[llvm-commits] [llvm] r115817 - in /llvm/trunk: lib/MC/ELFObjectWriter.cpp test/MC/ELF/merge.s
Rafael Espindola
rafael.espindola at gmail.com
Wed Oct 6 12:27:21 PDT 2010
Author: rafael
Date: Wed Oct 6 14:27:21 2010
New Revision: 115817
URL: http://llvm.org/viewvc/llvm-project?rev=115817&view=rev
Log:
If a symbol is global, reloc against it even if it is in a mergeable section.
Modified:
llvm/trunk/lib/MC/ELFObjectWriter.cpp
llvm/trunk/test/MC/ELF/merge.s
Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=115817&r1=115816&r2=115817&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Wed Oct 6 14:27:21 2010
@@ -539,12 +539,12 @@
const MCSectionELF &Section =
static_cast<const MCSectionELF&>(Symbol.getSection());
- if (Section.getFlags() & MCSectionELF::SHF_MERGE)
- return Target.getConstant() != 0;
-
if (SD.isExternal())
return true;
+ if (Section.getFlags() & MCSectionELF::SHF_MERGE)
+ return Target.getConstant() != 0;
+
MCSymbolRefExpr::VariantKind Kind = Target.getSymA()->getKind();
const MCSectionELF &Sec2 =
static_cast<const MCSectionELF&>(F.getParent()->getSection());
Modified: llvm/trunk/test/MC/ELF/merge.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/merge.s?rev=115817&r1=115816&r2=115817&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/merge.s (original)
+++ llvm/trunk/test/MC/ELF/merge.s Wed Oct 6 14:27:21 2010
@@ -12,9 +12,12 @@
movl $.Lfoo+2, %edi
jmp foo at PLT
movq foo at GOTPCREL, %rax
+ movq zed, %rax
.section .sec1,"aM", at progbits,16
.Lfoo:
+zed:
+ .global zed
.section bar,"ax", at progbits
foo:
@@ -39,6 +42,10 @@
// CHECK-NEXT: ('st_other', 0)
// CHECK-NEXT: ('st_shndx', 4)
+// Symbol number 8 is zed
+// CHECK: # Symbol 8
+// CHECK-NEXT: (('st_name', 11) # 'zed'
+
// Relocation 0 refers to symbol 1
// CHECK: ('_relocations', [
// CHECK-NEXT: # Relocation 0
@@ -79,4 +86,12 @@
// CHECK-NEXT: ('r_type', 9
// CHECK-NEXT: ('r_addend',
// CHECK-NEXT: ),
+
+// Relocation 5 refers to symbol 8
+// CHECK-NEXT: # Relocation 5
+// CHECK-NEXT: (('r_offset', 35)
+// CHECK-NEXT: ('r_sym', 8)
+// CHECK-NEXT: ('r_type', 11)
+// CHECK-NEXT: ('r_addend', 0)
+// CHECK-NEXT: ),
// CHECK-NEXT: ])
More information about the llvm-commits
mailing list