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

Renlin Li renlin.li@foss.arm.com
Fri Oct 12 16:09:00 GMT 2018

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

           .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?


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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: path-diff.patch
Type: text/x-patch
Size: 626 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20181012/866e5dcb/attachment.bin>

More information about the Binutils mailing list