This is an archive of the discontinued LLVM Phabricator instance.

[lld] Keep full library path in DT_NEEDED
ClosedPublic

Authored by eugenis on Apr 7 2017, 6:16 PM.

Details

Reviewers
ruiu
eugenis
Summary

Fixes PR32572.

When

(a) a library has no soname

and (b) library is given on the command line with path (and not through -L/-l flags)
DT_NEEDED entry for such library keeps the path as given.

This behavior is consistent with gold and bfd, and is used in compiler-rt test suite.

Diff Detail

Repository
rL LLVM

Event Timeline

eugenis created this revision.Apr 7 2017, 6:16 PM
ruiu added inline comments.Apr 9 2017, 10:43 AM
ELF/Driver.cpp
156

This variable name seems too long and too abstract. I prefer something like WithLOption.

187

The logic to choose the default SO name is buried inside InputFiles.cpp which I don't think very easy to read. I'd probably process it right here for clarity.

if (WithLOption)
  Files.back()->DefaultSoName = sys::path::filename(Path);
else
  Files.back()->DefaultSoName = Path;
ELF/Driver.h
30

Please avoid using default arguments to make things explicit.

ruiu edited edge metadata.Apr 10 2017, 10:59 AM

Re-sending the mail...

eugenis updated this revision to Diff 94903.Apr 11 2017, 4:15 PM
eugenis marked 3 inline comments as done.
ruiu accepted this revision.Apr 11 2017, 4:25 PM

LGTM

ELF/InputFiles.h
98

I believe it is safe to use StringRef here.

This revision is now accepted and ready to land.Apr 11 2017, 4:25 PM
eugenis added inline comments.Apr 11 2017, 4:28 PM
ELF/InputFiles.h
98

That's what I started with, but then I got "718" in DT_NEEDED instead of a file path. :)

eugenis accepted this revision.Apr 11 2017, 5:00 PM

Thanks!
r300007

eugenis closed this revision.Apr 21 2017, 11:25 AM

And one more time in r300011.