[LLVMdev] [lld] [mach-o]: RFC: representing LC_REEXPORT_DYLIB

Shankar Easwaran
Thu, 03 Jul 2014 15:22:43 -0000

On 7/2/2014 7:09 PM, Nick Kledzik wrote:
>
> Shankar, Does lld for ELF support loading indirect DSOs?

The Gnu flavor doesnot try to read dependent(indirect DSO's) libraries
for resolving symbols unless the dependent library is also added in the
link line.

Test case :-

cat > 1.c << \!
int main() {
   fn();
   return 0;
}
!

cat > fn.c << \!
int fn() { return fn1(); }
!

cat > fn1.c << \!
int fn1() { return fn2(); }
!

gcc -c fn.c fn1.c -fPIC 1.c
ld -shared fn1.o -o libfn1.so
ld -shared fn.o -L. -lfn1 -o libfn.so
ld 1.o -L. -lfn -t --no-allow-shlib-undefined

=> Does not read libfn1 et all, not used to this, I dont know why this
has been followed on Gnu and the reasoning behind it. I'm not sure if
this is by design or a bug, that was never fixed.

In the case of lld, for the Gnu flavor, we dont need to support indirect
DSO's :)

Thanks

Shankar Easwaran