[PATCH] D33975: [MachO] Fix codegen of alias of alias.
Evgenii Stepanov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 7 14:50:55 PDT 2017
eugenis updated this revision to Diff 101818.
Repository:
rL LLVM
https://reviews.llvm.org/D33975
Files:
lib/MC/MCExpr.cpp
test/MC/MachO/alias.ll
test/MC/MachO/variable-exprs.s
Index: test/MC/MachO/variable-exprs.s
===================================================================
--- test/MC/MachO/variable-exprs.s
+++ test/MC/MachO/variable-exprs.s
@@ -110,8 +110,8 @@
// CHECK-I386: 0x2C 0 2 0 GENERIC_RELOC_VANILLA 0 __data
// CHECK-I386: 0x28 0 2 0 GENERIC_RELOC_VANILLA 0 __data
// CHECK-I386: 0x24 0 2 1 GENERIC_RELOC_VANILLA 0 d3
-// CHECK-I386: 0x20 0 2 1 GENERIC_RELOC_VANILLA 0 d2
-// CHECK-I386: 0x1C 0 2 1 GENERIC_RELOC_VANILLA 0 d
+// CHECK-I386: 0x20 0 2 1 GENERIC_RELOC_VANILLA 0 d{{$}}
+// CHECK-I386: 0x1C 0 2 1 GENERIC_RELOC_VANILLA 0 d{{$}}
// CHECK-I386: 0x18 0 2 n/a GENERIC_RELOC_VANILLA 1 0x5
// CHECK-I386: 0x14 0 2 0 GENERIC_RELOC_VANILLA 0 __data
// CHECK-I386: 0x10 0 2 0 GENERIC_RELOC_VANILLA 0 __data
@@ -319,8 +319,8 @@
// CHECK-X86_64: 0x2C 0 2 1 X86_64_RELOC_UNSIGNED 0 g
// CHECK-X86_64: 0x28 0 2 1 X86_64_RELOC_UNSIGNED 0 f
// CHECK-X86_64: 0x24 0 2 1 X86_64_RELOC_UNSIGNED 0 d3
-// CHECK-X86_64: 0x20 0 2 1 X86_64_RELOC_UNSIGNED 0 d2
-// CHECK-X86_64: 0x1C 0 2 1 X86_64_RELOC_UNSIGNED 0 d
+// CHECK-X86_64: 0x20 0 2 1 X86_64_RELOC_UNSIGNED 0 d{{$}}
+// CHECK-X86_64: 0x1C 0 2 1 X86_64_RELOC_UNSIGNED 0 d{{$}}
// CHECK-X86_64: 0x18 0 2 1 X86_64_RELOC_UNSIGNED 0 a
// CHECK-X86_64: 0x14 0 2 1 X86_64_RELOC_UNSIGNED 0 e
// CHECK-X86_64: 0x10 0 2 1 X86_64_RELOC_UNSIGNED 0 b
Index: test/MC/MachO/alias.ll
===================================================================
--- /dev/null
+++ test/MC/MachO/alias.ll
@@ -0,0 +1,6 @@
+// RUN: llvm-mc -triple x86_64-apple-macosx10.12.0 %s -filetype=obj -o /dev/null
+
+l_a:
+l_b = l_a
+l_c = l_b
+ .long l_c
Index: lib/MC/MCExpr.cpp
===================================================================
--- lib/MC/MCExpr.cpp
+++ lib/MC/MCExpr.cpp
@@ -655,8 +655,12 @@
// the OS X assembler will completely drop the 4. We should probably
// include it in the relocation or produce an error if that is not
// possible.
+ // Allow constant expressions.
if (!A && !B)
return true;
+ // Allows aliases with zero offset.
+ if (Res.getConstant() == 0 && (!A || !B))
+ return true;
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33975.101818.patch
Type: text/x-patch
Size: 2269 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170607/18def02e/attachment.bin>
More information about the llvm-commits
mailing list