[PATCH] [Layout] Assign ordinals in resolution order

Shankar Easwaran shankare at codeaurora.org
Tue Oct 8 22:44:10 PDT 2013


On 10/9/2013 12:40 AM, kledzik at apple.com wrote:
>    It looks to me like the ordinals are assigned to archive members as the members are used.  This will result in unstable output because the lazy loading nature of archives loads the members in some what chaotic way (small changes to what if referenced by initial .o files can radically change the load order of members).
ELF needs the symbols to appear in resolution order.
>
>    For the darwin linker, we gave each archive a range of ordinals.  For instance if you link with -lfoo -lbar, the library ordinal for libfoo.a might be 100 and for libbar.a be 200.  Later when members are loaded from each, the member's ordinal is the owning libraries ordinal plus the member index (libfoo.a(foo.o) might have an ordinal of 100+3=103).

DarwinLinkingContext would need to override the 
getNextOrdinalAndIncrement function, that would use the 
currentInputElement and the file returned to associate ordinals like 
earlier.

Thanks

Shankar Easwaran

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation




More information about the llvm-commits mailing list