summaryrefslogtreecommitdiff
path: root/bolt/test/R_ABS.pic.lld.cpp
blob: b1396209567e204deee8f042c55a68e2d1710bfc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
 * Check that we don't assert on a duplicate static relocation added by lld
 * against _Z6myfuncv. The same address has a dynamic relocation against it.
 *
 * This test uses the clang driver + lld and will only succeed on Linux systems
 * with libc available.
 * REQUIRES: system-linux
 *
 * RUN: %clang %cflags -fPIC -shared %s -o %t.so -Wl,-q -fuse-ld=lld
 * RUN: llvm-bolt %t.so -o %t.so.bolt --relocs
 */

unsigned long long myfunc();

unsigned long long (*myglobal)() = myfunc;

unsigned long long myfunc() {
  return reinterpret_cast<unsigned long long>(myglobal);
}