If both a.a and b.so define foo
ld.bfd -u foo a.a b.so # foo is defined ld.bfd a.a b.so -u foo # foo is defined ld.bfd -u foo b.so a.a # foo is undefined (provided at runtime by b.so) ld.bfd b.so a.a -u foo # foo is undefined (provided at runtime by b.so)
In all cases we make foo undefined in the output. I tend to think the
GNU ld behavior makes more sense.
- In their model, they have to treat -u as a fake object file with an undefined symbol before all input files, otherwise the first archive would not be fetched.
- Following their behavior allows us to drop a --warn-backrefs special case.
We now no longer use this function for -u, will be worth updating comment.