简体   繁体   中英

How to compile rust with tpidr1 as thread local register

In bare-metal AArch64, rust generates tpidr0 as the default register for thread_local calculations. For scenarios like kernel, tpidr1 should be used instead of tpidr0 . How to make rust compiler generate code to use tpidr1 instead of the default?

LLVM support a custom attribute -mattr=tipdr-el[1|2|3] to override the thread local register.

By default, tipdr0 is used for this purpose. This can be overriden in rust by doing something like the following

rustc -C target-feature=tpidr-el1 --target=aarch64-unknown-none

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM