This is an archive of the discontinued LLVM Phabricator instance.

[lld][WebAssembly] Allow linking of PIC code into static binaries
ClosedPublic

Authored by sbc100 on Aug 7 2019, 7:53 PM.

Event Timeline

sbc100 created this revision.Aug 7 2019, 7:53 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 7 2019, 7:53 PM
sbc100 updated this revision to Diff 214059.Aug 7 2019, 8:07 PM

add __table_base

sbc100 retitled this revision from [lld][WebAssembly] Allow linking of pic code into static binaries to [lld][WebAssembly] Allow linking of PIC code into static binaries.Aug 7 2019, 8:07 PM
sbc100 added reviewers: kripken, sunfish.
ruiu added a subscriber: ruiu.Aug 8 2019, 12:51 AM
ruiu added inline comments.
lld/wasm/Relocations.cpp
43

nit: space not after but before *

kripken resigned from this revision.Aug 8 2019, 11:01 AM
kripken added a subscriber: tlively.

Nothing looks wrong to me here, but I don't know enough to fully understand it, sorry - like what the various indexes are, what a virtual address means here, etc.

Perhaps @tlively can take a look if we need a second reviewer, as he's worked on this code recently?

dschuff added inline comments.Aug 8 2019, 11:19 AM
lld/wasm/Driver.cpp
541

does this mean we create these symbols in the output even when not linking PIC code?

sbc100 updated this revision to Diff 214206.Aug 8 2019, 12:09 PM
sbc100 marked an inline comment as done.
  • clang-format
sbc100 marked an inline comment as done.Aug 8 2019, 12:10 PM
sbc100 added inline comments.
lld/wasm/Driver.cpp
541

Yes, they go from being imported global to local, globals with a fixed value. wasm-opt can then eliminate them completely. See the comment in addGOTEntry.

As a followup we could instead do linker relaxation to remove references to these.

sbc100 added a reviewer: ruiu.Aug 9 2019, 2:12 PM
sbc100 edited reviewers, added: dschuff; removed: kripken.
dschuff accepted this revision.Aug 12 2019, 3:39 PM
This revision is now accepted and ready to land.Aug 12 2019, 3:39 PM
This revision was automatically updated to reflect the committed changes.