This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - Do not handle --defsym as regular linkerscript assignment.
AbandonedPublic

Authored by grimar on Dec 20 2017, 6:01 AM.

Details

Reviewers
ruiu
rafael
Summary

With following code and script:

.global foo
foo:

VER1 { global: foo ; local: * ; } ;

ld.bfd does not allow to redefine symbol:

++ ld.bfd --defsym=foo=2 --version-script version.txt -shared test.o -o test.so
test.o: In function `foo':
(.text+0x0): multiple definition of `foo'

So semantic of --defsym is like a symbol declaration.
LLD allowed that, patch fixes it.

Diff Detail

Event Timeline

grimar created this revision.Dec 20 2017, 6:01 AM
grimar updated this revision to Diff 127700.Dec 20 2017, 6:13 AM
  • Fixed last minute mistype.
grimar updated this revision to Diff 128096.Dec 23 2017, 10:07 PM
  • Rebased, updated.
ruiu added a comment.Dec 25 2017, 11:04 PM

I agree that we shouldn't introduce a new semantics just for reporting an error for a corner use case which looks like we don't need to mimic the exact behavior of the bfd linker.

grimar abandoned this revision.Dec 26 2017, 3:03 AM

Abandoning basing on discussion about this.