From 07de8e96b371ed08061203a7014bb08a4e92f375 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Thu, 3 Dec 1992 23:03:17 +0000 Subject: [PATCH] syms.c (asymbol): Added new field "app_data", for data particular to the application. Some of the linker flags ought to get moved to this field someday. archures.c (bfd_default_scan): Recognize a few more numbers: 80486, 80960, and 960. bfd-in.h, bfd.c, targets.c, coffcode.h, coff-mips.c, other targets: Moved COFF swap table to backend data. hosts/i386linux.h: Include unistd.h. aoutx.h, libaout.h, stab-syms.c: stab names are now in constant storage. trad-core.c: Fixed some `PARAMS' uses that were missing parentheses. aoutx.h, archive.c, archures.c, coffcode.h, ctor.c, reloc.c, syms.c: Doc fixes. --- bfd/ChangeLog | 38 ++++++++++++++++ bfd/coff-a29k.c | 2 +- bfd/coffcode.h | 114 +++++++++++++++++++++++++++++++++++++++++++++++- bfd/ctor.c | 2 +- bfd/libcoff.h | 109 ++++++++++++++++++++++++++++++++++++++++++--- 5 files changed, 255 insertions(+), 10 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 41763d4476b..9bc27d927ae 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,41 @@ +Thu Dec 3 16:54:58 1992 Ken Raeburn (raeburn@cambridge.cygnus.com) + + * hosts/i386linux.h: Include unistd.h. + + * aoutx.h (print_symbol): aout_stab_name returns a constant + string. + * libaout.h (aout_stab_name): Fix prototype. + * stab-syms.c (aout_stab_names): Array is now const. + (aout_stab_name): Return value is now pointer to const. + + * aoutx.h, archive.c, archures.c, coffcode.h, ctor.c, reloc.c, + syms.c: Doc fixes. + + * syms.c (asymbol): Added new field "app_data", for data + particular to the application. Some of the linker flags ought to + get moved to this field someday. + + * archures.c (bfd_default_scan): Recognize a few more numbers: + 80486, 80960, and 960. + + * bfd-in.h (COFF_SWAP_TABLE): New is just address of + bfd_coff_std_swap_table, cast to PTR. + * bfd.c (bfd_coff_swap_*): Deleted macros. + * targets.c (struct bfd_target): Deleted COFF-specific swapping + routine pointers. + * coffcode.h (type bfd_coff_backend_data): New structure type, + contains pointers to the COFF-specific swapping routines. + (bfd_coff_std_swap_table): New data structure, to be used when + NO_COFF_SYMBOLS and NO_COFF_LINENOS are not defined. + (bfd_coff_swap_*): New macros. + * coff-mips.c (mips_coff_swap_table): New data structure. + (ecoff_big_vec): Use it. + * All COFF targets: Moved COFF_SWAP_TABLE to target-specific data. + * All other targets: Deleted coff-specific vector entries. + + * trad-core.c: Fixed some `PARAMS' uses that were missing + parentheses. + Sun Nov 29 08:37:13 1992 Fred Fish (fnf@cygnus.com) * aoutx.h (some_aout_object_p): Protect arg prototype in diff --git a/bfd/coff-a29k.c b/bfd/coff-a29k.c index e77412089d9..f10a69750be 100644 --- a/bfd/coff-a29k.c +++ b/bfd/coff-a29k.c @@ -334,6 +334,6 @@ bfd_target a29kcoff_big_vec = }, JUMP_TABLE(coff), + 0, 0, COFF_SWAP_TABLE }; - diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 3e11a86aafd..4374d2d08d9 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -85,7 +85,7 @@ SUBSUBSECTION Each flavour of coff supported in BFD has its own header file descibing the external layout of the structures. There is also an internal description of the coff layout (in - @code{internalcoff.h}) file (@code{}). A major function of the + @code{internalcoff.h}). A major function of the coff backend is swapping the bytes and twiddling the bits to translate the external form of the structures into the normal internal form. This is all performed in the @@ -452,6 +452,109 @@ Here are all the routines for swapping the structures seen in the outside world into the internal forms. */ +/* +INTERNAL_DEFINITION + bfd_coff_backend_data + +CODE_FRAGMENT + +.typedef struct { +Special entry points for gdb to swap in coff symbol table parts + +. void (*_bfd_coff_swap_aux_in) PARAMS (( +. bfd *abfd , +. PTR ext, +. int type, +. int class , +. PTR in)); +. +. void (*_bfd_coff_swap_sym_in) PARAMS (( +. bfd *abfd , +. PTR ext, +. PTR in)); +. +. void (*_bfd_coff_swap_lineno_in) PARAMS (( +. bfd *abfd, +. PTR ext, +. PTR in)); +. + +Special entry points for gas to swap coff parts + +. unsigned int (*_bfd_coff_swap_aux_out) PARAMS (( +. bfd *abfd, +. PTR in, +. int type, +. int class, +. PTR ext)); +. +. unsigned int (*_bfd_coff_swap_sym_out) PARAMS (( +. bfd *abfd, +. PTR in, +. PTR ext)); +. +. unsigned int (*_bfd_coff_swap_lineno_out) PARAMS (( +. bfd *abfd, +. PTR in, +. PTR ext)); +. +. unsigned int (*_bfd_coff_swap_reloc_out) PARAMS (( +. bfd *abfd, +. PTR src, +. PTR dst)); +. +. unsigned int (*_bfd_coff_swap_filehdr_out) PARAMS (( +. bfd *abfd, +. PTR in, +. PTR out)); +. +. unsigned int (*_bfd_coff_swap_aouthdr_out) PARAMS (( +. bfd *abfd, +. PTR in, +. PTR out)); +. +. unsigned int (*_bfd_coff_swap_scnhdr_out) PARAMS (( +. bfd *abfd, +. PTR in, +. PTR out)); +. +.} bfd_coff_backend_data; +. +.extern bfd_coff_backend_data bfd_coff_std_swap_table; +. +.#define coff_backend_info(abfd) ((bfd_coff_backend_data *) (abfd)->xvec->backend_data) +. +.#define bfd_coff_swap_aux_in(a,e,t,c,i) \ +. ((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,i)) +. +.#define bfd_coff_swap_sym_in(a,e,i) \ +. ((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i)) +. +.#define bfd_coff_swap_lineno_in(a,e,i) \ +. ((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i)) +. +.#define bfd_coff_swap_reloc_out(abfd, i, o) \ +. ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o)) +. +.#define bfd_coff_swap_lineno_out(abfd, i, o) \ +. ((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o)) +. +.#define bfd_coff_swap_aux_out(abfd, i, t,c,o) \ +. ((coff_backend_info (abfd)->_bfd_coff_swap_aux_out) (abfd, i,t,c, o)) +. +.#define bfd_coff_swap_sym_out(abfd, i,o) \ +. ((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o)) +. +.#define bfd_coff_swap_scnhdr_out(abfd, i,o) \ +. ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o)) +. +.#define bfd_coff_swap_filehdr_out(abfd, i,o) \ +. ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o)) +. +.#define bfd_coff_swap_aouthdr_out(abfd, i,o) \ +. ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o)) +. +*/ static void DEFUN(bfd_swap_reloc_in,(abfd, reloc_src, reloc_dst), @@ -4222,6 +4325,15 @@ DEFUN(bfd_coff_get_relocated_section_contents,(in_abfd, seclet, data), } +#if !defined (NO_COFF_SYMBOLS) && !defined (NO_COFF_LINENOS) +bfd_coff_backend_data bfd_coff_std_swap_table = { + coff_swap_aux_in, coff_swap_sym_in, coff_swap_lineno_in, + coff_swap_aux_out, coff_swap_sym_out, + coff_swap_lineno_out, coff_swap_reloc_out, + coff_swap_filehdr_out, coff_swap_aouthdr_out, + coff_swap_scnhdr_out, +}; +#endif #define coff_core_file_failing_command _bfd_dummy_core_file_failing_command #define coff_core_file_failing_signal _bfd_dummy_core_file_failing_signal diff --git a/bfd/ctor.c b/bfd/ctor.c index b3e1890be9f..3d939ef16b5 100644 --- a/bfd/ctor.c +++ b/bfd/ctor.c @@ -103,7 +103,7 @@ SYNOPSIS DESCRIPTION This function is called with an a symbol describing the function to be called, an string which descibes the xtor type, - eg something like "CTOR" or "DTOR" would be fine. And the bfd + e.g., something like "CTOR" or "DTOR" would be fine. And the bfd which owns the function. Its duty is to create a section called "CTOR" or "DTOR" or whatever if the bfd doesn't already have one, and grow a relocation table for the entry points as diff --git a/bfd/libcoff.h b/bfd/libcoff.h index 0eba7a6e47d..094c30b799f 100644 --- a/bfd/libcoff.h +++ b/bfd/libcoff.h @@ -29,6 +29,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #define obj_relocbase(bfd) (coff_data(bfd)->relocbase) #define obj_raw_syments(bfd) (coff_data(bfd)->raw_syments) #define obj_convert(bfd) (coff_data(bfd)->conversion_table) +#define obj_conv_table_size(bfd) (coff_data(bfd)->conv_table_size) #if CFILE_STUFF #define obj_symbol_slew(bfd) (coff_data(bfd)->symbol_index_slew) #else @@ -42,6 +43,7 @@ typedef struct coff_tdata { struct coff_symbol_struct *symbols; /* symtab for input bfd */ unsigned int *conversion_table; + int conv_table_size; file_ptr sym_filepos; long symbol_index_slew; /* used during read to mark whether a @@ -104,13 +106,106 @@ union { typedef struct coff_symbol_struct { - /* The actual symbol which the rest of BFD works with */ - asymbol symbol; + /* The actual symbol which the rest of BFD works with */ +asymbol symbol; - /* A pointer to the hidden information for this symbol */ - combined_entry_type *native; + /* A pointer to the hidden information for this symbol */ +combined_entry_type *native; - /* A pointer to the linenumber information for this symbol */ - struct lineno_cache_entry *lineno; - boolean done_lineno; + /* A pointer to the linenumber information for this symbol */ +struct lineno_cache_entry *lineno; + + /* Have the line numbers been relocated yet ? */ +boolean done_lineno; } coff_symbol_type; +typedef struct { + void (*_bfd_coff_swap_aux_in) PARAMS (( + bfd *abfd , + PTR ext, + int type, + int class , + PTR in)); + + void (*_bfd_coff_swap_sym_in) PARAMS (( + bfd *abfd , + PTR ext, + PTR in)); + + void (*_bfd_coff_swap_lineno_in) PARAMS (( + bfd *abfd, + PTR ext, + PTR in)); + + unsigned int (*_bfd_coff_swap_aux_out) PARAMS (( + bfd *abfd, + PTR in, + int type, + int class, + PTR ext)); + + unsigned int (*_bfd_coff_swap_sym_out) PARAMS (( + bfd *abfd, + PTR in, + PTR ext)); + + unsigned int (*_bfd_coff_swap_lineno_out) PARAMS (( + bfd *abfd, + PTR in, + PTR ext)); + + unsigned int (*_bfd_coff_swap_reloc_out) PARAMS (( + bfd *abfd, + PTR src, + PTR dst)); + + unsigned int (*_bfd_coff_swap_filehdr_out) PARAMS (( + bfd *abfd, + PTR in, + PTR out)); + + unsigned int (*_bfd_coff_swap_aouthdr_out) PARAMS (( + bfd *abfd, + PTR in, + PTR out)); + + unsigned int (*_bfd_coff_swap_scnhdr_out) PARAMS (( + bfd *abfd, + PTR in, + PTR out)); + +} bfd_coff_backend_data; + +extern bfd_coff_backend_data bfd_coff_std_swap_table; + +#define coff_backend_info(abfd) ((bfd_coff_backend_data *) (abfd)->xvec->backend_data) + +#define bfd_coff_swap_aux_in(a,e,t,c,i) \ + ((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,i)) + +#define bfd_coff_swap_sym_in(a,e,i) \ + ((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i)) + +#define bfd_coff_swap_lineno_in(a,e,i) \ + ((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i)) + +#define bfd_coff_swap_reloc_out(abfd, i, o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o)) + +#define bfd_coff_swap_lineno_out(abfd, i, o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o)) + +#define bfd_coff_swap_aux_out(abfd, i, t,c,o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_aux_out) (abfd, i,t,c, o)) + +#define bfd_coff_swap_sym_out(abfd, i,o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o)) + +#define bfd_coff_swap_scnhdr_out(abfd, i,o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o)) + +#define bfd_coff_swap_filehdr_out(abfd, i,o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o)) + +#define bfd_coff_swap_aouthdr_out(abfd, i,o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o)) + -- 2.30.2