[PATCH] D27711: ELF/AArch64: Fix dynamic relocation against local symbol in shared objects

Adhemerval Zanella via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 13 06:41:57 PST 2016


zatrazz created this revision.
zatrazz added reviewers: rui314, rafael, rengolin.
zatrazz added a subscriber: llvm-commits.
zatrazz set the repository for this revision to rL LLVM.
zatrazz added a project: lld.
Herald added a subscriber: aemerson.

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.


Repository:
  rL LLVM

https://reviews.llvm.org/D27711

Files:
  ELF/Relocations.cpp
  ELF/Target.cpp
  ELF/Target.h
  test/ELF/aarch64-tlsdesc.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27711.81229.patch
Type: text/x-patch
Size: 4496 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161213/a6341cfb/attachment.bin>


More information about the llvm-commits mailing list