[LLVMbugs] [Bug 13544] New: Passing a library multiple times to llvm-ld destroys order of positional arguments
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Aug 7 10:37:51 PDT 2012
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: unassignedbugs at nondot.org
ReportedBy: stefan at stefant.org
CC: llvmbugs at cs.uiuc.edu
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.
More information about the llvm-bugs
mailing list