[mips] Allow PT_LOAD to have overlapping p_offset ranges on EM_MIPS

Port the D64906 <https://reviews.llvm.org/D64906> technique to MIPS.

Fix PR33131

llvm-svn: 371554
This commit is contained in:
Simon Atanasyan 2019-09-10 20:19:59 +00:00
parent 7a54d76fa5
commit 6c6f5a9984
2 changed files with 22 additions and 23 deletions

View File

@ -2218,7 +2218,6 @@ template <class ELFT> void Writer<ELFT>::fixSectionAlignments() {
//
// TODO Enable this technique on all targets.
bool enable = config->emachine != EM_HEXAGON &&
config->emachine != EM_MIPS &&
config->emachine != EM_X86_64;
if (!enable ||

View File

@ -24,9 +24,9 @@ __start:
# CHECK-NEXT: Type: Executable (0x2)
# CHECK-NEXT: Machine: EM_MIPS (0x8)
# CHECK-NEXT: Version: 1
# CHECK-NEXT: Entry: 0x20000
# CHECK-NEXT: Entry: 0x20150
# CHECK-NEXT: ProgramHeaderOffset: 0x34
# CHECK-NEXT: SectionHeaderOffset: 0x200A0
# CHECK-NEXT: SectionHeaderOffset: 0x200
# CHECK-NEXT: Flags [
# CHECK-NEXT: EF_MIPS_ABI_O32
# CHECK-NEXT: EF_MIPS_ARCH_32
@ -92,8 +92,8 @@ __start:
# CHECK-NEXT: SHF_ALLOC (0x2)
# CHECK-NEXT: SHF_EXECINSTR (0x4)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x20000
# CHECK-NEXT: Offset: 0x10000
# CHECK-NEXT: Address: 0x20150
# CHECK-NEXT: Offset: 0x150
# CHECK-NEXT: Size: 12
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
@ -108,8 +108,8 @@ __start:
# CHECK-NEXT: SHF_ALLOC (0x2)
# CHECK-NEXT: SHF_WRITE (0x1)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x30000
# CHECK-NEXT: Offset: 0x20000
# CHECK-NEXT: Address: 0x30160
# CHECK-NEXT: Offset: 0x160
# CHECK-NEXT: Size: 0
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
@ -125,8 +125,8 @@ __start:
# CHECK-NEXT: SHF_MIPS_GPREL (0x10000000)
# CHECK-NEXT: SHF_WRITE (0x1)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x30000
# CHECK-NEXT: Offset: 0x20000
# CHECK-NEXT: Address: 0x30160
# CHECK-NEXT: Offset: 0x160
# CHECK-NEXT: Size: 8
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
@ -141,8 +141,8 @@ __start:
# CHECK-NEXT: SHF_ALLOC (0x2)
# CHECK-NEXT: SHF_WRITE (0x1)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x30010
# CHECK-NEXT: Offset: 0x20008
# CHECK-NEXT: Address: 0x30170
# CHECK-NEXT: Offset: 0x168
# CHECK-NEXT: Size: 0
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
@ -158,7 +158,7 @@ __start:
# CHECK-NEXT: SHF_STRINGS (0x20)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
# CHECK-NEXT: Offset: 0x20008
# CHECK-NEXT: Offset: 0x168
# CHECK-NEXT: Size: 8
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
@ -172,7 +172,7 @@ __start:
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
# CHECK-NEXT: Offset: 0x20010
# CHECK-NEXT: Offset: 0x170
# CHECK-NEXT: Size: 48
# CHECK-NEXT: Link: 10
# CHECK-NEXT: Info: 2
@ -186,7 +186,7 @@ __start:
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
# CHECK-NEXT: Offset: 0x20040
# CHECK-NEXT: Offset: 0x1A0
# CHECK-NEXT: Size: 82
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
@ -200,7 +200,7 @@ __start:
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
# CHECK-NEXT: Offset: 0x20092
# CHECK-NEXT: Offset: 0x1F2
# CHECK-NEXT: Size: 13
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
@ -220,7 +220,7 @@ __start:
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name: _gp
# CHECK-NEXT: Value: 0x37FF0
# CHECK-NEXT: Value: 0x38150
# CHECK-NEXT: Size: 0
# CHECK-NEXT: Binding: Local
# CHECK-NEXT: Type: None (0x0)
@ -231,7 +231,7 @@ __start:
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name: __start
# CHECK-NEXT: Value: 0x20000
# CHECK-NEXT: Value: 0x20150
# CHECK-NEXT: Size: 0
# CHECK-NEXT: Binding: Global (0x1)
# CHECK-NEXT: Type: None (0x0)
@ -266,9 +266,9 @@ __start:
# CHECK-NEXT: }
# CHECK-NEXT: ProgramHeader {
# CHECK-NEXT: Type: PT_LOAD (0x1)
# CHECK-NEXT: Offset: 0x10000
# CHECK-NEXT: VirtualAddress: 0x20000
# CHECK-NEXT: PhysicalAddress: 0x20000
# CHECK-NEXT: Offset: 0x150
# CHECK-NEXT: VirtualAddress: 0x20150
# CHECK-NEXT: PhysicalAddress: 0x20150
# CHECK-NEXT: FileSize: 12
# CHECK-NEXT: MemSize: 12
# CHECK-NEXT: Flags [ (0x5)
@ -279,9 +279,9 @@ __start:
# CHECK-NEXT: }
# CHECK-NEXT: ProgramHeader {
# CHECK-NEXT: Type: PT_LOAD (0x1)
# CHECK-NEXT: Offset: 0x20000
# CHECK-NEXT: VirtualAddress: 0x30000
# CHECK-NEXT: PhysicalAddress: 0x30000
# CHECK-NEXT: Offset: 0x160
# CHECK-NEXT: VirtualAddress: 0x30160
# CHECK-NEXT: PhysicalAddress: 0x30160
# CHECK-NEXT: FileSize: 8
# CHECK-NEXT: MemSize: 16
# CHECK-NEXT: Flags [