[ELF][MIPS] Exclude mips .got from PT_GNU_RELRO segment

On MIPS .got section cannot be included into the PT_GNU_RELRO segment.
Sometimes it might work, but in general it is unsupported. One of the
problem is that all sections marked by SHF_MIPS_GPREL should be grouped
together because data in these sections is addressable with a gp
relative address, but such sections might be writable.

This patch exclude mips .got from PT_GNU_RELRO segment and group
SHF_MIPS_GPREL sections.

llvm-svn: 292161
This commit is contained in:
Simon Atanasyan 2017-01-16 21:17:23 +00:00
parent 97a42ea896
commit 2bd98af563
18 changed files with 169 additions and 134 deletions

View File

@ -434,7 +434,7 @@ template <class ELFT> void GotSection<ELFT>::writeTo(uint8_t *Buf) {
template <class ELFT>
MipsGotSection<ELFT>::MipsGotSection()
: SyntheticSection<ELFT>(SHF_ALLOC | SHF_WRITE | SHF_MIPS_GPREL,
SHT_PROGBITS, Target->GotEntrySize, ".got") {}
SHT_PROGBITS, 16, ".got") {}
template <class ELFT>
void MipsGotSection<ELFT>::addEntry(SymbolBody &Sym, uintX_t Addend,

View File

@ -490,6 +490,16 @@ static int getPPC64SectionRank(StringRef SectionName) {
.Default(1);
}
// All sections with SHF_MIPS_GPREL flag should be grouped together
// because data in these sections is addressable with a gp relative address.
static int getMipsSectionRank(const OutputSectionBase *S) {
if ((S->Flags & SHF_MIPS_GPREL) == 0)
return 0;
if (S->getName() == ".got")
return 1;
return 2;
}
template <class ELFT> bool elf::isRelroSection(const OutputSectionBase *Sec) {
if (!Config->ZRelro)
return false;
@ -508,8 +518,6 @@ template <class ELFT> bool elf::isRelroSection(const OutputSectionBase *Sec) {
return true;
if (In<ELFT>::Got && Sec == In<ELFT>::Got->OutSec)
return true;
if (In<ELFT>::MipsGot && Sec == In<ELFT>::MipsGot->OutSec)
return true;
if (Sec == Out<ELFT>::BssRelRo)
return true;
StringRef S = Sec->getName();
@ -609,6 +617,8 @@ static bool compareSectionsNonScript(const OutputSectionBase *A,
if (Config->EMachine == EM_PPC64)
return getPPC64SectionRank(A->getName()) <
getPPC64SectionRank(B->getName());
if (Config->EMachine == EM_MIPS)
return getMipsSectionRank(A) < getMipsSectionRank(B);
return false;
}

View File

@ -35,7 +35,7 @@ __start:
# CHECK-NEXT: ]
# CHECK-NEXT: HeaderSize: 52
# CHECK-NEXT: ProgramHeaderEntrySize: 32
# CHECK-NEXT: ProgramHeaderCount: 6
# CHECK-NEXT: ProgramHeaderCount: 5
# CHECK-NEXT: SectionHeaderEntrySize: 40
# CHECK-NEXT: SectionHeaderCount: 11
# CHECK-NEXT: StringTableSectionIndex: 9
@ -62,8 +62,8 @@ __start:
# CHECK-NEXT: Flags [ (0x2)
# CHECK-NEXT: SHF_ALLOC (0x2)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x100F8
# CHECK-NEXT: Offset: 0xF8
# CHECK-NEXT: Address: 0x100D8
# CHECK-NEXT: Offset: 0xD8
# CHECK-NEXT: Size: 24
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
@ -77,8 +77,8 @@ __start:
# CHECK-NEXT: Flags [ (0x2)
# CHECK-NEXT: SHF_ALLOC (0x2)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x10110
# CHECK-NEXT: Offset: 0x110
# CHECK-NEXT: Address: 0x100F0
# CHECK-NEXT: Offset: 0xF0
# CHECK-NEXT: Size: 24
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
@ -131,7 +131,7 @@ __start:
# CHECK-NEXT: Size: 8
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
# CHECK-NEXT: AddressAlignment: 4
# CHECK-NEXT: AddressAlignment: 16
# CHECK-NEXT: EntrySize: 0
# CHECK-NEXT: }
# CHECK-NEXT: Section {
@ -142,7 +142,7 @@ __start:
# CHECK-NEXT: SHF_ALLOC (0x2)
# CHECK-NEXT: SHF_WRITE (0x1)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x40000
# CHECK-NEXT: Address: 0x30010
# CHECK-NEXT: Offset: 0x20008
# CHECK-NEXT: Size: 0
# CHECK-NEXT: Link: 0
@ -246,8 +246,8 @@ __start:
# CHECK-NEXT: Offset: 0x34
# CHECK-NEXT: VirtualAddress: 0x10034
# CHECK-NEXT: PhysicalAddress: 0x10034
# CHECK-NEXT: FileSize: 192
# CHECK-NEXT: MemSize: 192
# CHECK-NEXT: FileSize: 160
# CHECK-NEXT: MemSize: 160
# CHECK-NEXT: Flags [ (0x4)
# CHECK-NEXT: PF_R (0x4)
# CHECK-NEXT: ]
@ -258,8 +258,8 @@ __start:
# CHECK-NEXT: Offset: 0x0
# CHECK-NEXT: VirtualAddress: 0x10000
# CHECK-NEXT: PhysicalAddress: 0x10000
# CHECK-NEXT: FileSize: 296
# CHECK-NEXT: MemSize: 296
# CHECK-NEXT: FileSize: 264
# CHECK-NEXT: MemSize: 264
# CHECK-NEXT: Flags [ (0x4)
# CHECK-NEXT: PF_R (0x4)
# CHECK-NEXT: ]
@ -284,7 +284,7 @@ __start:
# CHECK-NEXT: VirtualAddress: 0x30000
# CHECK-NEXT: PhysicalAddress: 0x30000
# CHECK-NEXT: FileSize: 8
# CHECK-NEXT: MemSize: 65536
# CHECK-NEXT: MemSize: 16
# CHECK-NEXT: Flags [
# CHECK-NEXT: PF_R
# CHECK-NEXT: PF_W
@ -292,18 +292,6 @@ __start:
# CHECK-NEXT: Alignment: 65536
# CHECK-NEXT: }
# CHECK-NEXT: ProgramHeader {
# CHECK-NEXT: Type: PT_GNU_RELRO (0x6474E552)
# CHECK-NEXT: Offset: 0x20000
# CHECK-NEXT: VirtualAddress: 0x30000
# CHECK-NEXT: PhysicalAddress: 0x30000
# CHECK-NEXT: FileSize: 8
# CHECK-NEXT: MemSize: 65536
# CHECK-NEXT: Flags [ (0x4)
# CHECK-NEXT: PF_R (0x4)
# CHECK-NEXT: ]
# CHECK-NEXT: Alignment: 1
# CHECK-NEXT: }
# CHECK-NEXT: ProgramHeader {
# CHECK-NEXT: Type: PT_GNU_STACK
# CHECK-NEXT: Offset: 0x0
# CHECK-NEXT: VirtualAddress: 0x0

View File

@ -9,10 +9,10 @@
# REQUIRES: mips
# CHECK: Contents of section .eh_frame_hdr:
# CHECK-NEXT: 10148 011b033b 00000010 00000001 0000feb8
# ^-- 0x20000 - 0x10148
# CHECK-NEXT: 10128 011b033b 00000010 00000001 0000fed8
# ^-- 0x20000 - 0x10138
# .text - .eh_frame_hdr
# CHECK-NEXT: 10158 0000002c
# CHECK-NEXT: 10138 0000002c
# CHECK: Contents of section .text:
# CHECK-NEXT: 20000 00000000

View File

@ -20,7 +20,7 @@
# ^-- %lo(0x17ff0)
# CHECK: Contents of section .rodata:
# CHECK-NEXT: 10190 ffffffff fffe8014
# CHECK-NEXT: 10158 ffffffff fffe8014
# ^-- 0x20004 - 0x37ff0 = 0xfffffffffffe8014
# CHECK: 0000000000020004 .text 00000000 loc

View File

@ -45,21 +45,21 @@ v1:
.word 0
# EXE_SYM: Sections:
# EXE_SYM: .got 0000000c 0000000000040000 DATA
# EXE_SYM: .got 0000000c 0000000000030010 DATA
# EXE_SYM: SYMBOL TABLE:
# EXE_SYM: 00047ff0 *ABS* 00000000 .hidden _gp
# EXE_SYM: 00038000 *ABS* 00000000 .hidden _gp
# ^-- .got + GP offset (0x7ff0)
# EXE_SYM: 00030000 g .data 00000004 v1
# EXE_GOT_BE: Contents of section .got:
# EXE_GOT_BE: 40000 00000000 80000000 00030000
# EXE_GOT_BE: 30010 00000000 80000000 00030000
# ^ ^ ^-- v1 (0x30000)
# | +-- Module pointer (0x80000000)
# +-- Lazy resolver (0x0)
# EXE_GOT_EL: Contents of section .got:
# EXE_GOT_EL: 40000 00000000 00000080 00000300
# EXE_GOT_EL: 30010 00000000 00000080 00000300
# ^ ^ ^-- v1 (0x30000)
# | +-- Module pointer (0x80000000)
# +-- Lazy resolver (0x0)
@ -69,20 +69,20 @@ v1:
# EXE_DIS_EL: 20000: 18 80 02 3c lui $2, 32792
# DSO_SYM: Sections:
# DSO_SYM: .got 0000000c 0000000000030000 DATA
# DSO_SYM: .got 0000000c 0000000000020010 DATA
# DSO_SYM: SYMBOL TABLE:
# DSO_SYM: 00037ff0 *ABS* 00000000 .hidden _gp
# DSO_SYM: 00028000 *ABS* 00000000 .hidden _gp
# ^-- .got + GP offset (0x7ff0)
# DSO_SYM: 00020000 g .data 00000004 v1
# DSO_GOT_BE: Contents of section .got:
# DSO_GOT_BE: 30000 00000000 80000000 00020000
# DSO_GOT_BE: 20010 00000000 80000000 00020000
# ^ ^ ^-- v1 (0x20000)
# | +-- Module pointer (0x80000000)
# +-- Lazy resolver (0x0)
# DSO_GOT_EL: Contents of section .got:
# DSO_GOT_EL: 30000 00000000 00000080 00000200
# DSO_GOT_EL: 20010 00000000 00000080 00000200
# ^ ^ ^-- v1 (0x20000)
# | +-- Module pointer (0x80000000)
# +-- Lazy resolver (0x0)

View File

@ -20,10 +20,10 @@
# REQUIRES: mips
# REL: Contents of section .text:
# REL-NEXT: 0000 3c080000 2108010c 8f82fff0
# REL-NEXT: 0000 3c080000 2108010c 8f82fffc
# ^-- %hi(_gp_disp)
# ^-- %lo(_gp_disp)
# ^-- 8 - (0x10c - 0xf4)
# ^-- 8 - (0x10c - 0x100)
# G - (GP - .got)
# REL: Contents of section .reginfo:
@ -40,10 +40,10 @@
# REL: 0000010c *ABS* 00000000 .hidden _gp
# ABS: Contents of section .text:
# ABS-NEXT: 0000 3c080000 21080200 8f82fefc
# ABS-NEXT: 0000 3c080000 21080200 8f82ff08
# ^-- %hi(_gp_disp)
# ^-- %lo(_gp_disp)
# ^-- 8 - (0x200 - 0xf4)
# ^-- 8 - (0x200 - 0x100)
# G - (GP - .got)
# ABS: Contents of section .reginfo:

View File

@ -26,7 +26,7 @@ foo:
# CHECK-NEXT: SHF_MIPS_GPREL
# CHECK-NEXT: SHF_WRITE
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0xDD
# CHECK-NEXT: Address: 0xE0
# CHECK: }
# CHECK: Section {
# CHECK: Name: .got
@ -40,5 +40,5 @@ foo:
# CHECK: }
# CHECK: Name: _gp (5)
# CHECK-NEXT: Value: 0x80CD
# ^-- 0xDD + 0x7ff0
# CHECK-NEXT: Value: 0x80D0
# ^-- 0xE0 + 0x7ff0

View File

@ -0,0 +1,37 @@
# Check order of gp-relative sections, i.e. sections with SHF_MIPS_GPREL flag.
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o
# RUN: ld.lld %t.o -shared -o %t.so
# RUN: llvm-readobj -s %t.so | FileCheck %s
# REQUIRES: mips
.text
nop
.sdata
.word 0
# CHECK: Section {
# CHECK: Name: .got
# CHECK-NEXT: Type: SHT_PROGBITS
# CHECK-NEXT: Flags [
# CHECK-NEXT: SHF_ALLOC
# CHECK-NEXT: SHF_MIPS_GPREL
# CHECK-NEXT: SHF_WRITE
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x20000
# CHECK-NEXT: Offset: 0x20000
# CHECK: }
# CHECK: Section {
# CHECK-NEXT: Index:
# CHECK-NEXT: Name: .sdata
# CHECK-NEXT: Type: SHT_PROGBITS
# CHECK-NEXT: Flags [
# CHECK-NEXT: SHF_ALLOC
# CHECK-NEXT: SHF_MIPS_GPREL
# CHECK-NEXT: SHF_WRITE
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x20008
# CHECK-NEXT: Offset: 0x20008
# CHECK: }

View File

@ -22,7 +22,7 @@
# DSO: GP: 0x27FF0
# DUMP: Contents of section .rodata:
# DUMP: 0114 ffff0004 ffff0008
# DUMP: 00f4 ffff0004 ffff0008
# ^ 0x10004 + 0x7ff0 - 0x27ff0
# ^ 0x10008 + 0x7ff0 - 0x27ff0

View File

@ -21,7 +21,7 @@ v1:
.gpword bar
# CHECK: Contents of section .rodata:
# CHECK: 0114 fffe8014 fffe8018
# CHECK: 00f4 fffe8014 fffe8018
# ^ 0x10004 - 0x27ff0
# ^ 0x10008 - 0x27ff0

View File

@ -24,32 +24,32 @@ bar:
# EXE-NEXT: __start:
# EXE-NEXT: 20000: 3c 08 00 02 lui $8, 2
# ^-- %hi(0x47ff0-0x20000)
# EXE-NEXT: 20004: 21 08 7f f0 addi $8, $8, 32752
# ^-- %lo(0x47ff0-0x20004+4)
# EXE-NEXT: 20004: 21 08 80 00 addi $8, $8, -32768
# ^-- %lo(0x38000-0x20004+4)
# EXE: bar:
# EXE-NEXT: 2000c: 3c 08 00 02 lui $8, 2
# ^-- %hi(0x47ff0-0x2000c)
# EXE-NEXT: 20010: 21 08 7f e4 addi $8, $8, 32740
# ^-- %lo(0x47ff0-0x20010+4)
# EXE-NEXT: 2000c: 3c 08 00 01 lui $8, 1
# ^-- %hi(0x38000-0x2000c)
# EXE-NEXT: 20010: 21 08 7f f4 addi $8, $8, 32756
# ^-- %lo(0x38000-0x20010+4)
# EXE: SYMBOL TABLE:
# EXE: 0002000c .text 00000000 bar
# EXE: 00047ff0 *ABS* 00000000 .hidden _gp
# EXE: 00038000 *ABS* 00000000 .hidden _gp
# EXE: 00020000 .text 00000000 __start
# SO: Disassembly of section .text:
# SO-NEXT: __start:
# SO-NEXT: 10000: 3c 08 00 02 lui $8, 2
# ^-- %hi(0x37ff0-0x10000)
# SO-NEXT: 10004: 21 08 7f f0 addi $8, $8, 32752
# ^-- %lo(0x37ff0-0x10004+4)
# ^-- %hi(0x28000-0x10000)
# SO-NEXT: 10004: 21 08 80 00 addi $8, $8, -32768
# ^-- %lo(0x28000-0x10004+4)
# SO: bar:
# SO-NEXT: 1000c: 3c 08 00 02 lui $8, 2
# ^-- %hi(0x37ff0-0x1000c)
# SO-NEXT: 10010: 21 08 7f e4 addi $8, $8, 32740
# ^-- %lo(0x37ff0-0x10010+4)
# SO-NEXT: 1000c: 3c 08 00 01 lui $8, 1
# ^-- %hi(0x28000-0x1000c)
# SO-NEXT: 10010: 21 08 7f f4 addi $8, $8, 32756
# ^-- %lo(0x28000-0x10010+4)
# SO: SYMBOL TABLE:
# SO: 0001000c .text 00000000 bar
# SO: 00037ff0 *ABS* 00000000 .hidden _gp
# SO: 00028000 *ABS* 00000000 .hidden _gp
# SO: 00010000 .text 00000000 __start

View File

@ -38,7 +38,7 @@
# ^-- %lo(0x17ff0)
# CHECK: Contents of section .rodata:
# CHECK-NEXT: 100f4 00020004
# CHECK-NEXT: 100d4 00020004
# ^-- loc
# CHECK: 00020004 .text 00000000 loc

View File

@ -23,11 +23,11 @@
# DIS-NEXT: 20010: 24 62 80 58 addiu $2, $3, -32680
# DIS: Contents of section .got:
# DIS-NEXT: 40008 00000000 00000000 80000000 00000000
# DIS-NEXT: 40018 00000000 00000000 00000000 00000000
# DIS-NEXT: 40028 00000000 00000000 00000000 00000001
# DIS-NEXT: 40038 00000000 00000000 00000000 00000001
# DIS-NEXT: 40048 ffffffff ffff8004 ffffffff ffff9004
# DIS-NEXT: 30010 00000000 00000000 80000000 00000000
# DIS-NEXT: 30020 00000000 00000000 00000000 00000000
# DIS-NEXT: 30030 00000000 00000000 00000000 00000001
# DIS-NEXT: 30040 00000000 00000000 00000000 00000001
# DIS-NEXT: 30050 ffffffff ffff8004 ffffffff ffff9004
# DIS: 0000000000040000 l .tdata 00000000 .tdata
# DIS: 0000000000040000 l .tdata 00000000 loc
@ -36,13 +36,13 @@
# CHECK: Relocations [
# CHECK-NEXT: Section (7) .rela.dyn {
# CHECK-NEXT: 0x40018 R_MIPS_TLS_DTPMOD64/R_MIPS_NONE/R_MIPS_NONE foo 0x0
# CHECK-NEXT: 0x40020 R_MIPS_TLS_DTPREL64/R_MIPS_NONE/R_MIPS_NONE foo 0x0
# CHECK-NEXT: 0x40028 R_MIPS_TLS_TPREL64/R_MIPS_NONE/R_MIPS_NONE foo 0x0
# CHECK-NEXT: 0x30020 R_MIPS_TLS_DTPMOD64/R_MIPS_NONE/R_MIPS_NONE foo 0x0
# CHECK-NEXT: 0x30028 R_MIPS_TLS_DTPREL64/R_MIPS_NONE/R_MIPS_NONE foo 0x0
# CHECK-NEXT: 0x30030 R_MIPS_TLS_TPREL64/R_MIPS_NONE/R_MIPS_NONE foo 0x0
# CHECK-NEXT: }
# CHECK-NEXT: ]
# CHECK-NEXT: Primary GOT {
# CHECK-NEXT: Canonical gp value: 0x47FF8
# CHECK-NEXT: Canonical gp value: 0x38000
# CHECK-NEXT: Reserved entries [
# CHECK: ]
# CHECK-NEXT: Local entries [
@ -60,25 +60,25 @@
# ^-- -32680 R_MIPS_TLS_GOTTPREL VA - 0x7000 bar
# DIS-SO: Contents of section .got:
# DIS-SO-NEXT: 20008 00000000 00000000 80000000 00000000
# DIS-SO-NEXT: 20018 00000000 00000000 00000000 00000000
# DIS-SO-NEXT: 20028 00000000 00000000 00000000 00000000
# DIS-SO-NEXT: 20038 00000000 00000000 00000000 00000000
# DIS-SO-NEXT: 20048 00000000 00000000 00000000 00000000
# DIS-SO-NEXT: 20000 00000000 00000000 80000000 00000000
# DIS-SO-NEXT: 20010 00000000 00000000 00000000 00000000
# DIS-SO-NEXT: 20020 00000000 00000000 00000000 00000000
# DIS-SO-NEXT: 20030 00000000 00000000 00000000 00000000
# DIS-SO-NEXT: 20040 00000000 00000000 00000000 00000000
# SO: Relocations [
# SO-NEXT: Section (7) .rela.dyn {
# SO-NEXT: 0x20030 R_MIPS_TLS_DTPMOD64/R_MIPS_NONE/R_MIPS_NONE - 0x0
# SO-NEXT: 0x20040 R_MIPS_TLS_DTPMOD64/R_MIPS_NONE/R_MIPS_NONE bar 0x0
# SO-NEXT: 0x20048 R_MIPS_TLS_DTPREL64/R_MIPS_NONE/R_MIPS_NONE bar 0x0
# SO-NEXT: 0x20050 R_MIPS_TLS_TPREL64/R_MIPS_NONE/R_MIPS_NONE bar 0x0
# SO-NEXT: 0x20018 R_MIPS_TLS_DTPMOD64/R_MIPS_NONE/R_MIPS_NONE foo 0x0
# SO-NEXT: 0x20020 R_MIPS_TLS_DTPREL64/R_MIPS_NONE/R_MIPS_NONE foo 0x0
# SO-NEXT: 0x20028 R_MIPS_TLS_TPREL64/R_MIPS_NONE/R_MIPS_NONE foo 0x0
# SO-NEXT: 0x20028 R_MIPS_TLS_DTPMOD64/R_MIPS_NONE/R_MIPS_NONE - 0x0
# SO-NEXT: 0x20038 R_MIPS_TLS_DTPMOD64/R_MIPS_NONE/R_MIPS_NONE bar 0x0
# SO-NEXT: 0x20040 R_MIPS_TLS_DTPREL64/R_MIPS_NONE/R_MIPS_NONE bar 0x0
# SO-NEXT: 0x20048 R_MIPS_TLS_TPREL64/R_MIPS_NONE/R_MIPS_NONE bar 0x0
# SO-NEXT: 0x20010 R_MIPS_TLS_DTPMOD64/R_MIPS_NONE/R_MIPS_NONE foo 0x0
# SO-NEXT: 0x20018 R_MIPS_TLS_DTPREL64/R_MIPS_NONE/R_MIPS_NONE foo 0x0
# SO-NEXT: 0x20020 R_MIPS_TLS_TPREL64/R_MIPS_NONE/R_MIPS_NONE foo 0x0
# SO-NEXT: }
# SO-NEXT: ]
# SO-NEXT: Primary GOT {
# SO-NEXT: Canonical gp value: 0x27FF8
# SO-NEXT: Canonical gp value: 0x27FF0
# SO-NEXT: Reserved entries [
# SO: ]
# SO-NEXT: Local entries [
@ -86,14 +86,14 @@
# SO-NEXT: Global entries [
# SO-NEXT: ]
# SO-NEXT: Number of TLS and multi-GOT entries: 8
# ^-- 0x20018 R_MIPS_TLS_GD R_MIPS_TLS_DTPMOD64 foo
# ^-- 0x20020 R_MIPS_TLS_DTPREL64 foo
# ^-- 0x20028 R_MIPS_TLS_GOTTPREL R_MIPS_TLS_TPREL64 foo
# ^-- 0x20030 R_MIPS_TLS_LDM R_MIPS_TLS_DTPMOD64 loc
# ^-- 0x20038 0 loc
# ^-- 0x20040 R_MIPS_TLS_GD R_MIPS_TLS_DTPMOD64 bar
# ^-- 0x20048 R_MIPS_TLS_DTPREL64 bar
# ^-- 0x20050 R_MIPS_TLS_GOTTPREL R_MIPS_TLS_TPREL64 bar
# ^-- -32736 R_MIPS_TLS_GD R_MIPS_TLS_DTPMOD64 foo
# ^-- -32728 R_MIPS_TLS_DTPREL64 foo
# ^-- -32720 R_MIPS_TLS_GOTTPREL R_MIPS_TLS_TPREL64 foo
# ^-- -32712 R_MIPS_TLS_LDM R_MIPS_TLS_DTPMOD64 loc
# ^-- -32704 0 loc
# ^-- -32696 R_MIPS_TLS_GD R_MIPS_TLS_DTPMOD64 bar
# ^-- -32688 R_MIPS_TLS_DTPREL64 bar
# ^-- -32680 R_MIPS_TLS_GOTTPREL R_MIPS_TLS_TPREL64 bar
.text
.global __start

View File

@ -21,8 +21,8 @@
# DIS-NEXT: 2000c: 24 62 90 00 addiu $2, $3, -28672
# %lo(loc0 - .tdata - 0x7000) --^
# DIS: 00030000 l .tdata 00000000 .tdata
# DIS: 00030000 l .tdata 00000000 loc0
# DIS: 00040000 l .tdata 00000000 .tdata
# DIS: 00040000 l .tdata 00000000 loc0
# CHECK: Relocations [
# CHECK-NEXT: ]

View File

@ -10,8 +10,8 @@
# CHECK: Contents of section .data:
# CHECK-NEXT: 30000 0002000c ffff8004 ffff9004
# CHECK: Contents of section .got:
# CHECK-NEXT: 40008 00000000 80000000 00000001 ffff8000
# CHECK-NEXT: 40018 00000001 00000000 ffff9000
# CHECK-NEXT: 30010 00000000 80000000 00000001 ffff8000
# CHECK-NEXT: 30020 00000001 00000000 ffff9000
#
# CHECK: SYMBOL TABLE:
# CHECK: 0002000c .text 00000000 __tls_get_addr

View File

@ -23,9 +23,9 @@
# DIS-NEXT: 20010: 24 62 80 34 addiu $2, $3, -32716
# DIS: Contents of section .got:
# DIS-NEXT: 40008 00000000 80000000 00000000 00000000
# DIS-NEXT: 40018 00000000 00000001 00000000 00000001
# DIS-NEXT: 40028 ffff8004 ffff9004
# DIS-NEXT: 30010 00000000 80000000 00000000 00000000
# DIS-NEXT: 30020 00000000 00000001 00000000 00000001
# DIS-NEXT: 30030 ffff8004 ffff9004
# DIS: 00040000 l .tdata 00000000 .tdata
# DIS: 00040000 l .tdata 00000000 loc
@ -34,13 +34,13 @@
# CHECK: Relocations [
# CHECK-NEXT: Section (7) .rel.dyn {
# CHECK-NEXT: 0x40010 R_MIPS_TLS_DTPMOD32 foo 0x0
# CHECK-NEXT: 0x40014 R_MIPS_TLS_DTPREL32 foo 0x0
# CHECK-NEXT: 0x40018 R_MIPS_TLS_TPREL32 foo 0x0
# CHECK-NEXT: 0x30018 R_MIPS_TLS_DTPMOD32 foo 0x0
# CHECK-NEXT: 0x3001C R_MIPS_TLS_DTPREL32 foo 0x0
# CHECK-NEXT: 0x30020 R_MIPS_TLS_TPREL32 foo 0x0
# CHECK-NEXT: }
# CHECK-NEXT: ]
# CHECK-NEXT: Primary GOT {
# CHECK-NEXT: Canonical gp value: 0x47FF8
# CHECK-NEXT: Canonical gp value: 0x38000
# CHECK-NEXT: Reserved entries [
# CHECK: ]
# CHECK-NEXT: Local entries [
@ -48,33 +48,33 @@
# CHECK-NEXT: Global entries [
# CHECK-NEXT: ]
# CHECK-NEXT: Number of TLS and multi-GOT entries: 8
# ^-- 0x30010 R_MIPS_TLS_GD R_MIPS_TLS_DTPMOD32 foo
# ^-- 0x30014 R_MIPS_TLS_DTPREL32 foo
# ^-- 0x30018 R_MIPS_TLS_GOTTPREL R_MIPS_TLS_TPREL32 foo
# ^-- 0x3001C R_MIPS_TLS_LDM 1 loc
# ^-- 0x30020 0 loc
# ^-- 0x30024 R_MIPS_TLS_GD 1 bar
# ^-- 0x30028 VA - 0x8000 bar
# ^-- 0x3002C R_MIPS_TLS_GOTTPREL VA - 0x7000 bar
# ^-- -32744 R_MIPS_TLS_GD R_MIPS_TLS_DTPMOD32 foo
# ^-- -32740 R_MIPS_TLS_DTPREL32 foo
# ^-- -32736 R_MIPS_TLS_GOTTPREL R_MIPS_TLS_TPREL32 foo
# ^-- -32732 R_MIPS_TLS_LDM 1 loc
# ^-- -32728 0 loc
# ^-- -32724 R_MIPS_TLS_GD 1 bar
# ^-- -32720 VA - 0x8000 bar
# ^-- -32716 R_MIPS_TLS_GOTTPREL VA - 0x7000 bar
# DIS-SO: Contents of section .got:
# DIS-SO-NEXT: 20008 00000000 80000000 00000000 00000000
# DIS-SO-NEXT: 20018 00000000 00000000 00000000 00000000
# DIS-SO-NEXT: 20028 00000000 00000000
# DIS-SO-NEXT: 20000 00000000 80000000 00000000 00000000
# DIS-SO-NEXT: 20010 00000000 00000000 00000000 00000000
# DIS-SO-NEXT: 20020 00000000 00000000
# SO: Relocations [
# SO-NEXT: Section (7) .rel.dyn {
# SO-NEXT: 0x2001C R_MIPS_TLS_DTPMOD32 - 0x0
# SO-NEXT: 0x20024 R_MIPS_TLS_DTPMOD32 bar 0x0
# SO-NEXT: 0x20028 R_MIPS_TLS_DTPREL32 bar 0x0
# SO-NEXT: 0x2002C R_MIPS_TLS_TPREL32 bar 0x0
# SO-NEXT: 0x20010 R_MIPS_TLS_DTPMOD32 foo 0x0
# SO-NEXT: 0x20014 R_MIPS_TLS_DTPREL32 foo 0x0
# SO-NEXT: 0x20018 R_MIPS_TLS_TPREL32 foo 0x0
# SO-NEXT: 0x20014 R_MIPS_TLS_DTPMOD32 - 0x0
# SO-NEXT: 0x2001C R_MIPS_TLS_DTPMOD32 bar 0x0
# SO-NEXT: 0x20020 R_MIPS_TLS_DTPREL32 bar 0x0
# SO-NEXT: 0x20024 R_MIPS_TLS_TPREL32 bar 0x0
# SO-NEXT: 0x20008 R_MIPS_TLS_DTPMOD32 foo 0x0
# SO-NEXT: 0x2000C R_MIPS_TLS_DTPREL32 foo 0x0
# SO-NEXT: 0x20010 R_MIPS_TLS_TPREL32 foo 0x0
# SO-NEXT: }
# SO-NEXT: ]
# SO-NEXT: Primary GOT {
# SO-NEXT: Canonical gp value: 0x27FF8
# SO-NEXT: Canonical gp value: 0x27FF0
# SO-NEXT: Reserved entries [
# SO: ]
# SO-NEXT: Local entries [
@ -82,14 +82,14 @@
# SO-NEXT: Global entries [
# SO-NEXT: ]
# SO-NEXT: Number of TLS and multi-GOT entries: 8
# ^-- 0x20010 R_MIPS_TLS_GD R_MIPS_TLS_DTPMOD32 foo
# ^-- 0x20014 R_MIPS_TLS_DTPREL32 foo
# ^-- 0x20018 R_MIPS_TLS_GOTTPREL R_MIPS_TLS_TPREL32 foo
# ^-- 0x2001C R_MIPS_TLS_LDM R_MIPS_TLS_DTPMOD32 loc
# ^-- 0x20020 0 loc
# ^-- 0x20024 R_MIPS_TLS_GD R_MIPS_TLS_DTPMOD32 bar
# ^-- 0x20028 R_MIPS_TLS_DTPREL32 bar
# ^-- 0x2002C R_MIPS_TLS_GOTTPREL R_MIPS_TLS_TPREL32 bar
# ^-- -32744 R_MIPS_TLS_GD R_MIPS_TLS_DTPMOD32 foo
# ^-- -32740 R_MIPS_TLS_DTPREL32 foo
# ^-- -32736 R_MIPS_TLS_GOTTPREL R_MIPS_TLS_TPREL32 foo
# ^-- -32732 R_MIPS_TLS_LDM R_MIPS_TLS_DTPMOD32 loc
# ^-- -32728 0 loc
# ^-- -32724 R_MIPS_TLS_GD R_MIPS_TLS_DTPMOD32 bar
# ^-- -32720 R_MIPS_TLS_DTPREL32 bar
# ^-- -32716 R_MIPS_TLS_GOTTPREL R_MIPS_TLS_TPREL32 bar
.text
.global __start

View File

@ -20,10 +20,10 @@
# CHECK-NEXT: 20018: 20 42 00 00 addi $2, $2, 0
# CHECK: Contents of section .got:
# CHECK-NEXT: 40000 00000000 80000000 00030000 00040000
# CHECK-NEXT: 30010 00000000 80000000 00030000 00040000
# ^ %hi(loc)
# ^ redundant entry
# CHECK-NEXT: 40010 00020010 00020000 00030000
# CHECK-NEXT: 30020 00020010 00020000 00030000
# ^ %got(bar)
# ^ %got_hi/lo(start)
# ^ %got_hi/lo(loc)