llvm / llvm/llvm-project

[Aarch64 LLD] unknown relocation (550) linking -mtls-size=12 local-exec TLS

Open
#203,435 0 comments 0 reactions 0 assignees View on GitHub
lld
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

```c
static __thread void *tls_probe __attribute__((tls_model("local-exec")));
void _start(void) { tls_probe = &tls_probe; }
```
```bash
$ clang -mtls-size=12 -fpie -c tls.c -o tls.o # OK
$ llvm-readobj -r tls.o | grep -i tprel
0x4 R_AARCH64_TLSLE_ADD_TPREL_LO12 tls_probe 0x0
$ clang -mtls-size=12 -fpie -pie -nostdlib -fuse-ld=lld tls.c -o tls.elf
ld.lld: error: tls.o:(function _start: .text+0x4): unknown relocation (550) against symbol tls_probe
$ clang -fpie -pie -nostdlib -fuse-ld=lld tls.c -o tls.elf # ok, no mtls-size
$ clang -mtls-size=12 -fpie -pie -nostdlib tls.c -o tls.elf # ok, gnu ld
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.