[PATCH] D133627: [Object][COFF] Allow section symbol to be common symbol
Pengxuan Zheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 13 18:07:18 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rGecb5ea6a266d: [Object][COFF] Allow section symbol to be common symbol (authored by pzheng).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133627/new/
https://reviews.llvm.org/D133627
Files:
llvm/include/llvm/Object/COFF.h
llvm/test/Object/coff-sec-sym.test
Index: llvm/test/Object/coff-sec-sym.test
===================================================================
--- /dev/null
+++ llvm/test/Object/coff-sec-sym.test
@@ -0,0 +1,20 @@
+# Check that section symbol (IMAGE_SYM_CLASS_SECTION) is listed as common symbol.
+
+# RUN: yaml2obj %s -o %t.obj
+# RUN: llvm-nm %t.obj | FileCheck %s
+
+# CHECK: 00000001 C foo
+
+--- !COFF
+header:
+ Machine: IMAGE_FILE_MACHINE_AMD64
+ Characteristics: [ ]
+sections:
+symbols:
+ - Name: foo
+ Value: 1
+ SectionNumber: 0
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_SECTION
+...
Index: llvm/include/llvm/Object/COFF.h
===================================================================
--- llvm/include/llvm/Object/COFF.h
+++ llvm/include/llvm/Object/COFF.h
@@ -379,8 +379,8 @@
}
bool isCommon() const {
- return isExternal() && getSectionNumber() == COFF::IMAGE_SYM_UNDEFINED &&
- getValue() != 0;
+ return (isExternal() || isSection()) &&
+ getSectionNumber() == COFF::IMAGE_SYM_UNDEFINED && getValue() != 0;
}
bool isUndefined() const {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133627.459942.patch
Type: text/x-patch
Size: 1186 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220914/0920656e/attachment.bin>
More information about the llvm-commits
mailing list