aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2010-07-20 14:08:32 +0000
committerAlan Modra <amodra@gmail.com>2010-07-20 14:08:32 +0000
commitf4638467331c33e2f9dd00c12c175a9eb47351c8 (patch)
tree98a865621bcd4a31314c5de6d5e7780feff3d365 /bfd
parentad34eb2f7c3120f83d22cf2d5371673fc95040b4 (diff)
downloadgdb-f4638467331c33e2f9dd00c12c175a9eb47351c8.zip
gdb-f4638467331c33e2f9dd00c12c175a9eb47351c8.tar.gz
gdb-f4638467331c33e2f9dd00c12c175a9eb47351c8.tar.bz2
include/elf/
* internal.h (ELF_TBSS_SPECIAL): New macro, extracted from.. (ELF_SECTION_SIZE): ..here. (ELF_SECTION_IN_SEGMENT_1): Add "strict" arg. (ELF_SECTION_IN_SEGMENT_STRICT): New macro. bfd/ * elf.c (assign_file_positions_for_load_sections): Check that zero size sections are allocated in segments too. (assign_file_positions_for_non_load_sections): Warn if zero size alloc sections are found here. (copy_elf_program_header): Don't drop zero size sections from segment map. (copy_private_bfd_data): Check for changes in zero size sections. binutils/ * readelf.c (process_program_headers): Don't ignore all zero size sections. ld/testsuite/ * ld-powerpc/tlsexe.r: Update. * ld-powerpc/tlsexetoc.r: Update. * ld-powerpc/tlsso.r: Update. * ld-powerpc/tlstocso.r: Update.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog10
-rw-r--r--bfd/elf.c25
2 files changed, 20 insertions, 15 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index a6dd0d8..aa36284 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,13 @@
+2010-07-20 Alan Modra <amodra@gmail.com>
+
+ * elf.c (assign_file_positions_for_load_sections): Check that
+ zero size sections are allocated in segments too.
+ (assign_file_positions_for_non_load_sections): Warn if zero
+ size alloc sections are found here.
+ (copy_elf_program_header): Don't drop zero size sections from
+ segment map.
+ (copy_private_bfd_data): Check for changes in zero size sections.
+
2010-07-17 Alan Modra <amodra@gmail.com>
* elf.c (_bfd_elf_map_sections_to_segments): Force new segment
diff --git a/bfd/elf.c b/bfd/elf.c
index 63f0260..e7651ba 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -4589,8 +4589,7 @@ assign_file_positions_for_load_sections (bfd *abfd,
sec = m->sections[i];
this_hdr = &(elf_section_data(sec)->this_hdr);
- if (this_hdr->sh_size != 0
- && !ELF_SECTION_IN_SEGMENT_1 (this_hdr, p, check_vma))
+ if (!ELF_SECTION_IN_SEGMENT_1 (this_hdr, p, check_vma, 0))
{
(*_bfd_error_handler)
(_("%B: section `%A' can't be allocated in segment %d"),
@@ -4640,13 +4639,12 @@ assign_file_positions_for_non_load_sections (bfd *abfd,
BFD_ASSERT (hdr->sh_offset == hdr->bfd_section->filepos);
else if ((hdr->sh_flags & SHF_ALLOC) != 0)
{
- if (hdr->sh_size != 0)
- ((*_bfd_error_handler)
- (_("%B: warning: allocated section `%s' not in segment"),
- abfd,
- (hdr->bfd_section == NULL
- ? "*unknown*"
- : hdr->bfd_section->name)));
+ (*_bfd_error_handler)
+ (_("%B: warning: allocated section `%s' not in segment"),
+ abfd,
+ (hdr->bfd_section == NULL
+ ? "*unknown*"
+ : hdr->bfd_section->name));
/* We don't need to page align empty sections. */
if ((abfd->flags & D_PAGED) != 0 && hdr->sh_size != 0)
off += vma_page_aligned_bias (hdr->sh_addr, off,
@@ -5868,8 +5866,7 @@ copy_elf_program_header (bfd *ibfd, bfd *obfd)
section = section->next)
{
this_hdr = &(elf_section_data(section)->this_hdr);
- if (this_hdr->sh_size != 0
- && ELF_SECTION_IN_SEGMENT (this_hdr, segment))
+ if (ELF_SECTION_IN_SEGMENT (this_hdr, segment))
{
if (!first_section)
first_section = lowest_section = section;
@@ -5948,8 +5945,7 @@ copy_elf_program_header (bfd *ibfd, bfd *obfd)
section = section->next)
{
this_hdr = &(elf_section_data(section)->this_hdr);
- if (this_hdr->sh_size != 0
- && ELF_SECTION_IN_SEGMENT (this_hdr, segment))
+ if (ELF_SECTION_IN_SEGMENT (this_hdr, segment))
{
map->sections[isec++] = section->output_section;
if (isec == section_count)
@@ -6026,8 +6022,7 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd)
/* Check if this section is covered by the segment. */
this_hdr = &(elf_section_data(section)->this_hdr);
- if (this_hdr->sh_size != 0
- && ELF_SECTION_IN_SEGMENT (this_hdr, segment))
+ if (ELF_SECTION_IN_SEGMENT (this_hdr, segment))
{
/* FIXME: Check if its output section is changed or
removed. What else do we need to check? */