This revision was automatically updated to reflect the committed changes.
Closed by commit rL353877: Disable PIC/PIE for MSP430 target (authored by asl, 
committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56927/new/

https://reviews.llvm.org/D56927

Files:
  cfe/trunk/lib/Driver/ToolChains/MSP430.h
  cfe/trunk/test/CodeGen/msp430-reloc.c


Index: cfe/trunk/test/CodeGen/msp430-reloc.c
===================================================================
--- cfe/trunk/test/CodeGen/msp430-reloc.c
+++ cfe/trunk/test/CodeGen/msp430-reloc.c
@@ -0,0 +1,30 @@
+// REQUIRES: msp430-registered-target
+// RUN: %clang -target msp430 -fPIC -S %s -o - | FileCheck %s
+
+// Check the compilation does not crash as it was crashing before with "-fPIC" 
enabled
+
+void *alloca(unsigned int size);
+
+// CHECK: .globl foo
+short foo(char** data, char encoding)
+{
+       char* encoding_addr = alloca(sizeof(char));
+       *encoding_addr = encoding;
+
+       char tmp3 = *encoding_addr;
+       short conv2 = tmp3;
+       short and = conv2 & 0xf;
+
+       switch (and)
+       {
+       case 0 :
+       case 4 :
+       case 10 :
+               return 1;
+       case 11 :
+               return 2;
+       }
+
+       return 0;
+}
+
Index: cfe/trunk/lib/Driver/ToolChains/MSP430.h
===================================================================
--- cfe/trunk/lib/Driver/ToolChains/MSP430.h
+++ cfe/trunk/lib/Driver/ToolChains/MSP430.h
@@ -36,6 +36,10 @@
                              llvm::opt::ArgStringList &CC1Args,
                              Action::OffloadKind) const override;
 
+  bool isPICDefault() const override { return false; }
+  bool isPIEDefault() const override { return false; }
+  bool isPICDefaultForced() const override { return true; }
+
 protected:
   Tool *buildLinker() const override;
 


Index: cfe/trunk/test/CodeGen/msp430-reloc.c
===================================================================
--- cfe/trunk/test/CodeGen/msp430-reloc.c
+++ cfe/trunk/test/CodeGen/msp430-reloc.c
@@ -0,0 +1,30 @@
+// REQUIRES: msp430-registered-target
+// RUN: %clang -target msp430 -fPIC -S %s -o - | FileCheck %s
+
+// Check the compilation does not crash as it was crashing before with "-fPIC" enabled
+
+void *alloca(unsigned int size);
+
+// CHECK: .globl foo
+short foo(char** data, char encoding)
+{
+	char* encoding_addr = alloca(sizeof(char));
+	*encoding_addr = encoding;
+
+	char tmp3 = *encoding_addr;
+	short conv2 = tmp3;
+	short and = conv2 & 0xf;
+
+	switch (and)
+	{
+	case 0 :
+	case 4 :
+	case 10 :
+		return 1;
+	case 11 :
+		return 2;
+	}
+
+	return 0;
+}
+
Index: cfe/trunk/lib/Driver/ToolChains/MSP430.h
===================================================================
--- cfe/trunk/lib/Driver/ToolChains/MSP430.h
+++ cfe/trunk/lib/Driver/ToolChains/MSP430.h
@@ -36,6 +36,10 @@
                              llvm::opt::ArgStringList &CC1Args,
                              Action::OffloadKind) const override;
 
+  bool isPICDefault() const override { return false; }
+  bool isPIEDefault() const override { return false; }
+  bool isPICDefaultForced() const override { return true; }
+
 protected:
   Tool *buildLinker() const override;
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to