-
Notifications
You must be signed in to change notification settings - Fork 726
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
Improve wasmdump output for relocations and data segments #406
Conversation
For data segments, print the file offsets so they match the file offsets shown when dumping relocations. For relocations, only show the addend when one is present and correctly display negative addends in the same way that objdump does (e.g. symbol_foo-0x10 and symbol_foo+0x10)
int32_t signed_addend = static_cast<int32_t>(addend); | ||
if (signed_addend < 0) { | ||
PrintDetails("-"); | ||
signed_addend = -signed_addend; |
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 this is UB when signed_addend is -0x80000000. Probably not possible to generate this case, though.
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.
ha! that would be quite an addend. Funny that we were just chatting about that exact case the other day.
@@ -44,11 +44,11 @@ Elem: | |||
Custom: | |||
- name: "reloc.Elem" | |||
- section: Elem | |||
- R_FUNC_INDEX_LEB idx=0 addend=0 offset=0x6(file=0x38) |
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.
no tests with a non-zero addend?
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.
Because we don't currently generate GLOBAL_ADDR relocations. I haven't found a way to represent them in the wast format. I guess we could use the binary builds to build them?
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.
Sorry I mean MEMORY_ADDR relocs. They are the only type with an addend ( https://github.com/WebAssembly/tool-conventions/blob/master/Linking.md)
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.
Hm, I guess I'm just concerned that this will break otherwise. But if there's no easy way to do it, I guess it's OK. Do you mind creating an issue for it though?
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.
For data segments, print the file offsets so they match
the file offsets shown when dumping relocations.
For relocations, only show the addend when one is present
and correctly display negative addends in the same way that
objdump does (e.g. symbol_foo-0x10 and symbol_foo+0x10)