aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2010-04-22 01:51:01 +0000
committerAlan Modra <amodra@gmail.com>2010-04-22 01:51:01 +0000
commit3ac9b6c910daef1a01271f14f137862eb570a420 (patch)
tree54b8906d42c7952bf6633c65cf5dcf728b4203a2 /bfd/elf.c
parente96d56a1c8ae442971a1cedc3128fd0d822a3f77 (diff)
downloadgdb-3ac9b6c910daef1a01271f14f137862eb570a420.zip
gdb-3ac9b6c910daef1a01271f14f137862eb570a420.tar.gz
gdb-3ac9b6c910daef1a01271f14f137862eb570a420.tar.bz2
bfd/
* elf.c (assign_file_positions_for_load_sections): Revert 2008-05-29 change. Tidy. Don't error on sections not allocated in segment. ld/testsuite/ * ld-elf/extract-symbol-1sec.d: Update lma. * ld-i386/alloc.d: Expect a warning, not an error.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c27
1 files changed, 5 insertions, 22 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index bcd238d..0ffc2d0 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -4453,32 +4453,17 @@ assign_file_positions_for_load_sections (bfd *abfd,
&& ((this_hdr->sh_flags & SHF_TLS) == 0
|| p->p_type == PT_TLS))))
{
- bfd_signed_vma adjust = sec->vma - (p->p_vaddr + p->p_memsz);
+ bfd_vma adjust = sec->lma - (p->p_paddr + p->p_memsz);
- if (sec->vma < p->p_vaddr + p->p_memsz)
+ if (sec->lma < p->p_paddr + p->p_memsz)
{
(*_bfd_error_handler)
- (_("%B: section %A vma 0x%lx overlaps previous sections"),
- abfd, sec, (unsigned long) sec->vma);
+ (_("%B: section %A lma 0x%lx overlaps previous sections"),
+ abfd, sec, (unsigned long) sec->lma);
adjust = 0;
- }
- p->p_memsz += adjust;
-
- if (p->p_paddr + p->p_memsz != sec->lma)
- {
- /* This behavior is a compromise--ld has long
- silently changed the lma of sections when
- lma - vma is not equal for every section in a
- pheader--but only in the internal elf structures.
- Silently changing the lma is probably a bug, but
- changing it would have subtle and unknown
- consequences for existing scripts.
-
- Instead modify the bfd data structure to reflect
- what happened. This at least fixes the values
- for the lma in the mapfile. */
sec->lma = p->p_paddr + p->p_memsz;
}
+ p->p_memsz += adjust;
if (this_hdr->sh_type != SHT_NOBITS)
{
@@ -4581,8 +4566,6 @@ assign_file_positions_for_load_sections (bfd *abfd,
(_("%B: section `%A' can't be allocated in segment %d"),
abfd, sec, j);
print_segment_map (m);
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
}
}
}