This is an archive of the discontinued LLVM Phabricator instance.

allow-multiple-definitions should completely suppress errors instead of making them warnings.
ClosedPublic

Authored by ruiu on Mar 15 2018, 4:29 PM.

Details

Summary

We found that when you pass --allow-multiple-definitions or -z muldefs
to GNU linkers, they don't complain about duplicate symbols at all. They
don't even print out warnings on it. We emit warnings in that case.
If you pass --fatal-warnings, that difference results in a link failure.

Diff Detail

Repository
rL LLVM

Event Timeline

ruiu created this revision.Mar 15 2018, 4:29 PM
espindola added inline comments.Mar 15 2018, 4:54 PM
lld/ELF/SymbolTable.cpp
420 ↗(On Diff #138650)

Why was it necessary to inline this reportDuplicate?

ruiu added inline comments.Mar 15 2018, 9:39 PM
lld/ELF/SymbolTable.cpp
420 ↗(On Diff #138650)

It's not necessary, but since it is now short that it is easier to read than having a overloaded function.

espindola added inline comments.Mar 15 2018, 10:14 PM
lld/ELF/SymbolTable.cpp
420 ↗(On Diff #138650)

Leave that for a followup patch. There may be a better way of merging these two overloads and doing it in one patch makes the patch harder to read.

Logic by itself looks OK to me.
+1 to leave inlining for the follow-up.

lld/ELF/SymbolTable.cpp
420 ↗(On Diff #138650)

That is not what was changed by this patch, but have to note
that this (and below places) probably should be errorOrWarn from Config.h to support -noinhibit-exec.

ruiu updated this revision to Diff 138744.Mar 16 2018, 12:22 PM
  • address review comment.
grimar accepted this revision.Mar 16 2018, 11:51 PM

LGTM

This revision is now accepted and ready to land.Mar 16 2018, 11:51 PM
espindola added inline comments.Mar 19 2018, 10:25 AM
lld/ELF/SymbolTable.cpp
515 ↗(On Diff #138744)

Please leave the check for AllowMultipleDefinition in reportDuplicate. Both overloads should check it or none.

ruiu added inline comments.Mar 19 2018, 11:03 AM
lld/ELF/SymbolTable.cpp
515 ↗(On Diff #138744)

Done.

espindola accepted this revision.Mar 19 2018, 12:32 PM
espindola added inline comments.
lld/ELF/SymbolTable.cpp
515 ↗(On Diff #138744)

Have you forgot to upload a new patch? In any case, LGTM with that.

This revision was automatically updated to reflect the committed changes.