X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=bfd%2Fbout.c;h=165dd24e5fc0128092d22c8f367a40ddce0e7897;hb=563e308f244b1d6adb9d012a3e11d458400b3ff2;hp=4ef10f52057e6f3345759bb1ed3a60f4ae41ba21;hpb=252b5132c753830d5fd56823373aed85f2a0db63;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/bout.c b/bfd/bout.c index 4ef10f5205..165dd24e5f 100644 --- a/bfd/bout.c +++ b/bfd/bout.c @@ -1,5 +1,7 @@ /* BFD back-end for Intel 960 b.out binaries. - Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, + 2000 + Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -18,7 +20,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. */ - #include "bfd.h" #include "sysdep.h" #include "libbfd.h" @@ -29,7 +30,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "aout/stab_gnu.h" #include "libaout.h" /* BFD a.out internal data structures */ - static int aligncode PARAMS ((bfd *abfd, asection *input_section, arelent *r, unsigned int shrink)); static void perform_slip PARAMS ((bfd *abfd, unsigned int slip, @@ -96,7 +96,7 @@ bout_swap_exec_header_out (abfd, execp, raw_bytes) { struct external_exec *bytes = (struct external_exec *)raw_bytes; - /* Now fill in fields in the raw data, from the fields in the exec struct. */ + /* Now fill in fields in the raw data, from the fields in the exec struct. */ bfd_h_put_32 (abfd, execp->a_info , bytes->e_info); PUT_WORD (abfd, execp->a_text , bytes->e_text); PUT_WORD (abfd, execp->a_data , bytes->e_data); @@ -113,7 +113,6 @@ bout_swap_exec_header_out (abfd, execp, raw_bytes) bytes->e_relaxable[0] = execp->a_relaxable; } - static const bfd_target * b_out_object_p (abfd) bfd *abfd; @@ -139,7 +138,6 @@ b_out_object_p (abfd) return aout_32_some_aout_object_p (abfd, &anexec, b_out_callback); } - /* Finish up the opening of a b.out file for reading. Fill in all the fields that are not handled by common code. */ @@ -188,8 +186,8 @@ b_out_callback (abfd) obj_textsec (abfd)->rel_filepos = N_TROFF(*execp); obj_datasec (abfd)->rel_filepos = N_DROFF(*execp); - adata(abfd).page_size = 1; /* Not applicable. */ - adata(abfd).segment_size = 1; /* Not applicable. */ + adata(abfd).page_size = 1; /* Not applicable. */ + adata(abfd).segment_size = 1; /* Not applicable. */ adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE; if (execp->a_relaxable) @@ -309,22 +307,22 @@ b_out_write_object_contents (abfd) } if (q > outsyms) - qsort (outsyms, q - outsyms, sizeof(asymbol*), b_out_symbol_cmp); + qsort (outsyms, q - outsyms, sizeof (asymbol*), b_out_symbol_cmp); /* Back to your regularly scheduled program. */ - if (bfd_seek (abfd, (file_ptr)(N_SYMOFF(*exec_hdr(abfd))), SEEK_SET) + 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) + 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) + if (bfd_seek (abfd, (file_ptr) (N_DROFF(*exec_hdr(abfd))), SEEK_SET) != 0) return false; @@ -343,7 +341,6 @@ b_out_write_object_contents (abfd) #define CALL 0x09000000 #define PCREL13_MASK 0x1fff - #define output_addr(sec) ((sec)->output_offset+(sec)->output_section->vma) /* Magic to turn callx into calljx */ @@ -379,11 +376,10 @@ calljx_callback (abfd, link_info, reloc_entry, src, dst, input_section) word += value + reloc_entry->addend; - bfd_put_32(abfd, word, dst); + bfd_put_32 (abfd, word, dst); return bfd_reloc_ok; } - /* Magic to turn call into callj */ static bfd_reloc_status_type callj_callback (abfd, link_info, reloc_entry, data, srcidx, dstidx, @@ -416,7 +412,7 @@ callj_callback (abfd, link_info, reloc_entry, data, srcidx, dstidx, /* The next symbol should be an N_BALNAME. */ BFD_ASSERT(IS_BALNAME(balsym->other)); - + /* We are calling a leaf, so replace the call instruction with a bal. */ word = BAL | ((word @@ -444,7 +440,7 @@ callj_callback (abfd, link_info, reloc_entry, data, srcidx, dstidx, - output_addr (input_section)) & BAL_MASK); } - bfd_put_32(abfd, word, (bfd_byte *) data + dstidx); + bfd_put_32 (abfd, word, (bfd_byte *) data + dstidx); return bfd_reloc_ok; } @@ -471,7 +467,6 @@ HOWTO(PCREL24, 0, 2, 24, true, 0, complain_overflow_signed,0,"pcrel24", true, 0x static reloc_howto_type howto_reloc_pcrel13 = HOWTO(PCREL13, 0, 2, 13, true, 0, complain_overflow_signed,0,"pcrel13", true, 0x00001fff,0x00001fff,false); - static reloc_howto_type howto_reloc_abs32codeshrunk = HOWTO(ABS32CODE_SHRUNK, 0, 2, 24, true, 0, complain_overflow_signed, 0,"callx->callj", true, 0x00ffffff, 0x00ffffff,false); @@ -494,7 +489,7 @@ static reloc_howto_type howto_done_align_table[] = { static reloc_howto_type * b_out_bfd_reloc_type_lookup (abfd, code) - bfd *abfd; + bfd *abfd ATTRIBUTE_UNUSED; bfd_reloc_code_real_type code; { switch (code) @@ -555,7 +550,7 @@ b_out_slurp_reloc_table (abfd, asect, symbols) return false; doit: - if (bfd_seek (abfd, (file_ptr)(asect->rel_filepos), SEEK_SET) != 0) + if (bfd_seek (abfd, (file_ptr) (asect->rel_filepos), SEEK_SET) != 0) return false; count = reloc_size / sizeof (struct relocation_info); @@ -576,8 +571,6 @@ b_out_slurp_reloc_table (abfd, asect, symbols) return false; } - - if (bfd_header_big_endian (abfd)) { /* big-endian bit field allocation order */ pcrel_mask = 0x80; @@ -727,17 +720,14 @@ b_out_slurp_reloc_table (abfd, asect, symbols) } } - if (relocs != NULL) free (relocs); asect->relocation = reloc_cache; asect->reloc_count = count; - return true; } - static boolean b_out_squirt_out_relocs (abfd, section) bfd *abfd; @@ -955,7 +945,7 @@ b_out_set_section_contents (abfd, section, location, offset, count) if (! aout_32_make_sections (abfd)) return false; - obj_textsec (abfd)->filepos = sizeof(struct internal_exec); + obj_textsec (abfd)->filepos = sizeof (struct internal_exec); obj_datasec(abfd)->filepos = obj_textsec(abfd)->filepos + obj_textsec (abfd)->_raw_size; @@ -1001,14 +991,12 @@ b_out_set_arch_mach (abfd, arch, machine) static int b_out_sizeof_headers (ignore_abfd, ignore) - bfd *ignore_abfd; - boolean ignore; + bfd *ignore_abfd ATTRIBUTE_UNUSED; + boolean ignore ATTRIBUTE_UNUSED; { - return sizeof(struct internal_exec); + return sizeof (struct internal_exec); } - - /************************************************************************/ static bfd_vma get_value (reloc, link_info, input_section) @@ -1046,7 +1034,8 @@ get_value (reloc, link_info, input_section) { if (! ((*link_info->callbacks->undefined_symbol) (link_info, bfd_asymbol_name (symbol), - input_section->owner, input_section, reloc->address))) + input_section->owner, input_section, reloc->address, + true))) abort (); value = 0; } @@ -1123,7 +1112,6 @@ abs32code (abfd, input_section, r, shrink, link_info) gap = value - (dot - shrink); - if (-1<<23 < (long)gap && (long)gap < 1<<23 ) { /* Change the reloc type from 32bitcode possible 24, to 24bit @@ -1423,7 +1411,7 @@ b_out_bfd_get_relocated_section_contents (output_bfd, link_info, link_order, break; default: - abort(); + abort (); } } } @@ -1448,10 +1436,13 @@ b_out_bfd_get_relocated_section_contents (output_bfd, link_info, link_order, #define b_out_bfd_final_link _bfd_generic_final_link #define b_out_bfd_link_split_section _bfd_generic_link_split_section #define b_out_bfd_gc_sections bfd_generic_gc_sections +#define b_out_bfd_merge_sections bfd_generic_merge_sections #define aout_32_get_section_contents_in_window \ _bfd_generic_get_section_contents_in_window +extern const bfd_target b_out_vec_little_host; + const bfd_target b_out_vec_big_host = { "b.out.big", /* name */ @@ -1489,10 +1480,11 @@ const bfd_target b_out_vec_big_host = BFD_JUMP_TABLE_LINK (b_out), BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + & b_out_vec_little_host, + (PTR) 0, }; - const bfd_target b_out_vec_little_host = { "b.out.little", /* name */ @@ -1530,5 +1522,7 @@ const bfd_target b_out_vec_little_host = BFD_JUMP_TABLE_LINK (b_out), BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + & b_out_vec_big_host, + (PTR) 0 };