android-riscv64 icon indicating copy to clipboard operation
android-riscv64 copied to clipboard

bionic/: implement TLSDESC (Documented in psabi; implemented in llvm)

Open enh-google opened this issue 2 years ago • 4 comments

risc-v is the first Android ABI to ship after we added ELF TLS support. emutls doesn't even seem to work (with LLVM at least) for risc-v, but we can't go straight to using TLSDESC relocations because they haven't been standardized for risc-v yet. blocked on https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/94 getting some traction.

enh-google avatar Jan 30 '23 20:01 enh-google

What is the current status of TLS support? Recently, llvm received a fix for emulate_tls on RISC-V. But in AOSP emulate_tls is currently disabled on RISC-V, it seems the traditional GD/LD TLS mode is being used; and it appears that someone in the community has started to support TLS DESC in llvm so all that's needed going forward is to update the tools and enable relocation support in Bionic once llvm support is available?

MaoHan001 avatar Mar 22 '23 08:03 MaoHan001

What is the current status of TLS support? Recently, llvm received a fix for emulate_tls on RISC-V. But in AOSP emulate_tls is currently disabled on RISC-V, it seems the traditional GD/LD TLS mode is being used;

correct. we don't want to use emutls for rv64 --- we'll use the best option available, which is currently the one you mention.

and it appears that someone in the community has started to support TLS DESC in llvm so all that's needed going forward is to update the tools and enable relocation support in Bionic once llvm support is available?

yeah, i'm excited to see some progress on that. the bionic work will be easy+quick once the details are fixed. (i'm assuming the same will be true for llvm too, given that other architectures already support it.)

but for now we're blocked on the TLS DESC psabi proposal.

enh-google avatar Mar 22 '23 15:03 enh-google

Reference to sourceware implementation: https://inbox.sourceware.org/binutils/DS7PR12MB576522B309E27EBA26708A85CB1BA@DS7PR12MB5765.namprd12.prod.outlook.com/T/

appujee avatar Sep 14 '23 18:09 appujee

Support for RISC-V TLSDESC Relocations has landed in llvm: https://github.com/llvm/llvm-project/pull/66916 Thanks to @ilovepi and @MaskRay

appujee avatar May 08 '24 17:05 appujee