[llvm-branch-commits] [llvm-branch] r353827 - Merging r353480:
Hans Wennborg via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Feb 12 03:05:22 PST 2019
Author: hans
Date: Tue Feb 12 03:05:22 2019
New Revision: 353827
URL: http://llvm.org/viewvc/llvm-project?rev=353827&view=rev
Log:
Merging r353480:
------------------------------------------------------------------------
r353480 | petarj | 2019-02-07 23:57:33 +0100 (Thu, 07 Feb 2019) | 15 lines
[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
with -fPIC flag, 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.
r344591 fixed this issue for -static compilation.
Patch by Aleksandar Beserminji.
Differential Revision: https://reviews.llvm.org/D57677
------------------------------------------------------------------------
Modified:
llvm/branches/release_80/ (props changed)
llvm/branches/release_80/lib/MC/MCExpr.cpp
llvm/branches/release_80/test/CodeGen/Mips/micromips-b-range.ll
llvm/branches/release_80/test/DebugInfo/Mips/eh_frame.ll
Propchange: llvm/branches/release_80/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 12 03:05:22 2019
@@ -1,3 +1,3 @@
/llvm/branches/Apple/Pertwee:110850,110961
/llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,351325,351344-351345,351349,351351,351370,351381,351387,351421,351426,351436,351475,351485,351753-351754,351765,351910,351930,351932,352034,352204,352246,352374,352555,352607-352608,352770,352889,352945,353015,353061,353082,353138,353141,353155,353218,353304,353308,353334,353367,353374,353383,353463,353489,353551,353809
+/llvm/trunk:155241,351325,351344-351345,351349,351351,351370,351381,351387,351421,351426,351436,351475,351485,351753-351754,351765,351910,351930,351932,352034,352204,352246,352374,352555,352607-352608,352770,352889,352945,353015,353061,353082,353138,353141,353155,353218,353304,353308,353334,353367,353374,353383,353463,353480,353489,353551,353809
Modified: llvm/branches/release_80/lib/MC/MCExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_80/lib/MC/MCExpr.cpp?rev=353827&r1=353826&r2=353827&view=diff
==============================================================================
--- llvm/branches/release_80/lib/MC/MCExpr.cpp (original)
+++ llvm/branches/release_80/lib/MC/MCExpr.cpp Tue Feb 12 03:05:22 2019
@@ -559,6 +559,11 @@ static void AttemptToFoldSymbolOffsetDif
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;
Modified: llvm/branches/release_80/test/CodeGen/Mips/micromips-b-range.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_80/test/CodeGen/Mips/micromips-b-range.ll?rev=353827&r1=353826&r2=353827&view=diff
==============================================================================
--- llvm/branches/release_80/test/CodeGen/Mips/micromips-b-range.ll (original)
+++ llvm/branches/release_80/test/CodeGen/Mips/micromips-b-range.ll Tue Feb 12 03:05:22 2019
@@ -13,7 +13,7 @@
; CHECK-NEXT: 1e: fb fd 00 00 sw $ra, 0($sp)
; CHECK-NEXT: 22: 41 a1 00 01 lui $1, 1
; CHECK-NEXT: 26: 40 60 00 02 bal 8 <foo+0x2e>
-; CHECK-NEXT: 2a: 30 21 04 68 addiu $1, $1, 1128
+; CHECK-NEXT: 2a: 30 21 04 69 addiu $1, $1, 1129
; CHECK-NEXT: 2e: 00 3f 09 50 addu $1, $ra, $1
; CHECK-NEXT: 32: ff fd 00 00 lw $ra, 0($sp)
; CHECK-NEXT: 36: 00 01 0f 3c jr $1
@@ -27,7 +27,7 @@
; CHECK-NEXT: 56: fb fd 00 00 sw $ra, 0($sp)
; CHECK-NEXT: 5a: 41 a1 00 01 lui $1, 1
; CHECK-NEXT: 5e: 40 60 00 02 bal 8 <foo+0x66>
-; CHECK-NEXT: 62: 30 21 04 5c addiu $1, $1, 1116
+; CHECK-NEXT: 62: 30 21 04 5d addiu $1, $1, 1117
; CHECK-NEXT: 66: 00 3f 09 50 addu $1, $ra, $1
; CHECK-NEXT: 6a: ff fd 00 00 lw $ra, 0($sp)
; CHECK-NEXT: 6e: 00 01 0f 3c jr $1
@@ -39,7 +39,7 @@
; CHECK-NEXT: 86: fb fd 00 00 sw $ra, 0($sp)
; CHECK-NEXT: 8a: 41 a1 00 01 lui $1, 1
; CHECK-NEXT: 8e: 40 60 00 02 bal 8 <foo+0x96>
-; CHECK-NEXT: 92: 30 21 04 2c addiu $1, $1, 1068
+; CHECK-NEXT: 92: 30 21 04 2d addiu $1, $1, 1069
; CHECK-NEXT: 96: 00 3f 09 50 addu $1, $ra, $1
; CHECK-NEXT: 9a: ff fd 00 00 lw $ra, 0($sp)
; CHECK-NEXT: 9e: 00 01 0f 3c jr $1
@@ -51,7 +51,7 @@
; CHECK-NEXT: 10476: fb fd 00 00 sw $ra, 0($sp)
; CHECK-NEXT: 1047a: 41 a1 00 01 lui $1, 1
; CHECK-NEXT: 1047e: 40 60 00 02 bal 8 <foo+0x10486>
-; CHECK-NEXT: 10482: 30 21 04 00 addiu $1, $1, 1024
+; CHECK-NEXT: 10482: 30 21 04 01 addiu $1, $1, 1025
; CHECK-NEXT: 10486: 00 3f 09 50 addu $1, $ra, $1
; CHECK-NEXT: 1048a: ff fd 00 00 lw $ra, 0($sp)
; CHECK-NEXT: 1048e: 00 01 0f 3c jr $1
Modified: llvm/branches/release_80/test/DebugInfo/Mips/eh_frame.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_80/test/DebugInfo/Mips/eh_frame.ll?rev=353827&r1=353826&r2=353827&view=diff
==============================================================================
--- llvm/branches/release_80/test/DebugInfo/Mips/eh_frame.ll (original)
+++ llvm/branches/release_80/test/DebugInfo/Mips/eh_frame.ll Tue Feb 12 03:05:22 2019
@@ -1,9 +1,21 @@
-; RUN: llc -mtriple mips-unknown-linux-gnu -mattr=+micromips -O3 -filetype=obj -o - %s | llvm-readelf -r | FileCheck %s
+; RUN: llc -mtriple mips-unknown-linux-gnu -mattr=+micromips -relocation-model=static -O3 -filetype=obj -o - %s | \
+; RUN: llvm-readelf -r | FileCheck %s --check-prefix=CHECK-READELF
+; RUN: llc -mtriple mips-unknown-linux-gnu -mattr=+micromips -relocation-model=pic -O3 -filetype=obj -o - %s | \
+; RUN: llvm-readelf -r | FileCheck %s --check-prefix=CHECK-READELF
+; RUN: llc -mtriple mips-unknown-linux-gnu -mattr=+micromips -relocation-model=static -O3 -filetype=obj -o - %s | \
+; RUN: llvm-objdump -s -j .gcc_except_table - | FileCheck %s --check-prefix=CHECK-EXCEPT-TABLE-STATIC
+; RUN: llc -mtriple mips-unknown-linux-gnu -mattr=+micromips -relocation-model=pic -O3 -filetype=obj -o - %s | \
+; RUN: llvm-objdump -s -j .gcc_except_table - | FileCheck %s --check-prefix=CHECK-EXCEPT-TABLE-PIC
-; CHECK: .rel.eh_frame
-; CHECK: DW.ref.__gxx_personality_v0
-; CHECK-NEXT: .text
-; CHECK-NEXT: .gcc_except_table
+; CHECK-READELF: .rel.eh_frame
+; CHECK-READELF: DW.ref.__gxx_personality_v0
+; CHECK-READELF-NEXT: .text
+; CHECK-READELF-NEXT: .gcc_except_table
+
+; CHECK-EXCEPT-TABLE-STATIC: 0000 ff9b1501 0c011500 00150e23 01231e00 ...........#.#..
+; CHECK-EXCEPT-TABLE-STATIC: 0010 00010000 00000000
+; CHECK-EXCEPT-TABLE-PIC: 0000 ff9b1501 0c012d00 002d133f 013f2a00 ......-..-.?.?*.
+; CHECK-EXCEPT-TABLE-PIC: 0010 00010000 00000000 ........
@_ZTIi = external constant i8*
More information about the llvm-branch-commits
mailing list