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]

[BFD]Don't create got section while processing TLS Local Exec relocations.


Hi all,

For Local Exec TLS model, the offset of the variable from the thread pointer
can be computed at static link time. This doesn't require GOT indirection.


The initial change is a bad fix for a problem during TLS GD -> LE relaxation.

TLS GD in large memory model requires to initialize gp register by loading the
address from literal pool. And this will generate a symbol reference to _GLOBAL_OFFSET_TABLE_.

          ldr     x1, .Lgot
          adr     x2, .Lgot
          add     x1, x2, x1

          movz    x0, #:tlsgd_g1:var
          movk    x0, #:tlsgd_g0_nc:var
          add     x0, x1, x0
          bl      __tls_get_addr
          nop

.Lgot:
          .dword _GLOBAL_OFFSET_TABLE_ - .


However, after the relaxation, the got section is not needed.
But we still have a reference to  _GLOBAL_OFFSET_TABLE_ left behind. This reference could not be removed.


The proper fix is to check whether _GLOBAL_OFFSET_TABLE_ is referenced, create got section if yes.
And the fix is already in the repository.


So I removed the wrong fix here (sorry!).
Okay to commit and backport to release branches?

bfd/ChangeLog:

2018-10-08  Renlin Li  <renlin.li@arm.com>

	* elfnn-aarch64.c (elfNN_aarch64_check_relocs): Don't create got
	section for Local Exec TLS model.



diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index b5fb25527f1069c2878885a1461d6b842546b870..99627c16900ae39da42f4b5b9eb146da75b1ac3f 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -7562,9 +7562,6 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info,
 	case BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC:
 	case BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21:
 	case BFD_RELOC_AARCH64_TLSLD_ADR_PREL21:
-	case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1:
-	case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1_NC:
-	case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G2:
 	  {
 	    unsigned got_type;
 	    unsigned old_got_type;




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