llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.1k stars 11.6k forks source link

[AArch64] ELF TLS only supported in small memory model or in local exec TLS model #54713

Open Jianghibo opened 2 years ago

Jianghibo commented 2 years ago

When I was compiling llvm-test-suite(release/12.x) with -DCMAKE_C_FLAGS="-mtls-size=48 -mcmodel=large" -DCMAKE_CXX_FLAGS="-mtls-size=48 -mcmodel=large", I ran into a error.

image


The error occurred when compiling the following file. clang++ -DHAVE_POSIX_REGEX -DHAVE_STD_REGEX -DHAVE_STEADY_CLOCK -DNDEBUG -I/home/jianghaibo/llvm-test-suite/MicroBenchmarks/libs/benchmark-1.3.0/include -I/home/jianghaibo/llvm-test-suite/MicroBenchmarks/libs/benchmark-1.3.0/src -I/home/jianghaibo/llvm-test-suite/MicroBenchmarks/libs/benchmark-1.3.0/src/../include -mtls-size=48 -mcmodel=large -std=c++11 -Wall -Wextra -Wshadow -pedantic -pedantic-errors -Wshorten-64-to-32 -Wfloat-equal -fstrict-aliasing -Wzero-as-null-pointer-constant -Wstrict-aliasing -Wthread-safety -O0 -w -Werror=date-time -std=gnu++11 -o sysinfo.cc.o -c /home/jianghaibo/llvm-test-suite/MicroBenchmarks/libs/benchmark-1.3.0/src/sysinfo.cc

Is there any plan to support more scenarios?

Thanks!

MaskRay commented 2 years ago

-mtls-size=48 is irrelevant. The feature request is about large code model TLS for TLSDESC/Initial-Exec models on AArch64.

% cat a.cc
extern thread_local int x;
int foo() { return x; }
% clang++ --target=aarch64-linux-gnu -mcmodel=large -S -fno-pic a.cc  # -fpie and -fpic are similar
fatal error: error in backend: ELF TLS only supported in small memory model or in local exec TLS model
...

Please test the latest release for future bug reports/feature requests.

llvmbot commented 2 years ago

@llvm/issue-subscribers-backend-aarch64

Jianghibo commented 2 years ago

Does the latest release refer to test-suite or clang?