Page MenuHomePhabricator

[PECOFF] Find symbols with @number suffix for dllexported symbols

Authored by ruiu on May 12 2014, 8:33 PM.



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.

Diff Detail


Event Timeline

ruiu updated this revision to Diff 9332.May 12 2014, 8:33 PM
ruiu retitled this revision from to [PECOFF] Find symbols with @number suffix for dllexported symbols.
ruiu updated this object.
ruiu edited the test plan for this revision. (Show Details)

Would it be better to lazily initialize the _defined member when find is called? Or is this going to almost always be used?

ruiu added a comment.May 13 2014, 2:28 PM

It'll rarely be used, so lazy initialization is a good idea. I'll do that.

ruiu closed this revision.May 19 2014, 7:24 AM
ruiu updated this revision to Diff 9558.

Closed by commit rL208754 (authored by @ruiu).