llvm-project/lld/test/COFF
Rui Ueyama f10a32014d COFF: Improve dllexported name mangling compatibility.
The rules for dllexported symbols are overly complicated due to
x86 name decoration, fuzzy symbol resolution, and the fact that
one symbol can be resolved by so many different names. The rules
are probably intended to be "intuitive", so that users don't have
to understand the name mangling schemes, but it seems that it can
lead to unintended symbol exports.

To make it clear what I'm trying to do with this patch, let me
write how the export rules are subtle and complicated.

 - x86 name decoration: If machine type is i386 and export name
   is given by a command line option, like /export:foo, the
   real symbol name the linker has to search for is _foo because
   all symbols are decorated with "_" prefixes. This doesn't happen
   on non-x86 machines. This automatic name decoration happens only
   when the name is not C++ mangled.

   However, the symbol name exported from DLLs are ones without "_"
   on all platforms.

   Moreover, if the option is given via .drectve section, no
   symbol decoration is done (the reason being that the .drectve
   section is created by a compiler and the compiler should always
   know the exact name of the symbol, I guess).

 - Fuzzy symbol resolution: In addition to x86 name decoration,
   the linker has to look for cdecl or C++ mangled symbols
   for a given /export. For example, it searches for not only
   _foo but also _foo@<number> or ??foo@... for /export:foo.

Previous implementation didn't get it right. I'm trying to make
it as compatible with MSVC linker as possible with this patch
however the rules are. The new code looks a bit messy to me, but
I don't think it can be simpler due to the ad-hoc-ness of the rules.

llvm-svn: 246424
2015-08-31 08:43:21 +00:00
..
Inputs COFF: Update a test for ICF. 2015-08-24 07:52:08 +00:00
alternatename.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
ar-comdat.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
armnt-blx23t.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
armnt-branch24t.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
armnt-entry-point.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
armnt-imports.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
armnt-mov32t-exec.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
armnt-movt32t.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
base.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
baserel.test COFF: Align sections to 512-byte boundaries on disk. 2015-08-11 23:09:00 +00:00
common.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
conflict.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
debug.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
defparser.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
delayimports.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
delayimports32.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
dll.test COFF: Improve dllexported name mangling compatibility. 2015-08-31 08:43:21 +00:00
dllorder.test COFF: Attempt to unbreak buildbots. 2015-08-26 02:52:05 +00:00
driver.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
entry-inference.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
entry-inference2.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
entry-inference32.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
entry-mangled.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
entrylib.ll COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
export.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
export32.test COFF: Improve dllexported name mangling compatibility. 2015-08-31 08:43:21 +00:00
failifmismatch.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
filetype.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
force.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
heap.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
hello32.test COFF: Align sections to 512-byte boundaries on disk. 2015-08-11 23:09:00 +00:00
help.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
icf-circular.test COFF: Add a test for ICF and circular references. 2015-08-24 08:11:53 +00:00
icf-simple.test COFF: Update a test for ICF. 2015-08-24 07:52:08 +00:00
imports-mangle.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
imports.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
include.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
include2.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
internal.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
largeaddressaware.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
libpath.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
linkenv.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
lldmap.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
loadcfg.ll COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
loadcfg.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
loadcfg32.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
locally-imported.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
locally-imported32.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
long-section-name.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
lto-chkstk.ll COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
lto-comdat.ll COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
lto-linker-opts.ll COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
lto-new-symbol.ll COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
lto-opt-level.ll COFF: Introduce flag /opt:lldlto=N for controlling LTO optimization level. 2015-08-14 04:47:07 +00:00
lto-parallel.ll COFF: Implement parallel LTO code generation. 2015-08-28 22:16:09 +00:00
lto.ll COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
machine.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
manifest.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
merge.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
nodefaultlib.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
noentry.test This test needs lib.exe. 2015-08-13 00:03:47 +00:00
opt.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
options.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
order.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
out.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
reloc-arm.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
reloc-x64.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
reloc-x86.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
resource.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
responsefile.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
safeseh.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
seh.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
sort-debug.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
stack.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
subsystem-inference.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
subsystem.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
symtab.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
tls.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
tls32.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
unwind.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
version.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
weak-external.test COFF: Implement parallel LTO code generation. 2015-08-28 22:16:09 +00:00
weak-external2.test COFF: Make test commands shorter. NFC. 2015-08-06 16:47:46 +00:00
weak-external3.test COFF: Implement parallel LTO code generation. 2015-08-28 22:16:09 +00:00