diff options
author | Ian Lance Taylor <ian@airs.com> | 1994-02-26 18:25:23 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1994-02-26 18:25:23 +0000 |
commit | 68241b2b3f91c517b33a1d234ade7ed834f31f54 (patch) | |
tree | 41b3201d99fe49def28b99f908a7519b74f1deaf | |
parent | 3d51f02f4c683aa29fb45e9083ddddd1a1b9ce97 (diff) | |
download | gdb-68241b2b3f91c517b33a1d234ade7ed834f31f54.zip gdb-68241b2b3f91c517b33a1d234ade7ed834f31f54.tar.gz gdb-68241b2b3f91c517b33a1d234ade7ed834f31f54.tar.bz2 |
* aoutx.h, archive.c: Add casts to avoid warnings from SVR4 cc.
* ecoff.c, ecofflink.c, ecoffswap.h, srec.c: Likewise.
* elf32-i386.c: Likewise.
* elfcode.h (bfd_section_from_shdr): Make i unsigned; remove old
#if 0 code.
(elf_write_phdrs): Make i unsigned.
(map_program_segments): Make i and n_left unsigned.
(assign_file_positions_except_relocs): Make i unsigned.
(write_shdrs_and_ehdr): Make count unsigned.
(assign_file_positions_for_relocs): Make i unsigned.
(NAME(bfd,elf_write_object_contents)): Make count unsigned.
(section_from_elf_index): Make index argument unsigned.
-rw-r--r-- | bfd/ChangeLog | 19 | ||||
-rw-r--r-- | bfd/aoutx.h | 50 | ||||
-rw-r--r-- | bfd/ecoff.c | 9 | ||||
-rw-r--r-- | bfd/ecofflink.c | 24 | ||||
-rw-r--r-- | bfd/elf32-i386.c | 84 | ||||
-rw-r--r-- | bfd/elfcode.h | 41 | ||||
-rw-r--r-- | bfd/srec.c | 2 |
7 files changed, 137 insertions, 92 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 93e7eeb..44b4f50 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,22 @@ +Sat Feb 26 10:00:45 1994 Ian Lance Taylor (ian@cygnus.com) + + * reloc.c (_bfd_relocate_contents): Adjust handling of overflow to + avoid depending upon right shifts of signed numbers, and to + correct handling of src_mask with lower bits zero. + + * aoutx.h, archive.c: Add casts to avoid warnings from SVR4 cc. + * ecoff.c, ecofflink.c, ecoffswap.h, srec.c: Likewise. + * elf32-i386.c: Likewise. + * elfcode.h (bfd_section_from_shdr): Make i unsigned; remove old + #if 0 code. + (elf_write_phdrs): Make i unsigned. + (map_program_segments): Make i and n_left unsigned. + (assign_file_positions_except_relocs): Make i unsigned. + (write_shdrs_and_ehdr): Make count unsigned. + (assign_file_positions_for_relocs): Make i unsigned. + (NAME(bfd,elf_write_object_contents)): Make count unsigned. + (section_from_elf_index): Make index argument unsigned. + Fri Feb 25 21:34:58 1994 Ian Lance Taylor (ian@cygnus.com) * elfcode.h: Don't include assert.h. diff --git a/bfd/aoutx.h b/bfd/aoutx.h index d5698dc..aa49239 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -287,7 +287,7 @@ DEFUN(NAME(aout,swap_exec_header_in),(abfd, raw_bytes, execp), configuration (IE for i960), so ensure that all such uninitialized fields are zero'd out. There are places where two of these structs are memcmp'd, and thus the contents do matter. */ - memset (execp, 0, sizeof (struct internal_exec)); + memset ((PTR) execp, 0, sizeof (struct internal_exec)); /* Now fill in fields in the execp, from the bytes in the raw data. */ execp->a_info = bfd_h_get_32 (abfd, bytes->e_info); execp->a_text = GET_WORD (abfd, bytes->e_text); @@ -364,7 +364,7 @@ DEFUN(NAME(aout,some_aout_object_p),(abfd, execp, callback_to_real_object_p), rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, sizeof (struct aout_data_struct )); if (rawptr == NULL) { - bfd_error = no_memory; + bfd_set_error (bfd_error_no_memory); return 0; } @@ -552,13 +552,13 @@ DEFUN(NAME(aout,mkobject),(abfd), { struct aout_data_struct *rawptr; - bfd_error = system_call_error; + bfd_set_error (bfd_error_system_call); /* Use an intermediate variable for clarity */ rawptr = (struct aout_data_struct *)bfd_zalloc (abfd, sizeof (struct aout_data_struct )); if (rawptr == NULL) { - bfd_error = no_memory; + bfd_set_error (bfd_error_no_memory); return false; } @@ -878,7 +878,7 @@ DEFUN (NAME(aout,adjust_sizes_and_vmas), (abfd, text_size, text_end), if ((obj_textsec (abfd) == NULL) || (obj_datasec (abfd) == NULL)) { - bfd_error = invalid_operation; + bfd_set_error (bfd_error_invalid_operation); return false; } if (adata(abfd).magic != undecided_magic) return true; @@ -1104,7 +1104,7 @@ DEFUN (translate_from_native_sym_flags, (sym_pointer, cache_ptr, abfd), if (!copy || !reloc) { - bfd_error = no_memory; + bfd_set_error (bfd_error_no_memory); return false; } @@ -1136,7 +1136,7 @@ DEFUN (translate_from_native_sym_flags, (sym_pointer, cache_ptr, abfd), cache_ptr->type = N_BSS; break; default: - bfd_error = bad_value; + bfd_set_error (bfd_error_bad_value); return false; } @@ -1338,14 +1338,14 @@ DEFUN(translate_to_native_sym_flags,(sym_pointer, cache_ptr, abfd), else if (bfd_get_output_section(cache_ptr) == NULL) { /* Protect the bfd_is_com_section call. This case occurs, e.g., for the *DEBUG* section of a COFF file. */ - bfd_error = nonrepresentable_section; + bfd_set_error (bfd_error_nonrepresentable_section); return false; } else if (bfd_is_com_section (bfd_get_output_section (cache_ptr))) { sym_pointer->e_type[0] = (N_UNDF | N_EXT); } else { - bfd_error = nonrepresentable_section; + bfd_set_error (bfd_error_nonrepresentable_section); return false; } @@ -1393,7 +1393,7 @@ DEFUN(NAME(aout,make_empty_symbol),(abfd), (aout_symbol_type *)bfd_zalloc (abfd, sizeof (aout_symbol_type)); if (!new) { - bfd_error = no_memory; + bfd_set_error (bfd_error_no_memory); return NULL; } new->symbol.the_bfd = abfd; @@ -1475,7 +1475,7 @@ DEFUN(NAME(aout,slurp_symbol_table),(abfd), symbol_size = exec_hdr(abfd)->a_syms; if (symbol_size == 0) { - bfd_error = no_symbols; + bfd_set_error (bfd_error_no_symbols); return false; } @@ -1505,7 +1505,7 @@ DEFUN(NAME(aout,slurp_symbol_table),(abfd), syms = (struct external_nlist *) malloc(symbol_size); if (!strings || !cached || !syms) { - bfd_error = no_memory; + bfd_set_error (bfd_error_no_memory); return false; } bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET); @@ -1843,7 +1843,7 @@ add_to_stringtab (abfd, str, tab) bfd_alloc_by_size_t (abfd, sizeof (struct stringtab_entry)); if (!entry) { - bfd_error = no_memory; + bfd_set_error (bfd_error_no_memory); abort(); /* FIXME */ } @@ -2336,7 +2336,7 @@ DEFUN(NAME(aout,slurp_reloc_table),(abfd, asect, symbols), reloc_size = exec_hdr(abfd)->a_trsize; else { - bfd_error = invalid_operation; + bfd_set_error (bfd_error_invalid_operation); return false; } @@ -2361,7 +2361,7 @@ DEFUN(NAME(aout,slurp_reloc_table),(abfd, asect, symbols), if (!reloc_cache) { nomem: - bfd_error = no_memory; + bfd_set_error (bfd_error_no_memory); return false; } @@ -2376,7 +2376,7 @@ DEFUN(NAME(aout,slurp_reloc_table),(abfd, asect, symbols), { bfd_release (abfd, relocs); bfd_release (abfd, reloc_cache); - bfd_error = system_call_error; + bfd_set_error (bfd_error_system_call); return false; } @@ -2467,7 +2467,7 @@ DEFUN(NAME(aout,squirt_out_relocs),(abfd, section), natsize = each_size * count; native = (unsigned char *) bfd_zalloc (abfd, natsize); if (!native) { - bfd_error = no_memory; + bfd_set_error (bfd_error_no_memory); return false; } @@ -2540,7 +2540,7 @@ DEFUN(NAME(aout,get_reloc_upper_bound),(abfd, asect), bfd_size_type dynrel_count = 0; if (bfd_get_format (abfd) != bfd_object) { - bfd_error = invalid_operation; + bfd_set_error (bfd_error_invalid_operation); return 0; } if (asect->flags & SEC_CONSTRUCTOR) { @@ -2568,7 +2568,7 @@ DEFUN(NAME(aout,get_reloc_upper_bound),(abfd, asect), ((exec_hdr(abfd)->a_trsize / obj_reloc_entry_size (abfd)) + dynrel_count + 1)); - bfd_error = invalid_operation; + bfd_set_error (bfd_error_invalid_operation); return 0; } @@ -2831,7 +2831,7 @@ aout_link_hash_newfunc (entry, table, string) bfd_hash_allocate (table, sizeof (struct aout_link_hash_entry))); if (ret == (struct aout_link_hash_entry *) NULL) { - bfd_error = no_memory; + bfd_set_error (bfd_error_no_memory); return (struct bfd_hash_entry *) ret; } @@ -2858,7 +2858,7 @@ NAME(aout,link_hash_table_create) (abfd) malloc (sizeof (struct aout_link_hash_table))); if (ret == (struct aout_link_hash_table *) NULL) { - bfd_error = no_memory; + bfd_set_error (bfd_error_no_memory); return (struct bfd_link_hash_table *) NULL; } if (! _bfd_link_hash_table_init (&ret->root, abfd, @@ -2905,7 +2905,7 @@ NAME(aout,link_add_symbols) (abfd, info) return _bfd_generic_link_add_archive_symbols (abfd, info, aout_link_check_archive_element); default: - bfd_error = wrong_format; + bfd_set_error (bfd_error_wrong_format); return false; } } @@ -2992,7 +2992,7 @@ aout_link_get_symbols (abfd) malloc ((size_t) count * EXTERNAL_NLIST_SIZE)); if (syms == (struct external_nlist *) NULL) { - bfd_error = no_memory; + bfd_set_error (bfd_error_no_memory); return false; } @@ -3010,7 +3010,7 @@ aout_link_get_symbols (abfd) strings = (char *) malloc ((size_t) stringsize); if (strings == NULL) { - bfd_error = no_memory; + bfd_set_error (bfd_error_no_memory); return false; } @@ -3200,7 +3200,7 @@ aout_link_add_symbols (abfd, info) * sizeof (struct aout_link_hash_entry *)))); if (!sym_hash) { - bfd_error = no_memory; + bfd_set_error (bfd_error_no_memory); return false; } obj_aout_sym_hashes (abfd) = sym_hash; diff --git a/bfd/ecoff.c b/bfd/ecoff.c index 821e75f..552be69 100644 --- a/bfd/ecoff.c +++ b/bfd/ecoff.c @@ -550,7 +550,8 @@ ecoff_swap_rndx_in (bigend, ext_copy, intern) intern->index = ((ext->r_bits[1] & RNDX_BITS1_INDEX_LITTLE) >> RNDX_BITS1_INDEX_SH_LITTLE) | (ext->r_bits[2] << RNDX_BITS2_INDEX_SH_LEFT_LITTLE) - | (ext->r_bits[3] << RNDX_BITS3_INDEX_SH_LEFT_LITTLE); + | ((unsigned int) ext->r_bits[3] + << RNDX_BITS3_INDEX_SH_LEFT_LITTLE); } #ifdef TEST @@ -820,7 +821,7 @@ ecoff_make_empty_symbol (abfd) bfd_set_error (bfd_error_no_memory); return (asymbol *) NULL; } - memset (new, 0, sizeof *new); + memset ((PTR) new, 0, sizeof *new); new->symbol.section = (asection *) NULL; new->fdr = (FDR *) NULL; new->local = false; @@ -2759,7 +2760,7 @@ ecoff_write_object_contents (abfd) asymbol *sym; struct internal_reloc in; - memset (&in, 0, sizeof in); + memset ((PTR) &in, 0, sizeof in); reloc = *reloc_ptr_ptr; sym = *reloc->sym_ptr_ptr; @@ -3355,7 +3356,7 @@ ecoff_link_hash_newfunc (entry, table, string) ret->indx = -1; ret->abfd = NULL; } - memset (&ret->esym, 0, sizeof ret->esym); + memset ((PTR) &ret->esym, 0, sizeof ret->esym); return (struct bfd_hash_entry *) ret; } diff --git a/bfd/ecofflink.c b/bfd/ecofflink.c index 596f169..a4507ea 100644 --- a/bfd/ecofflink.c +++ b/bfd/ecofflink.c @@ -932,7 +932,7 @@ bfd_ecoff_debug_accumulate_other (handle, output_bfd, output_debug, asymbol **sym_end; PTR external_fdr; - memset (&fdr, 0, sizeof fdr); + memset ((PTR) &fdr, 0, sizeof fdr); sec = bfd_get_section_by_name (input_bfd, ".text"); if (sec != NULL) @@ -971,7 +971,7 @@ bfd_ecoff_debug_accumulate_other (handle, output_bfd, output_debug, if (((*sym_ptr)->flags & BSF_EXPORT) != 0) continue; - memset (&internal_sym, 0, sizeof internal_sym); + memset ((PTR) &internal_sym, 0, sizeof internal_sym); internal_sym.iss = ecoff_add_string (ainfo, info, output_debug, &fdr, (*sym_ptr)->name); @@ -1168,7 +1168,7 @@ ecoff_align_debug (abfd, debug, swap) if (add != debug_align) { if (debug->line != (unsigned char *) NULL) - memset (debug->line + symhdr->cbLine, 0, add); + memset ((PTR) (debug->line + symhdr->cbLine), 0, add); symhdr->cbLine += add; } @@ -1176,7 +1176,7 @@ ecoff_align_debug (abfd, debug, swap) if (add != debug_align) { if (debug->ss != (char *) NULL) - memset (debug->ss + symhdr->issMax, 0, add); + memset ((PTR) (debug->ss + symhdr->issMax), 0, add); symhdr->issMax += add; } @@ -1184,7 +1184,7 @@ ecoff_align_debug (abfd, debug, swap) if (add != debug_align) { if (debug->ssext != (char *) NULL) - memset (debug->ssext + symhdr->issExtMax, 0, add); + memset ((PTR) (debug->ssext + symhdr->issExtMax), 0, add); symhdr->issExtMax += add; } @@ -1192,7 +1192,7 @@ ecoff_align_debug (abfd, debug, swap) if (add != aux_align) { if (debug->external_aux != (union aux_ext *) NULL) - memset (debug->external_aux + symhdr->iauxMax, 0, + memset ((PTR) (debug->external_aux + symhdr->iauxMax), 0, add * sizeof (union aux_ext)); symhdr->iauxMax += add; } @@ -1201,8 +1201,8 @@ ecoff_align_debug (abfd, debug, swap) if (add != rfd_align) { if (debug->external_rfd != (PTR) NULL) - memset (((char *) debug->external_rfd - + symhdr->crfd * swap->external_rfd_size), + memset ((PTR) ((char *) debug->external_rfd + + symhdr->crfd * swap->external_rfd_size), 0, add * swap->external_rfd_size); symhdr->crfd += add; } @@ -1263,6 +1263,8 @@ ecoff_write_symhdr (abfd, debug, swap, where) where += swap->external_hdr_size; + symhdr->magic = swap->sym_magic; + /* Fill in the file offsets. */ #define SET(offset, count, size) \ if (symhdr->count == 0) \ @@ -1376,7 +1378,7 @@ ecoff_write_shuffle (abfd, swap, shuffle, space) i = swap->debug_align - (total & (swap->debug_align - 1)); s = (bfd_byte *) alloca (i); - memset (s, 0, i); + memset ((PTR) s, 0, i); if (bfd_write ((PTR) s, 1, i, abfd) != i) return false; } @@ -1450,7 +1452,7 @@ bfd_ecoff_write_accumulated_debug (handle, abfd, debug, swap, info, where) i = swap->debug_align - (total & (swap->debug_align - 1)); s = (bfd_byte *) alloca (i); - memset (s, 0, i); + memset ((PTR) s, 0, i); if (bfd_write ((PTR) s, 1, i, abfd) != i) return false; } @@ -1469,7 +1471,7 @@ bfd_ecoff_write_accumulated_debug (handle, abfd, debug, swap, info, where) i = (swap->debug_align - (debug->symbolic_header.issExtMax & (swap->debug_align - 1))); s = (bfd_byte *) alloca (i); - memset (s, 0, i); + memset ((PTR) s, 0, i); if (bfd_write ((PTR) s, 1, i, abfd) != i) return false; } diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 9ead8bf..f5a1e48 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -17,10 +17,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., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* - * This file contains changes from the Open Software Foundation. - */ - #include "bfd.h" #include "sysdep.h" #include "libbfd.h" @@ -31,12 +27,16 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ enum reloc_type { R_386_NONE = 0, - R_386_32, R_386_PC32, - R_386_GOT32, R_386_PLT32, + R_386_32, + R_386_PC32, + R_386_GOT32, + R_386_PLT32, R_386_COPY, - R_386_GLOB_DAT, R_386_JUMP_SLOT, + R_386_GLOB_DAT, + R_386_JUMP_SLOT, R_386_RELATIVE, - R_386_GOTOFF, R_386_GOTPC, + R_386_GOTOFF, + R_386_GOTPC, R_386_max }; @@ -44,22 +44,32 @@ enum reloc_type static CONST char *CONST reloc_type_names[] = { "R_386_NONE", - "R_386_32", "R_386_PC32", - "R_386_GOT32", "R_386_PLT32", + "R_386_32", + "R_386_PC32", + "R_386_GOT32", + "R_386_PLT32", "R_386_COPY", - "R_386_GLOB_DAT", "R_386_JUMP_SLOT", + "R_386_GLOB_DAT", + "R_386_JUMP_SLOT", "R_386_RELATIVE", - "R_386_GOTOFF", "R_386_GOTPC", + "R_386_GOTOFF", + "R_386_GOTPC", }; #endif - static reloc_howto_type elf_howto_table[]= { - HOWTO(R_386_NONE, 0,0, 0,false,0, complain_overflow_dont, 0,"R_386_NONE", false,0x00000000,0x00000000,false), - HOWTO(R_386_32, 0,2,32,false,0, complain_overflow_bitfield, 0,"R_386_32", false,0xffffffff,0xffffffff,false), - HOWTO(R_386_PC32, 0,2,32,true, 0, complain_overflow_signed, 0,"R_386_PC32", false,0xffffffff,0xffffffff,false), - HOWTO(R_386_GOT32, 0,2,32,false,0, complain_overflow_bitfield, 0,"R_386_GOT32",false,0xffffffff,0xffffffff,false) + HOWTO(R_386_NONE, 0,0, 0,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_NONE", true,0x00000000,0x00000000,false), + HOWTO(R_386_32, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_32", true,0xffffffff,0xffffffff,false), + HOWTO(R_386_PC32, 0,2,32,true, 0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_PC32", true,0xffffffff,0xffffffff,true), + HOWTO(R_386_GOT32, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_GOT32", true,0xffffffff,0xffffffff,false), + HOWTO(R_386_PLT32, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_PLT32", true,0xffffffff,0xffffffff,false), + HOWTO(R_386_COPY, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_COPY", true,0xffffffff,0xffffffff,false), + HOWTO(R_386_GLOB_DAT, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_GLOB_DAT", true,0xffffffff,0xffffffff,false), + HOWTO(R_386_JUMP_SLOT, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_JUMP_SLOT",true,0xffffffff,0xffffffff,false), + HOWTO(R_386_RELATIVE, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_RELATIVE", true,0xffffffff,0xffffffff,false), + HOWTO(R_386_GOTOFF, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_GOTOFF", true,0xffffffff,0xffffffff,false), + HOWTO(R_386_GOTPC, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_GOTPC", true,0xffffffff,0xffffffff,false), }; #ifdef DEBUG_GEN_RELOC @@ -87,8 +97,40 @@ DEFUN (elf_i386_reloc_type_lookup, (abfd, code), TRACE ("BFD_RELOC_PC32"); return &elf_howto_table[ (int)R_386_PC32 ]; + case BFD_RELOC_386_GOT32: + TRACE ("BFD_RELOC_386_GOT32"); + return &elf_howto_table[ (int)R_386_GOT32 ]; + + case BFD_RELOC_386_PLT32: + TRACE ("BFD_RELOC_386_PLT32"); + return &elf_howto_table[ (int)R_386_PLT32 ]; + + case BFD_RELOC_386_COPY: + TRACE ("BFD_RELOC_386_COPY"); + return &elf_howto_table[ (int)R_386_COPY ]; + + case BFD_RELOC_386_GLOB_DAT: + TRACE ("BFD_RELOC_386_GLOB_DAT"); + return &elf_howto_table[ (int)R_386_GLOB_DAT ]; + + case BFD_RELOC_386_JUMP_SLOT: + TRACE ("BFD_RELOC_386_JUMP_SLOT"); + return &elf_howto_table[ (int)R_386_JUMP_SLOT ]; + + case BFD_RELOC_386_RELATIVE: + TRACE ("BFD_RELOC_386_RELATIVE"); + return &elf_howto_table[ (int)R_386_RELATIVE ]; + + case BFD_RELOC_386_GOTOFF: + TRACE ("BFD_RELOC_386_GOTOFF"); + return &elf_howto_table[ (int)R_386_GOTOFF ]; + + case BFD_RELOC_386_GOTPC: + TRACE ("BFD_RELOC_386_GOTPC"); + return &elf_howto_table[ (int)R_386_GOTPC ]; + default: - abort (); + break; } TRACE ("Unknown"); @@ -101,7 +143,7 @@ DEFUN(elf_i386_info_to_howto, (abfd, cache_ptr, dst), arelent *cache_ptr AND Elf32_Internal_Rela *dst) { - BFD_ASSERT (ELF32_R_TYPE(dst->r_info) < R_386_GOT32); + BFD_ASSERT (ELF32_R_TYPE(dst->r_info) < (unsigned int) R_386_max); cache_ptr->howto = &elf_howto_table[ELF32_R_TYPE(dst->r_info)]; } @@ -112,7 +154,7 @@ DEFUN(elf_i386_info_to_howto_rel, (abfd, cache_ptr, dst), arelent *cache_ptr AND Elf32_Internal_Rel *dst) { - BFD_ASSERT (ELF32_R_TYPE(dst->r_info) < R_386_GOT32); + BFD_ASSERT (ELF32_R_TYPE(dst->r_info) < (unsigned int) R_386_max); cache_ptr->howto = &elf_howto_table[ELF32_R_TYPE(dst->r_info)]; } @@ -120,8 +162,10 @@ DEFUN(elf_i386_info_to_howto_rel, (abfd, cache_ptr, dst), #define TARGET_LITTLE_SYM bfd_elf32_i386_vec #define TARGET_LITTLE_NAME "elf32-i386" #define ELF_ARCH bfd_arch_i386 +#define ELF_MACHINE_CODE EM_386 #define elf_info_to_howto elf_i386_info_to_howto #define elf_info_to_howto_rel elf_i386_info_to_howto_rel #define bfd_elf32_bfd_reloc_type_lookup elf_i386_reloc_type_lookup +#define ELF_MAXPAGESIZE 0x1000 #include "elf32-target.h" diff --git a/bfd/elfcode.h b/bfd/elfcode.h index d01a2d6..cb4f451 100644 --- a/bfd/elfcode.h +++ b/bfd/elfcode.h @@ -118,7 +118,7 @@ struct elf_sect_data { /* Forward declarations of static functions */ -static struct sec * section_from_elf_index PARAMS ((bfd *, int)); +static struct sec * section_from_elf_index PARAMS ((bfd *, unsigned int)); static int elf_section_from_bfd_section PARAMS ((bfd *, struct sec *)); @@ -556,7 +556,7 @@ DEFUN (bfd_section_from_shdr, (abfd, shindex), return true; } { - int i; + unsigned int i; for (i = 1; i < ehdr->e_shnum; i++) { @@ -841,7 +841,7 @@ DEFUN (elf_object_p, (abfd), bfd * abfd) Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form */ Elf_External_Shdr x_shdr; /* Section header table entry, external form */ Elf_Internal_Shdr *i_shdrp; /* Section header table, internal form */ - int shindex; + unsigned int shindex; char *shstrtab; /* Internal copy of section header stringtab */ struct elf_backend_data *ebd; struct elf_obj_tdata *preserved_tdata = elf_tdata (abfd); @@ -981,27 +981,6 @@ DEFUN (elf_object_p, (abfd), bfd * abfd) bfd_section_from_shdr (abfd, i_ehdrp->e_shstrndx); } -#if 0 - for (shindex = i_ehdrp->e_shnum - 1; shindex >= 0; shindex--) - { - if (!strcmp (elf_string_from_elf_strtab (abfd, - i_shdrp[shindex].sh_name), - ".strtab")) - { - elf_tdata(abfd)->strtab_hdr = i_shdrp[shindex]; - elf_elfsections(abfd)[shindex] = &elf_tdata(abfd)->strtab_hdr; - } - else if (!strcmp (elf_string_from_elf_strtab (abfd, - i_shdrp[shindex].sh_name), - ".symtab")) - { - elf_tdata(abfd)->symtab_hdr = i_shdrp[shindex]; - elf_elfsections(abfd)[shindex] = &elf_tdata(abfd)->symtab_hdr; - elf_onesymtab (abfd) = shindex; - } - } -#endif - /* Read in the string table containing the names of the sections. We will need the base pointer to this table later. */ /* We read this inline now, so that we don't have to go through @@ -1548,7 +1527,7 @@ DEFUN (elf_write_phdrs, (abfd, i_ehdrp, i_phdrp, phdr_cnt), { /* first program header entry goes after the file header */ int outbase = i_ehdrp->e_phoff; - int i; + unsigned int i; Elf_External_Phdr x_phdr; for (i = 0; i < phdr_cnt; i++) @@ -1697,7 +1676,7 @@ map_program_segments (abfd) Elf_Internal_Shdr *i_shdrp; Elf_Internal_Phdr *phdr; char *done; - int i, n_left = 0; + unsigned int i, n_left = 0; file_ptr lowest_offset = 0; struct seg_info *seg = NULL; @@ -1885,7 +1864,7 @@ assign_file_positions_except_relocs (abfd) struct elf_obj_tdata *t = elf_tdata (abfd); file_ptr off; - int i; + unsigned int i; Elf_Internal_Shdr **i_shdrpp = elf_elfsections (abfd); Elf_Internal_Shdr *i_shdrp; Elf_Internal_Ehdr *i_ehdrp = elf_elfheader (abfd); @@ -2284,7 +2263,7 @@ write_shdrs_and_ehdr (abfd) Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form */ Elf_External_Shdr *x_shdrp; /* Section header table, external form */ Elf_Internal_Shdr **i_shdrp; /* Section header table, internal form */ - int count; + unsigned int count; struct strtab *shstrtab; i_ehdrp = elf_elfheader (abfd); @@ -2329,7 +2308,7 @@ assign_file_positions_for_relocs (abfd) bfd *abfd; { file_ptr off = elf_tdata(abfd)->next_file_pos; - int i; + unsigned int i; Elf_Internal_Shdr **shdrpp = elf_elfsections (abfd); Elf_Internal_Shdr *shdrp; for (i = 1; i < elf_elfheader(abfd)->e_shnum; i++) @@ -2349,7 +2328,7 @@ DEFUN (NAME(bfd_elf,write_object_contents), (abfd), bfd * abfd) struct elf_backend_data *bed = get_elf_backend_data (abfd); Elf_Internal_Ehdr *i_ehdrp; Elf_Internal_Shdr **i_shdrp; - int count; + unsigned int count; /* We don't know how to write dynamic objects. Specifically, we don't know how to construct the program header. */ @@ -2406,7 +2385,7 @@ DEFUN (NAME(bfd_elf,write_object_contents), (abfd), bfd * abfd) static struct sec * DEFUN (section_from_elf_index, (abfd, index), bfd * abfd AND - int index) + unsigned int index) { /* @@ Is bfd_com_section really correct in all the places it could be returned from this routine? */ @@ -586,7 +586,7 @@ DEFUN (srec_set_section_contents, (abfd, section, location, offset, bytes_to_do) bfd_set_error (bfd_error_no_memory); return false; } - memcpy (data, location, bytes_to_do); + memcpy ((PTR) data, location, bytes_to_do); if ((section->lma + offset + bytes_to_do) <= 0xffff) { |