Page MenuHomePhabricator

ELF/AArch64: Fix dynamic relocation against local symbol in shared objects
ClosedPublic

Authored by zatrazz on Dec 13 2016, 6:41 AM.

Details

Summary

ELF/AArch64: Fix dynamic relocation against local symbol in
shared objects

static thread int32_t x1;
static
thread int64_t x2;

int32_t foo1 (int32_t x)
{

x1 += x;
return x;

}

int64_t foo2 (int64_t x)
{

x2 += x;
return x;

}

The dynamic relocation should be create as:

Relocations [

Section (N) .rela.dyn {
  <Address1> R_AARCH64_TLSDESC - 0x0
  <Address2> R_AARCH64_TLSDESC - 0x8
}

]

Where 0x0 addend in first dynamic relocation is the address of 'x1'
in TLS block and '0x8' is the address of 'x2'.

Checked against test-suite on aarch64-linux-gnu.

Diff Detail

Event Timeline

zatrazz updated this revision to Diff 81229.Dec 13 2016, 6:41 AM
zatrazz retitled this revision from to ELF/AArch64: Fix dynamic relocation against local symbol in shared objects.
zatrazz updated this object.
zatrazz added reviewers: rui314, rafael, rengolin.
zatrazz set the repository for this revision to rL LLVM.
zatrazz added a project: lld.
zatrazz added a subscriber: llvm-commits.
zatrazz edited reviewers, added: ruiu; removed: rui314.Dec 13 2016, 6:42 AM
ruiu edited edge metadata.Dec 15 2016, 1:26 PM

Looks like Rafael made a comment?

In D27711#624244, @ruiu wrote:

Looks like Rafael made a comment?

Did he? I am not seeing it on phabricator. Did he reply to the message directly?

zatrazz updated this revision to Diff 81737.Dec 16 2016, 4:29 AM
zatrazz edited edge metadata.
zatrazz removed rL LLVM as the repository for this revision.

Updated patch based on previous comments.

ruiu accepted this revision.Dec 16 2016, 9:15 AM
ruiu edited edge metadata.

LGTM

This revision is now accepted and ready to land.Dec 16 2016, 9:15 AM
zatrazz closed this revision.Dec 19 2016, 5:24 AM