diff options
-rw-r--r-- | bfd/ChangeLog | 9 | ||||
-rw-r--r-- | bfd/elf.c | 18 | ||||
-rw-r--r-- | bfd/elflink.c | 2 | ||||
-rw-r--r-- | include/elf/ChangeLog | 6 | ||||
-rw-r--r-- | include/elf/internal.h | 8 |
5 files changed, 26 insertions, 17 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index f69dae1e658..627d3487c2d 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,14 @@ 2008-03-13 Alan Modra <amodra@bigpond.net.au> + * elf.c (_bfd_elf_make_section_from_shdr): Remove unnecessary cast. + (_bfd_elf_assign_file_position_for_section): Simplify align. + (_bfd_elf_init_reloc_shdr): Ensure shift expression wide enough + for sh_addralign. + (elf_fake_sections, swap_out_syms): Likewise. + * elflink.c (bfd_elf_final_link): Likewise. + +2008-03-13 Alan Modra <amodra@bigpond.net.au> + * Makefile.am: Run "make dep-am". * Makefile.in: Regenerate. * po/SRC-POTFILES.in: Regenerate. diff --git a/bfd/elf.c b/bfd/elf.c index 5ca43ebb4cb..36515ce35b7 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -828,7 +828,7 @@ _bfd_elf_make_section_from_shdr (bfd *abfd, if (! bfd_set_section_vma (abfd, newsect, hdr->sh_addr) || ! bfd_set_section_size (abfd, newsect, hdr->sh_size) || ! bfd_set_section_alignment (abfd, newsect, - bfd_log2 ((bfd_vma) hdr->sh_addralign))) + bfd_log2 (hdr->sh_addralign))) return FALSE; flags = SEC_NO_FLAGS; @@ -2449,7 +2449,7 @@ _bfd_elf_init_reloc_shdr (bfd *abfd, rel_hdr->sh_entsize = (use_rela_p ? bed->s->sizeof_rela : bed->s->sizeof_rel); - rel_hdr->sh_addralign = 1 << bed->s->log_file_align; + rel_hdr->sh_addralign = (bfd_vma) 1 << bed->s->log_file_align; rel_hdr->sh_flags = 0; rel_hdr->sh_addr = 0; rel_hdr->sh_size = 0; @@ -2496,7 +2496,7 @@ elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg) this_hdr->sh_offset = 0; this_hdr->sh_size = asect->size; this_hdr->sh_link = 0; - this_hdr->sh_addralign = 1 << asect->alignment_power; + this_hdr->sh_addralign = (bfd_vma) 1 << asect->alignment_power; /* The sh_entsize and sh_info fields may have been set already by copy_private_section_data. */ @@ -3221,14 +3221,8 @@ _bfd_elf_assign_file_position_for_section (Elf_Internal_Shdr *i_shdrp, file_ptr offset, bfd_boolean align) { - if (align) - { - unsigned int al; - - al = i_shdrp->sh_addralign; - if (al > 1) - offset = BFD_ALIGN (offset, al); - } + if (align && i_shdrp->sh_addralign > 1) + offset = BFD_ALIGN (offset, i_shdrp->sh_addralign); i_shdrp->sh_offset = offset; if (i_shdrp->bfd_section != NULL) i_shdrp->bfd_section->filepos = offset; @@ -6145,7 +6139,7 @@ swap_out_syms (bfd *abfd, symtab_hdr->sh_entsize = bed->s->sizeof_sym; symtab_hdr->sh_size = symtab_hdr->sh_entsize * (symcount + 1); symtab_hdr->sh_info = elf_num_locals (abfd) + 1; - symtab_hdr->sh_addralign = 1 << bed->s->log_file_align; + symtab_hdr->sh_addralign = (bfd_vma) 1 << bed->s->log_file_align; symstrtab_hdr = &elf_tdata (abfd)->strtab_hdr; symstrtab_hdr->sh_type = SHT_STRTAB; diff --git a/bfd/elflink.c b/bfd/elflink.c index 0e42da7eed8..65cb85253ee 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -10166,7 +10166,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) /* sh_link is set in assign_section_numbers. */ /* sh_info is set below. */ /* sh_offset is set just below. */ - symtab_hdr->sh_addralign = 1 << bed->s->log_file_align; + symtab_hdr->sh_addralign = (bfd_vma) 1 << bed->s->log_file_align; off = elf_tdata (abfd)->next_file_pos; off = _bfd_elf_assign_file_position_for_section (symtab_hdr, off, TRUE); diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog index 621f48e4ade..b2e4bebfc5d 100644 --- a/include/elf/ChangeLog +++ b/include/elf/ChangeLog @@ -1,3 +1,9 @@ +2008-03-13 Alan Modra <amodra@bigpond.net.au> + + * internal.h (Elf_Internal_Shdr): Change sh_link and sh_info from + unsigned long to unsigned int. Change sh_addralign to bfd_vma. + Order struct as for external version. + 2008-03-12 Alan Modra <amodra@bigpond.net.au> PR 5900 diff --git a/include/elf/internal.h b/include/elf/internal.h index cacfc63bf1f..513f6763c82 100644 --- a/include/elf/internal.h +++ b/include/elf/internal.h @@ -105,12 +105,12 @@ typedef struct elf_internal_shdr { unsigned int sh_type; /* Type of section */ bfd_vma sh_flags; /* Miscellaneous section attributes */ bfd_vma sh_addr; /* Section virtual addr at execution */ + file_ptr sh_offset; /* Section file offset */ bfd_size_type sh_size; /* Size of section in bytes */ + unsigned int sh_link; /* Index of another section */ + unsigned int sh_info; /* Additional section information */ + bfd_vma sh_addralign; /* Section alignment */ bfd_size_type sh_entsize; /* Entry size if section holds table */ - unsigned long sh_link; /* Index of another section */ - unsigned long sh_info; /* Additional section information */ - file_ptr sh_offset; /* Section file offset */ - unsigned int sh_addralign; /* Section alignment */ /* The internal rep also has some cached info associated with it. */ asection * bfd_section; /* Associated BFD section. */ |