From: Alan Modra Date: Sun, 6 Jan 2002 07:30:35 +0000 (+0000) Subject: * syms.c (_bfd_generic_make_empty_symbol): New function. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3f3c5c340426c1a7d0006cd92f68d394a100d287;p=binutils-gdb.git * syms.c (_bfd_generic_make_empty_symbol): New function. * libbfd-in.h (_bfd_nosymbols_make_empty_symbol): Define as _bfd_generic_make_empty_symbol. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. * hppabsd-core.c (hppabsd_core_make_empty_symbol): Delete function. (hppabsd_core_get_symtab_upper_bound): Don't define. (hppabsd_core_get_symtab): Likewise. (hppabsd_core_print_symbol): Likewise. (hppabsd_core_get_symbol_info): Likewise. (hppabsd_core_bfd_is_local_label_name): Likewise. (hppabsd_core_get_lineno): Likewise. (hppabsd_core_find_nearest_line): Likewise. (hppabsd_core_bfd_make_debug_symbol): Likewise. (hppabsd_core_read_minisymbols): Likewise. (hppabsd_core_minisymbol_to_symbol): Likewise. (hppabsd_core_vec): Use BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols). Formatting fixes. * hpux-core.c: Similarly. * irix-core.c: Similarly. * osf-core.c: Similarly. * sco5-core.c: Similarly. * binary.c (binary_make_empty_symbol): Remove function, define as _bfd_generic_make_empty_symbol. * ihex.c (ihex_make_empty_symbol): Likewise. * mmo.c (mmo_make_empty_symbol): Likewise. * ppcboot.c (ppcboot_make_empty_symbol): Likewise. * srec.c (srec_make_empty_symbol): Likewise. * versados.c (versados_make_empty_symbol): Likewise. * vms.c (_bfd_vms_make_empty_symbol): Remove. (vms_make_empty_symbol): Define as _bfd_generic_make_empty_symbol. * vms-gsd.c (_bfd_vms_slurp_gsd): Call bfd_make_empty_symbol rather than _bfd_vms_make_empty_symbol. * vms-misc.c (new_symbol): Likewise. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index be4fe732a6c..06434355ddf 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,40 @@ +2002-01-06 Alan Modra + + * syms.c (_bfd_generic_make_empty_symbol): New function. + * libbfd-in.h (_bfd_nosymbols_make_empty_symbol): Define as + _bfd_generic_make_empty_symbol. + * libbfd.h: Regenerate. + * bfd-in2.h: Regenerate. + * hppabsd-core.c (hppabsd_core_make_empty_symbol): Delete function. + (hppabsd_core_get_symtab_upper_bound): Don't define. + (hppabsd_core_get_symtab): Likewise. + (hppabsd_core_print_symbol): Likewise. + (hppabsd_core_get_symbol_info): Likewise. + (hppabsd_core_bfd_is_local_label_name): Likewise. + (hppabsd_core_get_lineno): Likewise. + (hppabsd_core_find_nearest_line): Likewise. + (hppabsd_core_bfd_make_debug_symbol): Likewise. + (hppabsd_core_read_minisymbols): Likewise. + (hppabsd_core_minisymbol_to_symbol): Likewise. + (hppabsd_core_vec): Use BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols). + Formatting fixes. + * hpux-core.c: Similarly. + * irix-core.c: Similarly. + * osf-core.c: Similarly. + * sco5-core.c: Similarly. + * binary.c (binary_make_empty_symbol): Remove function, define as + _bfd_generic_make_empty_symbol. + * ihex.c (ihex_make_empty_symbol): Likewise. + * mmo.c (mmo_make_empty_symbol): Likewise. + * ppcboot.c (ppcboot_make_empty_symbol): Likewise. + * srec.c (srec_make_empty_symbol): Likewise. + * versados.c (versados_make_empty_symbol): Likewise. + * vms.c (_bfd_vms_make_empty_symbol): Remove. + (vms_make_empty_symbol): Define as _bfd_generic_make_empty_symbol. + * vms-gsd.c (_bfd_vms_slurp_gsd): Call bfd_make_empty_symbol + rather than _bfd_vms_make_empty_symbol. + * vms-misc.c (new_symbol): Likewise. + 2002-01-05 Alan Modra * section.c (bfd_section_init): Remove unnecessary initialisations. diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 95a3d2e35bc..e48a20d7c07 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -3110,6 +3110,9 @@ bfd_print_symbol_vandf PARAMS ((bfd *abfd, PTR file, asymbol *symbol)); #define bfd_make_empty_symbol(abfd) \ BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd)) +asymbol * +_bfd_generic_make_empty_symbol PARAMS ((bfd *)); + #define bfd_make_debug_symbol(abfd,ptr,size) \ BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size)) int diff --git a/bfd/binary.c b/bfd/binary.c index 7b66f309014..705ac8fe260 100644 --- a/bfd/binary.c +++ b/bfd/binary.c @@ -48,7 +48,6 @@ static boolean binary_get_section_contents static long binary_get_symtab_upper_bound PARAMS ((bfd *)); static char *mangle_name PARAMS ((bfd *, char *)); static long binary_get_symtab PARAMS ((bfd *, asymbol **)); -static asymbol *binary_make_empty_symbol PARAMS ((bfd *)); static void binary_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *)); static boolean binary_set_section_contents PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); @@ -219,15 +218,7 @@ binary_get_symtab (abfd, alocation) return BIN_SYMS; } -/* Make an empty symbol. */ - -static asymbol * -binary_make_empty_symbol (abfd) - bfd *abfd; -{ - return (asymbol *) bfd_alloc (abfd, (bfd_size_type) sizeof (asymbol)); -} - +#define binary_make_empty_symbol _bfd_generic_make_empty_symbol #define binary_print_symbol _bfd_nosymbols_print_symbol /* Get information about a symbol. */ diff --git a/bfd/hppabsd-core.c b/bfd/hppabsd-core.c index 3fb76cc439c..4ae6315157b 100644 --- a/bfd/hppabsd-core.c +++ b/bfd/hppabsd-core.c @@ -51,7 +51,6 @@ static asection *make_bfd_asection PARAMS ((bfd *, const char *, flagword, bfd_size_type, file_ptr, unsigned int)); -static asymbol *hppabsd_core_make_empty_symbol PARAMS ((bfd *)); static const bfd_target *hppabsd_core_core_file_p PARAMS ((bfd *)); static char *hppabsd_core_core_file_failing_command PARAMS ((bfd *)); static int hppabsd_core_core_file_failing_signal PARAMS ((bfd *)); @@ -100,18 +99,6 @@ make_bfd_asection (abfd, name, flags, _raw_size, offset, alignment_power) return asect; } -static asymbol * -hppabsd_core_make_empty_symbol (abfd) - bfd *abfd; -{ - asymbol *new; - - new = (asymbol *) bfd_zalloc (abfd, (bfd_size_type) sizeof (asymbol)); - if (new) - new->the_bfd = abfd; - return new; -} - static const bfd_target * hppabsd_core_core_file_p (abfd) bfd *abfd; @@ -239,19 +226,6 @@ hppabsd_core_core_file_matches_executable_p (core_bfd, exec_bfd) return true; } -#define hppabsd_core_get_symtab_upper_bound \ - _bfd_nosymbols_get_symtab_upper_bound -#define hppabsd_core_get_symtab _bfd_nosymbols_get_symtab -#define hppabsd_core_print_symbol _bfd_nosymbols_print_symbol -#define hppabsd_core_get_symbol_info _bfd_nosymbols_get_symbol_info -#define hppabsd_core_bfd_is_local_label_name \ - _bfd_nosymbols_bfd_is_local_label_name -#define hppabsd_core_get_lineno _bfd_nosymbols_get_lineno -#define hppabsd_core_find_nearest_line _bfd_nosymbols_find_nearest_line -#define hppabsd_core_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol -#define hppabsd_core_read_minisymbols _bfd_nosymbols_read_minisymbols -#define hppabsd_core_minisymbol_to_symbol _bfd_nosymbols_minisymbol_to_symbol - /* If somebody calls any byte-swapping routines, shoot them. */ static void swap_abort () @@ -300,15 +274,15 @@ const bfd_target hppabsd_core_vec = bfd_false, bfd_false }, - BFD_JUMP_TABLE_GENERIC (_bfd_generic), - BFD_JUMP_TABLE_COPY (_bfd_generic), - BFD_JUMP_TABLE_CORE (hppabsd_core), - BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), - BFD_JUMP_TABLE_SYMBOLS (hppabsd_core), - BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), - BFD_JUMP_TABLE_WRITE (_bfd_generic), - BFD_JUMP_TABLE_LINK (_bfd_nolink), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + BFD_JUMP_TABLE_GENERIC (_bfd_generic), + BFD_JUMP_TABLE_COPY (_bfd_generic), + BFD_JUMP_TABLE_CORE (hppabsd_core), + BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), + BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols), + BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), + BFD_JUMP_TABLE_WRITE (_bfd_generic), + BFD_JUMP_TABLE_LINK (_bfd_nolink), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), NULL, diff --git a/bfd/hpux-core.c b/bfd/hpux-core.c index a8360228eb6..81d85eaa221 100644 --- a/bfd/hpux-core.c +++ b/bfd/hpux-core.c @@ -103,7 +103,6 @@ struct hpux_core_struct static asection *make_bfd_asection PARAMS ((bfd *, const char *, flagword, bfd_size_type, bfd_vma, unsigned int)); -static asymbol *hpux_core_make_empty_symbol PARAMS ((bfd *)); static const bfd_target *hpux_core_core_file_p PARAMS ((bfd *)); static char *hpux_core_core_file_failing_command PARAMS ((bfd *)); static int hpux_core_core_file_failing_signal PARAMS ((bfd *)); @@ -142,18 +141,6 @@ make_bfd_asection (abfd, name, flags, _raw_size, vma, alignment_power) return asect; } -static asymbol * -hpux_core_make_empty_symbol (abfd) - bfd *abfd; -{ - asymbol *new; - - new = (asymbol *) bfd_zalloc (abfd, (bfd_size_type) sizeof (asymbol)); - if (new) - new->the_bfd = abfd; - return new; -} - /* this function builds a bfd target if the file is a corefile. It returns null or 0 if it finds out thaat it is not a core file. The way it checks this is by looking for allowed 'type' field values. @@ -353,18 +340,6 @@ hpux_core_core_file_matches_executable_p (core_bfd, exec_bfd) return true; /* FIXME, We have no way of telling at this point */ } -#define hpux_core_get_symtab_upper_bound _bfd_nosymbols_get_symtab_upper_bound -#define hpux_core_get_symtab _bfd_nosymbols_get_symtab -#define hpux_core_print_symbol _bfd_nosymbols_print_symbol -#define hpux_core_get_symbol_info _bfd_nosymbols_get_symbol_info -#define hpux_core_bfd_is_local_label_name \ - _bfd_nosymbols_bfd_is_local_label_name -#define hpux_core_get_lineno _bfd_nosymbols_get_lineno -#define hpux_core_find_nearest_line _bfd_nosymbols_find_nearest_line -#define hpux_core_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol -#define hpux_core_read_minisymbols _bfd_nosymbols_read_minisymbols -#define hpux_core_minisymbol_to_symbol _bfd_nosymbols_minisymbol_to_symbol - /* If somebody calls any byte-swapping routines, shoot them. */ static void swap_abort () @@ -411,15 +386,15 @@ const bfd_target hpux_core_vec = bfd_false, bfd_false }, - BFD_JUMP_TABLE_GENERIC (_bfd_generic), - BFD_JUMP_TABLE_COPY (_bfd_generic), - BFD_JUMP_TABLE_CORE (hpux_core), - BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), - BFD_JUMP_TABLE_SYMBOLS (hpux_core), - BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), - BFD_JUMP_TABLE_WRITE (_bfd_generic), - BFD_JUMP_TABLE_LINK (_bfd_nolink), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + BFD_JUMP_TABLE_GENERIC (_bfd_generic), + BFD_JUMP_TABLE_COPY (_bfd_generic), + BFD_JUMP_TABLE_CORE (hpux_core), + BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), + BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols), + BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), + BFD_JUMP_TABLE_WRITE (_bfd_generic), + BFD_JUMP_TABLE_LINK (_bfd_nolink), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), NULL, diff --git a/bfd/ihex.c b/bfd/ihex.c index 9aacdfce4d5..8bb51349f07 100644 --- a/bfd/ihex.c +++ b/bfd/ihex.c @@ -1,5 +1,5 @@ /* BFD back-end for Intel Hex objects. - Copyright 1995, 1996, 1998, 1999, 2000, 2001 + Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Written by Ian Lance Taylor of Cygnus Support . @@ -139,7 +139,6 @@ static boolean ihex_set_section_contents static boolean ihex_write_record PARAMS ((bfd *, size_t, unsigned int, unsigned int, bfd_byte *)); static boolean ihex_write_object_contents PARAMS ((bfd *)); -static asymbol *ihex_make_empty_symbol PARAMS ((bfd *)); static boolean ihex_set_arch_mach PARAMS ((bfd *, enum bfd_architecture, unsigned long)); static int ihex_sizeof_headers PARAMS ((bfd *, boolean)); @@ -916,21 +915,6 @@ ihex_write_object_contents (abfd) return true; } -/* Make an empty symbol. This is required only because - bfd_make_section_anyway wants to create a symbol for the section. */ - -static asymbol * -ihex_make_empty_symbol (abfd) - bfd *abfd; -{ - asymbol *new; - - new = (asymbol *) bfd_zalloc (abfd, (bfd_size_type) sizeof (asymbol)); - if (new != NULL) - new->the_bfd = abfd; - return new; -} - /* Set the architecture for the output file. The architecture is irrelevant, so we ignore errors about unknown architectures. */ @@ -970,6 +954,7 @@ ihex_sizeof_headers (abfd, exec) #define ihex_get_symtab_upper_bound bfd_0l #define ihex_get_symtab \ ((long (*) PARAMS ((bfd *, asymbol **))) bfd_0l) +#define ihex_make_empty_symbol _bfd_generic_make_empty_symbol #define ihex_print_symbol _bfd_nosymbols_print_symbol #define ihex_get_symbol_info _bfd_nosymbols_get_symbol_info #define ihex_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name diff --git a/bfd/irix-core.c b/bfd/irix-core.c index c1a99acd525..0e48a9aa681 100644 --- a/bfd/irix-core.c +++ b/bfd/irix-core.c @@ -48,7 +48,6 @@ static char *irix_core_core_file_failing_command PARAMS ((bfd *)); static int irix_core_core_file_failing_signal PARAMS ((bfd *)); static boolean irix_core_core_file_matches_executable_p PARAMS ((bfd *, bfd *)); -static asymbol *irix_core_make_empty_symbol PARAMS ((bfd *)); static void swap_abort PARAMS ((void)); static asection * @@ -203,29 +202,6 @@ irix_core_core_file_matches_executable_p (core_bfd, exec_bfd) return true; /* XXX - FIXME */ } -static asymbol * -irix_core_make_empty_symbol (abfd) - bfd *abfd; -{ - bfd_size_type amt = sizeof (asymbol); - asymbol *new = (asymbol *) bfd_zalloc (abfd, amt); - if (new) - new->the_bfd = abfd; - return new; -} - -#define irix_core_get_symtab_upper_bound _bfd_nosymbols_get_symtab_upper_bound -#define irix_core_get_symtab _bfd_nosymbols_get_symtab -#define irix_core_print_symbol _bfd_nosymbols_print_symbol -#define irix_core_get_symbol_info _bfd_nosymbols_get_symbol_info -#define irix_core_bfd_is_local_label_name \ - _bfd_nosymbols_bfd_is_local_label_name -#define irix_core_get_lineno _bfd_nosymbols_get_lineno -#define irix_core_find_nearest_line _bfd_nosymbols_find_nearest_line -#define irix_core_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol -#define irix_core_read_minisymbols _bfd_nosymbols_read_minisymbols -#define irix_core_minisymbol_to_symbol _bfd_nosymbols_minisymbol_to_symbol - /* If somebody calls any byte-swapping routines, shoot them. */ static void swap_abort() @@ -272,15 +248,15 @@ const bfd_target irix_core_vec = bfd_false, bfd_false }, - BFD_JUMP_TABLE_GENERIC (_bfd_generic), - BFD_JUMP_TABLE_COPY (_bfd_generic), - BFD_JUMP_TABLE_CORE (irix_core), - BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), - BFD_JUMP_TABLE_SYMBOLS (irix_core), - BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), - BFD_JUMP_TABLE_WRITE (_bfd_generic), - BFD_JUMP_TABLE_LINK (_bfd_nolink), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + BFD_JUMP_TABLE_GENERIC (_bfd_generic), + BFD_JUMP_TABLE_COPY (_bfd_generic), + BFD_JUMP_TABLE_CORE (irix_core), + BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), + BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols), + BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), + BFD_JUMP_TABLE_WRITE (_bfd_generic), + BFD_JUMP_TABLE_LINK (_bfd_nolink), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), NULL, diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h index f4ee631a33f..cc5be3fe34c 100644 --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h @@ -251,8 +251,7 @@ extern boolean _bfd_archive_coff_construct_extended_name_table #define _bfd_nosymbols_get_symtab_upper_bound _bfd_n1 #define _bfd_nosymbols_get_symtab \ ((long (*) PARAMS ((bfd *, asymbol **))) _bfd_n1) -#define _bfd_nosymbols_make_empty_symbol \ - ((asymbol *(*) PARAMS ((bfd *))) bfd_nullvoidptr) +#define _bfd_nosymbols_make_empty_symbol _bfd_generic_make_empty_symbol #define _bfd_nosymbols_print_symbol \ ((void (*) PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type))) bfd_void) #define _bfd_nosymbols_get_symbol_info \ diff --git a/bfd/libbfd.h b/bfd/libbfd.h index 911ff0830e8..b9ad62354f3 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -256,8 +256,7 @@ extern boolean _bfd_archive_coff_construct_extended_name_table #define _bfd_nosymbols_get_symtab_upper_bound _bfd_n1 #define _bfd_nosymbols_get_symtab \ ((long (*) PARAMS ((bfd *, asymbol **))) _bfd_n1) -#define _bfd_nosymbols_make_empty_symbol \ - ((asymbol *(*) PARAMS ((bfd *))) bfd_nullvoidptr) +#define _bfd_nosymbols_make_empty_symbol _bfd_generic_make_empty_symbol #define _bfd_nosymbols_print_symbol \ ((void (*) PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type))) bfd_void) #define _bfd_nosymbols_get_symbol_info \ diff --git a/bfd/mmo.c b/bfd/mmo.c index e9034de3db7..019160c3386 100644 --- a/bfd/mmo.c +++ b/bfd/mmo.c @@ -1,5 +1,5 @@ /* BFD back-end for mmo objects (MMIX-specific object-format). - Copyright 2001 + Copyright 2001, 2002 Free Software Foundation, Inc. Written by Hans-Peter Nilsson (hp@bitrange.com). Infrastructure and other bits originally copied from srec.c and @@ -381,7 +381,6 @@ static boolean mmo_get_section_contents PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); static long mmo_get_symtab_upper_bound PARAMS ((bfd *)); static long mmo_get_symtab PARAMS ((bfd *, asymbol **)); -static asymbol *mmo_make_empty_symbol PARAMS ((bfd *)); static void mmo_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *)); static void mmo_print_symbol PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type)); @@ -2188,19 +2187,6 @@ mmo_get_symtab (abfd, alocation) return symcount; } -/* Make an empty symbol. */ - -static asymbol * -mmo_make_empty_symbol (abfd) - bfd *abfd; -{ - asymbol *new = (asymbol *) bfd_zalloc (abfd, sizeof (asymbol)); - - if (new) - new->the_bfd = abfd; - return new; -} - /* Get information about a symbol. */ static void @@ -3171,6 +3157,7 @@ mmo_canonicalize_reloc (abfd, section, relptr, symbols) /* FIXME: We can do better on this one, if we have a dwarf2 .debug_line section or if MMO line numbers are implemented. */ #define mmo_find_nearest_line _bfd_nosymbols_find_nearest_line +#define mmo_make_empty_symbol _bfd_generic_make_empty_symbol #define mmo_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol #define mmo_read_minisymbols _bfd_generic_read_minisymbols #define mmo_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol diff --git a/bfd/osf-core.c b/bfd/osf-core.c index a514a2b2dad..edf54706e59 100644 --- a/bfd/osf-core.c +++ b/bfd/osf-core.c @@ -30,21 +30,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* forward declarations */ -static asection * -make_bfd_asection PARAMS ((bfd *, const char *, flagword, bfd_size_type, - bfd_vma, file_ptr)); -static asymbol * -osf_core_make_empty_symbol PARAMS ((bfd *)); -static const bfd_target * -osf_core_core_file_p PARAMS ((bfd *)); -static char * -osf_core_core_file_failing_command PARAMS ((bfd *)); -static int -osf_core_core_file_failing_signal PARAMS ((bfd *)); -static boolean -osf_core_core_file_matches_executable_p PARAMS ((bfd *, bfd *)); -static void -swap_abort PARAMS ((void)); +static asection *make_bfd_asection + PARAMS ((bfd *, const char *, flagword, bfd_size_type, bfd_vma, file_ptr)); +static const bfd_target *osf_core_core_file_p PARAMS ((bfd *)); +static char *osf_core_core_file_failing_command PARAMS ((bfd *)); +static int osf_core_core_file_failing_signal PARAMS ((bfd *)); +static boolean osf_core_core_file_matches_executable_p PARAMS ((bfd *, bfd *)); +static void swap_abort PARAMS ((void)); /* These are stored in the bfd's tdata */ @@ -82,18 +74,6 @@ make_bfd_asection (abfd, name, flags, _raw_size, vma, filepos) return asect; } -static asymbol * -osf_core_make_empty_symbol (abfd) - bfd *abfd; -{ - asymbol *new; - - new = (asymbol *) bfd_zalloc (abfd, (bfd_size_type) sizeof (asymbol)); - if (new) - new->the_bfd = abfd; - return new; -} - static const bfd_target * osf_core_core_file_p (abfd) bfd *abfd; @@ -196,17 +176,6 @@ osf_core_core_file_matches_executable_p (core_bfd, exec_bfd) return true; /* FIXME, We have no way of telling at this point */ } -#define osf_core_get_symtab_upper_bound _bfd_nosymbols_get_symtab_upper_bound -#define osf_core_get_symtab _bfd_nosymbols_get_symtab -#define osf_core_print_symbol _bfd_nosymbols_print_symbol -#define osf_core_get_symbol_info _bfd_nosymbols_get_symbol_info -#define osf_core_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name -#define osf_core_get_lineno _bfd_nosymbols_get_lineno -#define osf_core_find_nearest_line _bfd_nosymbols_find_nearest_line -#define osf_core_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol -#define osf_core_read_minisymbols _bfd_nosymbols_read_minisymbols -#define osf_core_minisymbol_to_symbol _bfd_nosymbols_minisymbol_to_symbol - /* If somebody calls any byte-swapping routines, shoot them. */ static void swap_abort() @@ -253,15 +222,15 @@ const bfd_target osf_core_vec = bfd_false, bfd_false }, - BFD_JUMP_TABLE_GENERIC (_bfd_generic), - BFD_JUMP_TABLE_COPY (_bfd_generic), - BFD_JUMP_TABLE_CORE (osf_core), - BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), - BFD_JUMP_TABLE_SYMBOLS (osf_core), - BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), - BFD_JUMP_TABLE_WRITE (_bfd_generic), - BFD_JUMP_TABLE_LINK (_bfd_nolink), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + BFD_JUMP_TABLE_GENERIC (_bfd_generic), + BFD_JUMP_TABLE_COPY (_bfd_generic), + BFD_JUMP_TABLE_CORE (osf_core), + BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), + BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols), + BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), + BFD_JUMP_TABLE_WRITE (_bfd_generic), + BFD_JUMP_TABLE_LINK (_bfd_nolink), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), NULL, diff --git a/bfd/ppcboot.c b/bfd/ppcboot.c index cd196b89202..9ac3f31bfb0 100644 --- a/bfd/ppcboot.c +++ b/bfd/ppcboot.c @@ -1,5 +1,5 @@ /* BFD back-end for PPCbug boot records. - Copyright 1996, 1997, 1998, 1999, 2000, 2001 + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Written by Michael Meissner, Cygnus Support, @@ -96,7 +96,6 @@ static boolean ppcboot_get_section_contents static long ppcboot_get_symtab_upper_bound PARAMS ((bfd *)); static char *mangle_name PARAMS ((bfd *, char *)); static long ppcboot_get_symtab PARAMS ((bfd *, asymbol **)); -static asymbol *ppcboot_make_empty_symbol PARAMS ((bfd *)); static void ppcboot_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *)); static boolean ppcboot_set_section_contents PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); @@ -332,17 +331,7 @@ ppcboot_get_symtab (abfd, alocation) return PPCBOOT_SYMS; } - -/* Make an empty symbol. */ - -static asymbol * -ppcboot_make_empty_symbol (abfd) - bfd *abfd; -{ - return (asymbol *) bfd_alloc (abfd, (bfd_size_type) sizeof (asymbol)); -} - - +#define ppcboot_make_empty_symbol _bfd_generic_make_empty_symbol #define ppcboot_print_symbol _bfd_nosymbols_print_symbol /* Get information about a symbol. */ diff --git a/bfd/sco5-core.c b/bfd/sco5-core.c index b78ee59b2d9..9f5b7934ac2 100644 --- a/bfd/sco5-core.c +++ b/bfd/sco5-core.c @@ -43,7 +43,6 @@ struct sco5_core_struct static asection * make_bfd_asection PARAMS ((bfd *, const char *, flagword, bfd_size_type, bfd_vma, file_ptr)); -static asymbol *sco5_core_make_empty_symbol PARAMS ((bfd *)); static struct user *read_uarea PARAMS ((bfd *, int)); const bfd_target *sco5_core_file_p PARAMS ((bfd *abfd)); char *sco5_core_file_failing_command PARAMS ((bfd *abfd)); @@ -75,18 +74,6 @@ make_bfd_asection (abfd, name, flags, _raw_size, vma, filepos) return asect; } -static asymbol * -sco5_core_make_empty_symbol (abfd) - bfd *abfd; -{ - asymbol *new; - - new = (asymbol *) bfd_zalloc (abfd, (bfd_size_type) sizeof (asymbol)); - if (new) - new->the_bfd = abfd; - return new; -} - static struct user * read_uarea(abfd, filepos) bfd *abfd; @@ -371,17 +358,6 @@ sco5_core_file_matches_executable_p (core_bfd, exec_bfd) return true; /* FIXME, We have no way of telling at this point */ } -#define sco5_core_get_symtab_upper_bound _bfd_nosymbols_get_symtab_upper_bound -#define sco5_core_get_symtab _bfd_nosymbols_get_symtab -#define sco5_core_print_symbol _bfd_nosymbols_print_symbol -#define sco5_core_get_symbol_info _bfd_nosymbols_get_symbol_info -#define sco5_core_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name -#define sco5_core_get_lineno _bfd_nosymbols_get_lineno -#define sco5_core_find_nearest_line _bfd_nosymbols_find_nearest_line -#define sco5_core_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol -#define sco5_core_read_minisymbols _bfd_nosymbols_read_minisymbols -#define sco5_core_minisymbol_to_symbol _bfd_nosymbols_minisymbol_to_symbol - /* If somebody calls any byte-swapping routines, shoot them. */ static void swap_abort () @@ -428,15 +404,15 @@ const bfd_target sco5_core_vec = bfd_false, bfd_false }, - BFD_JUMP_TABLE_GENERIC (_bfd_generic), - BFD_JUMP_TABLE_COPY (_bfd_generic), - BFD_JUMP_TABLE_CORE (sco5), - BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), - BFD_JUMP_TABLE_SYMBOLS (sco5_core), - BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), - BFD_JUMP_TABLE_WRITE (_bfd_generic), - BFD_JUMP_TABLE_LINK (_bfd_nolink), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + BFD_JUMP_TABLE_GENERIC (_bfd_generic), + BFD_JUMP_TABLE_COPY (_bfd_generic), + BFD_JUMP_TABLE_CORE (sco5), + BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), + BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols), + BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), + BFD_JUMP_TABLE_WRITE (_bfd_generic), + BFD_JUMP_TABLE_LINK (_bfd_nolink), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), NULL, diff --git a/bfd/srec.c b/bfd/srec.c index 5cb83caedd4..5dfad8890d1 100644 --- a/bfd/srec.c +++ b/bfd/srec.c @@ -1,6 +1,6 @@ /* BFD back-end for s-record objects. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001 + 2000, 2001, 2002 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support . @@ -138,7 +138,6 @@ static boolean internal_srec_write_object_contents PARAMS ((bfd *, int)); static boolean srec_write_object_contents PARAMS ((bfd *)); static boolean symbolsrec_write_object_contents PARAMS ((bfd *)); static int srec_sizeof_headers PARAMS ((bfd *, boolean)); -static asymbol *srec_make_empty_symbol PARAMS ((bfd *)); static long srec_get_symtab_upper_bound PARAMS ((bfd *)); static long srec_get_symtab PARAMS ((bfd *, asymbol **)); @@ -1150,18 +1149,6 @@ srec_sizeof_headers (abfd, exec) return 0; } -static asymbol * -srec_make_empty_symbol (abfd) - bfd *abfd; -{ - asymbol *new; - - new = (asymbol *) bfd_zalloc (abfd, (bfd_size_type) sizeof (asymbol)); - if (new) - new->the_bfd = abfd; - return new; -} - /* Return the amount of memory needed to read the symbol table. */ static long @@ -1251,6 +1238,7 @@ srec_print_symbol (abfd, afile, symbol, how) #define srec_bfd_is_local_label_name bfd_generic_is_local_label_name #define srec_get_lineno _bfd_nosymbols_get_lineno #define srec_find_nearest_line _bfd_nosymbols_find_nearest_line +#define srec_make_empty_symbol _bfd_generic_make_empty_symbol #define srec_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol #define srec_read_minisymbols _bfd_generic_read_minisymbols #define srec_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol diff --git a/bfd/syms.c b/bfd/syms.c index 03c41a52862..9ec9dd8e769 100644 --- a/bfd/syms.c +++ b/bfd/syms.c @@ -494,6 +494,31 @@ DESCRIPTION . BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd)) */ +/* +FUNCTION + _bfd_generic_make_empty_symbol + +SYNOPSIS + asymbol *_bfd_generic_make_empty_symbol (bfd *); + +DESCRIPTION + Create a new <> structure for the BFD @var{abfd} + and return a pointer to it. Used by core file routines, + binary back-end and anywhere else where no private info + is needed. +*/ + +asymbol * +_bfd_generic_make_empty_symbol (abfd) + bfd *abfd; +{ + bfd_size_type amt = sizeof (asymbol); + asymbol *new = (asymbol *) bfd_zalloc (abfd, amt); + if (new) + new->the_bfd = abfd; + return new; +} + /* FUNCTION bfd_make_debug_symbol diff --git a/bfd/versados.c b/bfd/versados.c index 276a1019b76..37eb94ceb58 100644 --- a/bfd/versados.c +++ b/bfd/versados.c @@ -1,5 +1,6 @@ /* BFD back-end for VERSAdos-E objects. - Copyright 1995, 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002 + Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support . Versados is a Motorola trademark. @@ -55,7 +56,6 @@ static boolean versados_get_section_contents static boolean versados_set_section_contents PARAMS ((bfd *, sec_ptr, void *, file_ptr, bfd_size_type)); static int versados_sizeof_headers PARAMS ((bfd *, boolean)); -static asymbol *versados_make_empty_symbol PARAMS ((bfd *)); static long int versados_get_symtab_upper_bound PARAMS ((bfd *)); static long int versados_get_symtab PARAMS ((bfd *, asymbol **)); static void versados_get_symbol_info @@ -723,18 +723,6 @@ versados_sizeof_headers (abfd, exec) return 0; } -static asymbol * -versados_make_empty_symbol (abfd) - bfd *abfd; -{ - asymbol *new; - - new = (asymbol *) bfd_zalloc (abfd, (bfd_size_type) sizeof (asymbol)); - if (new) - new->the_bfd = abfd; - return new; -} - /* Return the amount of memory needed to read the symbol table. */ static long @@ -865,6 +853,7 @@ versados_canonicalize_reloc (abfd, section, relptr, symbols) #define versados_bfd_is_local_label_name bfd_generic_is_local_label_name #define versados_get_lineno _bfd_nosymbols_get_lineno #define versados_find_nearest_line _bfd_nosymbols_find_nearest_line +#define versados_make_empty_symbol _bfd_generic_make_empty_symbol #define versados_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol #define versados_read_minisymbols _bfd_generic_read_minisymbols #define versados_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol diff --git a/bfd/vms-gsd.c b/bfd/vms-gsd.c index 538c148cb20..d9dcd785789 100644 --- a/bfd/vms-gsd.c +++ b/bfd/vms-gsd.c @@ -1,6 +1,7 @@ /* vms-gsd.c -- BFD back-end for VAX (openVMS/VAX) and EVAX (openVMS/Alpha) files. - Copyright 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 + Free Software Foundation, Inc. go and read the openVMS linker manual (esp. appendix B) if you don't know what's going on here :-) @@ -635,7 +636,7 @@ _bfd_vms_slurp_gsd (abfd, objtype) { /* symbol specification (definition or reference) */ - symbol = _bfd_vms_make_empty_symbol (abfd); + symbol = bfd_make_empty_symbol (abfd); if (symbol == 0) return -1; diff --git a/bfd/vms-misc.c b/bfd/vms-misc.c index 0c8236fb1ac..b871a5d3ae0 100644 --- a/bfd/vms-misc.c +++ b/bfd/vms-misc.c @@ -1,6 +1,6 @@ /* vms-misc.c -- Miscellaneous functions for VAX (openVMS/VAX) and EVAX (openVMS/Alpha) files. - Copyright 1996, 1997, 1998, 1999, 2000, 2001 + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Written by Klaus K"ampf (kkaempf@rmi.de) @@ -1070,7 +1070,7 @@ new_symbol (abfd, name) _bfd_vms_debug (7, "new_symbol %s\n", name); #endif - symbol = _bfd_vms_make_empty_symbol (abfd); + symbol = bfd_make_empty_symbol (abfd); if (symbol == 0) return symbol; symbol->name = name; diff --git a/bfd/vms.c b/bfd/vms.c index 55bcf6193cb..388b7270a3e 100644 --- a/bfd/vms.c +++ b/bfd/vms.c @@ -1,6 +1,6 @@ /* vms.c -- BFD back-end for VAX (openVMS/VAX) and EVAX (openVMS/Alpha) files. - Copyright 1996, 1997, 1998, 1999, 2000, 2001 + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Written by Klaus K"ampf (kkaempf@rmi.de) @@ -129,7 +129,7 @@ static long vms_canonicalize_dynamic_reloc static boolean vms_bfd_merge_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd)); static boolean vms_bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags)); -#define vms_make_empty_symbol _bfd_vms_make_empty_symbol +#define vms_make_empty_symbol _bfd_generic_make_empty_symbol /*===========================================================================*/ @@ -1142,34 +1142,6 @@ vms_get_symtab (abfd, symbols) return PRIV (gsd_sym_count); } -/* Create a new asymbol structure for the BFD abfd and return a pointer - to it. - This routine is necessary because each back end has private information - surrounding the asymbol. Building your own asymbol and pointing to it - will not create the private information, and will cause problems later on. */ - -asymbol * -_bfd_vms_make_empty_symbol (abfd) - bfd *abfd; -{ - asymbol *symbol; - - symbol = (asymbol *) bfd_zalloc(abfd, (bfd_size_type) sizeof (asymbol)); - -#if VMS_DEBUG - vms_debug (1, "_bfd_vms_make_empty_symbol(%p)\n", abfd); -#endif - - if (symbol == 0) - { - bfd_set_error (bfd_error_no_memory); - return 0; - } - symbol->the_bfd = abfd; - - return symbol; -} - /* Print symbol to file according to how. how is one of bfd_print_symbol_name just print the name bfd_print_symbol_more print more (???)