[llvm] b847859 - [jitlink] Updating test file for GOT relocations for elf x86

Jared Wyles via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 21 00:20:33 PDT 2020


Author: Jared Wyles
Date: 2020-07-21T17:19:48+10:00
New Revision: b847859f379146a3c5df8dcd959b7635282ae4b7

URL: https://github.com/llvm/llvm-project/commit/b847859f379146a3c5df8dcd959b7635282ae4b7
DIFF: https://github.com/llvm/llvm-project/commit/b847859f379146a3c5df8dcd959b7635282ae4b7.diff

LOG: [jitlink] Updating  test file for GOT relocations for elf x86

Added: 
    

Modified: 
    llvm/test/ExecutionEngine/JITLink/X86/ELF_x86-64_relocations.s

Removed: 
    


################################################################################
diff  --git a/llvm/test/ExecutionEngine/JITLink/X86/ELF_x86-64_relocations.s b/llvm/test/ExecutionEngine/JITLink/X86/ELF_x86-64_relocations.s
index 0eee9a449cea..ca9c926b32de 100644
--- a/llvm/test/ExecutionEngine/JITLink/X86/ELF_x86-64_relocations.s
+++ b/llvm/test/ExecutionEngine/JITLink/X86/ELF_x86-64_relocations.s
@@ -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, at function
+        .type   test_pcrel32, at 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, at function
+test_gotpcrel:
+	movl    named_data at GOTPCREL(%rip), %eax
+.Lend_test_gotpcrel:
+        .size   test_gotpcrel, .Lend_test_gotpcrel-test_gotpcrel
 
         .type   named_data, at 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","", at progbits
-        .addrsig
+        .addrsig
\ No newline at end of file


        


More information about the llvm-commits mailing list