Skip to content

Commit

Permalink
[ELF][X86] Allow PT_LOAD to have overlapping p_offset ranges on EM_X8…
Browse files Browse the repository at this point in the history
…6_64

Port the D64906 technique to EM_X86_64.

Differential Revision: https://reviews.llvm.org/D67482

llvm-svn: 371958
  • Loading branch information
MaskRay committed Sep 16, 2019
1 parent 06bb7df commit d4306e9
Show file tree
Hide file tree
Showing 119 changed files with 792 additions and 787 deletions.
3 changes: 1 addition & 2 deletions lld/ELF/Writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2218,8 +2218,7 @@ template <class ELFT> void Writer<ELFT>::fixSectionAlignments() {
// previous segment anyway.
//
// TODO Enable this technique on all targets.
bool enable = config->emachine != EM_HEXAGON &&
config->emachine != EM_X86_64;
bool enable = config->emachine != EM_HEXAGON;

if (!enable ||
(config->zSeparateCode && prev &&
Expand Down
2 changes: 1 addition & 1 deletion lld/test/ELF/Inputs/copy-rel-abs.s
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ bar:

.weak zed
.type zed, @object
zed = 0x1000
zed = 0x1288
2 changes: 1 addition & 1 deletion lld/test/ELF/Inputs/copy-rel-tls.s
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ foo:

.section .tbss,"awT",@nobits
.global tfoo
.skip 0x2000
.skip 0x3358
.type tfoo,@object
.size tfoo, 4
tfoo:
6 changes: 3 additions & 3 deletions lld/test/ELF/abs-hidden.s
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

# CHECK: There are no relocations in this file.
# CHECK: section '.got':
# CHECK: 0x00001070 2a000000 00000000
# CHECK: 0x000022b8 2a000000 00000000

## .got - (.data+8) = 0xfffff068
## .got - (.data+8) = 0xfffff0ef
# CHECK: section '.data':
# CHECK: 0x00002000 2a000000 00000000 68f0ffff
# CHECK: 0x000032c0 2a000000 00000000 f0efffff

.data
.quad foo
Expand Down
4 changes: 2 additions & 2 deletions lld/test/ELF/apply-dynamic-relocs.s
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# CHECK: Name: .got
# CHECK: Address: 0x[[GOT:.*]]
# CHECK: SectionData (
# APPLY-NEXT: 0000: 00200000 00000000 |
# APPLY-NEXT: 0000: 30220000 00000000 |
# NOAPPLY-NEXT: 0000: 00000000 00000000 |
# CHECK-NEXT: )

Expand All @@ -25,7 +25,7 @@
# CHECK-NEXT: ]

# CHECK: Type: PT_DYNAMIC
# CHECK-NEXT: Offset: 0x[[ADDEND]]
# CHECK-NEXT: Offset: 0x230
# CHECK-NEXT: VirtualAddress: 0x[[ADDEND]]
# CHECK-NEXT: PhysicalAddress: 0x[[ADDEND]]

Expand Down
12 changes: 6 additions & 6 deletions lld/test/ELF/avoid-empty-program-headers.s
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ _start:
// CHECK-NEXT: }
// CHECK-NEXT: ProgramHeader {
// CHECK-NEXT: Type: PT_LOAD (0x1)
// CHECK-NEXT: Offset: 0x1000
// CHECK-NEXT: VirtualAddress: 0x201000
// CHECK-NEXT: PhysicalAddress: 0x201000
// CHECK-NEXT: Offset: 0x158
// CHECK-NEXT: VirtualAddress: 0x201158
// CHECK-NEXT: PhysicalAddress: 0x201158
// CHECK-NEXT: FileSize: 1
// CHECK-NEXT: MemSize: 1
// CHECK-NEXT: Flags [ (0x5)
Expand All @@ -52,9 +52,9 @@ _start:
// CHECK-NEXT: }
// CHECK-NEXT: ProgramHeader {
// CHECK-NEXT: Type: PT_TLS (0x7)
// CHECK-NEXT: Offset: 0x1001
// CHECK-NEXT: VirtualAddress: 0x201001
// CHECK-NEXT: PhysicalAddress: 0x201001
// CHECK-NEXT: Offset: 0x159
// CHECK-NEXT: VirtualAddress: 0x201159
// CHECK-NEXT: PhysicalAddress: 0x201159
// CHECK-NEXT: FileSize: 0
// CHECK-NEXT: MemSize: 4
// CHECK-NEXT: Flags [ (0x4)
Expand Down
20 changes: 10 additions & 10 deletions lld/test/ELF/basic.s
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ _start:
# CHECK-NEXT: Version: 1
# CHECK-NEXT: Entry: [[ENTRY:0x[0-9A-F]+]]
# CHECK-NEXT: ProgramHeaderOffset: 0x40
# CHECK-NEXT: SectionHeaderOffset: 0x1080
# CHECK-NEXT: SectionHeaderOffset: 0x1A0
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: HeaderSize: 64
Expand Down Expand Up @@ -61,8 +61,8 @@ _start:
# CHECK-NEXT: SHF_ALLOC (0x2)
# CHECK-NEXT: SHF_EXECINSTR (0x4)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x201000
# CHECK-NEXT: Offset: 0x1000
# CHECK-NEXT: Address: 0x201120
# CHECK-NEXT: Offset: 0x120
# CHECK-NEXT: Size: 16
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
Expand All @@ -78,7 +78,7 @@ _start:
# CHECK-NEXT: SHF_STRINGS (0x20)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
# CHECK-NEXT: Offset: 0x1010
# CHECK-NEXT: Offset: 0x130
# CHECK-NEXT: Size: 8
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
Expand All @@ -92,7 +92,7 @@ _start:
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
# CHECK-NEXT: Offset: 0x1018
# CHECK-NEXT: Offset: 0x138
# CHECK-NEXT: Size: 48
# CHECK-NEXT: Link: 5
# CHECK-NEXT: Info: 1
Expand All @@ -106,7 +106,7 @@ _start:
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
# CHECK-NEXT: Offset: 0x1048
# CHECK-NEXT: Offset: 0x168
# CHECK-NEXT: Size: 42
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
Expand All @@ -120,7 +120,7 @@ _start:
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
# CHECK-NEXT: Offset: 0x1072
# CHECK-NEXT: Offset: 0x192
# CHECK-NEXT: Size: 8
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
Expand Down Expand Up @@ -175,9 +175,9 @@ _start:
# CHECK-NEXT: }
# CHECK-NEXT: ProgramHeader {
# CHECK-NEXT: Type: PT_LOAD (0x1)
# CHECK-NEXT: Offset: 0x1000
# CHECK-NEXT: VirtualAddress: 0x201000
# CHECK-NEXT: PhysicalAddress: 0x201000
# CHECK-NEXT: Offset: 0x120
# CHECK-NEXT: VirtualAddress: 0x201120
# CHECK-NEXT: PhysicalAddress: 0x201120
# CHECK-NEXT: FileSize: 16
# CHECK-NEXT: MemSize: 16
# CHECK-NEXT: Flags [ (0x5)
Expand Down
6 changes: 3 additions & 3 deletions lld/test/ELF/build-id.s
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ _start:
# DEFAULT: Contents of section .note.test:
# DEFAULT: Contents of section .note.gnu.build-id:
# DEFAULT-NEXT: 04000000 08000000 03000000 474e5500 ............GNU.
# DEFAULT-NEXT: 605e19a6 30469e00
# DEFAULT-NEXT: 7e8ddeff 3ed41fa3

# MD5: Contents of section .note.gnu.build-id:
# MD5-NEXT: 04000000 10000000 03000000 474e5500 ............GNU.
# MD5-NEXT: adbf65c5 42b4a428 184fd7c9 099cdc29
# MD5-NEXT: 7b00fd9e 054ceb4b 06f64d0e 482cb476

# SHA1: Contents of section .note.gnu.build-id:
# SHA1-NEXT: 04000000 14000000 03000000 474e5500 ............GNU.
# SHA1-NEXT: fe148fd4 1add2878 6b298b61 5880148b
# SHA1-NEXT: 221a99da dd1d2bf3 05e48a91 dde8a0cb

# UUID: Contents of section .note.gnu.build-id:
# UUID-NEXT: 04000000 10000000 03000000 474e5500 ............GNU.
Expand Down
18 changes: 9 additions & 9 deletions lld/test/ELF/cgprofile-bad-clusters.s
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,20 @@ I:
.fill 13, 1, 0

# CHECK: Name: B
# CHECK-NEXT: Value: 0x201011
# CHECK-NEXT: Value: 0x201131
# CHECK: Name: C
# CHECK-NEXT: Value: 0x20100F
# CHECK-NEXT: Value: 0x20112F
# CHECK: Name: D
# CHECK-NEXT: Value: 0x2013F9
# CHECK-NEXT: Value: 0x201519
# CHECK: Name: E
# CHECK-NEXT: Value: 0x201010
# CHECK-NEXT: Value: 0x201130
# CHECK: Name: F
# CHECK-NEXT: Value: 0x2017E1
# CHECK-NEXT: Value: 0x201901
# CHECK: Name: G
# CHECK-NEXT: Value: 0x3017E0
# CHECK-NEXT: Value: 0x301900
# CHECK: Name: H
# CHECK-NEXT: Value: 0x201000
# CHECK-NEXT: Value: 0x201120
# CHECK: Name: I
# CHECK-NEXT: Value: 0x201001
# CHECK-NEXT: Value: 0x201121
# CHECK: Name: A
# CHECK-NEXT: Value: 0x20100E
# CHECK-NEXT: Value: 0x20112E
16 changes: 8 additions & 8 deletions lld/test/ELF/cgprofile-icf.s
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ A:
retq

# CHECK: Name: A
# CHECK-NEXT: Value: 0x201000
# CHECK-NEXT: Value: 0x201120
# CHECK: Name: B
# CHECK-NEXT: Value: 0x201010
# CHECK-NEXT: Value: 0x201130
# CHECK: Name: C
# CHECK-NEXT: Value: 0x201008
# CHECK-NEXT: Value: 0x201128
# CHECK: Name: D
# CHECK-NEXT: Value: 0x201008
# CHECK-NEXT: Value: 0x201128

# NOICF: Name: A
# NOICF-NEXT: Value: 0x201000
# NOICF-NEXT: Value: 0x201120
# NOICF: Name: B
# NOICF-NEXT: Value: 0x201008
# NOICF-NEXT: Value: 0x201128
# NOICF: Name: C
# NOICF-NEXT: Value: 0x201010
# NOICF-NEXT: Value: 0x201130
# NOICF: Name: D
# NOICF-NEXT: Value: 0x201018
# NOICF-NEXT: Value: 0x201138
18 changes: 9 additions & 9 deletions lld/test/ELF/cgprofile-obj.s
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ Aa:
.cg_profile B, C, 30
.cg_profile C, D, 90

# CHECK: 0000000000201003 t D
# CHECK: 0000000000201000 T A
# CHECK: 0000000000201001 T B
# CHECK: 0000000000201002 T C

# NO-CG: 0000000000201000 t D
# NO-CG: 0000000000201003 T A
# NO-CG: 0000000000201002 T B
# NO-CG: 0000000000201001 T C
# CHECK: 0000000000201123 t D
# CHECK: 0000000000201120 T A
# CHECK: 0000000000201121 T B
# CHECK: 0000000000201122 T C

# NO-CG: 0000000000201120 t D
# NO-CG: 0000000000201123 T A
# NO-CG: 0000000000201122 T B
# NO-CG: 0000000000201121 T C
8 changes: 4 additions & 4 deletions lld/test/ELF/cgprofile-reproduce.s
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
# RUN: llvm-readobj --symbols %t2 | FileCheck %s

# CHECK: Name: A
# CHECK-NEXT: Value: 0x201003
# CHECK-NEXT: Value: 0x201123
# CHECK: Name: B
# CHECK-NEXT: Value: 0x201000
# CHECK-NEXT: Value: 0x201120
# CHECK: Name: C
# CHECK-NEXT: Value: 0x201001
# CHECK-NEXT: Value: 0x201121
# CHECK: Name: D
# CHECK-NEXT: Value: 0x201002
# CHECK-NEXT: Value: 0x201122

.section .text.A,"ax",@progbits
.globl A
Expand Down
48 changes: 24 additions & 24 deletions lld/test/ELF/cgprofile-txt.s
Original file line number Diff line number Diff line change
Expand Up @@ -135,51 +135,51 @@ TooManyPreds10:
retq

# CHECK: Name: D
# CHECK-NEXT: Value: 0x201003
# CHECK-NEXT: Value: 0x201123
# CHECK: Name: TooManyPreds
# CHECK-NEXT: Value: 0x201004
# CHECK-NEXT: Value: 0x201124
# CHECK: Name: TooManyPreds10
# CHECK-NEXT: Value: 0x201018
# CHECK-NEXT: Value: 0x201138
# CHECK: Name: A
# CHECK-NEXT: Value: 0x201000
# CHECK-NEXT: Value: 0x201120
# CHECK: Name: B
# CHECK-NEXT: Value: 0x201001
# CHECK-NEXT: Value: 0x201121
# CHECK: Name: C
# CHECK-NEXT: Value: 0x201002
# CHECK-NEXT: Value: 0x201122
# CHECK: Name: GB
# CHECK-NEXT: Value: 0x20101F
# CHECK-NEXT: Value: 0x20113F
# CHECK: Name: PP
# CHECK-NEXT: Value: 0x20101C
# CHECK-NEXT: Value: 0x20113C
# CHECK: Name: QC
# CHECK-NEXT: Value: 0x20101E
# CHECK-NEXT: Value: 0x20113E
# CHECK: Name: TS
# CHECK-NEXT: Value: 0x20101D
# CHECK-NEXT: Value: 0x20113D
# CHECK: Name: _init
# CHECK-NEXT: Value: 0x201020
# CHECK-NEXT: Value: 0x201140
# CHECK: Name: _init2
# CHECK-NEXT: Value: 0x201021
# CHECK-NEXT: Value: 0x201141

# NOSORT: Name: D
# NOSORT-NEXT: Value: 0x201000
# NOSORT-NEXT: Value: 0x201120
# NOSORT: Name: TooManyPreds
# NOSORT-NEXT: Value: 0x201004
# NOSORT-NEXT: Value: 0x201124
# NOSORT: Name: TooManyPreds10
# NOSORT-NEXT: Value: 0x201018
# NOSORT-NEXT: Value: 0x201138
# NOSORT: Name: A
# NOSORT-NEXT: Value: 0x201003
# NOSORT-NEXT: Value: 0x201123
# NOSORT: Name: B
# NOSORT-NEXT: Value: 0x201002
# NOSORT-NEXT: Value: 0x201122
# NOSORT: Name: C
# NOSORT-NEXT: Value: 0x201001
# NOSORT-NEXT: Value: 0x201121
# NOSORT: Name: GB
# NOSORT-NEXT: Value: 0x20101C
# NOSORT-NEXT: Value: 0x20113C
# NOSORT: Name: PP
# NOSORT-NEXT: Value: 0x20101A
# NOSORT-NEXT: Value: 0x20113A
# NOSORT: Name: QC
# NOSORT-NEXT: Value: 0x20101B
# NOSORT-NEXT: Value: 0x20113B
# NOSORT: Name: TS
# NOSORT-NEXT: Value: 0x201019
# NOSORT-NEXT: Value: 0x201139
# NOSORT: Name: _init
# NOSORT-NEXT: Value: 0x20101D
# NOSORT-NEXT: Value: 0x20113D
# NOSORT: Name: _init2
# NOSORT-NEXT: Value: 0x20101E
# NOSORT-NEXT: Value: 0x20113E
8 changes: 4 additions & 4 deletions lld/test/ELF/cgprofile-txt2.s
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
# RUN: llvm-readobj --symbols %t2 | FileCheck %s

# CHECK: Name: A
# CHECK-NEXT: Value: 0x201003
# CHECK-NEXT: Value: 0x201123
# CHECK: Name: B
# CHECK-NEXT: Value: 0x201000
# CHECK-NEXT: Value: 0x201120
# CHECK: Name: C
# CHECK-NEXT: Value: 0x201001
# CHECK-NEXT: Value: 0x201121
# CHECK: Name: D
# CHECK-NEXT: Value: 0x201002
# CHECK-NEXT: Value: 0x201122

.section .text.A,"ax",@progbits
.globl A
Expand Down
Loading

0 comments on commit d4306e9

Please sign in to comment.