This is an archive of the discontinued LLVM Phabricator instance.

[lld-macho]Limit "cannot-export-hidden-symbol" warnings to only 3 to avoid crowding logs
ClosedPublic

Authored by oontvoo on Aug 29 2023, 7:13 AM.

Details

Summary

Details:
We often use wildcard symbols in the exported_symbols list, and sometimes they match autohide symbols, which triggers these "cannot export hidden symbols" warnings that can be a bit noisy.

It'd be more user-friendly if LLD could truncate these.

Diff Detail

Event Timeline

oontvoo created this revision.Aug 29 2023, 7:13 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptAug 29 2023, 7:13 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
oontvoo requested review of this revision.Aug 29 2023, 7:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 29 2023, 7:13 AM
thakis added a subscriber: thakis.Aug 29 2023, 6:22 PM

How does ld64 handle this situation?

oontvoo added a comment.EditedAug 30 2023, 11:56 AM

How does ld64 handle this situation?

LD64 would issue similar warnings. It's not that LLD is doing anything wrong here.
It's just that in our internal use case, we have a huge list of exported-symbols (with wild-cards) so these warnings don't really offer anything useful to us and often crowd the log.
Having a way to silence them would drastically improve the readability of logs (and potentially speed up the linkage too, due to less I/O), especially when debugging other linker errors.

oontvoo planned changes to this revision.Aug 30 2023, 1:06 PM

Per off-line discussion, will rework this so that LLD only emit the warning 3 times (or some smaller number, can decide/debate later)

oontvoo updated this revision to Diff 556066.Sep 6 2023, 12:23 PM

updated patch to truncate the warnings

oontvoo retitled this revision from [lld-macho]Add an option to suppress warnings when autohide symbols are in the list of exported_symbols. to [lld-macho]Limit "cannot-export-hidden-symbol" warnings to only 3 to avoid crowding logs.Sep 6 2023, 12:23 PM
oontvoo edited the summary of this revision. (Show Details)
thakis accepted this revision.Sep 6 2023, 6:33 PM

Thanks!

lld/MachO/Driver.cpp
1388

why an explicit call to .load() here but not in the line above? be self-consistent.

This revision is now accepted and ready to land.Sep 6 2023, 6:33 PM
oontvoo updated this revision to Diff 556180.Sep 7 2023, 10:51 AM
oontvoo marked an inline comment as done.
oontvoo edited the summary of this revision. (Show Details)

removed .load() call

This revision was landed with ongoing or failed builds.Sep 7 2023, 10:52 AM
This revision was automatically updated to reflect the committed changes.