-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
write/xcoff: add support. #482
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a few things that need fixing. I think there will also be more that needs fixing once you are actually using this. Have you used this to write any object files other than the one written by the test added in this PR?
Convert this PR to draft for now, since this PR will rebase on #484. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still a draft?
@philipc Thanks a lot for your comment and I apologize for my late reply as I was on vacation last month. I just post a PR rust-lang/rust#107583 to support metadata on AIX, which is related to this PR, specifically the C_INFO symbol here. |
2. implement a new function symbol_address_by_name().
I think this is good to merge once CI is passing, so please continue working on fixes for that. |
Thank you for your review. Checks are clean now. |
Hi @philipc , what abstraction level do we expect from object crate? Is it user's responsibility to make the final object file legal? |
The object crate will never be able to ensure that the final object is 100% legal. We rely on the user to have knowledge about the file formats and what they require. For the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I'll merge this soon. Before doing a release I will also do a bit more validation myself, and complete some other unrelated work.
Thanks @philipc , I'll also validate this PR via bootstrapping rustc on AIX. I'll get it done as soon as possible. |
src/write/xcoff.rs
Outdated
} | ||
} | ||
} else { | ||
return Err(Error(format!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is situation we have a symbol with kind SymbolSection::Undefined
, we will set n_scnum
to N_UNDEF
in line 378. This situation should be valid in XCOFF's view.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've verify the PR via bootstrapping rustc 1.70.0-dev on AIX. Current implementation looks good to me.
@@ -119,6 +119,21 @@ pub trait Object<'data: 'file, 'file>: read::private::Sealed { | |||
/// Returns an error if the index is invalid. | |||
fn symbol_by_index(&'file self, index: SymbolIndex) -> Result<Self::Symbol>; | |||
|
|||
/// Get the address of symbol named `symbol_name`, if such a symbol exists. | |||
fn symbol_address_by_name(&'file self, symbol_name: &str) -> Result<u64> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I overlooked the addition of this when reviewing. It didn't really belong in this PR, and I'm not confident that this is an API we want to support because it seems too specialized to me, so I'm going to remove it again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it seems quite specific, however the function is going to be called in https://github.com/rust-lang/rust/pull/107583/files#diff-6bbf6edd930f26d3b180eb5c250b0e48d8f3c5eb474e3274909ef6ae6f0d1e61R109
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since rust-lang/rust#107583 is not landed yet, we can still look for a solution without these new APIs. And as I asked in #482 (comment) and @philipc answered in #482 (comment), we can still use existing APIs and our knowledge of XCOFF to get the work done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I have no objection to removing this function.
No description provided.