diff --git a/clang/lib/Driver/ToolChains/PS4CPU.h b/clang/lib/Driver/ToolChains/PS4CPU.h index 27969bcf3726..6b1efd25f43a 100644 --- a/clang/lib/Driver/ToolChains/PS4CPU.h +++ b/clang/lib/Driver/ToolChains/PS4CPU.h @@ -100,6 +100,8 @@ public: 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 index 000000000000..b22cd2e8d864 --- /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"