[PATCH] [lld] [ELF/AArch64] Fix local TLS relocations

Adhemerval Zanella adhemerval.zanella at linaro.org
Tue May 26 10:37:50 PDT 2015



On 26-05-2015 10:36, Shankar Kalpathi Easwaran wrote:
> ================
> Comment at: lib/ReaderWriter/ELF/AArch64/AArch64RelocationHandler.cpp:476-479
> @@ -475,6 +475,6 @@
>      break;
> -  case R_AARCH64_TLSLE_ADD_TPREL_HI12:
> -    return relocR_AARCH64_TLSLE_ADD_TPREL_HI12(loc, reloc, target, addend);
> -  case R_AARCH64_TLSLE_ADD_TPREL_LO12_NC:
> -    relocR_AARCH64_TLSLE_ADD_TPREL_LO12_NC(loc, reloc, target, addend);
> -    break;
> +  case R_AARCH64_TLSLE_ADD_TPREL_HI12: {
> +    _tlsSize = _layout.getAlignedTLSSize();
> +    return relocR_AARCH64_TLSLE_ADD_TPREL_HI12(loc, reloc, target + _tlsSize, addend);
> +  } case R_AARCH64_TLSLE_ADD_TPREL_LO12_NC: {
> +    _tlsSize = _layout.getAlignedTLSSize();
> ----------------
> can you move the case statement to a new line ?

Alright, I will change it.

> 
> ================
> Comment at: lib/ReaderWriter/ELF/AArch64/AArch64RelocationHandler.cpp:477
> @@ +476,3 @@
> +  case R_AARCH64_TLSLE_ADD_TPREL_HI12: {
> +    _tlsSize = _layout.getAlignedTLSSize();
> +    return relocR_AARCH64_TLSLE_ADD_TPREL_HI12(loc, reloc, target + _tlsSize, addend);
> ----------------
> Do relocations increase the size of the initial TLS image ? Confused.

The idea is to get the target address aligned to TLS alignment requirement (which
is 16 bytes for aarch64).  That's why the _tlsSize is 'changed' before send to the
relocation handler.

> 
> http://reviews.llvm.org/D10030
> 
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
> 
> 



More information about the llvm-commits mailing list