Index: ELF/Writer.cpp =================================================================== --- ELF/Writer.cpp +++ ELF/Writer.cpp @@ -63,7 +63,6 @@ void assignFileOffsetsBinary(); void setPhdrs(); void fixSectionAlignments(); - void makeMipsGpAbs(); void openFile(); void writeTrapInstr(); void writeHeader(); @@ -216,8 +215,6 @@ if (Config->Relocatable) { for (OutputSection *Sec : OutputSections) Sec->Addr = 0; - } else { - makeMipsGpAbs(); } // It does not make sense try to open the file if we have error already. @@ -1785,14 +1782,6 @@ return ET_EXEC; } -// For some reason we have to make the mips gp symbol absolute. -template void Writer::makeMipsGpAbs() { - if (ElfSym::MipsGp && ElfSym::MipsGp->Section) { - ElfSym::MipsGp->Value += cast(ElfSym::MipsGp->Section)->Addr; - ElfSym::MipsGp->Section = nullptr; - } -} - template void Writer::writeHeader() { uint8_t *Buf = Buffer->getBufferStart(); memcpy(Buf, "\177ELF", 4); Index: test/ELF/basic-mips.s =================================================================== --- test/ELF/basic-mips.s +++ test/ELF/basic-mips.s @@ -228,7 +228,7 @@ # CHECK-NEXT: Other [ (0x2) # CHECK-NEXT: STV_HIDDEN (0x2) # CHECK-NEXT: ] -# CHECK-NEXT: Section: Absolute +# CHECK-NEXT: Section: .got # CHECK-NEXT: } # CHECK-NEXT: Symbol { # CHECK-NEXT: Name: __start Index: test/ELF/mips-64-gprel-so.s =================================================================== --- test/ELF/mips-64-gprel-so.s +++ test/ELF/mips-64-gprel-so.s @@ -12,7 +12,7 @@ # CHECK-NEXT: 10004: 03 99 e0 2d daddu $gp, $gp, $25 # CHECK-NEXT: 10008: 67 9c 7f f0 daddiu $gp, $gp, 32752 -# CHECK: 0000000000027ff0 *ABS* 00000000 .hidden _gp +# CHECK: 0000000000027ff0 .got 00000000 .hidden _gp # CHECK: 0000000000010000 .text 00000000 foo .text Index: test/ELF/mips-64-rels.s =================================================================== --- test/ELF/mips-64-rels.s +++ test/ELF/mips-64-rels.s @@ -24,7 +24,7 @@ # ^-- 0x20004 - 0x37ff0 = 0xfffffffffffe8014 # CHECK: 0000000000020004 .text 00000000 loc -# CHECK: 0000000000037ff0 *ABS* 00000000 .hidden _gp +# CHECK: 0000000000037ff0 .got 00000000 .hidden _gp # CHECK: 0000000000020000 .text 00000000 __start # REL: Relocations [ Index: test/ELF/mips-got-relocs.s =================================================================== --- test/ELF/mips-got-relocs.s +++ test/ELF/mips-got-relocs.s @@ -47,7 +47,7 @@ # EXE_SYM: Sections: # EXE_SYM: .got 0000000c 0000000000030010 DATA # EXE_SYM: SYMBOL TABLE: -# EXE_SYM: 00038000 *ABS* 00000000 .hidden _gp +# EXE_SYM: 00038000 .got 00000000 .hidden _gp # ^-- .got + GP offset (0x7ff0) # EXE_SYM: 00030000 g .data 00000004 v1 @@ -71,7 +71,7 @@ # DSO_SYM: Sections: # DSO_SYM: .got 0000000c 0000000000020010 DATA # DSO_SYM: SYMBOL TABLE: -# DSO_SYM: 00028000 *ABS* 00000000 .hidden _gp +# DSO_SYM: 00028000 .got 00000000 .hidden _gp # ^-- .got + GP offset (0x7ff0) # DSO_SYM: 00020000 g .data 00000004 v1 Index: test/ELF/mips-gp-disp.s =================================================================== --- test/ELF/mips-gp-disp.s +++ test/ELF/mips-gp-disp.s @@ -24,7 +24,7 @@ # DIS-NEXT: 10000: 3c 08 00 01 lui $8, 1 # DIS-NEXT: 10004: 21 08 7f f0 addi $8, $8, 32752 # ^-- 0x37ff0 & 0xffff -# DIS: 00027ff0 *ABS* 00000000 .hidden _gp +# DIS: 00027ff0 .got 00000000 .hidden _gp # REL: Relocations [ # REL-NEXT: ] Index: test/ELF/mips-gp-local.s =================================================================== --- test/ELF/mips-gp-local.s +++ test/ELF/mips-gp-local.s @@ -11,7 +11,7 @@ # CHECK-NEXT: 20000: 3c 08 00 03 lui $8, 3 # CHECK-NEXT: 20004: 21 08 7f f0 addi $8, $8, 32752 -# CHECK: 00037ff0 *ABS* 00000000 .hidden _gp +# CHECK: 00037ff0 .got 00000000 .hidden _gp .text .globl __start Index: test/ELF/mips-gprel32-relocs-gp0.s =================================================================== --- test/ELF/mips-gprel32-relocs-gp0.s +++ test/ELF/mips-gprel32-relocs-gp0.s @@ -29,7 +29,7 @@ # DUMP: SYMBOL TABLE: # DUMP: 00010008 .text 00000000 bar # DUMP: 00010004 .text 00000000 foo -# DUMP: 00027ff0 *ABS* 00000000 .hidden _gp +# DUMP: 00027ff0 .got 00000000 .hidden _gp # ERR: error: {{.*}}mips-gp0-non-zero.o: unsupported non-zero ri_gp_value Index: test/ELF/mips-gprel32-relocs.s =================================================================== --- test/ELF/mips-gprel32-relocs.s +++ test/ELF/mips-gprel32-relocs.s @@ -28,4 +28,4 @@ # CHECK: SYMBOL TABLE: # CHECK: 00010008 .text 00000000 bar # CHECK: 00010004 .text 00000000 foo -# CHECK: 00027ff0 *ABS* 00000000 .hidden _gp +# CHECK: 00027ff0 .got 00000000 .hidden _gp Index: test/ELF/mips-hilo-gp-disp.s =================================================================== --- test/ELF/mips-hilo-gp-disp.s +++ test/ELF/mips-hilo-gp-disp.s @@ -34,7 +34,7 @@ # EXE: SYMBOL TABLE: # EXE: 0002000c .text 00000000 bar -# EXE: 00038000 *ABS* 00000000 .hidden _gp +# EXE: 00038000 .got 00000000 .hidden _gp # EXE: 00020000 .text 00000000 __start # SO: Disassembly of section .text: @@ -51,5 +51,5 @@ # SO: SYMBOL TABLE: # SO: 0001000c .text 00000000 bar -# SO: 00028000 *ABS* 00000000 .hidden _gp +# SO: 00028000 .got 00000000 .hidden _gp # SO: 00010000 .text 00000000 __start Index: test/ELF/mips-micro-relocs.s =================================================================== --- test/ELF/mips-micro-relocs.s +++ test/ELF/mips-micro-relocs.s @@ -54,7 +54,7 @@ # FIXME-EL-NEXT: 20028: 00 00 00 00 nop # FIXME-EL-NEXT: 2002c: 00 94 e8 ff b -44 -# SYM: 00037ff0 *ABS* 00000000 .hidden _gp +# SYM: 00037ff0 .got 00000000 .hidden _gp # SYM: 00020000 g F .text 00000000 foo # SYM: 00020010 .text 00000000 __start Index: test/ELF/mips-n32-rels.s =================================================================== --- test/ELF/mips-n32-rels.s +++ test/ELF/mips-n32-rels.s @@ -42,7 +42,7 @@ # ^-- loc # CHECK: 00020004 .text 00000000 loc -# CHECK: 00037ff0 *ABS* 00000000 .hidden _gp +# CHECK: 00037ff0 .got 00000000 .hidden _gp # CHECK: 00020000 g F .text 00000000 __start # ELF: Format: ELF32-mips