summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC
diff options
context:
space:
mode:
authorAleksandar Beserminji <abeserminji@wavecomp.com>2018-10-16 08:27:28 +0000
committerAleksandar Beserminji <abeserminji@wavecomp.com>2018-10-16 08:27:28 +0000
commita5949439ca6adbb3b19dbd599880ff5b239f964e (patch)
tree4be20376f56b291b1647ab57a8e16915b42beb28 /llvm/lib/MC
parent8d56be707038f99cf4e387c2a9390d39bea287cc (diff)
downloadbcm5719-llvm-a5949439ca6adbb3b19dbd599880ff5b239f964e.tar.gz
bcm5719-llvm-a5949439ca6adbb3b19dbd599880ff5b239f964e.zip
[mips][micromips] Fix how values in .gcc_except_table are calculated
When a landing pad is calculated in a program that is compiled for micromips, it will point to an even address. Such an error will cause a segmentation fault, as the instructions in micromips are aligned on odd addresses. This patch sets the last bit of the offset where a landing pad is, to 1, which will effectively be an odd address and point to the instruction exactly. Differential Revision: https://reviews.llvm.org/D52985 llvm-svn: 344591
Diffstat (limited to 'llvm/lib/MC')
-rw-r--r--llvm/lib/MC/MCExpr.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCExpr.cpp b/llvm/lib/MC/MCExpr.cpp
index a4458e64bd3..38f311be7c6 100644
--- a/llvm/lib/MC/MCExpr.cpp
+++ b/llvm/lib/MC/MCExpr.cpp
@@ -526,6 +526,11 @@ static void AttemptToFoldSymbolOffsetDifference(
if (Asm->isThumbFunc(&SA))
Addend |= 1;
+ // If symbol is labeled as micromips, we set low-bit to ensure
+ // correct offset in .gcc_except_table
+ if (Asm->getBackend().isMicroMips(&SA))
+ Addend |= 1;
+
// Clear the symbol expr pointers to indicate we have folded these
// operands.
A = B = nullptr;
OpenPOWER on IntegriCloud