Skip to content
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

Merged
merged 2 commits into from
Apr 26, 2017

Conversation

sbc100
Copy link
Member

@sbc100 sbc100 commented Apr 25, 2017

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)

sbc100 added 2 commits April 25, 2017 14:48
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;
Copy link
Member

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.

Copy link
Member Author

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)
Copy link
Member

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?

Copy link
Member Author

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?

Copy link
Member Author

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)

Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sbc100 sbc100 merged commit 27b992d into master Apr 26, 2017
@sbc100 sbc100 deleted the objdump_improve branch April 26, 2017 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants