This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Resolve undefined symbols from archives when linking shared objects
AbandonedPublic

Authored by evgeny777 on Oct 27 2016, 8:01 AM.

Details

Reviewers
ruiu
rafael
Summary

When linking DSO lld doesn't resolve symbols from input DSOs in case those symbols are lazy. Below is an example:

input.so - has undefined symbol 'print'
libprint.a - defines 'print'

ld.lld -shared -o output.so input.so libprint.a

Even though libprint.a has definition of 'print', output.so will have it undefined.
Later when you link application with output.so, you'll also have to provide libprint.a

This patch fixes it.

Diff Detail

Event Timeline

evgeny777 updated this revision to Diff 76012.Oct 27 2016, 8:01 AM
evgeny777 retitled this revision from to [ELF] Resolve undefined symbols from archives when linking shared objects.
evgeny777 updated this object.
evgeny777 added reviewers: ruiu, rafael.
evgeny777 set the repository for this revision to rL LLVM.
evgeny777 added a project: lld.
evgeny777 added subscribers: grimar, ikudrin, llvm-commits.
ruiu edited edge metadata.Oct 27 2016, 10:49 AM

How did you notice that this is an issue? I wonder if this is a real one.

ELF/SymbolTable.cpp
556

You want to set true to ExportDynamic.

evgeny777 abandoned this revision.Nov 28 2016, 2:00 AM