This is an archive of the discontinued LLVM Phabricator instance.

[LLD] [COFF] Cope with weak aliases produced by GNU tools
ClosedPublic

Authored by mstorsjo on Sep 27 2018, 4:16 AM.

Details

Summary

When GNU tools create a weak alias, they produce a strong symbol named .weak.<weaksymbol>.<relatedstrongsymbol>.

GNU ld allows many such weak alternatives for the same weak symbol, and the linker picks the first one encountered.

This can't be reproduced by assembling from .s files, since llvm-mc produces symbols named .weak.<weaksymbol>.default in these cases.

Diff Detail

Repository
rLLD LLVM Linker

Event Timeline

mstorsjo created this revision.Sep 27 2018, 4:16 AM
ruiu added a comment.Sep 27 2018, 4:51 AM

Is the feature to support .weak.<foo>.<bar> symbols already supported by lld?

Is the feature to support .weak.<foo>.<bar> symbols already supported by lld?

As far as I understand it, there's nothing extra needed to handle them as such, they work just as any weak alias (which lld already supports). It's just an artefact from how GNU tools (both GCC and gas) express weak symbols in COFF.

ruiu accepted this revision.Oct 3 2018, 10:53 AM

LGTM

This revision is now accepted and ready to land.Oct 3 2018, 10:53 AM
This revision was automatically updated to reflect the committed changes.