Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[llvm-objdump] Print out xcoff load section of xcoff object file with option private-headers #121226
base: main
Are you sure you want to change the base?
[llvm-objdump] Print out xcoff load section of xcoff object file with option private-headers #121226
Changes from 2 commits
cb20a6e
dce5109
2ecfb53
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 there a risk that the data won't be aligned in memory, such that on some architectures, reading the data will cause a failure?
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.
If I understand your question correctly. I wrote following test case and run , it do not crash. it looks the PowerPC do not need to be alignment on the memory in when reading the data.
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, I think you understood the question correctly, but you've missed the fact that this code could be run on non-PowerPC architectures, which is where my concern lies. See issues like #95811 for examples.
In this case, perhaps we should check that
LoaderSectionAddr
is appropriately aligned and emit an error if it isn't. Alternatively, we can simply do amemcpy
of the raw data into a local copy ofLoaderSectionHeader[64|32]
, so that the data is guaranteed to be aligned. I think either approach is valid, since it's probably a requirement (either explicitly, or indirectly implied by other aspects of the spec) of the XCOFF spec thatLoaderSectionAddr
is aligned.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 think it only happen when compile with option
-mstrict-align
on theAArch64
, I do not think llvm compile the llvm-objdump with option-mstrict-align
.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 seen issues fixed in LLVM because of alignment problems, flagged by build bots. The issue I filed was just one possible example. Another example: 8fbe1e7.
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 a lot of
reinterpret_cast
orstatic_cast
in the XCOFFObjectFile.cpp/Archive.cpp etc. it will have the same problem if there is.I think if we want to fix the problem we need to have underlying API to deal with the problem for whole the llvm in a separate patch instead of using
memcpy
one by one.