This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - Resolve references properly when using .symver directive (2)
AbandonedPublic

Authored by grimar on Jun 14 2017, 2:28 PM.

Details

Reviewers
ruiu
rafael
Summary

This is variation of D33680.

Previously LLD was unable to link following:
(failed with undefined symbol bar)

Version script:

SOME_VERSION { global: *; };

.global _start
.global bar
.symver _start, bar@@SOME_VERSION
_start:
  jmp bar

Manual has next description:

.symver name, name2@@nodename
In this case, the symbol name must exist and be defined within the file being assembled. It is similar to name2@nodename.
The difference is name2@@nodename will also be used to resolve references to name2 by the linker
https://sourceware.org/binutils/docs/as/Symver.html

Patch implements that. If we have name@@ver symbol and name is undefined, name@@ver is used to resolve references to name.
If name is defined then multiple definition error is emited, that is consistent with what bfd do.

Diff Detail

Event Timeline

grimar created this revision.Jun 14 2017, 2:28 PM
ruiu edited edge metadata.Jun 14 2017, 4:28 PM

I don't think we should return a bool value from a parser function unless it really improves performance. Essentially it is a speed hack, so it needs to be proven that it is effective.

grimar abandoned this revision.Jun 17 2017, 10:14 PM

So looks we agreed to go with D33680 version for now.