llvm-project/lld/test/COFF/exclude-symbols.s
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

20 lines
397 B
ArmAsm

// REQUIRES: x86
// RUN: llvm-mc -filetype=obj -triple=i686-win32-gnu %s -o %t.o
// RUN: lld-link -lldmingw -dll -out:%t.dll %t.o -noentry -exclude-symbols:sym2,unknownsym -exclude-symbols:unknownsym,sym3
// RUN: llvm-readobj --coff-exports %t.dll | FileCheck --implicit-check-not=Name: %s
// CHECK: Name: sym1
.global _sym1
_sym1:
ret
.global _sym2
_sym2:
ret
.global _sym3
_sym3:
ret