This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Add support for -emit-reloc
ClosedPublic

Authored by sbc100 on May 24 2019, 4:00 AM.

Details

Summary

This can be useful for post-link tools and for testing. Sometimes
it can be useful to produces a regular executable but with relocations
preserved.

Diff Detail

Repository
rLLD LLVM Linker

Event Timeline

sbc100 created this revision.May 24 2019, 4:00 AM
sbc100 retitled this revision from [WebAssembly] Add support for -emit-reloc to [WebAssembly] Add support for -emit-relocs.May 24 2019, 4:06 AM
sbc100 edited reviewers, added: ruiu; removed: espindola.
sbc100 updated this revision to Diff 201188.May 24 2019, 4:06 AM
sbc100 retitled this revision from [WebAssembly] Add support for -emit-relocs to [WebAssembly] Add support for -emit-reloc.
sbc100 removed a reviewer: ruiu.
  • cleanup
sbc100 updated this revision to Diff 201198.May 24 2019, 4:57 AM
  • only include live syms
ruiu accepted this revision.May 24 2019, 5:33 AM
ruiu added a subscriber: ruiu.

LGTM

But I wonder what kind of tools need this flag in the wasm ecosystem. As far as I know, in the ELF world, Linux kernel is using this, but that is not an ordinary program.

This revision is now accepted and ready to land.May 24 2019, 5:33 AM

My motivation is mostly for testing purposes. I want to be able to include reloc information in the output without going for --relocatable .. mostly so objdump can tell me a little more about the output file. If you think thats not a good enough motivation I could reconsider.

Specifically I want to use in https://reviews.llvm.org/D62380.

Once we have better objdump -d support this might not be necessary.

ruiu added a comment.May 24 2019, 5:50 AM

All the existing use cases of the feature is somewhat tricky. But if you already have --relocatable, implementing --emit-relocs is pretty easy as you demonstrated. So, it's up to you, but I'd perhaps just submit this.

This revision was automatically updated to reflect the committed changes.