If -opt:noref is specified, they can end up with isLive() == 1 when the autoexport check is run.
To reduce the risk of potential issues, only consider exporting DefinedRegular and DefinedCommon, nothing else.
Differential D40014
[LLD] [COFF] Improve the autoexport check for symbols from import libraries with -opt:noref mstorsjo on Nov 14 2017, 3:34 AM. Authored by
Details
If -opt:noref is specified, they can end up with isLive() == 1 when the autoexport check is run. To reduce the risk of potential issues, only consider exporting DefinedRegular and DefinedCommon, nothing else.
Diff Detail
Event TimelineComment Actions Do you mind digging a little bit so we can get a test case for it? Is there some way to get symbol definitions from .drectives like ELF with --defsym or something? Comment Actions Identified the actual root cause, improved the related code further by checking for specific types of Defined symbols, added a test. Comment Actions lgtm, definitely don't want to auto-export that imported data. The absolute symbol thing can be a follow-up change.
Comment Actions I can amend it to allow absolute symbols before committing - I wasn't quite sure what they were originally, but I guess it can make sense to export them as well. Comment Actions Ok, maybe like this? // Only allow the symbol kinds that make sense to export; // in particular, disallow import symbols. if (!isa<DefinedRegular>(Sym) && !isa<DefinedCommon>(Sym)) And // Check that file is non-null before dereferencing it, // symbols not originating in regular object files probably shouldn't be exported. if (!Sym->getFile()) |