forked from OSchip/llvm-project
Disable PIC/PIE for MSP430 target by default.
Relocatable code generation is meaningless on MSP430, as the platform is too small to use shared libraries. Patch by Dmitry Mikushev! Differential Revision: https://reviews.llvm.org/D56927 llvm-svn: 352181
This commit is contained in:
parent
2a1f300bb5
commit
56bf7b56dc
|
@ -36,6 +36,10 @@ public:
|
|||
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;
|
||||
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
// 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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue