llvm-project/lld/test/COFF/export-exe.test
Alvin Wong e2e132c5d9 [LLD][COFF] Set OrdinalBase to 1 for export table
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
2022-10-03 10:58:44 +03:00

10 lines
319 B
Plaintext

# RUN: lld-link /entry:main /out:%t.exe /subsystem:windows \
# RUN: %p/Inputs/ret42.obj /export:main
# RUN: llvm-objdump -p %t.exe | FileCheck %s
CHECK: Export Table:
CHECK-NEXT: DLL name: export-exe.test.tmp.exe
CHECK-NEXT: Ordinal base: 1
CHECK-NEXT: Ordinal RVA Name
CHECK-NEXT: 1 0x1000 main