This is an archive of the discontinued LLVM Phabricator instance.

[1/3] [LLD] [MinGW] Implement the --exclude-symbols option
ClosedPublic

Authored by mstorsjo on Jul 19 2022, 1:19 PM.

Details

Summary

This adds support for the existing GNU ld command line option, which
allows excluding individual symbols from autoexport (when linking a
DLL and no symbols are marked explicitly as dllexported).

I haven't seen this option used in the wild anywhere, but I'm
implementing it as a stepping stone for something more useful.

Diff Detail

Event Timeline

mstorsjo created this revision.Jul 19 2022, 1:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 19 2022, 1:19 PM
mstorsjo requested review of this revision.Jul 19 2022, 1:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 19 2022, 1:19 PM

LGTM with minor question.

lld/COFF/Options.td
48

I don't have experience with MSVC tools so cannot tell but will this message be clear enough for people used to MSVC that they have to pass comma separated symbol names?

mstorsjo added inline comments.Jul 20 2022, 8:46 AM
lld/COFF/Options.td
48

I guess I could add an MetaVarName to make it clearer, like in the mingw options file.

mstorsjo updated this revision to Diff 446783.Jul 22 2022, 4:31 AM

Added a MetaVarName in COFF/Options.td.

Ping, @mati865 @rnk - does either of you want to give the formal approval here?

mati865 accepted this revision.EditedJul 28 2022, 5:18 AM

Sorry, haven't noticed the approval was reset.

EDIT: ah, I probably haven't checked the box back then.

This revision is now accepted and ready to land.Jul 28 2022, 5:18 AM
rnk accepted this revision.Aug 9 2022, 11:56 AM

lgtm

MaskRay accepted this revision.Aug 9 2022, 5:40 PM
MaskRay added a subscriber: MaskRay.
MaskRay added inline comments.
lld/test/COFF/exclude-symbols.s
5

grep Name: can be expressed with pure FileCheck directives with --implicit-check-not=Name:

// CHECK: Name:
// CHECK: Name: sym1
mstorsjo marked an inline comment as done.Aug 10 2022, 5:00 AM
mstorsjo added inline comments.
lld/test/COFF/exclude-symbols.s
5

Thanks - that seems to work.

mstorsjo updated this revision to Diff 451421.Aug 10 2022, 5:00 AM
mstorsjo marked an inline comment as done.

Use --implicit-check-not to simplify the testcase a little.

This revision was automatically updated to reflect the committed changes.