diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2017-09-15 01:49:01 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2017-09-15 01:49:01 +0000 |
| commit | 056190c348f0663e7ba1d91bcac93b2b1981ebe1 (patch) | |
| tree | dd9c1315519e9f52548f8cfc1cefc82857ddab9c | |
| parent | 325b6c1efe942c461c52d9c7cba30c89d2fe3f35 (diff) | |
| download | bcm5719-llvm-056190c348f0663e7ba1d91bcac93b2b1981ebe1.tar.gz bcm5719-llvm-056190c348f0663e7ba1d91bcac93b2b1981ebe1.zip | |
Don't make _gp absolute.
_gp points to a position in the file, so it is not really absolute. It
is also simpler to not force it to be absolute, so if there is no
strong ABI requirement we should not do it.
llvm-svn: 313333
| -rw-r--r-- | lld/ELF/Writer.cpp | 11 | ||||
| -rw-r--r-- | lld/test/ELF/basic-mips.s | 2 | ||||
| -rw-r--r-- | lld/test/ELF/mips-64-gprel-so.s | 2 | ||||
| -rw-r--r-- | lld/test/ELF/mips-64-rels.s | 2 | ||||
| -rw-r--r-- | lld/test/ELF/mips-got-relocs.s | 4 | ||||
| -rw-r--r-- | lld/test/ELF/mips-gp-disp.s | 2 | ||||
| -rw-r--r-- | lld/test/ELF/mips-gp-local.s | 2 | ||||
| -rw-r--r-- | lld/test/ELF/mips-gprel32-relocs-gp0.s | 2 | ||||
| -rw-r--r-- | lld/test/ELF/mips-gprel32-relocs.s | 2 | ||||
| -rw-r--r-- | lld/test/ELF/mips-hilo-gp-disp.s | 4 | ||||
| -rw-r--r-- | lld/test/ELF/mips-micro-relocs.s | 2 | ||||
| -rw-r--r-- | lld/test/ELF/mips-n32-rels.s | 2 |
12 files changed, 13 insertions, 24 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 4f6f75dda58..d2e0078264b 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -63,7 +63,6 @@ private: void assignFileOffsetsBinary(); void setPhdrs(); void fixSectionAlignments(); - void makeMipsGpAbs(); void openFile(); void writeTrapInstr(); void writeHeader(); @@ -216,8 +215,6 @@ template <class ELFT> void Writer<ELFT>::run() { 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. @@ -1774,14 +1771,6 @@ static uint16_t getELFType() { return ET_EXEC; } -// For some reason we have to make the mips gp symbol absolute. -template <class ELFT> void Writer<ELFT>::makeMipsGpAbs() { - if (ElfSym::MipsGp && ElfSym::MipsGp->Section) { - ElfSym::MipsGp->Value += cast<OutputSection>(ElfSym::MipsGp->Section)->Addr; - ElfSym::MipsGp->Section = nullptr; - } -} - template <class ELFT> void Writer<ELFT>::writeHeader() { uint8_t *Buf = Buffer->getBufferStart(); memcpy(Buf, "\177ELF", 4); diff --git a/lld/test/ELF/basic-mips.s b/lld/test/ELF/basic-mips.s index 4c7a66cf005..c8e9cc2da09 100644 --- a/lld/test/ELF/basic-mips.s +++ b/lld/test/ELF/basic-mips.s @@ -228,7 +228,7 @@ __start: # 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 diff --git a/lld/test/ELF/mips-64-gprel-so.s b/lld/test/ELF/mips-64-gprel-so.s index a390ec082b1..437238ef5f2 100644 --- a/lld/test/ELF/mips-64-gprel-so.s +++ b/lld/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 diff --git a/lld/test/ELF/mips-64-rels.s b/lld/test/ELF/mips-64-rels.s index 93d893aacbd..a9fb2d9a93d 100644 --- a/lld/test/ELF/mips-64-rels.s +++ b/lld/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 [ diff --git a/lld/test/ELF/mips-got-relocs.s b/lld/test/ELF/mips-got-relocs.s index 4471bc210e2..5b443e51938 100644 --- a/lld/test/ELF/mips-got-relocs.s +++ b/lld/test/ELF/mips-got-relocs.s @@ -47,7 +47,7 @@ v1: # 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 @@ v1: # 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 diff --git a/lld/test/ELF/mips-gp-disp.s b/lld/test/ELF/mips-gp-disp.s index 62a2b108453..7a0fd6409d1 100644 --- a/lld/test/ELF/mips-gp-disp.s +++ b/lld/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: ] diff --git a/lld/test/ELF/mips-gp-local.s b/lld/test/ELF/mips-gp-local.s index b77dbb8367a..8bb3c236edf 100644 --- a/lld/test/ELF/mips-gp-local.s +++ b/lld/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 diff --git a/lld/test/ELF/mips-gprel32-relocs-gp0.s b/lld/test/ELF/mips-gprel32-relocs-gp0.s index 4f1962bd683..3173e7d0674 100644 --- a/lld/test/ELF/mips-gprel32-relocs-gp0.s +++ b/lld/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 diff --git a/lld/test/ELF/mips-gprel32-relocs.s b/lld/test/ELF/mips-gprel32-relocs.s index 1c877b12b29..2750fbb0130 100644 --- a/lld/test/ELF/mips-gprel32-relocs.s +++ b/lld/test/ELF/mips-gprel32-relocs.s @@ -28,4 +28,4 @@ v1: # 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 diff --git a/lld/test/ELF/mips-hilo-gp-disp.s b/lld/test/ELF/mips-hilo-gp-disp.s index 62e03c7b676..c7229ee0da2 100644 --- a/lld/test/ELF/mips-hilo-gp-disp.s +++ b/lld/test/ELF/mips-hilo-gp-disp.s @@ -34,7 +34,7 @@ bar: # 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 @@ bar: # 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 diff --git a/lld/test/ELF/mips-micro-relocs.s b/lld/test/ELF/mips-micro-relocs.s index 3117e24614a..8a5d7b9e71b 100644 --- a/lld/test/ELF/mips-micro-relocs.s +++ b/lld/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 diff --git a/lld/test/ELF/mips-n32-rels.s b/lld/test/ELF/mips-n32-rels.s index 7706e2591a3..5a3aab2d8b4 100644 --- a/lld/test/ELF/mips-n32-rels.s +++ b/lld/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 |

