summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM/ARMTargetMachine.cpp
diff options
context:
space:
mode:
authorMichael Platings <michael.platings@arm.com>2019-03-07 09:15:23 +0000
committerMichael Platings <michael.platings@arm.com>2019-03-07 09:15:23 +0000
commitfd4156ed4d30828fbcca7b42618dde0550c9b674 (patch)
treefdc8b02c65f61b60fcdd2b7702a1e77badce6b9a /llvm/lib/Target/ARM/ARMTargetMachine.cpp
parentb0f764c73732958745f13e5310131d0e7c3fa400 (diff)
downloadbcm5719-llvm-fd4156ed4d30828fbcca7b42618dde0550c9b674.tar.gz
bcm5719-llvm-fd4156ed4d30828fbcca7b42618dde0550c9b674.zip
[IR][ARM] Add function pointer alignment to datalayout
Use this feature to fix a bug on ARM where 4 byte alignment is incorrectly assumed. Differential Revision: https://reviews.llvm.org/D57335 llvm-svn: 355585
Diffstat (limited to 'llvm/lib/Target/ARM/ARMTargetMachine.cpp')
-rw-r--r--llvm/lib/Target/ARM/ARMTargetMachine.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/ARMTargetMachine.cpp b/llvm/lib/Target/ARM/ARMTargetMachine.cpp
index 9954eee2e5f..401843c1e0f 100644
--- a/llvm/lib/Target/ARM/ARMTargetMachine.cpp
+++ b/llvm/lib/Target/ARM/ARMTargetMachine.cpp
@@ -141,6 +141,10 @@ static std::string computeDataLayout(const Triple &TT, StringRef CPU,
// Pointers are 32 bits and aligned to 32 bits.
Ret += "-p:32:32";
+ // Function pointers are aligned to 8 bits (because the LSB stores the
+ // ARM/Thumb state).
+ Ret += "-Fi8";
+
// ABIs other than APCS have 64 bit integers with natural alignment.
if (ABI != ARMBaseTargetMachine::ARM_ABI_APCS)
Ret += "-i64:64";
OpenPOWER on IntegriCloud