[jitlink] Updating test file for GOT relocations for elf x86
authorJared Wyles <jared.wyles@gmail.com>
Tue, 21 Jul 2020 07:19:48 +0000 (17:19 +1000)
committerJared Wyles <jared.wyles@gmail.com>
Tue, 21 Jul 2020 07:19:48 +0000 (17:19 +1000)
llvm/test/ExecutionEngine/JITLink/X86/ELF_x86-64_relocations.s

index 0eee9a4..ca9c926 100644 (file)
@@ -1,5 +1,5 @@
 # RUN: rm -rf %t && mkdir -p %t
-# RUN: llvm-mc -triple=x86_64-unknown-linux -filetype=obj -o %t/elf_reloc.o %s
+# RUN: llvm-mc -triple=x86_64-unknown-linux -position-independent -filetype=obj -o %t/elf_reloc.o %s
 # RUN: llvm-jitlink -noexec -check %s %t/elf_reloc.o
 #
 # Test standard ELF relocations.
@@ -20,15 +20,27 @@ main:
 # jitlink-check: decode_operand(test_pcrel32, 4) = named_data - next_pc(test_pcrel32)
         .globl  test_pcrel32
         .p2align       4, 0x90
-        .type  test_pcrel32,@function
+        .type   test_pcrel32,@function
 test_pcrel32:
         movl    named_data(%rip), %eax
-.Ltest_pcrel32_end:
-        .size   test_pcrel32, .Ltest_pcrel32_end-test_pcrel32
+.Lend_test_pcrel32:
+         .size   test_pcrel32, .Lend_test_pcrel32-test_pcrel32
+
+# Test GOTPCREL handling. We want to check both the offset to the GOT entry and its
+# contents.
+# jitlink-check: decode_operand(test_gotpcrel, 4) = got_addr(elf_reloc.o, named_data) - next_pc(test_gotpcrel)
+# jitlink-check: *{8}(got_addr(elf_reloc.o, named_data)) = named_data
+
+        .globl test_gotpcrel
+        .p2align      4, 0x90
+        .type   test_gotpcrel,@function
+test_gotpcrel:
+       movl    named_data@GOTPCREL(%rip), %eax
+.Lend_test_gotpcrel:
+        .size   test_gotpcrel, .Lend_test_gotpcrel-test_gotpcrel
 
         .type   named_data,@object
         .data
-       .globl named_data
         .p2align        2
 named_data:
         .long   42
@@ -36,4 +48,4 @@ named_data:
 
         .ident  "clang version 10.0.0-4ubuntu1 "
         .section        ".note.GNU-stack","",@progbits
-        .addrsig
+        .addrsig
\ No newline at end of file