Conversation
philipc
left a comment
There was a problem hiding this comment.
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. |
|
@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 |
philipc
left a comment
There was a problem hiding this comment.
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.
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.
bzEq
left a comment
There was a problem hiding this comment.
I've verify the PR via bootstrapping rustc 1.70.0-dev on AIX. Current implementation looks good to me.
| 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.
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.
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.
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.
Ok, I have no objection to removing this function.
No description provided.