diff options
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 25 | ||||
-rw-r--r-- | bfd/aout-target.h | 4 | ||||
-rw-r--r-- | bfd/aout-tic30.c | 4 | ||||
-rw-r--r-- | bfd/bfd-in2.h | 10 | ||||
-rw-r--r-- | bfd/bfd.c | 23 | ||||
-rw-r--r-- | bfd/coff-rs6000.c | 2 | ||||
-rw-r--r-- | bfd/coff64-rs6000.c | 2 | ||||
-rw-r--r-- | bfd/coffcode.h | 4 | ||||
-rw-r--r-- | bfd/elf-bfd.h | 2 | ||||
-rw-r--r-- | bfd/elf.c | 41 | ||||
-rw-r--r-- | bfd/elfxx-target.h | 4 | ||||
-rw-r--r-- | bfd/libbfd-in.h | 2 | ||||
-rw-r--r-- | bfd/libbfd.h | 8 | ||||
-rw-r--r-- | bfd/libecoff.h | 5 | ||||
-rw-r--r-- | bfd/mach-o.c | 1 | ||||
-rw-r--r-- | bfd/mmo.c | 1 | ||||
-rw-r--r-- | bfd/ppcboot.c | 1 | ||||
-rw-r--r-- | bfd/som.c | 2 | ||||
-rw-r--r-- | bfd/targets.c | 5 | ||||
-rw-r--r-- | bfd/vms.c | 2 |
20 files changed, 126 insertions, 22 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index b4b1d91..b5364ed 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,28 @@ +2004-05-17 David Heine <dlheine@tensilica.com> + + * aout-target.h (MY_bfd_copy_private_header_data): Define. + * aout-tic30.c (MY_bfd_copy_private_header_data): Define. + * bfd.c (bfd_copy_private_header_data): Define. + * coff-rs6000.c (rs6000coff_vec, pmac_xcoff_vec): Add entries for new + interface. + * coff64-rs6000.c (rs6000coff64_vec, aix5coff64_vec): Likewise. + * coffcode.h (coff_bfd_copy_private_header_data): Define. + * elf-bfd.h (_bfd_elf_copy_private_header_data): Declare. + * elf.c (_bfd_elf_copy_private_section_data): Remove code to set up + segments by calling copy_private_bfd_data. + (_bfd_elf_copy_private_header_data): Define. + * elfxx-target.h (bfd_elfNN_bfd_copy_private_header_data): Define. + * libbfd-in.h (_bfd_generic_bfd_copy_private_header_data): Define. + * libecoff.h (_bfd_ecoff_bfd_copy_private_header_data): Define. + * mach-o.c (bfd_mach_o_bfd_copy_private_header_data): Define. + * mmo.c (mmo_bfd_copy_private_header_data): Define. + * ppcboot.c (ppcboot_bfd_copy_private_header_data): Define. + * som.c (som_bfd_copy_private_header_data): Define. + * targets.c (BFD_JUMP_TABLE_COPY): Add _bfd_copy_private_header_data. + * vms.c (vms_bfd_copy_private_header_data): Define. + * bfd-in2.h: Regenerate. + * libbfd.h: Regenerate. + 2004-05-15 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de> * elfxx-mips.c (MINUS_TWO): Define. diff --git a/bfd/aout-target.h b/bfd/aout-target.h index 80513c7..fd344a4 100644 --- a/bfd/aout-target.h +++ b/bfd/aout-target.h @@ -559,6 +559,10 @@ MY_bfd_final_link (abfd, info) #define MY_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data #endif +#ifndef MY_bfd_copy_private_header_data +#define MY_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data +#endif + #ifndef MY_bfd_print_private_bfd_data #define MY_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data #endif diff --git a/bfd/aout-tic30.c b/bfd/aout-tic30.c index 1ae0ebf..af99c4b 100644 --- a/bfd/aout-tic30.c +++ b/bfd/aout-tic30.c @@ -1016,6 +1016,10 @@ tic30_aout_set_arch_mach (abfd, arch, machine) #define MY_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data #endif +#ifndef MY_bfd_copy_private_header_data +#define MY_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data +#endif + #ifndef MY_bfd_print_private_bfd_data #define MY_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data #endif diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index ee194f9..3f38b6a 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -3945,6 +3945,11 @@ void bfd_set_gp_size (bfd *abfd, unsigned int i); bfd_vma bfd_scan_vma (const char *string, const char **end, int base); +bfd_boolean bfd_copy_private_header_data (bfd *ibfd, bfd *obfd); + +#define bfd_copy_private_header_data(ibfd, obfd) \ + BFD_SEND (obfd, _bfd_copy_private_header_data, \ + (ibfd, obfd)) bfd_boolean bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd); #define bfd_copy_private_bfd_data(ibfd, obfd) \ @@ -4225,6 +4230,7 @@ typedef struct bfd_target NAME##_bfd_merge_private_bfd_data, \ NAME##_bfd_copy_private_section_data, \ NAME##_bfd_copy_private_symbol_data, \ + NAME##_bfd_copy_private_header_data, \ NAME##_bfd_set_private_flags, \ NAME##_bfd_print_private_bfd_data @@ -4242,6 +4248,10 @@ typedef struct bfd_target to another. */ bfd_boolean (*_bfd_copy_private_symbol_data) (bfd *, asymbol *, bfd *, asymbol *); + /* Called to copy BFD private header data from one object file + to another. */ + bfd_boolean (*_bfd_copy_private_header_data) + (bfd *, bfd *); /* Called to set private backend flags. */ bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword); @@ -982,6 +982,29 @@ bfd_scan_vma (const char *string, const char **end, int base) /* FUNCTION + bfd_copy_private_header_data + +SYNOPSIS + bfd_boolean bfd_copy_private_header_data (bfd *ibfd, bfd *obfd); + +DESCRIPTION + Copy private BFD header information from the BFD @var{ibfd} to the + the BFD @var{obfd}. This copies information that may require + sections to exist, but does not require symbol tables. Return + <<true>> on success, <<false>> on error. + Possible error returns are: + + o <<bfd_error_no_memory>> - + Not enough memory exists to create private data for @var{obfd}. + +.#define bfd_copy_private_header_data(ibfd, obfd) \ +. BFD_SEND (obfd, _bfd_copy_private_header_data, \ +. (ibfd, obfd)) + +*/ + +/* +FUNCTION bfd_copy_private_bfd_data SYNOPSIS diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index 22d47c5..cbd3a91 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -4142,6 +4142,7 @@ const bfd_target rs6000coff_vec = ((bfd_boolean (*) (bfd *, bfd *)) bfd_true), ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true), ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true), + ((bfd_boolean (*) (bfd *, bfd *)) bfd_true), ((bfd_boolean (*) (bfd *, flagword)) bfd_true), ((bfd_boolean (*) (bfd *, void * )) bfd_true), @@ -4386,6 +4387,7 @@ const bfd_target pmac_xcoff_vec = ((bfd_boolean (*) (bfd *, bfd *)) bfd_true), ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true), ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true), + ((bfd_boolean (*) (bfd *, bfd *)) bfd_true), ((bfd_boolean (*) (bfd *, flagword)) bfd_true), ((bfd_boolean (*) (bfd *, void * )) bfd_true), diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c index 857a4b4..678ba93 100644 --- a/bfd/coff64-rs6000.c +++ b/bfd/coff64-rs6000.c @@ -2683,6 +2683,7 @@ const bfd_target rs6000coff64_vec = ((bfd_boolean (*) (bfd *, bfd *)) bfd_true), ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true), ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true), + ((bfd_boolean (*) (bfd *, bfd *)) bfd_true), ((bfd_boolean (*) (bfd *, flagword)) bfd_true), ((bfd_boolean (*) (bfd *, void * )) bfd_true), @@ -2928,6 +2929,7 @@ const bfd_target aix5coff64_vec = ((bfd_boolean (*) (bfd *, bfd *)) bfd_true), ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true), ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true), + ((bfd_boolean (*) (bfd *, bfd *)) bfd_true), ((bfd_boolean (*) (bfd *, flagword)) bfd_true), ((bfd_boolean (*) (bfd *, void * )) bfd_true), diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 35da7c9..d507446 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -5511,6 +5511,10 @@ static const bfd_coff_backend_data ticoff1_swap_table = #define coff_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data #endif +#ifndef coff_bfd_copy_private_header_data +#define coff_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data +#endif + #ifndef coff_bfd_copy_private_section_data #define coff_bfd_copy_private_section_data _bfd_generic_bfd_copy_private_section_data #endif diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 750cc1c..82da5bb 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -1379,6 +1379,8 @@ extern void bfd_elf_set_group_contents (bfd *, asection *, void *); extern void _bfd_elf_link_just_syms (asection *, struct bfd_link_info *); +extern bfd_boolean _bfd_elf_copy_private_header_data + (bfd *, bfd *); extern bfd_boolean _bfd_elf_copy_private_symbol_data (bfd *, asymbol *, bfd *, asymbol *); extern bfd_boolean _bfd_elf_copy_private_section_data @@ -5290,24 +5290,6 @@ _bfd_elf_copy_private_section_data (bfd *ibfd, || obfd->xvec->flavour != bfd_target_elf_flavour) return TRUE; - if (elf_tdata (obfd)->segment_map == NULL && elf_tdata (ibfd)->phdr != NULL) - { - asection *s; - - /* Only set up the segments if there are no more SEC_ALLOC - sections. FIXME: This won't do the right thing if objcopy is - used to remove the last SEC_ALLOC section, since objcopy - won't call this routine in that case. */ - for (s = isec->next; s != NULL; s = s->next) - if ((s->flags & SEC_ALLOC) != 0) - break; - if (s == NULL) - { - if (! copy_private_bfd_data (ibfd, obfd)) - return FALSE; - } - } - ihdr = &elf_section_data (isec)->this_hdr; ohdr = &elf_section_data (osec)->this_hdr; @@ -5330,6 +5312,29 @@ _bfd_elf_copy_private_section_data (bfd *ibfd, return TRUE; } +/* Copy private header information. */ + +bfd_boolean +_bfd_elf_copy_private_header_data (bfd *ibfd, bfd *obfd) +{ + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return TRUE; + + /* Copy over private BFD data if it has not already been copied. + This must be done here, rather than in the copy_private_bfd_data + entry point, because the latter is called after the section + contents have been set, which means that the program headers have + already been worked out. */ + if (elf_tdata (obfd)->segment_map == NULL && elf_tdata (ibfd)->phdr != NULL) + { + if (! copy_private_bfd_data (ibfd, obfd)) + return FALSE; + } + + return TRUE; +} + /* Copy private symbol information. If this symbol is in a section which we did not map into a BFD section, try to map the section index correctly. We use special macro definitions for the mapped diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h index 61ed197..d0773e5 100644 --- a/bfd/elfxx-target.h +++ b/bfd/elfxx-target.h @@ -158,6 +158,10 @@ #define bfd_elfNN_bfd_copy_private_section_data \ _bfd_elf_copy_private_section_data #endif +#ifndef bfd_elfNN_bfd_copy_private_header_data +#define bfd_elfNN_bfd_copy_private_header_data \ + _bfd_elf_copy_private_header_data +#endif #ifndef bfd_elfNN_bfd_copy_private_bfd_data #define bfd_elfNN_bfd_copy_private_bfd_data \ _bfd_elf_copy_private_bfd_data diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h index fb021d3..6d3a335 100644 --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h @@ -212,6 +212,8 @@ extern bfd_boolean _bfd_generic_get_section_contents_in_window ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true) #define _bfd_generic_bfd_copy_private_symbol_data \ ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true) +#define _bfd_generic_bfd_copy_private_header_data \ + ((bfd_boolean (*) (bfd *, bfd *)) bfd_true) #define _bfd_generic_bfd_print_private_bfd_data \ ((bfd_boolean (*) (bfd *, void *)) bfd_true) diff --git a/bfd/libbfd.h b/bfd/libbfd.h index 6841e29..86819ff 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -217,6 +217,8 @@ extern bfd_boolean _bfd_generic_get_section_contents_in_window ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true) #define _bfd_generic_bfd_copy_private_symbol_data \ ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true) +#define _bfd_generic_bfd_copy_private_header_data \ + ((bfd_boolean (*) (bfd *, bfd *)) bfd_true) #define _bfd_generic_bfd_print_private_bfd_data \ ((bfd_boolean (*) (bfd *, void *)) bfd_true) @@ -696,9 +698,9 @@ struct _bfd_window_internal { extern bfd *bfd_last_cache; #define bfd_cache_lookup(x) \ - ((x)==bfd_last_cache? \ - (FILE*) (bfd_last_cache->iostream): \ - bfd_cache_lookup_worker(x)) + ((x) == bfd_last_cache ? \ + (FILE *) (bfd_last_cache->iostream): \ + bfd_cache_lookup_worker (x)) bfd_boolean bfd_cache_init (bfd *abfd); bfd_boolean bfd_cache_close (bfd *abfd); diff --git a/bfd/libecoff.h b/bfd/libecoff.h index 7d4006a..b809f3a 100644 --- a/bfd/libecoff.h +++ b/bfd/libecoff.h @@ -1,5 +1,5 @@ /* BFD ECOFF object file private structure. - Copyright 1993, 1994, 1995, 1996, 1999, 2001, 2002, 2003 + Copyright 1993, 1994, 1995, 1996, 1999, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. @@ -249,6 +249,9 @@ extern bfd_boolean _bfd_ecoff_bfd_copy_private_bfd_data #define _bfd_ecoff_bfd_copy_private_symbol_data \ _bfd_generic_bfd_copy_private_symbol_data +#define _bfd_ecoff_bfd_copy_private_header_data \ + _bfd_generic_bfd_copy_private_header_data + #define _bfd_ecoff_bfd_print_private_bfd_data \ _bfd_generic_bfd_print_private_bfd_data diff --git a/bfd/mach-o.c b/bfd/mach-o.c index eaa7aba..b2401c4 100644 --- a/bfd/mach-o.c +++ b/bfd/mach-o.c @@ -70,6 +70,7 @@ #define bfd_mach_o_bfd_merge_sections bfd_generic_merge_sections #define bfd_mach_o_bfd_is_group_section bfd_generic_is_group_section #define bfd_mach_o_bfd_discard_group bfd_generic_discard_group +#define bfd_mach_o_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data static bfd_boolean bfd_mach_o_bfd_copy_private_symbol_data PARAMS ((bfd *, asymbol *, bfd *, asymbol *)); @@ -3306,6 +3306,7 @@ mmo_canonicalize_reloc (abfd, section, relptr, symbols) #define mmo_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data #define mmo_bfd_copy_private_section_data _bfd_generic_bfd_copy_private_section_data #define mmo_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data +#define mmo_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data #define mmo_bfd_set_private_flags _bfd_generic_bfd_set_private_flags #define mmo_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data diff --git a/bfd/ppcboot.c b/bfd/ppcboot.c index d34f1a2..cc4dc27 100644 --- a/bfd/ppcboot.c +++ b/bfd/ppcboot.c @@ -484,6 +484,7 @@ ppcboot_bfd_print_private_bfd_data (abfd, farg) #define ppcboot_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data #define ppcboot_bfd_copy_private_section_data _bfd_generic_bfd_copy_private_section_data #define ppcboot_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data +#define ppcboot_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data #define ppcboot_bfd_set_private_flags _bfd_generic_bfd_set_private_flags #define ppcboot_bfd_print_private_bfd_dat ppcboot_bfd_print_private_bfd_data @@ -192,6 +192,8 @@ static bfd_boolean som_bfd_copy_private_section_data PARAMS ((bfd *, asection *, bfd *, asection *)); static bfd_boolean som_bfd_copy_private_bfd_data PARAMS ((bfd *, bfd *)); +#define som_bfd_copy_private_header_data \ + _bfd_generic_bfd_copy_private_header_data #define som_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data #define som_bfd_set_private_flags _bfd_generic_bfd_set_private_flags static bfd_boolean som_bfd_is_local_label_name diff --git a/bfd/targets.c b/bfd/targets.c index ad6362a..bceb724 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -265,6 +265,7 @@ BFD_JUMP_TABLE macros. . NAME##_bfd_merge_private_bfd_data, \ . NAME##_bfd_copy_private_section_data, \ . NAME##_bfd_copy_private_symbol_data, \ +. NAME##_bfd_copy_private_header_data, \ . NAME##_bfd_set_private_flags, \ . NAME##_bfd_print_private_bfd_data . @@ -282,6 +283,10 @@ BFD_JUMP_TABLE macros. . to another. *} . bfd_boolean (*_bfd_copy_private_symbol_data) . (bfd *, asymbol *, bfd *, asymbol *); +. {* Called to copy BFD private header data from one object file +. to another. *} +. bfd_boolean (*_bfd_copy_private_header_data) +. (bfd *, bfd *); . {* Called to set private backend flags. *} . bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword); . @@ -168,6 +168,8 @@ static bfd_boolean vms_bfd_set_private_flags #define vms_bfd_link_just_syms _bfd_generic_link_just_syms #define vms_bfd_is_group_section bfd_generic_is_group_section #define vms_bfd_discard_group bfd_generic_discard_group +#define vms_bfd_copy_private_header_data \ + _bfd_generic_bfd_copy_private_header_data /*===========================================================================*/ |