diff options
author | Alan Modra <amodra@gmail.com> | 2003-06-25 06:40:27 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2003-06-25 06:40:27 +0000 |
commit | 1049f94e8e1a9eae86a694d2dca94a6194f763b1 (patch) | |
tree | 40fbf4dbcdbd98d6784861ab18ce46a36b3308c8 /bfd | |
parent | 59861b363a480a4e802ef0433bf31153b57a2e3a (diff) | |
download | gdb-1049f94e8e1a9eae86a694d2dca94a6194f763b1.zip gdb-1049f94e8e1a9eae86a694d2dca94a6194f763b1.tar.gz gdb-1049f94e8e1a9eae86a694d2dca94a6194f763b1.tar.bz2 |
Correct spelling of "relocatable".
Diffstat (limited to 'bfd')
98 files changed, 769 insertions, 666 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index de64406..48980a7 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,102 @@ +2003-06-25 Alan Modra <amodra@bigpond.net.au> + + * aout-ns32k.c: Correct spelling of "relocatable". + * aoutx.h: Likewise. + * bfd-in.h: Likewise. + * bfd.c: Likewise. + * bout.c: Likewise. + * coff-a29k.c: Likewise. + * coff-alpha.c: Likewise. + * coff-arm.c: Likewise. + * coff-i386.c: Likewise. + * coff-i860.c: Likewise. + * coff-i960.c: Likewise. + * coff-m68k.c: Likewise. + * coff-m88k.c: Likewise. + * coff-mcore.c: Likewise. + * coff-mips.c: Likewise. + * coff-or32.c: Likewise. + * coff-ppc.c: Likewise. + * coff-rs6000.c: Likewise. + * coff-sh.c: Likewise. + * coff-tic80.c: Likewise. + * coff64-rs6000.c: Likewise. + * cofflink.c: Likewise. + * cpu-ns32k.c: Likewise. + * ecoff.c: Likewise. + * ecofflink.c: Likewise. + * elf-bfd.h: Likewise. + * elf-eh-frame.c: Likewise. + * elf-hppa.h: Likewise. + * elf-m10200.c: Likewise. + * elf-m10300.c: Likewise. + * elf.c: Likewise. + * elf32-arm.h: Likewise. + * elf32-avr.c: Likewise. + * elf32-cris.c: Likewise. + * elf32-d10v.c: Likewise. + * elf32-dlx.c: Likewise. + * elf32-fr30.c: Likewise. + * elf32-frv.c: Likewise. + * elf32-h8300.c: Likewise. + * elf32-hppa.c: Likewise. + * elf32-i370.c: Likewise. + * elf32-i386.c: Likewise. + * elf32-i860.c: Likewise. + * elf32-i960.c: Likewise. + * elf32-ip2k.c: Likewise. + * elf32-iq2000.c: Likewise. + * elf32-m32r.c: Likewise. + * elf32-m68hc11.c: Likewise. + * elf32-m68hc1x.c: Likewise. + * elf32-m68k.c: Likewise. + * elf32-mcore.c: Likewise. + * elf32-mips.c: Likewise. + * elf32-msp430.c: Likewise. + * elf32-openrisc.c: Likewise. + * elf32-ppc.c: Likewise. + * elf32-s390.c: Likewise. + * elf32-sh.c: Likewise. + * elf32-sh64.c: Likewise. + * elf32-sparc.c: Likewise. + * elf32-v850.c: Likewise. + * elf32-vax.c: Likewise. + * elf32-xstormy16.c: Likewise. + * elf32-xtensa.c: Likewise. + * elf64-alpha.c: Likewise. + * elf64-hppa.c: Likewise. + * elf64-mips.c: Likewise. + * elf64-mmix.c: Likewise. + * elf64-ppc.c: Likewise. + * elf64-s390.c: Likewise. + * elf64-sh64.c: Likewise. + * elf64-sparc.c: Likewise. + * elf64-x86-64.c: Likewise. + * elfcode.h: Likewise. + * elflink.h: Likewise. + * elfn32-mips.c: Likewise. + * elfxx-ia64.c: Likewise. + * elfxx-mips.c: Likewise. + * i386linux.c: Likewise. + * ieee.c: Likewise. + * libcoff-in.h: Likewise. + * linker.c: Likewise. + * m68klinux.c: Likewise. + * pdp11.c: Likewise. + * pe-mips.c: Likewise. + * peXXigen.c: Likewise. + * reloc.c: Likewise. + * reloc16.c: Likewise. + * sparclinux.c: Likewise. + * sunos.c: Likewise. + * syms.c: Likewise. + * versados.c: Likewise. + * vms.c: Likewise. + * xcofflink.c: Likewise. + * bfd-in2.h: Regenerate. + * libcoff.h: Regenerate. + * libbfd.h: Regenerate. + 2003-06-24 Alan Modra <amodra@bigpond.net.au> * elf32-ppc.c (ppc_elf_check_relocs): Report plt reloc against @@ -2604,7 +2703,7 @@ in a local var. Comment typo fixes. (h8300_bfd_link_add_symbols): Likewise. - * bfd/reloc.c (struct reloc_howto_struct): Revise src_mask and + * reloc.c (struct reloc_howto_struct): Revise src_mask and dst_mask comments. * bfd-in2.h: Regenerate. @@ -4355,9 +4454,9 @@ 2002-08-16 Stephen Clarke <stephen.clarke@superh.com> - * bfd/elf32-sh.c (sh_elf_gc_mark_hook): For sh64, skip indirect + * elf32-sh.c (sh_elf_gc_mark_hook): For sh64, skip indirect symbols when looking for section referred to by a relocation. - * bfd/elf64-sh.c (sh_elf64_gc_mark_hook): Likewise. + * elf64-sh.c (sh_elf64_gc_mark_hook): Likewise. 2002-08-15 Alan Modra <amodra@bigpond.net.au> diff --git a/bfd/aout-ns32k.c b/bfd/aout-ns32k.c index 0972b5d..8092705 100644 --- a/bfd/aout-ns32k.c +++ b/bfd/aout-ns32k.c @@ -65,7 +65,7 @@ MY(put_reloc) PARAMS ((bfd *, int, int, bfd_vma, reloc_howto_type *, struct reloc_std_external *)); /* The ns32k series is ah, unusual, when it comes to relocation. - There are three storage methods for relocateable objects. There + There are three storage methods for relocatable objects. There are displacements, immediate operands and ordinary twos complement data. Of these, only the last fits into the standard relocation scheme. Immediate operands are stored huffman encoded and diff --git a/bfd/aoutx.h b/bfd/aoutx.h index 7f02d13..674fc76 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -3749,7 +3749,7 @@ NAME(aout,final_link) (abfd, info, callback) includes_hash_initialized = TRUE; /* Figure out the largest section size. Also, if generating - relocateable output, count the relocs. */ + relocatable output, count the relocs. */ trsize = 0; drsize = 0; max_contents_size = 0; @@ -3759,7 +3759,7 @@ NAME(aout,final_link) (abfd, info, callback) { bfd_size_type sz; - if (info->relocateable) + if (info->relocatable) { if (bfd_get_flavour (sub) == bfd_target_aout_flavour) { @@ -3773,7 +3773,7 @@ NAME(aout,final_link) (abfd, info, callback) work out the number of relocs needed, and then multiply by the reloc size. */ (*_bfd_error_handler) - (_("%s: relocateable link from %s to %s not supported"), + (_("%s: relocatable link from %s to %s not supported"), bfd_get_filename (abfd), sub->xvec->name, abfd->xvec->name); bfd_set_error (bfd_error_invalid_operation); @@ -3803,7 +3803,7 @@ NAME(aout,final_link) (abfd, info, callback) } } - if (info->relocateable) + if (info->relocatable) { if (obj_textsec (abfd) != (asection *) NULL) trsize += (_bfd_count_link_order_relocs (obj_textsec (abfd) @@ -4786,9 +4786,9 @@ aout_link_input_section (finfo, input_bfd, input_section, reloff_ptr, input_size)) return FALSE; - /* If we are producing relocateable output, the relocs were + /* If we are producing relocatable output, the relocs were modified, and we now write them out. */ - if (finfo->info->relocateable && rel_size > 0) + if (finfo->info->relocatable && rel_size > 0) { if (bfd_seek (finfo->output_bfd, *reloff_ptr, SEEK_SET) != 0) return FALSE; @@ -4850,7 +4850,7 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs, struct aout_link_hash_entry *, PTR, bfd_byte *, bfd_boolean *, bfd_vma *)); bfd *output_bfd; - bfd_boolean relocateable; + bfd_boolean relocatable; struct external_nlist *syms; char *strings; struct aout_link_hash_entry **sym_hashes; @@ -4866,7 +4866,7 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs, BFD_ASSERT (input_bfd->xvec->header_byteorder == output_bfd->xvec->header_byteorder); - relocateable = finfo->info->relocateable; + relocatable = finfo->info->relocatable; syms = obj_aout_external_syms (input_bfd); strings = obj_aout_external_strings (input_bfd); sym_hashes = obj_aout_sym_hashes (input_bfd); @@ -4935,9 +4935,9 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs, } #endif - if (relocateable) + if (relocatable) { - /* We are generating a relocateable output file, and must + /* We are generating a relocatable output file, and must modify the reloc accordingly. */ if (r_extern) { @@ -5195,7 +5195,7 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, struct aout_link_hash_entry *, PTR, bfd_byte *, bfd_boolean *, bfd_vma *)); bfd *output_bfd; - bfd_boolean relocateable; + bfd_boolean relocatable; struct external_nlist *syms; char *strings; struct aout_link_hash_entry **sym_hashes; @@ -5211,7 +5211,7 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, BFD_ASSERT (input_bfd->xvec->header_byteorder == output_bfd->xvec->header_byteorder); - relocateable = finfo->info->relocateable; + relocatable = finfo->info->relocatable; syms = obj_aout_external_syms (input_bfd); strings = obj_aout_external_strings (input_bfd); sym_hashes = obj_aout_sym_hashes (input_bfd); @@ -5256,9 +5256,9 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, BFD_ASSERT (r_type < TABLE_SIZE (howto_table_ext)); - if (relocateable) + if (relocatable) { - /* We are generating a relocateable output file, and must + /* We are generating a relocatable output file, and must modify the reloc accordingly. */ if (r_extern || r_type == (unsigned int) RELOC_BASE10 diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index fdf5f1c..977095e 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -619,7 +619,7 @@ extern bfd_boolean bfd_ecoff_debug_accumulate_other extern bfd_boolean bfd_ecoff_debug_externals PARAMS ((bfd *abfd, struct ecoff_debug_info *debug, const struct ecoff_debug_swap *swap, - bfd_boolean relocateable, + bfd_boolean relocatable, bfd_boolean (*get_extr) (struct symbol_cache_entry *, struct ecoff_extr *), void (*set_index) (struct symbol_cache_entry *, diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 71346c1..bdd7a48 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -626,7 +626,7 @@ extern bfd_boolean bfd_ecoff_debug_accumulate_other extern bfd_boolean bfd_ecoff_debug_externals PARAMS ((bfd *abfd, struct ecoff_debug_info *debug, const struct ecoff_debug_swap *swap, - bfd_boolean relocateable, + bfd_boolean relocatable, bfd_boolean (*get_extr) (struct symbol_cache_entry *, struct ecoff_extr *), void (*set_index) (struct symbol_cache_entry *, @@ -1164,12 +1164,12 @@ DESCRIPTION bfd_byte * bfd_get_relocated_section_contents (abfd, link_info, link_order, data, - relocateable, symbols) + relocatable, symbols) bfd *abfd; struct bfd_link_info *link_info; struct bfd_link_order *link_order; bfd_byte *data; - bfd_boolean relocateable; + bfd_boolean relocatable; asymbol **symbols; { bfd *abfd2; @@ -1188,7 +1188,7 @@ bfd_get_relocated_section_contents (abfd, link_info, link_order, data, fn = abfd2->xvec->_bfd_get_relocated_section_contents; - return (*fn) (abfd, link_info, link_order, data, relocateable, symbols); + return (*fn) (abfd, link_info, link_order, data, relocatable, symbols); } /* Record information about an ELF program header. */ @@ -1,6 +1,6 @@ /* BFD back-end for Intel 960 b.out binaries. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002 + 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Cygnus Support. @@ -1298,12 +1298,12 @@ b_out_bfd_relax_section (abfd, i, link_info, again) static bfd_byte * b_out_bfd_get_relocated_section_contents (output_bfd, link_info, link_order, - data, relocateable, symbols) + data, relocatable, symbols) bfd *output_bfd; struct bfd_link_info *link_info; struct bfd_link_order *link_order; bfd_byte *data; - bfd_boolean relocateable; + bfd_boolean relocatable; asymbol **symbols; { /* Get enough memory to hold the stuff. */ @@ -1317,11 +1317,11 @@ b_out_bfd_get_relocated_section_contents (output_bfd, link_info, link_order, if (reloc_size < 0) goto error_return; - /* If producing relocateable output, don't bother to relax. */ - if (relocateable) + /* If producing relocatable output, don't bother to relax. */ + if (relocatable) return bfd_generic_get_relocated_section_contents (output_bfd, link_info, link_order, - data, relocateable, + data, relocatable, symbols); reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size); diff --git a/bfd/coff-a29k.c b/bfd/coff-a29k.c index 844d371..444dbc2 100644 --- a/bfd/coff-a29k.c +++ b/bfd/coff-a29k.c @@ -1,5 +1,6 @@ /* BFD back-end for AMD 29000 COFF binaries. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002 + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1997, 1999, 2000, 2001, + 2002, 2003 Free Software Foundation, Inc. Contributed by David Wood at New York University 7/8/91. @@ -327,10 +328,10 @@ coff_a29k_relocate_section (output_bfd, info, input_bfd, input_section, bfd_boolean hihalf; bfd_vma hihalf_val; - /* If we are performing a relocateable link, we don't need to do a + /* If we are performing a relocatable link, we don't need to do a thing. The caller will take care of adjusting the reloc addresses and symbol indices. */ - if (info->relocateable) + if (info->relocatable) return TRUE; hihalf = FALSE; diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c index 14e0ee1..e9dd416 100644 --- a/bfd/coff-alpha.c +++ b/bfd/coff-alpha.c @@ -1,5 +1,5 @@ /* BFD back-end for ALPHA Extended-Coff files. - Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 + Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Modified from coff-mips.c by Steve Chamberlain <sac@cygnus.com> and Ian Lance Taylor <ian@cygnus.com>. @@ -53,7 +53,7 @@ static reloc_howto_type *alpha_bfd_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type)); static bfd_byte *alpha_ecoff_get_relocated_section_contents PARAMS ((bfd *abfd, struct bfd_link_info *, struct bfd_link_order *, - bfd_byte *data, bfd_boolean relocateable, asymbol **symbols)); + bfd_byte *data, bfd_boolean relocatable, asymbol **symbols)); static bfd_vma alpha_convert_external_reloc PARAMS ((bfd *, struct bfd_link_info *, bfd *, struct external_reloc *, struct ecoff_link_hash_entry *)); @@ -753,12 +753,12 @@ alpha_adjust_reloc_out (abfd, rel, intern) static bfd_byte * alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order, - data, relocateable, symbols) + data, relocatable, symbols) bfd *abfd; struct bfd_link_info *link_info; struct bfd_link_order *link_order; bfd_byte *data; - bfd_boolean relocateable; + bfd_boolean relocatable; asymbol **symbols; { bfd *input_bfd = link_order->u.indirect.section->owner; @@ -766,7 +766,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order, long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section); arelent **reloc_vector = NULL; long reloc_count; - bfd *output_bfd = relocateable ? abfd : (bfd *) NULL; + bfd *output_bfd = relocatable ? abfd : (bfd *) NULL; bfd_vma gp; bfd_boolean gp_undefined; bfd_vma stack[RELOC_STACKSIZE]; @@ -798,7 +798,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order, gp = _bfd_get_gp_value (abfd); if (gp == 0) { - if (relocateable) + if (relocatable) { asection *sec; bfd_vma lo; @@ -858,7 +858,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order, case ALPHA_R_SREL16: case ALPHA_R_SREL32: case ALPHA_R_SREL64: - if (relocateable + if (relocatable && ((*rel->sym_ptr_ptr)->flags & BSF_SECTION_SYM) == 0) { rel->address += input_section->output_offset; @@ -991,7 +991,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order, asymbol *symbol; bfd_vma relocation; - if (relocateable) + if (relocatable) { rel->address += input_section->output_offset; break; @@ -1024,7 +1024,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order, bfd_vma val; int offset, size; - if (relocateable) + if (relocatable) { rel->address += input_section->output_offset; break; @@ -1051,7 +1051,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order, asymbol *symbol; bfd_vma relocation; - if (relocateable) + if (relocatable) { rel->address += input_section->output_offset; break; @@ -1084,7 +1084,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order, asymbol *symbol; bfd_vma relocation; - if (relocateable) + if (relocatable) { rel->address += input_section->output_offset; break; @@ -1121,7 +1121,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order, abort (); } - if (relocateable) + if (relocatable) { asection *os = input_section->output_section; @@ -1248,7 +1248,7 @@ alpha_bfd_reloc_type_lookup (abfd, code) } /* A helper routine for alpha_relocate_section which converts an - external reloc when generating relocateable output. Returns the + external reloc when generating relocatable output. Returns the relocation amount. */ static bfd_vma @@ -1262,7 +1262,7 @@ alpha_convert_external_reloc (output_bfd, info, input_bfd, ext_rel, h) unsigned long r_symndx; bfd_vma relocation; - BFD_ASSERT (info->relocateable); + BFD_ASSERT (info->relocatable); if (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) @@ -1443,7 +1443,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section, lita_sec = symndx_to_section[RELOC_SECTION_LITA]; gp = _bfd_get_gp_value (output_bfd); - if (! info->relocateable && lita_sec != NULL) + if (! info->relocatable && lita_sec != NULL) { struct ecoff_section_tdata *lita_sec_data; @@ -1552,7 +1552,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section, not otherwise used for anything. For some reason, the address of the relocation does not appear to include the section VMA, unlike the other relocation types. */ - if (info->relocateable) + if (info->relocatable) H_PUT_64 (input_bfd, input_section->output_offset + r_vaddr, ext_rel->r_vaddr); adjust_addrp = FALSE; @@ -1705,7 +1705,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section, if (h == (struct ecoff_link_hash_entry *) NULL) abort (); - if (! info->relocateable) + if (! info->relocatable) { if (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) @@ -1748,7 +1748,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section, addend += r_vaddr; - if (info->relocateable) + if (info->relocatable) { /* Adjust r_vaddr by the addend. */ H_PUT_64 (input_bfd, addend, ext_rel->r_vaddr); @@ -1782,9 +1782,9 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section, case ALPHA_R_OP_STORE: /* Store a value from the reloc stack into a bitfield. If - we are generating relocateable output, all we do is + we are generating relocatable output, all we do is adjust the address of the reloc. */ - if (! info->relocateable) + if (! info->relocatable) { bfd_vma mask; bfd_vma val; @@ -1850,9 +1850,9 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section, abort (); } - if (info->relocateable) + if (info->relocatable) { - /* We are generating relocateable output, and must + /* We are generating relocatable output, and must convert the existing reloc. */ if (r_extern) { @@ -1975,7 +1975,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section, } } - if (info->relocateable && adjust_addrp) + if (info->relocatable && adjust_addrp) { /* Change the address of the relocation. */ H_PUT_64 (input_bfd, diff --git a/bfd/coff-arm.c b/bfd/coff-arm.c index a88cdba..98d7048 100644 --- a/bfd/coff-arm.c +++ b/bfd/coff-arm.c @@ -1,6 +1,6 @@ /* BFD back-end for ARM COFF files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002 + 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Cygnus Support. @@ -1247,13 +1247,13 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, return FALSE; /* The relocation_section function will skip pcrel_offset relocs - when doing a relocateable link. However, we want to convert + when doing a relocatable link. However, we want to convert ARM26 to ARM26D relocs if possible. We return a fake howto in this case without pcrel_offset set, and adjust the addend to compensate. */ if (rel->r_type == ARM_26 && h != NULL - && info->relocateable + && info->relocatable && (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) && (h->root.u.def.section->output_section @@ -1283,18 +1283,18 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, the next opcode's pc, so is off by one. */ #if 0 /* This appears to have been true for WINCE 2.0, but it is not true for WINCE 3.0. */ - if (howto->pc_relative && !info->relocateable) + if (howto->pc_relative && !info->relocatable) addend -= 8; #endif #endif - /* If we are doing a relocateable link, then we can just ignore + /* If we are doing a relocatable link, then we can just ignore a PC relative reloc that is pcrel_offset. It will already - have the correct value. If this is not a relocateable link, + have the correct value. If this is not a relocatable link, then we should ignore the symbol value. */ if (howto->pc_relative && howto->pcrel_offset) { - if (info->relocateable) + if (info->relocatable) continue; /* FIXME - it is not clear which targets need this next test and which do not. It is known that it is needed for the @@ -1341,7 +1341,7 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, stub generation to the final linker pass. If we fail to verify that the name is defined, we'll try to build stubs for an undefined name... */ - if (! info->relocateable + if (! info->relocatable && ( h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak)) { @@ -1595,7 +1595,7 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, + sec->output_offset); } - else if (! info->relocateable) + else if (! info->relocatable) { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, @@ -1617,7 +1617,7 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, rstat = bfd_reloc_ok; #ifndef ARM_WINCE /* Only perform this fix during the final link, not a relocatable link. nickc@cygnus.com */ - else if (! info->relocateable + else if (! info->relocatable && howto->type == ARM_THUMB23) { /* This is pretty much a copy of what the default @@ -1743,7 +1743,7 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, Is this the best way to fix up thumb addresses? krk@cygnus.com Probably not, but it works, and if it works it don't need fixing! nickc@cygnus.com */ /* Only perform this fix during the final link, not a relocatable link. nickc@cygnus.com */ - if (! info->relocateable + if (! info->relocatable && (rel->r_type == ARM_32 || rel->r_type == ARM_RVA32)) { /* Determine if we need to set the bottom bit of a relocated address @@ -2023,7 +2023,7 @@ bfd_arm_get_bfd_for_interworking (abfd, info) /* If we are only performing a partial link do not bother getting a bfd to hold the glue. */ - if (info->relocateable) + if (info->relocatable) return TRUE; globals = coff_arm_hash_table (info); @@ -2078,7 +2078,7 @@ bfd_arm_process_before_allocation (abfd, info, support_old_code) /* If we are only performing a partial link do not bother to construct any glue. */ - if (info->relocateable) + if (info->relocatable) return TRUE; /* Here we have a bfd that is to be included on the link. We have a hook @@ -2198,7 +2198,7 @@ bfd_arm_process_before_allocation (abfd, info, support_old_code) #define coff_bfd_copy_private_bfd_data coff_arm_copy_private_bfd_data #define coff_bfd_link_hash_table_create coff_arm_link_hash_table_create -/* When doing a relocateable link, we want to convert ARM26 relocs +/* When doing a relocatable link, we want to convert ARM26 relocs into ARM26D relocs. */ static bfd_boolean diff --git a/bfd/coff-i386.c b/bfd/coff-i386.c index f083ae1..a24344a 100644 --- a/bfd/coff-i386.c +++ b/bfd/coff-i386.c @@ -1,6 +1,6 @@ /* BFD back-end for Intel 386 COFF files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002 + 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Cygnus Support. @@ -56,7 +56,7 @@ static reloc_howto_type *coff_i386_reloc_type_lookup section for a reference to a common symbol is the value itself plus any desired offset. Ian Taylor, Cygnus Support. */ -/* If we are producing relocateable output, we need to do some +/* If we are producing relocatable output, we need to do some adjustments to the object file that are not done by the bfd_perform_relocation function. This function is called by every reloc type to make any required adjustments. */ @@ -103,7 +103,7 @@ coff_i386_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, { /* For some reason bfd_perform_relocation always effectively ignores the addend for a COFF target when producing - relocateable output. This seems to be always wrong for 386 + relocatable output. This seems to be always wrong for 386 COFF, so we handle the addend here instead. */ #ifdef COFF_WITH_PE if (output_bfd == (bfd *) NULL) @@ -386,7 +386,7 @@ static reloc_howto_type howto_table[] = /* The PE relocate section routine. The only difference between this and the regular routine is that we don't want to do anything for a - relocateable link. */ + relocatable link. */ static bfd_boolean coff_pe_i386_relocate_section PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, @@ -405,7 +405,7 @@ coff_pe_i386_relocate_section (output_bfd, info, input_bfd, struct internal_syment *syms; asection **sections; { - if (info->relocateable) + if (info->relocatable) return TRUE; return _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd, @@ -470,7 +470,7 @@ coff_i386_rtype_to_howto (abfd, sec, rel, h, sym, addendp) #ifndef COFF_WITH_PE /* If the output symbol is common (in which case this must be a - relocateable link), we need to add in the final size of the + relocatable link), we need to add in the final size of the common symbol. */ if (h != NULL && h->root.type == bfd_link_hash_common) *addendp += h->root.u.c.size; diff --git a/bfd/coff-i860.c b/bfd/coff-i860.c index 767692d..b862ff7 100644 --- a/bfd/coff-i860.c +++ b/bfd/coff-i860.c @@ -1,5 +1,5 @@ /* BFD back-end for Intel 860 COFF files. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2002 + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Created mostly by substituting "860" for "386" in coff-i386.c Harry Dolan <dolan@ssd.intel.com>, October 1995 @@ -47,7 +47,7 @@ static const bfd_target * i3coff_object_p PARAMS ((bfd *)); section for a reference to a common symbol is the value itself plus any desired offset. Ian Taylor, Cygnus Support. */ -/* If we are producing relocateable output, we need to do some +/* If we are producing relocatable output, we need to do some adjustments to the object file that are not done by the bfd_perform_relocation function. This function is called by every reloc type to make any required adjustments. */ @@ -87,7 +87,7 @@ coff_i860_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, { /* For some reason bfd_perform_relocation always effectively ignores the addend for a COFF target when producing - relocateable output. This seems to be always wrong for 860 + relocatable output. This seems to be always wrong for 860 COFF, so we handle the addend here instead. */ diff = reloc_entry->addend; } @@ -348,7 +348,7 @@ coff_i860_rtype_to_howto (abfd, sec, rel, h, sym, addendp) } /* If the output symbol is common (in which case this must be a - relocateable link), we need to add in the final size of the + relocatable link), we need to add in the final size of the common symbol. */ if (h != NULL && h->root.type == bfd_link_hash_common) *addendp += h->root.u.c.size; diff --git a/bfd/coff-i960.c b/bfd/coff-i960.c index e4dc053..3a04753 100644 --- a/bfd/coff-i960.c +++ b/bfd/coff-i960.c @@ -1,6 +1,6 @@ /* BFD back-end for Intel 960 COFF files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1997, 1999, 2000, 2001, - 2002 Free Software Foundation, Inc. + 2002, 2003 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -180,12 +180,12 @@ optcall_callback (abfd, reloc_entry, symbol_in, data, same object file. It appears to simply discard such relocs, rather than adding their values into the object file. We handle this here by converting all relocs against defined symbols into relocs - against the section symbol, when generating a relocateable output + against the section symbol, when generating a relocatable output file. Note that this function is only called if we are not using the COFF specific backend linker. It only does something when doing a - relocateable link, which will almost certainly fail when not + relocatable link, which will almost certainly fail when not generating COFF i960 output, so this function is actually no longer useful. It was used before this target was converted to use the COFF specific backend linker. */ @@ -205,7 +205,7 @@ coff_i960_relocate (abfd, reloc_entry, symbol, data, input_section, if (output_bfd == NULL) { - /* Not generating relocateable output file. */ + /* Not generating relocatable output file. */ return bfd_reloc_continue; } @@ -328,7 +328,7 @@ coff_i960_start_final_link (abfd, info) asection *o; bfd_byte *esym; - if (! info->relocateable) + if (! info->relocatable) return TRUE; esym = (bfd_byte *) bfd_malloc (symesz); @@ -455,7 +455,7 @@ coff_i960_relocate_section (output_bfd, info, input_bfd, input_section, + sec->output_section->vma + sec->output_offset); } - else if (! info->relocateable) + else if (! info->relocatable) { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, @@ -466,7 +466,7 @@ coff_i960_relocate_section (output_bfd, info, input_bfd, input_section, done = FALSE; - if (howto->type == R_OPTCALL && ! info->relocateable && symndx != -1) + if (howto->type == R_OPTCALL && ! info->relocatable && symndx != -1) { int class; diff --git a/bfd/coff-m68k.c b/bfd/coff-m68k.c index a293b87..0947811 100644 --- a/bfd/coff-m68k.c +++ b/bfd/coff-m68k.c @@ -1,6 +1,6 @@ /* BFD back-end for Motorola 68000 COFF binaries. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999, - 2000, 2001, 2002 + 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Cygnus Support. @@ -250,7 +250,7 @@ m68kcoff_rtype_to_howto (abfd, sec, rel, h, sym, addendp) symbol is the value itself plus any desired offset. (taken from work done by Ian Taylor, Cygnus Support, for I386 COFF). */ -/* If we are producing relocateable output, we need to do some +/* If we are producing relocatable output, we need to do some adjustments to the object file that are not done by the bfd_perform_relocation function. This function is called by every reloc type to make any required adjustments. */ @@ -290,7 +290,7 @@ m68kcoff_common_addend_special_fn (abfd, reloc_entry, symbol, data, { /* For some reason bfd_perform_relocation always effectively ignores the addend for a COFF target when producing - relocateable output. This seems to be always wrong for 386 + relocatable output. This seems to be always wrong for 386 COFF, so we handle the addend here instead. */ diff = reloc_entry->addend; } @@ -409,7 +409,7 @@ m68kcoff_common_addend_rtype_to_howto (abfd, sec, rel, h, sym, addendp) } /* If the output symbol is common (in which case this must be a - relocateable link), we need to add in the final size of the + relocatable link), we need to add in the final size of the common symbol. */ if (h != NULL && h->root.type == bfd_link_hash_common) *addendp += h->root.u.c.size; @@ -445,7 +445,7 @@ bfd_m68k_coff_create_embedded_relocs (abfd, info, datasec, relsec, errmsg) bfd_byte *p; bfd_size_type amt; - BFD_ASSERT (! info->relocateable); + BFD_ASSERT (! info->relocatable); *errmsg = NULL; diff --git a/bfd/coff-m88k.c b/bfd/coff-m88k.c index aa88b99..a8b2c55 100644 --- a/bfd/coff-m88k.c +++ b/bfd/coff-m88k.c @@ -1,6 +1,6 @@ /* BFD back-end for Motorola 88000 COFF "Binary Compatability Standard" files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1997, 1998, 1999, 2000, - 2001, 2002 + 2001, 2002, 2003 Free Software Foundation, Inc. Written by Cygnus Support. @@ -120,7 +120,7 @@ m88k_special_reloc (abfd, reloc_entry, symbol, data, (unsigned char *) data + addr); } - /* If we are not producing relocateable output, return an error if + /* If we are not producing relocatable output, return an error if the symbol is not defined. */ if (bfd_is_und_section (symbol->section) && output_bfd == (bfd *) NULL) return bfd_reloc_undefined; diff --git a/bfd/coff-mcore.c b/bfd/coff-mcore.c index c30f5aa..c4b0735 100644 --- a/bfd/coff-mcore.c +++ b/bfd/coff-mcore.c @@ -1,5 +1,5 @@ /* BFD back-end for Motorola MCore COFF/PE - Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -388,10 +388,10 @@ coff_mcore_relocate_section (output_bfd, info, input_bfd, input_section, bfd_boolean hihalf; bfd_vma hihalf_val; - /* If we are performing a relocateable link, we don't need to do a + /* If we are performing a relocatable link, we don't need to do a thing. The caller will take care of adjusting the reloc addresses and symbol indices. */ - if (info->relocateable) + if (info->relocatable) return TRUE; /* Check if we have the same endianess */ diff --git a/bfd/coff-mips.c b/bfd/coff-mips.c index 6bb1b9f..d6d8218 100644 --- a/bfd/coff-mips.c +++ b/bfd/coff-mips.c @@ -1,6 +1,6 @@ /* BFD back-end for MIPS Extended-Coff files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002 + 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Original version by Per Bothner. Full support added by Ian Lance Taylor, ian@cygnus.com. @@ -551,7 +551,7 @@ mips_adjust_reloc_out (abfd, rel, intern) } /* ECOFF relocs are either against external symbols, or against - sections. If we are producing relocateable output, and the reloc + sections. If we are producing relocatable output, and the reloc is against an external symbol, and nothing has given us any additional addend, the resulting reloc will also be against the same symbol. In such a case, we don't want to change anything @@ -559,7 +559,7 @@ mips_adjust_reloc_out (abfd, rel, intern) final link time. Rather than put special case code into bfd_perform_relocation, all the reloc types use this howto function. It just short circuits the reloc if producing - relocateable output against an external symbol. */ + relocatable output against an external symbol. */ static bfd_reloc_status_type mips_generic_reloc (abfd, @@ -758,7 +758,7 @@ mips_gprel_reloc (abfd, bfd *output_bfd; char **error_message; { - bfd_boolean relocateable; + bfd_boolean relocatable; bfd_vma gp; bfd_vma relocation; unsigned long val; @@ -777,27 +777,27 @@ mips_gprel_reloc (abfd, } if (output_bfd != (bfd *) NULL) - relocateable = TRUE; + relocatable = TRUE; else { - relocateable = FALSE; + relocatable = FALSE; output_bfd = symbol->section->output_section->owner; } - if (bfd_is_und_section (symbol->section) && ! relocateable) + if (bfd_is_und_section (symbol->section) && ! relocatable) return bfd_reloc_undefined; /* We have to figure out the gp value, so that we can adjust the symbol value correctly. We look up the symbol _gp in the output BFD. If we can't find it, we're stuck. We cache it in the ECOFF target data. We don't need to adjust the symbol value for an - external symbol if we are producing relocateable output. */ + external symbol if we are producing relocatable output. */ gp = _bfd_get_gp_value (output_bfd); if (gp == 0 - && (! relocateable + && (! relocatable || (symbol->flags & BSF_SECTION_SYM) != 0)) { - if (relocateable) + if (relocatable) { /* Make up a value. */ gp = symbol->section->output_section->vma + 0x4000; @@ -861,16 +861,16 @@ mips_gprel_reloc (abfd, val -= 0x10000; /* Adjust val for the final section location and GP value. If we - are producing relocateable output, we don't want to do this for + are producing relocatable output, we don't want to do this for an external symbol. */ - if (! relocateable + if (! relocatable || (symbol->flags & BSF_SECTION_SYM) != 0) val += relocation - gp; insn = (insn &~ (unsigned) 0xffff) | (val & 0xffff); bfd_put_32 (abfd, (bfd_vma) insn, (bfd_byte *) data + reloc_entry->address); - if (relocateable) + if (relocatable) reloc_entry->address += input_section->output_offset; /* Make sure it fit in 16 bits. */ @@ -1046,7 +1046,7 @@ mips_rello_reloc (abfd, } /* bfd_perform_relocation does not handle pcrel_offset relocations - correctly when generating a relocateable file, so handle them + correctly when generating a relocatable file, so handle them directly here. */ if (output_bfd != (bfd *) NULL) { @@ -1413,7 +1413,7 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section, and the GP value of OUTPUT_BFD (which is in GP). */ addend = ecoff_data (input_bfd)->gp - gp; } - else if (! info->relocateable + else if (! info->relocatable || h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) { @@ -1432,7 +1432,7 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section, /* This is a relocation against an undefined or common symbol. The current addend in the instruction is simply the desired offset into the symbol (normally - zero). We are generating relocateable output, and we + zero). We are generating relocatable output, and we aren't going to define this symbol, so we just leave the instruction alone. */ addend = 0; @@ -1446,7 +1446,7 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section, if (offsets != NULL && offsets[i] != 0) { - BFD_ASSERT (! info->relocateable); + BFD_ASSERT (! info->relocatable); BFD_ASSERT (int_rel.r_type == MIPS_R_PCREL16 || int_rel.r_type == MIPS_R_RELHI || int_rel.r_type == MIPS_R_RELLO); @@ -1524,9 +1524,9 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section, } } - if (info->relocateable) + if (info->relocatable) { - /* We are generating relocateable output, and must convert + /* We are generating relocatable output, and must convert the existing reloc. */ if (int_rel.r_extern) { @@ -2348,7 +2348,7 @@ bfd_mips_ecoff_create_embedded_relocs (abfd, info, datasec, relsec, errmsg) bfd_byte *p; bfd_size_type amt; - BFD_ASSERT (! info->relocateable); + BFD_ASSERT (! info->relocatable); *errmsg = NULL; diff --git a/bfd/coff-or32.c b/bfd/coff-or32.c index 6bec813..b21cdf3 100644 --- a/bfd/coff-or32.c +++ b/bfd/coff-or32.c @@ -1,5 +1,5 @@ /* BFD back-end for OpenRISC 1000 COFF binaries. - Copyright 2002 Free Software Foundation, Inc. + Copyright 2002, 2003 Free Software Foundation, Inc. Contributed by Ivan Guzvinec <ivang@opencores.org> This file is part of BFD, the Binary File Descriptor library. @@ -360,10 +360,10 @@ coff_or32_relocate_section (output_bfd, info, input_bfd, input_section, bfd_boolean hihalf; bfd_vma hihalf_val; - /* If we are performing a relocateable link, we don't need to do a + /* If we are performing a relocatable link, we don't need to do a thing. The caller will take care of adjusting the reloc addresses and symbol indices. */ - if (info->relocateable) + if (info->relocatable) return TRUE; hihalf = FALSE; diff --git a/bfd/coff-ppc.c b/bfd/coff-ppc.c index 067f2b6..cf54942 100644 --- a/bfd/coff-ppc.c +++ b/bfd/coff-ppc.c @@ -1088,10 +1088,10 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section, bfd_vma relocation; reloc_howto_type *howto = 0; - /* If we are performing a relocateable link, we don't need to do a + /* If we are performing a relocatable link, we don't need to do a thing. The caller will take care of adjusting the reloc addresses and symbol indices. */ - if (info->relocateable) + if (info->relocatable) return TRUE; hihalf = FALSE; @@ -2325,7 +2325,7 @@ ppc_bfd_coff_final_link (abfd, info) || info->strip == strip_some) o->lineno_count += sec->lineno_count; - if (info->relocateable) + if (info->relocatable) o->reloc_count += sec->reloc_count; if (sec->_raw_size > max_contents_size) @@ -2335,7 +2335,7 @@ ppc_bfd_coff_final_link (abfd, info) if (sec->reloc_count > max_reloc_count) max_reloc_count = sec->reloc_count; } - else if (info->relocateable + else if (info->relocatable && (p->type == bfd_section_reloc_link_order || p->type == bfd_symbol_reloc_link_order)) ++o->reloc_count; @@ -2350,9 +2350,9 @@ ppc_bfd_coff_final_link (abfd, info) } } - /* If doing a relocateable link, allocate space for the pointers we + /* If doing a relocatable link, allocate space for the pointers we need to keep. */ - if (info->relocateable) + if (info->relocatable) { unsigned int i; @@ -2401,9 +2401,9 @@ ppc_bfd_coff_final_link (abfd, info) Because of this problem, we also keep the relocs in memory until the end of the link. This wastes memory, - but only when doing a relocateable link, which is not the + but only when doing a relocatable link, which is not the common case. */ - BFD_ASSERT (info->relocateable); + BFD_ASSERT (info->relocatable); amt = o->reloc_count; amt *= sizeof (struct internal_reloc); finfo.section_info[o->target_index].relocs = @@ -2455,7 +2455,7 @@ ppc_bfd_coff_final_link (abfd, info) finfo.linenos = (bfd_byte *) bfd_malloc (amt); finfo.contents = (bfd_byte *) bfd_malloc (max_contents_size); finfo.external_relocs = (bfd_byte *) bfd_malloc (max_reloc_count * relsz); - if (! info->relocateable) + if (! info->relocatable) { amt = max_reloc_count * sizeof (struct internal_reloc); finfo.internal_relocs = (struct internal_reloc *) bfd_malloc (amt); @@ -2467,7 +2467,7 @@ ppc_bfd_coff_final_link (abfd, info) || (finfo.linenos == NULL && max_lineno_count > 0) || (finfo.contents == NULL && max_contents_size > 0) || (finfo.external_relocs == NULL && max_reloc_count > 0) - || (! info->relocateable + || (! info->relocatable && finfo.internal_relocs == NULL && max_reloc_count > 0)) goto error_return; @@ -2602,7 +2602,7 @@ ppc_bfd_coff_final_link (abfd, info) finfo.outsyms = NULL; } - if (info->relocateable) + if (info->relocatable) { /* Now that we have written out all the global symbols, we know the symbol indices to use for relocs against them, and we can diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index 87b80b6..8ba305c 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -1,5 +1,5 @@ /* BFD back-end for IBM RS/6000 "XCOFF" files. - Copyright 1990-1999, 2000, 2001, 2002 + Copyright 1990-1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. FIXME: Can someone provide a transliteration of this name into ASCII? Using the following chars caused a compiler warning on HIUX (so I replaced @@ -3426,7 +3426,7 @@ xcoff_ppc_relocate_section (output_bfd, info, input_bfd, } else if ((0 == (h->flags & (XCOFF_DEF_DYNAMIC | XCOFF_IMPORT))) - && ! info->relocateable) + && ! info->relocatable) { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c index c9997db..6b1468e 100644 --- a/bfd/coff-sh.c +++ b/bfd/coff-sh.c @@ -706,7 +706,7 @@ sh_relax_section (abfd, sec, link_info, again) *again = FALSE; - if (link_info->relocateable + if (link_info->relocatable || (sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0) return TRUE; @@ -2969,7 +2969,7 @@ sh_relocate_section (output_bfd, info, input_bfd, input_section, contents, + sec->output_section->vma + sec->output_offset); } - else if (! info->relocateable) + else if (! info->relocatable) { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, @@ -3024,12 +3024,12 @@ sh_relocate_section (output_bfd, info, input_bfd, input_section, contents, static bfd_byte * sh_coff_get_relocated_section_contents (output_bfd, link_info, link_order, - data, relocateable, symbols) + data, relocatable, symbols) bfd *output_bfd; struct bfd_link_info *link_info; struct bfd_link_order *link_order; bfd_byte *data; - bfd_boolean relocateable; + bfd_boolean relocatable; asymbol **symbols; { asection *input_section = link_order->u.indirect.section; @@ -3040,12 +3040,12 @@ sh_coff_get_relocated_section_contents (output_bfd, link_info, link_order, /* We only need to handle the case of relaxing, or of having a particular set of section contents, specially. */ - if (relocateable + if (relocatable || coff_section_data (input_bfd, input_section) == NULL || coff_section_data (input_bfd, input_section)->contents == NULL) return bfd_generic_get_relocated_section_contents (output_bfd, link_info, link_order, data, - relocateable, + relocatable, symbols); memcpy (data, coff_section_data (input_bfd, input_section)->contents, diff --git a/bfd/coff-tic80.c b/bfd/coff-tic80.c index 7329b7b..c7ec9bd 100644 --- a/bfd/coff-tic80.c +++ b/bfd/coff-tic80.c @@ -1,5 +1,6 @@ /* BFD back-end for Texas Instruments TMS320C80 Multimedia Video Processor (MVP). - Copyright 1996, 1997, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1996, 1997, 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. Written by Fred Fish (fnf@cygnus.com) @@ -576,7 +577,7 @@ coff_tic80_relocate_section (output_bfd, info, input_bfd, + sec->output_offset); } - else if (! info->relocateable) + else if (! info->relocatable) { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c index dcb96dd..c6b1803 100644 --- a/bfd/coff64-rs6000.c +++ b/bfd/coff64-rs6000.c @@ -1,5 +1,5 @@ /* BFD back-end for IBM RS/6000 "XCOFF64" files. - Copyright 2000, 2001, 2002 + Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written Clinton Popetz. Contributed by Cygnus Support. @@ -1277,7 +1277,7 @@ xcoff64_ppc_relocate_section (output_bfd, info, input_bfd, + sec->output_offset); } else if ((0 == (h->flags & (XCOFF_DEF_DYNAMIC | XCOFF_IMPORT))) - && ! info->relocateable) + && ! info->relocatable) { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, diff --git a/bfd/cofflink.c b/bfd/cofflink.c index 4e61388..59b32ed 100644 --- a/bfd/cofflink.c +++ b/bfd/cofflink.c @@ -1,5 +1,5 @@ /* COFF specific linker code. - Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 + Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. @@ -597,9 +597,9 @@ coff_link_add_symbols (abfd, info) sym_hash += sym.n_numaux + 1; } - /* If this is a non-traditional, non-relocateable link, try to + /* If this is a non-traditional, non-relocatable link, try to optimize the handling of any .stab/.stabstr sections. */ - if (! info->relocateable + if (! info->relocatable && ! info->traditional_format && info->hash->creator->flavour == bfd_get_flavour (abfd) && (info->strip != strip_all && info->strip != strip_debugger)) @@ -739,7 +739,7 @@ _bfd_coff_final_link (abfd, info) || info->strip == strip_some) o->lineno_count += sec->lineno_count; - if (info->relocateable) + if (info->relocatable) o->reloc_count += sec->reloc_count; if (sec->_raw_size > max_contents_size) @@ -749,7 +749,7 @@ _bfd_coff_final_link (abfd, info) if (sec->reloc_count > max_reloc_count) max_reloc_count = sec->reloc_count; } - else if (info->relocateable + else if (info->relocatable && (p->type == bfd_section_reloc_link_order || p->type == bfd_symbol_reloc_link_order)) ++o->reloc_count; @@ -782,9 +782,9 @@ _bfd_coff_final_link (abfd, info) } } - /* If doing a relocateable link, allocate space for the pointers we + /* If doing a relocatable link, allocate space for the pointers we need to keep. */ - if (info->relocateable) + if (info->relocatable) { unsigned int i; @@ -830,9 +830,9 @@ _bfd_coff_final_link (abfd, info) Because of this problem, we also keep the relocs in memory until the end of the link. This wastes memory, - but only when doing a relocateable link, which is not the + but only when doing a relocatable link, which is not the common case. */ - BFD_ASSERT (info->relocateable); + BFD_ASSERT (info->relocatable); amt = o->reloc_count; amt *= sizeof (struct internal_reloc); finfo.section_info[o->target_index].relocs = @@ -884,7 +884,7 @@ _bfd_coff_final_link (abfd, info) finfo.contents = (bfd_byte *) bfd_malloc (max_contents_size); amt = max_reloc_count * relsz; finfo.external_relocs = (bfd_byte *) bfd_malloc (amt); - if (! info->relocateable) + if (! info->relocatable) { amt = max_reloc_count * sizeof (struct internal_reloc); finfo.internal_relocs = (struct internal_reloc *) bfd_malloc (amt); @@ -896,7 +896,7 @@ _bfd_coff_final_link (abfd, info) || (finfo.linenos == NULL && max_lineno_count > 0) || (finfo.contents == NULL && max_contents_size > 0) || (finfo.external_relocs == NULL && max_reloc_count > 0) - || (! info->relocateable + || (! info->relocatable && finfo.internal_relocs == NULL && max_reloc_count > 0)) goto error_return; @@ -1033,7 +1033,7 @@ _bfd_coff_final_link (abfd, info) finfo.outsyms = NULL; } - if (info->relocateable && max_output_reloc_count > 0) + if (info->relocatable && max_output_reloc_count > 0) { /* Now that we have written out all the global symbols, we know the symbol indices to use for relocs against them, and we can @@ -1334,8 +1334,8 @@ mark_relocs (finfo, input_bfd) internal_relocs = _bfd_coff_read_internal_relocs (input_bfd, a, FALSE, finfo->external_relocs, - finfo->info->relocateable, - (finfo->info->relocateable + finfo->info->relocatable, + (finfo->info->relocatable ? (finfo->section_info[ a->output_section->target_index ].relocs + a->output_section->reloc_count) : finfo->internal_relocs) ); @@ -1430,7 +1430,7 @@ _bfd_coff_link_input_bfd (finfo, input_bfd) going to be involved in the relocations */ if (( finfo->info->strip != strip_none || finfo->info->discard != discard_none) - && finfo->info->relocateable) + && finfo->info->relocatable) { /* mark the symbol array as 'not-used' */ memset (indexp, 0, obj_raw_syment_count (input_bfd) * sizeof * indexp); @@ -1477,7 +1477,7 @@ _bfd_coff_link_input_bfd (finfo, input_bfd) relocation. */ if ((finfo->info->strip != strip_none || finfo->info->discard != discard_none) - && finfo->info->relocateable) + && finfo->info->relocatable) dont_skip_symbol = *indexp; else dont_skip_symbol = FALSE; @@ -2356,8 +2356,8 @@ _bfd_coff_link_input_bfd (finfo, input_bfd) target_index = o->output_section->target_index; internal_relocs = (_bfd_coff_read_internal_relocs (input_bfd, o, FALSE, finfo->external_relocs, - finfo->info->relocateable, - (finfo->info->relocateable + finfo->info->relocatable, + (finfo->info->relocatable ? (finfo->section_info[target_index].relocs + o->output_section->reloc_count) : finfo->internal_relocs))); @@ -2374,7 +2374,7 @@ _bfd_coff_link_input_bfd (finfo, input_bfd) finfo->sec_ptrs)) return FALSE; - if (finfo->info->relocateable) + if (finfo->info->relocatable) { bfd_vma offset; struct internal_reloc *irelend; @@ -2608,9 +2608,9 @@ _bfd_coff_write_global_sym (h, data) /* When a weak symbol is not overriden by a strong one, turn it into an external symbol when not building a - shared or relocateable object. */ + shared or relocatable object. */ if (! finfo->info->shared - && ! finfo->info->relocateable + && ! finfo->info->relocatable && IS_WEAK_EXTERNAL (finfo->output_bfd, isym)) isym.n_sclass = C_EXT; @@ -2666,7 +2666,7 @@ _bfd_coff_write_global_sym (h, data) if (sec->reloc_count > 0xffff && (! obj_pe (output_bfd) - || finfo->info->relocateable)) + || finfo->info->relocatable)) (*_bfd_error_handler) (_("%s: %s: reloc overflow: 0x%lx > 0xffff"), bfd_get_filename (output_bfd), @@ -2675,7 +2675,7 @@ _bfd_coff_write_global_sym (h, data) if (sec->lineno_count > 0xffff && (! obj_pe (output_bfd) - || finfo->info->relocateable)) + || finfo->info->relocatable)) (*_bfd_error_handler) (_("%s: warning: %s: line number overflow: 0x%lx > 0xffff"), bfd_get_filename (output_bfd), @@ -2938,13 +2938,13 @@ _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd, if (howto == NULL) return FALSE; - /* If we are doing a relocateable link, then we can just ignore + /* If we are doing a relocatable link, then we can just ignore a PC relative reloc that is pcrel_offset. It will already - have the correct value. If this is not a relocateable link, + have the correct value. If this is not a relocatable link, then we should ignore the symbol value. */ if (howto->pc_relative && howto->pcrel_offset) { - if (info->relocateable) + if (info->relocatable) continue; if (sym != NULL && sym->n_scnum != 0) addend += sym->n_value; @@ -2987,7 +2987,7 @@ _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd, else if (h->root.type == bfd_link_hash_undefweak) val = 0; - else if (! info->relocateable) + else if (! info->relocatable) { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, diff --git a/bfd/cpu-ns32k.c b/bfd/cpu-ns32k.c index 1fe67d9..1a12b16 100644 --- a/bfd/cpu-ns32k.c +++ b/bfd/cpu-ns32k.c @@ -1,5 +1,5 @@ /* BFD support for the ns32k architecture. - Copyright 1990, 1991, 1994, 1995, 1998, 2000, 2001, 2002 + Copyright 1990, 1991, 1994, 1995, 1998, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Almost totally rewritten by Ian Dall from initial work by Andrew Cagney. @@ -182,7 +182,7 @@ do_ns32k_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, return bfd_reloc_ok; } - /* If we are not producing relocateable output, return an error if + /* If we are not producing relocatable output, return an error if the symbol is not defined. An undefined weak symbol is considered to have a value of zero (SVR4 ABI, p. 4-27). */ if (symbol->section == &bfd_und_section @@ -236,7 +236,7 @@ do_ns32k_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, include the position of the location; for example, m88kbcs, or ELF. For those targets, pcrel_offset is TRUE. - If we are producing relocateable output, then we must ensure + If we are producing relocatable output, then we must ensure that this reloc will be correctly computed when the final relocation is done. If pcrel_offset is FALSE we want to wind up with the negative of the location within the section, @@ -245,7 +245,7 @@ do_ns32k_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, we do not want to adjust the existing addend at all. FIXME: This seems logical to me, but for the case of - producing relocateable output it is not what the code + producing relocatable output it is not what the code actually does. I don't want to change it, because it seems far too likely that something will break. */ relocation -= @@ -297,7 +297,7 @@ do_ns32k_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, should not have any tests that depend upon the flavour. It's seem like entirely the wrong place for such a thing. The second obvious point is that the current code ignores the - reloc addend when producing relocateable output for COFF. + reloc addend when producing relocatable output for COFF. That's peculiar. In fact, I really have no idea what the point of the line you want to remove is. @@ -315,10 +315,10 @@ do_ns32k_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, (coff-i386 does subtract the old value, to be compatible with existing coff-i386 targets, like SCO). - So everything works fine when not producing relocateable - output. When we are producing relocateable output, logically + So everything works fine when not producing relocatable + output. When we are producing relocatable output, logically we should do exactly what we do when not producing - relocateable output. Therefore, your patch is correct. In + relocatable output. Therefore, your patch is correct. In fact, it should probably always just set reloc_entry->addend to 0 for all cases, since it is, in fact, going to add the value into the object file. This won't hurt the COFF code, @@ -326,7 +326,7 @@ do_ns32k_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, to other formats (the thing to check for would be whether any formats both use the addend and set partial_inplace). - When I wanted to make coff-i386 produce relocateable output, + When I wanted to make coff-i386 produce relocatable output, I ran into the problem that you are running into: I wanted to remove that line. Rather than risk it, I made the coff-i386 relocs use a special function; it's coff_i386_reloc diff --git a/bfd/doc/bfdint.texi b/bfd/doc/bfdint.texi index 27375cd..4566731 100644 --- a/bfd/doc/bfdint.texi +++ b/bfd/doc/bfdint.texi @@ -1,6 +1,6 @@ \input texinfo @c Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, -@c 2000, 2001 +@c 2000, 2001, 2002, 2003 @c Free Software Foundation, Inc. @setfilename bfdint.info @@ -835,7 +835,7 @@ corresponding field in the target vector is named @item _bfd_get_relocated_section_contents Read the contents of a section and apply the relocation information. -This handles both a final link and a relocateable link; in the latter +This handles both a final link and a relocatable link; in the latter case, it adjust the relocation information as well. This is called via @samp{bfd_get_relocated_section_contents}. Most targets implement it by calling @samp{bfd_generic_get_relocated_section_contents}. @@ -1169,7 +1169,7 @@ allocate space in a different section and use the offset within that section as the value to store. In the IEEE object file format, relocations may involve arbitrary expressions. -When doing a relocateable link, the linker may or may not have to do +When doing a relocatable link, the linker may or may not have to do anything with a relocation, depending upon the definition of the relocation. Simple relocations generally do not require any special action. @@ -1240,9 +1240,9 @@ existing target, you need to do the following: @itemize @bullet @item Make sure you clearly understand what the contents of the section should -look like after assembly, after a relocateable link, and after a final +look like after assembly, after a relocatable link, and after a final link. Make sure you clearly understand the operations the linker must -perform during a relocateable link and during a final link. +perform during a relocatable link and during a final link. @item Write a howto structure for the relocation. The howto structure is @@ -1257,7 +1257,7 @@ call @samp{bfd_install_relocation}, so your howto structure has to be able to handle that. You may need to set the @samp{special_function} field to handle assembly correctly. Be careful to ensure that any code you write to handle the assembler will also work correctly when doing a -relocateable link. For example, see @samp{bfd_elf_generic_reloc}. +relocatable link. For example, see @samp{bfd_elf_generic_reloc}. @item Test the assembler. Consider the cases of relocation against an @@ -1271,14 +1271,14 @@ If your target uses the new linker, which is recommended, add any required handling to the target specific relocation function. In simple cases this will just involve a call to @samp{_bfd_final_link_relocate} or @samp{_bfd_relocate_contents}, depending upon the definition of the -relocation and whether the link is relocateable or not. +relocation and whether the link is relocatable or not. @item Test the linker. Test the case of a final link. If the relocation can overflow, use a linker script to force an overflow and make sure the -error is reported correctly. Test a relocateable link, whether the -symbol is defined or undefined in the relocateable output. For both the -final and relocateable link, test the case when the symbol is a common +error is reported correctly. Test a relocatable link, whether the +symbol is defined or undefined in the relocatable output. For both the +final and relocatable link, test the case when the symbol is a common symbol, when the symbol looked like a common symbol but became a defined symbol, when the symbol is defined in a different object file, and when the symbol is defined in the same object file. @@ -1291,7 +1291,7 @@ thing for the relocation. You may need to set the doing a link in which the output object file format is S-records. @item -Using the linker to generate relocateable output in a different object +Using the linker to generate relocatable output in a different object file format is impossible in the general case, so you generally don't have to worry about that. The GNU linker makes sure to stop that from happening when an input file in a different format has relocations. @@ -1350,7 +1350,7 @@ howto structure. Some mechanism would be used to determine which type of howto structure was being used by a particular format. The new howto structure would clearly define the relocation behaviour in -the case of an assembly, a relocateable link, and a final link. At +the case of an assembly, a relocatable link, and a final link. At least one special function would be defined as an escape, and it might make sense to define more. @@ -1566,7 +1566,7 @@ relocations. @samp{Rela} relocations will require more space in object files (but not in executables, except when using dynamic linking). However, this is outweighed by the simplicity of addend handling when using @samp{Rela} relocations. With @samp{Rel} relocations, the addend -must be stored in the section contents, which makes relocateable links +must be stored in the section contents, which makes relocatable links more complex. For example, consider C code like @code{i = a[1000];} where @samp{a} is @@ -1578,7 +1578,7 @@ relocations, that addend must be stored in the instructions themselves. If you are adding support for a RISC chip which uses two or more instructions to load an address, then the addend may not fit in a single instruction, and will have to be somehow split among the instructions. -This makes linking awkward, particularly when doing a relocateable link +This makes linking awkward, particularly when doing a relocatable link in which the addend may have to be updated. It can be done---the MIPS ELF support does it---but it should be avoided when possible. @@ -1645,7 +1645,7 @@ information, and modify the section contents according to the relocation information. In simple cases, this is little more than a loop over the relocations which computes the value of each relocation and calls @samp{_bfd_final_link_relocate}. The function must check for a -relocateable link, and in that case normally needs to do nothing other +relocatable link, and in that case normally needs to do nothing other than adjust the addend for relocations against a section symbol. The complex cases generally have to do with dynamic linker support. GOT diff --git a/bfd/ecoff.c b/bfd/ecoff.c index 4d9b3d4..ce18f54 100644 --- a/bfd/ecoff.c +++ b/bfd/ecoff.c @@ -4160,7 +4160,7 @@ _bfd_ecoff_bfd_final_link (abfd, info) ecoff_link_write_external, (PTR) &einfo); - if (info->relocateable) + if (info->relocatable) { /* We need to make a pass over the link_orders to count up the number of relocations we will need to output, so that we know @@ -4190,7 +4190,7 @@ _bfd_ecoff_bfd_final_link (abfd, info) bfd_ecoff_debug_free (handle, abfd, debug, &backend->debug_swap, info); - if (info->relocateable) + if (info->relocatable) { /* Now reset the reloc_count field of the sections in the output BFD to 0, so that we can use them to keep track of how many @@ -4210,7 +4210,7 @@ _bfd_ecoff_bfd_final_link (abfd, info) ecoff_data (abfd)->gp = (h->u.def.value + h->u.def.section->output_section->vma + h->u.def.section->output_offset); - else if (info->relocateable) + else if (info->relocatable) { bfd_vma lo; @@ -4608,11 +4608,11 @@ ecoff_indirect_link_order (output_bfd, info, output_section, link_order) cooked_size)) goto error_return; - /* If we are producing relocateable output, the relocs were + /* If we are producing relocatable output, the relocs were modified, and we write them out now. We use the reloc_count field of output_section to keep track of the number of relocs we have output so far. */ - if (info->relocateable) + if (info->relocatable) { file_ptr pos = (output_section->rel_filepos + output_section->reloc_count * external_reloc_size); diff --git a/bfd/ecofflink.c b/bfd/ecofflink.c index b74f18a..89edae3 100644 --- a/bfd/ecofflink.c +++ b/bfd/ecofflink.c @@ -1,5 +1,5 @@ /* Routines to link ECOFF debugging information. - Copyright 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002 + Copyright 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>. @@ -526,7 +526,7 @@ bfd_ecoff_debug_init (output_bfd, output_debug, output_swap, info) ainfo->largest_file_shuffle = 0; - if (! info->relocateable) + if (! info->relocatable) { if (! bfd_hash_table_init (&ainfo->str_hash.table, string_hash_newfunc)) return NULL; @@ -559,7 +559,7 @@ bfd_ecoff_debug_free (handle, output_bfd, output_debug, output_swap, info) bfd_hash_table_free (&ainfo->fdr_hash.table); - if (! info->relocateable) + if (! info->relocatable) bfd_hash_table_free (&ainfo->str_hash.table); objalloc_free (ainfo->memory); @@ -879,9 +879,9 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap, /* If we are doing a final link, we hash all the strings in the local symbol table together. This reduces the amount of space required by debugging information. We don't do - this when performing a relocateable link because it would + this when performing a relocatable link because it would prevent us from easily merging different FDR's. */ - if (! info->relocateable) + if (! info->relocatable) { bfd_boolean ffilename; const char *name; @@ -958,7 +958,7 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap, fdr.iauxBase = output_symhdr->iauxMax; output_symhdr->iauxMax += fdr.caux; } - if (! info->relocateable) + if (! info->relocatable) { /* When are are hashing strings, we lie about the number of @@ -1127,7 +1127,7 @@ ecoff_add_string (ainfo, info, debug, fdr, string) symhdr = &debug->symbolic_header; len = strlen (string); - if (info->relocateable) + if (info->relocatable) { if (!add_memory_shuffle (ainfo, &ainfo->ss, &ainfo->ss_end, (PTR) string, len + 1)) @@ -1287,12 +1287,12 @@ bfd_ecoff_debug_accumulate_other (handle, output_bfd, output_debug, this interface, so that must be changed to do something else. */ bfd_boolean -bfd_ecoff_debug_externals (abfd, debug, swap, relocateable, get_extr, +bfd_ecoff_debug_externals (abfd, debug, swap, relocatable, get_extr, set_index) bfd *abfd; struct ecoff_debug_info *debug; const struct ecoff_debug_swap *swap; - bfd_boolean relocateable; + bfd_boolean relocatable; bfd_boolean (*get_extr) PARAMS ((asymbol *, EXTR *)); void (*set_index) PARAMS ((asymbol *, bfd_size_type)); { @@ -1317,7 +1317,7 @@ bfd_ecoff_debug_externals (abfd, debug, swap, relocateable, get_extr, /* If we're producing an executable, move common symbols into bss. */ - if (! relocateable) + if (! relocatable) { if (esym.asym.sc == scCommon) esym.asym.sc = scBss; @@ -1694,7 +1694,7 @@ bfd_ecoff_write_accumulated_debug (handle, abfd, debug, swap, info, where) /* The string table is written out from the hash table if this is a final link. */ - if (info->relocateable) + if (info->relocatable) { BFD_ASSERT (ainfo->ss_hash == (struct string_hash_entry *) NULL); if (! ecoff_write_shuffle (abfd, swap, ainfo->ss, space)) diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index d397307..5e4c180 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -706,7 +706,7 @@ struct elf_backend_data This function is responsible for adjust the section contents as necessary, and (if using Rela relocs and generating a - relocateable output file) adjusting the reloc addend as + relocatable output file) adjusting the reloc addend as necessary. This function does not have to worry about setting the reloc @@ -720,7 +720,7 @@ struct elf_backend_data The global hash table entry for the global symbols can be found via elf_sym_hashes (input_bfd). - When generating relocateable output, this function must handle + When generating relocatable output, this function must handle STB_LOCAL/STT_SECTION symbols specially. The output symbol is going to be the section symbol corresponding to the output section, which means that the addend must be adjusted diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c index 7d0b52b..e422aa9 100644 --- a/bfd/elf-eh-frame.c +++ b/bfd/elf-eh-frame.c @@ -403,7 +403,7 @@ _bfd_elf_discard_section_eh_frame (abfd, info, sec, in which case we can remove it provided we adjust all FDEs. Also, it can be removed if we have removed all FDEs using it. */ - if ((!info->relocateable + if ((!info->relocatable && cie_compare (&cie, &hdr_info->last_cie) == 0) || cie_usage_count == 0) { diff --git a/bfd/elf-hppa.h b/bfd/elf-hppa.h index 5e4458c..f372746 100644 --- a/bfd/elf-hppa.h +++ b/bfd/elf-hppa.h @@ -1,5 +1,5 @@ /* Common code for PA ELF implementations. - Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -1159,7 +1159,7 @@ elf_hppa_unmark_useless_dynamic_symbols (h, data) Ultimately we should have better controls over the generic ELF BFD linker code. */ - if (! info->relocateable + if (! info->relocatable && ! (info->shared && !info->no_undefined) && h->root.type == bfd_link_hash_undefined @@ -1195,7 +1195,7 @@ elf_hppa_remark_useless_dynamic_symbols (h, data) Ultimately we should have better controls over the generic ELF BFD linker code. */ - if (! info->relocateable + if (! info->relocatable && ! (info->shared && !info->no_undefined) && h->root.type == bfd_link_hash_undefined @@ -1265,7 +1265,7 @@ elf_hppa_final_link (abfd, info) bfd_boolean retval; struct elf64_hppa_link_hash_table *hppa_info = elf64_hppa_hash_table (info); - if (! info->relocateable) + if (! info->relocatable) { struct elf_link_hash_entry *gp; bfd_vma gp_val; @@ -1376,7 +1376,7 @@ elf_hppa_relocate_section (output_bfd, info, input_bfd, input_section, Elf_Internal_Rela *relend; struct elf64_hppa_link_hash_table *hppa_info; - if (info->relocateable) + if (info->relocatable) return TRUE; hppa_info = elf64_hppa_hash_table (info); diff --git a/bfd/elf-m10200.c b/bfd/elf-m10200.c index c35adcb..09d7d99 100644 --- a/bfd/elf-m10200.c +++ b/bfd/elf-m10200.c @@ -343,7 +343,7 @@ mn10200_elf_relocate_section (output_bfd, info, input_bfd, input_section, struct elf_link_hash_entry **sym_hashes; Elf_Internal_Rela *rel, *relend; - if (info->relocateable) + if (info->relocatable) return TRUE; symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; @@ -512,10 +512,10 @@ mn10200_elf_relax_section (abfd, sec, link_info, again) /* Assume nothing changes. */ *again = FALSE; - /* We don't have to do anything for a relocateable link, if + /* We don't have to do anything for a relocatable link, if this section does not have relocs, or if this is not a code section. */ - if (link_info->relocateable + if (link_info->relocatable || (sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0 || (sec->flags & SEC_CODE) == 0) @@ -1305,12 +1305,12 @@ mn10200_elf_symbol_address_p (abfd, sec, isym, addr) static bfd_byte * mn10200_elf_get_relocated_section_contents (output_bfd, link_info, link_order, - data, relocateable, symbols) + data, relocatable, symbols) bfd *output_bfd; struct bfd_link_info *link_info; struct bfd_link_order *link_order; bfd_byte *data; - bfd_boolean relocateable; + bfd_boolean relocatable; asymbol **symbols; { Elf_Internal_Shdr *symtab_hdr; @@ -1322,11 +1322,11 @@ mn10200_elf_get_relocated_section_contents (output_bfd, link_info, link_order, /* We only need to handle the case of relaxing, or of having a particular set of section contents, specially. */ - if (relocateable + if (relocatable || elf_section_data (input_section)->this_hdr.contents == NULL) return bfd_generic_get_relocated_section_contents (output_bfd, link_info, link_order, data, - relocateable, + relocatable, symbols); symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index cad2b9c..15d1a33 100644 --- a/bfd/elf-m10300.c +++ b/bfd/elf-m10300.c @@ -350,7 +350,7 @@ mn10300_elf_check_relocs (abfd, info, sec, relocs) const Elf_Internal_Rela *rel; const Elf_Internal_Rela *rel_end; - if (info->relocateable) + if (info->relocatable) return TRUE; symtab_hdr = &elf_tdata (abfd)->symtab_hdr; @@ -550,7 +550,7 @@ mn10300_elf_relocate_section (output_bfd, info, input_bfd, input_section, struct elf32_mn10300_link_hash_entry **sym_hashes; Elf_Internal_Rela *rel, *relend; - if (info->relocateable) + if (info->relocatable) return TRUE; symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; @@ -1334,10 +1334,10 @@ mn10300_elf_relax_section (abfd, sec, link_info, again) /* For error_return. */ section = sec; - /* We don't have to do anything for a relocateable link, if + /* We don't have to do anything for a relocatable link, if this section does not have relocs, or if this is not a code section. */ - if (link_info->relocateable + if (link_info->relocatable || (sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0 || (sec->flags & SEC_CODE) == 0) @@ -2541,12 +2541,12 @@ mn10300_elf_symbol_address_p (abfd, sec, isym, addr) static bfd_byte * mn10300_elf_get_relocated_section_contents (output_bfd, link_info, link_order, - data, relocateable, symbols) + data, relocatable, symbols) bfd *output_bfd; struct bfd_link_info *link_info; struct bfd_link_order *link_order; bfd_byte *data; - bfd_boolean relocateable; + bfd_boolean relocatable; asymbol **symbols; { Elf_Internal_Shdr *symtab_hdr; @@ -2558,11 +2558,11 @@ mn10300_elf_get_relocated_section_contents (output_bfd, link_info, link_order, /* We only need to handle the case of relaxing, or of having a particular set of section contents, specially. */ - if (relocateable + if (relocatable || elf_section_data (input_section)->this_hdr.contents == NULL) return bfd_generic_get_relocated_section_contents (output_bfd, link_info, link_order, data, - relocateable, + relocatable, symbols); symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; @@ -936,7 +936,7 @@ const char *const bfd_elf_section_type_names[] = { "SHT_NOBITS", "SHT_REL", "SHT_SHLIB", "SHT_DYNSYM", }; -/* ELF relocs are against symbols. If we are producing relocateable +/* ELF relocs are against symbols. If we are producing relocatable output, and the reloc is against an external symbol, and nothing has given us any additional addend, the resulting reloc will also be against the same symbol. In such a case, we don't want to @@ -944,7 +944,7 @@ const char *const bfd_elf_section_type_names[] = { all be done at final link time. Rather than put special case code into bfd_perform_relocation, all the reloc types use this howto function. It just short circuits the reloc if producing - relocateable output against an external symbol. */ + relocatable output against an external symbol. */ bfd_reloc_status_type bfd_elf_generic_reloc (abfd, @@ -1838,7 +1838,7 @@ bfd_section_from_shdr (abfd, shindex) SHF_ALLOC is set, and this is a shared object, then we also treat this section as a BFD section. We can not base the decision purely on SHF_ALLOC, because that flag is sometimes - set in a relocateable object file, which would confuse the + set in a relocatable object file, which would confuse the linker. */ if ((hdr->sh_flags & SHF_ALLOC) != 0 && (abfd->flags & DYNAMIC) != 0 diff --git a/bfd/elf32-arm.h b/bfd/elf32-arm.h index ba286b1..e2d66ad 100644 --- a/bfd/elf32-arm.h +++ b/bfd/elf32-arm.h @@ -564,7 +564,7 @@ bfd_elf32_arm_add_glue_sections_to_bfd (abfd, info) /* If we are only performing a partial link do not bother adding the glue. */ - if (info->relocateable) + if (info->relocatable) return TRUE; sec = bfd_get_section_by_name (abfd, ARM2THUMB_GLUE_SECTION_NAME); @@ -620,7 +620,7 @@ bfd_elf32_arm_get_bfd_for_interworking (abfd, info) /* If we are only performing a partial link do not bother getting a bfd to hold the glue. */ - if (info->relocateable) + if (info->relocatable) return TRUE; globals = elf32_arm_hash_table (info); @@ -652,7 +652,7 @@ bfd_elf32_arm_process_before_allocation (abfd, link_info, no_pipeline_knowledge) /* If we are only performing a partial link do not bother to construct any glue. */ - if (link_info->relocateable) + if (link_info->relocatable) return TRUE; /* Here we have a bfd that is to be included on the link. We have a hook @@ -1838,7 +1838,7 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section, const char *name; #if !USE_REL - if (info->relocateable) + if (info->relocatable) return TRUE; #endif @@ -1870,9 +1870,9 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section, howto = bfd_reloc.howto; #if USE_REL - if (info->relocateable) + if (info->relocatable) { - /* This is a relocateable link. We don't have to change + /* This is a relocatable link. We don't have to change anything, unless the reloc is against a section symbol, in which case we have to adjust according to where the section symbol winds up in the output section. */ @@ -2630,7 +2630,7 @@ elf32_arm_check_relocs (abfd, info, sec, relocs) asection *sgot, *srelgot, *sreloc; bfd_vma *local_got_offsets; - if (info->relocateable) + if (info->relocatable) return TRUE; sgot = srelgot = sreloc = NULL; diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c index a701dc9..defa9ce 100644 --- a/bfd/elf32-avr.c +++ b/bfd/elf32-avr.c @@ -1,5 +1,5 @@ /* AVR-specific support for 32-bit ELF - Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by Denis Chertykov <denisc@overta.ru> This file is part of BFD, the Binary File Descriptor library. @@ -455,7 +455,7 @@ elf32_avr_check_relocs (abfd, info, sec, relocs) const Elf_Internal_Rela *rel; const Elf_Internal_Rela *rel_end; - if (info->relocateable) + if (info->relocatable) return TRUE; symtab_hdr = &elf_tdata (abfd)->symtab_hdr; @@ -719,7 +719,7 @@ elf32_avr_relocate_section (output_bfd, info, input_bfd, input_section, Elf_Internal_Rela * rel; Elf_Internal_Rela * relend; - if (info->relocateable) + if (info->relocatable) return TRUE; symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c index 1d278a0..4618a8f 100644 --- a/bfd/elf32-cris.c +++ b/bfd/elf32-cris.c @@ -799,7 +799,7 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section, Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; - if (info->relocateable) + if (info->relocatable) return TRUE; dynobj = elf_hash_table (info)->dynobj; @@ -2274,7 +2274,7 @@ cris_elf_check_relocs (abfd, info, sec, relocs) asection *srelgot; asection *sreloc; - if (info->relocateable) + if (info->relocatable) return TRUE; dynobj = elf_hash_table (info)->dynobj; diff --git a/bfd/elf32-d10v.c b/bfd/elf32-d10v.c index 1d6912a..cc5eddc 100644 --- a/bfd/elf32-d10v.c +++ b/bfd/elf32-d10v.c @@ -1,5 +1,6 @@ /* D10V-specific support for 32-bit ELF - Copyright 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. Contributed by Martin Hunt (hunt@cygnus.com). This file is part of BFD, the Binary File Descriptor library. @@ -303,7 +304,7 @@ elf32_d10v_check_relocs (abfd, info, sec, relocs) const Elf_Internal_Rela *rel; const Elf_Internal_Rela *rel_end; - if (info->relocateable) + if (info->relocatable) return TRUE; symtab_hdr = &elf_tdata (abfd)->symtab_hdr; @@ -388,9 +389,9 @@ elf32_d10v_relocate_section (output_bfd, info, input_bfd, input_section, howto = elf_d10v_howto_table + r_type; - if (info->relocateable) + if (info->relocatable) { - /* This is a relocateable link. We don't have to change + /* This is a relocatable link. We don't have to change anything, unless the reloc is against a section symbol, in which case we have to adjust according to where the section symbol winds up in the output section. */ diff --git a/bfd/elf32-dlx.c b/bfd/elf32-dlx.c index a1f7d0d..1f380e8 100644 --- a/bfd/elf32-dlx.c +++ b/bfd/elf32-dlx.c @@ -1,5 +1,5 @@ /* DLX specific support for 32-bit ELF - Copyright 2002 Free Software Foundation, Inc. + Copyright 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -320,7 +320,7 @@ _bfd_dlx_elf_hi16_reloc (abfd, reloc_entry, symbol, data, return ret; } -/* ELF relocs are against symbols. If we are producing relocateable +/* ELF relocs are against symbols. If we are producing relocatable output, and the reloc is against an external symbol, and nothing has given us any additional addend, the resulting reloc will also be against the same symbol. In such a case, we don't want to @@ -328,7 +328,7 @@ _bfd_dlx_elf_hi16_reloc (abfd, reloc_entry, symbol, data, all be done at final link time. Rather than put special case code into bfd_perform_relocation, all the reloc types use this howto function. It just short circuits the reloc if producing - relocateable output against an external symbol. */ + relocatable output against an external symbol. */ static bfd_reloc_status_type elf32_dlx_relocate16 (abfd, reloc_entry, symbol, data, @@ -532,7 +532,7 @@ elf32_dlx_check_relocs (abfd, info, sec, relocs) const Elf_Internal_Rela *rel; const Elf_Internal_Rela *rel_end; - if (info->relocateable) + if (info->relocatable) return TRUE; symtab_hdr = &elf_tdata (abfd)->symtab_hdr; diff --git a/bfd/elf32-fr30.c b/bfd/elf32-fr30.c index 2311316..c4e2290 100644 --- a/bfd/elf32-fr30.c +++ b/bfd/elf32-fr30.c @@ -1,5 +1,6 @@ /* FR30-specific support for 32-bit ELF. - Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1998, 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -478,7 +479,7 @@ fr30_final_link_relocate (howto, input_bfd, input_section, contents, rel, zero. This function is responsible for adjusting the section contents as - necessary, and (if using Rela relocs and generating a relocateable + necessary, and (if using Rela relocs and generating a relocatable output file) adjusting the reloc addend as necessary. This function does not have to worry about setting the reloc @@ -492,7 +493,7 @@ fr30_final_link_relocate (howto, input_bfd, input_section, contents, rel, The global hash table entry for the global symbols can be found via elf_sym_hashes (input_bfd). - When generating relocateable output, this function must handle + When generating relocatable output, this function must handle STB_LOCAL/STT_SECTION symbols specially. The output symbol is going to be the section symbol corresponding to the output section, which means that the addend must be adjusted @@ -515,7 +516,7 @@ fr30_elf_relocate_section (output_bfd, info, input_bfd, input_section, Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; - if (info->relocateable) + if (info->relocatable) return TRUE; symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; @@ -726,7 +727,7 @@ fr30_elf_check_relocs (abfd, info, sec, relocs) const Elf_Internal_Rela *rel; const Elf_Internal_Rela *rel_end; - if (info->relocateable) + if (info->relocatable) return TRUE; symtab_hdr = &elf_tdata (abfd)->symtab_hdr; diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c index 08dae26..19fb324 100644 --- a/bfd/elf32-frv.c +++ b/bfd/elf32-frv.c @@ -1,5 +1,5 @@ /* FRV-specific support for 32-bit ELF. - Copyright 2002 Free Software Foundation, Inc. + Copyright 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -651,7 +651,7 @@ frv_final_link_relocate (howto, input_bfd, input_section, contents, rel, zero. This function is responsible for adjusting the section contents as - necessary, and (if using Rela relocs and generating a relocateable + necessary, and (if using Rela relocs and generating a relocatable output file) adjusting the reloc addend as necessary. This function does not have to worry about setting the reloc @@ -665,7 +665,7 @@ frv_final_link_relocate (howto, input_bfd, input_section, contents, rel, The global hash table entry for the global symbols can be found via elf_sym_hashes (input_bfd). - When generating relocateable output, this function must handle + When generating relocatable output, this function must handle STB_LOCAL/STT_SECTION symbols specially. The output symbol is going to be the section symbol corresponding to the output section, which means that the addend must be adjusted @@ -688,7 +688,7 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; - if (info->relocateable) + if (info->relocatable) return TRUE; symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; @@ -907,7 +907,7 @@ elf32_frv_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) bfd_vma *valp; { if (sym->st_shndx == SHN_COMMON - && !info->relocateable + && !info->relocatable && (int)sym->st_size <= (int)bfd_get_gp_size (abfd)) { /* Common symbols less than or equal to -G nn bytes are @@ -947,7 +947,7 @@ elf32_frv_check_relocs (abfd, info, sec, relocs) const Elf_Internal_Rela *rel; const Elf_Internal_Rela *rel_end; - if (info->relocateable) + if (info->relocatable) return TRUE; symtab_hdr = &elf_tdata (abfd)->symtab_hdr; diff --git a/bfd/elf32-h8300.c b/bfd/elf32-h8300.c index e4929fb..1b623f2 100644 --- a/bfd/elf32-h8300.c +++ b/bfd/elf32-h8300.c @@ -426,7 +426,7 @@ elf32_h8_relocate_section (output_bfd, info, input_bfd, input_section, struct elf_link_hash_entry **sym_hashes; Elf_Internal_Rela *rel, *relend; - if (info->relocateable) + if (info->relocatable) return TRUE; symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; @@ -706,10 +706,10 @@ elf32_h8_relax_section (abfd, sec, link_info, again) /* Assume nothing changes. */ *again = FALSE; - /* We don't have to do anything for a relocateable link, if + /* We don't have to do anything for a relocatable link, if this section does not have relocs, or if this is not a code section. */ - if (link_info->relocateable + if (link_info->relocatable || (sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0 || (sec->flags & SEC_CODE) == 0) @@ -1378,12 +1378,12 @@ elf32_h8_symbol_address_p (abfd, sec, addr) static bfd_byte * elf32_h8_get_relocated_section_contents (output_bfd, link_info, link_order, - data, relocateable, symbols) + data, relocatable, symbols) bfd *output_bfd; struct bfd_link_info *link_info; struct bfd_link_order *link_order; bfd_byte *data; - bfd_boolean relocateable; + bfd_boolean relocatable; asymbol **symbols; { Elf_Internal_Shdr *symtab_hdr; @@ -1395,11 +1395,11 @@ elf32_h8_get_relocated_section_contents (output_bfd, link_info, link_order, /* We only need to handle the case of relaxing, or of having a particular set of section contents, specially. */ - if (relocateable + if (relocatable || elf_section_data (input_section)->this_hdr.contents == NULL) return bfd_generic_get_relocated_section_contents (output_bfd, link_info, link_order, data, - relocateable, + relocatable, symbols); symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index e448c43..ca3e8e1 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -1214,7 +1214,7 @@ elf32_hppa_check_relocs (abfd, info, sec, relocs) asection *sreloc; asection *stubreloc; - if (info->relocateable) + if (info->relocatable) return TRUE; htab = hppa_link_hash_table (info); @@ -3593,7 +3593,7 @@ elf32_hppa_relocate_section (output_bfd, info, input_bfd, input_section, Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; - if (info->relocateable) + if (info->relocatable) return TRUE; symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c index 8b74baa..2eacb81 100644 --- a/bfd/elf32-i370.c +++ b/bfd/elf32-i370.c @@ -1,5 +1,5 @@ /* i370-specific support for 32-bit ELF - Copyright 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002 + Copyright 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. Hacked by Linas Vepstas for i370 linas@linas.org @@ -971,7 +971,7 @@ i370_elf_check_relocs (abfd, info, sec, relocs) bfd_vma *local_got_offsets; asection *sreloc; - if (info->relocateable) + if (info->relocatable) return TRUE; #ifdef DEBUG @@ -1200,7 +1200,7 @@ i370_elf_finish_dynamic_sections (output_bfd, info) This function is responsible for adjust the section contents as necessary, and (if using Rela relocs and generating a - relocateable output file) adjusting the reloc addend as + relocatable output file) adjusting the reloc addend as necessary. This function does not have to worry about setting the reloc @@ -1214,7 +1214,7 @@ i370_elf_finish_dynamic_sections (output_bfd, info) The global hash table entry for the global symbols can be found via elf_sym_hashes (input_bfd). - When generating relocateable output, this function must handle + When generating relocatable output, this function must handle STB_LOCAL/STT_SECTION symbols specially. The output symbol is going to be the section symbol corresponding to the output section, which means that the addend must be adjusted @@ -1241,7 +1241,7 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section, bfd_vma *local_got_offsets; bfd_boolean ret = TRUE; - if (info->relocateable) + if (info->relocatable) return TRUE; #ifdef DEBUG @@ -1249,7 +1249,7 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section, bfd_archive_filename (input_bfd), bfd_section_name(input_bfd, input_section), (long) input_section->reloc_count, - (info->relocateable) ? " (relocatable)" : ""); + (info->relocatable) ? " (relocatable)" : ""); #endif if (!i370_elf_howto_table[ R_I370_ADDR31 ]) /* Initialize howto table if needed */ diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 16ef09f..3c7bbd9 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -817,7 +817,7 @@ elf_i386_check_relocs (bfd *abfd, const Elf_Internal_Rela *rel_end; asection *sreloc; - if (info->relocateable) + if (info->relocatable) return TRUE; htab = elf_i386_hash_table (info); @@ -2034,7 +2034,7 @@ elf_i386_relocate_section (bfd *output_bfd, r_symndx = ELF32_R_SYM (rel->r_info); - if (info->relocateable) + if (info->relocatable) { bfd_vma val; bfd_byte *where; diff --git a/bfd/elf32-i860.c b/bfd/elf32-i860.c index 74112f1..cec42be 100644 --- a/bfd/elf32-i860.c +++ b/bfd/elf32-i860.c @@ -1,5 +1,5 @@ /* Intel i860 specific support for 32-bit ELF. - Copyright 1993, 1995, 1999, 2000, 2001, 2002 + Copyright 1993, 1995, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Full i860 support contributed by Jason Eckhardt <jle@cygnus.com>. @@ -840,7 +840,7 @@ i860_final_link_relocate (howto, input_bfd, input_section, contents, rel, reloca zero. This function is responsible for adjusting the section contents as - necessary, and (if using Rela relocs and generating a relocateable + necessary, and (if using Rela relocs and generating a relocatable output file) adjusting the reloc addend as necessary. This function does not have to worry about setting the reloc @@ -854,7 +854,7 @@ i860_final_link_relocate (howto, input_bfd, input_section, contents, rel, reloca The global hash table entry for the global symbols can be found via elf_sym_hashes (input_bfd). - When generating relocateable output, this function must handle + When generating relocatable output, this function must handle STB_LOCAL/STT_SECTION symbols specially. The output symbol is going to be the section symbol corresponding to the output section, which means that the addend must be adjusted @@ -876,7 +876,7 @@ elf32_i860_relocate_section (output_bfd, info, input_bfd, input_section, Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; - if (info->relocateable) + if (info->relocatable) return TRUE; symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; diff --git a/bfd/elf32-i960.c b/bfd/elf32-i960.c index 4a1e931..6218e1a 100644 --- a/bfd/elf32-i960.c +++ b/bfd/elf32-i960.c @@ -1,5 +1,5 @@ /* Intel 860 specific support for 32-bit ELF - Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -96,7 +96,7 @@ elf32_i960_info_to_howto_rel (abfd, cache_ptr, dst) cache_ptr->howto = &elf_howto_table[(int) type]; } -/* ELF relocs are against symbols. If we are producing relocateable +/* ELF relocs are against symbols. If we are producing relocatable output, and the reloc is against an external symbol, and nothing has given us any additional addend, the resulting reloc will also be against the same symbol. In such a case, we don't want to @@ -104,7 +104,7 @@ elf32_i960_info_to_howto_rel (abfd, cache_ptr, dst) all be done at final link time. Rather than put special case code into bfd_perform_relocation, all the reloc types use this howto function. It just short circuits the reloc if producing - relocateable output against an external symbol. */ + relocatable output against an external symbol. */ bfd_reloc_status_type elf32_i960_relocate (abfd, diff --git a/bfd/elf32-ip2k.c b/bfd/elf32-ip2k.c index e10e941..4cb28bb 100644 --- a/bfd/elf32-ip2k.c +++ b/bfd/elf32-ip2k.c @@ -834,7 +834,7 @@ ip2k_elf_relax_section (abfd, sec, link_info, again) /* We don't have to do anything for a relocatable link, if this section does not have relocs, or if this is not a code section. */ - if (link_info->relocateable + if (link_info->relocatable || (sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0 || (sec->flags & SEC_CODE) == 0) @@ -1456,7 +1456,7 @@ ip2k_final_link_relocate (howto, input_bfd, input_section, contents, rel, zero. This function is responsible for adjusting the section contents as - necessary, and (if using Rela relocs and generating a relocateable + necessary, and (if using Rela relocs and generating a relocatable output file) adjusting the reloc addend as necessary. This function does not have to worry about setting the reloc @@ -1470,7 +1470,7 @@ ip2k_final_link_relocate (howto, input_bfd, input_section, contents, rel, The global hash table entry for the global symbols can be found via elf_sym_hashes (input_bfd). - When generating relocateable output, this function must handle + When generating relocatable output, this function must handle STB_LOCAL/STT_SECTION symbols specially. The output symbol is going to be the section symbol corresponding to the output section, which means that the addend must be adjusted @@ -1493,7 +1493,7 @@ ip2k_elf_relocate_section (output_bfd, info, input_bfd, input_section, Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; - if (info->relocateable) + if (info->relocatable) return TRUE; symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; diff --git a/bfd/elf32-iq2000.c b/bfd/elf32-iq2000.c index ebdd303..e2a3b17 100644 --- a/bfd/elf32-iq2000.c +++ b/bfd/elf32-iq2000.c @@ -458,7 +458,7 @@ iq2000_elf_check_relocs (abfd, info, sec, relocs) const Elf_Internal_Rela *rel_end; bfd_boolean changed = FALSE; - if (info->relocateable) + if (info->relocatable) return TRUE; symtab_hdr = &elf_tdata (abfd)->symtab_hdr; @@ -531,7 +531,7 @@ iq2000_elf_check_relocs (abfd, info, sec, relocs) zero. This function is responsible for adjusting the section contents as - necessary, and (if using Rela relocs and generating a relocateable + necessary, and (if using Rela relocs and generating a relocatable output file) adjusting the reloc addend as necessary. This function does not have to worry about setting the reloc @@ -545,7 +545,7 @@ iq2000_elf_check_relocs (abfd, info, sec, relocs) The global hash table entry for the global symbols can be found via elf_sym_hashes (input_bfd). - When generating relocateable output, this function must handle + When generating relocatable output, this function must handle STB_LOCAL/STT_SECTION symbols specially. The output symbol is going to be the section symbol corresponding to the output section, which means that the addend must be adjusted diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index 3116ace..34773ce 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -840,7 +840,7 @@ m32r_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) asection **secp; bfd_vma *valp; { - if (! info->relocateable + if (! info->relocatable && (*namep)[0] == '_' && (*namep)[1] == 'S' && strcmp (*namep, "_SDA_BASE_") == 0 && info->hash->creator->flavour == bfd_target_elf_flavour) @@ -903,7 +903,7 @@ m32r_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) symbol value correctly. We look up the symbol _SDA_BASE_ in the output BFD. If we can't find it, we're stuck. We cache it in the ELF target data. We don't need to adjust the symbol value for an - external symbol if we are producing relocateable output. */ + external symbol if we are producing relocatable output. */ static bfd_reloc_status_type m32r_elf_final_sda_base (output_bfd, info, error_message, psb) @@ -948,7 +948,7 @@ m32r_elf_final_sda_base (output_bfd, info, error_message, psb) This function is responsible for adjust the section contents as necessary, and (if using Rela relocs and generating a - relocateable output file) adjusting the reloc addend as + relocatable output file) adjusting the reloc addend as necessary. This function does not have to worry about setting the reloc @@ -962,7 +962,7 @@ m32r_elf_final_sda_base (output_bfd, info, error_message, psb) The global hash table entry for the global symbols can be found via elf_sym_hashes (input_bfd). - When generating relocateable output, this function must handle + When generating relocatable output, this function must handle STB_LOCAL/STT_SECTION symbols specially. The output symbol is going to be the section symbol corresponding to the output section, which means that the addend must be adjusted @@ -987,7 +987,7 @@ m32r_elf_relocate_section (output_bfd, info, input_bfd, input_section, bfd_boolean ret = TRUE; #if !USE_REL - if (info->relocateable) + if (info->relocatable) return TRUE; #endif @@ -1031,9 +1031,9 @@ m32r_elf_relocate_section (output_bfd, info, input_bfd, input_section, r_symndx = ELF32_R_SYM (rel->r_info); #if USE_REL - if (info->relocateable) + if (info->relocatable) { - /* This is a relocateable link. We don't have to change + /* This is a relocatable link. We don't have to change anything, unless the reloc is against a section symbol, in which case we have to adjust according to where the section symbol winds up in the output section. */ @@ -1350,10 +1350,10 @@ m32r_elf_relax_section (abfd, sec, link_info, again) /* Assume nothing changes. */ *again = FALSE; - /* We don't have to do anything for a relocateable link, if + /* We don't have to do anything for a relocatable link, if this section does not have relocs, or if this is not a code section. */ - if (link_info->relocateable + if (link_info->relocatable || (sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0 || (sec->flags & SEC_CODE) == 0 @@ -1744,12 +1744,12 @@ m32r_elf_relax_delete_bytes (abfd, sec, addr, count) static bfd_byte * m32r_elf_get_relocated_section_contents (output_bfd, link_info, link_order, - data, relocateable, symbols) + data, relocatable, symbols) bfd *output_bfd; struct bfd_link_info *link_info; struct bfd_link_order *link_order; bfd_byte *data; - bfd_boolean relocateable; + bfd_boolean relocatable; asymbol **symbols; { Elf_Internal_Shdr *symtab_hdr; @@ -1762,11 +1762,11 @@ m32r_elf_get_relocated_section_contents (output_bfd, link_info, link_order, /* We only need to handle the case of relaxing, or of having a particular set of section contents, specially. */ - if (relocateable + if (relocatable || elf_section_data (input_section)->this_hdr.contents == NULL) return bfd_generic_get_relocated_section_contents (output_bfd, link_info, link_order, data, - relocateable, + relocatable, symbols); symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; @@ -2050,7 +2050,7 @@ m32r_elf_check_relocs (abfd, info, sec, relocs) const Elf_Internal_Rela *rel; const Elf_Internal_Rela *rel_end; - if (info->relocateable) + if (info->relocatable) return TRUE; symtab_hdr = &elf_tdata (abfd)->symtab_hdr; diff --git a/bfd/elf32-m68hc11.c b/bfd/elf32-m68hc11.c index 1b95105..0383907 100644 --- a/bfd/elf32-m68hc11.c +++ b/bfd/elf32-m68hc11.c @@ -687,10 +687,10 @@ m68hc11_elf_relax_section (abfd, sec, link_info, again) /* Assume nothing changes. */ *again = FALSE; - /* We don't have to do anything for a relocateable link, if + /* We don't have to do anything for a relocatable link, if this section does not have relocs, or if this is not a code section. */ - if (link_info->relocateable + if (link_info->relocatable || (sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0 || (sec->flags & SEC_CODE) == 0) diff --git a/bfd/elf32-m68hc1x.c b/bfd/elf32-m68hc1x.c index 176a256..a3def11 100644 --- a/bfd/elf32-m68hc1x.c +++ b/bfd/elf32-m68hc1x.c @@ -956,7 +956,7 @@ elf32_m68hc11_check_relocs (abfd, info, sec, relocs) const Elf_Internal_Rela * rel; const Elf_Internal_Rela * rel_end; - if (info->relocateable) + if (info->relocatable) return TRUE; symtab_hdr = & elf_tdata (abfd)->symtab_hdr; @@ -1152,9 +1152,9 @@ elf32_m68hc11_relocate_section (output_bfd, info, input_bfd, input_section, || r_type == R_M68HC11_GNU_VTINHERIT ) continue; - if (info->relocateable) + if (info->relocatable) { - /* This is a relocateable link. We don't have to change + /* This is a relocatable link. We don't have to change anything, unless the reloc is against a section symbol, in which case we have to adjust according to where the section symbol winds up in the output section. */ diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index 1cf23d6..1320429 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -427,7 +427,7 @@ elf_m68k_check_relocs (abfd, info, sec, relocs) asection *srelgot; asection *sreloc; - if (info->relocateable) + if (info->relocatable) return TRUE; dynobj = elf_hash_table (info)->dynobj; @@ -1358,7 +1358,7 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section, Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; - if (info->relocateable) + if (info->relocatable) return TRUE; dynobj = elf_hash_table (info)->dynobj; @@ -2153,7 +2153,7 @@ bfd_m68k_elf32_create_embedded_relocs (abfd, info, datasec, relsec, errmsg) bfd_byte *p; bfd_size_type amt; - BFD_ASSERT (! info->relocateable); + BFD_ASSERT (! info->relocatable); *errmsg = NULL; diff --git a/bfd/elf32-mcore.c b/bfd/elf32-mcore.c index 927418e..e88f01d 100644 --- a/bfd/elf32-mcore.c +++ b/bfd/elf32-mcore.c @@ -1,5 +1,5 @@ /* Motorola MCore specific support for 32-bit ELF - Copyright 1994, 1995, 1999, 2000, 2001, 2002 + Copyright 1994, 1995, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -367,7 +367,7 @@ mcore_elf_unsupported_reloc (abfd, reloc_entry, symbol, data, input_section, This function is responsible for adjust the section contents as necessary, and (if using Rela relocs and generating a - relocateable output file) adjusting the reloc addend as + relocatable output file) adjusting the reloc addend as necessary. This function does not have to worry about setting the reloc @@ -381,7 +381,7 @@ mcore_elf_unsupported_reloc (abfd, reloc_entry, symbol, data, input_section, The global hash table entry for the global symbols can be found via elf_sym_hashes (input_bfd). - When generating relocateable output, this function must handle + When generating relocatable output, this function must handle STB_LOCAL/STT_SECTION symbols specially. The output symbol is going to be the section symbol corresponding to the output section, which means that the addend must be adjusted @@ -411,10 +411,10 @@ mcore_elf_relocate_section (output_bfd, info, input_bfd, input_section, bfd_archive_filename (input_bfd), bfd_section_name(input_bfd, input_section), (long) input_section->reloc_count, - (info->relocateable) ? " (relocatable)" : ""); + (info->relocatable) ? " (relocatable)" : ""); #endif - if (info->relocateable) + if (info->relocatable) return TRUE; if (! mcore_elf_howto_table [R_MCORE_PCRELIMM8BY4]) /* Initialize howto table if needed */ @@ -637,7 +637,7 @@ mcore_elf_check_relocs (abfd, info, sec, relocs) const Elf_Internal_Rela * rel; const Elf_Internal_Rela * rel_end; - if (info->relocateable) + if (info->relocatable) return TRUE; symtab_hdr = & elf_tdata (abfd)->symtab_hdr; diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c index 67688c9..47002d5 100644 --- a/bfd/elf32-mips.c +++ b/bfd/elf32-mips.c @@ -803,21 +803,21 @@ mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, input_section, if (strcmp (bfd_asymbol_name (symbol), "_gp_disp") == 0) { - bfd_boolean relocateable; + bfd_boolean relocatable; bfd_vma gp; if (ret == bfd_reloc_undefined) abort (); if (output_bfd != NULL) - relocateable = TRUE; + relocatable = TRUE; else { - relocateable = FALSE; + relocatable = FALSE; output_bfd = symbol->section->output_section->owner; } - ret = mips_elf_final_gp (output_bfd, symbol, relocateable, + ret = mips_elf_final_gp (output_bfd, symbol, relocatable, error_message, &gp); if (ret != bfd_reloc_ok) return ret; @@ -1053,18 +1053,18 @@ mips_elf_assign_gp (output_bfd, pgp) symbol value correctly. We look up the symbol _gp in the output BFD. If we can't find it, we're stuck. We cache it in the ELF target data. We don't need to adjust the symbol value for an - external symbol if we are producing relocateable output. */ + external symbol if we are producing relocatable output. */ static bfd_reloc_status_type -mips_elf_final_gp (output_bfd, symbol, relocateable, error_message, pgp) +mips_elf_final_gp (output_bfd, symbol, relocatable, error_message, pgp) bfd *output_bfd; asymbol *symbol; - bfd_boolean relocateable; + bfd_boolean relocatable; char **error_message; bfd_vma *pgp; { if (bfd_is_und_section (symbol->section) - && ! relocateable) + && ! relocatable) { *pgp = 0; return bfd_reloc_undefined; @@ -1072,10 +1072,10 @@ mips_elf_final_gp (output_bfd, symbol, relocateable, error_message, pgp) *pgp = _bfd_get_gp_value (output_bfd); if (*pgp == 0 - && (! relocateable + && (! relocatable || (symbol->flags & BSF_SECTION_SYM) != 0)) { - if (relocateable) + if (relocatable) { /* Make up a value. */ *pgp = symbol->section->output_section->vma + 0x4000; @@ -1109,7 +1109,7 @@ _bfd_mips_elf32_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section, bfd *output_bfd; char **error_message; { - bfd_boolean relocateable; + bfd_boolean relocatable; bfd_reloc_status_type ret; bfd_vma gp; @@ -1124,20 +1124,20 @@ _bfd_mips_elf32_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section, } if (output_bfd != (bfd *) NULL) - relocateable = TRUE; + relocatable = TRUE; else { - relocateable = FALSE; + relocatable = FALSE; output_bfd = symbol->section->output_section->owner; } - ret = mips_elf_final_gp (output_bfd, symbol, relocateable, error_message, + ret = mips_elf_final_gp (output_bfd, symbol, relocatable, error_message, &gp); if (ret != bfd_reloc_ok) return ret; return _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry, - input_section, relocateable, + input_section, relocatable, data, gp); } @@ -1155,7 +1155,7 @@ mips_elf_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, bfd *output_bfd; char **error_message; { - bfd_boolean relocateable; + bfd_boolean relocatable; bfd_reloc_status_type ret; bfd_vma gp; @@ -1171,30 +1171,30 @@ mips_elf_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, } if (output_bfd != (bfd *) NULL) - relocateable = TRUE; + relocatable = TRUE; else { - relocateable = FALSE; + relocatable = FALSE; output_bfd = symbol->section->output_section->owner; } - ret = mips_elf_final_gp (output_bfd, symbol, relocateable, + ret = mips_elf_final_gp (output_bfd, symbol, relocatable, error_message, &gp); if (ret != bfd_reloc_ok) return ret; return gprel32_with_gp (abfd, symbol, reloc_entry, input_section, - relocateable, data, gp); + relocatable, data, gp); } static bfd_reloc_status_type -gprel32_with_gp (abfd, symbol, reloc_entry, input_section, relocateable, data, +gprel32_with_gp (abfd, symbol, reloc_entry, input_section, relocatable, data, gp) bfd *abfd; asymbol *symbol; arelent *reloc_entry; asection *input_section; - bfd_boolean relocateable; + bfd_boolean relocatable; PTR data; bfd_vma gp; { @@ -1219,9 +1219,9 @@ gprel32_with_gp (abfd, symbol, reloc_entry, input_section, relocateable, data, val += bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); /* Adjust val for the final section location and GP value. If we - are producing relocateable output, we don't want to do this for + are producing relocatable output, we don't want to do this for an external symbol. */ - if (! relocateable + if (! relocatable || (symbol->flags & BSF_SECTION_SYM) != 0) val += relocation - gp; @@ -1230,7 +1230,7 @@ gprel32_with_gp (abfd, symbol, reloc_entry, input_section, relocateable, data, else reloc_entry->addend = val; - if (relocateable) + if (relocatable) reloc_entry->address += input_section->output_offset; return bfd_reloc_ok; @@ -1331,7 +1331,7 @@ mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, bfd *output_bfd; char **error_message; { - bfd_boolean relocateable; + bfd_boolean relocatable; bfd_reloc_status_type ret; bfd_vma gp; unsigned short extend = 0; @@ -1350,14 +1350,14 @@ mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, } if (output_bfd != NULL) - relocateable = TRUE; + relocatable = TRUE; else { - relocateable = FALSE; + relocatable = FALSE; output_bfd = symbol->section->output_section->owner; } - ret = mips_elf_final_gp (output_bfd, symbol, relocateable, error_message, + ret = mips_elf_final_gp (output_bfd, symbol, relocatable, error_message, &gp); if (ret != bfd_reloc_ok) return ret; @@ -1387,9 +1387,9 @@ mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, _bfd_mips_elf_sign_extend(val, 16); /* Adjust val for the final section location and GP value. If we - are producing relocateable output, we don't want to do this for + are producing relocatable output, we don't want to do this for an external symbol. */ - if (! relocateable + if (! relocatable || (symbol->flags & BSF_SECTION_SYM) != 0) val += relocation - gp; @@ -1408,7 +1408,7 @@ mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, else reloc_entry->addend = val; - if (relocateable) + if (relocatable) reloc_entry->address += input_section->output_offset; else if (((val & ~0xffff) != ~0xffff) && ((val & ~0xffff) != 0)) return bfd_reloc_overflow; @@ -1729,7 +1729,7 @@ bfd_mips_elf32_create_embedded_relocs (abfd, info, datasec, relsec, errmsg) Elf_Internal_Rela *irel, *irelend; bfd_byte *p; - BFD_ASSERT (! info->relocateable); + BFD_ASSERT (! info->relocatable); *errmsg = NULL; diff --git a/bfd/elf32-msp430.c b/bfd/elf32-msp430.c index 694a30f..23f5069 100644 --- a/bfd/elf32-msp430.c +++ b/bfd/elf32-msp430.c @@ -1,5 +1,5 @@ /* MSP430-specific support for 32-bit ELF - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2003 Free Software Foundation, Inc. Contributed by Dmitry Diky <diwil@mail.ru> This file is part of BFD, the Binary File Descriptor library. @@ -278,7 +278,7 @@ elf32_msp430_check_relocs (abfd, info, sec, relocs) const Elf_Internal_Rela *rel; const Elf_Internal_Rela *rel_end; - if (info->relocateable) + if (info->relocatable) return TRUE; symtab_hdr = &elf_tdata (abfd)->symtab_hdr; diff --git a/bfd/elf32-openrisc.c b/bfd/elf32-openrisc.c index 8e8d0bc..a9b6d1d 100644 --- a/bfd/elf32-openrisc.c +++ b/bfd/elf32-openrisc.c @@ -1,5 +1,5 @@ /* OpenRISC-specific support for 32-bit ELF. - Copyright 2001, 2002 Free Software Foundation, Inc. + Copyright 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by Johan Rydberg, jrydberg@opencores.org This file is part of BFD, the Binary File Descriptor library. @@ -298,7 +298,7 @@ openrisc_final_link_relocate (howto, input_bfd, input_section, contents, rel, zero. This function is responsible for adjusting the section contents as - necessary, and (if using Rela relocs and generating a relocateable + necessary, and (if using Rela relocs and generating a relocatable output file) adjusting the reloc addend as necessary. This function does not have to worry about setting the reloc @@ -312,7 +312,7 @@ openrisc_final_link_relocate (howto, input_bfd, input_section, contents, rel, The global hash table entry for the global symbols can be found via elf_sym_hashes (input_bfd). - When generating relocateable output, this function must handle + When generating relocatable output, this function must handle STB_LOCAL/STT_SECTION symbols specially. The output symbol is going to be the section symbol corresponding to the output section, which means that the addend must be adjusted @@ -335,7 +335,7 @@ openrisc_elf_relocate_section (output_bfd, info, input_bfd, input_section, Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; - if (info->relocateable) + if (info->relocatable) return TRUE; symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; @@ -529,7 +529,7 @@ openrisc_elf_check_relocs (abfd, info, sec, relocs) const Elf_Internal_Rela *rel; const Elf_Internal_Rela *rel_end; - if (info->relocateable) + if (info->relocatable) return TRUE; symtab_hdr = &elf_tdata (abfd)->symtab_hdr; diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index a7ccfed..884415e 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -3085,7 +3085,7 @@ ppc_elf_check_relocs (bfd *abfd, const Elf_Internal_Rela *rel_end; asection *sreloc; - if (info->relocateable) + if (info->relocatable) return TRUE; #ifdef DEBUG @@ -3716,7 +3716,7 @@ ppc_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, asection *sec; struct ppc_elf_link_hash_table *htab; - if (info->relocateable || info->shared) + if (info->relocatable || info->shared) return TRUE; htab = ppc_elf_hash_table (info); @@ -3911,7 +3911,7 @@ ppc_elf_add_symbol_hook (bfd *abfd, bfd_vma *valp) { if (sym->st_shndx == SHN_COMMON - && !info->relocateable + && !info->relocatable && sym->st_size <= elf_gp_size (abfd) && info->hash->creator->flavour == bfd_target_elf_flavour) { @@ -4148,7 +4148,7 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd, This function is responsible for adjust the section contents as necessary, and (if using Rela relocs and generating a - relocateable output file) adjusting the reloc addend as + relocatable output file) adjusting the reloc addend as necessary. This function does not have to worry about setting the reloc @@ -4162,7 +4162,7 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd, The global hash table entry for the global symbols can be found via elf_sym_hashes (input_bfd). - When generating relocateable output, this function must handle + When generating relocatable output, this function must handle STB_LOCAL/STT_SECTION symbols specially. The output symbol is going to be the section symbol corresponding to the output section, which means that the addend must be adjusted @@ -4195,10 +4195,10 @@ ppc_elf_relocate_section (bfd *output_bfd, bfd_archive_filename (input_bfd), bfd_section_name(input_bfd, input_section), (long) input_section->reloc_count, - (info->relocateable) ? " (relocatable)" : ""); + (info->relocatable) ? " (relocatable)" : ""); #endif - if (info->relocateable) + if (info->relocatable) return TRUE; if (!ppc_elf_howto_table[R_PPC_ADDR32]) diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index 97be1db..50d430d 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -895,7 +895,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs) bfd_signed_vma *local_got_refcounts; int tls_type, old_tls_type; - if (info->relocateable) + if (info->relocatable) return TRUE; htab = elf_s390_hash_table (info); @@ -2198,7 +2198,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; - if (info->relocateable) + if (info->relocatable) return TRUE; htab = elf_s390_hash_table (info); diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index 2042c34..af8dd67 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -2034,7 +2034,7 @@ sh_elf_relax_section (abfd, sec, link_info, again) *again = FALSE; - if (link_info->relocateable + if (link_info->relocatable || (sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0) return TRUE; @@ -4650,9 +4650,9 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, (info, _("Unexpected STO_SH5_ISA32 on local symbol is not handled"), input_bfd, input_section, rel->r_offset)); - if (info->relocateable) + if (info->relocatable) { - /* This is a relocateable link. We don't have to change + /* This is a relocatable link. We don't have to change anything, unless the reloc is against a section symbol, in which case we have to adjust according to where the section symbol winds up in the output section. */ @@ -4721,8 +4721,8 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, { /* Section symbol are never (?) placed in the hash table, so we can just ignore hash relocations when creating a - relocateable object file. */ - if (info->relocateable) + relocatable object file. */ + if (info->relocatable) continue; h = sym_hashes[r_symndx - symtab_hdr->sh_info]; @@ -5718,12 +5718,12 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, static bfd_byte * sh_elf_get_relocated_section_contents (output_bfd, link_info, link_order, - data, relocateable, symbols) + data, relocatable, symbols) bfd *output_bfd; struct bfd_link_info *link_info; struct bfd_link_order *link_order; bfd_byte *data; - bfd_boolean relocateable; + bfd_boolean relocatable; asymbol **symbols; { Elf_Internal_Shdr *symtab_hdr; @@ -5735,11 +5735,11 @@ sh_elf_get_relocated_section_contents (output_bfd, link_info, link_order, /* We only need to handle the case of relaxing, or of having a particular set of section contents, specially. */ - if (relocateable + if (relocatable || elf_section_data (input_section)->this_hdr.contents == NULL) return bfd_generic_get_relocated_section_contents (output_bfd, link_info, link_order, data, - relocateable, + relocatable, symbols); symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; @@ -6211,7 +6211,7 @@ sh_elf_check_relocs (abfd, info, sec, relocs) srelgot = NULL; sreloc = NULL; - if (info->relocateable) + if (info->relocatable) return TRUE; symtab_hdr = &elf_tdata (abfd)->symtab_hdr; diff --git a/bfd/elf32-sh64.c b/bfd/elf32-sh64.c index 1a2acc1..4728842 100644 --- a/bfd/elf32-sh64.c +++ b/bfd/elf32-sh64.c @@ -403,11 +403,11 @@ sh64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) { struct elf_link_hash_entry *h; - /* For relocateable links, we register the DataLabel sym in its own + /* For relocatable links, we register the DataLabel sym in its own right, and tweak the name when it's output. Otherwise, we make an indirect symbol of it. */ flagword flags - = info->relocateable || info->emitrelocations + = info->relocatable || info->emitrelocations ? BSF_GLOBAL : BSF_GLOBAL | BSF_INDIRECT; char *dl_name @@ -451,9 +451,9 @@ sh64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) free (dl_name); if (h->type != STT_DATALABEL - || ((info->relocateable || info->emitrelocations) + || ((info->relocatable || info->emitrelocations) && h->root.type != bfd_link_hash_undefined) - || (! info->relocateable && !info->emitrelocations + || (! info->relocatable && !info->emitrelocations && h->root.type != bfd_link_hash_indirect)) { /* Make sure we don't get confused on invalid input. */ @@ -498,7 +498,7 @@ sh64_elf_link_output_symbol_hook (abfd, info, cname, sym, input_sec) { char *name = (char *) cname; - if (info->relocateable || info->emitrelocations) + if (info->relocatable || info->emitrelocations) { if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL) name[strlen (name) - strlen (DATALABEL_SUFFIX)] = 0; diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c index 5f1bec5..83d4c47 100644 --- a/bfd/elf32-sparc.c +++ b/bfd/elf32-sparc.c @@ -862,7 +862,7 @@ elf32_sparc_check_relocs (abfd, info, sec, relocs) asection *sreloc; bfd_boolean checked_tlsgd = FALSE; - if (info->relocateable) + if (info->relocatable) return TRUE; htab = elf32_sparc_hash_table (info); @@ -2126,7 +2126,7 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section, Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; - if (info->relocateable) + if (info->relocatable) return TRUE; htab = elf32_sparc_hash_table (info); diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c index 99c0077..e41d0c0 100644 --- a/bfd/elf32-v850.c +++ b/bfd/elf32-v850.c @@ -652,7 +652,7 @@ v850_elf_check_relocs (abfd, info, sec, relocs) int other = 0; const char *common = (const char *)0; - if (info->relocateable) + if (info->relocatable) return TRUE; #ifdef DEBUG @@ -1632,7 +1632,7 @@ v850_elf_relocate_section (output_bfd, info, input_bfd, input_section, Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; - if (info->relocateable) + if (info->relocatable) return TRUE; symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; @@ -2520,7 +2520,7 @@ v850_elf_relax_section (abfd, sec, link_info, again) *again = FALSE; - if (link_info->relocateable + if (link_info->relocatable || (sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0) return TRUE; diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c index 1aca042..3ad9747 100644 --- a/bfd/elf32-vax.c +++ b/bfd/elf32-vax.c @@ -578,7 +578,7 @@ elf_vax_check_relocs (abfd, info, sec, relocs) asection *srelgot; asection *sreloc; - if (info->relocateable) + if (info->relocatable) return TRUE; dynobj = elf_hash_table (info)->dynobj; @@ -1440,7 +1440,7 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section, Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; - if (info->relocateable) + if (info->relocatable) return TRUE; dynobj = elf_hash_table (info)->dynobj; diff --git a/bfd/elf32-xstormy16.c b/bfd/elf32-xstormy16.c index c05c186..af9a048 100644 --- a/bfd/elf32-xstormy16.c +++ b/bfd/elf32-xstormy16.c @@ -1,5 +1,5 @@ /* XSTORMY16-specific support for 32-bit ELF. - Copyright 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -423,7 +423,7 @@ xstormy16_elf_check_relocs (abfd, info, sec, relocs) asection *splt; bfd *dynobj; - if (info->relocateable) + if (info->relocatable) return TRUE; symtab_hdr = &elf_tdata(abfd)->symtab_hdr; @@ -609,7 +609,7 @@ xstormy16_elf_relax_section (dynobj, splt, info, again) /* Assume nothing changes. */ *again = FALSE; - if (info->relocateable) + if (info->relocatable) return TRUE; /* We only relax the .plt section at the moment. */ @@ -739,7 +739,7 @@ xstormy16_elf_always_size_sections (output_bfd, info) bfd *dynobj; asection *splt; - if (info->relocateable) + if (info->relocatable) return TRUE; dynobj = elf_hash_table (info)->dynobj; @@ -766,7 +766,7 @@ xstormy16_elf_always_size_sections (output_bfd, info) zero. This function is responsible for adjusting the section contents as - necessary, and (if using Rela relocs and generating a relocateable + necessary, and (if using Rela relocs and generating a relocatable output file) adjusting the reloc addend as necessary. This function does not have to worry about setting the reloc @@ -780,7 +780,7 @@ xstormy16_elf_always_size_sections (output_bfd, info) The global hash table entry for the global symbols can be found via elf_sym_hashes (input_bfd). - When generating relocateable output, this function must handle + When generating relocatable output, this function must handle STB_LOCAL/STT_SECTION symbols specially. The output symbol is going to be the section symbol corresponding to the output section, which means that the addend must be adjusted @@ -805,7 +805,7 @@ xstormy16_elf_relocate_section (output_bfd, info, input_bfd, input_section, bfd *dynobj; asection *splt; - if (info->relocateable) + if (info->relocatable) return TRUE; symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c index b277540..1f8d86d 100644 --- a/bfd/elf32-xtensa.c +++ b/bfd/elf32-xtensa.c @@ -127,7 +127,7 @@ static char *build_encoding_error_message PARAMS ((xtensa_opcode, xtensa_encode_result)); static bfd_reloc_status_type bfd_elf_xtensa_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static void do_fix_for_relocateable_link +static void do_fix_for_relocatable_link PARAMS ((Elf_Internal_Rela *, bfd *, asection *)); static void do_fix_for_final_link PARAMS ((Elf_Internal_Rela *, asection *, bfd_vma *)); @@ -609,7 +609,7 @@ elf_xtensa_check_relocs (abfd, info, sec, relocs) property_table_entry *lit_table; int ltblsize; - if (info->relocateable) + if (info->relocatable) return TRUE; symtab_hdr = &elf_tdata (abfd)->symtab_hdr; @@ -1662,7 +1662,7 @@ bfd_elf_xtensa_reloc (abfd, reloc_entry, symbol, data, input_section, asection *reloc_target_output_section; bfd_boolean is_weak_undef; - /* ELF relocs are against symbols. If we are producing relocateable + /* ELF relocs are against symbols. If we are producing relocatable output, and the reloc is against an external symbol, the resulting reloc will also be against the same symbol. In such a case, we don't want to change anything about the way the reloc is handled, @@ -1841,7 +1841,7 @@ xtensa_elf_dynamic_symbol_p (info, h) /* Relocate an Xtensa ELF section. This is invoked by the linker for - both relocateable and final links. */ + both relocatable and final links. */ static bfd_boolean elf_xtensa_relocate_section (output_bfd, info, input_bfd, @@ -1909,9 +1909,9 @@ elf_xtensa_relocate_section (output_bfd, info, input_bfd, r_symndx = ELF32_R_SYM (rel->r_info); - if (info->relocateable) + if (info->relocatable) { - /* This is a relocateable link. + /* This is a relocatable link. 1) If the reloc is against a section symbol, adjust according to the output section. 2) If there is a new target for this relocation, @@ -1922,7 +1922,7 @@ elf_xtensa_relocate_section (output_bfd, info, input_bfd, if (relaxing_section) { /* Check if this references a section in another input file. */ - do_fix_for_relocateable_link (rel, input_bfd, input_section); + do_fix_for_relocatable_link (rel, input_bfd, input_section); r_type = ELF32_R_TYPE (rel->r_info); } @@ -1934,7 +1934,7 @@ elf_xtensa_relocate_section (output_bfd, info, input_bfd, r_type = ELF32_R_TYPE (rel->r_info); } - /* This is a relocateable link, so we don't have to change + /* This is a relocatable link, so we don't have to change anything unless the reloc is against a section symbol, in which case we have to adjust according to where the section symbol winds up in the output section. */ @@ -1950,7 +1950,7 @@ elf_xtensa_relocate_section (output_bfd, info, input_bfd, /* If there is an addend with a partial_inplace howto, then move the addend to the contents. This is a hack - to work around problems with DWARF in relocateable links + to work around problems with DWARF in relocatable links with some previous version of BFD. Now we can't easily get rid of the hack without breaking backward compatibility.... */ if (rel->r_addend) @@ -1973,7 +1973,7 @@ elf_xtensa_relocate_section (output_bfd, info, input_bfd, } } - /* Done with work for relocateable link; continue with next reloc. */ + /* Done with work for relocatable link; continue with next reloc. */ continue; } @@ -2465,7 +2465,7 @@ elf_xtensa_finish_dynamic_sections (output_bfd, info) } /* Combine adjacent literal table entries. */ - BFD_ASSERT (! info->relocateable); + BFD_ASSERT (! info->relocatable); num_xtlit_entries = elf_xtensa_combine_prop_entries (output_bfd, ".xt.lit"); if (num_xtlit_entries < 0) return FALSE; @@ -4431,10 +4431,10 @@ is_resolvable_asm_expansion (abfd, sec, contents, irel, link_info, if (!target_sec->output_section) return FALSE; - /* For relocateable sections, we can only simplify when the output + /* For relocatable sections, we can only simplify when the output section of the target is the same as the output section of the source. */ - if (link_info->relocateable + if (link_info->relocatable && (target_sec->output_section != sec->output_section)) return FALSE; @@ -5345,7 +5345,7 @@ relax_section_symbols (abfd, sec) /* "Fix" handling functions, called while performing relocations. */ static void -do_fix_for_relocateable_link (rel, input_bfd, input_section) +do_fix_for_relocatable_link (rel, input_bfd, input_section) Elf_Internal_Rela *rel; bfd *input_bfd; asection *input_section; diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index 58ab6ba..767d89c 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -2058,7 +2058,7 @@ elf64_alpha_relax_section (abfd, sec, link_info, again) /* We are not currently changing any sizes, so only one pass. */ *again = FALSE; - if (link_info->relocateable + if (link_info->relocatable || (sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0) return TRUE; @@ -2465,7 +2465,7 @@ elf64_alpha_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) bfd_vma *valp; { if (sym->st_shndx == SHN_COMMON - && !info->relocateable + && !info->relocatable && sym->st_size <= elf_gp_size (abfd)) { /* Common symbols less than or equal to -G nn bytes are @@ -3057,7 +3057,7 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs) bfd_boolean got_created; bfd_size_type amt; - if (info->relocateable) + if (info->relocatable) return TRUE; dynobj = elf_hash_table(info)->dynobj; @@ -3863,7 +3863,7 @@ elf64_alpha_always_size_sections (output_bfd, info) { bfd *i; - if (info->relocateable) + if (info->relocatable) return TRUE; /* First, take care of the indirect symbols created by versioning. */ @@ -4330,7 +4330,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, const char *section_name; /* Handle relocatable links with a smaller loop. */ - if (info->relocateable) + if (info->relocatable) return elf64_alpha_relocate_section_r (output_bfd, info, input_bfd, input_section, contents, relocs, local_syms, local_sections); diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c index 8ce5b20..4c88a54 100644 --- a/bfd/elf64-hppa.c +++ b/bfd/elf64-hppa.c @@ -599,7 +599,7 @@ elf64_hppa_check_relocs (abfd, info, sec, relocs) size_t buf_len; int sec_symndx; - if (info->relocateable) + if (info->relocatable) return TRUE; /* If this is the first dynamic object found in the link, create diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c index baf030a..bec1aca 100644 --- a/bfd/elf64-mips.c +++ b/bfd/elf64-mips.c @@ -1556,18 +1556,18 @@ mips_elf64_assign_gp (output_bfd, pgp) symbol value correctly. We look up the symbol _gp in the output BFD. If we can't find it, we're stuck. We cache it in the ELF target data. We don't need to adjust the symbol value for an - external symbol if we are producing relocateable output. */ + external symbol if we are producing relocatable output. */ static bfd_reloc_status_type -mips_elf64_final_gp (output_bfd, symbol, relocateable, error_message, pgp) +mips_elf64_final_gp (output_bfd, symbol, relocatable, error_message, pgp) bfd *output_bfd; asymbol *symbol; - bfd_boolean relocateable; + bfd_boolean relocatable; char **error_message; bfd_vma *pgp; { if (bfd_is_und_section (symbol->section) - && ! relocateable) + && ! relocatable) { *pgp = 0; return bfd_reloc_undefined; @@ -1575,10 +1575,10 @@ mips_elf64_final_gp (output_bfd, symbol, relocateable, error_message, pgp) *pgp = _bfd_get_gp_value (output_bfd); if (*pgp == 0 - && (! relocateable + && (! relocatable || (symbol->flags & BSF_SECTION_SYM) != 0)) { - if (relocateable) + if (relocatable) { /* Make up a value. */ *pgp = symbol->section->output_section->vma /*+ 0x4000*/; @@ -1609,7 +1609,7 @@ mips_elf64_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section, bfd *output_bfd; char **error_message; { - bfd_boolean relocateable; + bfd_boolean relocatable; bfd_reloc_status_type ret; bfd_vma gp; @@ -1624,20 +1624,20 @@ mips_elf64_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section, } if (output_bfd != (bfd *) NULL) - relocateable = TRUE; + relocatable = TRUE; else { - relocateable = FALSE; + relocatable = FALSE; output_bfd = symbol->section->output_section->owner; } - ret = mips_elf64_final_gp (output_bfd, symbol, relocateable, error_message, + ret = mips_elf64_final_gp (output_bfd, symbol, relocatable, error_message, &gp); if (ret != bfd_reloc_ok) return ret; return _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry, - input_section, relocateable, + input_section, relocatable, data, gp); } @@ -1654,7 +1654,7 @@ mips_elf64_literal_reloc (abfd, reloc_entry, symbol, data, input_section, bfd *output_bfd; char **error_message; { - bfd_boolean relocateable; + bfd_boolean relocatable; bfd_reloc_status_type ret; bfd_vma gp; @@ -1670,20 +1670,20 @@ mips_elf64_literal_reloc (abfd, reloc_entry, symbol, data, input_section, /* FIXME: The entries in the .lit8 and .lit4 sections should be merged. */ if (output_bfd != (bfd *) NULL) - relocateable = TRUE; + relocatable = TRUE; else { - relocateable = FALSE; + relocatable = FALSE; output_bfd = symbol->section->output_section->owner; } - ret = mips_elf64_final_gp (output_bfd, symbol, relocateable, error_message, + ret = mips_elf64_final_gp (output_bfd, symbol, relocatable, error_message, &gp); if (ret != bfd_reloc_ok) return ret; return _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry, - input_section, relocateable, + input_section, relocatable, data, gp); } @@ -1701,7 +1701,7 @@ mips_elf64_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, bfd *output_bfd; char **error_message; { - bfd_boolean relocateable; + bfd_boolean relocatable; bfd_reloc_status_type ret; bfd_vma gp; bfd_vma relocation; @@ -1719,14 +1719,14 @@ mips_elf64_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, } if (output_bfd != (bfd *) NULL) - relocateable = TRUE; + relocatable = TRUE; else { - relocateable = FALSE; + relocatable = FALSE; output_bfd = symbol->section->output_section->owner; } - ret = mips_elf64_final_gp (output_bfd, symbol, relocateable, + ret = mips_elf64_final_gp (output_bfd, symbol, relocatable, error_message, &gp); if (ret != bfd_reloc_ok) return ret; @@ -1749,9 +1749,9 @@ mips_elf64_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, val += bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); /* Adjust val for the final section location and GP value. If we - are producing relocateable output, we don't want to do this for + are producing relocatable output, we don't want to do this for an external symbol. */ - if (! relocateable + if (! relocatable || (symbol->flags & BSF_SECTION_SYM) != 0) val += relocation - gp; @@ -1760,7 +1760,7 @@ mips_elf64_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, else reloc_entry->addend = val; - if (relocateable) + if (relocatable) reloc_entry->address += input_section->output_offset; return bfd_reloc_ok; @@ -1848,7 +1848,7 @@ mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, bfd *output_bfd; char **error_message; { - bfd_boolean relocateable; + bfd_boolean relocatable; bfd_reloc_status_type ret; bfd_vma gp; unsigned short extend = 0; @@ -1867,14 +1867,14 @@ mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, } if (output_bfd != NULL) - relocateable = TRUE; + relocatable = TRUE; else { - relocateable = FALSE; + relocatable = FALSE; output_bfd = symbol->section->output_section->owner; } - ret = mips_elf64_final_gp (output_bfd, symbol, relocateable, error_message, + ret = mips_elf64_final_gp (output_bfd, symbol, relocatable, error_message, &gp); if (ret != bfd_reloc_ok) return ret; @@ -1904,9 +1904,9 @@ mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, _bfd_mips_elf_sign_extend(val, 16); /* Adjust val for the final section location and GP value. If we - are producing relocateable output, we don't want to do this for + are producing relocatable output, we don't want to do this for an external symbol. */ - if (! relocateable + if (! relocatable || (symbol->flags & BSF_SECTION_SYM) != 0) val += relocation - gp; @@ -1925,7 +1925,7 @@ mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, else reloc_entry->addend = val; - if (relocateable) + if (relocatable) reloc_entry->address += input_section->output_offset; else if (((val & ~0xffff) != ~0xffff) && ((val & ~0xffff) != 0)) return bfd_reloc_overflow; diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c index d0213e6..54c4ca8 100644 --- a/bfd/elf64-mmix.c +++ b/bfd/elf64-mmix.c @@ -1229,9 +1229,9 @@ mmix_elf_relocate_section (output_bfd, info, input_bfd, input_section, r_symndx = ELF64_R_SYM (rel->r_info); - if (info->relocateable) + if (info->relocatable) { - /* This is a relocateable link. We don't have to change + /* This is a relocatable link. We don't have to change anything, unless the reloc is against a section symbol, in which case we have to adjust according to where the section symbol winds up in the output section. */ @@ -1669,7 +1669,7 @@ mmix_elf_check_common_relocs (abfd, info, sec, relocs) const Elf_Internal_Rela *rel; const Elf_Internal_Rela *rel_end; - if (info->relocateable) + if (info->relocatable) return TRUE; /* We currently have to abuse this COFF-specific member, since there's @@ -1780,7 +1780,7 @@ mmix_elf_check_relocs (abfd, info, sec, relocs) const Elf_Internal_Rela *rel; const Elf_Internal_Rela *rel_end; - if (info->relocateable) + if (info->relocatable) return TRUE; symtab_hdr = &elf_tdata (abfd)->symtab_hdr; @@ -2352,10 +2352,10 @@ mmix_elf_relax_section (abfd, sec, link_info, again) if (sec->_cooked_size == 0) sec->_cooked_size = sec->_raw_size; - /* We don't have to do anything for a relocateable link, if + /* We don't have to do anything for a relocatable link, if this section does not have relocs, or if this is not a code section. */ - if (link_info->relocateable + if (link_info->relocatable || (sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0 || (sec->flags & SEC_CODE) == 0 diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 68879de..bc331c8 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -3423,7 +3423,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sreloc; asection **opd_sym_map; - if (info->relocateable) + if (info->relocatable) return TRUE; htab = ppc_hash_table (info); @@ -5057,7 +5057,7 @@ ppc64_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info) asection *sec; struct ppc_link_hash_table *htab; - if (info->relocateable || info->shared) + if (info->relocatable || info->shared) return TRUE; htab = ppc_hash_table (info); @@ -7060,7 +7060,7 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms, This function is responsible for adjust the section contents as necessary, and (if using Rela relocs and generating a - relocateable output file) adjusting the reloc addend as + relocatable output file) adjusting the reloc addend as necessary. This function does not have to worry about setting the reloc @@ -7074,7 +7074,7 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms, The global hash table entry for the global symbols can be found via elf_sym_hashes (input_bfd). - When generating relocateable output, this function must handle + When generating relocatable output, this function must handle STB_LOCAL/STT_SECTION symbols specially. The output symbol is going to be the section symbol corresponding to the output section, which means that the addend must be adjusted @@ -7104,7 +7104,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, /* Disabled until we sort out how ld should choose 'y' vs 'at'. */ bfd_boolean is_power4 = FALSE; - if (info->relocateable) + if (info->relocatable) return TRUE; /* Initialize howto table if needed. */ diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index b5d724a..21501de 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -849,7 +849,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs) bfd_signed_vma *local_got_refcounts; int tls_type, old_tls_type; - if (info->relocateable) + if (info->relocatable) return TRUE; htab = elf_s390_hash_table (info); @@ -2169,7 +2169,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; - if (info->relocateable) + if (info->relocatable) return TRUE; htab = elf_s390_hash_table (info); diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c index fe3195c..95bbbd2 100644 --- a/bfd/elf64-sh64.c +++ b/bfd/elf64-sh64.c @@ -1585,9 +1585,9 @@ sh_elf64_relocate_section (output_bfd, info, input_bfd, input_section, _("Unexpected STO_SH5_ISA32 on local symbol is not handled"), input_bfd, input_section, rel->r_offset)); - if (info->relocateable) + if (info->relocatable) { - /* This is a relocateable link. We don't have to change + /* This is a relocatable link. We don't have to change anything, unless the reloc is against a section symbol, in which case we have to adjust according to where the section symbol winds up in the output section. */ @@ -1631,8 +1631,8 @@ sh_elf64_relocate_section (output_bfd, info, input_bfd, input_section, { /* Section symbols are never (?) placed in the hash table, so we can just ignore hash relocations when creating a - relocateable object file. */ - if (info->relocateable) + relocatable object file. */ + if (info->relocatable) continue; h = sym_hashes[r_symndx - symtab_hdr->sh_info]; @@ -2178,12 +2178,12 @@ sh_elf64_relocate_section (output_bfd, info, input_bfd, input_section, static bfd_byte * sh_elf64_get_relocated_section_contents (output_bfd, link_info, link_order, - data, relocateable, symbols) + data, relocatable, symbols) bfd *output_bfd; struct bfd_link_info *link_info; struct bfd_link_order *link_order; bfd_byte *data; - bfd_boolean relocateable; + bfd_boolean relocatable; asymbol **symbols; { Elf_Internal_Shdr *symtab_hdr; @@ -2195,11 +2195,11 @@ sh_elf64_get_relocated_section_contents (output_bfd, link_info, link_order, /* We only need to handle the case of relaxing, or of having a particular set of section contents, specially. */ - if (relocateable + if (relocatable || elf_section_data (input_section)->this_hdr.contents == NULL) return bfd_generic_get_relocated_section_contents (output_bfd, link_info, link_order, data, - relocateable, + relocatable, symbols); symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; @@ -2527,7 +2527,7 @@ sh_elf64_check_relocs (abfd, info, sec, relocs) srelgot = NULL; sreloc = NULL; - if (info->relocateable) + if (info->relocatable) return TRUE; symtab_hdr = &elf_tdata (abfd)->symtab_hdr; @@ -2932,11 +2932,11 @@ sh64_elf64_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) { struct elf_link_hash_entry *h; - /* For relocateable links, we register the DataLabel sym in its own + /* For relocatable links, we register the DataLabel sym in its own right, and tweak the name when it's output. Otherwise, we make an indirect symbol of it. */ flagword flags - = info->relocateable || info->emitrelocations + = info->relocatable || info->emitrelocations ? BSF_GLOBAL : BSF_GLOBAL | BSF_INDIRECT; char *dl_name @@ -2980,9 +2980,9 @@ sh64_elf64_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) free (dl_name); if (h->type != STT_DATALABEL - || ((info->relocateable || info->emitrelocations) + || ((info->relocatable || info->emitrelocations) && h->root.type != bfd_link_hash_undefined) - || (! info->relocateable && !info->emitrelocations + || (! info->relocatable && !info->emitrelocations && h->root.type != bfd_link_hash_indirect)) { /* Make sure we don't get confused on invalid input. */ @@ -3027,7 +3027,7 @@ sh64_elf64_link_output_symbol_hook (abfd, info, cname, sym, input_sec) { char *name = (char *) cname; - if (info->relocateable || info->emitrelocations) + if (info->relocatable || info->emitrelocations) { if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL) name[strlen (name) - strlen (DATALABEL_SUFFIX)] = 0; diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c index 080c4e7..dbaa954 100644 --- a/bfd/elf64-sparc.c +++ b/bfd/elf64-sparc.c @@ -1101,7 +1101,7 @@ sparc64_elf_check_relocs (abfd, info, sec, relocs) asection *srelgot; asection *sreloc; - if (info->relocateable || !(sec->flags & SEC_ALLOC)) + if (info->relocatable || !(sec->flags & SEC_ALLOC)) return TRUE; dynobj = elf_hash_table (info)->dynobj; @@ -2022,7 +2022,7 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; - if (info->relocateable) + if (info->relocatable) return TRUE; dynobj = elf_hash_table (info)->dynobj; diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index b39cdcd..76af7df 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -705,7 +705,7 @@ elf64_x86_64_check_relocs (abfd, info, sec, relocs) const Elf_Internal_Rela *rel_end; asection *sreloc; - if (info->relocateable) + if (info->relocatable) return TRUE; htab = elf64_x86_64_hash_table (info); @@ -1872,7 +1872,7 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section, Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; - if (info->relocateable) + if (info->relocatable) return TRUE; htab = elf64_x86_64_hash_table (info); diff --git a/bfd/elfcode.h b/bfd/elfcode.h index 0263631..6686ab9 100644 --- a/bfd/elfcode.h +++ b/bfd/elfcode.h @@ -1187,7 +1187,7 @@ elf_slurp_symbol_table (abfd, symptrs, dynamic) else sym->symbol.section = bfd_abs_section_ptr; - /* If this is a relocateable file, then the symbol value is + /* If this is a relocatable file, then the symbol value is already section relative. */ if ((abfd->flags & (EXEC_P | DYNAMIC)) != 0) sym->symbol.value -= sym->symbol.section->vma; diff --git a/bfd/elflink.h b/bfd/elflink.h index 7568946..f4a65bf 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -463,7 +463,7 @@ elf_link_add_object_symbols (abfd, info) /* You can't use -r against a dynamic object. Also, there's no hope of using a dynamic object which does not exactly match the format of the output file. */ - if (info->relocateable || info->hash->creator != abfd->xvec) + if (info->relocatable || info->hash->creator != abfd->xvec) { bfd_set_error (bfd_error_invalid_operation); goto error_return; @@ -534,7 +534,7 @@ elf_link_add_object_symbols (abfd, info) FALSE, collect, (struct bfd_link_hash_entry **) NULL))) goto error_return; - if (! info->relocateable) + if (! info->relocatable) { /* Clobber the section size so that the warning does not get copied into the output file. */ @@ -1658,7 +1658,7 @@ elf_link_add_object_symbols (abfd, info) } } - if (! info->relocateable && ! dynamic + if (! info->relocatable && ! dynamic && is_elf_hash_table (info)) { asection *s; @@ -1968,7 +1968,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath, if (notesec) { elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | exec; - if (exec && info->relocateable + if (exec && info->relocatable && notesec->output_section != bfd_abs_section_ptr) notesec->output_section->flags |= SEC_CODE; } @@ -2909,7 +2909,7 @@ struct elf_outext_info struct elf_final_link_info *finfo; }; -/* When performing a relocateable link, the input relocations are +/* When performing a relocatable link, the input relocations are preserved. But, if they reference global symbols, the indices referenced must be updated. Update all the relocations in REL_HDR (there are COUNT of them), using the data in REL_HASH. */ @@ -3186,7 +3186,7 @@ elf_bfd_final_link (abfd, info) dynamic = elf_hash_table (info)->dynamic_sections_created; dynobj = elf_hash_table (info)->dynobj; - emit_relocs = (info->relocateable + emit_relocs = (info->relocatable || info->emitrelocations || bed->elf_backend_emit_relocs); @@ -3271,7 +3271,7 @@ elf_bfd_final_link (abfd, info) if (sec->flags & SEC_MERGE) merged = TRUE; - if (info->relocateable || info->emitrelocations) + if (info->relocatable || info->emitrelocations) reloc_count = sec->reloc_count; else if (bed->elf_backend_count_relocs) { @@ -3396,7 +3396,7 @@ elf_bfd_final_link (abfd, info) o->vma = 0; } - if (! info->relocateable && merged) + if (! info->relocatable && merged) elf_link_hash_traverse (elf_hash_table (info), _bfd_elf_link_sec_merge_syms, (PTR) abfd); @@ -3524,7 +3524,7 @@ elf_bfd_final_link (abfd, info) if (o != NULL) o->target_index = bfd_get_symcount (abfd); elfsym.st_shndx = i; - if (info->relocateable || o == NULL) + if (info->relocatable || o == NULL) elfsym.st_value = 0; else elfsym.st_value = o->vma; @@ -3635,13 +3635,13 @@ elf_bfd_final_link (abfd, info) Unfortunately, there is no way to know the total number of local symbols until we have seen all of them, and the local symbol indices precede the global symbol indices. This means that when - we are generating relocateable output, and we see a reloc against + we are generating relocatable output, and we see a reloc against a global symbol, we can not know the symbol index until we have finished examining all the local symbols to see which ones we are going to output. To deal with this, we keep the relocations in memory, and don't output them until the end of the link. This is an unfortunate waste of memory, but I don't see a good way around - it. Fortunately, it only happens when performing a relocateable + it. Fortunately, it only happens when performing a relocatable link, which is not the common case. FIXME: If keep_memory is set we could write the relocs out and then read them again; I don't know how bad the memory loss will be. */ @@ -4081,7 +4081,7 @@ elf_bfd_final_link (abfd, info) } } - if (info->relocateable) + if (info->relocatable) { bfd_boolean failed = FALSE; @@ -4453,7 +4453,7 @@ elf_link_output_extsym (h, data) program is run. We don't have to worry about symbols that are referenced by regular files, because we will already have issued warnings for them. */ - if (! finfo->info->relocateable + if (! finfo->info->relocatable && (finfo->info->executable || ! finfo->info->allow_shlib_undefined) && h->root.type == bfd_link_hash_undefined @@ -4472,7 +4472,7 @@ elf_link_output_extsym (h, data) /* We should also warn if a forced local symbol is referenced from shared libraries. */ - if (! finfo->info->relocateable + if (! finfo->info->relocatable && (! finfo->info->shared || ! finfo->info->allow_shlib_undefined) && (h->elf_link_hash_flags & (ELF_LINK_FORCED_LOCAL | ELF_LINK_HASH_REF_DYNAMIC @@ -4570,11 +4570,11 @@ elf_link_output_extsym (h, data) return FALSE; } - /* ELF symbols in relocateable files are section relative, - but in nonrelocateable files they are virtual + /* ELF symbols in relocatable files are section relative, + but in nonrelocatable files they are virtual addresses. */ sym.st_value = h->root.u.def.value + input_sec->output_offset; - if (! finfo->info->relocateable) + if (! finfo->info->relocatable) { sym.st_value += input_sec->output_section->vma; if (h->type == STT_TLS) @@ -4657,7 +4657,7 @@ elf_link_output_extsym (h, data) /* If a non-weak symbol with non-default visibility is not defined locally, it is a fatal error. */ - if (! finfo->info->relocateable + if (! finfo->info->relocatable && ELF_ST_VISIBILITY (sym.st_other) != STV_DEFAULT && ELF_ST_BIND (sym.st_info) != STB_WEAK && h->root.type == bfd_link_hash_undefined @@ -4787,7 +4787,7 @@ elf_link_input_bfd (finfo, input_bfd) if ((input_bfd->flags & DYNAMIC) != 0) return TRUE; - emit_relocs = (finfo->info->relocateable + emit_relocs = (finfo->info->relocatable || finfo->info->emitrelocations || bed->elf_backend_emit_relocs); @@ -4882,7 +4882,7 @@ elf_link_input_bfd (finfo, input_bfd) continue; /* If we are discarding all local symbols, we don't want to - output this one. If we are generating a relocateable output + output this one. If we are generating a relocatable output file, then some of the local symbols may be required by relocs; we output them below as we discover that they are needed. */ @@ -4897,7 +4897,7 @@ elf_link_input_bfd (finfo, input_bfd) if ((isym->st_shndx < SHN_LORESERVE || isym->st_shndx > SHN_HIRESERVE) && isec != NULL && ((! isec->linker_mark && (isec->flags & SEC_HAS_CONTENTS) != 0) - || (! finfo->info->relocateable + || (! finfo->info->relocatable && (isec->flags & SEC_EXCLUDE) != 0))) continue; @@ -4912,7 +4912,7 @@ elf_link_input_bfd (finfo, input_bfd) && (bfd_hash_lookup (finfo->info->keep_hash, name, FALSE, FALSE) == NULL)) || (((finfo->info->discard == discard_sec_merge - && (isec->flags & SEC_MERGE) && ! finfo->info->relocateable) + && (isec->flags & SEC_MERGE) && ! finfo->info->relocatable) || finfo->info->discard == discard_l) && bfd_is_local_label_name (input_bfd, name))) continue; @@ -4929,7 +4929,7 @@ elf_link_input_bfd (finfo, input_bfd) *pindex = bfd_get_symcount (output_bfd); - /* ELF symbols in relocateable files are section relative, but + /* ELF symbols in relocatable files are section relative, but in executable files they are virtual addresses. Note that this code assumes that all ELF sections have an associated BFD section with a reasonable value for output_offset; below @@ -4937,7 +4937,7 @@ elf_link_input_bfd (finfo, input_bfd) output_section. Any special sections must be set up to meet these requirements. */ osym.st_value += isec->output_offset; - if (! finfo->info->relocateable) + if (! finfo->info->relocatable) { osym.st_value += isec->output_section->vma; if (ELF_ST_TYPE (osym.st_info) == STT_TLS) @@ -5108,7 +5108,7 @@ elf_link_input_bfd (finfo, input_bfd) The back end routine is responsible for adjusting the section contents as necessary, and (if using Rela relocs - and generating a relocateable output file) adjusting the + and generating a relocatable output file) adjusting the reloc addend as necessary. The back end routine does not have to worry about setting @@ -5118,7 +5118,7 @@ elf_link_input_bfd (finfo, input_bfd) internal symbols, and can access the hash table entries for the external symbols via elf_sym_hashes (input_bfd). - When generating relocateable output, the back end routine + When generating relocatable output, the back end routine must handle STB_LOCAL/STT_SECTION symbols specially. The output symbol is going to be a section symbol corresponding to the output section, which will require @@ -5157,7 +5157,7 @@ elf_link_input_bfd (finfo, input_bfd) + elf_section_data (o->output_section)->rel_count + elf_section_data (o->output_section)->rel_count2); last_offset = o->output_offset; - if (!finfo->info->relocateable) + if (!finfo->info->relocatable) last_offset += o->output_section->vma; for (next_erel = 0; irela < irelaend; irela++, next_erel++) { @@ -5190,7 +5190,7 @@ elf_link_input_bfd (finfo, input_bfd) irela->r_offset += o->output_offset; /* Relocs in an executable have to be virtual addresses. */ - if (!finfo->info->relocateable) + if (!finfo->info->relocatable) irela->r_offset += o->output_section->vma; last_offset = irela->r_offset; @@ -5294,7 +5294,7 @@ elf_link_input_bfd (finfo, input_bfd) return FALSE; sym.st_value += sec->output_offset; - if (! finfo->info->relocateable) + if (! finfo->info->relocatable) { sym.st_value += osec->vma; if (ELF_ST_TYPE (sym.st_info) == STT_TLS) @@ -5322,7 +5322,7 @@ elf_link_input_bfd (finfo, input_bfd) /* Swap out the relocs. */ if (bed->elf_backend_emit_relocs - && !(finfo->info->relocateable + && !(finfo->info->relocatable || finfo->info->emitrelocations)) reloc_emitter = bed->elf_backend_emit_relocs; else @@ -5522,10 +5522,10 @@ elf_reloc_link_order (output_bfd, info, output_section, link_order) } /* The address of a reloc is relative to the section in a - relocateable file, and is a virtual address in an executable + relocatable file, and is a virtual address in an executable file. */ offset = link_order->offset; - if (! info->relocateable) + if (! info->relocatable) offset += output_section->vma; for (i = 0; i < bed->s->int_rels_per_ext_rel; i++) @@ -6189,7 +6189,7 @@ elf_gc_sections (abfd, info) struct elf_link_hash_entry *h, Elf_Internal_Sym *)); if (!get_elf_backend_data (abfd)->can_gc_sections - || info->relocateable || info->emitrelocations + || info->relocatable || info->emitrelocations || elf_hash_table (info)->dynamic_sections_created) return TRUE; @@ -6599,7 +6599,7 @@ elf_bfd_discard_info (output_bfd, info) continue; eh = bfd_get_section_by_name (abfd, ".eh_frame"); - if (info->relocateable + if (info->relocatable || (eh != NULL && (eh->_raw_size == 0 || bfd_is_abs_section (eh->output_section)))) @@ -6705,7 +6705,7 @@ elf_bfd_discard_info (output_bfd, info) } if (info->eh_frame_hdr - && !info->relocateable + && !info->relocatable && _bfd_elf_discard_section_eh_frame_hdr (output_bfd, info)) ret = TRUE; diff --git a/bfd/elfn32-mips.c b/bfd/elfn32-mips.c index 1741e35..60c6ad0 100644 --- a/bfd/elfn32-mips.c +++ b/bfd/elfn32-mips.c @@ -1520,18 +1520,18 @@ mips_elf_assign_gp (output_bfd, pgp) symbol value correctly. We look up the symbol _gp in the output BFD. If we can't find it, we're stuck. We cache it in the ELF target data. We don't need to adjust the symbol value for an - external symbol if we are producing relocateable output. */ + external symbol if we are producing relocatable output. */ static bfd_reloc_status_type -mips_elf_final_gp (output_bfd, symbol, relocateable, error_message, pgp) +mips_elf_final_gp (output_bfd, symbol, relocatable, error_message, pgp) bfd *output_bfd; asymbol *symbol; - bfd_boolean relocateable; + bfd_boolean relocatable; char **error_message; bfd_vma *pgp; { if (bfd_is_und_section (symbol->section) - && ! relocateable) + && ! relocatable) { *pgp = 0; return bfd_reloc_undefined; @@ -1539,10 +1539,10 @@ mips_elf_final_gp (output_bfd, symbol, relocateable, error_message, pgp) *pgp = _bfd_get_gp_value (output_bfd); if (*pgp == 0 - && (! relocateable + && (! relocatable || (symbol->flags & BSF_SECTION_SYM) != 0)) { - if (relocateable) + if (relocatable) { /* Make up a value. */ *pgp = symbol->section->output_section->vma /*+ 0x4000*/; @@ -1573,27 +1573,27 @@ mips_elf_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section, bfd *output_bfd; char **error_message ATTRIBUTE_UNUSED; { - bfd_boolean relocateable; + bfd_boolean relocatable; bfd_reloc_status_type ret; bfd_vma gp; GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section) if (output_bfd != (bfd *) NULL) - relocateable = TRUE; + relocatable = TRUE; else { - relocateable = FALSE; + relocatable = FALSE; output_bfd = symbol->section->output_section->owner; } - ret = mips_elf_final_gp (output_bfd, symbol, relocateable, error_message, + ret = mips_elf_final_gp (output_bfd, symbol, relocatable, error_message, &gp); if (ret != bfd_reloc_ok) return ret; return _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry, - input_section, relocateable, + input_section, relocatable, data, gp); } @@ -1610,7 +1610,7 @@ mips_elf_literal_reloc (abfd, reloc_entry, symbol, data, input_section, bfd *output_bfd; char **error_message; { - bfd_boolean relocateable; + bfd_boolean relocatable; bfd_reloc_status_type ret; bfd_vma gp; @@ -1618,20 +1618,20 @@ mips_elf_literal_reloc (abfd, reloc_entry, symbol, data, input_section, /* FIXME: The entries in the .lit8 and .lit4 sections should be merged. */ if (output_bfd != (bfd *) NULL) - relocateable = TRUE; + relocatable = TRUE; else { - relocateable = FALSE; + relocatable = FALSE; output_bfd = symbol->section->output_section->owner; } - ret = mips_elf_final_gp (output_bfd, symbol, relocateable, error_message, + ret = mips_elf_final_gp (output_bfd, symbol, relocatable, error_message, &gp); if (ret != bfd_reloc_ok) return ret; return _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry, - input_section, relocateable, + input_section, relocatable, data, gp); } @@ -1649,7 +1649,7 @@ mips_elf_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, bfd *output_bfd; char **error_message; { - bfd_boolean relocateable; + bfd_boolean relocatable; bfd_reloc_status_type ret; bfd_vma gp; @@ -1667,32 +1667,32 @@ mips_elf_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section, if (output_bfd != (bfd *) NULL) { - relocateable = TRUE; + relocatable = TRUE; gp = _bfd_get_gp_value (output_bfd); } else { - relocateable = FALSE; + relocatable = FALSE; output_bfd = symbol->section->output_section->owner; - ret = mips_elf_final_gp (output_bfd, symbol, relocateable, + ret = mips_elf_final_gp (output_bfd, symbol, relocatable, error_message, &gp); if (ret != bfd_reloc_ok) return ret; } return gprel32_with_gp (abfd, symbol, reloc_entry, input_section, - relocateable, data, gp); + relocatable, data, gp); } static bfd_reloc_status_type -gprel32_with_gp (abfd, symbol, reloc_entry, input_section, relocateable, data, +gprel32_with_gp (abfd, symbol, reloc_entry, input_section, relocatable, data, gp) bfd *abfd; asymbol *symbol; arelent *reloc_entry; asection *input_section; - bfd_boolean relocateable; + bfd_boolean relocatable; PTR data; bfd_vma gp; { @@ -1719,15 +1719,15 @@ gprel32_with_gp (abfd, symbol, reloc_entry, input_section, relocateable, data, val += reloc_entry->addend; /* Adjust val for the final section location and GP value. If we - are producing relocateable output, we don't want to do this for + are producing relocatable output, we don't want to do this for an external symbol. */ - if (! relocateable + if (! relocatable || (symbol->flags & BSF_SECTION_SYM) != 0) val += relocation - gp; bfd_put_32 (abfd, (bfd_vma) val, (bfd_byte *) data + reloc_entry->address); - if (relocateable) + if (relocatable) reloc_entry->address += input_section->output_offset; return bfd_reloc_ok; @@ -1800,7 +1800,7 @@ mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, bfd *output_bfd; char **error_message; { - bfd_boolean relocateable; + bfd_boolean relocatable; bfd_reloc_status_type ret; bfd_vma gp; unsigned short extend = 0; @@ -1811,14 +1811,14 @@ mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section) if (output_bfd != NULL) - relocateable = TRUE; + relocatable = TRUE; else { - relocateable = FALSE; + relocatable = FALSE; output_bfd = symbol->section->output_section->owner; } - ret = mips_elf_final_gp (output_bfd, symbol, relocateable, error_message, + ret = mips_elf_final_gp (output_bfd, symbol, relocatable, error_message, &gp); if (ret != bfd_reloc_ok) return ret; @@ -1848,9 +1848,9 @@ mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, _bfd_mips_elf_sign_extend(val, 16); /* Adjust val for the final section location and GP value. If we - are producing relocateable output, we don't want to do this for + are producing relocatable output, we don't want to do this for an external symbol. */ - if (! relocateable + if (! relocatable || (symbol->flags & BSF_SECTION_SYM) != 0) val += relocation - gp; @@ -1869,7 +1869,7 @@ mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, else reloc_entry->addend = val; - if (relocateable) + if (relocatable) reloc_entry->address += input_section->output_offset; else if (((val & ~0xffff) != ~0xffff) && ((val & ~0xffff) != 0)) return bfd_reloc_overflow; diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c index 5e8dadf..2098f6f 100644 --- a/bfd/elfxx-ia64.c +++ b/bfd/elfxx-ia64.c @@ -1341,7 +1341,7 @@ elfNN_ia64_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) bfd_vma *valp; { if (sym->st_shndx == SHN_COMMON - && !info->relocateable + && !info->relocatable && sym->st_size <= elf_gp_size (abfd)) { /* Common symbols less than or equal to -G nn bytes are @@ -2228,7 +2228,7 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs) const Elf_Internal_Rela *rel; asection *got, *fptr, *srel; - if (info->relocateable) + if (info->relocatable) return TRUE; symtab_hdr = &elf_tdata (abfd)->symtab_hdr; @@ -3779,7 +3779,7 @@ elfNN_ia64_final_link (abfd, info) ia64_info = elfNN_ia64_hash_table (info); /* Make sure we've got ourselves a nice fat __gp value. */ - if (!info->relocateable) + if (!info->relocatable) { bfd_vma gp_val = _bfd_get_gp_value (abfd); struct elf_link_hash_entry *gp; @@ -3805,7 +3805,7 @@ elfNN_ia64_final_link (abfd, info) of the .IA_64.unwind section. Force this section to be relocated into memory rather than written immediately to the output file. */ unwind_output_sec = NULL; - if (!info->relocateable) + if (!info->relocatable) { asection *s = bfd_get_section_by_name (abfd, ELF_STRING_ia64_unwind); if (s) @@ -3863,7 +3863,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, ia64_info = elfNN_ia64_hash_table (info); /* Infect various flags from the input section to the output section. */ - if (info->relocateable) + if (info->relocatable) { bfd_vma flags; diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index dbbfb31..3e85fc3 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -1080,12 +1080,12 @@ mips_elf_check_mips16_stubs (h, data) bfd_reloc_status_type _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry, input_section, - relocateable, data, gp) + relocatable, data, gp) bfd *abfd; asymbol *symbol; arelent *reloc_entry; asection *input_section; - bfd_boolean relocateable; + bfd_boolean relocatable; PTR data; bfd_vma gp; { @@ -1116,9 +1116,9 @@ _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry, input_section, _bfd_mips_elf_sign_extend(val, 16); /* Adjust val for the final section location and GP value. If we - are producing relocateable output, we don't want to do this for + are producing relocatable output, we don't want to do this for an external symbol. */ - if (! relocateable + if (! relocatable || (symbol->flags & BSF_SECTION_SYM) != 0) val += relocation - gp; @@ -1131,7 +1131,7 @@ _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry, input_section, else reloc_entry->addend = val; - if (relocateable) + if (relocatable) reloc_entry->address += input_section->output_offset; else if (((val & ~0xffff) != ~0xffff) && ((val & ~0xffff) != 0)) return bfd_reloc_overflow; @@ -3151,7 +3151,7 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info, /* If this is a 32- or 64-bit call to a 16-bit function with a stub, we need to redirect the call to the stub, unless we're already *in* a stub. */ - if (r_type != R_MIPS16_26 && !info->relocateable + if (r_type != R_MIPS16_26 && !info->relocatable && ((h != NULL && h->fn_stub != NULL) || (local_p && elf_tdata (input_bfd)->local_stubs != NULL && elf_tdata (input_bfd)->local_stubs[r_symndx] != NULL)) @@ -3172,7 +3172,7 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info, } /* If this is a 16-bit call to a 32- or 64-bit function with a stub, we need to redirect the call to the stub. */ - else if (r_type == R_MIPS16_26 && !info->relocateable + else if (r_type == R_MIPS16_26 && !info->relocatable && h != NULL && (h->call_stub != NULL || h->call_fp_stub != NULL) && !target_is_16_bit_code_p) @@ -3208,7 +3208,7 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info, /* Calls from 16-bit code to 32-bit code and vice versa require the special jalx instruction. */ - *require_jalxp = (!info->relocateable + *require_jalxp = (!info->relocatable && (((r_type == R_MIPS16_26) && !target_is_16_bit_code_p) || ((r_type == R_MIPS_26) && target_is_16_bit_code_p))); @@ -3650,7 +3650,7 @@ mips_elf_perform_relocation (info, howto, relocation, value, input_bfd, JALX is the 5-bit value 00011. X is 0 for jal, 1 for jalx. Note that the immediate value in the first word is swapped. - When producing a relocateable object file, R_MIPS16_26 is + When producing a relocatable object file, R_MIPS16_26 is handled mostly like R_MIPS_26. In particular, the addend is stored as a straight 26-bit value in a 32-bit instruction. (gas makes life simpler for itself by never adjusting a @@ -3688,13 +3688,13 @@ mips_elf_perform_relocation (info, howto, relocation, value, input_bfd, where targ26-16 is sub1 followed by sub2 (i.e., the addend field A is ((sub1 << 16) | sub2)). - When producing a relocateable object file, the calculation is + When producing a relocatable object file, the calculation is (((A < 2) | ((P + 4) & 0xf0000000) + S) >> 2) When producing a fully linked file, the calculation is let R = (((A < 2) | ((P + 4) & 0xf0000000) + S) >> 2) ((R & 0x1f0000) << 5) | ((R & 0x3e00000) >> 5) | (R & 0xffff) */ - if (!info->relocateable) + if (!info->relocatable) /* Shuffle the bits according to the formula above. */ value = (((value & 0x1f0000) << 5) | ((value & 0x3e00000) >> 5) @@ -5061,7 +5061,7 @@ _bfd_mips_elf_check_relocs (abfd, info, sec, relocs) asection *sreloc; struct elf_backend_data *bed; - if (info->relocateable) + if (info->relocatable) return TRUE; dynobj = elf_hash_table (info)->dynobj; @@ -5557,7 +5557,7 @@ _bfd_mips_relax_section (abfd, sec, link_info, again) /* We are not currently changing any sizes, so only one pass. */ *again = FALSE; - if (link_info->relocateable) + if (link_info->relocatable) return TRUE; internal_relocs = _bfd_elf_link_read_relocs (abfd, sec, (PTR) NULL, @@ -5748,7 +5748,7 @@ _bfd_mips_elf_adjust_dynamic_symbol (info, h) any R_MIPS_32 or R_MIPS_REL32 relocs against it into the output file. */ hmips = (struct mips_elf_link_hash_entry *) h; - if (! info->relocateable + if (! info->relocatable && hmips->possibly_dynamic_relocs != 0 && (h->root.type == bfd_link_hash_defweak || (h->elf_link_hash_flags @@ -5846,7 +5846,7 @@ _bfd_mips_elf_always_size_sections (output_bfd, info) bfd_set_section_size (output_bfd, ri, (bfd_size_type) sizeof (Elf32_External_RegInfo)); - if (! (info->relocateable + if (! (info->relocatable || ! mips_elf_hash_table (info)->mips16_stubs_seen)) mips_elf_link_hash_traverse (mips_elf_hash_table (info), mips_elf_check_mips16_stubs, @@ -6384,7 +6384,7 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section, addend = rel->r_addend; } - if (info->relocateable) + if (info->relocatable) { Elf_Internal_Sym *sym; unsigned long r_symndx; @@ -6398,7 +6398,7 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section, they're against a section symbol, in which case we need to adjust by the section offset, or unless they're GP relative in which case we need to adjust by the amount - that we're adjusting GP in this relocateable object. */ + that we're adjusting GP in this relocatable object. */ if (! mips_elf_local_relocation_p (input_bfd, rel, local_sections, FALSE)) @@ -8129,12 +8129,12 @@ _bfd_mips_elf_set_section_contents (abfd, section, location, offset, count) bfd_byte * _bfd_elf_mips_get_relocated_section_contents (abfd, link_info, link_order, - data, relocateable, symbols) + data, relocatable, symbols) bfd *abfd; struct bfd_link_info *link_info; struct bfd_link_order *link_order; bfd_byte *data; - bfd_boolean relocateable; + bfd_boolean relocatable; asymbol **symbols; { /* Get enough memory to hold the stuff */ @@ -8242,7 +8242,7 @@ _bfd_elf_mips_get_relocated_section_contents (abfd, link_info, link_order, { /* bypass special_function call */ r = _bfd_mips_elf_gprel16_with_gp (input_bfd, sym, *parent, - input_section, relocateable, + input_section, relocatable, (PTR) data, gp); goto skip_bfd_perform_relocation; } @@ -8252,11 +8252,11 @@ _bfd_elf_mips_get_relocated_section_contents (abfd, link_info, link_order, *parent, (PTR) data, input_section, - relocateable ? abfd : (bfd *) NULL, + relocatable ? abfd : (bfd *) NULL, &error_message); skip_bfd_perform_relocation: - if (relocateable) + if (relocatable) { asection *os = input_section->output_section; @@ -8463,7 +8463,7 @@ _bfd_mips_elf_final_link (abfd, info) elf_gp (abfd) = (h->u.def.value + h->u.def.section->output_section->vma + h->u.def.section->output_offset); - else if (info->relocateable) + else if (info->relocatable) { bfd_vma lo = MINUS_ONE; @@ -8784,7 +8784,7 @@ _bfd_mips_elf_final_link (abfd, info) information describing how the small data area would change depending upon the -G switch. These sections not used in executables files. */ - if (! info->relocateable) + if (! info->relocatable) { for (p = o->link_order_head; p != (struct bfd_link_order *) NULL; diff --git a/bfd/i386linux.c b/bfd/i386linux.c index 6403e1c..84ae477 100644 --- a/bfd/i386linux.c +++ b/bfd/i386linux.c @@ -353,7 +353,7 @@ linux_add_one_symbol (info, abfd, name, flags, section, value, string, insert = FALSE; - if (! info->relocateable + if (! info->relocatable && linux_hash_table (info)->dynobj == NULL && strcmp (name, SHARABLE_CONFLICTS) == 0 && (flags & BSF_CONSTRUCTOR) != 0 @@ -3590,7 +3590,7 @@ static const unsigned char exten[] = 0xf0, 0x20, 0x00, 0xf1, 0xce, 0x20, 0x00, 37, 3, 3, /* Set version 3 rev 3. */ 0xf1, 0xce, 0x20, 0x00, 39, 2, /* Keep symbol in original case. */ - 0xf1, 0xce, 0x20, 0x00, 38 /* Set object type relocateable to x. */ + 0xf1, 0xce, 0x20, 0x00, 38 /* Set object type relocatable to x. */ }; static const unsigned char envi[] = diff --git a/bfd/libbfd.h b/bfd/libbfd.h index 9bbdebd..46695e7 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -1509,7 +1509,7 @@ bfd_generic_get_relocated_section_contents PARAMS ((bfd *abfd, struct bfd_link_info *link_info, struct bfd_link_order *link_order, bfd_byte *data, - bfd_boolean relocateable, + bfd_boolean relocatable, asymbol **symbols)); /* Extracted from archures.c. */ diff --git a/bfd/libcoff-in.h b/bfd/libcoff-in.h index fac7650..0c19433 100644 --- a/bfd/libcoff-in.h +++ b/bfd/libcoff-in.h @@ -1,6 +1,6 @@ /* BFD COFF object file private structure. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002 + 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Cygnus Support. @@ -434,7 +434,7 @@ struct coff_debug_merge_hash_table bfd_hash_lookup (&(table)->root, (string), (create), (copy))) /* Information we keep for each section in the output file when doing - a relocateable link. */ + a relocatable link. */ struct coff_link_section_info { @@ -461,7 +461,7 @@ struct coff_final_link_info bfd_boolean global_to_static; /* Hash table for long symbol names. */ struct bfd_strtab_hash *strtab; - /* When doing a relocateable link, an array of information kept for + /* When doing a relocatable link, an array of information kept for each output section, indexed by the target_index field. */ struct coff_link_section_info *section_info; /* Symbol index of last C_FILE symbol (-1 if none). */ diff --git a/bfd/libcoff.h b/bfd/libcoff.h index 1beec22..1e11ec0 100644 --- a/bfd/libcoff.h +++ b/bfd/libcoff.h @@ -438,7 +438,7 @@ struct coff_debug_merge_hash_table bfd_hash_lookup (&(table)->root, (string), (create), (copy))) /* Information we keep for each section in the output file when doing - a relocateable link. */ + a relocatable link. */ struct coff_link_section_info { @@ -465,7 +465,7 @@ struct coff_final_link_info bfd_boolean global_to_static; /* Hash table for long symbol names. */ struct bfd_strtab_hash *strtab; - /* When doing a relocateable link, an array of information kept for + /* When doing a relocatable link, an array of information kept for each output section, indexed by the target_index field. */ struct coff_link_section_info *section_info; /* Symbol index of last C_FILE symbol (-1 if none). */ diff --git a/bfd/linker.c b/bfd/linker.c index c0e3236..72f8bfd 100644 --- a/bfd/linker.c +++ b/bfd/linker.c @@ -88,7 +88,7 @@ SUBSECTION For example, with each entry in the hash table the a.out linker keeps the index the symbol has in the final output file - (this index number is used so that when doing a relocateable + (this index number is used so that when doing a relocatable link the symbol index used in the output file can be quickly filled in when copying over a reloc). The a.out linker code defines the required structures and functions for a hash table @@ -277,7 +277,7 @@ SUBSECTION the input sections and copy the data into the output sections. It must build an output symbol table including any local symbols from the input files and the global symbols from the - hash table. When producing relocateable output, it must + hash table. When producing relocatable output, it must modify the input relocs and write them into the output file. There may also be object format dependent work to be done. @@ -317,7 +317,7 @@ SUBSUBSECTION types of information. They also describe relocs that must be created by the BFD backend, but do not correspond to any input file; this is used to support -Ur, which builds constructors - while generating a relocateable object file. + while generating a relocatable object file. INODE Relocating the section contents, Writing the symbol table, Information provided by the linker, Performing the Final Link @@ -339,7 +339,7 @@ SUBSUBSECTION input files. The <<_bfd_final_link>> function should read the contents of the section and any associated relocs, apply the relocs to the section contents, and write out the modified - section contents. If performing a relocateable link, the + section contents. If performing a relocatable link, the relocs themselves must also be modified and written out. @findex _bfd_relocate_contents @@ -2043,7 +2043,7 @@ _bfd_generic_final_link (abfd, info) if (! generic_add_output_symbol (abfd, &outsymalloc, NULL)) return FALSE; - if (info->relocateable) + if (info->relocatable) { /* Allocate space for the output relocs for each section. */ for (o = abfd->sections; @@ -2362,7 +2362,7 @@ _bfd_generic_link_output_symbols (output_bfd, input_bfd, info, psymalloc) break; case discard_sec_merge: output = TRUE; - if (info->relocateable + if (info->relocatable || ! (sym->section->flags & SEC_MERGE)) break; /* FALLTHROUGH */ @@ -2534,7 +2534,7 @@ _bfd_generic_reloc_link_order (abfd, info, sec, link_order) { arelent *r; - if (! info->relocateable) + if (! info->relocatable) abort (); if (sec->orelocation == (arelent **) NULL) abort (); @@ -2767,7 +2767,7 @@ default_indirect_link_order (output_bfd, info, output_section, link_order, BFD_ASSERT (input_section->output_offset == link_order->offset); BFD_ASSERT (input_section->_cooked_size == link_order->size); - if (info->relocateable + if (info->relocatable && input_section->reloc_count > 0 && output_section->orelocation == (arelent **) NULL) { @@ -2777,7 +2777,7 @@ default_indirect_link_order (output_bfd, info, output_section, link_order, types of object files. Handling this case correctly is difficult, and sometimes impossible. */ (*_bfd_error_handler) - (_("Attempt to do relocateable link with %s input and %s output"), + (_("Attempt to do relocatable link with %s input and %s output"), bfd_get_target (input_bfd), bfd_get_target (output_bfd)); bfd_set_error (bfd_error_wrong_format); return FALSE; @@ -2842,7 +2842,7 @@ default_indirect_link_order (output_bfd, info, output_section, link_order, if (contents == NULL && sec_size != 0) goto error_return; new_contents = (bfd_get_relocated_section_contents - (output_bfd, info, link_order, contents, info->relocateable, + (output_bfd, info, link_order, contents, info->relocatable, _bfd_generic_link_get_symbols (input_bfd))); if (!new_contents) goto error_return; diff --git a/bfd/m68klinux.c b/bfd/m68klinux.c index 1a82980..90f342c 100644 --- a/bfd/m68klinux.c +++ b/bfd/m68klinux.c @@ -357,7 +357,7 @@ linux_add_one_symbol (info, abfd, name, flags, section, value, string, insert = FALSE; - if (! info->relocateable + if (! info->relocatable && linux_hash_table (info)->dynobj == NULL && strcmp (name, SHARABLE_CONFLICTS) == 0 && (flags & BSF_CONSTRUCTOR) != 0 diff --git a/bfd/pdp11.c b/bfd/pdp11.c index 95d78a1..52f7b70 100644 --- a/bfd/pdp11.c +++ b/bfd/pdp11.c @@ -1,5 +1,5 @@ /* BFD back-end for PDP-11 a.out binaries. - Copyright 2001, 2002 Free Software Foundation, Inc. + Copyright 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -3436,7 +3436,7 @@ NAME(aout,final_link) (abfd, info, callback) includes_hash_initialized = TRUE; /* Figure out the largest section size. Also, if generating - relocateable output, count the relocs. */ + relocatable output, count the relocs. */ trsize = 0; drsize = 0; max_contents_size = 0; @@ -3446,7 +3446,7 @@ NAME(aout,final_link) (abfd, info, callback) { size_t sz; - if (info->relocateable) + if (info->relocatable) { if (bfd_get_flavour (sub) == bfd_target_aout_flavour) { @@ -3460,7 +3460,7 @@ NAME(aout,final_link) (abfd, info, callback) work out the number of relocs needed, and then multiply by the reloc size. */ (*_bfd_error_handler) - ("%s: relocateable link from %s to %s not supported", + ("%s: relocatable link from %s to %s not supported", bfd_get_filename (abfd), sub->xvec->name, abfd->xvec->name); bfd_set_error (bfd_error_invalid_operation); @@ -3490,7 +3490,7 @@ NAME(aout,final_link) (abfd, info, callback) } } - if (info->relocateable) + if (info->relocatable) { if (obj_textsec (abfd) != (asection *) NULL) trsize += (_bfd_count_link_order_relocs (obj_textsec (abfd) @@ -4460,9 +4460,9 @@ aout_link_input_section (finfo, input_bfd, input_section, reloff_ptr, input_size)) return FALSE; - /* If we are producing relocateable output, the relocs were + /* If we are producing relocatable output, the relocs were modified, and we now write them out. */ - if (finfo->info->relocateable && rel_size > 0) + if (finfo->info->relocatable && rel_size > 0) { if (bfd_seek (finfo->output_bfd, *reloff_ptr, SEEK_SET) != 0) return FALSE; @@ -4521,7 +4521,7 @@ pdp11_aout_link_input_section (finfo, input_bfd, input_section, relocs, struct aout_link_hash_entry *, PTR, bfd_byte *, bfd_boolean *, bfd_vma *)); bfd *output_bfd; - bfd_boolean relocateable; + bfd_boolean relocatable; struct external_nlist *syms; char *strings; struct aout_link_hash_entry **sym_hashes; @@ -4537,7 +4537,7 @@ pdp11_aout_link_input_section (finfo, input_bfd, input_section, relocs, BFD_ASSERT (input_bfd->xvec->header_byteorder == output_bfd->xvec->header_byteorder); - relocateable = finfo->info->relocateable; + relocatable = finfo->info->relocatable; syms = obj_aout_external_syms (input_bfd); strings = obj_aout_external_strings (input_bfd); sym_hashes = obj_aout_sym_hashes (input_bfd); @@ -4578,9 +4578,9 @@ pdp11_aout_link_input_section (finfo, input_bfd, input_section, relocs, howto = howto_table_pdp11 + howto_idx; } - if (relocateable) + if (relocatable) { - /* We are generating a relocateable output file, and must + /* We are generating a relocatable output file, and must modify the reloc accordingly. */ if (r_extern) { diff --git a/bfd/pe-mips.c b/bfd/pe-mips.c index c9a4d58..3066aaa 100644 --- a/bfd/pe-mips.c +++ b/bfd/pe-mips.c @@ -1,6 +1,6 @@ /* BFD back-end for MIPS PE COFF files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002 Free Software Foundation, Inc. + 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Modified from coff-i386.c by DJ Delorie, dj@cygnus.com This file is part of BFD, the Binary File Descriptor library. @@ -73,7 +73,7 @@ static bfd_boolean coff_pe_mips_relocate_section section for a reference to a common symbol is the value itself plus any desired offset. Ian Taylor, Cygnus Support. */ -/* If we are producing relocateable output, we need to do some +/* If we are producing relocatable output, we need to do some adjustments to the object file that are not done by the bfd_perform_relocation function. This function is called by every reloc type to make any required adjustments. */ @@ -118,7 +118,7 @@ coff_mips_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, { /* For some reason bfd_perform_relocation always effectively ignores the addend for a COFF target when producing - relocateable output. This seems to be always wrong for 386 + relocatable output. This seems to be always wrong for 386 COFF, so we handle the addend here instead. */ diff = reloc_entry->addend; } @@ -467,7 +467,7 @@ coff_mips_rtype_to_howto (abfd, sec, rel, h, sym, addendp) #ifndef COFF_WITH_PE /* If the output symbol is common (in which case this must be a - relocateable link), we need to add in the final size of the + relocatable link), we need to add in the final size of the common symbol. */ if (h != NULL && h->root.type == bfd_link_hash_common) *addendp += h->root.u.c.size; @@ -654,7 +654,7 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd, unsigned int i; bfd_boolean got_lo; - if (info->relocateable) + if (info->relocatable) { (*_bfd_error_handler) (_("\ %s: `ld -r' not supported with PE MIPS objects\n"), @@ -722,13 +722,13 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd, if (howto == NULL) return FALSE; - /* If we are doing a relocateable link, then we can just ignore + /* If we are doing a relocatable link, then we can just ignore a PC relative reloc that is pcrel_offset. It will already - have the correct value. If this is not a relocateable link, + have the correct value. If this is not a relocatable link, then we should ignore the symbol value. */ if (howto->pc_relative && howto->pcrel_offset) { - if (info->relocateable) + if (info->relocatable) continue; if (sym != NULL && sym->n_scnum != 0) addend += sym->n_value; @@ -768,7 +768,7 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd, + sec->output_offset); } - else if (! info->relocateable) + else if (! info->relocatable) { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c index ba1c219..7f1a6a3 100644 --- a/bfd/peXXigen.c +++ b/bfd/peXXigen.c @@ -961,7 +961,7 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out) } if (coff_data (abfd)->link_info - && ! coff_data (abfd)->link_info->relocateable + && ! coff_data (abfd)->link_info->relocatable && ! coff_data (abfd)->link_info->shared && strcmp (scnhdr_int->s_name, ".text") == 0) { diff --git a/bfd/reloc.c b/bfd/reloc.c index 6aea881..09155b2 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -606,7 +606,7 @@ bfd_perform_relocation (abfd, reloc_entry, data, input_section, output_bfd, return bfd_reloc_ok; } - /* If we are not producing relocateable output, return an error if + /* If we are not producing relocatable output, return an error if the symbol is not defined. An undefined weak symbol is considered to have a value of zero (SVR4 ABI, p. 4-27). */ if (bfd_is_und_section (symbol->section) @@ -675,7 +675,7 @@ bfd_perform_relocation (abfd, reloc_entry, data, input_section, output_bfd, include the position of the location; for example, m88kbcs, or ELF. For those targets, pcrel_offset is TRUE. - If we are producing relocateable output, then we must ensure + If we are producing relocatable output, then we must ensure that this reloc will be correctly computed when the final relocation is done. If pcrel_offset is FALSE we want to wind up with the negative of the location within the section, @@ -684,7 +684,7 @@ bfd_perform_relocation (abfd, reloc_entry, data, input_section, output_bfd, we do not want to adjust the existing addend at all. FIXME: This seems logical to me, but for the case of - producing relocateable output it is not what the code + producing relocatable output it is not what the code actually does. I don't want to change it, because it seems far too likely that something will break. */ @@ -739,7 +739,7 @@ Hmmm. The first obvious point is that bfd_perform_relocation should not have any tests that depend upon the flavour. It's seem like entirely the wrong place for such a thing. The second obvious point is that the current code ignores the reloc addend when producing -relocateable output for COFF. That's peculiar. In fact, I really +relocatable output for COFF. That's peculiar. In fact, I really have no idea what the point of the line you want to remove is. A typical COFF reloc subtracts the old value of the symbol and adds in @@ -754,9 +754,9 @@ different story (we can't change it without losing backward compatibility with old object files) (coff-i386 does subtract the old value, to be compatible with existing coff-i386 targets, like SCO). -So everything works fine when not producing relocateable output. When -we are producing relocateable output, logically we should do exactly -what we do when not producing relocateable output. Therefore, your +So everything works fine when not producing relocatable output. When +we are producing relocatable output, logically we should do exactly +what we do when not producing relocatable output. Therefore, your patch is correct. In fact, it should probably always just set reloc_entry->addend to 0 for all cases, since it is, in fact, going to add the value into the object file. This won't hurt the COFF code, @@ -764,7 +764,7 @@ which doesn't use the addend; I'm not sure what it will do to other formats (the thing to check for would be whether any formats both use the addend and set partial_inplace). -When I wanted to make coff-i386 produce relocateable output, I ran +When I wanted to make coff-i386 produce relocatable output, I ran into the problem that you are running into: I wanted to remove that line. Rather than risk it, I made the coff-i386 relocs use a special function; it's coff_i386_reloc in coff-i386.c. The function @@ -1067,7 +1067,7 @@ bfd_install_relocation (abfd, reloc_entry, data_start, data_start_offset, include the position of the location; for example, m88kbcs, or ELF. For those targets, pcrel_offset is TRUE. - If we are producing relocateable output, then we must ensure + If we are producing relocatable output, then we must ensure that this reloc will be correctly computed when the final relocation is done. If pcrel_offset is FALSE we want to wind up with the negative of the location within the section, @@ -1076,7 +1076,7 @@ bfd_install_relocation (abfd, reloc_entry, data_start, data_start_offset, we do not want to adjust the existing addend at all. FIXME: This seems logical to me, but for the case of - producing relocateable output it is not what the code + producing relocatable output it is not what the code actually does. I don't want to change it, because it seems far too likely that something will break. */ @@ -1128,7 +1128,7 @@ Hmmm. The first obvious point is that bfd_install_relocation should not have any tests that depend upon the flavour. It's seem like entirely the wrong place for such a thing. The second obvious point is that the current code ignores the reloc addend when producing -relocateable output for COFF. That's peculiar. In fact, I really +relocatable output for COFF. That's peculiar. In fact, I really have no idea what the point of the line you want to remove is. A typical COFF reloc subtracts the old value of the symbol and adds in @@ -1143,9 +1143,9 @@ different story (we can't change it without losing backward compatibility with old object files) (coff-i386 does subtract the old value, to be compatible with existing coff-i386 targets, like SCO). -So everything works fine when not producing relocateable output. When -we are producing relocateable output, logically we should do exactly -what we do when not producing relocateable output. Therefore, your +So everything works fine when not producing relocatable output. When +we are producing relocatable output, logically we should do exactly +what we do when not producing relocatable output. Therefore, your patch is correct. In fact, it should probably always just set reloc_entry->addend to 0 for all cases, since it is, in fact, going to add the value into the object file. This won't hurt the COFF code, @@ -1153,7 +1153,7 @@ which doesn't use the addend; I'm not sure what it will do to other formats (the thing to check for would be whether any formats both use the addend and set partial_inplace). -When I wanted to make coff-i386 produce relocateable output, I ran +When I wanted to make coff-i386 produce relocatable output, I ran into the problem that you are running into: I wanted to remove that line. Rather than risk it, I made the coff-i386 relocs use a special function; it's coff_i386_reloc in coff-i386.c. The function @@ -1331,7 +1331,7 @@ space consuming. For each target: function than to try to deal with it. This routine does a final relocation. Whether it is useful for a - relocateable link depends upon how the object format defines + relocatable link depends upon how the object format defines relocations. FIXME: This routine ignores any special_function in the HOWTO, @@ -4066,7 +4066,7 @@ SYNOPSIS struct bfd_link_info *link_info, struct bfd_link_order *link_order, bfd_byte *data, - bfd_boolean relocateable, + bfd_boolean relocatable, asymbol **symbols); DESCRIPTION @@ -4077,12 +4077,12 @@ DESCRIPTION bfd_byte * bfd_generic_get_relocated_section_contents (abfd, link_info, link_order, data, - relocateable, symbols) + relocatable, symbols) bfd *abfd; struct bfd_link_info *link_info; struct bfd_link_order *link_order; bfd_byte *data; - bfd_boolean relocateable; + bfd_boolean relocatable; asymbol **symbols; { /* Get enough memory to hold the stuff. */ @@ -4131,10 +4131,10 @@ bfd_generic_get_relocated_section_contents (abfd, link_info, link_order, data, *parent, (PTR) data, input_section, - relocateable ? abfd : (bfd *) NULL, + relocatable ? abfd : (bfd *) NULL, &error_message); - if (relocateable) + if (relocatable) { asection *os = input_section->output_section; diff --git a/bfd/reloc16.c b/bfd/reloc16.c index 39f36e7..3a4c3d3 100644 --- a/bfd/reloc16.c +++ b/bfd/reloc16.c @@ -1,6 +1,6 @@ /* 8 and 16 bit COFF relocation functions, for BFD. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001, - 2002 Free Software Foundation, Inc. + 2002, 2003 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -240,13 +240,13 @@ bfd_coff_reloc16_get_relocated_section_contents (in_abfd, link_info, link_order, data, - relocateable, + relocatable, symbols) bfd *in_abfd; struct bfd_link_info *link_info; struct bfd_link_order *link_order; bfd_byte *data; - bfd_boolean relocateable; + bfd_boolean relocatable; asymbol **symbols; { /* Get enough memory to hold the stuff. */ @@ -259,11 +259,11 @@ bfd_coff_reloc16_get_relocated_section_contents (in_abfd, if (reloc_size < 0) return NULL; - /* If producing relocateable output, don't bother to relax. */ - if (relocateable) + /* If producing relocatable output, don't bother to relax. */ + if (relocatable) return bfd_generic_get_relocated_section_contents (in_abfd, link_info, link_order, - data, relocateable, + data, relocatable, symbols); /* Read in the section. */ diff --git a/bfd/sparclinux.c b/bfd/sparclinux.c index 40e49c8..0a936b1 100644 --- a/bfd/sparclinux.c +++ b/bfd/sparclinux.c @@ -354,7 +354,7 @@ linux_add_one_symbol (info, abfd, name, flags, section, value, string, insert = FALSE; - if (! info->relocateable + if (! info->relocatable && linux_hash_table (info)->dynobj == NULL && strcmp (name, SHARABLE_CONFLICTS) == 0 && (flags & BSF_CONSTRUCTOR) != 0 diff --git a/bfd/sunos.c b/bfd/sunos.c index 4569e80..fb8e17b 100644 --- a/bfd/sunos.c +++ b/bfd/sunos.c @@ -1,6 +1,6 @@ /* BFD backend for SunOS binaries. Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 2000, 2001, - 2002 Free Software Foundation, Inc. + 2002, 2003 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -884,7 +884,7 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp) { if (! sunos_create_dynamic_sections (abfd, info, ((abfd->flags & DYNAMIC) != 0 - && !info->relocateable))) + && !info->relocatable))) return FALSE; } @@ -911,7 +911,7 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp) /* The native linker seems to just ignore dynamic objects when -r is used. */ - if (info->relocateable) + if (info->relocatable) return TRUE; /* There's no hope of using a dynamic object which does not exactly @@ -1326,7 +1326,7 @@ bfd_sunos_size_dynamic_sections (output_bfd, info, sdynptr, sneedptr, *sneedptr = NULL; *srulesptr = NULL; - if (info->relocateable) + if (info->relocatable) return TRUE; if (output_bfd->xvec != &MY(vec)) @@ -1005,7 +1005,7 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound, (bfd_vma) 0, strsize)) return FALSE; - /* If this is a relocateable object file, we have to relocate + /* If this is a relocatable object file, we have to relocate the entries in .stab. This should always be simple 32 bit relocations against symbols defined in this object file, so this should be no big deal. */ diff --git a/bfd/versados.c b/bfd/versados.c index 1301c58..ee0897a 100644 --- a/bfd/versados.c +++ b/bfd/versados.c @@ -1,5 +1,5 @@ /* BFD back-end for VERSAdos-E objects. - Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002 + Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>. @@ -23,11 +23,11 @@ /* SUBSECTION - VERSAdos-E relocateable object file format + VERSAdos-E relocatable object file format DESCRIPTION - This module supports reading of VERSAdos relocateable + This module supports reading of VERSAdos relocatable object files. A VERSAdos file looks like contains @@ -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, 2002 + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Klaus K"ampf (kkaempf@rmi.de) @@ -132,7 +132,7 @@ static int vms_sizeof_headers static bfd_byte *vms_bfd_get_relocated_section_contents PARAMS ((bfd *abfd, struct bfd_link_info *link_info, struct bfd_link_order *link_order, bfd_byte *data, - bfd_boolean relocateable, asymbol **symbols)); + bfd_boolean relocatable, asymbol **symbols)); static bfd_boolean vms_bfd_relax_section PARAMS ((bfd *abfd, asection *section, struct bfd_link_info *link_info, bfd_boolean *again)); @@ -1691,17 +1691,17 @@ vms_sizeof_headers (abfd, reloc) static bfd_byte * vms_bfd_get_relocated_section_contents (abfd, link_info, link_order, data, - relocateable, symbols) + relocatable, symbols) bfd *abfd ATTRIBUTE_UNUSED; struct bfd_link_info *link_info ATTRIBUTE_UNUSED; struct bfd_link_order *link_order ATTRIBUTE_UNUSED; bfd_byte *data ATTRIBUTE_UNUSED; - bfd_boolean relocateable ATTRIBUTE_UNUSED; + bfd_boolean relocatable ATTRIBUTE_UNUSED; asymbol **symbols ATTRIBUTE_UNUSED; { #if VMS_DEBUG vms_debug (1, "vms_bfd_get_relocated_section_contents(%p, %p, %p, %p, %s, %p)\n", - abfd, link_info, link_order, data, (relocateable)?"True":"False", symbols); + abfd, link_info, link_order, data, (relocatable)?"True":"False", symbols); #endif return 0; } diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c index 0505c86..6f94029 100644 --- a/bfd/xcofflink.c +++ b/bfd/xcofflink.c @@ -1,5 +1,5 @@ /* POWER/PowerPC XCOFF linker support. - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 + Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Ian Lance Taylor <ian@cygnus.com>, Cygnus Support. @@ -2932,7 +2932,7 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry, } /* Garbage collect unused sections. */ - if (info->relocateable + if (info->relocatable || ! gc || hentry == NULL || (hentry->root.type != bfd_link_hash_defined @@ -5294,7 +5294,7 @@ xcoff_link_input_bfd (finfo, input_bfd) } else { - if (! finfo->info->relocateable + if (! finfo->info->relocatable && (h->flags & XCOFF_DEF_DYNAMIC) == 0 && (h->flags & XCOFF_IMPORT) == 0) { |