Do not assume the first file is a bytecode file. Instead, construct a dummy

Module and link things into that.

Also, fix a typo in an error message.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9748 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Brian Gaeke
2003-11-05 22:13:00 +00:00
parent 3b3640a373
commit 00cc86a8fc

View File

@ -215,10 +215,8 @@ void RemoveEnv(const char * name, char ** const envp) {
int main(int argc, char **argv, char **envp) { int main(int argc, char **argv, char **envp) {
cl::ParseCommandLineOptions(argc, argv, " llvm linker for GCC\n"); cl::ParseCommandLineOptions(argc, argv, " llvm linker for GCC\n");
std::string ErrorMessage; std::string ModuleID ("gccld-output");
std::auto_ptr<Module> Composite(LoadObject(InputFilenames[0], ErrorMessage)); std::auto_ptr<Module> Composite(new Module(ModuleID));
if (Composite.get() == 0)
return PrintAndReturn(argv[0], ErrorMessage);
// We always look first in the current directory when searching for libraries. // We always look first in the current directory when searching for libraries.
LibPaths.insert(LibPaths.begin(), "."); LibPaths.insert(LibPaths.begin(), ".");
@ -257,7 +255,7 @@ int main(int argc, char **argv, char **envp) {
// Generate the bytecode file. // Generate the bytecode file.
if (GenerateBytecode(Composite.get(), Strip, !NoInternalize, &Out)) { if (GenerateBytecode(Composite.get(), Strip, !NoInternalize, &Out)) {
Out.close(); Out.close();
return PrintAndReturn(argv[0], "error generating bytcode"); return PrintAndReturn(argv[0], "error generating bytecode");
} }
// Close the bytecode file. // Close the bytecode file.