From 8c252fd9c3e28b18ce8982d1c798ea569969a0a4 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 10 May 2007 14:46:48 +0000 Subject: [PATCH] bfd/ * elf.c (assign_file_positions_for_load_sections): Use p_memsz rather than p_filesz to calculate the LMA of the end of a segment. ld/testsuite/ * ld-elf/multibss1.d, ld-elf/multibss1.s: New test. --- bfd/ChangeLog | 5 +++++ bfd/elf.c | 2 +- ld/testsuite/ChangeLog | 4 ++++ ld/testsuite/ld-elf/multibss1.d | 9 +++++++++ ld/testsuite/ld-elf/multibss1.s | 11 +++++++++++ 5 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 ld/testsuite/ld-elf/multibss1.d create mode 100644 ld/testsuite/ld-elf/multibss1.s diff --git a/bfd/ChangeLog b/bfd/ChangeLog index f24593ad350..667a962e844 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2007-05-10 Richard Sandiford + + * elf.c (assign_file_positions_for_load_sections): Use p_memsz + rather than p_filesz to calculate the LMA of the end of a segment. + 2007-05-10 Jakub Jelinek * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Don't do copyreloc diff --git a/bfd/elf.c b/bfd/elf.c index ec0c1b3e9d1..6e1ab9631ac 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -4520,7 +4520,7 @@ assign_file_positions_for_load_sections (bfd *abfd, if (p->p_type == PT_LOAD || p->p_type == PT_TLS) { - bfd_signed_vma adjust = sec->lma - (p->p_paddr + p->p_filesz); + bfd_signed_vma adjust = sec->lma - (p->p_paddr + p->p_memsz); if ((flags & SEC_LOAD) != 0 || ((flags & SEC_ALLOC) != 0 diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 885b706dec1..ec50abef668 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2007-05-10 Richard Sandiford + + * ld-elf/multibss1.d, ld-elf/multibss1.s: New test. + 2007-04-27 Nathan Sidwell * ld-m68k/plt1-isac.d: New. diff --git a/ld/testsuite/ld-elf/multibss1.d b/ld/testsuite/ld-elf/multibss1.d new file mode 100644 index 00000000000..8074fe3347f --- /dev/null +++ b/ld/testsuite/ld-elf/multibss1.d @@ -0,0 +1,9 @@ +#source: multibss1.s +#ld: -e 0 +#readelf: -l --wide +#target: *-*-linux* + +#... + +LOAD +0x[^ ]+ +0x[^ ]+ +0x[^ ]+ +0x[^ ]+ +0x500000 .* +# p_offset p_vaddr p_paddr p_filesz +#pass diff --git a/ld/testsuite/ld-elf/multibss1.s b/ld/testsuite/ld-elf/multibss1.s new file mode 100644 index 00000000000..3e168b65d12 --- /dev/null +++ b/ld/testsuite/ld-elf/multibss1.s @@ -0,0 +1,11 @@ + .macro makebss + .section .bss_\@,"aw",@nobits + .space 0x10000 + .endm + + .rept 80 + makebss + .endr + + .text + .space 0x10