diff options
Diffstat (limited to 'contrib/binutils/bfd/aoutx.h')
-rw-r--r-- | contrib/binutils/bfd/aoutx.h | 153 |
1 files changed, 101 insertions, 52 deletions
diff --git a/contrib/binutils/bfd/aoutx.h b/contrib/binutils/bfd/aoutx.h index ff1cdd2..fa107a7 100644 --- a/contrib/binutils/bfd/aoutx.h +++ b/contrib/binutils/bfd/aoutx.h @@ -1,5 +1,5 @@ /* BFD semi-generic back-end for a.out binaries. - Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998 + Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc. Written by Cygnus Support. @@ -120,10 +120,9 @@ DESCRIPTION #define KEEPIT udata.i -#include <string.h> /* For strchr and friends */ #include <ctype.h> #include "bfd.h" -#include <sysdep.h> +#include "sysdep.h" #include "bfdlink.h" #include "libaout.h" @@ -199,7 +198,7 @@ reloc_howto_type howto_table_ext[] = HOWTO(RELOC_SFA_BASE,0, 2, 32, false, 0, complain_overflow_bitfield,0,"SFA_BASE", false, 0,0xffffffff, false), HOWTO(RELOC_SFA_OFF13,0,2, 32, false, 0, complain_overflow_bitfield,0,"SFA_OFF13",false, 0,0xffffffff, false), HOWTO(RELOC_BASE10, 0, 2, 10, false, 0, complain_overflow_dont,0,"BASE10", false, 0,0x000003ff, false), - HOWTO(RELOC_BASE13, 0, 2, 13, false, 0, complain_overflow_bitfield,0,"BASE13", false, 0,0x00001fff, false), + HOWTO(RELOC_BASE13, 0, 2, 13, false, 0, complain_overflow_signed,0,"BASE13", false, 0,0x00001fff, false), HOWTO(RELOC_BASE22, 10, 2, 22, false, 0, complain_overflow_bitfield,0,"BASE22", false, 0,0x003fffff, false), HOWTO(RELOC_PC10, 0, 2, 10, true, 0, complain_overflow_dont,0,"PC10", false, 0,0x000003ff, true), HOWTO(RELOC_PC22, 10, 2, 22, true, 0, complain_overflow_signed,0,"PC22", false, 0,0x003fffff, true), @@ -208,6 +207,10 @@ reloc_howto_type howto_table_ext[] = HOWTO(RELOC_GLOB_DAT,0, 2, 0, false, 0, complain_overflow_bitfield,0,"GLOB_DAT", false, 0,0x00000000, false), HOWTO(RELOC_JMP_SLOT,0, 2, 0, false, 0, complain_overflow_bitfield,0,"JMP_SLOT", false, 0,0x00000000, false), HOWTO(RELOC_RELATIVE,0, 2, 0, false, 0, complain_overflow_bitfield,0,"RELATIVE", false, 0,0x00000000, false), + HOWTO(0, 0, 0, 0, false, 0, complain_overflow_dont, 0, "R_SPARC_NONE", false,0,0x00000000,true), + HOWTO(0, 0, 0, 0, false, 0, complain_overflow_dont, 0, "R_SPARC_NONE", false,0,0x00000000,true), +#define RELOC_SPARC_REV32 RELOC_WDISP19 + HOWTO(RELOC_SPARC_REV32, 0, 2, 32, false, 0, complain_overflow_dont,0,"R_SPARC_REV32", false, 0,0xffffffff, false), }; /* Convert standard reloc records to "arelent" format (incl byte swap). */ @@ -225,28 +228,35 @@ HOWTO( 7, 0, 4, 64, true, 0, complain_overflow_signed, 0,"DISP64", tr HOWTO( 8, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"GOT_REL", false, 0,0x00000000, false), HOWTO( 9, 0, 1, 16, false, 0, complain_overflow_bitfield,0,"BASE16", false,0xffffffff,0xffffffff, false), HOWTO(10, 0, 2, 32, false, 0, complain_overflow_bitfield,0,"BASE32", false,0xffffffff,0xffffffff, false), -{ -1 }, -{ -1 }, -{ -1 }, -{ -1 }, -{ -1 }, +EMPTY_HOWTO (-1), +EMPTY_HOWTO (-1), +EMPTY_HOWTO (-1), +EMPTY_HOWTO (-1), +EMPTY_HOWTO (-1), HOWTO(16, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"JMP_TABLE", false, 0,0x00000000, false), -{ -1 }, -{ -1 }, -{ -1 }, -{ -1 }, -{ -1 }, -{ -1 }, -{ -1 }, -{ -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, +EMPTY_HOWTO (-1), +EMPTY_HOWTO (-1), +EMPTY_HOWTO (-1), +EMPTY_HOWTO (-1), +EMPTY_HOWTO (-1), +EMPTY_HOWTO (-1), +EMPTY_HOWTO (-1), +EMPTY_HOWTO (-1), +EMPTY_HOWTO (-1), +EMPTY_HOWTO (-1), +EMPTY_HOWTO (-1), +EMPTY_HOWTO (-1), +EMPTY_HOWTO (-1), +EMPTY_HOWTO (-1), +EMPTY_HOWTO (-1), HOWTO(32, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"RELATIVE", false, 0,0x00000000, false), -{ -1 }, -{ -1 }, -{ -1 }, -{ -1 }, -{ -1 }, -{ -1 }, -{ -1 }, +EMPTY_HOWTO (-1), +EMPTY_HOWTO (-1), +EMPTY_HOWTO (-1), +EMPTY_HOWTO (-1), +EMPTY_HOWTO (-1), +EMPTY_HOWTO (-1), +EMPTY_HOWTO (-1), HOWTO(40, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"BASEREL", false, 0,0x00000000, false), }; @@ -286,6 +296,7 @@ NAME(aout,reloc_type_lookup) (abfd,code) EXT (BFD_RELOC_SPARC_PC10, 17); EXT (BFD_RELOC_SPARC_PC22, 18); EXT (BFD_RELOC_SPARC_WPLT30, 19); + EXT (BFD_RELOC_SPARC_REV32, 26); default: return (reloc_howto_type *) NULL; } else @@ -708,6 +719,7 @@ NAME(aout,machine_type) (arch, machine, unknown) if (machine == 0 || machine == bfd_mach_sparc || machine == bfd_mach_sparc_sparclite + || machine == bfd_mach_sparc_sparclite_le || machine == bfd_mach_sparc_v9) arch_flags = M_SPARC; else if (machine == bfd_mach_sparc_sparclet) @@ -739,14 +751,29 @@ NAME(aout,machine_type) (arch, machine, unknown) case bfd_arch_mips: switch (machine) { case 0: - case 2000: - case 3000: arch_flags = M_MIPS1; break; - case 4000: /* mips3 */ - case 4400: - case 8000: /* mips4 */ - /* real mips2: */ - case 6000: arch_flags = M_MIPS2; break; - default: arch_flags = M_UNKNOWN; break; + case bfd_mach_mips3000: + case bfd_mach_mips3900: + arch_flags = M_MIPS1; + break; + case bfd_mach_mips6000: + arch_flags = M_MIPS2; + break; + case bfd_mach_mips4000: + case bfd_mach_mips4010: + case bfd_mach_mips4100: + case bfd_mach_mips4300: + case bfd_mach_mips4400: + case bfd_mach_mips4600: + case bfd_mach_mips4650: + case bfd_mach_mips8000: + case bfd_mach_mips10000: + case bfd_mach_mips16: + /* FIXME: These should be MIPS3 or MIPS4. */ + arch_flags = M_MIPS2; + break; + default: + arch_flags = M_UNKNOWN; + break; } break; @@ -1052,7 +1079,7 @@ boolean NAME(aout,adjust_sizes_and_vmas) (abfd, text_size, text_end) bfd *abfd; bfd_size_type *text_size; - file_ptr *text_end; + file_ptr *text_end ATTRIBUTE_UNUSED; { struct internal_exec *execp = exec_hdr (abfd); @@ -1214,7 +1241,7 @@ NAME(aout,set_section_contents) (abfd, section, location, offset, count) && section != obj_datasec (abfd)) { (*_bfd_error_handler) - ("%s: can not represent section `%s' in a.out object file format", + (_("%s: can not represent section `%s' in a.out object file format"), bfd_get_filename (abfd), bfd_get_section_name (abfd, section)); bfd_set_error (bfd_error_nonrepresentable_section); return false; @@ -1598,9 +1625,9 @@ translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer) /* This case occurs, e.g., for the *DEBUG* section of a COFF file. */ (*_bfd_error_handler) - ("%s: can not represent section for symbol `%s' in a.out object file format", + (_("%s: can not represent section for symbol `%s' in a.out object file format"), bfd_get_filename (abfd), - cache_ptr->name != NULL ? cache_ptr->name : "*unknown*"); + cache_ptr->name != NULL ? cache_ptr->name : _("*unknown*")); bfd_set_error (bfd_error_nonrepresentable_section); return false; } @@ -1628,7 +1655,7 @@ translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer) else { (*_bfd_error_handler) - ("%s: can not represent section `%s' in a.out object file format", + (_("%s: can not represent section `%s' in a.out object file format"), bfd_get_filename (abfd), bfd_get_section_name (abfd, sec)); bfd_set_error (bfd_error_nonrepresentable_section); return false; @@ -2511,16 +2538,16 @@ NAME(aout,get_symtab_upper_bound) (abfd) /*ARGSUSED*/ alent * NAME(aout,get_lineno) (ignore_abfd, ignore_symbol) - bfd *ignore_abfd; - asymbol *ignore_symbol; + bfd *ignore_abfd ATTRIBUTE_UNUSED; + asymbol *ignore_symbol ATTRIBUTE_UNUSED; { -return (alent *)NULL; + return (alent *)NULL; } /*ARGSUSED*/ void NAME(aout,get_symbol_info) (ignore_abfd, symbol, ret) - bfd *ignore_abfd; + bfd *ignore_abfd ATTRIBUTE_UNUSED; asymbol *symbol; symbol_info *ret; { @@ -2548,7 +2575,7 @@ NAME(aout,get_symbol_info) (ignore_abfd, symbol, ret) /*ARGSUSED*/ void NAME(aout,print_symbol) (ignore_abfd, afile, symbol, how) - bfd *ignore_abfd; + bfd *ignore_abfd ATTRIBUTE_UNUSED; PTR afile; asymbol *symbol; bfd_print_symbol_type how; @@ -2679,6 +2706,7 @@ NAME(aout,find_nearest_line) CONST char *main_file_name = NULL; CONST char *current_file_name = NULL; CONST char *line_file_name = NULL; /* Value of current_file_name at line number. */ + CONST char *line_directory_name = NULL; /* Value of directory_name at line number. */ bfd_vma low_line_vma = 0; bfd_vma low_func_vma = 0; asymbol *func = 0; @@ -2767,6 +2795,7 @@ NAME(aout,find_nearest_line) *line_ptr = q->desc; low_line_vma = q->symbol.value; line_file_name = current_file_name; + line_directory_name = directory_name; } break; case N_FUN: @@ -2787,7 +2816,10 @@ NAME(aout,find_nearest_line) done: if (*line_ptr != 0) - main_file_name = line_file_name; + { + main_file_name = line_file_name; + directory_name = line_directory_name; + } if (main_file_name == NULL || main_file_name[0] == '/' @@ -2853,7 +2885,7 @@ NAME(aout,find_nearest_line) int NAME(aout,sizeof_headers) (abfd, execable) bfd *abfd; - boolean execable; + boolean execable ATTRIBUTE_UNUSED; { return adata(abfd).exec_bytes_size; } @@ -3639,7 +3671,7 @@ NAME(aout,final_link) (abfd, info, callback) work out the number of relocs needed, and then multiply by the reloc size. */ (*_bfd_error_handler) - ("%s: relocateable link from %s to %s not supported", + (_("%s: relocateable link from %s to %s not supported"), bfd_get_filename (abfd), sub->xvec->name, abfd->xvec->name); bfd_set_error (bfd_error_invalid_operation); @@ -4694,6 +4726,8 @@ aout_reloc_index_to_section (abfd, indx) default: abort (); } + /*NOTREACHED*/ + return NULL; } /* Relocate an a.out section using standard a.out relocs. */ @@ -4937,6 +4971,7 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs, /* We are generating an executable, and must do a full relocation. */ hundef = false; + if (r_extern) { h = sym_hashes[r_index]; @@ -4994,7 +5029,8 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs, else name = strings + GET_WORD (input_bfd, syms[r_index].e_strx); if (! ((*finfo->info->callbacks->undefined_symbol) - (finfo->info, name, input_bfd, input_section, r_addr))) + (finfo->info, name, input_bfd, input_section, + r_addr, true))) return false; } @@ -5279,6 +5315,7 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, /* We are generating an executable, and must do a full relocation. */ hundef = false; + if (r_extern) { h = sym_hashes[r_index]; @@ -5395,14 +5432,26 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, else name = strings + GET_WORD (input_bfd, syms[r_index].e_strx); if (! ((*finfo->info->callbacks->undefined_symbol) - (finfo->info, name, input_bfd, input_section, r_addr))) + (finfo->info, name, input_bfd, input_section, + r_addr, true))) return false; } - r = MY_final_link_relocate (howto_table_ext + r_type, - input_bfd, input_section, - contents, r_addr, relocation, - r_addend); + if (r_type != RELOC_SPARC_REV32) + r = MY_final_link_relocate (howto_table_ext + r_type, + input_bfd, input_section, + contents, r_addr, relocation, + r_addend); + else + { + bfd_vma x; + + x = bfd_get_32 (input_bfd, contents + r_addr); + x = x + relocation + r_addend; + bfd_putl32 (/*input_bfd,*/ x, contents + r_addr); + r = bfd_reloc_ok; + } + if (r != bfd_reloc_ok) { switch (r) @@ -5455,7 +5504,7 @@ aout_link_reloc_link_order (finfo, o, p) int r_index; int r_extern; reloc_howto_type *howto; - file_ptr *reloff_ptr; + file_ptr *reloff_ptr = NULL; struct reloc_std_external srel; struct reloc_ext_external erel; PTR rel_ptr; |