diff --git a/clang/lib/Driver/ToolChains/PS4CPU.h b/clang/lib/Driver/ToolChains/PS4CPU.h --- a/clang/lib/Driver/ToolChains/PS4CPU.h +++ b/clang/lib/Driver/ToolChains/PS4CPU.h @@ -100,6 +100,8 @@ return llvm::DenormalMode::getPreserveSign(); } + bool useRelaxRelocations() const override { return true; } + protected: Tool *buildAssembler() const override; Tool *buildLinker() const override; diff --git a/clang/test/Driver/ps4-relax-relocations.c b/clang/test/Driver/ps4-relax-relocations.c new file mode 100644 --- /dev/null +++ b/clang/test/Driver/ps4-relax-relocations.c @@ -0,0 +1,18 @@ +// REQUIRES: x86-registered-target + +// RUN: %clang -### -target x86_64-scei-ps4 %s -o - 2>&1 | \ +// RUN: FileCheck %s +// RUN: %clang -### -target x86_64-scei-ps4 -Wa,-mrelax-relocations=yes %s -o - 2>&1 | \ +// RUN: FileCheck %s +// RUN: %clang -### -target x86_64-scei-ps4 -Wa,-mrelax-relocations=no %s -o - 2>&1 | \ +// RUN: FileCheck -check-prefix=UNSET %s +// RUN: %clang -### -x assembler -target x86_64-scei-ps4 %s -o - 2>&1 | \ +// RUN: FileCheck %s +// RUN: %clang -### -x assembler -target x86_64-scei-ps4 -Wa,-mrelax-relocations=yes %s -o - 2>&1 | \ +// RUN: FileCheck %s +// RUN: %clang -### -x assembler -target x86_64-scei-ps4 -Wa,-mrelax-relocations=no %s -o - 2>&1 | \ +// RUN: FileCheck -check-prefix=UNSET %s + +// CHECK: "--mrelax-relocations" + +// UNSET-NOT: "--mrelax-relocations"