This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Use GeneralDynamic TLS for exception handling builtins.
ClosedPublic

Authored by sbc100 on Feb 12 2022, 6:39 AM.

Details

Summary

These global TLS symbols are shared across all shared libraries and
cannot be assumed to be local to the currently module.

Also add new error in the linker when TLS relocations are used against
undefined symbols. TLS relocations are offsets into the current modules
tls data segment, and don't make sense for undefined symbols which are
modeled as global imports.

Fixes: https://github.com/emscripten-core/emscripten/issues/13398

Diff Detail

Unit TestsFailed

Event Timeline

sbc100 created this revision.Feb 12 2022, 6:39 AM
sbc100 requested review of this revision.Feb 12 2022, 6:39 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 12 2022, 6:39 AM
sbc100 updated this revision to Diff 408189.Feb 12 2022, 9:37 AM
  • add lld error
sbc100 edited the summary of this revision. (Show Details)Feb 12 2022, 9:39 AM
sbc100 added a reviewer: dschuff.
sbc100 added a reviewer: aheejin.
sbc100 updated this revision to Diff 408256.Feb 13 2022, 6:56 AM
  • rebase
aheejin accepted this revision.EditedFeb 14 2022, 11:35 AM

These global TLS symbols are shared across all shared libraries and cannot be assumed to be local to the currently module.

Is there any other libraries other than compiler-rt with which these variables are shared?

Fixes: https://github.com/emscripten-core/emscripten/issues/1339

I think the link is incorrect? That issue is from 2013.

This revision is now accepted and ready to land.Feb 14 2022, 11:35 AM
sbc100 edited the summary of this revision. (Show Details)Feb 14 2022, 12:21 PM

These global TLS symbols are shared across all shared libraries and cannot be assumed to be local to the currently module.

Is there any other libraries other than compiler-rt with which these variables are shared?

No, as afar as I know system/lib/compiler-rt/emscripten_exception_builtins.c is the only place these get defined or used aside from in this code here.

Fixes: https://github.com/emscripten-core/emscripten/issues/1339

I think the link is incorrect? That issue is from 2013.

Oops I was missing an 8: https://github.com/emscripten-core/emscripten/issues/13398

This revision was landed with ongoing or failed builds.Feb 14 2022, 2:09 PM
This revision was automatically updated to reflect the committed changes.