This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [PATCH][Binutils][AArch64] When DF_BIND_NOW don't use TLSDESC GOT value.


Hi All,

I will post a slight modification on Monday after all checks finish for an small thing I noticed after sending this out.

Please hold on review until then.

Thanks,
Tamar

> -----Original Message-----
> From: binutils-owner@sourceware.org <binutils-owner@sourceware.org>
> On Behalf Of Tamar Christina
> Sent: Friday, March 29, 2019 18:58
> To: binutils@sourceware.org
> Cc: nd <nd@arm.com>; Richard Earnshaw <Richard.Earnshaw@arm.com>;
> Marcus Shawcroft <Marcus.Shawcroft@arm.com>
> Subject: [PATCH][Binutils][AArch64] When DF_BIND_NOW don't use
> TLSDESC GOT value.
> 
> Hi All,
> 
> When using DF_BIND_NOW on AArch64 we don't reserve the GOT slot for a
> TLSDESC, but we still emitted DT_TLSDESC_GOT and DT_TLSDESC_PLT.  This
> caused random memory corruption as the "special" value of (bfd_vma)-1
> would be set for dt_tlsdesc_got.
> 
> Since we don't have a value of dt_tlsdesc_got I also don't emit
> DT_TLSDESC_PLT now becuase it would point to an incomplete PLT. To be
> able to write the PLT entry DT_TLSDESC_GOT is needed and since we don't
> have one we can't write the PLT entry either.
> 
> It is my understanding that GLIBC doesn't need these two entries when not
> lazy loading.  Conversely AArch32 does not reserve neither the GOT not the
> PLT slot when doing DF_BIND_NOW.
> 
> AArch32 does not need these checks because these values are initialized to 0
> and so the if (...) checks don't pass, but on AArch64 these are initialized to
> (bfd_vma)-1 and thus we need some extra checks.
> 
> build on native hardware and regtested on
>   aarch64-none-elf, aarch64-none-elf (32 bit host),
>   aarch64-none-linux-gnu, aarch64-none-linux-gnu (32 bit host)
> 
> Cross-compiled and regtested on
>   aarch64-none-linux-gnu, aarch64_be-none-linux-gnu
> 
> and no issues, also fixes 3 other linker testcases.
> 
> Ok for master? and for backport to binutils-2.32?
> 
> Thanks,
> Tamar
> 
> bfd/ChangeLog:
> 
> 2019-03-29  Tamar Christina  <tamar.christina@arm.com>
> 
> 	PR ld/24302
> 	* elfnn-aarch64.c (elfNN_aarch64_size_dynamic_sections): Don't
> emit
> 	DT_TLSDESC_GOT and DT_TLSDESC_PLT when DF_BIND_NOW.
> 	(elfNN_aarch64_finish_dynamic_sections): Don't write PLT if
> DF_BIND_NOW.
> 
> ld/ChangeLog:
> 
> 2019-03-29  Tamar Christina  <tamar.christina@arm.com>
> 
> 	PR ld/24302
> 	* testsuite/ld-aarch64/aarch64-elf.exp: Add new test.
> 	* testsuite/ld-aarch64/tls-relax-gdesc-le-now.d: New test.
> 
> --

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]