Browse Source

Abort if PT_GNU_RELRO segment doesn't fit in PT_LOAD segment

bfd/

	PR bfd/14207
	* elf.c (assign_file_positions_for_non_load_sections): Abort if
	PT_GNU_RELRO segment doesn't fit in PT_LOAD segment.

ld/testsuite/

	PR ld/14207
	* ld-x86-64/x86-64.exp: Run pr14207.

	* ld-x86-64/pr14207.d: New file.
	* ld-x86-64/pr14207.s: Likewise.
cygwin-64bit-branch
H.J. Lu 14 years ago
parent
commit
8981c88a1e
  1. 6
      bfd/ChangeLog
  2. 5
      bfd/elf.c
  3. 8
      ld/testsuite/ChangeLog
  4. 9
      ld/testsuite/ld-x86-64/pr14207.d
  5. 24
      ld/testsuite/ld-x86-64/pr14207.s
  6. 1
      ld/testsuite/ld-x86-64/x86-64.exp

6
bfd/ChangeLog

@ -1,3 +1,9 @@
2012-06-12 H.J. Lu <hongjiu.lu@intel.com>
PR bfd/14207
* elf.c (assign_file_positions_for_non_load_sections): Abort if
PT_GNU_RELRO segment doesn't fit in PT_LOAD segment.
2012-06-12 Alan Modra <amodra@gmail.com>
PR ld/14207

5
bfd/elf.c

@ -4931,6 +4931,11 @@ assign_file_positions_for_non_load_sections (bfd *abfd,
&& lp->p_vaddr + lp->p_filesz >= link_info->relro_end)
break;
}
/* PR ld/14207. If the RELRO segment doesn't fit in the
LOAD segment, it should be removed. */
if (lp == (phdrs + count))
abort ();
}
else
{

8
ld/testsuite/ChangeLog

@ -1,3 +1,11 @@
2012-06-12 H.J. Lu <hongjiu.lu@intel.com>
PR ld/14207
* ld-x86-64/x86-64.exp: Run pr14207.
* ld-x86-64/pr14207.d: New file.
* ld-x86-64/pr14207.s: Likewise.
2012-06-11 H.J. Lu <hongjiu.lu@intel.com>
PR ld/14215

9
ld/testsuite/ld-x86-64/pr14207.d

@ -0,0 +1,9 @@
#name: PR ld/14207
#as: --64
#ld: -melf_x86_64 -shared -z relro -z now
#readelf: -l --wide
#failif
#...
NULL +.*
#...

24
ld/testsuite/ld-x86-64/pr14207.s

@ -0,0 +1,24 @@
.section .ctors, "aw"
.space 0x10, 1
.section .dtors, "aw"
.space 0x10, 2
.section .jcr, "aw"
.space 0x8, 3
.section .data.rel.ro
.p2align 4
.space 0x20, 3
.section .dynamic
.space 0xb0, 2
.section .got
.space 0x2a8, 4
.bss
.zero 0x840

1
ld/testsuite/ld-x86-64/x86-64.exp

@ -209,6 +209,7 @@ run_dump_test "pr13947"
run_dump_test "pr12570a"
run_dump_test "pr12570b"
run_dump_test "pr14215"
run_dump_test "pr14207"
if { ![istarget "x86_64-*-linux*"] && ![istarget "x86_64-*-nacl*"]} {
return

Loading…
Cancel
Save