mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-07 12:28:24 +00:00
Handle the case of the magical _GLOBAL_OFFSET_TABLE_ showing up in a
symbol difference. This matches gas behavior and fixes PR11513. We still don't handle _GLOBAL_OFFSET_TABLE_ in data sections. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146238 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1742,6 +1742,15 @@ unsigned X86ELFObjectWriter::GetRelocType(const MCValue &Target,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (IsPCRel) {
|
if (IsPCRel) {
|
||||||
|
switch ((unsigned)Fixup.getKind()) {
|
||||||
|
default: llvm_unreachable("invalid fixup kind!");
|
||||||
|
|
||||||
|
case X86::reloc_global_offset_table:
|
||||||
|
Type = ELF::R_386_GOTPC;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FK_PCRel_4:
|
||||||
|
case FK_Data_4:
|
||||||
switch (Modifier) {
|
switch (Modifier) {
|
||||||
default:
|
default:
|
||||||
llvm_unreachable("Unimplemented");
|
llvm_unreachable("Unimplemented");
|
||||||
@@ -1752,6 +1761,8 @@ unsigned X86ELFObjectWriter::GetRelocType(const MCValue &Target,
|
|||||||
Type = ELF::R_386_PLT32;
|
Type = ELF::R_386_PLT32;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
switch ((unsigned)Fixup.getKind()) {
|
switch ((unsigned)Fixup.getKind()) {
|
||||||
default: llvm_unreachable("invalid fixup kind!");
|
default: llvm_unreachable("invalid fixup kind!");
|
||||||
|
@@ -160,6 +160,11 @@
|
|||||||
// CHECK-NEXT: ('r_sym', 0x00000d)
|
// CHECK-NEXT: ('r_sym', 0x00000d)
|
||||||
// CHECK-NEXT: ('r_type', 0x21)
|
// CHECK-NEXT: ('r_type', 0x21)
|
||||||
// CHECK-NEXT: ),
|
// CHECK-NEXT: ),
|
||||||
|
// Relocation 25 (_GLOBAL_OFFSET_TABLE_-bar2) is of type R_386_GOTPC.
|
||||||
|
// CHECK-NEXT: Relocation 25
|
||||||
|
// CHECK-NEXT: (('r_offset', 0x00000094)
|
||||||
|
// CHECK-NEXT: ('r_sym', 0x00000b)
|
||||||
|
// CHECK-NEXT: ('r_type', 0x0a)
|
||||||
|
|
||||||
// Section 4 is bss
|
// Section 4 is bss
|
||||||
// CHECK: # Section 4
|
// CHECK: # Section 4
|
||||||
@@ -225,6 +230,7 @@ bar2:
|
|||||||
movl zed@DTPOFF(%eax), %eax
|
movl zed@DTPOFF(%eax), %eax
|
||||||
pushl $bar
|
pushl $bar
|
||||||
addl foo@GOTTPOFF(%edx), %eax
|
addl foo@GOTTPOFF(%edx), %eax
|
||||||
|
subl _GLOBAL_OFFSET_TABLE_-bar2, %ebx
|
||||||
|
|
||||||
.section zedsec,"awT",@progbits
|
.section zedsec,"awT",@progbits
|
||||||
zed:
|
zed:
|
||||||
|
Reference in New Issue
Block a user