mirror of
https://github.com/rui314/mold.git
synced 2024-12-25 01:14:32 +03:00
30 lines
965 B
C
30 lines
965 B
C
// RUN: cc -ftls-model=local-dynamic -fPIC -c -o %t1.o %s
|
|
// RUN: echo '_Thread_local int foo = 3;' | cc -xc -c -fPIC -o %t2.o -
|
|
// RUN: mold -o %t.exe /usr/lib/x86_64-linux-gnu/crt1.o \
|
|
// RUN: /usr/lib/x86_64-linux-gnu/crti.o \
|
|
// RUN: /usr/lib/gcc/x86_64-linux-gnu/9/crtbegin.o \
|
|
// RUN: %t1.o %t2.o \
|
|
// RUN: /usr/lib/gcc/x86_64-linux-gnu/9/libgcc.a \
|
|
// RUN: /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 \
|
|
// RUN: /lib/x86_64-linux-gnu/libc.so.6 \
|
|
// RUN: /usr/lib/x86_64-linux-gnu/libc_nonshared.a \
|
|
// RUN: /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 \
|
|
// RUN: /usr/lib/gcc/x86_64-linux-gnu/9/crtend.o \
|
|
// RUN: /usr/lib/x86_64-linux-gnu/crtn.o
|
|
// RUN: %t.exe | grep '3 5 3 5'
|
|
|
|
#include <stdio.h>
|
|
|
|
extern _Thread_local int foo;
|
|
static _Thread_local int bar;
|
|
|
|
int *get_foo_addr() { return &foo; }
|
|
int *get_bar_addr() { return &bar; }
|
|
|
|
int main() {
|
|
bar = 5;
|
|
|
|
printf("%d %d %d %d\n", *get_foo_addr(), *get_bar_addr(), foo, bar);
|
|
return 0;
|
|
}
|