http://llvm.org/bugs/show_bug.cgi?id=13544
Bug #: 13544
Summary: Passing a library multiple times to llvm-ld destroys
order of positional arguments
Product: tools
Version: 3.1
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: llvm-ld
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
Classification: Unclassified
If a library is passed multiple times to llvm-ld without any other library in
between, then the order of the following arguments is destroyed.
This is caused by the code in llvm-ld.cpp, line 595:
// Remove any consecutive duplicates of the same library...
Libraries.erase(std::unique(Libraries.begin(), Libraries.end()),
Libraries.end());
This does not work for two reasons:
1) Consecutive duplicates in the Libraries array may not be consecutive
arguments, if there are input-file arguments in between -> requires checking of
getPosition for the possible duplicates
2) cl::list::erase only erases the argument string, but does not update the
Position vector, i.e., the arguments and the positions are out-of-sync after
erase -> erase() must be overloaded to update the Position vector too.
This causes problems in the following BuildLinkItems function call.
Example:
llvm-ld main.bc -lm crt0.bc -lm -Lsomepath symbols.bc -lsyms
will result in the following Items list:
main.bc -lm crt0.bc -lsyms symbols.bc
Note that 1) -lm now only appears once and 2) symbols.bc and -lsyms changed
positions, both can lead to unresolved symbols.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs