aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/gccld/gccld.cpp14
-rw-r--r--tools/llvm-ld/llvm-ld.cpp3
2 files changed, 15 insertions, 2 deletions
diff --git a/tools/gccld/gccld.cpp b/tools/gccld/gccld.cpp
index ae45100..22a26ef 100644
--- a/tools/gccld/gccld.cpp
+++ b/tools/gccld/gccld.cpp
@@ -243,11 +243,23 @@ int main(int argc, char **argv, char **envp ) {
} else {
// Build a list of the items from our command line
Linker::ItemList Items;
+ Linker::ItemList NativeItems;
BuildLinkItems(Items, InputFilenames, Libraries);
// Link all the items together
- if (TheLinker.LinkInItems(Items))
+ if (TheLinker.LinkInItems(Items,NativeItems))
return 1; // Error already printed
+
+ // Revise the Libraries based on the remaining (native) libraries that
+ // were not linked in to the bytecode. This ensures that we don't attempt
+ // to pass a bytecode library to the native linker
+ Libraries.clear(); // we've consumed the libraries except for native
+ if ((Native || NativeCBE) && !NativeItems.empty()) {
+ for (Linker::ItemList::const_iterator I = NativeItems.begin(),
+ E = NativeItems.end(); I != E; ++I) {
+ Libraries.push_back(I->first);
+ }
+ }
}
// We're done with the Linker, so tell it to release its module
diff --git a/tools/llvm-ld/llvm-ld.cpp b/tools/llvm-ld/llvm-ld.cpp
index 0c633d2..f6c9c74 100644
--- a/tools/llvm-ld/llvm-ld.cpp
+++ b/tools/llvm-ld/llvm-ld.cpp
@@ -434,10 +434,11 @@ int main(int argc, char **argv, char **envp) {
} else {
// Build a list of the items from our command line
Linker::ItemList Items;
+ Linker::ItemList NativeItems;
BuildLinkItems(Items, InputFilenames, Libraries);
// Link all the items together
- if (TheLinker.LinkInItems(Items) )
+ if (TheLinker.LinkInItems(Items,NativeItems) )
return 1;
}