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

thin LTO + wasm + _Thread_local + -pthread doesn't work well #91711

Open
yamt opened this issue May 10, 2024 · 2 comments
Open

thin LTO + wasm + _Thread_local + -pthread doesn't work well #91711

yamt opened this issue May 10, 2024 · 2 comments
Labels
LTO Link time optimization (regular/full LTO or ThinLTO)

Comments

@yamt
Copy link
Contributor

yamt commented May 10, 2024

a test code: https://github.com/yamt/garbage/tree/1deee3044926115ca949e4cc7056da819c118663/lto3

symptom:

% ./build.sh
+ CC='/opt/wasi-sdk-22.0/bin/clang -Os -flto=thin -pthread -target wasm32-wasi-threads'
+ /opt/wasi-sdk-22.0/bin/clang -Os -flto=thin -pthread -target wasm32-wasi-threads -c a.c
+ /opt/wasi-sdk-22.0/bin/clang -Os -flto=thin -pthread -target wasm32-wasi-threads -c main.c
+ /opt/wasi-sdk-22.0/bin/clang -Os -flto=thin -pthread -target wasm32-wasi-threads main.o a.o
wasm-ld: error: --shared-memory is disallowed by lto.tmp because it was not compiled with 'atomics' or 'bulk-memory' features.
wasm-ld: error: lto.tmp: relocation R_WASM_MEMORY_ADDR_TLS_SLEB cannot be used against non-TLS symbol `x`
wasm-ld: error: lto.tmp: relocation R_WASM_MEMORY_ADDR_TLS_SLEB cannot be used against `x` in non-TLS section: .bss
clang: error: linker command failed with exit code 1 (use -v to see invocation)
% 

the same program works ok with -flto=full and w/o LTO.

the same symptom with Clang from LLVM 46435ac

@EugeneZelenko EugeneZelenko added LTO Link time optimization (regular/full LTO or ThinLTO) and removed new issue labels May 10, 2024
@EugeneZelenko
Copy link
Contributor

@teresajohnson

@teresajohnson
Copy link
Contributor

@MaskRay since this is coming from lld

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LTO Link time optimization (regular/full LTO or ThinLTO)
Projects
None yet
Development

No branches or pull requests

3 participants