This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - Change -t implementation to print which archive members are used.
ClosedPublic

Authored by grimar on Apr 12 2016, 5:17 AM.

Details

Summary

This fixes PR27243.

Previously each archive file was reported no matter was it's member used or not:
lib/libLLVMSupport.a

Now lld prints line for each used internal file, like:
lib/libLLVMSupport.a(lib/Support/CMakeFiles/LLVMSupport.dir/StringSaver.cpp.o)
lib/libLLVMSupport.a(lib/Support/CMakeFiles/LLVMSupport.dir/Host.cpp.o)
lib/libLLVMSupport.a(lib/Support/CMakeFiles/LLVMSupport.dir/ConvertUTF.c.o)

That should be consistent with what gold do.

Diff Detail

Repository
rL LLVM

Event Timeline

grimar updated this revision to Diff 53387.Apr 12 2016, 5:17 AM
grimar retitled this revision from to [ELF] - Change -t implementation to print which archive members are used..
grimar updated this object.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: llvm-commits, grimar.
ruiu added inline comments.Apr 12 2016, 9:57 AM
ELF/Driver.cpp
101–102 ↗(On Diff #53387)

Is there any reason to keep this code here?

ELF/SymbolTable.cpp
73 ↗(On Diff #53387)

I mean you could make this Config->Trace||Config->Verbose

grimar added inline comments.Apr 13 2016, 4:19 AM
ELF/Driver.cpp
101–102 ↗(On Diff #53387)

I leaved it intentionally, but the answer on your question should be based on what Verbose should do.
I assumed that it should not behave as -t. For example when we using archives, -t will output only
those members that are used during link. If members are not used - you`ll never see archive name using -t.
Verbose in opposite - always prints any file processed. Including script files by the way, which are not
handled by -t (and that is equal to gold behavior, it does not print script files names).

So my opinion - Verbose is separate option and usefull itself, I would not combine it with -t.

ELF/SymbolTable.cpp
73 ↗(On Diff #53387)

Please see answer above.

ruiu added inline comments.Apr 13 2016, 9:14 AM
ELF/Driver.cpp
101–102 ↗(On Diff #53387)

Makes sense.

ELF/SymbolTable.cpp
100–107 ↗(On Diff #53387)

You want to move this code before if (Config->Trace).

test/ELF/Inputs/trace-ar1.s
1 ↗(On Diff #53387)

Remove ;

test/ELF/Inputs/trace-ar2.s
1 ↗(On Diff #53387)

Remove ;

grimar updated this revision to Diff 53596.Apr 13 2016, 11:05 AM
grimar marked 2 inline comments as done.
  • Addressed review comments.
ELF/SymbolTable.cpp
100–107 ↗(On Diff #53387)

Right. Added testcase for that.

Not relative to this patch - I didn't find any testcase that checks --end-lib

test/ELF/Inputs/trace-ar1.s
1 ↗(On Diff #53387)

Done.

test/ELF/Inputs/trace-ar2.s
1 ↗(On Diff #53387)

Done.

ruiu accepted this revision.Apr 13 2016, 11:08 AM
ruiu edited edge metadata.

LGTM

This revision is now accepted and ready to land.Apr 13 2016, 11:08 AM
In D19011#400095, @ruiu wrote:

LGTM

Thanks for review !

This revision was automatically updated to reflect the committed changes.