mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-04 03:17:51 +00:00
gold-plugin: save the .o when given -save-temps.
The plugin now save the bitcode before and after optimizations and the .o that is passed to the linker. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239726 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ad0b09d10e
commit
99e760ad9e
@ -12,6 +12,7 @@
|
||||
; 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 \
|
||||
@ -19,6 +20,8 @@
|
||||
; 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
|
||||
|
@ -787,15 +787,20 @@ static void codegen(Module &M) {
|
||||
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)
|
||||
@ -816,7 +821,7 @@ static void codegen(Module &M) {
|
||||
"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());
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user