Renlin Li
2018-10-12 16:09:06 UTC
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 <***@arm.com>
* elfnn-aarch64.c (elfNN_aarch64_check_relocs): Don't create got
section for Local Exec TLS model.
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 <***@arm.com>
* elfnn-aarch64.c (elfNN_aarch64_check_relocs): Don't create got
section for Local Exec TLS model.