forked from OSchip/llvm-project
If a symbol is global, reloc against it even if it is in a mergeable section.
llvm-svn: 115817
This commit is contained in:
parent
569eafce63
commit
d444577382
|
@ -539,12 +539,12 @@ static bool ShouldRelocOnSymbol(const MCSymbolData &SD,
|
||||||
const MCSectionELF &Section =
|
const MCSectionELF &Section =
|
||||||
static_cast<const MCSectionELF&>(Symbol.getSection());
|
static_cast<const MCSectionELF&>(Symbol.getSection());
|
||||||
|
|
||||||
if (Section.getFlags() & MCSectionELF::SHF_MERGE)
|
|
||||||
return Target.getConstant() != 0;
|
|
||||||
|
|
||||||
if (SD.isExternal())
|
if (SD.isExternal())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if (Section.getFlags() & MCSectionELF::SHF_MERGE)
|
||||||
|
return Target.getConstant() != 0;
|
||||||
|
|
||||||
MCSymbolRefExpr::VariantKind Kind = Target.getSymA()->getKind();
|
MCSymbolRefExpr::VariantKind Kind = Target.getSymA()->getKind();
|
||||||
const MCSectionELF &Sec2 =
|
const MCSectionELF &Sec2 =
|
||||||
static_cast<const MCSectionELF&>(F.getParent()->getSection());
|
static_cast<const MCSectionELF&>(F.getParent()->getSection());
|
||||||
|
|
|
@ -12,9 +12,12 @@
|
||||||
movl $.Lfoo+2, %edi
|
movl $.Lfoo+2, %edi
|
||||||
jmp foo@PLT
|
jmp foo@PLT
|
||||||
movq foo@GOTPCREL, %rax
|
movq foo@GOTPCREL, %rax
|
||||||
|
movq zed, %rax
|
||||||
|
|
||||||
.section .sec1,"aM",@progbits,16
|
.section .sec1,"aM",@progbits,16
|
||||||
.Lfoo:
|
.Lfoo:
|
||||||
|
zed:
|
||||||
|
.global zed
|
||||||
|
|
||||||
.section bar,"ax",@progbits
|
.section bar,"ax",@progbits
|
||||||
foo:
|
foo:
|
||||||
|
@ -39,6 +42,10 @@ foo:
|
||||||
// CHECK-NEXT: ('st_other', 0)
|
// CHECK-NEXT: ('st_other', 0)
|
||||||
// CHECK-NEXT: ('st_shndx', 4)
|
// 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
|
// Relocation 0 refers to symbol 1
|
||||||
// CHECK: ('_relocations', [
|
// CHECK: ('_relocations', [
|
||||||
// CHECK-NEXT: # Relocation 0
|
// CHECK-NEXT: # Relocation 0
|
||||||
|
@ -79,4 +86,12 @@ foo:
|
||||||
// CHECK-NEXT: ('r_type', 9
|
// CHECK-NEXT: ('r_type', 9
|
||||||
// CHECK-NEXT: ('r_addend',
|
// CHECK-NEXT: ('r_addend',
|
||||||
// CHECK-NEXT: ),
|
// 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: ])
|
// CHECK-NEXT: ])
|
||||||
|
|
Loading…
Reference in New Issue