1// This test checks dynamic relocations support for aarch64. 2 3RUN: yaml2obj %p/Inputs/rels-so.yaml &> %t.so 4RUN: yaml2obj %p/Inputs/rels-exe.yaml &> %t.exe 5RUN: llvm-bolt %t.so -o %t.bolt.so --use-old-text=0 --lite=0 6RUN: llvm-bolt %t.exe -o %t.bolt.exe --use-old-text=0 --lite=0 7 8// Check relocations in library: 9 10RUN: llvm-readelf -rW %t.bolt.so | FileCheck %s -check-prefix=CHECKLIB 11 12CHECKLIB: {{.*}} R_AARCH64_GLOB_DAT {{.*}} a + 0 13CHECKLIB: {{.*}} R_AARCH64_TLSDESC {{.*}} t1 + 0 14CHECKLIB: {{.*}} R_AARCH64_ABS64 {{.*}} a + 0 15 16// Check relocations in executable: 17 18RUN: llvm-readelf -rW %t.bolt.exe | FileCheck %s -check-prefix=CHECKEXE 19 20CHECKEXE: {{.*}} R_AARCH64_TLS_TPREL64 {{.*}} t1 + 0 21CHECKEXE: {{.*}} R_AARCH64_COPY {{.*}} a + 0 22CHECKEXE: {{.*}} R_AARCH64_JUMP_SLOT {{.*}} inc + 0 23 24// Check traditional TLS relocations R_AARCH64_TLS_DTPMOD64 and 25// R_AARCH64_TLS_DTPREL64 emitted correctly after bolt. Since these 26// relocations are obsolete and clang and lld does not support them, 27// the initial binary was built with gcc and ld with -mtls-dialect=trad flag. 28 29RUN: yaml2obj %p/Inputs/tls-trad.yaml &> %t.trad.so 30RUN: llvm-bolt %t.trad.so -o %t.trad.bolt.so --use-old-text=0 --lite=0 31RUN: llvm-readelf -rW %t.trad.so | FileCheck %s -check-prefix=CHECKTRAD 32 33CHECKTRAD: {{.*}} R_AARCH64_TLS_DTPMOD64 {{.*}} t1 + 0 34CHECKTRAD: {{.*}} R_AARCH64_TLS_DTPREL64 {{.*}} t1 + 0 35 36// The ld linker emits R_AARCH64_TLSDESC to .rela.plt section, check that 37// it is emitted correctly. 38 39RUN: yaml2obj %p/Inputs/tls-ld.yaml &> %t.ld.so 40RUN: llvm-bolt %t.ld.so -o %t.ld.bolt.so --use-old-text=0 --lite=0 41RUN: llvm-readelf -rW %t.ld.bolt.so | FileCheck %s -check-prefix=CHECKLD 42 43CHECKLD: {{.*}} R_AARCH64_TLSDESC {{.*}} t1 + 0 44