From 359df30f3d3b040a4bfc32a97b972a142df71ca8 Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Wed, 8 Dec 2004 05:17:40 +0000 Subject: [PATCH] When -link-as-library, add -l options to Module's deplibs llvm-svn: 18617 --- llvm/tools/gccld/gccld.cpp | 9 ++++++++- llvm/tools/llvm-ld/llvm-ld.cpp | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/llvm/tools/gccld/gccld.cpp b/llvm/tools/gccld/gccld.cpp index 48fbd8b633da..d06eb6ec05f5 100644 --- a/llvm/tools/gccld/gccld.cpp +++ b/llvm/tools/gccld/gccld.cpp @@ -176,10 +176,17 @@ int main(int argc, char **argv, char **envp) { std::auto_ptr Composite(0); if (LinkAsLibrary) { - // Link in only the files, we ignore libraries in this case. + // Link in only the files. Composite.reset( new Module(argv[0]) ); if (LinkFiles(argv[0], Composite.get(), InputFilenames, Verbose)) return 1; // Error already printed + // The libraries aren't linked in but are noted as "dependent" in the + // module. + for (cl::list::const_iterator I = Libraries.begin(), + E = Libraries.end(); I != E ; ++I) { + Composite.get()->addLibrary(*I); + } + } else { // Build a list of the items from our command line LinkItemList Items; diff --git a/llvm/tools/llvm-ld/llvm-ld.cpp b/llvm/tools/llvm-ld/llvm-ld.cpp index 3512c2a66a32..db5c4173a37c 100644 --- a/llvm/tools/llvm-ld/llvm-ld.cpp +++ b/llvm/tools/llvm-ld/llvm-ld.cpp @@ -397,10 +397,17 @@ int main(int argc, char **argv, char **envp) { std::auto_ptr Composite(0); if (LinkAsLibrary) { - // Link in only the files, we ignore libraries in this case. + // Link in only the files. Composite.reset( new Module(argv[0]) ); if (LinkFiles(argv[0], Composite.get(), InputFilenames, Verbose)) return 1; // Error already printed + + // The libraries aren't linked in but are noted as "dependent" in the + // module. + for (cl::list::const_iterator I = Libraries.begin(), + E = Libraries.end(); I != E ; ++I) { + Composite.get()->addLibrary(*I); + } } else { // Build a list of the items from our command line LinkItemList Items;