This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Prohibit icf=safe warning from being fatal
AbandonedPublic

Authored by melver on Feb 21 2023, 3:56 AM.

Details

Summary

Many projects compile with fatal linker warnings. The fact that icf=safe
has limitations with object files created by ld -r or objcopy limits
such projects from either (a) using --fatal-warnings, or (b) using ld or
objcopy produced dependencies.

Arguably, users that use ld/objcopy should be aware of icf=safe's
limitations, but should never affect _consumers_ of dependencies created
in this way. An example is a library that must internalize symbols to
ship and safely link into other targets.

Not being able to apply ICF to such a library should not be a
dealbreaker for projects that employ --fatal-warnings. The rest of the
project's object files can still employ ICF, while incompatible object
files are skipped with the warning.

Never treat icf=safe warnings as fatal.

Diff Detail

Event Timeline

melver created this revision.Feb 21 2023, 3:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 21 2023, 3:56 AM
melver requested review of this revision.Feb 21 2023, 3:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 21 2023, 3:56 AM

I just discovered that removing .llvm_addrsig (seen that done elsewhere, too) also resolves the issue.

I suppose that solves my immediate issue, but I wonder:

  1. Should we update the warning to suggest that?
  1. Still make the warning never-fatal?

Because I can't be the only one that has encountered this issue.

I don't think we want more diagnostic levels. The warning is not fatal, it's just that some users use --fatal-warnings to upgrade warnings to errors.
If this warning is annoying under --fatal-warnings, we can think of message(...). But right now, it seems appropriate for the user to be aware of the problem and discard .llvm_addrsig by themselves.
(I have more notes in https://maskray.me/blog/2020-11-15-explain-gnu-linker-options )

melver abandoned this revision.Feb 21 2023, 11:17 AM

I don't think we want more diagnostic levels. The warning is not fatal, it's just that some users use --fatal-warnings to upgrade warnings to errors.
If this warning is annoying under --fatal-warnings, we can think of message(...). But right now, it seems appropriate for the user to be aware of the problem and discard .llvm_addrsig by themselves.
(I have more notes in https://maskray.me/blog/2020-11-15-explain-gnu-linker-options )

Thanks - I'll abandon this for now.