This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Warn for duplicate symbols in version scripts instead of erroring out
ClosedPublic

Authored by davide on Jun 27 2016, 7:41 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

davide updated this revision to Diff 62051.Jun 27 2016, 7:41 PM
davide retitled this revision from to [ELF] Warn for duplicate symbols in version scripts instead of erroring out.
davide updated this object.
davide added reviewers: grimar, rafael, ruiu.
davide added a subscriber: llvm-commits.

See my comment on http://reviews.llvm.org/D21555 for the rationale behind this change.

ruiu accepted this revision.Jun 27 2016, 7:49 PM
ruiu edited edge metadata.

LGTM. If it's still too verbose, we should just remove this code.

This revision is now accepted and ready to land.Jun 27 2016, 7:49 PM
This revision was automatically updated to reflect the committed changes.
grimar edited edge metadata.Jun 27 2016, 10:55 PM
In D21781#468584, @ruiu wrote:

LGTM. If it's still too verbose, we should just remove this code.

I am not sure we should. That is definitely a error in script to have that. Users should fix their scripts instead.

ruiu added a comment.Jun 27 2016, 10:57 PM

It may be a misuse of a feature, but is it really an error?

In D21781#468631, @ruiu wrote:

It may be a misuse of a feature, but is it really an error?

Well, listing the same symbol under one version does not seem to be a error for me,
but listing the same symbol under different versions at least worth a warning as
it is possible that linker override one and that is confusing.

rafael edited edge metadata.Jun 28 2016, 5:30 AM
rafael added a subscriber: rafael.

I really think this should be an error. If we need a hack for now it
should be warning, but we should have an open bug on making this an
error again.

Both gold and bfd put the symbol just in the first version. We put it
just in the last version. Both are really confusing.

I will open a bug on making this a error again.

Cheers,
Rafael

emaste added a subscriber: emaste.EditedJun 28 2016, 1:59 PM
In D21781#468584, @ruiu wrote:

LGTM. If it's still too verbose, we should just remove this code.

I definitely don't want to see the warning removed altogether (and have a slight preference for seeing this become an error again eventually).

FreeBSD's libcxxrt version map has had a copy-and-paste error for 2.5 years (since it was introduced) resulting in missing exported symbols: it had duplicated _ZTIPDn entries, instead of _ZTIPDn and _ZTSPDn. The mistake went unnoticed until I tried building with lld and encountered the duplicate symbol error from lld. So I think this warning / error is not spurious and will catch real mistakes that need to be fixed in version scripts.

https://reviews.freebsd.org/D7011

joerg added a subscriber: joerg.Jun 29 2016, 7:53 AM

I agree with Rafael that it should be an error. There is one situation that we want to handle smarter, but that's it. If the version is the result from an explicit match and a wildcard, the explicit match should win and the wildcard be ignored. But that's the only exception I can sanely see.

I agree with Rafael that it should be an error. There is one situation that we want to handle smarter, but that's it. If the version is the result from an explicit match and a wildcard, the explicit match should win and the wildcard be ignored. But that's the only exception I can sanely see.

And if there is more than 1 match using wildcard, the last matching version tag in the file should be used.
(http://www.airs.com/blog/archives/300).