Files
clang-p2996/lld/test/pecoff/export.test
Rui Ueyama b18489c8bf [PECOFF] Find symbols with @number suffix for dllexported symbols
As written in the comment in this patch, symbol names specified with
/export option is resolved in a special way; for /export:foo, linker
finds a foo@<number> symbol if such symbols exists.

On Windows, a function in stdcall calling convention is mangled with
a leading underscore and following "@" and numbers. This name
mangling is kind of automatic, so you can sometimes omit _ and @number
when specifying a symbol. /export option is that case.

Previously, if a file in an archive file foo.lib provides a symbol
_fn@8, and /export:fn is specified, LLD failed to resolve the symbol.
It only tried to find _fn, and failed to find _fn@8. With this patch,
_fn@8 will be searched on the second iteration.

Differential Revision: http://reviews.llvm.org/D3736

llvm-svn: 208754
2014-05-14 06:29:32 +00:00

53 lines
1.9 KiB
Plaintext

# RUN: yaml2obj %p/Inputs/export.obj.yaml > %t.obj
#
# RUN: lld -flavor link /out:%t1.dll /dll /entry:init \
# RUN: /export:exportfn1 /export:exportfn2 -- %t.obj
# RUN: llvm-objdump -p %t1.dll | FileCheck -check-prefix=CHECK1 %s
CHECK1: Export Table:
CHECK1: DLL name: export.test.tmp1.dll
CHECK1: Ordinal RVA Name
CHECK1-NEXT: 1 0x2008 exportfn1
CHECK1-NEXT: 2 0x2010 exportfn2
# RUN: lld -flavor link /out:%t2.dll /dll /subsystem:console /entry:init \
# RUN: /export:exportfn1,@5 /export:exportfn2 -- %t.obj
# RUN: llvm-objdump -p %t2.dll | FileCheck -check-prefix=CHECK2 %s
CHECK2: Export Table:
CHECK2: DLL name: export.test.tmp2.dll
CHECK2: Ordinal RVA Name
CHECK2-NEXT: 5 0x2008 exportfn1
CHECK2-NEXT: 6 0x2010 exportfn2
# RUN: lld -flavor link /out:%t3.dll /dll /subsystem:console /entry:init \
# RUN: /export:exportfn1,@5,noname /export:exportfn2 -- %t.obj
# RUN: llvm-objdump -p %t3.dll | FileCheck -check-prefix=CHECK3 %s
CHECK3: Export Table:
CHECK3: DLL name: export.test.tmp3.dll
CHECK3: Ordinal RVA Name
CHECK3-NEXT: 5 0x2008
CHECK3-NEXT: 6 0x2010 exportfn2
# RUN: lld -flavor link /out:%t4.dll /dll /entry:init \
# RUN: /def:%p/Inputs/exports.def -- %t.obj
# RUN: llvm-objdump -p %t4.dll | FileCheck -check-prefix=CHECK4 %s
CHECK4: Export Table:
CHECK4: DLL name: export.test.tmp4.dll
CHECK4: Ordinal RVA Name
CHECK4-NEXT: 5 0x2008 exportfn1
CHECK4-NEXT: 6 0x2010 exportfn2
CHECK4-NEXT: 7 0x2010 exportfn5
CHECK4-NEXT: 8 0x2010 exportfn3@256
# RUN: lld -flavor link /out:%t5.dll /dll /entry:init \
# RUN: /export:exportfn7 -- %t.obj
# RUN: llvm-objdump -p %t5.dll | FileCheck -check-prefix=CHECK5 %s
CHECK5: Export Table:
CHECK5: DLL name: export.test.tmp5.dll
CHECK5: Ordinal RVA Name
CHECK5-NEXT: 1 0x2010 exportfn7