[PATCH] D41379: [LLD] [COFF] Don't set the thumb bit in address table entries for data symbols
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 19 22:51:36 PST 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLD321149: [COFF] Don't set the thumb bit in address table entries for data symbols (authored by mstorsjo, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D41379?vs=127467&id=127661#toc
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D41379
Files:
COFF/DLL.cpp
test/COFF/export-armnt.yaml
Index: test/COFF/export-armnt.yaml
===================================================================
--- test/COFF/export-armnt.yaml
+++ test/COFF/export-armnt.yaml
@@ -2,16 +2,17 @@
# RUN: yaml2obj < %s > %t.obj
#
-# RUN: lld-link /out:%t.dll /dll %t.obj /export:exportfn1 /export:exportfn2
+# RUN: lld-link /out:%t.dll /dll %t.obj /export:exportfn1 /export:exportfn2 /export:exportdata,data
# RUN: llvm-objdump -p %t.dll | FileCheck %s
# CHECK: Export Table:
# CHECK: DLL name: export-armnt.yaml.tmp.dll
# CHECK: Ordinal RVA Name
# CHECK-NEXT: 0 0
-# CHECK-NEXT: 1 0x1005 exportfn1
-# CHECK-NEXT: 2 0x1009 exportfn2
-# CHECK-NEXT: 3 0x1009 exportfn3
+# CHECK-NEXT: 1 0x1000 exportdata
+# CHECK-NEXT: 2 0x2005 exportfn1
+# CHECK-NEXT: 3 0x2009 exportfn2
+# CHECK-NEXT: 4 0x2009 exportfn3
--- !COFF
header:
@@ -22,6 +23,10 @@
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
Alignment: 4
SectionData: 704700bf704700bf704700bf
+ - Name: .data
+ Characteristics: [ IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
+ Alignment: 4
+ SectionData: 00000000
- Name: .drectve
Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ]
Alignment: 1
@@ -39,6 +44,18 @@
NumberOfLinenumbers: 0
CheckSum: 0
Number: 0
+ - Name: .data
+ Value: 0
+ SectionNumber: 2
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 4
+ NumberOfRelocations: 0
+ NumberOfLinenumbers: 0
+ CheckSum: 0
+ Number: 0
- Name: _DllMainCRTStartup
Value: 0
SectionNumber: 1
@@ -63,6 +80,12 @@
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: exportdata
+ Value: 0
+ SectionNumber: 2
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
- Name: '?mangled@@YAHXZ'
Value: 8
SectionNumber: 1
Index: COFF/DLL.cpp
===================================================================
--- COFF/DLL.cpp
+++ COFF/DLL.cpp
@@ -362,12 +362,12 @@
size_t getSize() const override { return Size * 4; }
void writeTo(uint8_t *Buf) const override {
- uint32_t Bit = 0;
- // Pointer to thumb code must have the LSB set, so adjust it.
- if (Config->Machine == ARMNT)
- Bit = 1;
- for (Export &E : Config->Exports) {
+ for (const Export &E : Config->Exports) {
uint8_t *P = Buf + OutputSectionOff + E.Ordinal * 4;
+ uint32_t Bit = 0;
+ // Pointer to thumb code must have the LSB set, so adjust it.
+ if (Config->Machine == ARMNT && !E.Data)
+ Bit = 1;
if (E.ForwardChunk) {
write32le(P, E.ForwardChunk->getRVA() | Bit);
} else {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41379.127661.patch
Type: text/x-patch
Size: 3178 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171220/c7c07508/attachment.bin>
More information about the llvm-commits
mailing list