mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-04 08:16:49 +00:00
[COFF] Don't set the thumb bit in address table entries for data symbols
The thumb bit should only be set for executable code. Differential Revision: https://reviews.llvm.org/D41379 llvm-svn: 321149
This commit is contained in:
parent
158d54d954
commit
6528fb8691
@ -362,12 +362,12 @@ public:
|
||||
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 {
|
||||
|
@ -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 @@ sections:
|
||||
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 @@ symbols:
|
||||
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 @@ symbols:
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user