[clang] 9d23b50 - [PS4] Enable relaxed relocations by default

Ben Dunbobbin via cfe-commits cfe-commits at lists.llvm.org
Thu May 21 15:05:57 PDT 2020


Author: Ben Dunbobbin
Date: 2020-05-21T23:05:44+01:00
New Revision: 9d23b5025d5f6614a2b2b1b6fc19997f0fb69138

URL: https://github.com/llvm/llvm-project/commit/9d23b5025d5f6614a2b2b1b6fc19997f0fb69138
DIFF: https://github.com/llvm/llvm-project/commit/9d23b5025d5f6614a2b2b1b6fc19997f0fb69138.diff

LOG: [PS4] Enable relaxed relocations by default

PS4 supports these relocations types; so, we want to enable them by default.

Differential Revision: https://reviews.llvm.org/D79980

Added: 
    clang/test/Driver/ps4-relax-relocations.c

Modified: 
    clang/lib/Driver/ToolChains/PS4CPU.h

Removed: 
    


################################################################################
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 @@ class LLVM_LIBRARY_VISIBILITY PS4CPU : public Generic_ELF {
     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"


        


More information about the cfe-commits mailing list