[PECOFF] Trim at most one character from imported symbols.
authorRui Ueyama <ruiu@google.com>
Mon, 12 Aug 2013 04:10:00 +0000 (04:10 +0000)
committerRui Ueyama <ruiu@google.com>
Mon, 12 Aug 2013 04:10:00 +0000 (04:10 +0000)
commitf1ffe8abbf5a90cb7e9f4280d24d4fd8f0dca44a
tree8ec53cbb0860a9bb7b253d2cbb23d79698b8c7a0
parentd57355031c0f19936c0a75d0061fc4ee9bc87a6a
[PECOFF] Trim at most one character from imported symbols.

The import name is not always the same as the symbol name. If the name/type
field in the import header is NOPREFIX or UNDECORATE, we need to strip some
characters from symbol to get its import name.

The Microsoft PE/COFF spec is vague if symbol contains more than two
consecutive characters to be stripped. We used to strip all characters,
but it doesn't seem right as we couldn't link against the system library
because of this name mangling. Looks like we shouldn't strip more than one
character.

llvm-svn: 188154
lld/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp
lld/test/pecoff/Inputs/vars-main.c
lld/test/pecoff/Inputs/vars-main.obj.yaml
lld/test/pecoff/Inputs/vars.c
lld/test/pecoff/Inputs/vars.dll.yaml
lld/test/pecoff/Inputs/vars.lib
lld/test/pecoff/importlib.test