; RUN: -shared %t.o -o %t3.o
; RUN: llvm-dis %t3.o.bc -o - | FileCheck %s
; RUN: llvm-dis %t3.o.opt.bc -o - | FileCheck --check-prefix=OPT %s
+; RUN: llvm-nm %t3.o.o | FileCheck --check-prefix=NM %s
; RUN: rm -f %t4.o
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
; RUN: -shared %t.o -o %t4.o
; RUN: not test -a %t4.o
+; NM: T f3
+
target triple = "x86_64-unknown-linux-gnu"
@g7 = extern_weak global i32
legacy::PassManager CodeGenPasses;
SmallString<128> Filename;
+ if (!options::obj_path.empty())
+ Filename = options::obj_path;
+ else if (options::TheOutputType == options::OT_SAVE_TEMPS)
+ Filename = output_name + ".o";
+
int FD;
- if (options::obj_path.empty()) {
+ bool TempOutFile = Filename.empty();
+ if (TempOutFile) {
std::error_code EC =
sys::fs::createTemporaryFile("lto-llvm", "o", FD, Filename);
if (EC)
message(LDPL_FATAL, "Could not create temporary file: %s",
EC.message().c_str());
} else {
- Filename = options::obj_path;
std::error_code EC =
sys::fs::openFileForWrite(Filename.c_str(), FD, sys::fs::F_None);
if (EC)
"Unable to add .o file to the link. File left behind in: %s",
Filename.c_str());
- if (options::obj_path.empty())
+ if (TempOutFile)
Cleanup.push_back(Filename.c_str());
}