This is an archive of the discontinued LLVM Phabricator instance.

Change which file we print when a symbol cannot be ordered
ClosedPublic

Authored by espindola on Apr 2 2018, 7:23 PM.

Details

Reviewers
jhenderson
ruiu
Summary

Currently there are a few odd things about the warning about symbols that cannot be ordered. This patch fixes:

  • When there is an undefined symbol that resolves to a shared file, we print the location of the undefined reference.
  • If there are multiple comdats, we report them all.

This makes the warning a bit less noisy and should also help with reusing this in D36351.

Diff Detail

Event Timeline

espindola created this revision.Apr 2 2018, 7:23 PM
ruiu added inline comments.Apr 2 2018, 7:40 PM
ELF/Writer.cpp
1055

This is perhaps better?

if (File != Sym->File)
espindola added inline comments.Apr 2 2018, 7:54 PM
ELF/Writer.cpp
1055

The problem with that is that we would not warn on shared symbols since we don't iterate over SharedSymbols.

Let me try a variation.

We now iterate over the symbol table for global symbols the object files for the local ones.

This fixes the issues noted before, but still warns if there are multiple unrelated symbols with the same name.

So, are you OK with the idea of using the symbol table to find the global symbols and iterating over the objects to find the local ones?

So, are you OK with the idea of using the symbol table to find the global symbols and iterating over the objects to find the local ones?

Ping. Sorry for the supper early ping, but this should help with the section layout patch.

ruiu accepted this revision.Apr 5 2018, 7:01 PM

LGTM

ELF/Writer.cpp
1083

Please add a comment saying that we add all symbols including local symbols so we have two loops.

This revision is now accepted and ready to land.Apr 5 2018, 7:01 PM