This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [gold][aarch64]Patch to support 2 TLSLD relocations and change _TLS_MODULE_BASE_
- From: Cary Coutant <ccoutant at gmail dot com>
- To: Jing Yu <jingyu at google dot com>
- Cc: binutils <binutils at sourceware dot org>, Cary Coutant <ccoutant at google dot com>, Han Shen <shenhan at google dot com>, Doug Kwan <dougkwan at google dot com>
- Date: Mon, 30 Mar 2015 12:03:48 -0700
- Subject: Re: [gold][aarch64]Patch to support 2 TLSLD relocations and change _TLS_MODULE_BASE_
- Authentication-results: sourceware.org; auth=none
- References: <CAJ_rGWSBBacfKYTk_BrL_MqSH19PJ3MufxQ7RiKf6R=u6zM9Xg at mail dot gmail dot com>
> Also, in order to make LLVM generated code work, I always let
> _TLS_MODULE_BASE_ point to the beginning of TLS segment. The LLVM
> generated code directly uses _TLS_MODULE_BASE_ symbol, assuming it
> always points to the beginning of TLS segment.
>
> Without this patch, _TLS_MODULE_BASE_ pointed to the end of TLS
> segment if generating executable. This behavior was copied from gold
> x86 backend and arm backend, when I initially wrote this piece of
> code. Now I think maybe I was wrong. x86 does this way because @DTPOFF
> has historically been relaxed in main executables. There is no such a
> history on aarch64 backend. TLSLD_*_DTPREL relocations haven't been
> supported by bfd ld linker so far. I think as long as the calculation
> is consistent in gold, we are fine. If you have different opinion,
> please let me know.
Sounds good to me.
> 2015-03-28 Jing Yu <jingyu@google.com>
>
> * aarch64-reloc.def: New TLSLD_ADD_DTPREL_HI12,
> TLSLD_ADD_DTPREL_LO12_NC.
> * aarch64.cc (Target_aarch64::define_tls_base_symbol): Always let
> _TLS_MODULE_BASE_ point to the start of tls segment.
> (Target_aarch64::optimize_tls_reloc): Add cases for
> R_AARCH64_TLSLD_ADD_DTPREL_HI12 and
> R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC.
> (Target_aarch64::Scan::local): Likewise.
> (Target_aarch64::Scan::global): Likewise.
> (Target_aarch64::Relocate::relocate): Likewise.
> (Target_aarch64::Relocate::relocate_tls): Likewise. And remove
> subtracting tls segment size from symbol value for TLSLD_*_DTPREL
> relocations.
This is OK for trunk. Thanks!
Note that the long lines in aarch64-reloc.def got wrapped by the mail
system. It's probably best in the future to send the patch as an
attachment.
-cary