Before this, LLD sets OrdinalBase to 0, which deviates from usual practices. This technically would allow LLD to export a symbol using ordinal 0, however LLD never use export ordinal 0, which results in binaries with export tables always having an empty export at ordinal 0. This change makes LLD set OrdinalBase to 1 and not create the empty export with ordinal 0, which makes its behaviour more in line with both the MSVC linker and the GNU linker. Reviewed By: mstorsjo Differential Revision: https://reviews.llvm.org/D134140
95 lines
3.0 KiB
YAML
95 lines
3.0 KiB
YAML
# REQUIRES: arm
|
|
|
|
# RUN: yaml2obj %s -o %t.obj
|
|
#
|
|
# 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: 1 0x3000 exportdata
|
|
# CHECK-NEXT: 2 0x1005 exportfn1
|
|
# CHECK-NEXT: 3 0x1009 exportfn2
|
|
# CHECK-NEXT: 4 0x1009 exportfn3
|
|
|
|
--- !COFF
|
|
header:
|
|
Machine: IMAGE_FILE_MACHINE_ARMNT
|
|
Characteristics: []
|
|
sections:
|
|
- Name: .text
|
|
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
|
|
SectionData: 2f6578706f72743a6578706f7274666e3300 # /export:exportfn3
|
|
symbols:
|
|
- Name: .text
|
|
Value: 0
|
|
SectionNumber: 1
|
|
SimpleType: IMAGE_SYM_TYPE_NULL
|
|
ComplexType: IMAGE_SYM_DTYPE_NULL
|
|
StorageClass: IMAGE_SYM_CLASS_STATIC
|
|
SectionDefinition:
|
|
Length: 12
|
|
NumberOfRelocations: 0
|
|
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
|
|
SimpleType: IMAGE_SYM_TYPE_NULL
|
|
ComplexType: IMAGE_SYM_DTYPE_NULL
|
|
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
|
|
- Name: exportfn1
|
|
Value: 4
|
|
SectionNumber: 1
|
|
SimpleType: IMAGE_SYM_TYPE_NULL
|
|
ComplexType: IMAGE_SYM_DTYPE_NULL
|
|
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
|
|
- Name: exportfn2
|
|
Value: 8
|
|
SectionNumber: 1
|
|
SimpleType: IMAGE_SYM_TYPE_NULL
|
|
ComplexType: IMAGE_SYM_DTYPE_NULL
|
|
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
|
|
- Name: exportfn3
|
|
Value: 8
|
|
SectionNumber: 1
|
|
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
|
|
SimpleType: IMAGE_SYM_TYPE_NULL
|
|
ComplexType: IMAGE_SYM_DTYPE_NULL
|
|
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
|
|
...
|