[llvm] 1237d94 - [JITLink] Add support for STT_NOTYPE symbols to ELF/x86-64.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 9 20:41:56 PST 2021


Author: Lang Hames
Date: 2021-03-09T20:40:24-08:00
New Revision: 1237d94871ceb111c4eaef131095e12b6ae93647

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

LOG: [JITLink] Add support for STT_NOTYPE symbols to ELF/x86-64.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp b/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp
index 5a0c8976cf51..f81e67421c1b 100644
--- a/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp
@@ -596,8 +596,8 @@ class ELFLinkGraphBuilder_x86_64 {
         }
 
         if (SymRef.isDefined() &&
-            (Type == ELF::STT_FUNC || Type == ELF::STT_OBJECT ||
-             Type == ELF::STT_SECTION)) {
+            (Type == ELF::STT_NOTYPE || Type == ELF::STT_FUNC ||
+             Type == ELF::STT_OBJECT || Type == ELF::STT_SECTION)) {
 
           auto DefinedSection = Obj.getSection(SymRef.st_shndx);
           if (!DefinedSection)

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 eada709cfe3f..c2039bd64264 100644
--- a/llvm/test/ExecutionEngine/JITLink/X86/ELF_x86-64_relocations.s
+++ b/llvm/test/ExecutionEngine/JITLink/X86/ELF_x86-64_relocations.s
@@ -106,8 +106,18 @@ test_rex_gotpcrelx:
 
         .size   test_rex_gotpcrelx, .-test_rex_gotpcrelx
 
-        .type   named_data, at object
+# Test that relocations to anonymous constant pool entries work.
+        .globl  test_anchor_LCPI
+        .p2align        4, 0x90
+        .type   test_anchor_LCPI, at function
+test_anchor_LCPI:
+        movq    .LCPI0_0(%rip), %rax
+
+        .size   test_anchor_LCPI, .-test_anchor_LCPI
+
         .data
+
+        .type   named_data, at object
         .p2align        3
 named_data:
         .quad   42
@@ -124,6 +134,12 @@ bss_variable:
 	.long	0
 	.size	bss_variable, 4
 
+# Constant pool entry with type STT_NOTYPE.
+        .section        .rodata.cst8,"aM", at progbits,8
+        .p2align        3
+.LCPI0_0:
+        .quad   0x400921fb54442d18
+
         .ident  "clang version 10.0.0-4ubuntu1 "
         .section        ".note.GNU-stack","", at progbits
         .addrsig


        


More information about the llvm-commits mailing list