From: Alan Modra Date: Tue, 2 May 2006 01:41:20 +0000 (+0000) Subject: * dwarf2.c: Formatting. X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=e460dd0d29973affa0b660495c1426c16d797e4c;p=deliverable%2Fbinutils-gdb.git * dwarf2.c: Formatting. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Simplify output section check. * elf32-i370.c: Warning fixes inside #ifdef DEBUG. * elf32-m32c.c: Similarly. * elf32-ppc.c: Similarly. * elf32-v850.c: Similarly. * nlm32-sparc.c: Similarly. * elfcode.h: Similarly. (elf_symbol_flags): Delete. * elflink.c (elf_link_input_bfd): Comment typo. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index dcfe7138af..a25e15eddc 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,17 @@ +2006-05-02 Alan Modra + + * dwarf2.c: Formatting. + * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Simplify + output section check. + * elf32-i370.c: Warning fixes inside #ifdef DEBUG. + * elf32-m32c.c: Similarly. + * elf32-ppc.c: Similarly. + * elf32-v850.c: Similarly. + * nlm32-sparc.c: Similarly. + * elfcode.h: Similarly. + (elf_symbol_flags): Delete. + * elflink.c (elf_link_input_bfd): Comment typo. + 2006-05-01 DJ Delorie * bfd-in.h (bfd_hash_table): Add count field. diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index ae68d18868..ea4ece4833 100644 --- a/bfd/dwarf2.c +++ b/bfd/dwarf2.c @@ -1625,7 +1625,7 @@ read_rangelist (struct comp_unit *unit, struct arange *arange, bfd_uint64_t offs if (low_pc == -1UL && high_pc != -1UL) base_address = high_pc; else - arange_add (unit->abfd, arange, base_address + low_pc, base_address + high_pc); + arange_add (unit->abfd, arange, base_address + low_pc, base_address + high_pc); } } diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c index ab0b995c0c..4f9ed4a99a 100644 --- a/bfd/elf-eh-frame.c +++ b/bfd/elf-eh-frame.c @@ -390,8 +390,7 @@ _bfd_elf_discard_section_eh_frame return FALSE; } - if ((sec->output_section != NULL - && bfd_is_abs_section (sec->output_section))) + if (bfd_is_abs_section (sec->output_section)) { /* At least one of the sections is being discarded from the link, so we should just ignore them. */ diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c index d9e6fbf528..218aa23a68 100644 --- a/bfd/elf32-i370.c +++ b/bfd/elf32-i370.c @@ -1,6 +1,6 @@ /* i370-specific support for 32-bit ELF - Copyright 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005 - Free Software Foundation, Inc. + Copyright 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, + 2005, 2006 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. Hacked by Linas Vepstas for i370 linas@linas.org @@ -567,7 +567,7 @@ i370_elf_adjust_dynindx (struct elf_link_hash_entry *h, void * cparg) #ifdef DEBUG fprintf (stderr, - "i370_elf_adjust_dynindx called, h->dynindx = %d, *cp = %d\n", + "i370_elf_adjust_dynindx called, h->dynindx = %ld, *cp = %d\n", h->dynindx, *cp); #endif @@ -1296,7 +1296,7 @@ i370_elf_relocate_section (bfd *output_bfd, #ifdef DEBUG if (indx <= 0) { - printf ("indx=%d section=%s flags=%08x name=%s\n", + printf ("indx=%ld section=%s flags=%08x name=%s\n", indx, osec->name, osec->flags, h->root.root.string); } diff --git a/bfd/elf32-m32c.c b/bfd/elf32-m32c.c index 5e9f3ab28a..43204615e3 100644 --- a/bfd/elf32-m32c.c +++ b/bfd/elf32-m32c.c @@ -40,7 +40,8 @@ static bfd_boolean m32c_elf_check_relocs (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *); static bfd_boolean m32c_elf_relax_delete_bytes (bfd *, asection *, bfd_vma, int); #ifdef DEBUG -static char * m32c_get_reloc (long reloc); +char * m32c_get_reloc (long reloc); +void dump_symtab (bfd *, void *, void *); #endif static bfd_boolean m32c_elf_relax_section (bfd *abfd, asection *sec, struct bfd_link_info *link_info, bfd_boolean *again); @@ -936,7 +937,7 @@ m32c_elf_object_p (bfd *abfd) #ifdef DEBUG -static void +void dump_symtab (bfd * abfd, void *internal_syms, void *external_syms) { size_t locsymcount; @@ -977,7 +978,6 @@ dump_symtab (bfd * abfd, void *internal_syms, void *external_syms) { case STT_FUNC: st_info_str = "STT_FUNC"; case STT_SECTION: st_info_str = "STT_SECTION"; - case STT_SRELC: st_info_str = "STT_SRELC"; case STT_FILE: st_info_str = "STT_FILE"; case STT_OBJECT: st_info_str = "STT_OBJECT"; case STT_TLS: st_info_str = "STT_TLS"; @@ -1022,7 +1022,7 @@ dump_symtab (bfd * abfd, void *internal_syms, void *external_syms) free (external_syms); } -static char * +char * m32c_get_reloc (long reloc) { if (0 <= reloc && reloc < R_M32C_max) diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 6a2d5170d7..9ee2bcd857 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -6293,7 +6293,7 @@ ppc_elf_relocate_section (bfd *output_bfd, BFD_ASSERT (indx > 0); #ifdef DEBUG if (indx <= 0) - printf ("indx=%d section=%s flags=%08x name=%s\n", + printf ("indx=%ld section=%s flags=%08x name=%s\n", indx, osec->name, osec->flags, h->root.root.string); #endif diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c index e2c29ee192..e3f1240bf5 100644 --- a/bfd/elf32-v850.c +++ b/bfd/elf32-v850.c @@ -1,6 +1,6 @@ /* V850-specific support for 32-bit ELF - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 - Free Software Foundation, Inc. + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, + 2006 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -33,6 +33,8 @@ /* Sign-extend a 24-bit number. */ #define SEXT24(x) ((((x) & 0xffffff) ^ 0x800000) - 0x800000) +static reloc_howto_type v850_elf_howto_table[]; + /* Look through the relocs for a section during the first phase, and allocate space in the global offset table or procedure linkage table. */ diff --git a/bfd/elfcode.h b/bfd/elfcode.h index 9bb66e11c0..5a54fc2105 100644 --- a/bfd/elfcode.h +++ b/bfd/elfcode.h @@ -1,6 +1,6 @@ /* ELF executable support for BFD. Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Written by Fred Fish @ Cygnus Support, from information published in "UNIX System V Release 4, Programmers Guide: ANSI C and @@ -139,10 +139,11 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. #define LOG_FILE_ALIGN 2 #endif -#ifdef DEBUG +#if DEBUG & 2 static void elf_debug_section (int, Elf_Internal_Shdr *); +#endif +#if DEBUG & 1 static void elf_debug_file (Elf_Internal_Ehdr *); -static char *elf_symbol_flags (flagword); #endif /* Structure swapping routines */ @@ -545,7 +546,7 @@ elf_object_p (bfd *abfd) if (i_ehdrp->e_shoff == 0 && i_ehdrp->e_type == ET_REL) goto got_wrong_format_error; - /* As a simple sanity check, verify that the what BFD thinks is the + /* As a simple sanity check, verify that what BFD thinks is the size of each section header table entry actually matches the size recorded in the file, but only if there are any sections. */ if (i_ehdrp->e_shentsize != sizeof (x_shdr) && i_ehdrp->e_shnum != 0) @@ -1450,7 +1451,7 @@ elf_slurp_reloc_table (bfd *abfd, return TRUE; } -#ifdef DEBUG +#if DEBUG & 2 static void elf_debug_section (int num, Elf_Internal_Shdr *hdr) { @@ -1476,7 +1477,9 @@ elf_debug_section (int num, Elf_Internal_Shdr *hdr) (long) hdr->sh_entsize); fflush (stderr); } +#endif +#if DEBUG & 1 static void elf_debug_file (Elf_Internal_Ehdr *ehdrp) { @@ -1488,77 +1491,6 @@ elf_debug_file (Elf_Internal_Ehdr *ehdrp) fprintf (stderr, "e_shnum = %ld\n", (long) ehdrp->e_shnum); fprintf (stderr, "e_shentsize = %ld\n", (long) ehdrp->e_shentsize); } - -static char * -elf_symbol_flags (flagword flags) -{ - static char buffer[1024]; - - buffer[0] = '\0'; - if (flags & BSF_LOCAL) - strcat (buffer, " local"); - - if (flags & BSF_GLOBAL) - strcat (buffer, " global"); - - if (flags & BSF_DEBUGGING) - strcat (buffer, " debug"); - - if (flags & BSF_FUNCTION) - strcat (buffer, " function"); - - if (flags & BSF_KEEP) - strcat (buffer, " keep"); - - if (flags & BSF_KEEP_G) - strcat (buffer, " keep_g"); - - if (flags & BSF_WEAK) - strcat (buffer, " weak"); - - if (flags & BSF_SECTION_SYM) - strcat (buffer, " section-sym"); - - if (flags & BSF_OLD_COMMON) - strcat (buffer, " old-common"); - - if (flags & BSF_NOT_AT_END) - strcat (buffer, " not-at-end"); - - if (flags & BSF_CONSTRUCTOR) - strcat (buffer, " constructor"); - - if (flags & BSF_WARNING) - strcat (buffer, " warning"); - - if (flags & BSF_INDIRECT) - strcat (buffer, " indirect"); - - if (flags & BSF_FILE) - strcat (buffer, " file"); - - if (flags & DYNAMIC) - strcat (buffer, " dynamic"); - - if (flags & ~(BSF_LOCAL - | BSF_GLOBAL - | BSF_DEBUGGING - | BSF_FUNCTION - | BSF_KEEP - | BSF_KEEP_G - | BSF_WEAK - | BSF_SECTION_SYM - | BSF_OLD_COMMON - | BSF_NOT_AT_END - | BSF_CONSTRUCTOR - | BSF_WARNING - | BSF_INDIRECT - | BSF_FILE - | BSF_DYNAMIC)) - strcat (buffer, " unknown-bits"); - - return buffer; -} #endif /* Create a new BFD as if by bfd_openr. Rather than opening a file, diff --git a/bfd/elflink.c b/bfd/elflink.c index 0900220dbc..984e8282b8 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -7250,7 +7250,7 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) /* This is a reloc for a deleted entry or somesuch. Turn it into an R_*_NONE reloc, at the same offset as the last reloc. elf_eh_frame.c and - elf_bfd_discard_info rely on reloc offsets + bfd_elf_discard_info rely on reloc offsets being ordered. */ irela->r_offset = last_offset; irela->r_info = 0; diff --git a/bfd/nlm32-sparc.c b/bfd/nlm32-sparc.c index e647ad082a..701a6d81c1 100644 --- a/bfd/nlm32-sparc.c +++ b/bfd/nlm32-sparc.c @@ -1,5 +1,5 @@ /* Support for 32-bit SPARC NLM (NetWare Loadable Module) - Copyright 1993, 1994, 1999, 2000, 2001, 2002, 2003, 2004, 2005 + Copyright 1993, 1994, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -123,8 +123,9 @@ nlm_sparc_read_reloc (bfd *abfd, } #ifdef DEBUG - fprintf (stderr, "%s: address = %08lx, addend = %08lx, type = %d, howto = %08lx\n", - __FUNCTION__, rel->address, rel->addend, type, rel->howto); + fprintf (stderr, "%s: address = %08lx, addend = %08lx, type = %u, howto = %p\n", + __FUNCTION__, (unsigned long) rel->address, + (unsigned long) rel->addend, type, rel->howto); #endif return TRUE; @@ -176,8 +177,9 @@ nlm_sparc_write_reloc (bfd * abfd, asection * sec, arelent * rel) val = bfd_get_section_vma (abfd, sec) + rel->address; #ifdef DEBUG - fprintf (stderr, "%s: val = %08lx, addend = %08lx, type = %d\n", - __FUNCTION__, val, rel->addend, rel->howto->type); + fprintf (stderr, "%s: val = %08lx, addend = %08lx, type = %u\n", + __FUNCTION__, (unsigned long) val, (unsigned long) rel->addend, + rel->howto->type); #endif bfd_put_32 (abfd, val, tmp_reloc.offset); bfd_put_32 (abfd, rel->addend, tmp_reloc.addend); @@ -280,8 +282,8 @@ nlm_sparc_write_import (bfd * abfd, asection * sec, arelent * rel) base = 0; #ifdef DEBUG - fprintf (stderr, "%s: <%x, 1>\n\t", - __FUNCTION__, base + (*rel->sym_ptr_ptr)->value); + fprintf (stderr, "%s: <%lx, 1>\n\t", + __FUNCTION__, (unsigned long) (base + (*rel->sym_ptr_ptr)->value)); #endif bfd_put_32 (abfd, base + (*rel->sym_ptr_ptr)->value, temp); if (bfd_bwrite (temp, (bfd_size_type) 4, abfd) != 4) @@ -330,8 +332,8 @@ nlm_sparc_write_export (bfd * abfd, asymbol * sym, bfd_vma value) bfd_byte temp[4]; #ifdef DEBUG - fprintf (stderr, "%s: <%x, %d, %s>\n", - __FUNCTION__, value, strlen (sym->name), sym->name); + fprintf (stderr, "%s: <%lx, %u, %s>\n", + __FUNCTION__, (unsigned long) value, strlen (sym->name), sym->name); #endif bfd_put_32 (abfd, value, temp); len = strlen (sym->name);