mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-29 06:10:48 +00:00
[gold] -thinlto-object-suffix-replace: don't append new suffix if path does not end with old suffix
Summary: This is to be consistent with lld behavior since rLLD340364. Reviewers: tejohnson Reviewed By: tejohnson Subscribers: steven_wu, eraman, mehdi_amini, inglorion, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D51060 llvm-svn: 340380
This commit is contained in:
parent
5602b833c9
commit
8c95eeae9d
@ -27,6 +27,17 @@
|
||||
; RUN: -shared %t1.thinlink.bc -o %t3
|
||||
; RUN: diff %t1.o.thinlto.bc.orig %t1.o.thinlto.bc
|
||||
|
||||
; If filename does not end with old suffix, no suffix change should occur,
|
||||
; so ".thinlto.bc" will simply be appended to the input file name.
|
||||
; RUN: rm -f %t1.thinlink.bc.thinlto.bc
|
||||
; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext \
|
||||
; RUN: -m elf_x86_64 \
|
||||
; RUN: --plugin-opt=thinlto \
|
||||
; RUN: --plugin-opt=thinlto-index-only \
|
||||
; RUN: --plugin-opt=thinlto-object-suffix-replace=".abc;.o" \
|
||||
; RUN: -shared %t1.thinlink.bc -o /dev/null
|
||||
; RUN: ls %t1.thinlink.bc.thinlto.bc
|
||||
|
||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
|
@ -667,13 +667,9 @@ static void getThinLTOOldAndNewSuffix(std::string &OldSuffix,
|
||||
/// suffix matching \p OldSuffix with \p NewSuffix.
|
||||
static std::string getThinLTOObjectFileName(StringRef Path, StringRef OldSuffix,
|
||||
StringRef NewSuffix) {
|
||||
if (OldSuffix.empty() && NewSuffix.empty())
|
||||
return Path;
|
||||
StringRef NewPath = Path;
|
||||
NewPath.consume_back(OldSuffix);
|
||||
std::string NewNewPath = NewPath;
|
||||
NewNewPath += NewSuffix;
|
||||
return NewNewPath;
|
||||
if (Path.consume_back(OldSuffix))
|
||||
return (Path + NewSuffix).str();
|
||||
return Path;
|
||||
}
|
||||
|
||||
// Returns true if S is valid as a C language identifier.
|
||||
|
Loading…
Reference in New Issue
Block a user