Page MenuHomePhabricator

[RISCV] Add missing emulated TLS support
Needs ReviewPublic

Authored by brad on May 14 2021, 1:14 PM.

Details

Summary

While getting OpenBSD/riscv64 up and running it was noticed that this bit of code to enable emulated TLS was missing from the RISC-V backend.

Diff Detail

Unit TestsFailed

TimeTest
2,570 msx64 debian > libarcher.races::lock-unrelated.c
Script: -- : 'RUN: at line 13'; /mnt/disks/ssd0/agent/llvm-project/build/./bin/clang -fopenmp -pthread -fno-experimental-isel -g -O1 -fsanitize=thread -I /mnt/disks/ssd0/agent/llvm-project/openmp/tools/archer/tests -I /mnt/disks/ssd0/agent/llvm-project/build/projects/openmp/runtime/src -L /mnt/disks/ssd0/agent/llvm-project/build/lib -Wl,-rpath,/mnt/disks/ssd0/agent/llvm-project/build/lib /mnt/disks/ssd0/agent/llvm-project/openmp/tools/archer/tests/races/lock-unrelated.c -o /mnt/disks/ssd0/agent/llvm-project/build/projects/openmp/tools/archer/tests/races/Output/lock-unrelated.c.tmp -latomic && env TSAN_OPTIONS='ignore_noninstrumented_modules=0:ignore_noninstrumented_modules=1' /mnt/disks/ssd0/agent/llvm-project/openmp/tools/archer/tests/deflake.bash /mnt/disks/ssd0/agent/llvm-project/build/projects/openmp/tools/archer/tests/races/Output/lock-unrelated.c.tmp 2>&1 | tee /mnt/disks/ssd0/agent/llvm-project/build/projects/openmp/tools/archer/tests/races/Output/lock-unrelated.c.tmp.log | /mnt/disks/ssd0/agent/llvm-project/build/./bin/FileCheck /mnt/disks/ssd0/agent/llvm-project/openmp/tools/archer/tests/races/lock-unrelated.c

Event Timeline

brad created this revision.May 14 2021, 1:14 PM
brad requested review of this revision.May 14 2021, 1:14 PM

Why should we bother to support this? Emulated TLS should die, not be supported by new architectures, IMO. We've had properly-defined TLS from the start.

brad added a comment.May 14 2021, 1:18 PM

OpenBSD requires the emulated TLS support.

You should really implement proper TLS. Emulated TLS is a lazy, inefficient hack.

+1. Please implement proper ELF TLS and drop reliance on emulated TLS. libclang_rt.builtins-$arch.a has some improper libc calls (e.g. malloc) just because of emutls.

I think we will soon be able to eliminate emutls in the LLVM code base.