[PATCH] D112582: [ELF] Implement General Dynamic style TLSDESC for x86-32
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 26 16:58:01 PDT 2021
MaskRay created this revision.
MaskRay added reviewers: arichardson, zatrazz.
Herald added a subscriber: emaste.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Tested with:
cat > ./a.c <<eof
#include <stdio.h>
int foo();
int main() {
printf("%d\n", foo());
printf("%d\n", foo());
printf("%d\n", foo());
}
eof
cat > ./b.c <<eof
#include <stdio.h>
__thread int tls0;
extern __thread int tls1;
int foo() { return ++tls0 + ++tls1; }
eof
echo '__thread int tls1;' > ./c.c
sed 's/ /\t/' > ./Makefile <<'eof'
.MAKE.MODE = meta curDirOk=true
CC := gcc -m32 -g -fpic -mtls-dialect=gnu2
LDFLAGS := -m32 -Wl,-rpath=.
all: a0 a1 a2
run: all
./a0 && ./a1 && ./a2
c.so: c.o; ${LINK.c} -shared $> -o $@
bc.so: b.o c.o; ${LINK.c} -shared $> -o $@
b.so: b.o c.so; ${LINK.c} -shared $> -o $@
a0: a.o b.o c.o; ${LINK.c} $> -o $@
a1: a.o b.so; ${LINK.c} $> -o $@
a2: a.o bc.so; ${LINK.c} $> -o $@
eof
`/usr/local/bin/ld` points to the freshly built `lld`.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D112582
Files:
lld/ELF/Arch/X86.cpp
lld/ELF/InputSection.cpp
lld/ELF/Relocations.cpp
lld/ELF/Relocations.h
lld/test/ELF/i386-tlsdesc-gd.s
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112582.382487.patch
Type: text/x-patch
Size: 10437 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211026/2e973bed/attachment.bin>
More information about the llvm-commits
mailing list