This is an archive of the discontinued LLVM Phabricator instance.

[lld] [AArch64] Initial TLSDESC relocations support
AbandonedPublic

Authored by zatrazz on Feb 17 2016, 5:34 AM.

Details

Reviewers
ruiu
rafael
Summary

Default Global Dynamic TLS relocation generation for AArch64 is done by
TLSDESC and TLSCALL / GNU2 tls and for shared mode it requires creating
dynamic R_AARCH64_TLSDESC relocations.

This patch adds initial support for TLSDESC relocation for AArch64. On
TargetInfo class a new hook is added, isTlsGlobalDescDynamicRel, to
indicate the TLS GD should be handled a TLSDESC one and special
handling and dynamic relocation generation is added on
handleTlsRelocation.

No relax optimization is added and there is room to some optimizations.
Along with 'Fix R_AARCH64_ABS64 in Shared mode' [1] patch I could
bootstrap lld and run all the tests withouth failure.

[1] http://reviews.llvm.org/D17265

Diff Detail

Event Timeline

zatrazz updated this revision to Diff 48179.Feb 17 2016, 5:34 AM
zatrazz retitled this revision from to [lld] [AArch64] Initial TLSDESC relocations support.
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 a subscriber: llvm-commits.
rafael edited edge metadata.Feb 19 2016, 12:52 PM

I have a applied this patch locally and I am giving it a try.

ELF/Target.cpp
1226

Are all of these needed? At least on X86_64 the _CALL one is just a marker for relaxations. I would expect it to be just a hint in here too.

rafael added inline comments.Feb 19 2016, 1:46 PM
test/ELF/aarch64-tls-tlsdesc.s
4

This file has windows line endings.

rafael added inline comments.Feb 19 2016, 2:04 PM
test/ELF/aarch64-tls-tlsdesc.s
14

Please add

#RELOC-NEXT: }
#RELOC-NEXT: ]

to make sure we are looking at all the relocations.

18

Please add the expression that computes 144.

grimar added a subscriber: grimar.Feb 21 2016, 12:13 AM

I think such relocations requires special PLT entry. Also they seems need DT_TLSDESC_GOT and DT_TLSDESC_PLT dynamic entries to be created.
I rebased my old patch that implements all that (http://reviews.llvm.org/D16201).

That is quite a bit bigger patch. My preference would be to finish
this one first and then rebase yours on top.

grimar added inline comments.Feb 24 2016, 8:42 AM
ELF/Target.cpp
1485

I would add some comment here.

ELF/Target.h
92

I dont think you want '= 0' here, we dont initialize other relocation fields.

ELF/Writer.cpp
276

No need in this empty line.

zatrazz abandoned this revision.Feb 25 2016, 8:02 AM

I am seeing a lot of issues with this patch after rebase. I will abandon it and work based on http://reviews.llvm.org/D16201.