[llvm-commits] [llvm] r148341 - in /llvm/trunk: lib/MC/MachObjectWriter.cpp test/MC/MachO/ARM/darwin-ARM-reloc.s test/MC/MachO/reloc-pcrel-offset.s test/MC/MachO/reloc-pcrel.s
Jim Grosbach
grosbach at apple.com
Tue Jan 17 14:14:39 PST 2012
Author: grosbach
Date: Tue Jan 17 16:14:39 2012
New Revision: 148341
URL: http://llvm.org/viewvc/llvm-project?rev=148341&view=rev
Log:
MC tweak symbol difference resolution for non-local symbols.
When the non-local symbol in the expression is in the same fragment
as the second symbol, the assembler can still evaluate the expression
without needing a relocation.
For example, on ARM:
_foo:
ldr lr, (_foo - 4)
rdar://10348687
Modified:
llvm/trunk/lib/MC/MachObjectWriter.cpp
llvm/trunk/test/MC/MachO/ARM/darwin-ARM-reloc.s
llvm/trunk/test/MC/MachO/reloc-pcrel-offset.s
llvm/trunk/test/MC/MachO/reloc-pcrel.s
Modified: llvm/trunk/lib/MC/MachObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MachObjectWriter.cpp?rev=148341&r1=148340&r2=148341&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MachObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/MachObjectWriter.cpp Tue Jan 17 16:14:39 2012
@@ -590,8 +590,8 @@
// assembler locals.
if (!Asm.getBackend().hasReliableSymbolDifference()) {
- if ((!SA.isTemporary() && Asm.getSubsectionsViaSymbols()) ||
- !SA.isInSection() || &SecA != &SecB)
+ if (!SA.isInSection() || &SecA != &SecB ||
+ (!SA.isTemporary() && &FB != Asm.getSymbolData(SA).getFragment()))
return false;
return true;
}
Modified: llvm/trunk/test/MC/MachO/ARM/darwin-ARM-reloc.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/MachO/ARM/darwin-ARM-reloc.s?rev=148341&r1=148340&r2=148341&view=diff
==============================================================================
--- llvm/trunk/test/MC/MachO/ARM/darwin-ARM-reloc.s (original)
+++ llvm/trunk/test/MC/MachO/ARM/darwin-ARM-reloc.s Tue Jan 17 16:14:39 2012
@@ -12,9 +12,9 @@
.data
_d0:
-Ld0_0:
+Ld0_0:
.long Lsc0_0 - Ld0_0
-
+
.section __TEXT,__cstring,cstring_literals
Lsc0_0:
.long 0
Modified: llvm/trunk/test/MC/MachO/reloc-pcrel-offset.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/MachO/reloc-pcrel-offset.s?rev=148341&r1=148340&r2=148341&view=diff
==============================================================================
--- llvm/trunk/test/MC/MachO/reloc-pcrel-offset.s (original)
+++ llvm/trunk/test/MC/MachO/reloc-pcrel-offset.s Tue Jan 17 16:14:39 2012
@@ -11,6 +11,7 @@
.text
_a:
+_b:
call _a
.subsections_via_symbols
Modified: llvm/trunk/test/MC/MachO/reloc-pcrel.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/MachO/reloc-pcrel.s?rev=148341&r1=148340&r2=148341&view=diff
==============================================================================
--- llvm/trunk/test/MC/MachO/reloc-pcrel.s (original)
+++ llvm/trunk/test/MC/MachO/reloc-pcrel.s Tue Jan 17 16:14:39 2012
@@ -8,13 +8,13 @@
// CHECK: ('word-1', 0x6)),
// CHECK: # Relocation 2
// CHECK: (('word-0', 0x40),
-// CHECK: ('word-1', 0xd000002)),
+// CHECK: ('word-1', 0xd000003)),
// CHECK: # Relocation 3
// CHECK: (('word-0', 0x3b),
-// CHECK: ('word-1', 0xd000002)),
+// CHECK: ('word-1', 0xd000003)),
// CHECK: # Relocation 4
// CHECK: (('word-0', 0x36),
-// CHECK: ('word-1', 0xd000002)),
+// CHECK: ('word-1', 0xd000003)),
// CHECK: # Relocation 5
// CHECK: (('word-0', 0xe0000031),
// CHECK: ('word-1', 0x4)),
@@ -41,6 +41,7 @@
_a:
xorl %eax,%eax
_b:
+_d:
xorl %eax,%eax
L0:
xorl %eax,%eax
More information about the llvm-commits
mailing list