diff options
Diffstat (limited to 'bfd')
64 files changed, 87 insertions, 2748 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index fd43f0e36ca..04ff99b15f8 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,22 @@ 2005-02-01 Ben Elliston <bje@au.ibm.com> - + + * aout-arm.c, aout-target.h, aoutx.h, archive.c, armnetbsd.c, + bfd-in.h, bfdio.c, coff-alpha.c, coff-arm.c, coff-h8300.c, + coff-i860.c, coff-mcore.c, coff-or32.c, coff-ppc.c, coff-sh.c, + coff-sparc.c, coffcode.h, coffgen.c, cofflink.c, cpu-cris.c, + cpu-h8500.c, cpu-ns32k.c, ecoff.c, ecofflink.c, elf.c, + elf32-dlx.c, elf32-fr30.c, elf32-frv.c, elf32-hppa.c, + elf32-i860.c, elf32-ip2k.c, elf32-m32r.c, elf32-sh.c, + elf32-v850.c, elf64-mips.c, elf64-sparc.c, elflink.c, + i386aout.c, i386msdos.c, i386os9k.c, ieee.c, mach-o.c, + nlm32-sparc.c, oasys.c, opncls.c, pdp11.c, pe-mips.c, peXXigen.c, + pef.c, peicode.h, reloc.c, riscix.c, section.c, simple.c, som.c, + sparclynx.c, targets.c, vms-misc.c, vms-tir.c, xsym.c, doc/chew.c, + hosts/delta68.h, hosts/vaxbsd.h: Remove #if 0'd code + throughout. Similarly, collapse #if 1'd code. + +2005-02-01 Ben Elliston <bje@au.ibm.com> + * elf-bfd.h (bfd_elf_discard_group): Remove. * elf.c (bfd_elf_discard_group): Likewise. * elfxx-target.h (bfd_elfNN_bfd_discard_group): Remove macro. diff --git a/bfd/aout-arm.c b/bfd/aout-arm.c index 38ecfab9d41..5abf3449209 100644 --- a/bfd/aout-arm.c +++ b/bfd/aout-arm.c @@ -411,11 +411,6 @@ MY_swap_std_reloc_out (abfd, g, natptr) r_pcrel = 1; } -#if 0 - /* For a standard reloc, the addend is in the object file. */ - r_addend = g->addend + (*(g->sym_ptr_ptr))->section->output_section->vma; -#endif - /* name was clobbered by aout_write_syms to be symbol index */ /* If this relocation is relative to a symbol then set the diff --git a/bfd/aout-target.h b/bfd/aout-target.h index 913339f39d9..0bd78d15292 100644 --- a/bfd/aout-target.h +++ b/bfd/aout-target.h @@ -124,11 +124,6 @@ MY(callback) (abfd) /* Don't set sizes now -- can't be sure until we know arch & mach. Sizes get set in set_sizes callback, later. */ -#if 0 - adata(abfd).page_size = TARGET_PAGE_SIZE; - adata(abfd).segment_size = SEGMENT_SIZE; - adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE; -#endif return abfd->xvec; } @@ -207,16 +202,9 @@ static bfd_boolean MY(mkobject) (abfd) bfd *abfd; { - if (! NAME(aout,mkobject) (abfd)) - return FALSE; -#if 0 /* Sizes get set in set_sizes callback, later, after we know - the architecture and machine. */ - adata(abfd).page_size = TARGET_PAGE_SIZE; - adata(abfd).segment_size = SEGMENT_SIZE; - adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE; -#endif - return TRUE; + return NAME (aout, mkobject (abfd)); } + #define MY_mkobject MY(mkobject) #endif diff --git a/bfd/aoutx.h b/bfd/aoutx.h index 34a28701756..2171e84560d 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -654,14 +654,7 @@ NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p) #endif /* STAT_FOR_EXEC */ if (result) - { -#if 0 /* These should be set correctly anyways. */ - abfd->sections = obj_textsec (abfd); - obj_textsec (abfd)->next = obj_datasec (abfd); - obj_datasec (abfd)->next = obj_bsssec (abfd); -#endif - return result; - } + return result; error_ret: bfd_release (abfd, rawptr); @@ -917,9 +910,6 @@ adjust_o_magic (abfd, execp) /* Data. */ if (!obj_datasec (abfd)->user_set_vma) { -#if 0 /* ?? Does alignment in the file image really matter? */ - pad = align_power (vma, obj_datasec (abfd)->alignment_power) - vma; -#endif obj_textsec (abfd)->size += pad; pos += pad; vma += pad; @@ -934,9 +924,6 @@ adjust_o_magic (abfd, execp) /* BSS. */ if (!obj_bsssec (abfd)->user_set_vma) { -#if 0 - pad = align_power (vma, obj_bsssec (abfd)->alignment_power) - vma; -#endif obj_datasec (abfd)->size += pad; pos += pad; vma += pad; @@ -1509,88 +1496,6 @@ translate_from_native_sym_flags (abfd, cache_ptr) /* This code is no longer needed. It used to be used to make the linker handle set symbols, but they are now handled in the add_symbols routine instead. */ -#if 0 - asection *section; - arelent_chain *reloc; - asection *into_section; - bfd_size_type amt; - - /* This is a set symbol. The name of the symbol is the name - of the set (e.g., __CTOR_LIST__). The value of the symbol - is the value to add to the set. We create a section with - the same name as the symbol, and add a reloc to insert the - appropriate value into the section. - - This action is actually obsolete; it used to make the - linker do the right thing, but the linker no longer uses - this function. */ - - section = bfd_get_section_by_name (abfd, cache_ptr->symbol.name); - if (section == NULL) - { - char *copy; - - amt = strlen (cache_ptr->symbol.name) + 1; - copy = bfd_alloc (abfd, amt); - if (copy == NULL) - return FALSE; - - strcpy (copy, cache_ptr->symbol.name); - section = bfd_make_section (abfd, copy); - if (section == NULL) - return FALSE; - } - - amt = sizeof (arelent_chain); - reloc = (arelent_chain *) bfd_alloc (abfd, amt); - if (reloc == NULL) - return FALSE; - - /* Build a relocation entry for the constructor. */ - switch (cache_ptr->type & N_TYPE) - { - case N_SETA: - into_section = bfd_abs_section_ptr; - cache_ptr->type = N_ABS; - break; - case N_SETT: - into_section = obj_textsec (abfd); - cache_ptr->type = N_TEXT; - break; - case N_SETD: - into_section = obj_datasec (abfd); - cache_ptr->type = N_DATA; - break; - case N_SETB: - into_section = obj_bsssec (abfd); - cache_ptr->type = N_BSS; - break; - } - - /* Build a relocation pointing into the constructor section - pointing at the symbol in the set vector specified. */ - reloc->relent.addend = cache_ptr->symbol.value; - cache_ptr->symbol.section = into_section; - reloc->relent.sym_ptr_ptr = into_section->symbol_ptr_ptr; - - /* We modify the symbol to belong to a section depending upon - the name of the symbol, and add to the size of the section - to contain a pointer to the symbol. Build a reloc entry to - relocate to this symbol attached to this section. */ - section->flags = SEC_CONSTRUCTOR | SEC_RELOC; - - section->reloc_count++; - section->alignment_power = 2; - - reloc->next = section->constructor_chain; - section->constructor_chain = reloc; - reloc->relent.address = section->size; - section->size += BYTES_IN_WORD; - - reloc->relent.howto = CTOR_TABLE_RELOC_HOWTO (abfd); - -#endif /* 0 */ - switch (cache_ptr->type & N_TYPE) { case N_SETA: @@ -2077,11 +1982,6 @@ NAME(aout,swap_std_reloc_out) (abfd, g, natptr) r_jmptable = (g->howto->type & 16) != 0; r_relative = (g->howto->type & 32) != 0; -#if 0 - /* For a standard reloc, the addend is in the object file. */ - r_addend = g->addend + (*(g->sym_ptr_ptr))->section->output_section->vma; -#endif - /* Name was clobbered by aout_write_syms to be symbol index. */ /* If this relocation is relative to a symbol then set the diff --git a/bfd/archive.c b/bfd/archive.c index ec8a086df99..da25f607868 100644 --- a/bfd/archive.c +++ b/bfd/archive.c @@ -642,14 +642,6 @@ bfd_generic_archive_p (bfd *abfd) if (bfd_check_format (first, bfd_object) && first->xvec != abfd->xvec) { -#if 0 - /* We ought to close `first' here, but we can't, because - we have no way to remove it from the archive cache. - It's close to impossible to figure out when we can - release bfd_ardata. FIXME. */ - bfd_close (first); - bfd_release (abfd, bfd_ardata (abfd)); -#endif bfd_set_error (bfd_error_wrong_object_format); bfd_ardata (abfd) = tdata_hold; return NULL; @@ -784,7 +776,6 @@ do_slurp_coff_armap (bfd *abfd) nsymz = bfd_getb32 (int_buf); stringsize = parsed_size - (4 * nsymz) - 4; -#if 1 /* ... except that some archive formats are broken, and it may be our fault - the i960 little endian coff sometimes has big and sometimes little, because our tools changed. Here's a horrible hack to clean @@ -799,7 +790,6 @@ do_slurp_coff_armap (bfd *abfd) stringsize = parsed_size - (4 * nsymz) - 4; swap = bfd_getl32; } -#endif /* The coff armap must be read sequentially. So we construct a bsd-style one in core all at once, for simplicity. */ @@ -1092,9 +1082,6 @@ _bfd_slurp_extended_name_table (bfd *abfd) /* FIXME, we can't release namedata here because it was allocated below extended_names on the objalloc... */ -#if 0 - bfd_release (abfd, namedata); -#endif } return TRUE; } @@ -1654,11 +1641,7 @@ _bfd_write_archive_contents (bfd *arch) if (makemap && ! hasobjects) { /* Don't bother if we won't make a map! */ - if ((bfd_check_format (current, bfd_object)) -#if 0 /* FIXME -- these are not set correctly */ - && ((bfd_get_file_flags (current) & HAS_SYMS)) -#endif - ) + if ((bfd_check_format (current, bfd_object))) hasobjects = TRUE; } } diff --git a/bfd/armnetbsd.c b/bfd/armnetbsd.c index d82e98f49eb..fdbba77afce 100644 --- a/bfd/armnetbsd.c +++ b/bfd/armnetbsd.c @@ -35,19 +35,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* This needs to start with a.out so GDB knows it is an a.out variant. */ #define TARGETNAME "a.out-arm-netbsd" -#if 0 -#define NAME(x,y) CONCAT3 (aoutarm,_32_,y) - -#define aoutarm_32_get_section_contents aout_32_get_section_contents - -#define MY_bfd_reloc_type_lookup aoutarm_bfd_reloc_type_lookup - -#include "bfd.h" /* To ensure following declaration is OK */ - -const struct reloc_howto_struct * -MY_bfd_reloc_type_lookup - PARAMS ((bfd * abfd AND - bfd_reloc_code_real_type code)); -#endif - #include "netbsd.h" diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index 1ca14500826..8695e684fa0 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -89,14 +89,6 @@ typedef int bfd_boolean; #define FALSE 0 #define TRUE 1 -#if 0 -/* Poison. */ -#undef false -#undef true -#define false dont_use_false_in_bfd -#define true dont_use_true_in_bfd -#endif - #ifdef BFD64 #ifndef BFD_HOST_64_BIT diff --git a/bfd/bfdio.c b/bfd/bfdio.c index a7505270199..51deabc48a1 100644 --- a/bfd/bfdio.c +++ b/bfd/bfdio.c @@ -299,20 +299,6 @@ bfd_seek (bfd *abfd, file_ptr position, int direction) if (abfd->format != bfd_archive && abfd->my_archive == 0) { -#if 0 - /* Explanation for this code: I'm only about 95+% sure that the above - conditions are sufficient and that all i/o calls are properly - adjusting the `where' field. So this is sort of an `assert' - that the `where' field is correct. If we can go a while without - tripping the abort, we can probably safely disable this code, - so that the real optimizations happen. */ - file_ptr where_am_i_now; - where_am_i_now = real_ftell (bfd_cache_lookup (abfd)); - if (abfd->my_archive) - where_am_i_now -= abfd->origin; - if (where_am_i_now != abfd->where) - abort (); -#endif if (direction == SEEK_SET && (bfd_vma) position == abfd->where) return 0; } diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c index 68dd7652786..38d2e699b94 100644 --- a/bfd/coff-alpha.c +++ b/bfd/coff-alpha.c @@ -1221,23 +1221,6 @@ alpha_bfd_reloc_type_lookup (abfd, code) case BFD_RELOC_64_PCREL: alpha_type = ALPHA_R_SREL64; break; -#if 0 - case ???: - alpha_type = ALPHA_R_OP_PUSH; - break; - case ???: - alpha_type = ALPHA_R_OP_STORE; - break; - case ???: - alpha_type = ALPHA_R_OP_PSUB; - break; - case ???: - alpha_type = ALPHA_R_OP_PRSHIFT; - break; - case ???: - alpha_type = ALPHA_R_GPVALUE; - break; -#endif default: return (reloc_howto_type *) NULL; } diff --git a/bfd/coff-arm.c b/bfd/coff-arm.c index 05229caeabc..c6580a81a4b 100644 --- a/bfd/coff-arm.c +++ b/bfd/coff-arm.c @@ -1288,11 +1288,6 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, #ifdef ARM_WINCE /* MS ARM-CE makes the reloc relative to the opcode's pc, not 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->relocatable) - addend -= 8; -#endif #endif /* If we are doing a relocatable link, then we can just ignore @@ -1342,7 +1337,6 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, } else { -#if 1 /* THUMBEXTENSION */ /* We don't output the stubs if we are generating a relocatable output file, since we may as well leave the stub generation to the final linker pass. If we fail to @@ -1579,7 +1573,6 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, if (done) rstat = bfd_reloc_ok; else -#endif /* THUMBEXTENSION */ if ( h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) { @@ -1608,7 +1601,6 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, rel->r_vaddr); } -#if 1 /* THUMBEXTENSION */ if (done) rstat = bfd_reloc_ok; #ifndef ARM_WINCE @@ -1729,7 +1721,6 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, } #endif else -#endif /* THUMBEXTENSION */ if (info->relocatable && ! howto->partial_inplace) rstat = bfd_reloc_ok; else @@ -1737,7 +1728,6 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, contents, rel->r_vaddr - input_section->vma, val, addend); -#if 1 /* THUMBEXTENSION */ /* FIXME: 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 */ @@ -1774,7 +1764,6 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, bfd_put_32 (input_bfd, x | 1, location); } } -#endif /* THUMBEXTENSION */ switch (rstat) { @@ -1824,9 +1813,6 @@ bfd_arm_allocate_interworking_sections (info) asection * s; bfd_byte * foo; struct coff_arm_link_hash_table * globals; -#if 0 - static char test_char = '1'; -#endif globals = coff_arm_hash_table (info); @@ -1843,9 +1829,6 @@ bfd_arm_allocate_interworking_sections (info) foo = (bfd_byte *) bfd_alloc (globals->bfd_of_glue_owner, globals->arm_glue_size); -#if 0 - memset (foo, test_char, (size_t) globals->arm_glue_size); -#endif s->size = globals->arm_glue_size; s->contents = foo; @@ -1862,9 +1845,6 @@ bfd_arm_allocate_interworking_sections (info) foo = (bfd_byte *) bfd_alloc (globals->bfd_of_glue_owner, globals->thumb_glue_size); -#if 0 - memset (foo, test_char, (size_t) globals->thumb_glue_size); -#endif s->size = globals->thumb_glue_size; s->contents = foo; diff --git a/bfd/coff-h8300.c b/bfd/coff-h8300.c index 0e07fb1673e..0dfbd8b0a8d 100644 --- a/bfd/coff-h8300.c +++ b/bfd/coff-h8300.c @@ -397,11 +397,7 @@ reloc_processing (arelent *relent, struct internal_reloc *reloc, relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; relent->addend = reloc->r_offset; - relent->address -= section->vma; -#if 0 - relent->section = 0; -#endif } static bfd_boolean diff --git a/bfd/coff-i860.c b/bfd/coff-i860.c index e18e30ba8ae..e7cbf8a96cd 100644 --- a/bfd/coff-i860.c +++ b/bfd/coff-i860.c @@ -463,31 +463,7 @@ static reloc_howto_type howto_table[] = FIXME: This macro refers to symbols and asect; these are from the calling function, not the macro arguments. */ -/* FIXME: This was copied from the i386 version originally but - appears to be wrong for i860. For now we'll do nothing. */ -#if 0 -#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \ - { \ - coff_symbol_type *coffsym = (coff_symbol_type *) NULL; \ - if (ptr && bfd_asymbol_bfd (ptr) != abfd) \ - coffsym = (obj_symbols (abfd) \ - + (cache_ptr->sym_ptr_ptr - symbols)); \ - else if (ptr) \ - coffsym = coff_symbol_from (abfd, ptr); \ - if (coffsym != (coff_symbol_type *) NULL \ - && coffsym->native->u.syment.n_scnum == 0) \ - cache_ptr->addend = - coffsym->native->u.syment.n_value; \ - else if (ptr && bfd_asymbol_bfd (ptr) == abfd \ - && ptr->section != (asection *) NULL) \ - cache_ptr->addend = - (ptr->section->vma + ptr->value); \ - else \ - cache_ptr->addend = 0; \ - if (ptr && howto_table[reloc.r_type].pc_relative) \ - cache_ptr->addend += asect->vma; \ - } -#else #define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) -#endif /* We use the special COFF backend linker. */ #define coff_relocate_section _bfd_coff_generic_relocate_section diff --git a/bfd/coff-mcore.c b/bfd/coff-mcore.c index 865e3980a72..20e2eb4db45 100644 --- a/bfd/coff-mcore.c +++ b/bfd/coff-mcore.c @@ -40,10 +40,6 @@ Boston, MA 02111-1307, USA. */ final_link routine once. */ extern bfd_boolean mcore_bfd_coff_final_link PARAMS ((bfd *, struct bfd_link_info *)); -#if 0 -static struct bfd_link_hash_table *coff_mcore_link_hash_table_create - PARAMS ((bfd *)); -#endif static bfd_reloc_status_type mcore_coff_unsupported_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); static bfd_boolean coff_mcore_relocate_section @@ -222,35 +218,6 @@ mcore_hash_table; #define coff_mcore_hash_table(info) \ ((mcore_hash_table *) ((info)->hash)) -#if 0 -/* Create an MCore coff linker hash table. */ - -static struct bfd_link_hash_table * -coff_mcore_link_hash_table_create (abfd) - bfd * abfd; -{ - mcore_hash_table * ret; - - ret = (mcore_hash_table *) bfd_malloc ((bfd_size_type) sizeof (* ret)); - if (ret == (mcore_hash_table *) NULL) - return NULL; - - if (! _bfd_coff_link_hash_table_init - (& ret->root, abfd, _bfd_coff_link_hash_newfunc)) - { - free (ret); - return (struct bfd_link_hash_table *) NULL; - } - - ret->bfd_of_toc_owner = NULL; - ret->global_toc_size = 0; - ret->import_table_size = 0; - ret->first_thunk_address = 0; - ret->thunk_size = 0; - - return & ret->root.root; -} -#endif /* Add an entry to the base file. */ diff --git a/bfd/coff-or32.c b/bfd/coff-or32.c index af30afdb7f0..6e02b90c8a5 100644 --- a/bfd/coff-or32.c +++ b/bfd/coff-or32.c @@ -148,23 +148,14 @@ or32_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd, signed_value = 0; signed_value += sym_value + reloc_entry->addend; -#if 0 - if ((signed_value & ~0x3ffff) == 0) - { /* Absolute jmp/call. */ - insn |= (1<<24); /* Make it absolute. */ - /* FIXME: Should we change r_type to R_IABS. */ - } - else -#endif - { - /* Relative jmp/call, so subtract from the value the - address of the place we're coming from. */ - signed_value -= (reloc_entry->address - + input_section->output_section->vma - + input_section->output_offset); - if (signed_value > 0x7ffffff || signed_value < -0x8000000) - return bfd_reloc_overflow; - } + /* Relative jmp/call, so subtract from the value the + address of the place we're coming from. */ + signed_value -= (reloc_entry->address + + input_section->output_section->vma + + input_section->output_offset); + if (signed_value > 0x7ffffff || signed_value < -0x8000000) + return bfd_reloc_overflow; + signed_value >>= 2; insn = INSERT_JUMPTARG (insn, signed_value); bfd_put_32 (abfd, insn, hit_data); @@ -465,25 +456,15 @@ coff_or32_relocate_section (output_bfd, info, input_bfd, input_section, /* Determine the destination of the jump. */ signed_value += val; -#if 0 - if ((signed_value & ~0x3ffff) == 0) - { - /* We can use an absolute jump. */ - insn |= (1 << 24); - } - else -#endif - { - /* Make the destination PC relative. */ - signed_value -= (input_section->output_section->vma - + input_section->output_offset - + (rel->r_vaddr - input_section->vma)); - if (signed_value > 0x7ffffff || signed_value < - 0x8000000) - { - overflow = TRUE; - signed_value = 0; - } - } + /* Make the destination PC relative. */ + signed_value -= (input_section->output_section->vma + + input_section->output_offset + + (rel->r_vaddr - input_section->vma)); + if (signed_value > 0x7ffffff || signed_value < - 0x8000000) + { + overflow = TRUE; + signed_value = 0; + } /* Put the adjusted value back into the instruction. */ signed_value >>= 2; diff --git a/bfd/coff-ppc.c b/bfd/coff-ppc.c index 28d7985bfea..7ca8b5ace4e 100644 --- a/bfd/coff-ppc.c +++ b/bfd/coff-ppc.c @@ -326,15 +326,6 @@ static bfd_reloc_status_type ppc_refhi_reloc PARAMS ((bfd *abfd, asection *section, bfd *output_bfd, char **error)); -#if 0 -static bfd_reloc_status_type ppc_reflo_reloc PARAMS ((bfd *abfd, - arelent *reloc, - asymbol *symbol, - PTR data, - asection *section, - bfd *output_bfd, - char **error)); -#endif static bfd_reloc_status_type ppc_pair_reloc PARAMS ((bfd *abfd, arelent *reloc, asymbol *symbol, @@ -351,15 +342,6 @@ static bfd_reloc_status_type ppc_toc16_reloc PARAMS ((bfd *abfd, bfd *output_bfd, char **error)); -#if 0 -static bfd_reloc_status_type ppc_addr32nb_reloc PARAMS ((bfd *abfd, - arelent *reloc, - asymbol *symbol, - PTR data, - asection *section, - bfd *output_bfd, - char **error)); -#endif static bfd_reloc_status_type ppc_section_reloc PARAMS ((bfd *abfd, arelent *reloc, asymbol *symbol, @@ -1005,67 +987,6 @@ static bfd_boolean in_reloc_p(abfd, howto) && (howto->type != IMAGE_REL_PPC_TOCREL16_DEFN) ; } -#if 0 - -/* This function is in charge of performing all the ppc PE relocations - Don't yet know if we want to do this this particular way ... (krk). */ -/* FIXME: (it is not yet enabled). */ - -static bfd_reloc_status_type -pe_ppc_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd, - error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol_in; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; -{ - /* The consth relocation comes in two parts, we have to remember - the state between calls, in these variables. */ - static bfd_boolean part1_consth_active = FALSE; - static unsigned long part1_consth_value; - - unsigned long sym_value; - unsigned short r_type; - unsigned long addr = reloc_entry->address ; /*+ input_section->vma*/ - - r_type = reloc_entry->howto->type; - - if (output_bfd) - { - /* Partial linking - do nothing. */ - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - if (symbol_in != NULL - && bfd_is_und_section (symbol_in->section)) - { - /* Keep the state machine happy in case we're called again. */ - if (r_type == IMAGE_REL_PPC_REFHI) - { - part1_consth_active = TRUE; - part1_consth_value = 0; - } - return(bfd_reloc_undefined); - } - - if ((part1_consth_active) && (r_type != IMAGE_REL_PPC_PAIR)) - { - part1_consth_active = FALSE; - *error_message = (char *) _("Missing PAIR"); - return(bfd_reloc_dangerous); - } - - sym_value = get_symbol_value(symbol_in); - - return(bfd_reloc_ok); -} - -#endif /* 0 */ - /* The reloc processing routine for the optimized COFF linker. */ static bfd_boolean @@ -1773,30 +1694,6 @@ ppc_refhi_reloc (abfd, reloc_entry, symbol, data, return bfd_reloc_undefined; } -#if 0 - -static bfd_reloc_status_type -ppc_reflo_reloc (abfd, reloc_entry, symbol, data, - input_section, output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; -{ - UN_IMPL("REFLO"); - DUMP_RELOC("REFLO",reloc_entry); - - if (output_bfd == (bfd *) NULL) - return bfd_reloc_continue; - - return bfd_reloc_undefined; -} - -#endif - static bfd_reloc_status_type ppc_pair_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message) @@ -1837,31 +1734,6 @@ ppc_toc16_reloc (abfd, reloc_entry, symbol, data, return bfd_reloc_ok; } -#if 0 - -/* ADDR32NB : 32 bit address relative to the virtual origin. - (On the alpha, this is always a linker generated thunk) - (i.e. 32bit addr relative to the image base). */ - -static bfd_reloc_status_type -ppc_addr32nb_reloc (abfd, reloc_entry, symbol, data, - input_section, output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; -{ - UN_IMPL("ADDR32NB"); - DUMP_RELOC("ADDR32NB",reloc_entry); - - return bfd_reloc_ok; -} - -#endif - static bfd_reloc_status_type ppc_secrel_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message) @@ -2108,10 +1980,6 @@ ppc_coff_reloc_type_lookup (abfd, code) #define coff_bfd_final_link ppc_bfd_coff_final_link #ifndef COFF_IMAGE_WITH_PE -/* FIXME: This no longer works. */ -#if 0 -#define coff_swap_sym_in_hook ppc_coff_swap_sym_in_hook -#endif #endif #define SELECT_RELOC(internal, howto) {internal.r_type=howto->type;} @@ -2140,62 +2008,6 @@ ppc_coff_reloc_type_lookup (abfd, code) #include "coffcode.h" #ifndef COFF_IMAGE_WITH_PE -/* FIXME: This no longer works. */ -#if 0 -/* FIXME: - What we're trying to do here is allocate a toc section (early), and attach - it to the last bfd to be processed. This avoids the problem of having a toc - written out before all files have been processed. This code allocates - a toc section for every file, and records the last one seen. There are - at least two problems with this approach: - 1. We allocate whole bunches of toc sections that are ignored, but at - at least we will not allocate a toc if no .toc is present. - 2. It's not clear to me that being the last bfd read necessarily means - that you are the last bfd closed. - 3. Doing it on a "swap in" hook depends on when the "swap in" is called, - and how often, etc. It's not clear to me that there isn't a hole here. */ -static void ppc_coff_swap_sym_in_hook PARAMS ((bfd *, PTR, PTR)); - -static void -ppc_coff_swap_sym_in_hook (abfd, ext1, in1) - bfd *abfd; - PTR ext1 ATTRIBUTE_UNUSED; - PTR in1; -{ - struct internal_syment * in = (struct internal_syment *)in1; - - if (bfd_of_toc_owner != 0) /* We already have a toc, so go home. */ - return; - - if (strcmp (in->_n._n_name, ".toc") == 0) - { - flagword flags; - register asection *s; - - s = bfd_get_section_by_name (abfd, TOC_SECTION_NAME); - if (s != NULL) - return; - - flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY ; - - s = bfd_make_section (abfd, TOC_SECTION_NAME); - - if (s == NULL - || !bfd_set_section_flags (abfd, s, flags) - || !bfd_set_section_alignment (abfd, s, 2)) - /* FIXME: set appropriate bfd error. */ - abort (); - - /* Save the bfd for later allocation. */ - bfd_of_toc_owner = abfd; - } - - return; -} -#endif -#endif - -#ifndef COFF_IMAGE_WITH_PE static bfd_boolean ppc_do_last PARAMS ((bfd *)); static bfd *ppc_get_last PARAMS ((void)); diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c index 93d0da1df8e..0433c9a2ab9 100644 --- a/bfd/coff-sh.c +++ b/bfd/coff-sh.c @@ -1656,26 +1656,6 @@ static const struct sh_opcode sh_opcode01[] = { 0x00ba, SETS1 | USESSP } /* sts y1,rn */ }; -/* These sixteen instructions can be handled with one table entry below. */ -#if 0 - { 0x0002, SETS1 | USESSP }, /* stc sr,rn */ - { 0x0012, SETS1 | USESSP }, /* stc gbr,rn */ - { 0x0022, SETS1 | USESSP }, /* stc vbr,rn */ - { 0x0032, SETS1 | USESSP }, /* stc ssr,rn */ - { 0x0042, SETS1 | USESSP }, /* stc spc,rn */ - { 0x0052, SETS1 | USESSP }, /* stc mod,rn */ - { 0x0062, SETS1 | USESSP }, /* stc rs,rn */ - { 0x0072, SETS1 | USESSP }, /* stc re,rn */ - { 0x0082, SETS1 | USESSP }, /* stc r0_bank,rn */ - { 0x0092, SETS1 | USESSP }, /* stc r1_bank,rn */ - { 0x00a2, SETS1 | USESSP }, /* stc r2_bank,rn */ - { 0x00b2, SETS1 | USESSP }, /* stc r3_bank,rn */ - { 0x00c2, SETS1 | USESSP }, /* stc r4_bank,rn */ - { 0x00d2, SETS1 | USESSP }, /* stc r5_bank,rn */ - { 0x00e2, SETS1 | USESSP }, /* stc r6_bank,rn */ - { 0x00f2, SETS1 | USESSP } /* stc r7_bank,rn */ -#endif - static const struct sh_opcode sh_opcode02[] = { { 0x0002, SETS1 | USESSP }, /* stc <special_reg>,rn */ @@ -1806,44 +1786,6 @@ static const struct sh_opcode sh_opcode40[] = { 0x40b2, STORE | SETS1 | USES1 | USESSP }, /* sts.l y1,@-rn */ { 0x40b6, LOAD | SETS1 | SETSSP | USES1 }, /* lds.l @rm+,y1 */ { 0x40ba, SETSSP | USES1 } /* lds.l rm,y1 */ -#if 0 /* These groups sixteen insns can be - handled with one table entry each below. */ - { 0x4003, STORE | SETS1 | USES1 | USESSP }, /* stc.l sr,@-rn */ - { 0x4013, STORE | SETS1 | USES1 | USESSP }, /* stc.l gbr,@-rn */ - { 0x4023, STORE | SETS1 | USES1 | USESSP }, /* stc.l vbr,@-rn */ - { 0x4033, STORE | SETS1 | USES1 | USESSP }, /* stc.l ssr,@-rn */ - { 0x4043, STORE | SETS1 | USES1 | USESSP }, /* stc.l spc,@-rn */ - { 0x4053, STORE | SETS1 | USES1 | USESSP }, /* stc.l mod,@-rn */ - { 0x4063, STORE | SETS1 | USES1 | USESSP }, /* stc.l rs,@-rn */ - { 0x4073, STORE | SETS1 | USES1 | USESSP }, /* stc.l re,@-rn */ - { 0x4083, STORE | SETS1 | USES1 | USESSP }, /* stc.l r0_bank,@-rn */ - .. - { 0x40f3, STORE | SETS1 | USES1 | USESSP }, /* stc.l r7_bank,@-rn */ - - { 0x4007, LOAD | SETS1 | SETSSP | USES1 }, /* ldc.l @rm+,sr */ - { 0x4017, LOAD | SETS1 | SETSSP | USES1 }, /* ldc.l @rm+,gbr */ - { 0x4027, LOAD | SETS1 | SETSSP | USES1 }, /* ldc.l @rm+,vbr */ - { 0x4037, LOAD | SETS1 | SETSSP | USES1 }, /* ldc.l @rm+,ssr */ - { 0x4047, LOAD | SETS1 | SETSSP | USES1 }, /* ldc.l @rm+,spc */ - { 0x4057, LOAD | SETS1 | SETSSP | USES1 }, /* ldc.l @rm+,mod */ - { 0x4067, LOAD | SETS1 | SETSSP | USES1 }, /* ldc.l @rm+,rs */ - { 0x4077, LOAD | SETS1 | SETSSP | USES1 }, /* ldc.l @rm+,re */ - { 0x4087, LOAD | SETS1 | SETSSP | USES1 }, /* ldc.l @rm+,r0_bank */ - .. - { 0x40f7, LOAD | SETS1 | SETSSP | USES1 }, /* ldc.l @rm+,r7_bank */ - - { 0x400e, SETSSP | USES1 }, /* ldc rm,sr */ - { 0x401e, SETSSP | USES1 }, /* ldc rm,gbr */ - { 0x402e, SETSSP | USES1 }, /* ldc rm,vbr */ - { 0x403e, SETSSP | USES1 }, /* ldc rm,ssr */ - { 0x404e, SETSSP | USES1 }, /* ldc rm,spc */ - { 0x405e, SETSSP | USES1 }, /* ldc rm,mod */ - { 0x406e, SETSSP | USES1 }, /* ldc rm,rs */ - { 0x407e, SETSSP | USES1 } /* ldc rm,re */ - { 0x408e, SETSSP | USES1 } /* ldc rm,r0_bank */ - .. - { 0x40fe, SETSSP | USES1 } /* ldc rm,r7_bank */ -#endif }; static const struct sh_opcode sh_opcode41[] = diff --git a/bfd/coff-sparc.c b/bfd/coff-sparc.c index 372b1a72278..73d0af64bcb 100644 --- a/bfd/coff-sparc.c +++ b/bfd/coff-sparc.c @@ -56,25 +56,6 @@ enum reloc_type R_SPARC_max }; -#if 0 -static const char *const reloc_type_names[] = -{ - "R_SPARC_NONE", - "R_SPARC_8", "R_SPARC_16", "R_SPARC_32", - "R_SPARC_DISP8", "R_SPARC_DISP16", "R_SPARC_DISP32", - "R_SPARC_WDISP30", "R_SPARC_WDISP22", - "R_SPARC_HI22", "R_SPARC_22", - "R_SPARC_13", "R_SPARC_LO10", - "R_SPARC_GOT10", "R_SPARC_GOT13", "R_SPARC_GOT22", - "R_SPARC_PC10", "R_SPARC_PC22", - "R_SPARC_WPLT30", - "R_SPARC_COPY", - "R_SPARC_GLOB_DAT", "R_SPARC_JMP_SLOT", - "R_SPARC_RELATIVE", - "R_SPARC_UA32", -}; -#endif - /* This is stolen pretty directly from elf.c. */ static bfd_reloc_status_type bfd_coff_generic_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 30560aa8148..b9dc23c0a68 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -1066,15 +1066,11 @@ styp_to_sec_flags (abfd, hdr, name, section, flags_ptr) unhandled = "IMAGE_SCN_MEM_NOT_CACHED"; break; case IMAGE_SCN_MEM_NOT_PAGED: -#if 0 - unhandled = "IMAGE_SCN_MEM_NOT_PAGED"; -#else /* Generate a warning message rather using the 'unhandled' variable as this will allow some .sys files generate by other toolchains to be processed. See bugzilla issue 196. */ _bfd_error_handler (_("%B: Warning: Ignoring section flag IMAGE_SCN_MEM_NOT_PAGED in section %s"), abfd, name); -#endif break; case IMAGE_SCN_MEM_EXECUTE: sec_flags |= SEC_CODE; @@ -3352,86 +3348,6 @@ coff_compute_section_file_positions (abfd) return TRUE; } -#if 0 - -/* This can never work, because it is called too late--after the - section positions have been set. I can't figure out what it is - for, so I am going to disable it--Ian Taylor 20 March 1996. */ - -/* If .file, .text, .data, .bss symbols are missing, add them. */ -/* @@ Should we only be adding missing symbols, or overriding the aux - values for existing section symbols? */ -static bfd_boolean -coff_add_missing_symbols (abfd) - bfd *abfd; -{ - unsigned int nsyms = bfd_get_symcount (abfd); - asymbol **sympp = abfd->outsymbols; - asymbol **sympp2; - unsigned int i; - int need_text = 1, need_data = 1, need_bss = 1, need_file = 1; - bfd_size_type amt; - - for (i = 0; i < nsyms; i++) - { - coff_symbol_type *csym = coff_symbol_from (abfd, sympp[i]); - const char *name; - - if (csym) - { - /* Only do this if there is a coff representation of the input - symbol. */ - if (csym->native && csym->native->u.syment.n_sclass == C_FILE) - { - need_file = 0; - continue; - } - name = csym->symbol.name; - if (!name) - continue; - if (!strcmp (name, _TEXT)) - need_text = 0; -#ifdef APOLLO_M68 - else if (!strcmp (name, ".wtext")) - need_text = 0; -#endif - else if (!strcmp (name, _DATA)) - need_data = 0; - else if (!strcmp (name, _BSS)) - need_bss = 0; - } - } - /* Now i == bfd_get_symcount (abfd). */ - /* @@ For now, don't deal with .file symbol. */ - need_file = 0; - - if (!need_text && !need_data && !need_bss && !need_file) - return TRUE; - nsyms += need_text + need_data + need_bss + need_file; - amt = nsyms; - amt *= sizeof (asymbol *); - sympp2 = (asymbol **) bfd_alloc (abfd, amt); - if (!sympp2) - return FALSE; - memcpy (sympp2, sympp, i * sizeof (asymbol *)); - - if (need_file) - /* @@ Generate fake .file symbol, in sympp2[i], and increment i. */ - abort (); - - if (need_text) - sympp2[i++] = coff_section_symbol (abfd, _TEXT); - if (need_data) - sympp2[i++] = coff_section_symbol (abfd, _DATA); - if (need_bss) - sympp2[i++] = coff_section_symbol (abfd, _BSS); - BFD_ASSERT (i == nsyms); - bfd_set_symtab (abfd, sympp2, nsyms); - return TRUE; -} - -#endif /* 0 */ - #ifdef COFF_IMAGE_WITH_PE static unsigned int pelength; @@ -4116,10 +4032,7 @@ coff_write_object_contents (abfd) if (bfd_get_symcount (abfd) != 0) { int firstundef; -#if 0 - if (!coff_add_missing_symbols (abfd)) - return FALSE; -#endif + if (!coff_renumber_symbols (abfd, &firstundef)) return FALSE; coff_mangle_symbols (abfd); @@ -4401,32 +4314,6 @@ coff_set_section_contents (abfd, section, location, offset, count) return bfd_bwrite (location, count, abfd) == count; } -#if 0 -static bfd_boolean -coff_close_and_cleanup (abfd) - bfd *abfd; -{ - if (!bfd_read_p (abfd)) - switch (abfd->format) - { - case bfd_archive: - if (!_bfd_write_archive_contents (abfd)) - return FALSE; - break; - case bfd_object: - if (!coff_write_object_contents (abfd)) - return FALSE; - break; - default: - bfd_set_error (bfd_error_invalid_operation); - return FALSE; - } - - /* We depend on bfd_close to free all the memory on the objalloc. */ - return TRUE; -} - -#endif static PTR buy_and_read (abfd, where, size) @@ -4610,11 +4497,6 @@ coff_slurp_symbol_table (abfd) { #ifdef I960 case C_LEAFEXT: -#if 0 - dst->symbol.value = src->u.syment.n_value - dst->symbol.section->vma; - dst->symbol.flags = BSF_EXPORT | BSF_GLOBAL; - dst->symbol.flags |= BSF_NOT_AT_END | BSF_FUNCTION; -#endif /* Fall through to next case. */ #endif diff --git a/bfd/coffgen.c b/bfd/coffgen.c index a2b0d5d0ddc..4b87b9bd402 100644 --- a/bfd/coffgen.c +++ b/bfd/coffgen.c @@ -1127,28 +1127,9 @@ coff_write_native_symbol (abfd, symbol, written, string_size_p, count++; while (lineno[count].line_number != 0) { -#if 0 - /* 13 april 92. sac - I've been told this, but still need proof: - > The second bug is also in `bfd/coffcode.h'. This bug - > causes the linker to screw up the pc-relocations for - > all the line numbers in COFF code. This bug isn't only - > specific to A29K implementations, but affects all - > systems using COFF format binaries. Note that in COFF - > object files, the line number core offsets output by - > the assembler are relative to the start of each - > procedure, not to the start of the .text section. This - > patch relocates the line numbers relative to the - > `native->u.syment.n_value' instead of the section - > virtual address. - > modular!olson@cs.arizona.edu (Jon Olson) - */ - lineno[count].u.offset += native->u.syment.n_value; -#else lineno[count].u.offset += (symbol->symbol.section->output_section->vma + symbol->symbol.section->output_offset); -#endif count++; } symbol->done_lineno = TRUE; @@ -1417,59 +1398,6 @@ coff_get_lineno (ignore_abfd, symbol) return coffsymbol (symbol)->lineno; } -#if 0 - -/* This is only called from coff_add_missing_symbols, which has been - disabled. */ - -asymbol * -coff_section_symbol (abfd, name) - bfd *abfd; - char *name; -{ - asection *sec = bfd_make_section_old_way (abfd, name); - asymbol *sym; - combined_entry_type *csym; - - sym = sec->symbol; - csym = coff_symbol_from (abfd, sym)->native; - /* Make sure back-end COFF stuff is there. */ - if (csym == 0) - { - struct foo - { - coff_symbol_type sym; - /* @@FIXME This shouldn't use a fixed size!! */ - combined_entry_type e[10]; - }; - struct foo *f; - - f = (struct foo *) bfd_zalloc (abfd, (bfd_size_type) sizeof (*f)); - if (!f) - { - bfd_set_error (bfd_error_no_error); - return NULL; - } - coff_symbol_from (abfd, sym)->native = csym = f->e; - } - csym[0].u.syment.n_sclass = C_STAT; - csym[0].u.syment.n_numaux = 1; -/* SF_SET_STATICS (sym); @@ ??? */ - csym[1].u.auxent.x_scn.x_scnlen = sec->size; - csym[1].u.auxent.x_scn.x_nreloc = sec->reloc_count; - csym[1].u.auxent.x_scn.x_nlinno = sec->lineno_count; - - if (sec->output_section == NULL) - { - sec->output_section = sec; - sec->output_offset = 0; - } - - return sym; -} - -#endif /* 0 */ - /* This function transforms the offsets into the symbol table into pointers to syments. */ diff --git a/bfd/cofflink.c b/bfd/cofflink.c index 815c8d58020..46770d8901c 100644 --- a/bfd/cofflink.c +++ b/bfd/cofflink.c @@ -1345,9 +1345,6 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *finfo, bfd *input_bfd) { unsigned int n_tmask = coff_data (input_bfd)->local_n_tmask; unsigned int n_btshft = coff_data (input_bfd)->local_n_btshft; -#if 0 - unsigned int n_btmask = coff_data (input_bfd)->local_n_btmask; -#endif bfd_boolean (*adjust_symndx) (bfd *, struct bfd_link_info *, bfd *, asection *, struct internal_reloc *, bfd_boolean *); diff --git a/bfd/cpu-cris.c b/bfd/cpu-cris.c index d15a2756aa8..67bc8612023 100644 --- a/bfd/cpu-cris.c +++ b/bfd/cpu-cris.c @@ -45,7 +45,6 @@ get_compatible (a,b) if (b->mach == bfd_mach_cris_v10_v32) return a; -#if 0 /* See ldlang.c:lang_check. Quite illogically, incompatible arches (as signalled by this function) are only *warned* about, while with this function signalling compatible ones, we can have the @@ -57,9 +56,12 @@ get_compatible (a,b) pretending matching machs here. */ /* Except for the compatible mach, machs must match. */ - if (a->mach != b->mach) - return NULL; -#endif + + /* + This code is disabled but kept as a warning: + if (a->mach != b->mach) + return NULL; + */ return a; } diff --git a/bfd/cpu-h8500.c b/bfd/cpu-h8500.c index fe05df5b020..36e945032ba 100644 --- a/bfd/cpu-h8500.c +++ b/bfd/cpu-h8500.c @@ -26,130 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ static bfd_boolean scan_mach PARAMS ((const struct bfd_arch_info *, const char *)); -#if 0 -/* -Relocations for the Z8K - -*/ -static bfd_reloc_status_type -howto16_callback (abfd, reloc_entry, symbol_in, data, - ignore_input_section, ignore_bfd) - bfd *abfd; - arelent *reloc_entry; - struct bfd_symbol *symbol_in; - PTR data; - asection *ignore_input_section; - bfd *ignore_bfd; -{ - long relocation = 0; - bfd_vma addr = reloc_entry->address; - long x = bfd_get_16 (abfd, (bfd_byte *)data + addr); - - HOWTO_PREPARE(relocation, symbol_in); - - x = (x + relocation + reloc_entry->addend); - - bfd_put_16 (abfd, x, (bfd_byte *)data + addr); - return bfd_reloc_ok; -} - -static bfd_reloc_status_type -howto8_callback (abfd, reloc_entry, symbol_in, data, - ignore_input_section, ignore_bfd) - bfd *abfd; - arelent *reloc_entry; - struct bfd_symbol *symbol_in; - PTR data; - asection *ignore_input_section; - bfd *ignore_bfd; -{ - long relocation = 0; - bfd_vma addr = reloc_entry->address; - long x = bfd_get_8 (abfd, (bfd_byte *)data + addr); - - HOWTO_PREPARE(relocation, symbol_in); - - x = (x + relocation + reloc_entry->addend); - - bfd_put_8 (abfd, x, (bfd_byte *)data + addr); - return bfd_reloc_ok; -} - -static bfd_reloc_status_type -howto8_FFnn_callback (abfd, reloc_entry, symbol_in, data, - ignore_input_section, ignore_bfd) - bfd *abfd; - arelent *reloc_entry; - struct bfd_symbol *symbol_in; - PTR data; - asection *ignore_input_section; - bfd *ignore_bfd; -{ - long relocation = 0; - bfd_vma addr = reloc_entry->address; - - long x = bfd_get_8 (abfd, (bfd_byte *)data + addr); - abort (); - HOWTO_PREPARE(relocation, symbol_in); - - x = (x + relocation + reloc_entry->addend); - - bfd_put_8 (abfd, x, (bfd_byte *)data + addr); - return bfd_reloc_ok; -} - -static bfd_reloc_status_type -howto8_pcrel_callback (abfd, reloc_entry, symbol_in, data, - ignore_input_section, ignore_bfd) - bfd *abfd; - arelent *reloc_entry; - struct bfd_symbol *symbol_in; - PTR data; - asection *ignore_input_section; - bfd *ignore_bfd; -{ - long relocation = 0; - bfd_vma addr = reloc_entry->address; - long x = bfd_get_8 (abfd, (bfd_byte *)data + addr); - abort (); - HOWTO_PREPARE(relocation, symbol_in); - - x = (x + relocation + reloc_entry->addend); - - bfd_put_8 (abfd, x, (bfd_byte *)data + addr); - return bfd_reloc_ok; -} - -static reloc_howto_type howto_16 - = NEWHOWTO (howto16_callback, "abs16", 1, FALSE, FALSE); -static reloc_howto_type howto_8 - = NEWHOWTO (howto8_callback, "abs8", 0, FALSE, FALSE); - -static reloc_howto_type howto_8_FFnn - = NEWHOWTO (howto8_FFnn_callback, "ff00+abs8", 0, FALSE, FALSE); - -static reloc_howto_type howto_8_pcrel - = NEWHOWTO (howto8_pcrel_callback, "pcrel8", 0, FALSE, TRUE); - -static reloc_howto_type * -local_bfd_reloc_type_lookup (arch, code) - const struct bfd_arch_info *arch; - bfd_reloc_code_real_type code; -{ - switch (code) { - case BFD_RELOC_16: - return &howto_16; - case BFD_RELOC_8_FFnn: - return &howto_8_FFnn; - case BFD_RELOC_8: - return &howto_8; - case BFD_RELOC_8_PCREL: - return &howto_8_pcrel; - } - return (reloc_howto_type *)NULL; -} -#endif - static bfd_boolean scan_mach (info, string) const struct bfd_arch_info *info ATTRIBUTE_UNUSED; @@ -166,21 +42,6 @@ scan_mach (info, string) return FALSE; } -#if 0 /* not used currently */ -/* This routine is provided two arch_infos and returns whether - they'd be compatible */ - -static const bfd_arch_info_type * -compatible (a,b) - const bfd_arch_info_type *a; - const bfd_arch_info_type *b; -{ - if (a->arch != b->arch || a->mach != b->mach) - return NULL; - return a; -} -#endif - const bfd_arch_info_type bfd_h8500_arch = { 16, /* 16 bits in a word */ diff --git a/bfd/cpu-ns32k.c b/bfd/cpu-ns32k.c index 0cd358da967..84978580985 100644 --- a/bfd/cpu-ns32k.c +++ b/bfd/cpu-ns32k.c @@ -279,7 +279,6 @@ do_ns32k_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, /* WTF?? */ if (abfd->xvec->flavour == bfd_target_coff_flavour) { -#if 1 /* For m68k-coff, the addend was being subtracted twice during relocation with -r. Removing the line below this comment fixes that problem; see PR 2953. @@ -355,7 +354,6 @@ do_ns32k_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, 7) if they are different you have to figure out which version is right. */ relocation -= reloc_entry->addend; -#endif reloc_entry->addend = 0; } else diff --git a/bfd/doc/chew.c b/bfd/doc/chew.c index 7c060da2d1c..bde09be33c8 100644 --- a/bfd/doc/chew.c +++ b/bfd/doc/chew.c @@ -588,45 +588,6 @@ translatecomments () pc++; } -#if 0 - -/* This is not currently used. */ - -/* turn everything not starting with a . into a comment */ - -static void -manglecomments () -{ - unsigned int idx = 0; - string_type out; - init_string (&out); - - while (at (tos, idx)) - { - if (at (tos, idx) == '\n' && at (tos, idx + 1) == '*') - { - cattext (&out, " /*"); - idx += 2; - } - else if (at (tos, idx) == '*' && at (tos, idx + 1) == '}') - { - cattext (&out, "*/"); - idx += 2; - } - else - { - catchar (&out, at (tos, idx)); - idx++; - } - } - - overwrite_string (tos, &out); - - pc++; -} - -#endif - /* Mod tos so that only lines with leading dots remain */ static void outputdots () diff --git a/bfd/ecoff.c b/bfd/ecoff.c index 74306f1ad17..a826415a826 100644 --- a/bfd/ecoff.c +++ b/bfd/ecoff.c @@ -862,73 +862,6 @@ ecoff_set_symbol_info (abfd, ecoff_sym, asym, ext, weak) case N_SETD: case N_SETB: { - /* This code is no longer needed. It used to be used to - make the linker handle set symbols, but they are now - handled in the add_symbols routine instead. */ -#if 0 - const char *name; - asection *section; - arelent_chain *reloc_chain; - unsigned int bitsize; - bfd_size_type amt; - - /* Get a section with the same name as the symbol (usually - __CTOR_LIST__ or __DTOR_LIST__). FIXME: gcc uses the - name ___CTOR_LIST (three underscores). We need - __CTOR_LIST (two underscores), since ECOFF doesn't use - a leading underscore. This should be handled by gcc, - but instead we do it here. Actually, this should all - be done differently anyhow. */ - name = bfd_asymbol_name (asym); - if (name[0] == '_' && name[1] == '_' && name[2] == '_') - { - ++name; - asym->name = name; - } - section = bfd_get_section_by_name (abfd, name); - if (section == (asection *) NULL) - { - char *copy; - - amt = strlen (name) + 1; - copy = (char *) bfd_alloc (abfd, amt); - if (!copy) - return FALSE; - strcpy (copy, name); - section = bfd_make_section (abfd, copy); - } - - /* Build a reloc pointing to this constructor. */ - amt = sizeof (arelent_chain); - reloc_chain = (arelent_chain *) bfd_alloc (abfd, amt); - if (!reloc_chain) - return FALSE; - reloc_chain->relent.sym_ptr_ptr = - bfd_get_section (asym)->symbol_ptr_ptr; - reloc_chain->relent.address = section->size; - reloc_chain->relent.addend = asym->value; - reloc_chain->relent.howto = - ecoff_backend (abfd)->constructor_reloc; - - /* Set up the constructor section to hold the reloc. */ - section->flags = SEC_CONSTRUCTOR; - ++section->reloc_count; - - /* Constructor sections must be rounded to a boundary - based on the bitsize. These are not real sections-- - they are handled specially by the linker--so the ECOFF - 16 byte alignment restriction does not apply. */ - bitsize = ecoff_backend (abfd)->constructor_bitsize; - section->alignment_power = 1; - while ((1 << section->alignment_power) < bitsize / 8) - ++section->alignment_power; - - reloc_chain->next = section->constructor_chain; - section->constructor_chain = reloc_chain; - section->size += bitsize / 8; - -#endif /* 0 */ - /* Mark the symbol as a constructor. */ asym->flags |= BSF_CONSTRUCTOR; } @@ -3192,14 +3125,10 @@ _bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx) armap. */ hdr.ar_uid[0] = '0'; hdr.ar_gid[0] = '0'; -#if 0 - hdr.ar_mode[0] = '0'; -#else /* Building gcc ends up extracting the armap as a file - twice. */ hdr.ar_mode[0] = '6'; hdr.ar_mode[1] = '4'; hdr.ar_mode[2] = '4'; -#endif sprintf (hdr.ar_size, "%-10d", (int) mapsize); @@ -3361,14 +3290,10 @@ _bfd_ecoff_archive_p (abfd) if (bfd_check_format (first, bfd_object) && first->xvec != abfd->xvec) { -#if 0 /* We ought to close `first' here, but we can't, because we have no way to remove it from the archive cache. - It's close to impossible to figure out when we can + It's almost impossible to figure out when we can release bfd_ardata. FIXME. */ - (void) bfd_close (first); - bfd_release (abfd, bfd_ardata (abfd)); -#endif bfd_set_error (bfd_error_wrong_object_format); bfd_ardata (abfd) = tdata_hold; return NULL; diff --git a/bfd/ecofflink.c b/bfd/ecofflink.c index 8a8e146394b..dee94d3a3a0 100644 --- a/bfd/ecofflink.c +++ b/bfd/ecofflink.c @@ -1839,24 +1839,9 @@ mk_fdrtab (abfd, debug_info, debug_swap, line_info) addresses do not equal the FDR vma, but they (the PDR address) are still vma's and not offsets. Cf. comments in 'lookup_line'. */ -#if 0 - bfd_size_type external_pdr_size; - char *pdr_ptr; - PDR pdr; - - external_pdr_size = debug_swap->external_pdr_size; - - pdr_ptr = ((char *) debug_info->external_pdr - + fdr_ptr->ipdFirst * external_pdr_size); - (*debug_swap->swap_pdr_in) (abfd, (PTR) pdr_ptr, &pdr); - /* The address of the first PDR is the offset of that - procedure relative to the beginning of file FDR. */ - tab->base_addr = fdr_ptr->adr - pdr.adr; -#else /* The address of the first PDR is the offset of that procedure relative to the beginning of file FDR. */ tab->base_addr = fdr_ptr->adr; -#endif } else { @@ -2115,11 +2100,6 @@ lookup_line (abfd, debug_info, debug_swap, line_info) considerably, which is undesirable. */ external_pdr_size = debug_swap->external_pdr_size; -#if 0 /* eraxxon: PDR addresses (pdr.adr) are not relative to FDRs! - Leave 'offset' alone. */ - /* Make offset relative to object file's start-address. */ - offset -= tab[i].base_addr; -#endif /* eraxxon: The Horrible Hack: Because of the problems above, set 'i' to 0 so we look through all FDRs. diff --git a/bfd/elf.c b/bfd/elf.c index 187763d310b..be77cc94c3b 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -1846,17 +1846,6 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex) that objcopy can handle it. */ break; } -#if 0 /* Not handling other string tables specially right now. */ - hdr2 = elf_elfsections (abfd)[i]; /* in case it moved */ - /* We have a strtab for some random other section. */ - newsect = (asection *) hdr2->bfd_section; - if (!newsect) - break; - hdr->bfd_section = newsect; - hdr2 = &elf_section_data (newsect)->str_hdr; - *hdr2 = *hdr; - elf_elfsections (abfd)[shindex] = hdr2; -#endif } } } @@ -4628,18 +4617,8 @@ prep_headers (bfd *abfd) /* If we're building an executable, we'll need a program header table. */ if (abfd->flags & EXEC_P) - { - /* It all happens later. */ -#if 0 - i_ehdrp->e_phentsize = sizeof (Elf_External_Phdr); - - /* elf_build_phdrs() returns a (NULL-terminated) array of - Elf_Internal_Phdrs. */ - i_phdrp = elf_build_phdrs (abfd, i_ehdrp, i_shdrp, &i_ehdrp->e_phnum); - i_ehdrp->e_phoff = outbase; - outbase += i_ehdrp->e_phentsize * i_ehdrp->e_phnum; -#endif - } + /* It all happens later. */ + ; else { i_ehdrp->e_phentsize = 0; @@ -5425,31 +5404,6 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd) -= (count - phdr_adjust_num) * iehdr->e_phentsize; } -#if 0 - /* Final Step: Sort the segments into ascending order of physical - address. */ - if (map_first != NULL) - { - struct elf_segment_map *prev; - - prev = map_first; - for (map = map_first->next; map != NULL; prev = map, map = map->next) - { - /* Yes I know - its a bubble sort.... */ - if (map->next != NULL && (map->next->p_paddr < map->p_paddr)) - { - /* Swap map and map->next. */ - prev->next = map->next; - map->next = map->next->next; - prev->next->next = map; - - /* Restart loop. */ - map = map_first; - } - } - } -#endif - #undef SEGMENT_END #undef SECTION_SIZE #undef IS_CONTAINED_BY_VMA diff --git a/bfd/elf32-dlx.c b/bfd/elf32-dlx.c index f8a394646b6..44f190c179a 100644 --- a/bfd/elf32-dlx.c +++ b/bfd/elf32-dlx.c @@ -98,25 +98,6 @@ static reloc_howto_type dlx_elf_howto_table[]= 0xffff, /* dst_mask */ FALSE), /* pcrel_offset */ -#if 0 - /* 26 bit jump address. */ - HOWTO (R_DLX_RELOC_26, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 26, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont,/* complain_on_overflow */ - /* This needs complex overflow detection, because the upper four - bits must match the PC + 4. */ - bfd_elf_generic_reloc, /* special_function */ - "R_DLX_RELOC_26", /* name */ - TRUE, /* partial_inplace */ - 0x3ffffff, /* src_mask */ - 0x3ffffff, /* dst_mask */ - FALSE), /* pcrel_offset */ -#endif - /* 32 bit relocation. */ HOWTO (R_DLX_RELOC_32, /* type */ 0, /* rightshift */ @@ -261,9 +242,6 @@ _bfd_dlx_elf_hi16_reloc (abfd, reloc_entry, symbol, data, /* If the skip flag is set then we simply do the generic relocating, this is more of a hack for dlx gas/gld, so we do not need to do the %hi/%lo fixup like mips gld did. */ -#if 0 - printf ("DEBUG: skip_dlx_elf_hi16_reloc = 0x%08x\n", skip_dlx_elf_hi16_reloc); -#endif if (skip_dlx_elf_hi16_reloc) return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message); @@ -284,23 +262,6 @@ _bfd_dlx_elf_hi16_reloc (abfd, reloc_entry, symbol, data, && output_bfd == (bfd *) NULL) ret = bfd_reloc_undefined; -#if 0 - { - unsigned long vallo, val; - - vallo = bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address); - printf ("DEBUG: The relocation address = 0x%08x\n", reloc_entry->address); - printf ("DEBUG: The symbol = 0x%08x\n", vallo); - printf ("DEBUG: The symbol name = %s\n", bfd_asymbol_name (symbol)); - printf ("DEBUG: The symbol->value = 0x%08x\n", symbol->value); - printf ("DEBUG: The vma = 0x%08x\n", symbol->section->output_section->vma); - printf ("DEBUG: The output_offset = 0x%08x\n", symbol->section->output_offset); - printf ("DEBUG: The input_offset = 0x%08x\n", input_section->output_offset); - printf ("DEBUG: The input_vma = 0x%08x\n", input_section->vma); - printf ("DEBUG: The addend = 0x%08x\n", reloc_entry->addend); - } -#endif - relocation = (bfd_is_com_section (symbol->section)) ? 0 : symbol->value; relocation += symbol->section->output_section->vma; relocation += symbol->section->output_offset; @@ -310,10 +271,6 @@ _bfd_dlx_elf_hi16_reloc (abfd, reloc_entry, symbol, data, if (reloc_entry->address > bfd_get_section_limit (abfd, input_section)) return bfd_reloc_outofrange; -#if 0 - printf ("DEBUG: The finial relocation value = 0x%08x\n", relocation); -#endif - bfd_put_16 (abfd, (short)((relocation >> 16) & 0xFFFF), (bfd_byte *)data + reloc_entry->address); @@ -383,19 +340,6 @@ elf32_dlx_relocate16 (abfd, reloc_entry, symbol, data, val = (symbol->section->output_offset + symbol->section->output_section->vma + symbol->value) - vallo; -#if 0 - printf ("DEBUG elf32_dlx_relocate: We are here\n"); - printf ("DEBUG: The insn = 0x%08x\n", insn); - printf ("DEBUG: The vallo = 0x%08x\n", vallo); - printf ("DEBUG: The val = 0x%08x\n", val); - printf ("DEBUG: The symbol name = %s\n", bfd_asymbol_name (symbol)); - printf ("DEBUG: The symbol->value = 0x%08x\n", symbol->value); - printf ("DEBUG: The vma = 0x%08x\n", symbol->section->output_section->vma); - printf ("DEBUG: The lma = 0x%08x\n", symbol->section->output_section->lma); - printf ("DEBUG: The alignment_power = 0x%08x\n", symbol->section->output_section->alignment_power); - printf ("DEBUG: The output_offset = 0x%08x\n", symbol->section->output_offset); - printf ("DEBUG: The addend = 0x%08x\n", reloc_entry->addend); -#endif if (abs ((int) val) > 0x00007FFF) return bfd_reloc_outofrange; @@ -461,21 +405,6 @@ elf32_dlx_relocate26 (abfd, reloc_entry, symbol, data, val = (symbol->section->output_offset + symbol->section->output_section->vma + symbol->value) - vallo; -#if 0 - printf ("DEBUG elf32_dlx_relocate26: We are here\n"); - printf ("DEBUG: The insn = 0x%08x\n", insn); - printf ("DEBUG: The vallo = 0x%08x\n", vallo); - printf ("DEBUG: The val = 0x%08x\n", val); - printf ("DEBUG: The abs(val) = 0x%08x\n", abs (val)); - printf ("DEBUG: The symbol name = %s\n", bfd_asymbol_name (symbol)); - printf ("DEBUG: The symbol->value = 0x%08x\n", symbol->value); - printf ("DEBUG: The vma = 0x%08x\n", symbol->section->output_section->vma); - printf ("DEBUG: The output_offset = 0x%08x\n", symbol->section->output_offset); - printf ("DEBUG: The input_vma = 0x%08x\n", input_section->output_section->vma); - printf ("DEBUG: The input_offset = 0x%08x\n", input_section->output_offset); - printf ("DEBUG: The input_name = %s\n", input_section->name); - printf ("DEBUG: The addend = 0x%08x\n", reloc_entry->addend); -#endif if (abs ((int) val) > 0x01FFFFFF) return bfd_reloc_outofrange; @@ -505,9 +434,6 @@ static const struct elf_reloc_map dlx_reloc_map[] = { { BFD_RELOC_NONE, R_DLX_NONE }, { BFD_RELOC_16, R_DLX_RELOC_16 }, -#if 0 - { BFD_RELOC_DLX_JMP26, R_DLX_RELOC_26_PCREL }, -#endif { BFD_RELOC_32, R_DLX_RELOC_32 }, { BFD_RELOC_DLX_HI16_S, R_DLX_RELOC_16_HI }, { BFD_RELOC_DLX_LO16, R_DLX_RELOC_16_LO }, diff --git a/bfd/elf32-fr30.c b/bfd/elf32-fr30.c index 3cf87452e5a..2e1f80b475c 100644 --- a/bfd/elf32-fr30.c +++ b/bfd/elf32-fr30.c @@ -557,12 +557,6 @@ fr30_elf_relocate_section (output_bfd, info, input_bfd, input_section, name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name; -#if 0 - fprintf (stderr, "local: sec: %s, sym: %s (%d), value: %x + %x + %x addend %x\n", - sec->name, name, sym->st_name, - sec->output_section->vma, sec->output_offset, - sym->st_value, rel->r_addend); -#endif } else { diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c index f97e0b75468..6bb3e204700 100644 --- a/bfd/elf32-frv.c +++ b/bfd/elf32-frv.c @@ -846,62 +846,6 @@ static reloc_howto_type elf32_frv_rel_tlsoff_howto = -/* Map BFD reloc types to FRV ELF reloc types. */ -#if 0 -struct frv_reloc_map -{ - unsigned int bfd_reloc_val; - unsigned int frv_reloc_val; -}; - -static const struct frv_reloc_map frv_reloc_map [] = -{ - { BFD_RELOC_NONE, R_FRV_NONE }, - { BFD_RELOC_32, R_FRV_32 }, - { BFD_RELOC_FRV_LABEL16, R_FRV_LABEL16 }, - { BFD_RELOC_FRV_LABEL24, R_FRV_LABEL24 }, - { BFD_RELOC_FRV_LO16, R_FRV_LO16 }, - { BFD_RELOC_FRV_HI16, R_FRV_HI16 }, - { BFD_RELOC_FRV_GPREL12, R_FRV_GPREL12 }, - { BFD_RELOC_FRV_GPRELU12, R_FRV_GPRELU12 }, - { BFD_RELOC_FRV_GPREL32, R_FRV_GPREL32 }, - { BFD_RELOC_FRV_GPRELHI, R_FRV_GPRELHI }, - { BFD_RELOC_FRV_GPRELLO, R_FRV_GPRELLO }, - { BFD_RELOC_FRV_GOT12, R_FRV_GOT12 }, - { BFD_RELOC_FRV_GOTHI, R_FRV_GOTHI }, - { BFD_RELOC_FRV_GOTLO, R_FRV_GOTLO }, - { BFD_RELOC_FRV_FUNCDESC, R_FRV_FUNCDESC }, - { BFD_RELOC_FRV_FUNCDESC_GOT12, R_FRV_FUNCDESC_GOT12 }, - { BFD_RELOC_FRV_FUNCDESC_GOTHI, R_FRV_FUNCDESC_GOTHI }, - { BFD_RELOC_FRV_FUNCDESC_GOTLO, R_FRV_FUNCDESC_GOTLO }, - { BFD_RELOC_FRV_FUNCDESC_VALUE, R_FRV_FUNCDESC_VALUE }, - { BFD_RELOC_FRV_FUNCDESC_GOTOFF12, R_FRV_FUNCDESC_GOTOFF12 }, - { BFD_RELOC_FRV_FUNCDESC_GOTOFFHI, R_FRV_FUNCDESC_GOTOFFHI }, - { BFD_RELOC_FRV_FUNCDESC_GOTOFFLO, R_FRV_FUNCDESC_GOTOFFLO }, - { BFD_RELOC_FRV_GOTOFF12, R_FRV_GOTOFF12 }, - { BFD_RELOC_FRV_GOTOFFHI, R_FRV_GOTOFFHI }, - { BFD_RELOC_FRV_GOTOFFLO, R_FRV_GOTOFFLO }, - { BFD_RELOC_FRV_GETTLSOFF, R_FRV_GETTLSOFF }, - { BFD_RELOC_FRV_TLSDESC_VALUE, R_FRV_TLSDESC_VALUE }, - { BFD_RELOC_FRV_GOTTLSDESC12, R_FRV_GOTTLSDESC12 }, - { BFD_RELOC_FRV_GOTTLSDESCHI, R_FRV_GOTTLSDESCHI }, - { BFD_RELOC_FRV_GOTTLSDESCLO, R_FRV_GOTTLSDESCLO }, - { BFD_RELOC_FRV_TLSMOFF12, R_FRV_TLSMOFF12 }, - { BFD_RELOC_FRV_TLSMOFFHI, R_FRV_TLSMOFFHI }, - { BFD_RELOC_FRV_TLSMOFFLO, R_FRV_TLSMOFFLO }, - { BFD_RELOC_FRV_GOTTLSOFF12, R_FRV_GOTTLSOFF12 }, - { BFD_RELOC_FRV_GOTTLSOFFHI, R_FRV_GOTTLSOFFHI }, - { BFD_RELOC_FRV_GOTTLSOFFLO, R_FRV_GOTTLSOFFLO }, - { BFD_RELOC_FRV_TLSOFF, R_FRV_TLSOFF }, - { BFD_RELOC_FRV_TLSDESC_RELAX, R_FRV_TLSDESC_RELAX }, - { BFD_RELOC_FRV_GETTLSOFF_RELAX, R_FRV_GETTLSOFF_RELAX }, - { BFD_RELOC_FRV_TLSOFF_RELAX, R_FRV_TLSOFF_RELAX }, - { BFD_RELOC_FRV_TLSMOFF, R_FRV_TLSMOFF }, - { BFD_RELOC_VTABLE_INHERIT, R_FRV_GNU_VTINHERIT }, - { BFD_RELOC_VTABLE_ENTRY, R_FRV_GNU_VTENTRY }, -}; -#endif - extern const bfd_target bfd_elf32_frvfdpic_vec; #define IS_FDPIC(bfd) ((bfd)->xvec == &bfd_elf32_frvfdpic_vec) @@ -1322,46 +1266,6 @@ frvfdpic_pic_merge_early_relocs_info (struct frvfdpic_relocs_info *e2, e2->gotoff |= e1->gotoff; e2->call |= e1->call; e2->sym |= e1->sym; - -#if 0 - /* These are set in _frvfdpic_count_got_plt_entries() or later, and this - function is only called in _frvfdpic_resolve_final_relocs_info(), that - runs just before it, so we don't have to worry about the fields - below. */ - - e2->plt |= e1->plt; - e2->privfd |= e1->privfd; - e2->lazyplt |= e1->lazyplt; - e2->done |= e1->done; - - e2->relocs32 += e1->relocs32; - e2->relocsfd += e1->relocsfd; - e2->relocsfdv += e1->relocsfdv; - e2->relocstlsd += e1->relocstlsd; - e2->relocstlsoff += e1->relocstlsoff; - e2->fixups += e1->fixups; - e2->dynrelocs += e1->dynrelocs; - - if (abs (e1->got_entry) < abs (e2->got_entry)) - e2->got_entry = e1->got_entry; - if (abs (e1->fdgot_entry) < abs (e2->fdgot_entry)) - e2->fdgot_entry = e1->fdgot_entry; - if (abs (e1->fd_entry) < abs (e2->fd_entry)) - e2->fd_entry = e1->fd_entry; - - if (e1->plt_entry < e2->plt_entry) - e2->plt_entry = e1->plt_entry; - if (e1->lzplt_entry < e2->lzplt_entry) - e2->lzplt_entry = e1->lzplt_entry; - - if (abs (e1->tlsoff_entry) < abs (e2->tlsoff_entry)) - e2->tlsoff_entry = e1->tlsoff_entry; - if (abs (e1->tlsdesc_entry) < abs (e2->tlsdesc_entry)) - e2->tlsdesc_entry = e1->tlsdesc_entry; - - if (e1->tlsplt_entry < e2->tlsplt_entry) - t2->tlsplt_entry = t1->tlsplt_entry; -#endif } /* Every block of 65535 lazy PLT entries shares a single call to the @@ -3581,14 +3485,16 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, break; -#if 0 /* There's nothing to relax in these. */ - case R_FRV_TLSDESC_VALUE: - case R_FRV_TLSOFF: - case R_FRV_TLSMOFF12: - case R_FRV_TLSMOFFHI: - case R_FRV_TLSMOFFLO: - case R_FRV_TLSMOFF: -#endif + /* + There's nothing to relax in these: + R_FRV_TLSDESC_VALUE + R_FRV_TLSOFF + R_FRV_TLSMOFF12 + R_FRV_TLSMOFFHI + R_FRV_TLSMOFFLO + R_FRV_TLSMOFF + */ + default: break; } @@ -4018,8 +3924,8 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, if (check_segment[0] != check_segment[1] && IS_FDPIC (output_bfd)) { -#if 1 /* If you take this out, remove the #error from fdpic-static-6.d - in the ld testsuite. */ + /* If you take this out, remove the #error from fdpic-static-6.d + in the ld testsuite. */ /* This helps catch problems in GCC while we can't do more than static linking. The idea is to test whether the input file basename is crt0.o only once. */ @@ -4032,7 +3938,6 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, + strlen (input_bfd->filename) - 7, "/crt0.o") == 0) ? -1 : 0; -#endif if (!silence_segment_error /* We don't want duplicate errors for undefined symbols. */ @@ -5226,32 +5131,8 @@ _frvfdpic_assign_plt_entries (void **entryp, void *info_) struct frvfdpic_relocs_info *entry = *entryp; struct _frvfdpic_dynamic_got_plt_info *dinfo = info_; -#if 1 if (entry->privfd) BFD_ASSERT (entry->fd_entry); -#else - /* If this symbol requires a local function descriptor, allocate - one. */ - if (entry->privfd && entry->fd_entry == 0) - { - if (dinfo->got12.fdplt) - { - entry->fd_entry = _frvfdpic_get_fd_entry (&dinfo->got12); - dinfo->got12.fdplt -= 8; - } - else if (dinfo->gotlos.fdplt) - { - entry->fd_entry = _frvfdpic_get_fd_entry (&dinfo->gotlos); - dinfo->gotlos.fdplt -= 8; - } - else - { - BFD_ASSERT (dinfo->gothilo.fdplt); - entry->fd_entry = _frvfdpic_get_fd_entry (&dinfo->gothilo); - dinfo->gothilo.fdplt -= 8; - } - } -#endif if (entry->plt) { diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index d1539be1b95..d861847628c 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -1186,20 +1186,6 @@ elf32_hppa_check_relocs (bfd *abfd, case R_PARISC_DIR14F: /* Used for load/store from absolute locn. */ case R_PARISC_DIR14R: case R_PARISC_DIR21L: /* As above, and for ext branches too. */ -#if 0 - /* Help debug shared library creation. Any of the above - relocs can be used in shared libs, but they may cause - pages to become unshared. */ - if (info->shared) - { - (*_bfd_error_handler) - (_("%B: relocation %s should not be used when making a shared object; recompile with -fPIC"), - abfd, - elf_hppa_howto_table[r_type].name); - } - /* Fall through. */ -#endif - case R_PARISC_DIR32: /* .word relocs. */ /* We may want to output a dynamic relocation later. */ need_entry = NEED_DYNREL; @@ -3253,14 +3239,6 @@ final_link_relocate (asection *input_section, == (((int) OP_ADDIL << 26) | (27 << 21))) { insn &= ~ (0x1f << 21); -#if 0 /* debug them. */ - (*_bfd_error_handler) - (_("%B(%A+0x%lx): fixing %s"), - input_bfd, - input_section, - (long) rel->r_offset, - howto->name); -#endif } /* Now try to make things easy for the dynamic linker. */ @@ -3823,13 +3801,6 @@ elf32_hppa_relocate_section (bfd *output_bfd, outrel.r_info = ELF32_R_INFO (indx, r_type); } -#if 0 - /* EH info can cause unaligned DIR32 relocs. - Tweak the reloc type for the dynamic linker. */ - if (r_type == R_PARISC_DIR32 && (outrel.r_offset & 3) != 0) - outrel.r_info = ELF32_R_INFO (ELF32_R_SYM (outrel.r_info), - R_PARISC_DIR32U); -#endif sreloc = elf_section_data (input_section)->sreloc; if (sreloc == NULL) abort (); diff --git a/bfd/elf32-i860.c b/bfd/elf32-i860.c index a5499a28819..3264c7aff4a 100644 --- a/bfd/elf32-i860.c +++ b/bfd/elf32-i860.c @@ -1086,13 +1086,6 @@ elf32_i860_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, int r_type; r_type = ELF32_R_TYPE (rel->r_info); - -#if 0 - if ( r_type == R_860_GNU_VTINHERIT - || r_type == R_860_GNU_VTENTRY) - continue; -#endif - r_symndx = ELF32_R_SYM (rel->r_info); howto = lookup_howto ((unsigned) ELF32_R_TYPE (rel->r_info)); diff --git a/bfd/elf32-ip2k.c b/bfd/elf32-ip2k.c index 70c05abaefe..94e04f4fa03 100644 --- a/bfd/elf32-ip2k.c +++ b/bfd/elf32-ip2k.c @@ -1598,12 +1598,6 @@ ip2k_elf_gc_mark_hook (sec, info, rel, h, sym) { switch (ELF32_R_TYPE (rel->r_info)) { -#if 0 - case R_IP2K_GNU_VTINHERIT: - case R_IP2K_GNU_VTENTRY: - break; -#endif - default: switch (h->root.type) { diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index c74980b4314..a72da4a9baa 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -56,10 +56,6 @@ static bfd_boolean m32r_elf_add_symbol_hook static bfd_boolean m32r_elf_relocate_section PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); -#if 0 /* not yet */ -static bfd_boolean m32r_elf_relax_delete_bytes - PARAMS ((bfd *, asection *, bfd_vma, int)); -#endif static bfd_reloc_status_type m32r_elf_final_sda_base PARAMS ((bfd *, struct bfd_link_info *, const char **, bfd_vma *)); static bfd_boolean m32r_elf_object_p @@ -3618,541 +3614,6 @@ printf("m32r_elf_finish_dynamic_sections()\n"); } -#if 0 /* relaxing not supported yet */ - -/* This function handles relaxing for the m32r. - Relaxing on the m32r is tricky because of instruction alignment - requirements (4 byte instructions must be aligned on 4 byte boundaries). - - The following relaxing opportunities are handled: - - seth/add3/jl -> bl24 or bl8 - seth/add3 -> ld24 - - It would be nice to handle bl24 -> bl8 but given: - - - 4 byte insns must be on 4 byte boundaries - - branch instructions only branch to insns on 4 byte boundaries - - this isn't much of a win because the insn in the 2 "deleted" bytes - must become a nop. With some complexity some real relaxation could be - done but the frequency just wouldn't make it worth it; it's better to - try to do all the code compaction one can elsewhere. - When the chip supports parallel 16 bit insns, things may change. -*/ - -static bfd_boolean -m32r_elf_relax_section (abfd, sec, link_info, again) - bfd *abfd; - asection *sec; - struct bfd_link_info *link_info; - bfd_boolean *again; -{ - Elf_Internal_Shdr *symtab_hdr; - /* The Rela structures are used here because that's what - _bfd_elf_link_read_relocs uses [for convenience - it sets the addend - field to 0]. */ - Elf_Internal_Rela *internal_relocs = NULL; - Elf_Internal_Rela *irel, *irelend; - bfd_byte *contents = NULL; - Elf_Internal_Sym *isymbuf = NULL; - - /* Assume nothing changes. */ - *again = FALSE; - - /* 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->relocatable - || (sec->flags & SEC_RELOC) == 0 - || sec->reloc_count == 0 - || (sec->flags & SEC_CODE) == 0 - || 0 /* FIXME: check SHF_M32R_CAN_RELAX */) - return TRUE; - - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; - - /* Get a copy of the native relocations. */ - internal_relocs = (_bfd_elf_link_read_relocs - (abfd, sec, (PTR) NULL, (Elf_Internal_Rela *) NULL, - link_info->keep_memory)); - if (internal_relocs == NULL) - goto error_return; - - /* Walk through them looking for relaxing opportunities. */ - irelend = internal_relocs + sec->reloc_count; - for (irel = internal_relocs; irel < irelend; irel++) - { - bfd_vma symval; - - /* If this isn't something that can be relaxed, then ignore - this reloc. */ - if (ELF32_R_TYPE (irel->r_info) != (int) R_M32R_HI16_SLO) - continue; - - /* Get the section contents if we haven't done so already. */ - if (contents == NULL) - { - /* Get cached copy if it exists. */ - if (elf_section_data (sec)->this_hdr.contents != NULL) - contents = elf_section_data (sec)->this_hdr.contents; - else - { - /* Go get them off disk. */ - if (!bfd_malloc_and_get_section (abfd, sec, &contents)) - goto error_return; - } - } - - /* Read this BFD's local symbols if we haven't done so already. */ - if (isymbuf == NULL && symtab_hdr->sh_info != 0) - { - isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; - if (isymbuf == NULL) - isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr, - symtab_hdr->sh_info, 0, - NULL, NULL, NULL); - if (isymbuf == NULL) - goto error_return; - } - - /* Get the value of the symbol referred to by the reloc. */ - if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info) - { - /* A local symbol. */ - Elf_Internal_Sym *isym; - asection *sym_sec; - - isym = isymbuf + ELF32_R_SYM (irel->r_info), - sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx); - symval = (isym->st_value - + sym_sec->output_section->vma - + sym_sec->output_offset); - } - else - { - unsigned long indx; - struct elf_link_hash_entry *h; - - /* An external symbol. */ - indx = ELF32_R_SYM (irel->r_info) - symtab_hdr->sh_info; - h = elf_sym_hashes (abfd)[indx]; - BFD_ASSERT (h != NULL); - if (h->root.type != bfd_link_hash_defined - && h->root.type != bfd_link_hash_defweak) - { - /* This appears to be a reference to an undefined - symbol. Just ignore it--it will be caught by the - regular reloc processing. */ - continue; - } - - symval = (h->root.u.def.value - + h->root.u.def.section->output_section->vma - + h->root.u.def.section->output_offset); - } - - /* For simplicity of coding, we are going to modify the section - contents, the section relocs, and the BFD symbol table. We - must tell the rest of the code not to free up this - information. It would be possible to instead create a table - of changes which have to be made, as is done in coff-mips.c; - that would be more work, but would require less memory when - the linker is run. */ - - /* Try to change a seth/add3/jl subroutine call to bl24 or bl8. - This sequence is generated by the compiler when compiling in - 32 bit mode. Also look for seth/add3 -> ld24. */ - - if (ELF32_R_TYPE (irel->r_info) == (int) R_M32R_HI16_SLO) - { - Elf_Internal_Rela *nrel; - bfd_vma pc = (sec->output_section->vma + sec->output_offset - + irel->r_offset); - bfd_signed_vma pcrel_value = symval - pc; - unsigned int code,reg; - int addend,nop_p,bl8_p,to_delete; - - /* The tests are ordered so that we get out as quickly as possible - if this isn't something we can relax, taking into account that - we are looking for two separate possibilities (jl/ld24). */ - - /* Do nothing if no room in the section for this to be what we're - looking for. */ - if (irel->r_offset > sec->size - 8) - continue; - - /* Make sure the next relocation applies to the next - instruction and that it's the add3's reloc. */ - nrel = irel + 1; - if (nrel == irelend - || irel->r_offset + 4 != nrel->r_offset - || ELF32_R_TYPE (nrel->r_info) != (int) R_M32R_LO16) - continue; - - /* See if the instructions are seth/add3. */ - /* FIXME: This is where macros from cgen can come in. */ - code = bfd_get_16 (abfd, contents + irel->r_offset + 0); - if ((code & 0xf0ff) != 0xd0c0) - continue; /* not seth rN,foo */ - reg = (code & 0x0f00) >> 8; - code = bfd_get_16 (abfd, contents + irel->r_offset + 4); - if (code != (0x80a0 | reg | (reg << 8))) - continue; /* not add3 rN,rN,foo */ - - /* At this point we've confirmed we have seth/add3. Now check - whether the next insn is a jl, in which case try to change this - to bl24 or bl8. */ - - /* Ensure the branch target is in range. - The bl24 instruction has a 24 bit operand which is the target - address right shifted by 2, giving a signed range of 26 bits. - Note that 4 bytes are added to the high value because the target - will be at least 4 bytes closer if we can relax. It'll actually - be 4 or 8 bytes closer, but we don't know which just yet and - the difference isn't significant enough to worry about. */ -#if !USE_REL /* put in for learning purposes */ - pcrel_value += irel->r_addend; -#else - addend = bfd_get_signed_16 (abfd, contents + irel->r_offset + 2); - pcrel_value += addend; -#endif - - if (pcrel_value >= -(1 << 25) && pcrel_value < (1 << 25) + 4 - /* Do nothing if no room in the section for this to be what we're - looking for. */ - && (irel->r_offset <= sec->size - 12) - /* Ensure the next insn is "jl rN". */ - && ((code = bfd_get_16 (abfd, contents + irel->r_offset + 8)), - code != (0x1ec0 | reg))) - { - /* We can relax to bl24/bl8. */ - - /* See if there's a nop following the jl. - Also see if we can use a bl8 insn. */ - code = bfd_get_16 (abfd, contents + irel->r_offset + 10); - nop_p = (code & 0x7fff) == NOP_INSN; - bl8_p = pcrel_value >= -0x200 && pcrel_value < 0x200; - - if (bl8_p) - { - /* Change "seth rN,foo" to "bl8 foo || nop". - We OR in CODE just in case it's not a nop (technically, - CODE currently must be a nop, but for cleanness we - allow it to be anything). */ -#if !USE_REL /* put in for learning purposes */ - code = 0x7e000000 | MAKE_PARALLEL (code); -#else - code = (0x7e000000 + (((addend >> 2) & 0xff) << 16)) | MAKE_PARALLEL (code); -#endif - to_delete = 8; - } - else - { - /* Change the seth rN,foo to a bl24 foo. */ -#if !USE_REL /* put in for learning purposes */ - code = 0xfe000000; -#else - code = 0xfe000000 + ((addend >> 2) & 0xffffff); -#endif - to_delete = nop_p ? 8 : 4; - } - - bfd_put_32 (abfd, code, contents + irel->r_offset); - - /* Set the new reloc type. */ - irel->r_info = ELF32_R_INFO (ELF32_R_SYM (nrel->r_info), - bl8_p ? R_M32R_10_PCREL : R_M32R_26_PCREL); - - /* Delete the add3 reloc by making it a null reloc. */ - nrel->r_info = ELF32_R_INFO (ELF32_R_SYM (nrel->r_info), - R_M32R_NONE); - } - else if (addend >= 0 - && symval + addend <= 0xffffff) - { - /* We can relax to ld24. */ - - code = 0xe0000000 | (reg << 24) | (addend & 0xffffff); - bfd_put_32 (abfd, code, contents + irel->r_offset); - to_delete = 4; - /* Tell the following code a nop filler isn't needed. */ - nop_p = 1; - } - else - { - /* Can't do anything here. */ - continue; - } - - /* Note that we've changed the relocs, section contents, etc. */ - elf_section_data (sec)->relocs = internal_relocs; - elf_section_data (sec)->this_hdr.contents = contents; - symtab_hdr->contents = (unsigned char *) isymbuf; - - /* Delete TO_DELETE bytes of data. */ - if (!m32r_elf_relax_delete_bytes (abfd, sec, - irel->r_offset + 4, to_delete)) - goto error_return; - - /* Now that the following bytes have been moved into place, see if - we need to replace the jl with a nop. This happens when we had - to use a bl24 insn and the insn following the jl isn't a nop. - Technically, this situation can't happen (since the insn can - never be executed) but to be clean we do this. When the chip - supports parallel 16 bit insns things may change. - We don't need to do this in the case of relaxing to ld24, - and the above code sets nop_p so this isn't done. */ - if (! nop_p && to_delete == 4) - bfd_put_16 (abfd, NOP_INSN, contents + irel->r_offset + 4); - - /* That will change things, so we should relax again. - Note that this is not required, and it may be slow. */ - *again = TRUE; - - continue; - } - - /* loop to try the next reloc */ - } - - if (isymbuf != NULL - && symtab_hdr->contents != (unsigned char *) isymbuf) - { - if (! link_info->keep_memory) - free (isymbuf); - else - { - /* Cache the symbols for elf_link_input_bfd. */ - symtab_hdr->contents = (unsigned char *) isymbuf; - } - } - - if (contents != NULL - && elf_section_data (sec)->this_hdr.contents != contents) - { - if (! link_info->keep_memory) - free (contents); - else - { - /* Cache the section contents for elf_link_input_bfd. */ - elf_section_data (sec)->this_hdr.contents = contents; - } - } - - if (internal_relocs != NULL - && elf_section_data (sec)->relocs != internal_relocs) - free (internal_relocs); - - return TRUE; - - error_return: - if (isymbuf != NULL - && symtab_hdr->contents != (unsigned char *) isymbuf) - free (isymbuf); - if (contents != NULL - && elf_section_data (sec)->this_hdr.contents != contents) - free (contents); - if (internal_relocs != NULL - && elf_section_data (sec)->relocs != internal_relocs) - free (internal_relocs); - - return FALSE; -} - -/* Delete some bytes from a section while relaxing. */ - -static bfd_boolean -m32r_elf_relax_delete_bytes (abfd, sec, addr, count) - bfd *abfd; - asection *sec; - bfd_vma addr; - int count; -{ - Elf_Internal_Shdr *symtab_hdr; - int shndx; - bfd_byte *contents; - Elf_Internal_Rela *irel, *irelend; - Elf_Internal_Rela *irelalign; - bfd_vma toaddr; - Elf_Internal_Sym *isym, *isymend; - struct elf_link_hash_entry **sym_hashes; - struct elf_link_hash_entry **end_hashes; - unsigned int symcount; - - shndx = _bfd_elf_section_from_bfd_section (abfd, sec); - - contents = elf_section_data (sec)->this_hdr.contents; - - /* The deletion must stop at the next ALIGN reloc for an aligment - power larger than the number of bytes we are deleting. */ - - irelalign = NULL; - toaddr = sec->size; - - irel = elf_section_data (sec)->relocs; - irelend = irel + sec->reloc_count; - - /* Actually delete the bytes. */ - memmove (contents + addr, contents + addr + count, toaddr - addr - count); - sec->size -= count; - - /* Adjust all the relocs. */ - for (irel = elf_section_data (sec)->relocs; irel < irelend; irel++) - { - /* Get the new reloc address. */ - if ((irel->r_offset > addr - && irel->r_offset < toaddr)) - irel->r_offset -= count; - } - - /* Adjust the local symbols defined in this section. */ - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; - isym = (Elf_Internal_Sym *) symtab_hdr->contents; - for (isymend = isym + symtab_hdr->sh_info; isym < isymend; isym++) - { - if (isym->st_shndx == shndx - && isym->st_value > addr - && isym->st_value < toaddr) - isym->st_value -= count; - } - - /* Now adjust the global symbols defined in this section. */ - symcount = (symtab_hdr->sh_size / sizeof (Elf32_External_Sym) - - symtab_hdr->sh_info); - sym_hashes = elf_sym_hashes (abfd); - end_hashes = sym_hashes + symcount; - for (; sym_hashes < end_hashes; sym_hashes++) - { - struct elf_link_hash_entry *sym_hash = *sym_hashes; - - if ((sym_hash->root.type == bfd_link_hash_defined - || sym_hash->root.type == bfd_link_hash_defweak) - && sym_hash->root.u.def.section == sec - && sym_hash->root.u.def.value > addr - && sym_hash->root.u.def.value < toaddr) - { - sym_hash->root.u.def.value -= count; - } - } - - return TRUE; -} - -/* This is a version of bfd_generic_get_relocated_section_contents - which uses m32r_elf_relocate_section. */ - -static bfd_byte * -m32r_elf_get_relocated_section_contents (output_bfd, link_info, link_order, - data, relocatable, symbols) - bfd *output_bfd; - struct bfd_link_info *link_info; - struct bfd_link_order *link_order; - bfd_byte *data; - bfd_boolean relocatable; - asymbol **symbols; -{ - Elf_Internal_Shdr *symtab_hdr; - asection *input_section = link_order->u.indirect.section; - bfd *input_bfd = input_section->owner; - asection **sections = NULL; - Elf_Internal_Rela *internal_relocs = NULL; - Elf_Internal_Sym *isymbuf = NULL; - bfd_size_type amt; - - /* We only need to handle the case of relaxing, or of having a - particular set of section contents, specially. */ - 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, - relocatable, - symbols); - - symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; - - memcpy (data, elf_section_data (input_section)->this_hdr.contents, - input_section->size); - - if ((input_section->flags & SEC_RELOC) != 0 - && input_section->reloc_count > 0) - { - Elf_Internal_Sym *isymp; - asection **secpp; - Elf32_External_Sym *esym, *esymend; - - internal_relocs = (_bfd_elf_link_read_relocs - (input_bfd, input_section, (PTR) NULL, - (Elf_Internal_Rela *) NULL, FALSE)); - if (internal_relocs == NULL) - goto error_return; - - if (symtab_hdr->sh_info != 0) - { - isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; - if (isymbuf == NULL) - isymbuf = bfd_elf_get_elf_syms (input_bfd, symtab_hdr, - symtab_hdr->sh_info, 0, - NULL, NULL, NULL); - if (isymbuf == NULL) - goto error_return; - } - - amt = symtab_hdr->sh_info; - amt *= sizeof (asection *); - sections = (asection **) bfd_malloc (amt); - if (sections == NULL && symtab_hdr->sh_info > 0) - goto error_return; - - isymend = isymbuf + symtab_hdr->sh_info; - for (isym = isymbuf, secpp = sections; isym < isymend; ++isym, ++secpp) - { - asection *isec; - - if (isym->st_shndx == SHN_UNDEF) - isec = bfd_und_section_ptr; - else if (isym->st_shndx == SHN_ABS) - isec = bfd_abs_section_ptr; - else if (isym->st_shndx == SHN_COMMON) - isec = bfd_com_section_ptr; - else if (isym->st_shndx == SHN_M32R_SCOMMON) - isec = &m32r_elf_scom_section; - else - isec = bfd_section_from_elf_index (input_bfd, isym->st_shndx); - - *secpp = isec; - } - - if (! m32r_elf_relocate_section (output_bfd, link_info, input_bfd, - input_section, data, internal_relocs, - isymbuf, sections)) - goto error_return; - - if (sections != NULL) - free (sections); - if (isymbuf != NULL - && symtab_hdr->contents != (unsigned char *) isymbuf) - free (isymbuf); - if (elf_section_data (input_section)->relocs != internal_relocs) - free (internal_relocs); - } - - return data; - - error_return: - if (sections != NULL) - free (sections); - if (isymbuf != NULL - && symtab_hdr->contents != (unsigned char *) isymbuf) - free (isymbuf); - if (internal_relocs != NULL - && elf_section_data (input_section)->relocs != internal_relocs) - free (internal_relocs); - return NULL; -} - -#endif /* #if 0 */ - /* Set the right machine number. */ static bfd_boolean m32r_elf_object_p (abfd) @@ -4832,13 +4293,6 @@ m32r_elf_reloc_type_class (rela) #define elf_backend_fake_sections m32r_elf_fake_sections #endif -#if 0 /* not yet */ -/* relax support */ -#define bfd_elf32_bfd_relax_section m32r_elf_relax_section -#define bfd_elf32_bfd_get_relocated_section_contents \ - m32r_elf_get_relocated_section_contents -#endif - #define elf_backend_object_p m32r_elf_object_p #define elf_backend_final_write_processing m32r_elf_final_write_processing #define bfd_elf32_bfd_merge_private_bfd_data m32r_elf_merge_private_bfd_data diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index b31ae9480e5..149ef9fed2d 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -2383,24 +2383,12 @@ sh_elf_relax_section (bfd *abfd, asection *sec, not if the symbol is in a different section. Besides, we need a consistent meaning for the relocation, so we just assume here that the value of the symbol is not available. */ -#if 0 - if (ELF32_R_SYM (irelfn->r_info) < symtab_hdr->sh_info) - { - /* If this needs to be changed because of future relaxing, - it will be handled here like other internal IND12W - relocs. */ - bfd_put_16 (abfd, - (bfd_vma) 0xb000 | ((foff >> 1) & 0xfff), - contents + irel->r_offset); - } - else -#endif - { - /* We can't fully resolve this yet, because the external - symbol value may be changed by future relaxing. We let - the final link phase handle it. */ - bfd_put_16 (abfd, (bfd_vma) 0xb000, contents + irel->r_offset); - } + + /* We can't fully resolve this yet, because the external + symbol value may be changed by future relaxing. We let + the final link phase handle it. */ + bfd_put_16 (abfd, (bfd_vma) 0xb000, contents + irel->r_offset); + irel->r_addend = -4; /* See if there is another R_SH_USES reloc referring to the same @@ -3400,7 +3388,6 @@ movi_shori_putval (bfd *output_bfd, unsigned long value, char *addr) /* First entry in an absolute procedure linkage table look like this. */ -#if 1 /* Note - this code has been "optimised" not to use r2. r2 is used by GCC to return the address of large structures, so it should not be corrupted here. This does mean however, that this PLT does not conform @@ -3508,107 +3495,6 @@ static const bfd_byte elf_sh_pic_plt_entry_le[PLT_ENTRY_SIZE] = 0, 0, 0, 0 /* 2: replaced with offset into relocation table. */ }; -#else /* These are the old style PLT entries. */ -static const bfd_byte elf_sh_plt0_entry_be[PLT_ENTRY_SIZE] = -{ - 0xd0, 0x04, /* mov.l 1f,r0 */ - 0xd2, 0x05, /* mov.l 2f,r2 */ - 0x60, 0x02, /* mov.l @r0,r0 */ - 0x62, 0x22, /* mov.l @r2,r2 */ - 0x40, 0x2b, /* jmp @r0 */ - 0xe0, 0x00, /* mov #0,r0 */ - 0x00, 0x09, /* nop */ - 0x00, 0x09, /* nop */ - 0x00, 0x09, /* nop */ - 0x00, 0x09, /* nop */ - 0, 0, 0, 0, /* 1: replaced with address of .got.plt + 8. */ - 0, 0, 0, 0, /* 2: replaced with address of .got.plt + 4. */ -}; - -static const bfd_byte elf_sh_plt0_entry_le[PLT_ENTRY_SIZE] = -{ - 0x04, 0xd0, /* mov.l 1f,r0 */ - 0x05, 0xd2, /* mov.l 2f,r2 */ - 0x02, 0x60, /* mov.l @r0,r0 */ - 0x22, 0x62, /* mov.l @r2,r2 */ - 0x2b, 0x40, /* jmp @r0 */ - 0x00, 0xe0, /* mov #0,r0 */ - 0x09, 0x00, /* nop */ - 0x09, 0x00, /* nop */ - 0x09, 0x00, /* nop */ - 0x09, 0x00, /* nop */ - 0, 0, 0, 0, /* 1: replaced with address of .got.plt + 8. */ - 0, 0, 0, 0, /* 2: replaced with address of .got.plt + 4. */ -}; - -/* Sebsequent entries in an absolute procedure linkage table look like - this. */ - -static const bfd_byte elf_sh_plt_entry_be[PLT_ENTRY_SIZE] = -{ - 0xd0, 0x04, /* mov.l 1f,r0 */ - 0x60, 0x02, /* mov.l @r0,r0 */ - 0xd2, 0x02, /* mov.l 0f,r2 */ - 0x40, 0x2b, /* jmp @r0 */ - 0x60, 0x23, /* mov r2,r0 */ - 0xd1, 0x03, /* mov.l 2f,r1 */ - 0x40, 0x2b, /* jmp @r0 */ - 0x00, 0x09, /* nop */ - 0, 0, 0, 0, /* 0: replaced with address of .PLT0. */ - 0, 0, 0, 0, /* 1: replaced with address of this symbol in .got. */ - 0, 0, 0, 0, /* 2: replaced with offset into relocation table. */ -}; - -static const bfd_byte elf_sh_plt_entry_le[PLT_ENTRY_SIZE] = -{ - 0x04, 0xd0, /* mov.l 1f,r0 */ - 0x02, 0x60, /* mov.l @r0,r0 */ - 0x02, 0xd2, /* mov.l 0f,r2 */ - 0x2b, 0x40, /* jmp @r0 */ - 0x23, 0x60, /* mov r2,r0 */ - 0x03, 0xd1, /* mov.l 2f,r1 */ - 0x2b, 0x40, /* jmp @r0 */ - 0x09, 0x00, /* nop */ - 0, 0, 0, 0, /* 0: replaced with address of .PLT. */ - 0, 0, 0, 0, /* 1: replaced with address of this symbol in .got. */ - 0, 0, 0, 0, /* 2: replaced with offset into relocation table. */ -}; - -/* Entries in a PIC procedure linkage table look like this. */ - -static const bfd_byte elf_sh_pic_plt_entry_be[PLT_ENTRY_SIZE] = -{ - 0xd0, 0x04, /* mov.l 1f,r0 */ - 0x00, 0xce, /* mov.l @(r0,r12),r0 */ - 0x40, 0x2b, /* jmp @r0 */ - 0x00, 0x09, /* nop */ - 0x50, 0xc2, /* 0: mov.l @(8,r12),r0 */ - 0x52, 0xc1, /* 1: mov.l @(4,r12),r2 */ - 0xd1, 0x02, /* mov.l 2f,r1 */ - 0x40, 0x2b, /* jmp @r0 */ - 0xe0, 0x00, /* mov #0,r0 ! shows the type of PLT. */ - 0x00, 0x09, /* nop */ - 0, 0, 0, 0, /* 1: replaced with address of this symbol in .got. */ - 0, 0, 0, 0 /* 2: replaced with offset into relocation table. */ -}; - -static const bfd_byte elf_sh_pic_plt_entry_le[PLT_ENTRY_SIZE] = -{ - 0x04, 0xd0, /* mov.l 1f,r0 */ - 0xce, 0x00, /* mov.l @(r0,r12),r0 */ - 0x2b, 0x40, /* jmp @r0 */ - 0x09, 0x00, /* nop */ - 0xc2, 0x50, /* 0: mov.l @(8,r12),r0 */ - 0xc1, 0x52, /* 1: mov.l @(4,r12),r2 */ - 0x02, 0xd1, /* mov.l 2f,r1 */ - 0x2b, 0x40, /* jmp @r0 */ - 0x00, 0xe0, /* mov #0,r0 ! shows the type of PLT. */ - 0x09, 0x00, /* nop */ - 0, 0, 0, 0, /* 1: replaced with address of this symbol in .got. */ - 0, 0, 0, 0 /* 2: replaced with offset into relocation table. */ -}; -#endif /* old style PLT entries. */ - static const bfd_byte *elf_sh_plt0_entry; static const bfd_byte *elf_sh_plt_entry; static const bfd_byte *elf_sh_pic_plt_entry; diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c index d960235298a..13294a0556d 100644 --- a/bfd/elf32-v850.c +++ b/bfd/elf32-v850.c @@ -1415,30 +1415,6 @@ v850_elf_reloc (abfd, reloc, symbol, data, isection, obfd, err) relocation += symbol->section->output_offset; relocation += reloc->addend; -#if 0 /* Since this reloc is going to be processed later on, we should - not make it pc-relative here. To test this, try assembling and - linking this program: - - .text - .globl _start - nop - _start: - jr foo - - .section ".foo","ax" - nop - foo: - nop */ - if (reloc->howto->pc_relative) - { - /* Here the variable relocation holds the final address of the - symbol we are relocating against, plus any addend. */ - relocation -= isection->output_section->vma + isection->output_offset; - - /* Deal with pcrel_offset. */ - relocation -= reloc->address; - } -#endif reloc->addend = relocation; return bfd_reloc_ok; } @@ -1719,17 +1695,6 @@ v850_elf_relocate_section (output_bfd, info, input_bfd, input_section, sym = local_syms + r_symndx; sec = local_sections[r_symndx]; relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); -#if 0 - { - char * name; - - name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); - name = (name == NULL) ? "<none>" : name; - fprintf (stderr, "local: sec: %s, sym: %s (%d), value: %x + %x + %x addend %x\n", - sec->name, name, sym->st_name, - sec->output_section->vma, sec->output_offset, sym->st_value, rel->r_addend); - } -#endif } else { diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c index dd68f708a67..699b8628cf3 100644 --- a/bfd/elf64-mips.c +++ b/bfd/elf64-mips.c @@ -1367,9 +1367,6 @@ mips_elf64_be_swap_reloc_out (bfd *abfd, const Elf_Internal_Rela *src, mirel.r_offset = src[0].r_offset; BFD_ASSERT(src[0].r_offset == src[1].r_offset); -#if 0 - BFD_ASSERT(src[0].r_offset == src[2].r_offset); -#endif mirel.r_type = ELF64_MIPS_R_TYPE (src[0].r_info); mirel.r_sym = ELF64_R_SYM (src[0].r_info); diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c index 1b2835cc02e..a9b553d0f59 100644 --- a/bfd/elf64-sparc.c +++ b/bfd/elf64-sparc.c @@ -1268,7 +1268,6 @@ sparc64_elf_check_relocs (abfd, info, sec, relocs) sgot->size += 8; -#if 0 /* Doesn't work for 64-bit -fPIC, since sethi/or builds unsigned numbers. If we permit ourselves to modify code so we get sethi/xor, this could work. @@ -1277,10 +1276,11 @@ sparc64_elf_check_relocs (abfd, info, sec, relocs) /* If the .got section is more than 0x1000 bytes, we add 0x1000 to the value of _GLOBAL_OFFSET_TABLE_, so that 13 bit relocations have a greater chance of working. */ + /* if (sgot->size >= 0x1000 && elf_hash_table (info)->hgot->root.u.def.value == 0) elf_hash_table (info)->hgot->root.u.def.value = 0x1000; -#endif + */ break; diff --git a/bfd/elflink.c b/bfd/elflink.c index 328e780fe49..c7dfbd123fc 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -7830,22 +7830,6 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) goto error_return; } -#if 0 - /* Some standard ELF linkers do this, but we don't because it causes - bootstrap comparison failures. */ - /* Output a file symbol for the output file as the second symbol. - We output this even if we are discarding local symbols, although - I'm not sure if this is correct. */ - elfsym.st_value = 0; - elfsym.st_size = 0; - elfsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_FILE); - elfsym.st_other = 0; - elfsym.st_shndx = SHN_ABS; - if (! elf_link_output_sym (&finfo, bfd_get_filename (abfd), - &elfsym, bfd_abs_section_ptr, NULL)) - goto error_return; -#endif - /* Output a symbol for each section. We output these even if we are discarding local symbols, since they are used for relocs. These symbols have no names. We store the index of each one in the diff --git a/bfd/hosts/delta68.h b/bfd/hosts/delta68.h index 1a6a6e6f197..302628e8786 100644 --- a/bfd/hosts/delta68.h +++ b/bfd/hosts/delta68.h @@ -7,12 +7,8 @@ #define NBPG NBPC #define HOST_DATA_START_ADDR u.u_exdata.ux_datorg #define HOST_TEXT_START_ADDR u.u_exdata.ux_txtorg -#if 0 -#define HOST_STACK_END_ADDR 0x40000000 -#else /* User's stack, copied from sys/param.h */ #define HOST_STACK_END_ADDR USRSTACK -#endif #define UPAGES USIZE #define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(abfd) \ abfd->tdata.trad_core_data->u.u_abort diff --git a/bfd/hosts/vaxbsd.h b/bfd/hosts/vaxbsd.h index ceb9ccedfaf..75ba59e3ddc 100644 --- a/bfd/hosts/vaxbsd.h +++ b/bfd/hosts/vaxbsd.h @@ -1,12 +1,5 @@ #define NO_CORE_COMMAND /* No command name in core file */ -#if 0 -#undef ALIGN /* They use it, we use it too */ -/* Does not exist on BSD 4.3, it uses machine/machparam.h. - Whatever it is, it's included by <sys/param.h>, which trad-core.c, - the only place that uses this (I think), already includes. */ -#include <machine/param.h> -#endif #undef ALIGN /* They use it, we use it too */ /* Note that HOST_PAGE_SIZE -- the page size as far as executable files diff --git a/bfd/i386aout.c b/bfd/i386aout.c index 6b2948ef4cc..f87e6c92959 100644 --- a/bfd/i386aout.c +++ b/bfd/i386aout.c @@ -31,11 +31,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define N_TXTADDR(x) (N_MAGIC(x)==ZMAGIC ? 0x1020 : 0) #define N_TXTSIZE(x) ((x).a_text) -#if 0 -#define N_DATADDR(x) (N_MAGIC(x)==OMAGIC? (N_TXTADDR(x)+(x).a_text) : (SEGMENT_SIZE + ((0x1020+(x).a_text-1) & ~(SEGMENT_SIZE-1)))) -#define NOSUBEXECB - -#endif #define TARGET_PAGE_SIZE 4096 #define SEGMENT_SIZE 0x400000 #define DEFAULT_ARCH bfd_arch_i386 diff --git a/bfd/i386msdos.c b/bfd/i386msdos.c index a1a7baa13e7..56accd07913 100644 --- a/bfd/i386msdos.c +++ b/bfd/i386msdos.c @@ -28,29 +28,6 @@ #include "libbfd.h" #include "libaout.h" -#if 0 -struct exe_header -{ - unsigned short magic; - unsigned short bytes_in_last_page; - unsigned short npages; /* number of 512-byte "pages" including this header */ - unsigned short nrelocs; - unsigned short header_paras; /* number of 16-byte paragraphs in header */ - unsigned short reserved; - unsigned short load_switch; - unsigned short ss_ofs; - unsigned short sp; - unsigned short checksum; - unsigned short ip; - unsigned short cs_ofs; - unsigned short reloc_ofs; - unsigned short reserved2; - unsigned short something1; - unsigned short something2; - unsigned short something3; -}; -#endif - #define EXE_MAGIC 0x5a4d #define EXE_LOAD_HIGH 0x0000 #define EXE_LOAD_LOW 0xffff diff --git a/bfd/i386os9k.c b/bfd/i386os9k.c index c4b9d1ee131..ec5e2795a17 100644 --- a/bfd/i386os9k.c +++ b/bfd/i386os9k.c @@ -77,40 +77,6 @@ os9k_swap_exec_header_in (abfd, raw_bytes, execp) return TRUE; } -#if 0 -/* Swaps the information in an internal exec header structure into the - supplied buffer ready for writing to disk. */ - -void os9k_swap_exec_header_out - PARAMS ((bfd *, struct internal_exec *, struct mh_com *)); - -void -os9k_swap_exec_header_out (abfd, execp, raw_bytes) - bfd *abfd; - struct internal_exec *execp; - mh_com *raw_bytes; -{ - mh_com *bytes = (mh_com *) raw_bytes; - - /* Now fill in fields in the raw data, from the fields in the exec struct. */ - H_PUT_32 (abfd, execp->a_info, bytes->e_info); - H_PUT_32 (abfd, execp->a_text, bytes->e_text); - H_PUT_32 (abfd, execp->a_data, bytes->e_data); - H_PUT_32 (abfd, execp->a_bss, bytes->e_bss); - H_PUT_32 (abfd, execp->a_syms, bytes->e_syms); - H_PUT_32 (abfd, execp->a_entry, bytes->e_entry); - H_PUT_32 (abfd, execp->a_trsize, bytes->e_trsize); - H_PUT_32 (abfd, execp->a_drsize, bytes->e_drsize); - H_PUT_32 (abfd, execp->a_tload, bytes->e_tload); - H_PUT_32 (abfd, execp->a_dload, bytes->e_dload); - bytes->e_talign[0] = execp->a_talign; - bytes->e_dalign[0] = execp->a_dalign; - bytes->e_balign[0] = execp->a_balign; - bytes->e_relaxable[0] = execp->a_relaxable; -} - -#endif /* 0 */ - static const bfd_target * os9k_object_p (abfd) bfd *abfd; @@ -190,125 +156,6 @@ os9k_callback (abfd) return abfd->xvec; } -#if 0 -struct bout_data_struct -{ - struct aoutdata a; - struct internal_exec e; -}; - -static bfd_boolean -os9k_mkobject (abfd) - bfd *abfd; -{ - struct bout_data_struct *rawptr; - bfd_size_type amt = sizeof (struct bout_data_struct); - - rawptr = (struct bout_data_struct *) bfd_zalloc (abfd, amt); - if (rawptr == NULL) - return FALSE; - - abfd->tdata.bout_data = rawptr; - exec_hdr (abfd) = &rawptr->e; - - obj_textsec (abfd) = (asection *) NULL; - obj_datasec (abfd) = (asection *) NULL; - obj_bsssec (abfd) = (asection *) NULL; - - return TRUE; -} - -static bfd_boolean -os9k_write_object_contents (abfd) - bfd *abfd; -{ - struct external_exec swapped_hdr; - - if (! aout_32_make_sections (abfd)) - return FALSE; - - exec_hdr (abfd)->a_info = BMAGIC; - - exec_hdr (abfd)->a_text = obj_textsec (abfd)->size; - exec_hdr (abfd)->a_data = obj_datasec (abfd)->size; - exec_hdr (abfd)->a_bss = obj_bsssec (abfd)->size; - exec_hdr (abfd)->a_syms = bfd_get_symcount (abfd) * sizeof (struct nlist); - exec_hdr (abfd)->a_entry = bfd_get_start_address (abfd); - exec_hdr (abfd)->a_trsize = ((obj_textsec (abfd)->reloc_count) * - sizeof (struct relocation_info)); - exec_hdr (abfd)->a_drsize = ((obj_datasec (abfd)->reloc_count) * - sizeof (struct relocation_info)); - - exec_hdr (abfd)->a_talign = obj_textsec (abfd)->alignment_power; - exec_hdr (abfd)->a_dalign = obj_datasec (abfd)->alignment_power; - exec_hdr (abfd)->a_balign = obj_bsssec (abfd)->alignment_power; - - exec_hdr (abfd)->a_tload = obj_textsec (abfd)->vma; - exec_hdr (abfd)->a_dload = obj_datasec (abfd)->vma; - - bout_swap_exec_header_out (abfd, exec_hdr (abfd), &swapped_hdr); - - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 - || bfd_bwrite ((PTR) & swapped_hdr, (bfd_size_type) EXEC_BYTES_SIZE, - abfd) != EXEC_BYTES_SIZE) - return FALSE; - - /* Now write out reloc info, followed by syms and strings. */ - if (bfd_get_symcount (abfd) != 0) - { - if (bfd_seek (abfd, (file_ptr) (N_SYMOFF (*exec_hdr (abfd))), SEEK_SET) - != 0) - return FALSE; - - if (!aout_32_write_syms (abfd)) - return FALSE; - - if (bfd_seek (abfd, (file_ptr) (N_TROFF (*exec_hdr (abfd))), SEEK_SET) - != 0) - return FALSE; - - if (!b_out_squirt_out_relocs (abfd, obj_textsec (abfd))) - return FALSE; - if (bfd_seek (abfd, (file_ptr) (N_DROFF (*exec_hdr (abfd))), SEEK_SET) - != 0) - return FALSE; - - if (!b_out_squirt_out_relocs (abfd, obj_datasec (abfd))) - return FALSE; - } - return TRUE; -} - -static bfd_boolean -os9k_set_section_contents (abfd, section, location, offset, count) - bfd *abfd; - sec_ptr section; - unsigned char *location; - file_ptr offset; - int count; -{ - - if (! abfd->output_has_begun) - { /* set by bfd.c handler */ - if (! aout_32_make_sections (abfd)) - return FALSE; - - obj_textsec (abfd)->filepos = sizeof (struct internal_exec); - obj_datasec (abfd)->filepos = obj_textsec (abfd)->filepos - + obj_textsec (abfd)->size; - - } - /* Regardless, once we know what we're doing, we might as well get going. */ - if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0) - return FALSE; - - if (count != 0) - return bfd_bwrite ((PTR) location, (bfd_size_type) count, abfd) == count; - - return TRUE; -} -#endif /* 0 */ - static int os9k_sizeof_headers (ignore_abfd, ignore) bfd *ignore_abfd ATTRIBUTE_UNUSED; diff --git a/bfd/ieee.c b/bfd/ieee.c index c16a1ed1590..2b1ed532fe9 100644 --- a/bfd/ieee.c +++ b/bfd/ieee.c @@ -1801,10 +1801,6 @@ ieee_print_symbol (abfd, afile, symbol, how) fprintf (file, "%s", symbol->name); break; case bfd_print_symbol_more: -#if 0 - fprintf (file, "%4x %2x", aout_symbol (symbol)->desc & 0xffff, - aout_symbol (symbol)->other & 0xff); -#endif BFD_FAIL (); break; case bfd_print_symbol_all: @@ -2316,11 +2312,6 @@ ieee_write_section_part (abfd) if (! ieee_write_id (abfd, s->name)) return FALSE; -#if 0 - ieee_write_int (abfd, 0); /* Parent */ - ieee_write_int (abfd, 0); /* Brother */ - ieee_write_int (abfd, 0); /* Context */ -#endif /* Alignment. */ if (! ieee_write_byte (abfd, ieee_section_alignment_enum) || ! ieee_write_byte (abfd, @@ -2471,10 +2462,6 @@ do_with_relocs (abfd, s) { arelent *r = *p; bfd_signed_vma ov; -#if 0 - if (r->howto->pc_relative) - r->addend += current_byte_index; -#endif switch (r->howto->size) { case 2: @@ -3938,68 +3925,6 @@ ieee_sizeof_headers (abfd, x) return 0; } - -/* The debug info routines are never used. */ -#if 0 - -static void -ieee_bfd_debug_info_start (abfd) - bfd *abfd; -{ - -} - -static void -ieee_bfd_debug_info_end (abfd) - bfd *abfd; -{ - -} - - -/* Add this section to the list of sections we have debug info for, to - be ready to output it at close time. */ -static void -ieee_bfd_debug_info_accumulate (abfd, section) - bfd *abfd; - asection *section; -{ - ieee_data_type *ieee = IEEE_DATA (section->owner); - ieee_data_type *output_ieee = IEEE_DATA (abfd); - - /* Can only accumulate data from other ieee bfds. */ - if (section->owner->xvec != abfd->xvec) - return; - /* Only bother once per bfd. */ - if (ieee->done_debug) - return; - ieee->done_debug = TRUE; - - /* Don't bother if there is no debug info. */ - if (ieee->w.r.debug_information_part == 0) - return; - - /* Add to chain. */ - { - bfd_size_type amt = sizeof (bfd_chain_type); - bfd_chain_type *n = (bfd_chain_type *) bfd_alloc (abfd, amt); - - if (!n) - abort (); /* FIXME */ - n->this = section->owner; - n->next = (bfd_chain_type *) NULL; - - if (output_ieee->chain_head) - output_ieee->chain_head->next = n; - else - output_ieee->chain_root = n; - - output_ieee->chain_head = n; - } -} - -#endif - #define ieee_close_and_cleanup _bfd_generic_close_and_cleanup #define ieee_bfd_free_cached_info _bfd_generic_bfd_free_cached_info diff --git a/bfd/mach-o.c b/bfd/mach-o.c index 19a19d4d0f6..7efc1a91bb4 100644 --- a/bfd/mach-o.c +++ b/bfd/mach-o.c @@ -379,41 +379,6 @@ bfd_mach_o_write_contents (abfd) for (s = abfd->sections; s != (asection *) NULL; s = s->next) ; -#if 0 - for (i = 0; i < mdata->header.ncmds; i++) - { - bfd_mach_o_load_command *cur = &mdata->commands[i]; - if (cur->type != BFD_MACH_O_LC_SEGMENT) - break; - - { - bfd_mach_o_segment_command *seg = &cur->command.segment; - char buf[1024]; - bfd_vma nbytes = seg->filesize; - bfd_vma curoff = seg->fileoff; - - while (nbytes > 0) - { - bfd_vma thisread = nbytes; - - if (thisread > 1024) - thisread = 1024; - - bfd_seek (abfd, curoff, SEEK_SET); - if (bfd_bread ((PTR) buf, thisread, abfd) != thisread) - return FALSE; - - bfd_seek (abfd, curoff, SEEK_SET); - if (bfd_bwrite ((PTR) buf, thisread, abfd) != thisread) - return FALSE; - - nbytes -= thisread; - curoff += thisread; - } - } - } -#endif - /* Now write header information. */ if (bfd_mach_o_write_header (abfd, &mdata->header) != 0) return FALSE; @@ -679,21 +644,6 @@ bfd_mach_o_scan_write_symtab_symbols (abfd, command) s = &sym->symbols[i]; - /* Don't set this from the symbol information; use stored values. */ -#if 0 - if (s->flags & BSF_GLOBAL) - ntype |= N_EXT; - if (s->flags & BSF_DEBUGGING) - ntype |= N_STAB; - - if (s->section == bfd_und_section_ptr) - ntype |= N_UNDF; - else if (s->section == bfd_abs_section_ptr) - ntype |= N_ABS; - else - ntype |= N_SECT; -#endif - /* Instead just set from the stored values. */ ntype = (s->udata.i >> 24) & 0xff; nsect = (s->udata.i >> 16) & 0xff; @@ -1707,17 +1657,9 @@ bfd_mach_o_scan (abfd, header, mdata) } if (bfd_mach_o_scan_start_address (abfd) < 0) - { -#if 0 - fprintf (stderr, "bfd_mach_o_scan: unable to scan start address: %s\n", - bfd_errmsg (bfd_get_error ())); - abfd->tdata.mach_o_data = NULL; - return -1; -#endif - } + ; bfd_mach_o_flatten_sections (abfd); - return 0; } diff --git a/bfd/nlm32-sparc.c b/bfd/nlm32-sparc.c index 847220e6b4f..fbdbccf02a2 100644 --- a/bfd/nlm32-sparc.c +++ b/bfd/nlm32-sparc.c @@ -62,25 +62,6 @@ enum reloc_type R_SPARC_max }; -#if 0 -static const char *const reloc_type_names[] = - { - "R_SPARC_NONE", - "R_SPARC_8", "R_SPARC_16", "R_SPARC_32", - "R_SPARC_DISP8", "R_SPARC_DISP16", "R_SPARC_DISP32", - "R_SPARC_WDISP30", "R_SPARC_WDISP22", - "R_SPARC_HI22", "R_SPARC_22", - "R_SPARC_13", "R_SPARC_LO10", - "R_SPARC_GOT10", "R_SPARC_GOT13", "R_SPARC_GOT22", - "R_SPARC_PC10", "R_SPARC_PC22", - "R_SPARC_WPLT30", - "R_SPARC_COPY", - "R_SPARC_GLOB_DAT", "R_SPARC_JMP_SLOT", - "R_SPARC_RELATIVE", - "R_SPARC_UA32", - }; -#endif - static reloc_howto_type nlm32_sparc_howto_table[] = { HOWTO (R_SPARC_NONE, 0,0, 0,FALSE,0,complain_overflow_dont, 0,"R_SPARC_NONE", FALSE,0,0x00000000,TRUE), @@ -211,11 +192,7 @@ nlm_sparc_write_reloc (abfd, sec, rel) segment. This offset is the section vma, adjusted by the vma of the lowest section in that segment, plus the address of the relocation. */ -#if 0 - val = bfd_get_section_vma (abfd, (*rel->sym_ptr_ptr)->section) + rel->address; -#else val = bfd_get_section_vma (abfd, sec) + rel->address; -#endif #ifdef DEBUG fprintf (stderr, "%s: val = %08lx, addend = %08lx, type = %d\n", diff --git a/bfd/oasys.c b/bfd/oasys.c index 16f6b6d5adf..7749b5f212d 100644 --- a/bfd/oasys.c +++ b/bfd/oasys.c @@ -738,14 +738,6 @@ oasys_slurp_section_data (abfd) r->symbol = 0; /* Work out the howto */ abort (); -#if 0 - r->relent.section = - data->sections[reloc & - RELOCATION_SECT_BITS]; - - r->relent.addend = - - r->relent.section->vma; -#endif r->relent.address = dst_ptr - dst_base_ptr; r->relent.howto = &howto_table[reloc >> 6]; r->relent.sym_ptr_ptr = (asymbol **) NULL; @@ -781,10 +773,6 @@ oasys_slurp_section_data (abfd) /* Work out the howto */ abort (); -#if 0 - r->relent.section = (asection - *) NULL; -#endif r->relent.addend = 0; r->relent.address = dst_ptr - dst_base_ptr; r->relent.howto = &howto_table[reloc >> 6]; @@ -891,13 +879,6 @@ oasys_canonicalize_reloc (ignore_abfd, section, relptr, symbols) { abort (); -#if 0 - if (src->relent.section == (asection *) NULL) - { - src->relent.sym_ptr_ptr = symbols + src->symbol; - } -#endif - *relptr++ = &src->relent; src = src->next; reloc_count++; @@ -1228,20 +1209,9 @@ oasys_write_data (abfd) } /* Is this a section relative relocation, or a symbol - relative relocation ? */ + relative relocation ? */ abort (); -#if 0 - if (r->section != (asection *) NULL) - { - /* The relent has a section attached, so it must be section - relative */ - rel_byte |= RELOCATION_TYPE_REL; - rel_byte |= r->section->output_section->target_index; - *dst++ = rel_byte; - } - else -#endif { asymbol *sym = *(r->sym_ptr_ptr); diff --git a/bfd/opncls.c b/bfd/opncls.c index 501c56865c4..7358cf3093b 100644 --- a/bfd/opncls.c +++ b/bfd/opncls.c @@ -1189,10 +1189,6 @@ RETURNS char * bfd_follow_gnu_debuglink (bfd *abfd, const char *dir) { -#if 0 /* Disabled until DEBUGDIR can be defined by configure.in. */ - if (dir == NULL) - dir = DEBUGDIR; -#endif return find_separate_debug_file (abfd, dir); } diff --git a/bfd/pdp11.c b/bfd/pdp11.c index f1aa421a9d9..20e9bf3cf58 100644 --- a/bfd/pdp11.c +++ b/bfd/pdp11.c @@ -842,15 +842,7 @@ NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p) } #endif /* STAT_FOR_EXEC */ - if (result) - { -#if 0 /* These should be set correctly anyways. */ - abfd->sections = obj_textsec (abfd); - obj_textsec (abfd)->next = obj_datasec (abfd); - obj_datasec (abfd)->next = obj_bsssec (abfd); -#endif - } - else + if (!result) { free (rawptr); abfd->tdata.aout_data = oldrawptr; @@ -1074,9 +1066,6 @@ adjust_o_magic (abfd, execp) /* Data. */ if (!obj_datasec (abfd)->user_set_vma) { -#if 0 /* ?? Does alignment in the file image really matter? */ - pad = align_power (vma, obj_datasec (abfd)->alignment_power) - vma; -#endif obj_textsec (abfd)->size += pad; pos += pad; vma += pad; @@ -1091,9 +1080,6 @@ adjust_o_magic (abfd, execp) /* BSS. */ if (! obj_bsssec (abfd)->user_set_vma) { -#if 0 - pad = align_power (vma, obj_bsssec (abfd)->alignment_power) - vma; -#endif obj_datasec (abfd)->size += pad; pos += pad; vma += pad; @@ -1708,41 +1694,6 @@ translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer) else if ((cache_ptr->flags & BSF_GLOBAL) != 0) sym_pointer->e_type[0] |= N_EXT; -#if 0 - if ((cache_ptr->flags & BSF_CONSTRUCTOR) != 0) - { - int type = ((aout_symbol_type *) cache_ptr)->type; - - - switch (type) - { - case N_ABS: type = N_SETA; break; - case N_TEXT: type = N_SETT; break; - case N_DATA: type = N_SETD; break; - case N_BSS: type = N_SETB; break; - } - sym_pointer->e_type[0] = type; - } -#endif - -#if 0 - if ((cache_ptr->flags & BSF_WEAK) != 0) - { - int type; - - switch (sym_pointer->e_type[0] & N_TYPE) - { - default: - case N_ABS: type = N_WEAKA; break; - case N_TEXT: type = N_WEAKT; break; - case N_DATA: type = N_WEAKD; break; - case N_BSS: type = N_WEAKB; break; - case N_UNDF: type = N_WEAKU; break; - } - sym_pointer->e_type[0] = type; - } -#endif - PUT_WORD(abfd, value, sym_pointer->e_value); return TRUE; @@ -2063,30 +2014,6 @@ pdp11_aout_swap_reloc_out (abfd, g, natptr) else r_index = (*(g->sym_ptr_ptr))->KEEPIT; -#if 0 - if (bfd_is_abs_section (bfd_get_section (sym))) - { - r_extern = 0; - r_index = N_ABS; - r_type = RABS; - } - else if ((sym->flags & BSF_SECTION_SYM) == 0) - { - if (bfd_is_und_section (bfd_get_section (sym)) - || (sym->flags & BSF_GLOBAL) != 0) - r_extern = 1; - else - r_extern = 0; - r_index = (*(g->sym_ptr_ptr))->KEEPIT; - } - else - { - /* Just an ordinary section */ - r_extern = 0; - r_index = output_section->target_index; - } -#endif - reloc_entry = r_index << 4 | r_type | r_pcrel; PUT_WORD (abfd, reloc_entry, natptr); @@ -2297,14 +2224,6 @@ NAME(aout,squirt_out_relocs) (abfd, section) unsigned int count = section->reloc_count; bfd_size_type natsize; -#if 0 - /* If we're writing an .o file, we must write - relocation information, even if there is none. */ - if ((count == 0 || section->orelocation == NULL) && - <writing_executable>) - return TRUE; -#endif - natsize = section->size; native = (unsigned char *) bfd_zalloc (abfd, natsize); if (!native) @@ -3185,12 +3104,6 @@ aout_link_add_symbols (abfd, info) type = H_GET_8 (abfd, p->e_type); -#if 0 /* not supported in PDP-11 a.out */ - /* Ignore debugging symbols. */ - if ((type & N_STAB) != 0) - continue; -#endif - name = strings + GET_WORD (abfd, p->e_strx); value = GET_WORD (abfd, p->e_value); flags = BSF_GLOBAL; @@ -4661,13 +4574,7 @@ pdp11_aout_link_input_section (finfo, input_bfd, input_section, relocs, } /* Change the address of the relocation. */ -#if 0 - PUT_WORD (output_bfd, - r_addr + input_section->output_offset, - rel->r_address); -#else -fprintf (stderr, "TODO: change the address of the relocation\n"); -#endif + fprintf (stderr, "TODO: change the address of the relocation\n"); /* Adjust a PC relative relocation by removing the reference to the original address in the section and including the diff --git a/bfd/pe-mips.c b/bfd/pe-mips.c index 4d6d9618497..d3026b770e1 100644 --- a/bfd/pe-mips.c +++ b/bfd/pe-mips.c @@ -113,15 +113,6 @@ coff_mips_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, diff = reloc_entry->addend; } -#ifdef COFF_WITH_PE -#if 0 - /* dj - handle it like any other reloc? */ - /* FIXME: How should this case be handled? */ - if (reloc_entry->howto->type == MIPS_R_RVA && diff != 0) - abort (); -#endif -#endif - #define DOIT(x) \ x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + (diff >> howto->rightshift)) & howto->dst_mask)) @@ -641,12 +632,6 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd, BFD_ASSERT (input_bfd->xvec->byteorder == output_bfd->xvec->byteorder); -#if 0 - printf ("dj: relocate %s(%s) %08x\n", - input_bfd->filename, input_section->name, - input_section->output_section->vma + input_section->output_offset); -#endif - gp = _bfd_get_gp_value (output_bfd); if (gp == 0) gp_undefined = TRUE; @@ -754,12 +739,6 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd, src = rel->r_vaddr + input_section->output_section->vma + input_section->output_offset; -#if 0 - printf ("dj: reloc %02x %-8s a=%08x/%08x(%08x) v=%08x+%08x %s\n", - rel->r_type, howto_table[rel->r_type].name, - src, rel->r_vaddr, *(unsigned long *)mem, val, rel->r_offset, - h?h->root.root.string:"(none)"); -#endif /* OK, at this point the following variables are set up: src = VMA of the memory we're fixing up diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c index 6a41e9bcaa5..d5db4a8be1b 100644 --- a/bfd/peXXigen.c +++ b/bfd/peXXigen.c @@ -138,24 +138,6 @@ _bfd_XXi_swap_sym_in (abfd, ext1, in1) { in->n_value = 0x0; -#if 0 - /* FIXME: This is clearly wrong. The problem seems to be that - undefined C_SECTION symbols appear in the first object of a - MS generated .lib file, and the symbols are not defined - anywhere. */ - in->n_scnum = 1; - - /* I have tried setting the class to 3 and using the following - to set the section number. This will put the address of the - pointer to the string kernel32.dll at addresses 0 and 0x10 - off start of idata section which is not correct. */ -#if 0 - if (strcmp (in->_n._n_name, ".idata$4") == 0) - in->n_scnum = 3; - else - in->n_scnum = 2; -#endif -#else /* Create synthetic empty sections as needed. DJ */ if (in->n_scnum == 0) { @@ -205,7 +187,6 @@ _bfd_XXi_swap_sym_in (abfd, ext1, in1) in->n_scnum = unused_section_number; } in->n_sclass = C_STAT; -#endif } #endif @@ -1050,14 +1031,6 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out) H_PUT_16 (abfd, 0xffff, scnhdr_ext->s_nreloc); scnhdr_int->s_flags |= IMAGE_SCN_LNK_NRELOC_OVFL; H_PUT_32 (abfd, scnhdr_int->s_flags, scnhdr_ext->s_flags); -#if 0 - (*_bfd_error_handler) (_("%s: reloc overflow 1: 0x%lx > 0xffff"), - bfd_get_filename (abfd), - scnhdr_int->s_nreloc); - bfd_set_error (bfd_error_file_truncated); - H_PUT_16 (abfd, 0xffff, scnhdr_ext->s_nreloc); - ret = 0; -#endif } } return ret; @@ -1230,11 +1203,6 @@ pe_print_idata (abfd, vfile) /* Print (i + extra->DataDirectory[1].VirtualAddress). */ fprintf (file, " %08lx\t", (unsigned long) (i + adj + dataoff)); -#if 0 - if (i + 20 > datasize) - /* Check stuff. */ - ; -#endif hint_addr = bfd_get_32 (abfd, data + i + dataoff); time_stamp = bfd_get_32 (abfd, data + i + 4 + dataoff); forward_chain = bfd_get_32 (abfd, data + i + 8 + dataoff); @@ -2010,14 +1978,6 @@ _bfd_XX_get_symbol_info (abfd, symbol, ret) symbol_info *ret; { coff_get_symbol_info (abfd, symbol, ret); -#if 0 /* This code no longer appears to be necessary. - ImageBase has already been added in by coff_swap_scnhdr_in. */ - if (pe_data (abfd) != NULL - && ((symbol->flags & BSF_DEBUGGING) == 0 - || (symbol->flags & BSF_DEBUGGING_RELOC) != 0) - && ! bfd_is_abs_section (symbol->section)) - ret->value += pe_data (abfd)->pe_opthdr.ImageBase; -#endif } /* Handle the .idata section and other things that need symbol table diff --git a/bfd/pef.c b/bfd/pef.c index 9bb3a76f155..7f266c5cff9 100644 --- a/bfd/pef.c +++ b/bfd/pef.c @@ -600,13 +600,7 @@ bfd_pef_scan (abfd, header, mdata) } if (bfd_pef_scan_start_address (abfd) < 0) - { -#if 0 - fprintf (stderr, "bfd_pef_scan: unable to scan start address: %s\n", - bfd_errmsg (bfd_get_error ())); - return -1; -#endif - } + ; abfd->tdata.pef_data = mdata; diff --git a/bfd/peicode.h b/bfd/peicode.h index ab940f76850..f72d3f5f706 100644 --- a/bfd/peicode.h +++ b/bfd/peicode.h @@ -487,11 +487,6 @@ pe_ILF_make_a_symbol_reloc (pe_ILF_vars * vars, internal->r_vaddr = address; internal->r_symndx = sym_index; internal->r_type = entry->howto->type; -#if 0 /* These fields do not need to be initialised. */ - internal->r_size = 0; - internal->r_extern = 0; - internal->r_offset = 0; -#endif vars->relcount ++; @@ -583,39 +578,18 @@ pe_ILF_make_a_symbol (pe_ILF_vars * vars, /* The following initialisations are unnecessary - the memory is zero initialised. They are just kept here as reminders. */ -#if 0 - esym->e.e.e_zeroes = 0; - esym->e_value = 0; - esym->e_type = T_NULL; - esym->e_numaux = 0; -#endif /* Initialise the internal symbol structure. */ ent->u.syment.n_sclass = sclass; ent->u.syment.n_scnum = section->target_index; ent->u.syment._n._n_n._n_offset = (long) sym; -#if 0 /* See comment above. */ - ent->u.syment.n_value = 0; - ent->u.syment.n_flags = 0; - ent->u.syment.n_type = T_NULL; - ent->u.syment.n_numaux = 0; - ent->fix_value = 0; -#endif - sym->symbol.the_bfd = vars->abfd; sym->symbol.name = vars->string_ptr; sym->symbol.flags = BSF_EXPORT | BSF_GLOBAL | extra_flags; sym->symbol.section = section; sym->native = ent; -#if 0 /* See comment above. */ - sym->symbol.value = 0; - sym->symbol.udata.i = 0; - sym->done_lineno = FALSE; - sym->lineno = NULL; -#endif - * vars->table_ptr = vars->sym_index; * vars->sym_ptr_ptr = sym; diff --git a/bfd/reloc.c b/bfd/reloc.c index 49d79388896..f3049355c52 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -715,7 +715,6 @@ bfd_perform_relocation (bfd *abfd, && strcmp (abfd->xvec->name, "coff-Intel-little") != 0 && strcmp (abfd->xvec->name, "coff-Intel-big") != 0) { -#if 1 /* For m68k-coff, the addend was being subtracted twice during relocation with -r. Removing the line below this comment fixes that problem; see PR 2953. @@ -786,7 +785,6 @@ space consuming. For each target: right */ relocation -= reloc_entry->addend; -#endif reloc_entry->addend = 0; } else @@ -1100,10 +1098,10 @@ bfd_install_relocation (bfd *abfd, && strcmp (abfd->xvec->name, "coff-Intel-little") != 0 && strcmp (abfd->xvec->name, "coff-Intel-big") != 0) { -#if 1 -/* For m68k-coff, the addend was being subtracted twice during - relocation with -r. Removing the line below this comment - fixes that problem; see PR 2953. + + /* For m68k-coff, the addend was being subtracted twice during + relocation with -r. Removing the line below this comment + fixes that problem; see PR 2953. However, Ian wrote the following, regarding removing the line below, which explains why it is still enabled: --djm @@ -1170,7 +1168,6 @@ space consuming. For each target: 7) if they are different you have to figure out which version is right. */ relocation -= reloc_entry->addend; -#endif reloc_entry->addend = 0; } else diff --git a/bfd/riscix.c b/bfd/riscix.c index f9b5ae2cd89..973cb762116 100644 --- a/bfd/riscix.c +++ b/bfd/riscix.c @@ -331,11 +331,6 @@ riscix_swap_std_reloc_out (abfd, g, natptr) if (r_length == 3) r_pcrel = r_pcrel ? 0 : 1; -#if 0 - /* For a standard reloc, the addend is in the object file. */ - r_addend = g->addend + (*(g->sym_ptr_ptr))->section->output_section->vma; -#endif - /* name was clobbered by aout_write_syms to be symbol index */ /* If this relocation is relative to a symbol then set the diff --git a/bfd/section.c b/bfd/section.c index 9ed0ae12ce8..72ffcd55ab7 100644 --- a/bfd/section.c +++ b/bfd/section.c @@ -1059,19 +1059,6 @@ bfd_set_section_flags (bfd *abfd ATTRIBUTE_UNUSED, sec_ptr section, flagword flags) { -#if 0 - /* If you try to copy a text section from an input file (where it - has the SEC_CODE flag set) to an output file, this loses big if - the bfd_applicable_section_flags (abfd) doesn't have the SEC_CODE - set - which it doesn't, at least not for a.out. FIXME */ - - if ((flags & bfd_applicable_section_flags (abfd)) != flags) - { - bfd_set_error (bfd_error_invalid_operation); - return FALSE; - } -#endif - section->flags = flags; return TRUE; } diff --git a/bfd/simple.c b/bfd/simple.c index fee2be089e5..36556151348 100644 --- a/bfd/simple.c +++ b/bfd/simple.c @@ -243,24 +243,9 @@ bfd_simple_get_relocated_section_contents (bfd *abfd, if (contents == NULL && data != NULL) free (data); -#if 0 - /* NOTE: cagney/2003-04-05: This free, which was introduced on - 2003-03-31 to stop a memory leak, caused a memory corruption - between GDB and BFD. The problem, which is stabs specific, can - be identified by a bunch of failures in relocate.exp vis: - - gdb.base/relocate.exp: get address of static_bar - - Details of the problem can be found on the binutils@ mailing - list, see the discussion thread: "gdb.mi/mi-cli.exp failures". */ - if (storage_needed != 0) - free (symbol_table); -#endif - bfd_map_over_sections (abfd, simple_restore_output_info, saved_offsets); free (saved_offsets); _bfd_generic_link_hash_table_free (link_info.hash); - return contents; } diff --git a/bfd/som.c b/bfd/som.c index 53a05b75d7d..d44c474519c 100644 --- a/bfd/som.c +++ b/bfd/som.c @@ -4543,11 +4543,6 @@ som_slurp_symbol_table (abfd) sym->symbol.value -= sym->symbol.section->vma; break; -#if 0 - /* SS_GLOBAL and SS_LOCAL are two names for the same thing. - Sound dumb? It is. */ - case SS_GLOBAL: -#endif case SS_LOCAL: sym->symbol.flags |= BSF_LOCAL; sym->symbol.section = bfd_section_from_som_symbol (abfd, bufp); diff --git a/bfd/sparclynx.c b/bfd/sparclynx.c index a7d78c6fadb..0f0761f6ba2 100644 --- a/bfd/sparclynx.c +++ b/bfd/sparclynx.c @@ -18,16 +18,6 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#if 0 -#define N_SHARED_LIB(x) 0 - -#define TEXT_START_ADDR 0 -#define TARGET_PAGE_SIZE 4096 -#define SEGMENT_SIZE TARGET_PAGE_SIZE -#define DEFAULT_ARCH bfd_arch_sparc - -#endif - /* Do not "beautify" the CONCAT* macro args. Traditional C will not remove whitespace added here, and thus will fail to concatenate the tokens. */ diff --git a/bfd/targets.c b/bfd/targets.c index 804da96b21f..e1bfcc4d48a 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -26,6 +26,14 @@ #include "fnmatch.h" /* + It's okay to see some: +#if 0 + directives in this source file, as targets.c uses them to exclude + certain BFD vectors. This comment is specially formatted to catch + users who grep for ^#if 0, so please keep it this way! +*/ + +/* SECTION Targets diff --git a/bfd/vms-misc.c b/bfd/vms-misc.c index 4b3fecc3762..048c643aba0 100644 --- a/bfd/vms-misc.c +++ b/bfd/vms-misc.c @@ -770,13 +770,7 @@ _bfd_vms_output_flush (abfd) while (aligncount-- > 0) { PRIV (output_buf)[real_size++] = 0; -#if 0 - /* this is why I *love* vms: inconsistency :-} - alignment is added to the subrecord length - but not to the record length */ - if (PRIV (push_level) > 0) -#endif - length++; + length++; } /* put length to buffer */ diff --git a/bfd/vms-tir.c b/bfd/vms-tir.c index aa3e5360442..2a4908b2d36 100644 --- a/bfd/vms-tir.c +++ b/bfd/vms-tir.c @@ -439,11 +439,6 @@ etir_sto (abfd, cmd, ptr) case ETIR_S_C_STO_B: dummy = _bfd_vms_pop (abfd, &psect); -#if 0 - if (is_share) /* FIXME */ - (*_bfd_error_handler) ("%s: byte fixups not supported", - cmd_name (cmd)); -#endif /* FIXME: check top bits */ image_write_b (abfd, (unsigned int) dummy & 0xff); break; @@ -453,11 +448,6 @@ etir_sto (abfd, cmd, ptr) case ETIR_S_C_STO_W: dummy = _bfd_vms_pop (abfd, &psect); -#if 0 - if (is_share) /* FIXME */ - (*_bfd_error_handler) ("%s: word fixups not supported", - cmd_name (cmd)); -#endif /* FIXME: check top bits */ image_write_w (abfd, (unsigned int) dummy & 0xffff); break; @@ -909,9 +899,6 @@ etir_stc (abfd, cmd, ptr) case ETIR_S_C_STC_NBH_PS: /* FIXME */ -#if 0 - (*_bfd_error_handler) ("%s: not supported", cmd_name (cmd)); -#endif break; default: @@ -2266,19 +2253,6 @@ _bfd_vms_write_tir (abfd, objtype) sptr->size = len; sto_imm (abfd, sptr, vaddr, section->index); sptr->size = hint_size; -#if 0 - vms_output_begin (abfd, - ETIR_S_C_STO_HINT_GBL, -1); - vms_output_long (abfd, - (unsigned long) (sec->index)); - vms_output_quad (abfd, (uquad) addr); - - hash = (_bfd_vms_length_hash_symbol - (abfd, sym->name, EOBJ_S_C_SYMSIZ)); - vms_output_counted (abfd, hash); - - vms_output_flush (abfd); -#endif } break; case ALPHA_R_LINKAGE: diff --git a/bfd/xsym.c b/bfd/xsym.c index 252be999d56..5f3cc1d0197 100644 --- a/bfd/xsym.c +++ b/bfd/xsym.c @@ -1367,21 +1367,6 @@ bfd_sym_print_modules_table_entry (abfd, f, entry) fprintf (f, ", child %lu", entry->mte_cmte_index); else fprintf (f, ", no child"); - -#if 0 - { - MTE bfd_sym_modules_table_entry pentry; - - ret = bfd_sym_fetch_modules_table_entry (abfd, &pentry, entry->mte_parent); - if (ret < 0) - fprintf (f, " parent MTE %lu [INVALID]\n", entry->mte_parent); - else - fprintf (f, " parent MTE %lu \"%.*s\"\n", - entry->mte_parent, - bfd_sym_symbol_name (abfd, pentry.mte_nte_index)[0], - &bfd_sym_symbol_name (abfd, pentry.mte_nte_index)[1]); - } -#endif } void |