forked from OSchip/llvm-project
gold-plugin: Simplify naming of object files created with save-temps or obj-path.
Now we never append a number to the file name for task ID 0. Differential Revision: https://reviews.llvm.org/D29160 llvm-svn: 293132
This commit is contained in:
parent
aae91d1041
commit
6201d78653
|
@ -1,9 +1,9 @@
|
|||
; RUN: llvm-as -o %t.bc %s
|
||||
; RUN: rm -f %t.opt.bc0 %t.opt.bc1 %t.o0 %t.o1
|
||||
; RUN: rm -f %t.0.5.precodegen.bc %t.1.5.precodegen.bc %t.o %t.o1
|
||||
; RUN: env LD_PRELOAD=%llvmshlibdir/LLVMgold.so %gold -plugin %llvmshlibdir/LLVMgold.so -u foo -u bar -plugin-opt lto-partitions=2 -plugin-opt save-temps -m elf_x86_64 -o %t %t.bc
|
||||
; RUN: llvm-dis %t.0.5.precodegen.bc -o - | FileCheck --check-prefix=CHECK-BC0 %s
|
||||
; RUN: llvm-dis %t.1.5.precodegen.bc -o - | FileCheck --check-prefix=CHECK-BC1 %s
|
||||
; RUN: llvm-nm %t.o0 | FileCheck --check-prefix=CHECK0 %s
|
||||
; RUN: llvm-nm %t.o | FileCheck --check-prefix=CHECK0 %s
|
||||
; RUN: llvm-nm %t.o1 | FileCheck --check-prefix=CHECK1 %s
|
||||
|
||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||
|
|
|
@ -106,7 +106,6 @@ static DenseMap<int, void *> FDToLeaderHandle;
|
|||
static StringMap<ResolutionInfo> ResInfo;
|
||||
static std::vector<std::string> Cleanup;
|
||||
static llvm::TargetOptions TargetOpts;
|
||||
static size_t MaxTasks;
|
||||
|
||||
namespace options {
|
||||
enum OutputType {
|
||||
|
@ -637,7 +636,7 @@ static void recordFile(std::string Filename, bool TempOutFile) {
|
|||
/// indicating whether a temp file should be generated, and an optional task id.
|
||||
/// The new filename generated is returned in \p NewFilename.
|
||||
static void getOutputFileName(SmallString<128> InFilename, bool TempOutFile,
|
||||
SmallString<128> &NewFilename, int TaskID = -1) {
|
||||
SmallString<128> &NewFilename, int TaskID) {
|
||||
if (TempOutFile) {
|
||||
std::error_code EC =
|
||||
sys::fs::createTemporaryFile("lto-llvm", "o", NewFilename);
|
||||
|
@ -646,7 +645,7 @@ static void getOutputFileName(SmallString<128> InFilename, bool TempOutFile,
|
|||
EC.message().c_str());
|
||||
} else {
|
||||
NewFilename = InFilename;
|
||||
if (TaskID >= 0)
|
||||
if (TaskID > 0)
|
||||
NewFilename += utostr(TaskID);
|
||||
}
|
||||
}
|
||||
|
@ -813,7 +812,7 @@ static ld_plugin_status allSymbolsReadHook() {
|
|||
Filename = output_name + ".o";
|
||||
bool SaveTemps = !Filename.empty();
|
||||
|
||||
MaxTasks = Lto->getMaxTasks();
|
||||
size_t MaxTasks = Lto->getMaxTasks();
|
||||
std::vector<uintptr_t> IsTemporary(MaxTasks);
|
||||
std::vector<SmallString<128>> Filenames(MaxTasks);
|
||||
|
||||
|
@ -821,7 +820,7 @@ static ld_plugin_status allSymbolsReadHook() {
|
|||
[&](size_t Task) -> std::unique_ptr<lto::NativeObjectStream> {
|
||||
IsTemporary[Task] = !SaveTemps;
|
||||
getOutputFileName(Filename, /*TempOutFile=*/!SaveTemps, Filenames[Task],
|
||||
MaxTasks > 1 ? Task : -1);
|
||||
Task);
|
||||
int FD;
|
||||
std::error_code EC =
|
||||
sys::fs::openFileForWrite(Filenames[Task], FD, sys::fs::F_None);
|
||||
|
|
Loading…
Reference in New Issue