[PATCH] D129754: [JITLink][COFF] Implement IMAGE_SYM_CLASS_LABEL.

Sunho Kim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 25 07:23:23 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGaef75aec3875: [JITLink][COFF] Implement IMAGE_SYM_CLASS_LABEL. (authored by sunho).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129754/new/

https://reviews.llvm.org/D129754

Files:
  llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.cpp
  llvm/test/ExecutionEngine/JITLink/X86/COFF_label.test


Index: llvm/test/ExecutionEngine/JITLink/X86/COFF_label.test
===================================================================
--- /dev/null
+++ llvm/test/ExecutionEngine/JITLink/X86/COFF_label.test
@@ -0,0 +1,61 @@
+# RUN: yaml2obj %s -o %t
+# RUN: llvm-jitlink -noexec \
+# RUN: -slab-allocate 100Kb -slab-address 0xfff00000 -slab-page-size 4096 \
+# RUN: -show-graph -noexec %t 2>&1 | FileCheck %s
+#
+# Check a label symbol with an offset is created as defined symbol.
+#
+# CHECK:   block 0xfff00000 size = 0x00000028, align = 16, alignment-offset = 0
+# CHECK-NEXT: symbols:
+# CHECK-NEXT:   0xfff00000 (block + 0x00000000): size: 0x00000013, linkage: strong, scope: default, live  -   main
+# CHECK-NEXT:   0xfff00013 (block + 0x00000013): size: 0x00000015, linkage: strong, scope: local, live  -   $LN4
+
+--- !COFF
+header:
+  Machine:         IMAGE_FILE_MACHINE_AMD64
+  Characteristics: [  ]
+sections:
+  - Name:            '.text$mn'
+    Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
+    Alignment:       16
+    SectionData:     4883EC28488D542438E8000000004883C428C34883EC28488D54243033C9E8000000004883C428C3
+  - Name:            '.sect'
+    Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
+    Alignment:       16
+    SectionData:     4883EC28488D542438E8000000004883C428C34883EC28488D54243033C9E8000000004883C428C3
+    Relocations:
+      - VirtualAddress:  10
+        SymbolTableIndex: 2
+        Type:            IMAGE_REL_AMD64_REL32
+symbols:
+  - Name:            '.text$mn'
+    Value:           0
+    SectionNumber:   1
+    SimpleType:      IMAGE_SYM_TYPE_NULL
+    ComplexType:     IMAGE_SYM_DTYPE_NULL
+    StorageClass:    IMAGE_SYM_CLASS_STATIC
+    SectionDefinition:
+      Length:          53
+      NumberOfRelocations: 1
+      NumberOfLinenumbers: 0
+      CheckSum:        973622814
+      Number:          0
+  - Name:            '$LN4'
+    Value:           19
+    SectionNumber:   1
+    SimpleType:      IMAGE_SYM_TYPE_NULL
+    ComplexType:     IMAGE_SYM_DTYPE_NULL
+    StorageClass:    IMAGE_SYM_CLASS_LABEL
+  - Name:            main
+    Value:           0
+    SectionNumber:   1
+    SimpleType:      IMAGE_SYM_TYPE_NULL
+    ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
+    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
+  - Name:            func
+    Value:           0
+    SectionNumber:   2
+    SimpleType:      IMAGE_SYM_TYPE_NULL
+    ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
+    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
+...
Index: llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.cpp
===================================================================
--- llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.cpp
+++ llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.cpp
@@ -411,7 +411,8 @@
     }
   }
 
-  if (Symbol.getStorageClass() == COFF::IMAGE_SYM_CLASS_STATIC) {
+  if (Symbol.getStorageClass() == COFF::IMAGE_SYM_CLASS_STATIC ||
+      Symbol.getStorageClass() == COFF::IMAGE_SYM_CLASS_LABEL) {
     const object::coff_aux_section_definition *Definition =
         Symbol.getSectionDefinition();
     if (!Definition || !isComdatSection(Section)) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129754.447332.patch
Type: text/x-patch
Size: 3206 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220725/d18d869e/attachment.bin>


More information about the llvm-commits mailing list