Skip to content
Commit 15cba9e7 authored by Adhemerval Zanella's avatar Adhemerval Zanella
Browse files

[lld] [ELF/AARCH64] Fix dynamic relocation from PIC GOT access

This patch fixes dynamic relocation creation from GOT access in dynamic
objects on aarch64. Current code creates a plt relative one
(R_AARCH64_JUMP_SLOT) instead of a got relative (R_AARCH64_GLOB_DAT).

It leads the programs fails with:

$ cat t.cc

std::string test = "hello...\n";

int main ()
{
  printf ("%s\n", test.c_str());
  return 0;
}
$ clang++ t.cc -fpic -o t
$ ./t
hello...

Segmentation fault (core dumped)

Due the fact it will try to access the plt instead of the got for
__cxa_atexit registration for the std::string destruction.  It will
lead in a bogus function address in atexit.

llvm-svn: 265784
parent 954ba21f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment