tinycc/tests/tests2/146_tls_extern.c
Mounir IDRASSI 97a6d8c75f
Some checks failed
build and test / test-x86_64-linux (push) Has been cancelled
build and test / test-x86_64-osx (push) Has been cancelled
build and test / test-aarch64-osx (push) Has been cancelled
build and test / test-x86_64-win32 (push) Has been cancelled
build and test / test-i386-win32 (push) Has been cancelled
build and test / test-arm64-win32 (push) Has been cancelled
build and test / test-armv7-linux (push) Has been cancelled
build and test / test-aarch64-linux (push) Has been cancelled
build and test / test-riscv64-linux (push) Has been cancelled
build and test / test-i386-linux (push) Has been cancelled
tls: fix local-exec addresses and external symbols
Preserve symbolic offsets when materializing i386 TLS addresses, generate ARM64 TLS addresses from the thread pointer, and carry RISC-V addends on both halves of the TPREL relocation pair.

Keep undefined ELF TLS symbols typed as STT_TLS so objects produced by TCC can be linked by the system linker. Extend the TLS regression coverage for narrow signed and unsigned accesses, address-taking, runtime indexing, thread isolation, large RISC-V offsets, unsupported runtimes, and external TLS definitions.
2026-07-10 23:58:23 +09:00

23 lines
471 B
C

#include <stdio.h>
extern __thread signed short extern_tls_short;
extern __thread float extern_tls_float;
int main(void)
{
int errors = 0;
if (extern_tls_short != 1234 || extern_tls_float != 1.5f)
errors = 1;
extern_tls_short = -2222;
extern_tls_float = 2.5f;
extern_tls_float += 1.0f;
if (extern_tls_short != -2222 || extern_tls_float != 3.5f)
errors = 1;
printf("extern tls errors: %d\n", errors);
return errors;
}