This is an archive of the discontinued LLVM Phabricator instance.

[lld] [ELF/AArch64] Add GD to IE TLS relax optimization
AbandonedPublic

Authored by zatrazz on Mar 8 2016, 8:10 PM.

Details

Reviewers
ruiu
rafael
Summary

This patch add the TLS Global-Dynamic to Initial-Exec TLS optimization
for AArch64. Similar of GD to LE, the idea is to optimize TLS access
to global symbols that can preempted by emitting a GOT entry and
a dynamic relocation (R_AARCH64_TLS_TPREL64).

With this patch, the R_AARCH64_TLSDESC* implementation [1]
(still in review), and a small one for aarch64 to fix the relativeRel
definition (which I plan to send for review shortly) I can bootstrap
and run all the lld tests without failure.

Diff Detail

Event Timeline

zatrazz updated this revision to Diff 50102.Mar 8 2016, 8:10 PM
zatrazz retitled this revision from to [lld] [ELF/AArch64] Add GD to IE TLS relax optimization.
zatrazz updated this object.
zatrazz added reviewers: ruiu, rafael.
zatrazz set the repository for this revision to rL LLVM.
zatrazz added a project: lld.
zatrazz added subscribers: grimar, emaste, rengolin, llvm-commits.
grimar added a comment.Mar 9 2016, 1:11 AM

IMO that is cool if this helps to "bootstrap and run all the lld tests without failure" !

ELF/Target.cpp
1590

I think you missing ]

ldr     x1, [x0, #:tlsdesc_lo12:v ]

and "R_":

R_AARCH64_TLSDESC_ADD_LO12_NC
1591
.tlsdesccall    v
1598

Please remove the empty line.

1602

ditto.

1614

could you put return inside {...} to be consistent with other lld code ?

case R_AARCH64_TLSDESC_ADR_PAGE21: {
   // adrp
   uint64_t X = getAArch64Page(SA) - getAArch64Page(P);
   updateAArch64Addr(Loc, (X >> 12) & 0x1FFFFF); // X[32:12]
   return;
 }
1619–1621

ditto for break

1623

not sure why "Relocation" is uppercase.
I would write "Unsupported relocation for TLS GD to LE relaxation"

test/ELF/Inputs/aarch64-tls-ie.s
12

Why you do remove it in this patch ? its just excessive .text declaration it seems. I think it is not relative to the patch and should be fixed separatelly.

test/ELF/aarch64-tls-gdie.s
8

Not an issue actually, but we often put the REQUIRES to be the first line of test. That looks better IMO

11

Add a space here please "# Global-Dynamic..."

I will update a new patch with fixes for your comments.

ELF/Target.cpp
1590

Yeap, I will fix it.

1598

Ok.

1602

Ok.

1614

Ok.

1619–1621

Ok.

1623

Right, and the wording is wrong, it should be "TLS GD to IE". I will change that.

test/ELF/Inputs/aarch64-tls-ie.s
12

I just noted it is non required .text declaration and since it being used on the testcase being added to create the shared library I decided to cleanup this up. I can let as it and clean before or after this patch.

test/ELF/aarch64-tls-gdie.s
8

Right, I will change that.

11

Ok.

zatrazz updated this revision to Diff 50230.Mar 9 2016, 8:29 PM
zatrazz removed rL LLVM as the repository for this revision.

Updated patch based on previous comments.

ruiu added inline comments.Mar 9 2016, 10:11 PM
ELF/Target.cpp
1367

Please run clang-format-diff on this patch.

zatrazz updated this revision to Diff 50250.Mar 10 2016, 2:03 AM

Fix format issues.

zatrazz abandoned this revision.Mar 21 2016, 2:12 PM

Ping.

You abandoned this too.
Mistake ?