This is an archive of the discontinued LLVM Phabricator instance.

[lld][WebAssembly] Apply relocations to TLS data
ClosedPublic

Authored by sbc100 on Jan 31 2023, 2:53 PM.

Details

Summary

This is only needed in the case of dynamic linking and pthreads.
Previously these relocations were simply not be applied.

Also verified that this works using a more real world emscripten test:
https://github.com/emscripten-core/emscripten/pull/18641

Diff Detail

Event Timeline

sbc100 created this revision.Jan 31 2023, 2:53 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 31 2023, 2:53 PM
Herald added subscribers: pmatos, asb, wingo and 4 others. · View Herald Transcript
sbc100 requested review of this revision.Jan 31 2023, 2:53 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 31 2023, 2:53 PM
sbc100 edited the summary of this revision. (Show Details)Jan 31 2023, 2:54 PM
sbc100 added a reviewer: dschuff.
sbc100 added inline comments.Jan 31 2023, 3:47 PM
lld/wasm/Symbols.cpp
312

This is perhaps a concerning change. The original line here was added without any test changes in: https://reviews.llvm.org/D112831. Its seems to lack test coverage although the new test I've add here adds coverage.

I also ran the entire emscripten test suite with this change to ensure this change doesn't break anything.

dschuff accepted this revision.Jan 31 2023, 3:48 PM
This revision is now accepted and ready to land.Jan 31 2023, 3:48 PM
dschuff added inline comments.Jan 31 2023, 3:50 PM
lld/wasm/Symbols.cpp
312

oh yeah I was going to ask, is that value getting moved to somewhere else. So this is used in exactly the case your new test covers, right? I guess it's no surprise that it was wrong, if the use case was also wrong in a different way, and nobody noticed before.

This revision was landed with ongoing or failed builds.Jan 31 2023, 3:51 PM
This revision was automatically updated to reflect the committed changes.