diff -uprN binutils-2.11.90.0.31/ChangeLog binutils-2.11.92.0.5/ChangeLog --- binutils-2.11.90.0.31/ChangeLog Wed Aug 22 08:52:09 2001 +++ binutils-2.11.92.0.5/ChangeLog Thu Oct 4 14:35:42 2001 @@ -1,3 +1,53 @@ +2001-10-03 Alan Modra + + * gettext.m4: Test po/POTFILES.in exists before trying to read. + +2001-09-29 Alexandre Oliva + + * Makefile.in (configure-target-gperf): Depend on $(ALL_GCC_CXX). + +2001-09-28 Hans-Peter Nilsson + + * config.sub, config.guess: Import latest from subversions. + +2001-09-21 Alexandre Oliva + + * Makefile.in (AS_FOR_TARGET, LD_FOR_TARGET, + DLLTOOL_FOR_TARGET, WINDRES_FOR_TARGET, AR_FOR_TARGET, + RANLIB_FOR_TARGET, NM_FOR_TARGET): Don't use double quotes to + avoid quotes nesting problems. + (NATIVE_CHECK_MODULES): Ditto, just for consistency. + (DO_X): Export only variables that are set. + +2001-09-19 Ben Elliston + + * configure.in (sparc-sun-solaris2*): Don't use /usr/bin/which on + Solaris when testing for the /usr/ucb/cc compiler; it has incorrect + semantics. Use the shell built-in "type" command instead. + +2001-09-15 Thiemo Seufer + + * config.sub: Reverted the earlier change, this version is not the + master file. + +2001-09-14 Thiemo Seufer + + * config.sub: Change machine triplets from mipsel*-* to mips*el-*. + Add support for mips64. + +2001-09-03 Jeff Holcomb + + * configure.in: Enable libstdc++-v3 for h8300 targets. + +2001-08-30 Eric Christopher + Jason Eckhardt + + * config.sub: Add support for mipsisa32. + +2001-08-30 Eric Christopher + + * config.sub, config.guess: Import latest from subversions. + 2001-08-20 Alan Modra * config.sub, config.guess: Import latest from subversions. @@ -50,7 +100,7 @@ Fri Jun 8 11:14:02 2001 Andrew Cagney 2001-05-24 Tom Rix * configure.in : enable ld for aix - + 2001-05-22 Alexandre Oliva * ltcf-cxx.sh (allow_undefined_flag, no_undefined_flag) diff -uprN binutils-2.11.90.0.31/ChangeLog.linux binutils-2.11.92.0.5/ChangeLog.linux --- binutils-2.11.90.0.31/ChangeLog.linux Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/ChangeLog.linux Fri Oct 5 14:11:21 2001 @@ -1,3 +1,8 @@ +2001-10-05 H.J. Lu + + * binutils.spec.in: Don't apply binutils-mips64.patch nor + gas-mips.patch, and apply gas-mips-kernel.patch for mips. + 2001-08-02 H.J. Lu * binutils.spec.in: Remove gas-mips-dwarf2.patch. diff -uprN binutils-2.11.90.0.31/Makefile.in binutils-2.11.92.0.5/Makefile.in --- binutils-2.11.90.0.31/Makefile.in Tue Jun 19 11:57:32 2001 +++ binutils-2.11.92.0.5/Makefile.in Mon Oct 1 15:25:20 2001 @@ -234,7 +234,7 @@ AS_FOR_TARGET = ` \ elif [ -f $$r/gcc/xgcc ]; then \ $(CC_FOR_TARGET) -print-prog-name=as ; \ else \ - if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \ + if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \ echo $(AS); \ else \ t='$(program_transform_name)'; echo as | sed -e 's/x/x/' $$t ; \ @@ -247,7 +247,7 @@ LD_FOR_TARGET = ` \ elif [ -f $$r/gcc/xgcc ]; then \ $(CC_FOR_TARGET) -print-prog-name=ld ; \ else \ - if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \ + if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \ echo $(LD); \ else \ t='$(program_transform_name)'; echo ld | sed -e 's/x/x/' $$t ; \ @@ -258,7 +258,7 @@ DLLTOOL_FOR_TARGET = ` \ if [ -f $$r/binutils/dlltool ] ; then \ echo $$r/binutils/dlltool ; \ else \ - if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \ + if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \ echo $(DLLTOOL); \ else \ t='$(program_transform_name)'; echo dlltool | sed -e 's/x/x/' $$t ; \ @@ -269,7 +269,7 @@ WINDRES_FOR_TARGET = ` \ if [ -f $$r/binutils/windres ] ; then \ echo $$r/binutils/windres ; \ else \ - if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \ + if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \ echo $(WINDRES); \ else \ t='$(program_transform_name)'; echo windres | sed -e 's/x/x/' $$t ; \ @@ -280,7 +280,7 @@ AR_FOR_TARGET = ` \ if [ -f $$r/binutils/ar ] ; then \ echo $$r/binutils/ar ; \ else \ - if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \ + if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \ echo $(AR); \ else \ t='$(program_transform_name)'; echo ar | sed -e 's/x/x/' $$t ; \ @@ -291,8 +291,12 @@ RANLIB_FOR_TARGET = ` \ if [ -f $$r/binutils/ranlib ] ; then \ echo $$r/binutils/ranlib ; \ else \ - if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \ - echo $(RANLIB); \ + if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \ + if [ x'$(RANLIB)' != x ]; then \ + echo $(RANLIB); \ + else \ + echo ranlib; \ + fi; \ else \ t='$(program_transform_name)'; echo ranlib | sed -e 's/x/x/' $$t ; \ fi; \ @@ -304,7 +308,7 @@ NM_FOR_TARGET = ` \ elif [ -f $$r/gcc/xgcc ]; then \ $(CC_FOR_TARGET) -print-prog-name=nm ; \ else \ - if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \ + if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \ echo $(NM); \ else \ t='$(program_transform_name)'; echo nm | sed -e 's/x/x/' $$t ; \ @@ -979,16 +983,15 @@ $(DO_X): case $$i in \ gcc) \ for flag in $(EXTRA_GCC_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'|"`; \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ done; \ ;; \ *) \ for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'|"`; \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ done; \ ;; \ esac ; \ - export AR AS CC CXX LD NM RANLIB DLLTOOL WINDRES; \ if (cd ./$$i; \ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ @@ -1005,9 +1008,8 @@ $(DO_X): for i in $(TARGET_CONFIGDIRS) -dummy-; do \ if [ -f $(TARGET_SUBDIR)/$$i/Makefile ]; then \ for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'|"`; \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ done; \ - export AR AS CC CXX LD NM RANLIB DLLTOOL WINDRES; \ if (cd $(TARGET_SUBDIR)/$$i; \ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ @@ -1213,7 +1215,7 @@ $(ALL_MODULES) all-gui all-libproc: .PHONY: $(CHECK_MODULES) $(NATIVE_CHECK_MODULES) $(CROSS_CHECK_MODULES) $(NATIVE_CHECK_MODULES): - @if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \ + @if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \ dir=`echo $@ | sed -e 's/check-//'`; \ if [ -f ./$${dir}/Makefile ] ; then \ r=`pwd`; export r; \ @@ -1605,8 +1607,8 @@ GDB_TK = all-tk all-tcl all-itcl all-tix all-gdb: all-libiberty all-opcodes all-bfd all-mmalloc all-readline all-bison all-byacc all-sim $(gdbnlmrequirements) $(GDB_TK) all-gettext: all-gnuserv: -configure-target-gperf: $(ALL_GCC_C) -all-target-gperf: configure-target-gperf all-target-libiberty all-target-libstdc++ +configure-target-gperf: $(ALL_GCC_CXX) +all-target-gperf: configure-target-gperf all-target-libiberty all-target-libstdc++-v3 all-gprof: all-libiberty all-bfd all-opcodes all-intl all-grep: all-libiberty all-grez: all-libiberty all-bfd all-opcodes diff -uprN binutils-2.11.90.0.31/bfd/ChangeLog binutils-2.11.92.0.5/bfd/ChangeLog --- binutils-2.11.90.0.31/bfd/ChangeLog Thu Aug 30 14:58:39 2001 +++ binutils-2.11.92.0.5/bfd/ChangeLog Fri Oct 5 14:11:21 2001 @@ -1,3 +1,1342 @@ +2001-10-05 Thiemo Seufer + + * elf32-mips.c (elf_mips_howto_table): Fix some relocation howtos + according to the MIPS/SGI ELF64 ABI Draft. + (mips_elf_sort_hash_table): Typo. + +2001-10-04 Alan Modra + + * elf32-mips.c (_bfd_mips_elf_copy_indirect_symbol): Comment typo. + + * elf32-mips.c (_bfd_mips_elf_copy_indirect_symbol): Bail out after + copying flags if this is a weakdef. + +2001-10-04 Alan Modra + + * elf-bfd.h (struct elf_link_hash_entry): Reorganise for better + packing. + + * elf32-mips.c (mips_elf_record_global_got_symbol): Set got.offset + to 1 rather than 0 to avoid confusing copy_indirect_symbol. + (mips_elf_sort_hash_table_f): Compare got.offset against 1. + + * Makefile.am (BFD_H_DEPS): Add symcat.h. Ensure everything + depends on $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS), not just those + backends we configure. Run "make dep-am". + (install-data-local): Install symcat.h. + * dep-in.sed: Remove symcat.h from dependencies. + * Makefile.in: Regenerate. + +2001-10-03 Vassili Karpov + + * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Handle nocopyreloc. + +2001-10-03 Thiemo Seufer + + * elf64-mips.c (elf_backend_may_use_rela_p): New define. + (elf_backend_default_use_rela_p): New define. + +2001-10-03 Alan Modra + + * elfxx-ia64.c (elfNN_ia64_hash_copy_indirect): Fix typos in last + change. + + * configure.in (AC_OUTPUT ): Remove version.h. + * configure: Regenerate. + * Makefile.am (BFD_H_FILES): Add version.h. + * Makefile.in: Regenerate. + * po/SRC-POTFILES.in: Regenerate. + + * elflink.h (elf_fix_symbol_flags): Copy flags to weakdef using + elf_backend_copy_indirect_symbol so that backend has a chance to + copy other necessary fields. + * elf-bfd.h (struct elf_backend_data): Update description of + elf_backend_copy_indirect_symbol. + * elf.c (_bfd_elf_link_hash_copy_indirect): Bail out after + copying flags if this is a weakdef. + * elfxx-ia64.c (elfNN_ia64_hash_copy_indirect): Likewise. + (elfNN_ia64_aix_add_symbol_hook): Use elf_link_hash_lookup rather + than bfd_link_hash_lookup. + * elf32-i386 (elf_i386_adjust_dynamic_symbol): Don't do copy + reloc processing for weakdefs. + * elf32-hppa.c (elf32_hppa_adjust_dynamic_symbol): Likewise. + * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise. + +2001-10-02 Alan Modra + + * elf64-ppc.c (ppc64_elf_check_relocs): Use a local var and cast + result of ELF64_R_TYPE to enum before using in a switch. + (ppc64_elf_gc_mark_hook): Likewise. + (ppc64_elf_gc_sweep_hook): Likewise. + (ppc64_elf_reloc_type_class): Likewise. + +2001-10-02 Alan Modra + + * version.h: New file. + * bfd-in.h: (BFD_VERSION): Substitute bfd_version. + (BFD_VERSION_DATE): Define. + (BFD_VERSION_STRING): Define. + * configure.in: AC_SUBST bfd_version, bfd_version_date and + bfd_version_string. + (AC_OUTPUT ): Depend on version.h. + * bfd-in2.h: Regenerate. + * configure: Regenerate. + * Makefile.am: Run "make dep-am". + * Makefile.in: Regenerate. + + * bfd-in.h: Include "symcat.h". + (CONCAT4): Redefine as for old CAT4. + * aout-arm.c: Use equivalent CONCAT* macro in place of CAT* macros. + Add warning regarding whitespace. + * aout-cris.c: Likewise. + * aout-ns32k.c: Likewise. + * aout-sparcle.c: Likewise. + * aout-tic30.c: Likewise. + * aout0.c: Likewise. + * armnetbsd.c: Likewise. + * demo64.c: Likewise. + * elf-bfd.h: Likewise. + * gen-aout.c: Likewise. + * host-aout.c: Likewise. + * hp300bsd.c: Likewise. + * hp300hpux.c: Likewise. + * i386aout.c: Likewise. + * i386bsd.c: Likewise. + * i386dynix.c: Likewise. + * i386freebsd.c: Likewise. + * i386linux.c: Likewise. + * i386lynx.c: Likewise. + * i386mach3.c: Likewise. + * i386netbsd.c: Likewise. + * libaout.h: Likewise. + * m68k4knetbsd.c: Likewise. + * m68klinux.c: Likewise. + * m68klynx.c: Likewise. + * m68knetbsd.c: Likewise. + * m88kmach3.c: Likewise. + * mipsbsd.c: Likewise. + * newsos3.c: Likewise. + * ns32knetbsd.c: Likewise. + * pc532-mach.c: Likewise. + * pdp11.c: Likewise. + * riscix.c: Likewise. + * sparclinux.c: Likewise. + * sparclynx.c: Likewise. + * sparcnetbsd.c: Likewise. + * sunos.c: Likewise. + * targets.c: Likewise. + * vaxnetbsd.c: Likewise. + * vms-hdr.c: Likewise. + +2001-10-01 Alan Modra + + * bfd-in.h: Remove comments regarding generated files. + * libbfd-in.h: Likewise. + * libcoff-in.h: Likewise. + * bfd-in2.h: Regenerate. + * libbfd.h: Likewise. + * libcoff.h: Likewise. + +2001-09-30 kaz Kojima + Hans-Peter Nilsson + + * elf32-sh.c (sh_elf_howto_table, R_SH_REL32): Make + partial_inplace, matching assembler output. Set src_mask to + all ones. + (sh_elf_relocate_section): Delete misplaced comment. + For relocatable linking against section symbol, call + _bfd_relocate_contents for partial_inplace relocs and adjust + rel->r_addend for others. + : Fetch partial_inplace addend with + bfd_get_32, not at rel->r_addend. + +2001-09-30 Alan Modra + + * elf.c (_bfd_elf_link_hash_copy_indirect): Set ind refcounts to + the old dir refcount, so we indirectly set them to init_refcount. + Short-circuit asserts when we've just verified they are true. + +2001-09-29 Alan Modra + + * section.c (struct sec): Remove kept_section. + (STD_SECTION): Remove kept_section initialisation. + (bfd_make_section_anyway): Here too. + * ecoff.c (bfd_debug_section): Remove kept_section initialisation. + * cofflink.c (_bfd_coff_link_input_bfd): Don't test kept_section. + * elflink.h (elf_link_input_bfd): Set discarded link-once section + symbols to zero, and remove all code involved with kept_section + and tracking section symbol values. + * bfd-in2.h: Regenerate. + * configure.in: Bump version number. + * configure: Regenerate. + +2001-09-29 Alan Modra + + * elf64-ppc.c (struct ppc_dyn_relocs): New. + (IS_ABSOLUTE_RELOC): Define. + (struct ppc_link_hash_entry): New. + (struct ppc_link_hash_table): New. + (ppc_hash_table): Define. + (link_hash_newfunc): New function. + (ppc64_elf_link_hash_table_create): New function. + (create_got_section): New function. + (ppc64_elf_create_dynamic_sections): Call create_got_section. Stash + pointers to our dynamic sections in hash table. + (ppc64_elf_copy_indirect_symbol): New function. + (ppc64_elf_check_relocs): Remove DEBUG code. Use short-cuts to + dynamic sections. Localise vars. Modify code for refcounts + starting from zero. Don't allocate here, or force symbols dynamic. + Don't copy all relocs if shared, select ones we need. Add code + to track possible copy relocs for non-shared link. + (ppc64_elf_gc_mark_hook): Update comment. + (ppc64_elf_gc_sweep_hook): Sweep dynrelocs too. + (ppc64_elf_adjust_dynamic_symbol): Remove DEBUG code. Rewrite .plt + code for reference counting garbage collection. Don't create .plt + entries for functions that don't comply with ABI naming convention, + and don't allocate .plt space here. Use short-cuts to dynamic + sections. If possible, keep dynamic relocations instead of using + copy relocs. Remove confused comments. + (ppc_adjust_dynindx): Delete. + (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. + (allocate_dynrelocs): New function. + (readonly_dynrelocs): New function. + (ppc64_elf_size_dynamic_sections): Rewrite. Allocate local .got + space here, and call allocate_dynrelocs to allocate space for + global .plt, .got and reloc sections. Use short-cuts to dynamic + sections. Call readonly_dynrelocs to determine whether we need + DT_TEXTREL. Don't generate section symbols here, the generic + ELF linker code does it for us. + (ppc64_elf_final_link): Call regular ELF backend linker rather than + gc variety, since we do our own .got handling. + (ppc64_elf_relocate_section): Remove DEBUG code. Make use of + dynamic section short-cuts. Localise vars, and delay setting. + Handle unknown relocs in main switch statement. Replace ugly + complicated tests for unresolvable relocs with a simple direct + scheme using "unresolved_reloc" var. Test ELF_ST_VISIBILITY + before allowing an undefined sym in a shared lib. Do R_*_DS tests + after main switch, when we've set addend. Do non-addend insn + tweaks before main swithc. Ignore input_section->vma when + calculating reloc offsets as it's always zero. Rewrite dynamic + reloc handling. Consolidate R_*_HA handling. Handle more relocs. + (ppc64_elf_finish_dynamic_symbol): Remove DEBUG code. Make use + of dynamic section short-cuts. Reorganise .plt handling code. + Remove confused comments. Take note of ELF_LINK_FORCED_LOCAL. + Move expressions out of swap_reloca_out function calls. + (ppc64_elf_reloc_type_class): New function. + (ppc64_elf_info_to_howto): Move common expression to local var. + (ppc64_elf_finish_dynamic_sections): Remove DEBUG code. Make use + of dynamic section short-cuts. Don't fiddle with section syms + here as the ELF linker does it for us. + (elf_backend_can_refcount): Define. + (bfd_elf64_bfd_link_hash_table_create): Define. + (elf_backend_copy_indirect_symbol): Define. + (elf_backend_reloc_type_class): Define. + (elf_backend_*, bfd_elf64_bfd_* defines): Sort. + +2001-09-29 Alan Modra + + * elf-bfd.h (struct elf_link_local_dynamic_entry): Add init_refcount. + (struct elf_backend_data): Add can_refcount. + * elf.c (_bfd_elf_link_hash_newfunc): Get rid of a few casts. Set + got.refcount and plt.refcount from init_refcount. + (_bfd_elf_link_hash_table_init): Set up init_refcount. + (_bfd_elf_link_hash_copy_indirect): Reference got/plt.refcount + rather than got/plt.offset, and test for <= 0 rather than -1. + * elflink.h (size_dynamic_sections): Set init_refcount to -1. + * elfxx-target.h (elf_backend_can_refcount): Define. + (elfNN_bed): Init can_refcount. + * linker.c (_bfd_link_hash_newfunc): Get rid of a few casts. + (_bfd_generic_link_hash_newfunc): Likewise. + * elf32-cris.c (cris_elf_check_relocs): Modify for refcounts + starting from zero. + (elf_backend_can_refcount): Define. + * elf32-hppa.c (elf32_hppa_check_relocs): Modify for refcounts + starting from zero. + (elf32_hppa_copy_indirect_symbol): Make static to agree with + prototype. + (elf_backend_can_refcount): Define. + * elf32-i386.c (elf_i386_check_relocs): Modify for refcounts + starting from zero. + (allocate_dynrelocs): Set plt/got.offset rather than *.refcount. + (elf_i386_finish_dynamic_symbol): Expand SHN_UNDEF comment. + (elf_i386_finish_dynamic_sections): Use local var so line < 80 chars. + (elf_backend_can_refcount): Define. + (elf_i386_copy_indirect_symbol): Make static to agree with + prototype. Formatting fix. + * elf32-m68k.c (elf_m68k_check_relocs): Modify for refcounts + starting from zero. + (elf_backend_can_refcount): Define. + * elf32-ppc.c (ppc_elf_check_relocs): Modify for refcounts + starting from zero. + (elf_backend_can_refcount): Define. + * elf32-s390.c (elf_s390_check_relocs): Modify for refcounts + starting from zero. + (elf_backend_can_refcount): Define. + * elf64-s390.c (elf_s390_check_relocs): Modify for refcounts + starting from zero. + (elf_backend_can_refcount): Define. + * elf64-x86-64.c (elf64_x86_64_check_relocs): Modify for refcounts + starting from zero. + (elf_backend_can_refcount): Define. + + * som.c (som_write_symbol_strings): Cast current_offset in + bfd_seek call to match param type. + +2001-09-28 J. Brobecker + + * som.c (som_write_symbol_strings): Fix incorrect type of + current_offset to match the function definition. Fixes a build + failure on HPUX-11.00. + +2001-09-28 Richard Henderson + + * elfxx-target.h [section_flags]: Add SEC_ARCH_BIT_0, SEC_SMALL_DATA, + SEC_MERGE, SEC_STRINGS. + + * section.c (SEC_ARCH_BIT_0): New; replace unused SEC_BALIGN. + * bfd-in2.h: Rebuild. + +2001-09-28 Alan Modra + + * elf64-x86-64.c (elf64_x86_64_reloc_type_lookup): Don't map bfd + reloc code using x86_64_reloc_map. + + * elf32-hppa.c (elf32_hppa_check_relocs): Update comment since we + no longer allocate here. Localise some vars to blocks where they + are used. + (elf32_hppa_adjust_dynamic_symbol): Correct a comment. Delay + setting of vars until needed. + (allocate_dynrelocs): Don't create a .plt entry without a reloc + when symbol visibilty makes a function local. + (elf32_hppa_finish_dynamic_symbol): Move expressions out of + swap_reloca_out function calls. + (elf32_hppa_relocate_section): Likewies. Comment typo fix. + (elf32_hppa_finish_dynamic_sections): Migrate common code out of + switch statement. + + * elf32-i386.c (elf_i386_check_relocs): Update comment since we + no longer allocate here. Localise some vars to blocks where they + are used. Remove separate switch stmt for creating .got sec. + (elf_i386_adjust_dynamic_symbol): Correct a comment. Remove + redundant casts and aborts. Delay setting of vars until needed. + (allocate_dynrelocs): Remove redundant casts and aborts. + (elf_i386_size_dynamic_sections): Move comment. + (elf_i386_finish_dynamic_symbol): Move expressions out of function + calls. + (elf_i386_relocate_section): Likewise. Comment typo fix. + (elf_i386_finish_dynamic_sections): Migrate common code out of + switch statement. + (elf_backend_* defines): Sort. + + * elf32-i386.c (allocate_dynrelocs): Don't create a .plt entry + without a reloc when symbol visibilty makes a function local. + +2001-09-27 Nick Clifton + + * elf32-arm.h (elf32_arm_merge_private_bfd_data): Fix detection of + conflicting float flags. + +2001-09-26 Alan Modra + + * elf32-i386 (elf_i386_copy_indirect_symbol): New function. + (elf_backend_copy_indirect_symbol): Define. + (struct elf_i386_link_hash_entry): Rename "root" to "elf". + (struct elf_i386_link_hash_table): Likewise. + (link_hash_newfunc): Get rid of unnecessary casts. + (elf_i386_link_hash_table_create): Likewise. + (elf_i386_check_relocs): Initialise local_got_refcounts to 0. + Don't test input section SEC_READONLY here to try to avoid copy + relocs, and keep dyn_relocs regardleas of ELF_LINK_NON_GOT_REF. + (elf_i386_adjust_dynamic_symbol): Check output section SEC_READONLY + here to properly test whether we need copy relocs. Do so for weak + syms too. + + * elf32-hppa (elf32_hppa_copy_indirect_symbol): New function. + (elf_backend_copy_indirect_symbol): Define. + (struct elf32_hppa_link_hash_table): Rename "root" to "elf". + (stub_hash_newfunc): Get rid of unnecessary casts. + (hppa_link_hash_newfunc): Likewise. + (elf32_hppa_check_relocs): Initialise local_got_refcounts to 0. + Don't test input section SEC_READONLY here to try to avoid copy + relocs, and keep dyn_relocs regardleas of ELF_LINK_NON_GOT_REF. + (elf32_hppa_adjust_dynamic_symbol): Check output section SEC_READONLY + here to properly test whether we need copy relocs. Do so for weak + syms too. + +2001-09-26 Alan Modra + + * bfd.c (_bfd_default_error_handlerl): Define using VPARAMS, + VA_OPEN, VA_FIXEDARG, VA_CLOSE. + (bfd_archive_filename): Cast bfd_malloc arg to the correct size. + +2001-09-25 Jakub Jelinek + + * elf64-sparc.c (sparc64_elf_build_plt): Fix .plt[32768+] slot + computation. + +2001-09-25 H.J. Lu + + * bfd-in2.h: Regenerated. + +2001-09-25 Alan Modra + + * elf32-i386.c: Add comment re linker function names and ordering. + (elf_i386_link_hash_newfunc): Rename to link_hash_newfunc. + (elf_i386_grok_prstatus): Move before linker functions. + (elf_i386_grok_psinfo): Likewise. + (elf_i386_fake_sections): Move so that functions are ordered. + (elf_i386_reloc_type_class): Likewise. Comment function purpose. + +2001-09-25 Alan Modra + + * elf32-hppa.c: Rename occurrences of "hplink" to "htab" + throughout file. + + * elf32-hppa.c: (LONG_BRANCH_PIC_IN_SHLIB): Delete. Remove all + code handling this option. + (LONG_BRANCH_VIA_PLT): Likewise. + (RELATIVE_DYNRELOCS): Define as zero. + (struct elf32_hppa_dyn_reloc_entry): Add "sec", and + "pc_count" fields. Remove "section" field. + (elf32_hppa_link_hash_entry): Rename reloc_entries to dyn_relocs. + (elf32_hppa_check_relocs): Don't allocate space for dynamic + relocs here. Instead, record all needed dynamic relocs via + dyn_relocs and local_dynrel. Cache pointer to "sreloc" section + in elf_section_data. + (elf32_hppa_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. + (allocate_plt_and_got_and_discard_relocs): Rename to + allocate_dynrelocs. Allocate rather than discarding dyn relocs. + (readonly_dynrelocs): New function. + (elf32_hppa_size_dynamic_sections): Mark output_bfd unused. + Call readonly_dynrelocs to determine need for DT_TEXTREL. + Rename "i" to "ibfd". Allocate space for local dyn relocs. + (elf32_hppa_relocate_section): Make use of cached sreloc. + (elf32_hppa_reloc_type_class): New function. + (elf_backend_reloc_type_class): Define. + +2001-09-25 Alan Modra + + * elf-bfd.h (struct bfd_elf_section_data): Add "local_dynrel" + and "sreloc" fields. + * elf32-i386.c (struct elf_i386_dyn_relocs): Add "sec", and + "pc_count" fields. Remove "section" field. + (elf_i386_check_relocs): Don't set DF_TEXTREL here. Don't + allocate space for dynamic relocs here. Instead, record all + needed dynamic relocs via dyn_relocs and local_dynrel. Cache + pointer to "sreloc" section in elf_section_data. + (elf_i386_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. + (allocate_plt_and_got_and_discard_relocs): Rename to + allocate_dynrelocs. Allocate rather than discarding dyn relocs. + (readonly_dynrelocs): New function. + (elf_i386_size_dynamic_sections): Call readonly_dynrelocs. + Rename "i" to "ibfd". Allocate space for local dyn relocs. + (elf_i386_relocate_section): Make use of cached sreloc. + +2001-09-24 Alan Modra + + * elf-bfd.h (elf_backend_reloc_type_class): Pass in the entire + reloc rather than just the type. + (_bfd_elf_reloc_type_class): Likewise. + * elf.c (_bfd_elf_reloc_type_class): Likewise. + * elf32-arm.h (elf32_arm_reloc_type_class): Likewise. + * elf32-cris.c (elf_cris_reloc_type_class): Likewise. + * elf32-i386.c (elf_i386_reloc_type_class): Likewise. + * elf32-m68k.c (elf32_m68k_reloc_type_class): Likewise. + * elf32-ppc.c (ppc_elf_reloc_type_class): Likewise. + * elf32-s390.c (elf_s390_reloc_type_class): Likewise. + * elf32-sh.c (sh_elf_reloc_type_class): Likewise. + * elf32-sparc.c (elf32_sparc_reloc_type_class): Likewise. + * elf64-alpha.c (elf64_alpha_reloc_type_class): Likewise. + * elf64-s390.c (elf_s390_reloc_type_class): Likewise. + * elf64-sparc.c (sparc64_elf_reloc_type_class): Likewise. + * elf64-x86-64.c (elf64_x86_64_reloc_type_class): Likewise. + * elfxx-ia64.c (elfNN_ia64_reloc_type_class): Likewise. + * elflink.h: Formatting fixes. + (elf_link_sort_relocs): Make "count" and "size" bfd_size_type. + Call bfd_zmalloc rather than calloc. Remove unnecessary cast of + o->contents to PTR. Update call to elf_backend_reloc_type_class. + +2001-09-22 John Reiser + + * elfcode.h (elf_object_p): Allow for no section header at all in + non-ET_REL files. Honor 0 for e_shnum, e_shstrndx, e_shoff. + +2001-09-21 Nick Clifton + + * elfxx-ia64.c: Fix compile time warning messages. + * coff-mcore.c: Fix compile time warning messages. + * coff-ppc.c: Fix compile time warning messages. + * coffcode.h: Fix compile time warning messages. + * elf32-mips.c: Fix compile time warning messages. + * elf64-alpha.c: Fix compile time warning messages. + * libbfd.c: Fix compile time warning messages. + * bfd-in2.h: Regenerate. + +2001-09-21 Alan Modra + + * Makefile.am: Run "make dep-am". + * Makefile.in: Regenerate. + + * aoutx.h: Formatting fixes. + * merge.c (_bfd_merged_section_offset): Break line at 80 chars. + + * linker.c: Replace bfd_get_filename with bfd_archive_filename + in error message. + +2001-09-21 Alan Modra + + * bfd.c (bfd_archive_filename): New function. + * bfd-in2.h: Regenerate. + * aout-adobe.c: Replace bfd_get_filename with bfd_archive_filename + in error messages where the bfd is an input bfd. + * aout-cris.c: Likewise. + * coff-arm.c: Likewise. + * coff-mcore.c: Likewise. + * coff-ppc.c: Likewise. + * coff-rs6000.c: Likewise. + * coff-sh.c: Likewise. + * coff-tic54x.c: Likewise. + * coff-tic80.c: Likewise. + * coff64-rs6000.c: Likewise. + * coffcode.h: Likewise. + * coffgen.c: Likewise. + * cofflink.c: Likewise. + * ecofflink.c: Likewise. + * elf-hppa.h: Likewise. + * elf.c: Likewise. + * elf32-arm.h: Likewise. + * elf32-cris.c: Likewise. + * elf32-gen.c: Likewise. + * elf32-hppa.c: Likewise. + * elf32-i370.c: Likewise. + * elf32-i386.c: Likewise. + * elf32-m32r.c: Likewise. + * elf32-mcore.c: Likewise. + * elf32-mips.c: Likewise. + * elf32-ppc.c: Likewise. + * elf32-s390.c: Likewise. + * elf32-sh.c: Likewise. + * elf32-sparc.c: Likewise. + * elf32-v850.c: Likewise. + * elf64-alpha.c: Likewise. + * elf64-gen.c: Likewise. + * elf64-ppc.c: Likewise. + * elf64-s390.c: Likewise. + * elf64-sparc.c: Likewise. + * elf64-x86-64.c: Likewise. + * elflink.h: Likewise. + * elfxx-ia64.c: Likewise. + * ieee.c: Likewise. + * ihex.c: Likewise. + * libbfd.c: Likewise. + * pdp11.c: Likewise. + * pe-mips.c: Likewise. + * peicode.h: Likewise. + * srec.c: Likewise. + * xcofflink.c: Likewise. + + * elf32-arm.h: Make _bfd_error_handler calls K&R compatible. + + * elflink.c (_bfd_elf_create_linker_section): Better grammar for + error message. + + * coff-mcore.c (coff_mcore_relocate_section): Internalionalise + error message. + + * elf64-sparc.c (sparc64_elf_add_symbol_hook): Constify stt_types. + Consolidate error messages, and split long messages to two lines. + +2001-09-20 John Reiser + + * elf32-i386.c (elf_i386_relocate_section): Coordinate info->symbolic + and info->allow_shlib_undefined. + * elf32-cris.c: Likewise. + * elf32-hppa.c: Likewise. + * elf32-m68k.c: Likewise. + * elf32-mips.c: Likewise. + * elf32-ppc.c: Likewise. + * elf32-s390.c: Likewise. + * elf32-sh.c: Likewise. + * elf32-sparc.c: Likewise. + * elf64-alpha.c: Likewise. + * elf64-hppa.c: Likewise. + * elf64-ppc.c: Likewise. + * elf64-s390.c: Likewise. + * elf64-sparc.c: Likewise. + * elf64-x86-64.c: Likewise. + * elfxx-ia64.c: Likewise. + +2001-09-18 Bruno Haible + + * aoutx.h: Include "safe-ctype.h" instead of . + (aout_link_write_symbols): Use ISDIGIT instead of isdigit. + * archive.c: Include "safe-ctype.h" instead of . + (_bfd_generic_read_ar_hdr_mag): Use ISDIGIT instead of isdigit. + * archures.c: Include "safe-ctype.h" instead of . + (bfd_default_scan): Use ISDIGIT instead of isdigit. + * bfd.c: Include "safe-ctype.h" instead of . + (bfd_scan_vma): Use ISXDIGIT/ISDIGIT/ISLOWER instead of + isxdigit/isdigit/islower. + * binary.c: Include "safe-ctype.h" instead of . + (mangle_name): Use ISALNUM instead of isalnum. + * cpu-v850.c: Include "safe-ctype.h" instead of . + (scan): Use ISDIGIT instead of isdigit. + * hosts/alphavms.h: Don't include . + * ieee.c: Include "safe-ctype.h" instead of . + (ieee_object_p): Use TOUPPER instead of toupper. + * ihex.c: Include "safe-ctype.h" instead of . + (ihex_bad_byte): Use ISPRINT instead of isprint. + * merge.c: Don't include . + * oasys.c: Include "safe-ctype.h" instead of . + (oasys_write_sections): Use ISDIGIT instead of isdigit. + * pdp11.c: Include "safe-ctype.h" instead of . + (aout_link_write_symbols): Use ISDIGIT instead of isdigit. + * ppcboot.c: Include "safe-ctype.h" instead of . + (mangle_name): Use ISALNUM instead of isalnum. + * som.c: Include "safe-ctype.h" instead of . + (som_set_reloc_info): Use ISUPPER/ISLOWER/ISDIGIT instead of + isupper/islower/isdigit. + (som_decode_symclass): Use TOUPPER instead of toupper. + * srec.c: Include "safe-ctype.h" instead of . + (srec_bad_byte): Use ISPRINT instead of isprint. + (srec_scan): Use ISSPACE instead of isspace. + * stabs.c: Include "safe-ctype.h" instead of . + (_bfd_link_section_stabs): Use ISDIGIT instead of isdigit. + * syms.c: Include "safe-ctype.h" + (islower, toupper): Remove macro definitions. + (bfd_decode_symclass): Use TOUPPER instead of toupper. + * vms-gsd.c: Don't include . + * vms-hdr.c: Include "safe-ctype.h" instead of . + (_bfd_vms_write_hdr): Use ISLOWER/TOUPPER instead of + islower/toupper. + * vms-tir.c: Don't include . + +2001-09-18 Alan Modra + + * libbfd.c (bfd_bread): New function replacing bfd_read without + redundant params. Allow reads up to (size_t) -2 in length. + (bfd_bwrite): Similarly for bfd_write. + (real_read): Return a size_t. + (bfd_read): Call bfd_bread. + (bfd_write): Call bfd_bwrite. + (warn_deprecated): New function to annoy everybody. + (bfd_get_file_window): Don't call bfd_set_error unnecessarily. + * bfd-in.h (bfd_bread, bfd_bwrite, warn_deprecated): Declare. + (bfd_read, bfd_write): Define as macro. + * aix386-core.c: Replace calls to bfd_read with bfd_bread, and + likewise for bfd_write. Ensure function args are correct size by + using casts or local vars. In some cases, remove unnecessary + casts. Formatting fixes, in some cases removing a large expression + from function args by using a local var. Replace CONST with const. + Modify variable types to avoid warings. Use casts to avoid + warnings when using negative numbers in unsigned expressions. + * aout-adobe.c: Likewise. + * aout-arm.c: Likewise. + * aout-cris.c: Likewise. + * aout-encap.c: Likewise. + * aout-ns32k.c: Likewise. + * aout-target.h: Likewise. + * aout-tic30.c: Likewise. + * aoutf1.h: Likewise. + * aoutx.h: Likewise. + * archive.c: Likewise. + * archures.c: Likewise. + * bfd-in.h: Likewise. + * bfd.c: Likewise. + * binary.c: Likewise. + * bout.c: Likewise. + * cache.c: Likewise. + * cisco-core.c: Likewise. + * coff-a29k.c: Likewise. + * coff-alpha.c: Likewise. + * coff-arm.c: Likewise. + * coff-h8300.c: Likewise. + * coff-h8500.c: Likewise. + * coff-i386.c: Likewise. + * coff-i860.c: Likewise. + * coff-i960.c: Likewise. + * coff-ia64.c: Likewise. + * coff-m68k.c: Likewise. + * coff-m88k.c: Likewise. + * coff-mcore.c: Likewise. + * coff-mips.c: Likewise. + * coff-ppc.c: Likewise. + * coff-rs6000.c: Likewise. + * coff-sh.c: Likewise. + * coff-sparc.c: Likewise. + * coff-stgo32.c: Likewise. + * coff-tic30.c: Likewise. + * coff-tic54x.c: Likewise. + * coff-tic80.c: Likewise. + * coff-w65.c: Likewise. + * coff-z8k.c: Likewise. + * coff64-rs6000.c: Likewise. + * coffcode.h: Likewise. + * coffgen.c: Likewise. + * cofflink.c: Likewise. + * coffswap.h: Likewise. + * corefile.c: Likewise. + * cpu-arc.c: Likewise. + * cpu-h8300.c: Likewise. + * cpu-h8500.c: Likewise. + * cpu-i960.c: Likewise. + * cpu-ia64-opc.c: Likewise. + * cpu-ns32k.c: Likewise. + * cpu-pdp11.c: Likewise. + * cpu-pj.c: Likewise. + * cpu-sh.c: Likewise. + * cpu-w65.c: Likewise. + * cpu-z8k.c: Likewise. + * dwarf1.c: Likewise. + * dwarf2.c: Likewise. + * ecoff.c: Likewise. + * ecofflink.c: Likewise. + * ecoffswap.h: Likewise. + * elf-bfd.h: Likewise. + * elf-hppa.h: Likewise. + * elf-m10200.c: Likewise. + * elf-m10300.c: Likewise. + * elf.c: Likewise. + * elf32-arc.c: Likewise. + * elf32-arm.h: Likewise. + * elf32-avr.c: Likewise. + * elf32-cris.c: Likewise. + * elf32-fr30.c: Likewise. + * elf32-gen.c: Likewise. + * elf32-h8300.c: Likewise. + * elf32-hppa.c: Likewise. + * elf32-i370.c: Likewise. + * elf32-i386.c: Likewise. + * elf32-i860.c: Likewise. + * elf32-m32r.c: Likewise. + * elf32-m68k.c: Likewise. + * elf32-mcore.c: Likewise. + * elf32-mips.c: Likewise. + * elf32-openrisc.c: Likewise. + * elf32-pj.c: Likewise. + * elf32-ppc.c: Likewise. + * elf32-s390.c: Likewise. + * elf32-sh-lin.c: Likewise. + * elf32-sh.c: Likewise. + * elf32-sparc.c: Likewise. + * elf32-v850.c: Likewise. + * elf64-alpha.c: Likewise. + * elf64-hppa.c: Likewise. + * elf64-mips.c: Likewise. + * elf64-ppc.c: Likewise. + * elf64-s390.c: Likewise. + * elf64-sparc.c: Likewise. + * elf64-x86-64.c: Likewise. + * elfarm-nabi.c: Likewise. + * elfcode.h: Likewise. + * elfcore.h: Likewise. + * elflink.c: Likewise. + * elflink.h: Likewise. + * elfxx-ia64.c: Likewise. + * elfxx-target.h: Likewise. + * format.c: Likewise. + * hash.c: Likewise. + * hp300hpux.c: Likewise. + * hppabsd-core.c: Likewise. + * hpux-core.c: Likewise. + * i386aout.c: Likewise. + * i386dynix.c: Likewise. + * i386linux.c: Likewise. + * i386lynx.c: Likewise. + * i386mach3.c: Likewise. + * i386msdos.c: Likewise. + * i386os9k.c: Likewise. + * ieee.c: Likewise. + * ihex.c: Likewise. + * irix-core.c: Likewise. + * libaout.h: Likewise. + * libbfd-in.h: Likewise. + * libbfd.c: Likewise. + * libcoff-in.h: Likewise. + * libecoff.h: Likewise. + * libieee.h: Likewise. + * libnlm.h: Likewise. + * libpei.h: Likewise. + * libxcoff.h: Likewise. + * linker.c: Likewise. + * lynx-core.c: Likewise. + * m68klinux.c: Likewise. + * merge.c: Likewise. + * mipsbsd.c: Likewise. + * netbsd-core.c: Likewise. + * nlm.c: Likewise. + * nlm32-alpha.c: Likewise. + * nlm32-i386.c: Likewise. + * nlm32-ppc.c: Likewise. + * nlm32-sparc.c: Likewise. + * nlmcode.h: Likewise. + * nlmswap.h: Likewise. + * ns32k.h: Likewise. + * oasys.c: Likewise. + * opncls.c: Likewise. + * osf-core.c: Likewise. + * pc532-mach.c: Likewise. + * pdp11.c: Likewise. + * pe-mips.c: Likewise. + * peXXigen.c: Likewise. + * peicode.h: Likewise. + * ppcboot.c: Likewise. + * ptrace-core.c: Likewise. + * reloc.c: Likewise. + * reloc16.c: Likewise. + * riscix.c: Likewise. + * rs6000-core.c: Likewise. + * sco5-core.c: Likewise. + * section.c: Likewise. + * som.c: Likewise. + * sparclinux.c: Likewise. + * sparclynx.c: Likewise. + * srec.c: Likewise. + * stabs.c: Likewise. + * sunos.c: Likewise. + * syms.c: Likewise. + * targets.c: Likewise. + * tekhex.c: Likewise. + * trad-core.c: Likewise. + * versados.c: Likewise. + * vms-gsd.c: Likewise. + * vms-hdr.c: Likewise. + * vms-misc.c: Likewise. + * vms-tir.c: Likewise. + * vms.c: Likewise. + * vms.h: Likewise. + * xcofflink.c: Likewise. + * bfd-in2.h: Regenerate. + * libbfd.h: Regenerate. + * libcoff.h: Regenerate. + + * bfd.c (struct _bfd): Make "where" and "origin" unsigned. + * bfd-in.h (file_ptr): Change from a long int to a bfd_signed_vma. + (ufile_ptr): Define. + (bfd_tell): Return a ufile_ptr. + * libbfd.c (bfd_tell): Likewise. + (bfd_seek): Use bfd_size_type locals. Don't call bfd_set_error + unnecessarily. + * aix386-core.c: Test != 0 for bfd_seek errors rather than < 0. + * aoutf1.h: Likewise. + * som.c: Likewise. + * cache.c (bfd_cache_lookup_worker): Guard against abfd->where + larger than unsigned long can represent. + + * libbfd.c (bfd_malloc): Take a bfd_size_type arg. Error if + size overflows size_t. + (bfd_realloc): Likewise. + (bfd_zmalloc): Likewise. + * opncls.c (bfd_alloc): Likewise. + (bfd_zalloc): Likewise. + * libbfd-in.h (bfd_malloc, bfd_realloc, bfd_zmalloc): Update. + (bfd_alloc, bfd_zalloc): Update. + + * libbfd.c (bfd_get_8): Mask with 0xff in case char is more than + 8 bits. + (bfd_get_signed_8): Likewise. + (H_PUT_64, H_PUT_32, H_PUT_16, H_PUT_8, + H_PUT_S64, H_PUT_S32, H_PUT_S16, H_PUT_S8, + H_GET_64, H_GET_32, H_GET_16, H_GET_8, + H_GET_S64, H_GET_S32, H_GET_S16, H_GET_S8): Define and use. + * libaout.h: Likewise define and use here. + * aout-adobe.c: Use H_GET_* and H_PUT_* macros. + * aout-arm.c: Likewise. + * aout-encap.c: Likewise. + * aout-ns32k.c: Likewise. + * aout-tic30.c: Likewise. + * aoutf1.h: Likewise. + * aoutx.h: Likewise. + * bout.c: Likewise. + * coff-alpha.c: Likewise. + * coff-h8300.c: Likewise. + * coff-h8500.c: Likewise. + * coff-i960.c: Likewise. + * coff-ia64.c: Likewise. + * coff-m88k.c: Likewise. + * coff-mips.c: Likewise. + * coff-ppc.c: Likewise. + * coff-rs6000.c: Likewise. + * coff-sh.c: Likewise. + * coff-sparc.c: Likewise. + * coff-stgo32.c: Likewise. + * coff-tic30.c: Likewise. + * coff-tic80.c: Likewise. + * coff-w65.c: Likewise. + * coff-z8k.c: Likewise. + * coff64-rs6000.c: Likewise. + * coffgen.c: Likewise. + * cofflink.c: Likewise. + * coffswap.h: Likewise. + * ecoff.c: Likewise. + * ecoffswap.h: Likewise. + * elf.c: Likewise. + * elf32-mips.c: Likewise. + * elf64-mips.c: Likewise. + * hp300hpux.c: Likewise. + * i386dynix.c: Likewise. + * i386lynx.c: Likewise. + * i386msdos.c: Likewise. + * i386os9k.c: Likewise. + * libpei.h: Likewise. + * nlm32-alpha.c: Likewise. + * nlm32-i386.c: Likewise. + * nlm32-ppc.c: Likewise. + * nlmcode.h: Likewise. + * nlmswap.h: Likewise. + * oasys.c: Likewise. + * pdp11.c: Likewise. + * pe-mips.c: Likewise. + * peXXigen.c: Likewise. + * peicode.h: Likewise. + * riscix.c: Likewise. + * sunos.c: Likewise. + * xcofflink.c: Likewise. + * elfcode.h: (put_word, get_word, put_signed_word, get_signed_word): + Rename to H_PUT_WORD, H_GET_WORD, H_PUT_SIGNED_WORD, H_GET_SIGNED_WORD. + * coff-rs6000.c (PUTWORD, PUTHALF, PUTBYTE): Don't define. Use + equivalent H_PUT_* macro instead. + (GETWORD, GETHALF, GETBYTE): Similarly. + * coff64-rs6000.c (PUTWORD, PUTHALF, PUTBYTE): Likewise. + (GETWORD, GETHALF, GETBYTE): Likewise. + * coffswap.h (PUTWORD, PUTHALF, PUTBYTE): Likewise. + + * bfd-in.h (struct orl): Change "pos" to a union. + * archive.c (_bfd_compute_and_write_armap): Use it instead of casts. + (bsd_write_armap): Here too. + (coff_write_armap): And here. + * coff-rs6000.c (xcoff_write_armap_old): And here. + (xcoff_write_one_armap_big): And here. + (xcoff_write_armap_big): And here. + * ecoff.c (_bfd_ecoff_write_armap): And here. + * elf64-mips.c (mips_elf64_write_armap): And here. + + * aoutf1.h (sunos_set_arch_mach): Make "mach" param an enum. + * elf-m10300.c (elf_mn10300_mach): Return an unsigned long. + * elf32-h8300.c (elf32_h8_mach): Likewise. + * elf32-mips.c (elf_mips_mach): Likewise. + * sparclynx.c (NAME(lynx,set_arch_mach)): Likewise. + + * aix386-core.c (aix386_core_file_p): Remove redundant bfd_release + calls. + (aix386_core_vec): Typo fix. + + * aout-arm.c: Include libaout.h and aout/aout64.h after N_TXTADDR + etc. to avoid redefined macro warning. + (MY(put_reloc)): Use bfd_vma for "value" rather than long. + (MY(fix_pcrel_26)): Likewise. + * aout-ns32k.c (MY(put_reloc)): Likewise. + * aout-cris.c (MY(swap_ext_reloc_out)): Likewise for r_addend. + * aoutx.h (NAME(aout,swap_ext_reloc_out)): Likewise. + * coff-arm.c (coff_arm_relocate_section): Likewise for my_offset. + + * aout-encap.c: Include "file", not for binutils headers. + (encap_object_p): Half baked attempt to fix compile errors in + code dealing with "magic". + + * aout-ns32k.c: Include "file", not for binutils headers. + (_bfd_ns32k_relocate_contents): get_data and put_data manipulate + bfd_vma's rather than longs. + * cpu-ns32k.c (ns32k_sign_extend): Delete. + (_bfd_ns32k_get_displacement): Return a bfd_vma, don't pass in offset. + (_bfd_ns32k_get_immediate): Likewise. Add code for 8 byte values, + remove case 3. + (_bfd_ns32k_put_displacement): Accept a bfd_vma, don't pass in offset. + Use unsigned comparisons. + (bfd_ns32k_put_immediate): Likewise, and add code for 8 byte values. + (do_ns32k_reloc): get_data and put_data operate on bfd_vma's. + (_bfd_do_ns32k_reloc_contents): Likewise. + * ns32k.h (_bfd_ns32k_get_displacement): Update prototype. + (_bfd_ns32k_get_immediate): Likewise. + (_bfd_ns32k_put_displacement): Likewise. + (_bfd_ns32k_put_immediate): Likewise. + (bfd_reloc_status_type): Likewise. + + * aoutx.h (NAME(aout,find_nearest_line)): Rename 'p' to 'colon' + to avoid shadowing. + * pdp11.c (NAME(aout,find_nearest_line)): Likewise. + * coff-h8300.c (h8300_reloc16_extra_cases): Remove shadowing "value". + * coff-ppc.c (enum ref_category): Rename "data" to "tocdata" to + avoid shadowing. + (record_toc): Use a bfd_signed_vma for our_toc_offset. + * coffcode.h (coff_write_relocs): Rename "i" to avoid shadowing. + * elf.c (bfd_elf_get_bfd_needed_list): Rename "link" var to avoid + shadow warning. + (_bfd_elfcore_strndup): Likewise for "dup". + * elf32-cris.c (cris_elf_relocate_section): "symname" instead of + "name" to avoid shadowing. + * elf32-hppa.c (elf32_hppa_relocate_section): Remove duplicate + definition of "off". + * elf32-i386.c (elf_i386_relocate_section): Likewise. + * elf32-mips.c (_bfd_mips_elf_modify_segment_map): Remove duplicate + definition of "s". + (_bfd_mips_elf_final_link): Rename "i" to "j". Remove duplicate + "secpp". + * elf64-x86-64.c (elf64_x86_64_relocate_section): Rename inner "indx" + to avoid shadowing. + * elflink.h (elf_link_add_object_symbols): Rename "link" to "shlink" + to avoid shadowing. + (elf_link_input_bfd): Likewise. + (elf_bfd_final_link): Remove duplicate innermost "off" var. + * oasys.c (oasys_write_data): Rename innermost "p" to "sym". + * reloc16.c (bfd_coff_reloc16_relax_section): Rename "i" param to + "input_section". + * som.c (som_prep_for_fixups): Rename inner "i" to "j". + * sunos.c (sunos_add_dynamic_symbols): Localise "s" var. + (sunos_write_dynamic_symbol): Remove unused vars. + * syms.c (_bfd_stab_section_find_nearest_line): Remove duplicate + innermost "directory_name" and "file_name" vars. + * tekhex.c (first_phase): Rename local var "type" to "stype". + (tekhex_write_object_contents): Rename innermost "s" to "sym". + * vms-gsd.c (vms_secflag_by_name): Change "size" param to "hassize", + doing comparison at caller. + (vms_esecflag_by_name): Likewise. + * vms-tir.c (etir_sto): Rename innermost "psect" to "psect1". + * xcofflink.c (xcoff_link_input_bfd): Delete duplicate innermost "o". + (xcoff_write_global_symbol): Rename "p" param to "inf". + + * cisco-core.c: Add missing prototypes. + (cisco_core_file_failing_command): Add ATTRIBUTE_UNUSED. + (cisco_core_file_failing_signal): Likewise. + (cisco_core_file_matches_executable_p): Likewise. + * hpux-core.c (hpux_core_core_file_failing_signal): Likewise. + * netbsd-core.c (netbsd_core_file_matches_executable_p): Likewise. + * osf-core.c (osf_core_core_file_matches_executable_p): Likewise. + * sco5-core.c (sco5_core_file_matches_executable_p): Likewise. + + * coff-arm.c (coff_arm_link_hash_table): Use bfd_size_type for + thumb_glue_size and arm_glue_size. + * elf32-arm.h (elf32_arm_link_hash_table): Likewise here. + + * coff64-rs6000.c: Group prototypes together. + + * coffcode.h (coff_set_arch_mach): Add ATTRIBUTE_UNUSED. + (buy_and_read): Remove "seek" param. Change "size" to bfd_size_type. + + * cpu-arc.c: Add missing prototypes. + * cpu-h8500.c: Likewise. + * cpu-i960.c: Likewise. + * cpu-pj.c: Likewise. + * cpu-sh.c: Likewise. + * cpu-w65.c: Likewise. + * cpu-z8k.c: Likewise. + * elf32-fr30.c: Likewise. + * elf32-h8300.c: Likewise. + * elf32-i370.c: Likewise. + * hpux-core.c: Likewise. + * versados.c: Likewise. + + * cpu-h8300.c (bfd_default_scan_num_mach): Don't declare. + * cpu-h8500.c: Likewise. + * cpu-i960.c: Likewise. + * cpu-z8k.c: Likewise. + + * cpu-ia64-opc.c: Correct comment. + + * dwarf2.c (_bfd_dwarf2_find_nearest_line): Remove unused var. + + * elf-bfd.h (elf_size_info): Change count param of write_out_phdrs + to unsigned. + (bfd_elf32_write_out_phdrs): Likewise. + (bfd_elf64_write_out_phdrs): Likewise. + (elf_linker_section_pointers): Change addend to bfd_vma. + (_bfd_elf_find_pointer_linker_section): Likewise. + (_bfd_elfcore_make_pseudosection): Change size param to size_t and + filepos to unsigned file_ptr. + (_bfd_elfcore_strndup): Change max param to size_t. + * elf.c (_bfd_elfcore_make_pseudosection): As above. + (_bfd_elfcore_strndup): Likewise. + (_bfd_elf_find_pointer_linker_section): Likewise. + + * elf-hppa.h (elf_hppa_relocate_insn): Return an int, and change + insn and sym_value to ints. + + * elf.c (elf_read): Make "offset" param a file_ptr, "size" a + bfd_size_type. + (elfcore_read_notes): Likewise. + + * elf32-arm.h (elf32_arm_final_link_relocate): Change sym_flags + param from unsigned char to int. + (elf32_arm_relocate_section): If USE_REL, cast "rel" appropriately + for info_to_howto call. + (add_dynamic_entry): Define macro. + (elf32_arm_size_dynamic_sections): Use add_dynamic_entry. + + * elf32-cris.c (add_dynamic_entry): Define macro. + (elf_cris_size_dynamic_sections): Use add_dynamic_entry. + + * elf32-h8300.c (elf32_h8_final_write_processing): Make static. + (elf32_h8_object_p): Likewise. + (elf32_h8_merge_private_bfd_data): Likewise. + (elf32_h8_relax_section): Cast gap to int so signed comparisons work. + + * elf32-hppa.c (add_dynamic_entry): Define macro. + (elf32_hppa_size_dynamic_sections): Use it. + * elf32-i370.c (add_dynamic_entry): Define macro. + (i370_elf_size_dynamic_sections): Use it. + (i370_noop): Make static. + * elf32-i386.c (add_dynamic_entry): Define macro. + (elf_i386_size_dynamic_sections): Use it. + * elf32-m68k.c (add_dynamic_entry): Define macro. + (elf_m68k_size_dynamic_sections): Use it. + * elf32-ppc.c (add_dynamic_entry): Define macro. + (ppc_elf_size_dynamic_sections): Use it. + * elf32-s390.c (add_dynamic_entry): Define macro. + (elf_s390_size_dynamic_sections): Use it. + * elf64-alpha.c (add_dynamic_entry): Define macro. + (elf64_alpha_size_dynamic_sections): Use it. + * elf64-hppa.c (add_dynamic_entry): Define macro. + (elf64_hppa_size_dynamic_sections): Use it. + * elf64-ppc.c (add_dynamic_entry): Define macro. + (ppc64_elf_size_dynamic_sections): Use it. + * elf64-s390.c (add_dynamic_entry): Define macro. + (elf_s390_size_dynamic_sections): Use it. + * elf64-sparc.c (add_dynamic_entry): Define macro. + (sparc64_elf_size_dynamic_sections): Use it. + * elf64-x86-64.c (add_dynamic_entry): Define macro. + (elf64_x86_64_size_dynamic_sections): Use it. + * elfxx-ia64.c (add_dynamic_entry): Define macro. + (elfNN_ia64_size_dynamic_sections): Use it. + + * elf32-v850.c (SEXT24): Modify to avoid signed/unsigned warning. + (v850_elf_perform_relocation): Make "r_type" param unsigned. + + * elf64-mips.c (mips_elf64_slurp_one_reloc_table): Just return + false if the first malloc fails rather than going via error_return. + + * elf64-sparc.c (sparc64_elf_plt_entry_offset): Use a bfd_vma for + "index" param. + (sparc64_elf_plt_ptr_offset): Likewise, and for "max" param too. + + * elflink.h (elf_link_input_bfd): s/ingored/ignored/ in error message. + + * elfxx-ia64.c (global_sym_index): Return a long. + + * ieee.c (get_symbol): Use int rather than char param. + (ieee_slurp_sections): Move "section" var to inner blocks. + (copy_expression): Don't init "value" to zero or worry about + clearing to zero after using. + (ieee_write_debug_part): Rename "output_buffer" to "obuff" to avoid + shadowing. + + * ihex.c (ihex_write_record): Make "count" var a size_t, "addr" an + unsigned int. + + * libbfd-in.h (BFD_ALIGN): Add cast to avoid signed/unsigned warning. + (bfd_write_bigendian_4byte_int): Pass an unsigned int value param. + + * mipsbsd.c (mips_fix_jmp_addr): Add "error_message" param. + + * pc532-mach.c (MYNSX): Delete. + (ns32kaout_bfd_reloc_type_lookup): Define prototype without MYNSX. + (write_object_contents): Correct prototype. + + * peicode.h (pe_ILF_build_a_bfd): Use an unsigned int param rather + than unsigned short. + + * section.c (bfd_set_section_contents): Remove redundant + "offset < 0" test. Check that "count" doesn't overflow size_t. + (bfd_get_section_contents): Likewise. + + * som.c (som_fixup_formats): Add missing braces. + (som_reloc_addend): Pass a bfd_vma for "addend". + + * srec.c (srec_write_record): Pass "type" as an unsigned int. + (srec_write_symbols): Remove an unnecessary var. + + * targets.c (_bfd_target_vector): Sort entries. Sort externs + to match. + * configure.in: Sort to match. Bump version number. + * configure: Regenerate. + + * tekhex.c (move_section_contents): Assert offset == 0. + + * versados.c (new_symbol_string): Constify arg. + (process_esd): Use bfd_und_section_ptr rather than &bfd_und_section. + (versados_get_symbol_info): Make static. + (versados_print_symbol): Likewise. + (versados_get_reloc_upper_bound): Likewise. + (versados_canonicalize_reloc): Likewise. + +2001-09-18 Nick Clifton + + * elflink.h (elf_link_input_bfd): Fix typo in error message. + +2001-09-17 H.J. Lu + + * dwarf1.c (parse_die): Take a new arg for the end of the + section. Return false if die is beyond the section. + (parse_functions_in_unit): Pass the end of the section to + parse_die (). + (_bfd_dwarf1_find_nearest_line): Likewise. + +2001-09-14 Michael Rauch + + * elf32-sparc.c (elf32_sparc_relocate_section): Treat R_SPARC_UA32 + just like R_SPARC_32. + +2001-09-14 Kevin Lo + + * configure.bfd: Add arm-openbsd target. + +2001-09-14 Thiemo Seufer + + * config.bfd: Change machine triplets from mips*el*-* to mips*el-*. + Add support for mips64. + +2001-09-13 Alexandre Oliva + + * elf32-openrisc.c (ELF_MACHINE_ALT1): Define as EM_OPENRISC_OLD. + +2001-09-12 Alexandre Oliva + + * elf.c (prep_headers): Get the machine code from the elf + backend data. + * elf-m10200.c (ELF_MACHINE_CODE): Redefine to EM_MN10200. + (ELF_MACHINE_ALT1): Define to EM_CYGNUS_MN10200. + * elf-m10300.c (ELF_MACHINE_CODE): Redefine to EM_MN10300. + (ELF_MACHINE_ALT1): Define to EM_CYGNUS_MN10300. + * elf-arc.c (arc_elf_final_write_processing): Don't override + e_machine, it's now properly set in prep_headers. + * elf32-avr.c (elf32_avr_object_p): Accept both EM_AVR and + EM_AVR_OLD. + (ELF_MACHINE_ALT1): Define to EM_AVR_OLD. + * elf-d10v.c (ELF_MACHINE_CODE): Redefine to EM_D10V. + (ELF_MACHINE_ALT1): Define to EM_CYGNUS_D10V. + * elf-d30v.c (ELF_MACHINE_CODE): Redefine to EM_D30V. + (ELF_MACHINE_ALT1): Define to EM_CYGNUS_D30V. + * elf-fr30.c (ELF_MACHINE_CODE): Redefine to EM_FR30. + (ELF_MACHINE_ALT1): Define to EM_CYGNUS_FR30. + * elf-m32r.c (ELF_MACHINE_CODE): Redefine to EM_M32R. + (ELF_MACHINE_ALT1): Define to EM_CYGNUS_M32R. + * elf32-pj.c (ELF_MACHINE_ALT1): DEfine to EM_PJ_OLD. + * elf-v850.c (ELF_MACHINE_CODE): Redefine to EM_V850. + (ELF_MACHINE_ALT1): Define to EM_CYGNUS_V850. + +2001-09-11 Richard Henderson + + * elf64-alpha.c (elf64_alpha_section_flags): New. + (elf64_alpha_fake_sections): Map SEC_SMALL_DATA to SHF_ALPHA_GPREL. + +2001-09-11 Richard Henderson + + * elf64-alpha.c (elf64_alpha_relocate_section): Do not + apply HINT relocations against dynamic symbols. + +2001-09-11 H.J. Lu + + * linker.c (link_action): Change COMMON_ROW\defw from CREF to COM. + +2001-09-09 Richard Henderson + + * elf64-alpha.c: Delete all unused ERIC_neverdef and rth_notdef code. + + * elf64-alpha.c (elf64_alpha_relax_with_lituse): Nop out gpdisp + following a call to a near function. + +2001-09-08 Richard Henderson + + * elf64-alpha.c (elf64_alpha_relocate_section): Soft fail + relocation errors. Fail gp-relative relocations against + dynamic symbols. + +2001-09-08 Alan Modra + + * elf32-i386.c (elf_i386_relocate_section): Check !DEF_REGULAR + as well as DEF_DYNAMIC in test for avoided copy relocs. + (allocate_plt_and_got_and_discard_relocs): Likewise. + * elf32-hppa.c (elf_i386_relocate_section): Likewise. + (allocate_plt_and_got_and_discard_relocs): Likewise. + +2001-09-07 Thiemo Seufer + + * elf32-mips.c (mips_elf_calculate_relocation): Fix overflow handling + of R_MIPS_PC16. + +2001-09-06 Thiemo Seufer + + * elf64-mips.c (mips_elf64_howto_table_rel): Fix relocation HOWTO + definitions. + (mips_elf64_howto_table_rel): Likewise. + +2001-09-05 Tom Rix + + * xcofflink.c (bfd_xcoff_import_symbol): Handle import file XMC_XO + and syscall symbols. + (write_global_symbol) : Same. + (bfd_xcoff_export_symbol): Remove unused syscall param. + * libxcoff.h: Change prototype of bfd_xcoff_export symbol and + bfd_xcoff_import_symbol. + * bfd-in.h: Same. + * bfd-in2.h : Regenerate. + +2001-09-04 Richard Henderson + + * elf64-alpha.c (SKIP_HOWTO): New. + (elf64_alpha_howto_table): Use it to remove dead ECOFF relocs. + Fix sizes of 16-bit mem format relocs. + (elf64_alpha_reloc_map): Update to match. + (elf64_alpha_relax_with_lituse): Use GPREL16 as appropriate. + (elf64_alpha_relax_without_lituse): Likewise. + (elf64_alpha_check_relocs): Handle GPREL16. + (elf64_alpha_relocate_section): Likewise. + * reloc.c (BFD_RELOC_ALPHA_USER_*): Remove. + (BFD_RELOC_ALPHA_GPREL_HI16, BFD_RELOC_ALPHA_GPREL_LO16): New. + * bfd-in2.h, libbfd.h: Rebuild. + +2001-09-04 Jeff Law + + * elf32-h8300.c (elf32_h8_relax_section): New function. + (elf32_h8_relax_delete_bytes): Likewise. + (elf32_h8_symbol_address_p): Likewise. + (elf32_h8_get_relocated_section_contents): Likewise. + (bfd_elf32_bfd_relax_section): Define. + (bfd_elf32_bfd_get_relocated_section_contents): Likewise. + + * elf32-h8300.c (special): New function. + (h8_elf_howto_table): Use it for SPECIAL_FUNCTION field in + all relocations. + (elf32_h8_final_link_relocate): Treat R_H8_DIR24A8 like 32bit + relocations. Fix problems with the true 24bit reloc R_H8_DIR24R8. + Fix minor problems with 8bit and 16bit PC relative relocations. + +2001-09-01 Andreas Jaeger + + * vms-tir.c: Add missing prototypes. + * vms-hdr.c: Likewise. + * vms-gsd.c: Likewise. + * vms-misc.c: Likewise. + +2001-08-31 H.J. Lu + + * elf32-mips.c (_bfd_mips_elf_check_relocs): Report filename + with bad relocation. + +2001-08-31 Eric Christopher + Jason Eckhardt + + * bfd/archures.c: Add mipsisa32 and mipsisa64. Remove mips32, + mips32_4k and mips64. + * bfd/aoutx.h: Remove bfd_mach_mips32, bfd_mach_mips32_4k, + bfd_mach_mips64. Add bfd_mach_mipsisa32, bfd_mach_mipsisa64. + * bfd/cpu-mips.c: Ditto. + * bfd/elf32-mips.c (_bfd_mips_elf_final_write_processing): Ditto. + * bfd/bfd-in2.h: Regenerate. + +2001-08-31 Jakub Jelinek + + * elf64-alpha.c (elf64_alpha_relocate_section): Duplicate memory + value into R_ALPHA_RELATIVE's addend. + (elf64_alpha_finish_dynamic_symbol): Likewise. + +2001-08-31 Nick Clifton + + * elf32-arm.h (elf32_arm_relocate_section): Do not rightshift + recomputed addend during relocatable link if not USE_REL. + + * elflink.h (elf_gc_propagate_vtable_entries_used): Fix off-by-one + error. + 2001-08-30 H.J. Lu * elf32-mips.c (mips_elf_calculate_relocation): Revert the last @@ -19,7 +1358,7 @@ 2001-08-29 Joel Sherrill - * config.bfd (i[3456]86-*-rtems*, m68*-*-rtems*): Change + * config.bfd (i[3456]86-*-rtems*, m68*-*-rtems*): Change default from coff to elf. 2001-08-29 Jeff Law @@ -47,8 +1386,8 @@ 2001-08-29 Tom Rix - * xcofflink.c (xcoff_link_add_symbols): Fix XTY_LD symbol that - does not follow a XTY_SD. + * xcofflink.c (xcoff_link_add_symbols): Fix XTY_LD symbol that + does not follow a XTY_SD. 2001-08-29 Alan Modra diff -uprN binutils-2.11.90.0.31/bfd/ChangeLog.linux binutils-2.11.92.0.5/bfd/ChangeLog.linux --- binutils-2.11.90.0.31/bfd/ChangeLog.linux Sat May 12 01:09:00 2001 +++ binutils-2.11.92.0.5/bfd/ChangeLog.linux Sun Oct 7 16:33:11 2001 @@ -1,3 +1,40 @@ +2001-10-07 Jakub Jelinek + + * elf32-ppc.c (ppc_elf_check_relocs): Don't output relocations + for debugging sections. + (ppc_elf_relocate_section): Likewise. + +2001-10-05 Alan Modra + + * elflink.h (elf_link_input_bfd): Don't fudge discarded link-once + section sym values. Instead fudge any relocs against them. + +2001-10-05 H.J. Lu + + * elf32-mips.c (mips_elf_calculate_relocation): Back out the + last change. + +2001-10-04 H.J. Lu + + * elf32-mips.c (mips_elf_calculate_relocation): Don't create + the dynamic relocation if a symbol is from a removed linkonce + section. + +2001-10-03 H.J. Lu + + * elflink.h (elf_link_check_versioned_symbol): Update types of + variables. + +2001-10-03 H.J. Lu + + * elflink.h (elf_link_check_versioned_symbol): Use bfd_bread + instead of bfd_read. + +2001-10-03 H.J. Lu + + * elflink.h (elf_merge_symbol): Allow a definition in a shared + object to override a weak definition in a regular object. + 2001-05-12 H.J. Lu * elf-bfd.h (elf_link_loaded_list): New structure. @@ -21,12 +58,12 @@ 2000-06-24 H.J. Lu - * bfd/cofflink.c (_bfd_coff_generic_relocate_section): Undo + * cofflink.c (_bfd_coff_generic_relocate_section): Undo the last change. 2000-06-24 H.J. Lu - * bfd/cofflink.c (_bfd_coff_generic_relocate_section): + * cofflink.c (_bfd_coff_generic_relocate_section): Compensate global relocations between .text$* sections within the same file. diff -uprN binutils-2.11.90.0.31/bfd/Makefile.am binutils-2.11.92.0.5/bfd/Makefile.am --- binutils-2.11.90.0.31/bfd/Makefile.am Thu Aug 30 09:30:36 2001 +++ binutils-2.11.92.0.5/bfd/Makefile.am Thu Oct 4 14:35:43 2001 @@ -504,7 +504,7 @@ SOURCE_HFILES = \ libaout.h libbfd.h libcoff.h libecoff.h libhppa.h \ libieee.h libnlm.h liboasys.h libpei.h netbsd.h nlm-target.h \ nlmcode.h nlmswap.h ns32k.h peicode.h som.h vms.h libxcoff.h \ - xcoff-target.h + xcoff-target.h version.h ## ... and all .h files which are in the build tree. BUILD_HFILES = \ @@ -627,12 +627,13 @@ pepigen.c : peXXigen.c sed -e s/XX/pep/g < $(srcdir)/peXXigen.c > pepigen.new mv -f pepigen.new pepigen.c -BFD_H_DEPS= $(INCDIR)/ansidecl.h +BFD_H_DEPS= $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h LOCAL_H_DEPS= libbfd.h sysdep.h config.h -$(BFD_LIBS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS) -$(BFD_MACHINES): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS) -$(BFD_BACKENDS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS) -$(OPTIONAL_BACKENDS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS) +$(BFD_LIBS) \ + $(ALL_MACHINES) \ + $(BFD32_BACKENDS) \ + $(BFD64_BACKENDS) \ + $(OPTIONAL_BACKENDS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS) # Install BFD include file, and others that it needs. install-data-local: $(BFD_H) @@ -640,8 +641,10 @@ install-data-local: $(BFD_H) $(mkinstalldirs) $(DESTDIR)$(includedir) $(INSTALL_DATA) $(BFD_H) $(DESTDIR)$(includedir)/bfd.h $(INSTALL_DATA) $(INCDIR)/ansidecl.h $(DESTDIR)$(includedir)/ansidecl.h + $(INSTALL_DATA) $(INCDIR)/symcat.h $(DESTDIR)$(includedir)/symcat.h $(INSTALL_DATA) $(INCDIR)/bfdlink.h $(DESTDIR)$(includedir)/bfdlink.h +Makefile: $(srcdir)/configure.in # Have to get rid of DEP1 here so that "$?" later includes all of $(CFILES). DEP: dep.sed $(CFILES) $(HFILES) bfd.h @@ -701,7 +704,7 @@ stmp-bfd-h: bfd-in3.h touch stmp-bfd-h BFD_H_FILES = bfd-in.h init.c opncls.c libbfd.c section.c archures.c \ - reloc.c syms.c bfd.c archive.c corefile.c targets.c format.c + reloc.c syms.c bfd.c archive.c corefile.c targets.c format.c version.h LIBBFD_H_FILES = libbfd-in.h init.c libbfd.c cache.c reloc.c archures.c elf.c LIBCOFF_H_FILES = libcoff-in.h coffcode.h @@ -756,12 +759,13 @@ config.status: $(srcdir)/configure $(src # DO NOT DELETE THIS LINE -- mkdep uses it. # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. archive.lo: archive.c $(INCDIR)/filenames.h $(INCDIR)/aout/ar.h \ - $(INCDIR)/aout/ranlib.h -archures.lo: archures.c $(INCDIR)/filenames.h + $(INCDIR)/aout/ranlib.h $(INCDIR)/safe-ctype.h +archures.lo: archures.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h bfd.lo: bfd.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h \ - libcoff.h libecoff.h $(INCDIR)/coff/ecoff.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h + $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/sym.h libcoff.h libecoff.h $(INCDIR)/coff/ecoff.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h cache.lo: cache.c $(INCDIR)/filenames.h coffgen.lo: coffgen.c $(INCDIR)/filenames.h $(INCDIR)/coff/internal.h \ libcoff.h $(INCDIR)/bfdlink.h @@ -772,19 +776,21 @@ libbfd.lo: libbfd.c $(INCDIR)/filenames. opncls.lo: opncls.c $(INCDIR)/filenames.h $(INCDIR)/objalloc.h reloc.lo: reloc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h section.lo: section.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h -syms.lo: syms.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def +syms.lo: syms.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def targets.lo: targets.c $(INCDIR)/filenames.h $(INCDIR)/fnmatch.h \ targmatch.h hash.lo: hash.c $(INCDIR)/filenames.h $(INCDIR)/objalloc.h linker.lo: linker.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ genlink.h -srec.lo: srec.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h -binary.lo: binary.c $(INCDIR)/filenames.h +srec.lo: srec.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ + $(INCDIR)/safe-ctype.h +binary.lo: binary.c $(INCDIR)/safe-ctype.h $(INCDIR)/filenames.h tekhex.lo: tekhex.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h -ihex.lo: ihex.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h +ihex.lo: ihex.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ + $(INCDIR)/safe-ctype.h stabs.lo: stabs.c $(INCDIR)/filenames.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def + $(INCDIR)/aout/stab.def $(INCDIR)/safe-ctype.h stab-syms.lo: stab-syms.c libaout.h $(INCDIR)/bfdlink.h \ $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab.def merge.lo: merge.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h @@ -830,7 +836,7 @@ cpu-sparc.lo: cpu-sparc.c $(INCDIR)/file cpu-tic30.lo: cpu-tic30.c $(INCDIR)/filenames.h cpu-tic54x.lo: cpu-tic54x.c $(INCDIR)/filenames.h cpu-tic80.lo: cpu-tic80.c $(INCDIR)/filenames.h -cpu-v850.lo: cpu-v850.c $(INCDIR)/filenames.h +cpu-v850.lo: cpu-v850.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h cpu-vax.lo: cpu-vax.c $(INCDIR)/filenames.h cpu-we32k.lo: cpu-we32k.c $(INCDIR)/filenames.h cpu-w65.lo: cpu-w65.c $(INCDIR)/filenames.h @@ -840,28 +846,31 @@ aout-adobe.lo: aout-adobe.c $(INCDIR)/fi $(INCDIR)/bfdlink.h aout-arm.lo: aout-arm.c $(INCDIR)/filenames.h libaout.h \ $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h aoutx.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ - aout-target.h + $(INCDIR)/safe-ctype.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h aout-target.h aout-cris.lo: aout-cris.c aout32.c aoutx.h $(INCDIR)/filenames.h \ - $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ - aout-target.h + $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h libaout.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h aout-target.h aout-ns32k.lo: aout-ns32k.c $(INCDIR)/aout/aout64.h \ - ns32k.h libaout.h $(INCDIR)/bfdlink.h + ns32k.h libaout.h $(INCDIR)/bfdlink.h aoutx.h $(INCDIR)/filenames.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h aout-sparcle.lo: aout-sparcle.c $(INCDIR)/bfdlink.h \ libaout.h aoutf1.h $(INCDIR)/filenames.h $(INCDIR)/aout/sun4.h \ $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ $(INCDIR)/aout/ar.h aout-target.h aout-tic30.lo: aout-tic30.c $(INCDIR)/filenames.h libaout.h \ $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aoutx.h + $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aoutx.h \ + $(INCDIR)/safe-ctype.h aout0.lo: aout0.c aoutf1.h $(INCDIR)/filenames.h $(INCDIR)/aout/sun4.h \ libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ aout-target.h -aout32.lo: aout32.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - libaout.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h +aout32.lo: aout32.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h armnetbsd.lo: armnetbsd.c netbsd.h $(INCDIR)/filenames.h \ libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h @@ -981,7 +990,7 @@ elf.lo: elf.c $(INCDIR)/filenames.h $(IN elf32-arc.lo: elf32-arc.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h $(INCDIR)/elf/arc.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h + $(INCDIR)/libiberty.h elf32-target.h elfarm-oabi.lo: elfarm-oabi.c $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h \ $(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ @@ -1013,10 +1022,10 @@ elf32-fr30.lo: elf32-fr30.c $(INCDIR)/fi elf32-gen.lo: elf32-gen.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h elf32-target.h -elf32-h8300.lo: elf32-h8300.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/h8.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h +elf32-h8300.lo: elf32-h8300.c $(INCDIR)/filenames.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/h8.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h elf32-hppa.lo: elf32-hppa.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h $(INCDIR)/elf/hppa.h $(INCDIR)/elf/reloc-macros.h \ @@ -1093,10 +1102,10 @@ elf32-sh.lo: elf32-sh.c $(INCDIR)/filena elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ elf32-target.h -elf32-sh-lin.lo: elf32-sh-lin.c elf32-sh.c $(INCDIR)/filenames.h \ - $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h \ - $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-sh-lin.lo: elf32-sh-lin.c $(INCDIR)/filenames.h \ + $(INCDIR)/elf/internal.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elf32-sh.c \ + $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h elf32-target.h elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \ @@ -1125,9 +1134,10 @@ hp300bsd.lo: hp300bsd.c $(INCDIR)/filena $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h hp300hpux.lo: hp300hpux.c $(INCDIR)/aout/hp300hpux.h \ - aoutx.h $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h libaout.h \ - $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ - $(INCDIR)/aout/ar.h aout-target.h + aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ + aout-target.h som.lo: som.c $(INCDIR)/alloca-conf.h $(INCDIR)/filenames.h i386aout.lo: i386aout.c $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \ libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/stab_gnu.h \ @@ -1136,9 +1146,9 @@ i386bsd.lo: i386bsd.c $(INCDIR)/filename $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h i386dynix.lo: i386dynix.c $(INCDIR)/aout/dynix3.h aoutx.h \ - $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h libaout.h \ - $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ - $(INCDIR)/aout/ar.h aout-target.h + $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h \ + libaout.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ + $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aout-target.h i386freebsd.lo: i386freebsd.c freebsd.h $(INCDIR)/filenames.h \ libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h @@ -1159,7 +1169,7 @@ i386mach3.lo: i386mach3.c $(INCDIR)/file i386os9k.lo: i386os9k.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ libaout.h $(INCDIR)/os9k.h ieee.lo: ieee.c $(INCDIR)/filenames.h $(INCDIR)/ieee.h \ - libieee.h + libieee.h $(INCDIR)/safe-ctype.h m68k4knetbsd.lo: m68k4knetbsd.c netbsd.h $(INCDIR)/filenames.h \ libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h @@ -1198,14 +1208,14 @@ nlm32.lo: nlm32.c nlmcode.h $(INCDIR)/fi ns32knetbsd.lo: ns32knetbsd.c netbsd.h $(INCDIR)/filenames.h \ libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -oasys.lo: oasys.c $(INCDIR)/filenames.h $(INCDIR)/oasys.h \ - liboasys.h +oasys.lo: oasys.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/oasys.h liboasys.h pc532-mach.lo: pc532-mach.c $(INCDIR)/filenames.h libaout.h \ $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h aout-target.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h pdp11.lo: pdp11.c $(INCDIR)/filenames.h libaout.h $(INCDIR)/bfdlink.h \ aout-target.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h + $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h $(INCDIR)/safe-ctype.h pe-arm.lo: pe-arm.c $(INCDIR)/filenames.h coff-arm.c \ $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ @@ -1255,7 +1265,7 @@ pei-mips.lo: pei-mips.c $(INCDIR)/filena $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ peicode.h libpei.h -ppcboot.lo: ppcboot.c $(INCDIR)/filenames.h +ppcboot.lo: ppcboot.c $(INCDIR)/safe-ctype.h $(INCDIR)/filenames.h reloc16.lo: reloc16.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ genlink.h $(INCDIR)/coff/internal.h libcoff.h riscix.lo: riscix.c $(INCDIR)/filenames.h libaout.h \ @@ -1284,7 +1294,7 @@ vms.lo: vms.c $(INCDIR)/filenames.h $(IN vms-gsd.lo: vms-gsd.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ vms.h vms-hdr.lo: vms-hdr.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - vms.h + $(INCDIR)/safe-ctype.h vms.h vms-misc.lo: vms-misc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ vms.h vms-tir.lo: vms-tir.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ @@ -1292,9 +1302,9 @@ vms-tir.lo: vms-tir.c $(INCDIR)/filename xcofflink.lo: xcofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h libcoff.h \ libxcoff.h -aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - libaout.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h +aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h coff-alpha.lo: coff-alpha.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \ $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h \ diff -uprN binutils-2.11.90.0.31/bfd/Makefile.in binutils-2.11.92.0.5/bfd/Makefile.in --- binutils-2.11.90.0.31/bfd/Makefile.in Thu Aug 30 09:30:36 2001 +++ binutils-2.11.92.0.5/bfd/Makefile.in Thu Oct 4 14:35:43 2001 @@ -116,6 +116,9 @@ all_backends = @all_backends@ bfd_backends = @bfd_backends@ bfd_default_target_size = @bfd_default_target_size@ bfd_machines = @bfd_machines@ +bfd_version = @bfd_version@ +bfd_version_date = @bfd_version_date@ +bfd_version_string = @bfd_version_string@ l = @l@ tdefaults = @tdefaults@ wordsize = @wordsize@ @@ -635,7 +638,7 @@ SOURCE_HFILES = \ libaout.h libbfd.h libcoff.h libecoff.h libhppa.h \ libieee.h libnlm.h liboasys.h libpei.h netbsd.h nlm-target.h \ nlmcode.h nlmswap.h ns32k.h peicode.h som.h vms.h libxcoff.h \ - xcoff-target.h + xcoff-target.h version.h BUILD_HFILES = \ @@ -666,11 +669,11 @@ libbfd_la_LDFLAGS = -release $(VERSION) noinst_LIBRARIES = libbfd.a libbfd_a_SOURCES = -BFD_H_DEPS = $(INCDIR)/ansidecl.h +BFD_H_DEPS = $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h LOCAL_H_DEPS = libbfd.h sysdep.h config.h BFD_H_FILES = bfd-in.h init.c opncls.c libbfd.c section.c archures.c \ - reloc.c syms.c bfd.c archive.c corefile.c targets.c format.c + reloc.c syms.c bfd.c archive.c corefile.c targets.c format.c version.h LIBBFD_H_FILES = libbfd-in.h init.c libbfd.c cache.c reloc.c archures.c elf.c LIBCOFF_H_FILES = libcoff-in.h coffcode.h @@ -713,7 +716,7 @@ configure.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = gtar +TAR = tar GZIP_ENV = --best SOURCES = $(libbfd_a_SOURCES) $(libbfd_la_SOURCES) OBJECTS = $(libbfd_a_OBJECTS) $(libbfd_la_OBJECTS) @@ -1182,10 +1185,11 @@ pepigen.c : peXXigen.c rm -f pepigen.c sed -e s/XX/pep/g < $(srcdir)/peXXigen.c > pepigen.new mv -f pepigen.new pepigen.c -$(BFD_LIBS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS) -$(BFD_MACHINES): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS) -$(BFD_BACKENDS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS) -$(OPTIONAL_BACKENDS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS) +$(BFD_LIBS) \ + $(ALL_MACHINES) \ + $(BFD32_BACKENDS) \ + $(BFD64_BACKENDS) \ + $(OPTIONAL_BACKENDS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS) # Install BFD include file, and others that it needs. install-data-local: $(BFD_H) @@ -1193,8 +1197,11 @@ install-data-local: $(BFD_H) $(mkinstalldirs) $(DESTDIR)$(includedir) $(INSTALL_DATA) $(BFD_H) $(DESTDIR)$(includedir)/bfd.h $(INSTALL_DATA) $(INCDIR)/ansidecl.h $(DESTDIR)$(includedir)/ansidecl.h + $(INSTALL_DATA) $(INCDIR)/symcat.h $(DESTDIR)$(includedir)/symcat.h $(INSTALL_DATA) $(INCDIR)/bfdlink.h $(DESTDIR)$(includedir)/bfdlink.h +Makefile: $(srcdir)/configure.in + # Have to get rid of DEP1 here so that "$?" later includes all of $(CFILES). DEP: dep.sed $(CFILES) $(HFILES) bfd.h rm -f DEP1 @@ -1295,12 +1302,13 @@ config.status: $(srcdir)/configure $(src # DO NOT DELETE THIS LINE -- mkdep uses it. # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. archive.lo: archive.c $(INCDIR)/filenames.h $(INCDIR)/aout/ar.h \ - $(INCDIR)/aout/ranlib.h -archures.lo: archures.c $(INCDIR)/filenames.h + $(INCDIR)/aout/ranlib.h $(INCDIR)/safe-ctype.h +archures.lo: archures.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h bfd.lo: bfd.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h \ - libcoff.h libecoff.h $(INCDIR)/coff/ecoff.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h + $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/sym.h libcoff.h libecoff.h $(INCDIR)/coff/ecoff.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h cache.lo: cache.c $(INCDIR)/filenames.h coffgen.lo: coffgen.c $(INCDIR)/filenames.h $(INCDIR)/coff/internal.h \ libcoff.h $(INCDIR)/bfdlink.h @@ -1311,19 +1319,21 @@ libbfd.lo: libbfd.c $(INCDIR)/filenames. opncls.lo: opncls.c $(INCDIR)/filenames.h $(INCDIR)/objalloc.h reloc.lo: reloc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h section.lo: section.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h -syms.lo: syms.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def +syms.lo: syms.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def targets.lo: targets.c $(INCDIR)/filenames.h $(INCDIR)/fnmatch.h \ targmatch.h hash.lo: hash.c $(INCDIR)/filenames.h $(INCDIR)/objalloc.h linker.lo: linker.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ genlink.h -srec.lo: srec.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h -binary.lo: binary.c $(INCDIR)/filenames.h +srec.lo: srec.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ + $(INCDIR)/safe-ctype.h +binary.lo: binary.c $(INCDIR)/safe-ctype.h $(INCDIR)/filenames.h tekhex.lo: tekhex.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h -ihex.lo: ihex.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h +ihex.lo: ihex.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ + $(INCDIR)/safe-ctype.h stabs.lo: stabs.c $(INCDIR)/filenames.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def + $(INCDIR)/aout/stab.def $(INCDIR)/safe-ctype.h stab-syms.lo: stab-syms.c libaout.h $(INCDIR)/bfdlink.h \ $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab.def merge.lo: merge.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h @@ -1369,7 +1379,7 @@ cpu-sparc.lo: cpu-sparc.c $(INCDIR)/file cpu-tic30.lo: cpu-tic30.c $(INCDIR)/filenames.h cpu-tic54x.lo: cpu-tic54x.c $(INCDIR)/filenames.h cpu-tic80.lo: cpu-tic80.c $(INCDIR)/filenames.h -cpu-v850.lo: cpu-v850.c $(INCDIR)/filenames.h +cpu-v850.lo: cpu-v850.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h cpu-vax.lo: cpu-vax.c $(INCDIR)/filenames.h cpu-we32k.lo: cpu-we32k.c $(INCDIR)/filenames.h cpu-w65.lo: cpu-w65.c $(INCDIR)/filenames.h @@ -1379,28 +1389,31 @@ aout-adobe.lo: aout-adobe.c $(INCDIR)/fi $(INCDIR)/bfdlink.h aout-arm.lo: aout-arm.c $(INCDIR)/filenames.h libaout.h \ $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h aoutx.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ - aout-target.h + $(INCDIR)/safe-ctype.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h aout-target.h aout-cris.lo: aout-cris.c aout32.c aoutx.h $(INCDIR)/filenames.h \ - $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ - aout-target.h + $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h libaout.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h aout-target.h aout-ns32k.lo: aout-ns32k.c $(INCDIR)/aout/aout64.h \ - ns32k.h libaout.h $(INCDIR)/bfdlink.h + ns32k.h libaout.h $(INCDIR)/bfdlink.h aoutx.h $(INCDIR)/filenames.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h aout-sparcle.lo: aout-sparcle.c $(INCDIR)/bfdlink.h \ libaout.h aoutf1.h $(INCDIR)/filenames.h $(INCDIR)/aout/sun4.h \ $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ $(INCDIR)/aout/ar.h aout-target.h aout-tic30.lo: aout-tic30.c $(INCDIR)/filenames.h libaout.h \ $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aoutx.h + $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aoutx.h \ + $(INCDIR)/safe-ctype.h aout0.lo: aout0.c aoutf1.h $(INCDIR)/filenames.h $(INCDIR)/aout/sun4.h \ libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ aout-target.h -aout32.lo: aout32.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - libaout.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h +aout32.lo: aout32.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h armnetbsd.lo: armnetbsd.c netbsd.h $(INCDIR)/filenames.h \ libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h @@ -1520,7 +1533,7 @@ elf.lo: elf.c $(INCDIR)/filenames.h $(IN elf32-arc.lo: elf32-arc.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h $(INCDIR)/elf/arc.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h + $(INCDIR)/libiberty.h elf32-target.h elfarm-oabi.lo: elfarm-oabi.c $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h \ $(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ @@ -1552,10 +1565,10 @@ elf32-fr30.lo: elf32-fr30.c $(INCDIR)/fi elf32-gen.lo: elf32-gen.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h elf32-target.h -elf32-h8300.lo: elf32-h8300.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/h8.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h +elf32-h8300.lo: elf32-h8300.c $(INCDIR)/filenames.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/h8.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h elf32-hppa.lo: elf32-hppa.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h $(INCDIR)/elf/hppa.h $(INCDIR)/elf/reloc-macros.h \ @@ -1632,10 +1645,10 @@ elf32-sh.lo: elf32-sh.c $(INCDIR)/filena elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ elf32-target.h -elf32-sh-lin.lo: elf32-sh-lin.c elf32-sh.c $(INCDIR)/filenames.h \ - $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h \ - $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-sh-lin.lo: elf32-sh-lin.c $(INCDIR)/filenames.h \ + $(INCDIR)/elf/internal.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elf32-sh.c \ + $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h elf32-target.h elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \ @@ -1664,9 +1677,10 @@ hp300bsd.lo: hp300bsd.c $(INCDIR)/filena $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h hp300hpux.lo: hp300hpux.c $(INCDIR)/aout/hp300hpux.h \ - aoutx.h $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h libaout.h \ - $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ - $(INCDIR)/aout/ar.h aout-target.h + aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ + aout-target.h som.lo: som.c $(INCDIR)/alloca-conf.h $(INCDIR)/filenames.h i386aout.lo: i386aout.c $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \ libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/stab_gnu.h \ @@ -1675,9 +1689,9 @@ i386bsd.lo: i386bsd.c $(INCDIR)/filename $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h i386dynix.lo: i386dynix.c $(INCDIR)/aout/dynix3.h aoutx.h \ - $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h libaout.h \ - $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ - $(INCDIR)/aout/ar.h aout-target.h + $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h \ + libaout.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ + $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aout-target.h i386freebsd.lo: i386freebsd.c freebsd.h $(INCDIR)/filenames.h \ libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h @@ -1698,7 +1712,7 @@ i386mach3.lo: i386mach3.c $(INCDIR)/file i386os9k.lo: i386os9k.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ libaout.h $(INCDIR)/os9k.h ieee.lo: ieee.c $(INCDIR)/filenames.h $(INCDIR)/ieee.h \ - libieee.h + libieee.h $(INCDIR)/safe-ctype.h m68k4knetbsd.lo: m68k4knetbsd.c netbsd.h $(INCDIR)/filenames.h \ libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h @@ -1737,14 +1751,14 @@ nlm32.lo: nlm32.c nlmcode.h $(INCDIR)/fi ns32knetbsd.lo: ns32knetbsd.c netbsd.h $(INCDIR)/filenames.h \ libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -oasys.lo: oasys.c $(INCDIR)/filenames.h $(INCDIR)/oasys.h \ - liboasys.h +oasys.lo: oasys.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/oasys.h liboasys.h pc532-mach.lo: pc532-mach.c $(INCDIR)/filenames.h libaout.h \ $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h aout-target.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h pdp11.lo: pdp11.c $(INCDIR)/filenames.h libaout.h $(INCDIR)/bfdlink.h \ aout-target.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h + $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h $(INCDIR)/safe-ctype.h pe-arm.lo: pe-arm.c $(INCDIR)/filenames.h coff-arm.c \ $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ @@ -1794,7 +1808,7 @@ pei-mips.lo: pei-mips.c $(INCDIR)/filena $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ peicode.h libpei.h -ppcboot.lo: ppcboot.c $(INCDIR)/filenames.h +ppcboot.lo: ppcboot.c $(INCDIR)/safe-ctype.h $(INCDIR)/filenames.h reloc16.lo: reloc16.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ genlink.h $(INCDIR)/coff/internal.h libcoff.h riscix.lo: riscix.c $(INCDIR)/filenames.h libaout.h \ @@ -1823,7 +1837,7 @@ vms.lo: vms.c $(INCDIR)/filenames.h $(IN vms-gsd.lo: vms-gsd.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ vms.h vms-hdr.lo: vms-hdr.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - vms.h + $(INCDIR)/safe-ctype.h vms.h vms-misc.lo: vms-misc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ vms.h vms-tir.lo: vms-tir.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ @@ -1831,9 +1845,9 @@ vms-tir.lo: vms-tir.c $(INCDIR)/filename xcofflink.lo: xcofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h libcoff.h \ libxcoff.h -aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - libaout.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h +aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h coff-alpha.lo: coff-alpha.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \ $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h \ diff -uprN binutils-2.11.90.0.31/bfd/aix386-core.c binutils-2.11.92.0.5/bfd/aix386-core.c --- binutils-2.11.90.0.31/bfd/aix386-core.c Fri Mar 9 11:15:25 2001 +++ binutils-2.11.92.0.5/bfd/aix386-core.c Mon Oct 1 15:25:20 2001 @@ -1,7 +1,8 @@ /* BFD back-end for AIX on PS/2 core files. This was based on trad-core.c, which was written by John Gilmore of Cygnus Support. - Copyright 1988, 1989, 1991, 1992, 1993, 1994, 1996, 1998, 1999, 2000 + Copyright 1988, 1989, 1991, 1992, 1993, 1994, 1996, 1998, 1999, 2000, + 2001 Free Software Foundation, Inc. Written by Minh Tran-Le . Converted to back end form by Ian Lance Taylor . @@ -72,14 +73,16 @@ aix386_core_file_p (abfd) { int i, n; unsigned char longbuf[4]; /* Raw bytes of various header fields */ - int core_size = sizeof (struct corehdr); + bfd_size_type core_size = sizeof (struct corehdr); + bfd_size_type amt; struct corehdr *core; struct mergem { struct trad_core_struct coredata; struct corehdr internal_core; } *mergem; - if (bfd_read ((PTR) longbuf, 1, sizeof (longbuf), abfd) != sizeof (longbuf)) + amt = sizeof (longbuf); + if (bfd_bread ((PTR) longbuf, amt, abfd) != amt) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -89,19 +92,21 @@ aix386_core_file_p (abfd) if (strncmp (longbuf, COR_MAGIC, 4)) return 0; - if (bfd_seek (abfd, 0L, false) < 0) + if (bfd_seek (abfd, (file_ptr) 0, 0) != 0) return 0; - mergem = (struct mergem *) bfd_zalloc (abfd, sizeof (struct mergem)); + amt = sizeof (struct mergem); + mergem = (struct mergem *) bfd_zalloc (abfd, amt); if (mergem == NULL) return 0; core = &mergem->internal_core; - if ((bfd_read ((PTR) core, 1, core_size, abfd)) != core_size) + if ((bfd_bread ((PTR) core, core_size, abfd)) != core_size) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); + loser: bfd_release (abfd, (char *) mergem); return 0; } @@ -111,38 +116,23 @@ aix386_core_file_p (abfd) /* Create the sections. This is raunchy, but bfd_close wants to reclaim them. */ - core_regsec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection)); + amt = sizeof (asection); + core_regsec (abfd) = (asection *) bfd_zalloc (abfd, amt); if (core_regsec (abfd) == NULL) - { - loser: - bfd_release (abfd, (char *) mergem); - return 0; - } - core_reg2sec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection)); + goto loser; + + core_reg2sec (abfd) = (asection *) bfd_zalloc (abfd, amt); if (core_reg2sec (abfd) == NULL) - { - loser1: - bfd_release (abfd, core_regsec (abfd)); - goto loser; - } + /* bfd_release frees everything allocated after it's arg. */ + goto loser; for (i = 0, n = 0; (i < MAX_CORE_SEGS) && (core->cd_segs[i].cs_type); i++) { if (core->cd_segs[i].cs_offset == 0) continue; - core_section (abfd, n) = - (asection *) bfd_zalloc (abfd, sizeof (asection)); + core_section (abfd, n) = (asection *) bfd_zalloc (abfd, amt); if (core_section (abfd, n) == NULL) - { - int j; - if (n > 0) - { - for (j = 0; j < n; j++) - bfd_release (abfd, core_section (abfd, j)); - } - bfd_release (abfd, (char *) mergem); - goto loser1; - } + goto loser; switch (core->cd_segs[i].cs_type) { @@ -193,8 +183,8 @@ aix386_core_file_p (abfd) core_regsec (abfd)->_raw_size = sizeof (core->cd_regs); core_reg2sec (abfd)->_raw_size = sizeof (core->cd_fpregs); - core_regsec (abfd)->vma = -1; - core_reg2sec (abfd)->vma = -1; + core_regsec (abfd)->vma = (bfd_vma) -1; + core_reg2sec (abfd)->vma = (bfd_vma) -1; /* We'll access the regs afresh in the core file, like any section. */ core_regsec (abfd)->filepos = @@ -243,15 +233,15 @@ swap_abort () abort (); } -#define NO_GET ((PROTO(bfd_vma, (*), ( const bfd_byte *))) swap_abort ) -#define NO_GETS ((PROTO(bfd_signed_vma, (*), (const bfd_byte *))) swap_abort ) -#define NO_PUT ((PROTO(void, (*), (bfd_vma, bfd_byte *))) swap_abort ) +#define NO_GET ((bfd_vma (*) PARAMS ((const bfd_byte *))) swap_abort) +#define NO_GETS ((bfd_signed_vma (*) PARAMS ((const bfd_byte *))) swap_abort) +#define NO_PUT ((void (*) PARAMS ((bfd_vma, bfd_byte *))) swap_abort) const bfd_target aix386_core_vec = { "aix386-core", bfd_target_unknown_flavour, BFD_ENDIAN_BIG, /* target byte order */ - BFD_ENDIANG_BIG, /* target headers byte order */ + BFD_ENDIAN_BIG, /* target headers byte order */ (HAS_RELOC | EXEC_P | /* object flags */ HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS | WP_TEXT), diff -uprN binutils-2.11.90.0.31/bfd/aout-adobe.c binutils-2.11.92.0.5/bfd/aout-adobe.c --- binutils-2.11.90.0.31/bfd/aout-adobe.c Wed Aug 22 08:52:09 2001 +++ binutils-2.11.92.0.5/bfd/aout-adobe.c Mon Oct 1 15:25:20 2001 @@ -39,16 +39,17 @@ static void aout_adobe_write_section static const bfd_target * aout_adobe_object_p PARAMS ((bfd *)); static boolean aout_adobe_mkobject PARAMS ((bfd *)); static boolean aout_adobe_write_object_contents PARAMS ((bfd *)); -static boolean aout_adobe_set_section_contents PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); -static boolean aout_adobe_set_arch_mach PARAMS ((bfd *, enum bfd_architecture, unsigned long)); +static boolean aout_adobe_set_section_contents + PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); +static boolean aout_adobe_set_arch_mach + PARAMS ((bfd *, enum bfd_architecture, unsigned long)); static int aout_adobe_sizeof_headers PARAMS ((bfd *, boolean)); /* Swaps the information in an executable header taken from a raw byte stream memory image, into the internal exec_header structure. */ void aout_adobe_swap_exec_header_in - PARAMS ((bfd *abfd, struct external_exec *raw_bytes, - struct internal_exec *execp)); + PARAMS ((bfd *, struct external_exec *, struct internal_exec *)); void aout_adobe_swap_exec_header_in (abfd, raw_bytes, execp) @@ -59,7 +60,7 @@ aout_adobe_swap_exec_header_in (abfd, ra struct external_exec *bytes = (struct external_exec *) raw_bytes; /* 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_info = H_GET_32 (abfd, bytes->e_info); execp->a_text = GET_WORD (abfd, bytes->e_text); execp->a_data = GET_WORD (abfd, bytes->e_data); execp->a_bss = GET_WORD (abfd, bytes->e_bss); @@ -72,10 +73,9 @@ aout_adobe_swap_exec_header_in (abfd, ra /* Swaps the information in an internal exec header structure into the supplied buffer ready for writing to disk. */ -PROTO(void, aout_adobe_swap_exec_header_out, - (bfd *abfd, - struct internal_exec *execp, - struct external_exec *raw_bytes)); +void aout_adobe_swap_exec_header_out + PARAMS ((bfd *, struct internal_exec *, struct external_exec *)); + void aout_adobe_swap_exec_header_out (abfd, execp, raw_bytes) bfd *abfd; @@ -86,7 +86,7 @@ aout_adobe_swap_exec_header_out (abfd, e /* 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); + 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); PUT_WORD (abfd, execp->a_bss , bytes->e_bss); @@ -103,16 +103,16 @@ aout_adobe_object_p (abfd) struct internal_exec anexec; struct external_exec exec_bytes; char *targ; + bfd_size_type amt = EXEC_BYTES_SIZE; - if (bfd_read ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd) - != EXEC_BYTES_SIZE) + if (bfd_bread ((PTR) &exec_bytes, amt, abfd) != amt) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); return 0; } - anexec.a_info = bfd_h_get_32 (abfd, exec_bytes.e_info); + anexec.a_info = H_GET_32 (abfd, exec_bytes.e_info); /* Normally we just compare for the magic number. However, a bunch of Adobe tools aren't fixed up yet; they generate @@ -154,7 +154,7 @@ aout_adobe_callback (abfd) flagword flags; /* Architecture and machine type -- unknown in this format. */ - bfd_set_arch_mach (abfd, bfd_arch_unknown, 0); + bfd_set_arch_mach (abfd, bfd_arch_unknown, 0L); /* The positions of the string table and symbol table. */ obj_str_filepos (abfd) = N_STROFF (*execp); @@ -163,7 +163,8 @@ aout_adobe_callback (abfd) /* Suck up the section information from the file, one section at a time. */ for (;;) { - if (bfd_read ((PTR) ext, 1, sizeof (*ext), abfd) != sizeof (*ext)) + bfd_size_type amt = sizeof (*ext); + if (bfd_bread ((PTR) ext, amt, abfd) != amt) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -193,7 +194,7 @@ aout_adobe_callback (abfd) default: (*_bfd_error_handler) (_("%s: Unknown section type in a.out.adobe file: %x\n"), - bfd_get_filename (abfd), ext->e_type[0]); + bfd_archive_filename (abfd), ext->e_type[0]); goto no_more_sections; } @@ -215,7 +216,8 @@ aout_adobe_callback (abfd) /* Fix the name, if it is a sprintf'd name. */ if (sect->name == try_again) { - newname = (char *) bfd_zalloc (abfd, strlen (sect->name)); + amt = strlen (sect->name); + newname = (char *) bfd_zalloc (abfd, amt); if (newname == NULL) return 0; strcpy (newname, sect->name); @@ -226,11 +228,11 @@ aout_adobe_callback (abfd) bfd_set_section_flags (abfd, sect, flags); /* Assumed big-endian. */ sect->_raw_size = ((ext->e_size[0] << 8) - | ext->e_size[1] << 8) - | ext->e_size[2]; + | ext->e_size[1] << 8 + | ext->e_size[2]); sect->_cooked_size = sect->_raw_size; - sect->vma = bfd_h_get_32 (abfd, ext->e_virtbase); - sect->filepos = bfd_h_get_32 (abfd, ext->e_filebase); + sect->vma = H_GET_32 (abfd, ext->e_virtbase); + sect->filepos = H_GET_32 (abfd, ext->e_filebase); /* FIXME XXX alignment? */ /* Set relocation information for first section of each type. */ @@ -273,8 +275,9 @@ aout_adobe_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, sizeof (struct bout_data_struct)); + rawptr = (struct bout_data_struct *) bfd_zalloc (abfd, amt); if (rawptr == NULL) return false; @@ -297,6 +300,7 @@ aout_adobe_write_object_contents (abfd) struct external_exec swapped_hdr; static struct external_segdesc sentinel[1]; /* Initialized to zero. */ asection *sect; + bfd_size_type amt; exec_hdr (abfd)->a_info = ZMAGIC; @@ -334,9 +338,9 @@ aout_adobe_write_object_contents (abfd) aout_adobe_swap_exec_header_out (abfd, exec_hdr (abfd), &swapped_hdr); + amt = EXEC_BYTES_SIZE; if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 - || (bfd_write ((PTR) &swapped_hdr, 1, EXEC_BYTES_SIZE, abfd) - != EXEC_BYTES_SIZE)) + || bfd_bwrite ((PTR) &swapped_hdr, amt, abfd) != amt) return false; /* Now write out the section information. Text first, data next, rest @@ -355,8 +359,8 @@ aout_adobe_write_object_contents (abfd) aout_adobe_write_section (abfd, sect); /* Write final `sentinel` section header (with type of 0). */ - if (bfd_write ((PTR) sentinel, 1, sizeof (*sentinel), abfd) - != sizeof (*sentinel)) + amt = sizeof (*sentinel); + if (bfd_bwrite ((PTR) sentinel, amt, abfd) != amt) return false; /* Now write out reloc info, followed by syms and strings. */ @@ -454,10 +458,10 @@ aout_adobe_set_section_contents (abfd, s if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0) return false; - if (count != 0) - return (bfd_write ((PTR) location, 1, count, abfd) == count) ? true : false; + if (count == 0) + return true; - return true; + return bfd_bwrite ((PTR) location, count, abfd) == count; } static boolean diff -uprN binutils-2.11.90.0.31/bfd/aout-arm.c binutils-2.11.92.0.5/bfd/aout-arm.c --- binutils-2.11.90.0.31/bfd/aout-arm.c Wed Aug 22 08:52:09 2001 +++ binutils-2.11.92.0.5/bfd/aout-arm.c Thu Oct 4 14:35:43 2001 @@ -21,25 +21,29 @@ Foundation, Inc., 59 Temple Place - Suit #include "bfd.h" #include "sysdep.h" + /* Avoid multiple defininitions from aoutx if supporting standarad a.out as well as our own. */ -#define NAME(x,y) CAT3(aoutarm,_32_,y) - -#include "libaout.h" -#include "aout/aout64.h" - -#define N_TXTADDR(x) \ - ((N_MAGIC(x) == NMAGIC) ? 0x8000 : \ - (N_MAGIC(x) != ZMAGIC) ? 0 : \ - (N_SHARED_LIB(x)) ? ((x).a_entry & ~(TARGET_PAGE_SIZE - 1)) : \ - TEXT_START_ADDR) +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define NAME(x,y) CONCAT3 (aoutarm,_32_,y) + +#define N_TXTADDR(x) \ + ((N_MAGIC (x) == NMAGIC) \ + ? (bfd_vma) 0x8000 \ + : ((N_MAGIC (x) != ZMAGIC) \ + ? (bfd_vma) 0 \ + : ((N_SHARED_LIB (x)) \ + ? ((x).a_entry & ~(bfd_vma) (TARGET_PAGE_SIZE - 1)) \ + : (bfd_vma) TEXT_START_ADDR))) #define TEXT_START_ADDR 0x8000 #define TARGET_PAGE_SIZE 0x8000 #define SEGMENT_SIZE TARGET_PAGE_SIZE #define DEFAULT_ARCH bfd_arch_arm -#define MY(OP) CAT(aoutarm_,OP) +#define MY(OP) CONCAT2 (aoutarm_,OP) #define N_BADMAG(x) ((((x).a_info & ~007200) != ZMAGIC) && \ (((x).a_info & ~006000) != OMAGIC) && \ ((x).a_info != NMAGIC)) @@ -47,15 +51,30 @@ Foundation, Inc., 59 Temple Place - Suit #define MY_bfd_reloc_type_lookup aoutarm_bfd_reloc_type_lookup -static boolean MY(write_object_contents) PARAMS ((bfd *)); -static bfd_reloc_status_type MY(fix_pcrel_26_done) PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static bfd_reloc_status_type MY(fix_pcrel_26) PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static void MY(swap_std_reloc_in) PARAMS ((bfd *, struct reloc_std_external *, arelent *, asymbol **, bfd_size_type)); -reloc_howto_type * MY(bfd_reloc_type_lookup) PARAMS ((bfd *, bfd_reloc_code_real_type)); -reloc_howto_type * MY(reloc_howto) PARAMS ((bfd *, struct reloc_std_external *, int *, int *, int *)); -void MY(put_reloc) PARAMS ((bfd *, int, int, long, reloc_howto_type *, struct reloc_std_external *)); -void MY(relocatable_reloc) PARAMS ((reloc_howto_type *, bfd *, struct reloc_std_external *, bfd_vma *, bfd_vma)); -void MY(swap_std_reloc_out) PARAMS ((bfd *, arelent *, struct reloc_std_external *)); +#include "libaout.h" +#include "aout/aout64.h" + +static boolean MY(write_object_contents) + PARAMS ((bfd *)); +static bfd_reloc_status_type MY(fix_pcrel_26_done) + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_reloc_status_type MY(fix_pcrel_26) + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static void MY(swap_std_reloc_in) + PARAMS ((bfd *, struct reloc_std_external *, arelent *, asymbol **, + bfd_size_type)); +reloc_howto_type *MY(bfd_reloc_type_lookup) + PARAMS ((bfd *, bfd_reloc_code_real_type)); +reloc_howto_type * MY(reloc_howto) + PARAMS ((bfd *, struct reloc_std_external *, int *, int *, int *)); +void MY(put_reloc) + PARAMS ((bfd *, int, int, bfd_vma, reloc_howto_type *, + struct reloc_std_external *)); +void MY(relocatable_reloc) + PARAMS ((reloc_howto_type *, bfd *, struct reloc_std_external *, bfd_vma *, + bfd_vma)); +void MY(swap_std_reloc_out) + PARAMS ((bfd *, arelent *, struct reloc_std_external *)); reloc_howto_type MY(howto_table)[] = { @@ -139,7 +158,7 @@ MY(put_reloc) (abfd, r_extern, r_index, bfd *abfd; int r_extern; int r_index; - long value; + bfd_vma value; reloc_howto_type *howto; struct reloc_std_external *reloc; { @@ -248,7 +267,7 @@ MY(fix_pcrel_26) (abfd, reloc_entry, sym { bfd_vma relocation; bfd_size_type addr = reloc_entry->address; - long target = bfd_get_32 (abfd, (bfd_byte *) data + addr); + bfd_vma target = bfd_get_32 (abfd, (bfd_byte *) data + addr); bfd_reloc_status_type flag = bfd_reloc_ok; /* If this is an undefined symbol, return error. */ @@ -280,10 +299,10 @@ MY(fix_pcrel_26) (abfd, reloc_entry, sym if ((relocation & ~ (bfd_vma) 0x03ffffff) != ~ (bfd_vma) 0x03ffffff) flag = bfd_reloc_overflow; } - else if (relocation & ~0x03ffffff) + else if (relocation & ~ (bfd_vma) 0x03ffffff) flag = bfd_reloc_overflow; - target &= ~0x00ffffff; + target &= ~ (bfd_vma) 0x00ffffff; target |= (relocation >> 2) & 0x00ffffff; bfd_put_32 (abfd, target, (bfd_byte *) data + addr); @@ -307,7 +326,7 @@ MY(bfd_reloc_type_lookup) (abfd,code) code = BFD_RELOC_32; break; default: - return (CONST struct reloc_howto_struct *) 0; + return (const struct reloc_howto_struct *) 0; } switch (code) @@ -319,7 +338,7 @@ MY(bfd_reloc_type_lookup) (abfd,code) ASTD (BFD_RELOC_16_PCREL, 5); ASTD (BFD_RELOC_32_PCREL, 6); default: - return (CONST struct reloc_howto_struct *) 0; + return (const struct reloc_howto_struct *) 0; } } @@ -345,7 +364,7 @@ MY_swap_std_reloc_in (abfd, bytes, cache int r_pcrel; struct aoutdata *su = &(abfd->tdata.aout_data->a); - cache_ptr->address = bfd_h_get_32 (abfd, bytes->r_address); + cache_ptr->address = H_GET_32 (abfd, bytes->r_address); cache_ptr->howto = MY_reloc_howto (abfd, bytes, r_index, r_extern, r_pcrel); @@ -539,7 +558,7 @@ const bfd_target aout_arm_big_vec = BFD_JUMP_TABLE_WRITE (MY), BFD_JUMP_TABLE_LINK (MY), BFD_JUMP_TABLE_DYNAMIC (MY), - + & aout_arm_little_vec, (PTR) MY_backend_data, diff -uprN binutils-2.11.90.0.31/bfd/aout-cris.c binutils-2.11.92.0.5/bfd/aout-cris.c --- binutils-2.11.90.0.31/bfd/aout-cris.c Sat Jun 2 23:14:34 2001 +++ binutils-2.11.92.0.5/bfd/aout-cris.c Thu Oct 4 14:35:43 2001 @@ -1,5 +1,5 @@ /* BFD backend for CRIS a.out binaries. - Copyright 2000 Free Software Foundation, Inc. + Copyright 2000, 2001 Free Software Foundation, Inc. Contributed by Axis Communications AB. Written by Hans-Peter Nilsson. @@ -37,7 +37,7 @@ Foundation, Inc., 59 Temple Place - Suit after text, but with those, we don't have any choice besides reading symbol info, and luckily there's no pressing need for correctness for those vma:s at this time. */ -#define N_TXTADDR(x) ((x).a_entry & ~0xffff) +#define N_TXTADDR(x) ((x).a_entry & ~(bfd_vma) 0xffff) /* If you change this to 4, you can not link to an address N*4+2. */ #define SEGMENT_SIZE 2 @@ -64,10 +64,11 @@ Foundation, Inc., 59 Temple Place - Suit /* The definition here seems not used; just provided as a convention. */ #define DEFAULT_ARCH bfd_arch_cris -/* ??? Spacing might be essential for the parameters in this macro. - Do Not Change. */ -#define MY(OP) CAT (cris_aout_,OP) -#define NAME(x,y) CAT3(cris_aout,_32_,y) +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (cris_aout_,OP) +#define NAME(x, y) CONCAT3 (cris_aout,_32_,y) #include "bfd.h" @@ -158,7 +159,7 @@ MY(swap_ext_reloc_out) (abfd, g, natptr) int r_index; int r_extern; unsigned int r_type; - unsigned int r_addend; + bfd_vma r_addend; asymbol *sym = *(g->sym_ptr_ptr); asection *output_section = sym->section->output_section; @@ -249,7 +250,7 @@ MY(swap_ext_reloc_in) (abfd, bytes, cach if (r_type > 2) { (*_bfd_error_handler) (_("%s: Invalid relocation type imported: %d"), - bfd_get_filename (abfd), r_type); + bfd_archive_filename (abfd), r_type); bfd_set_error(bfd_error_wrong_format); } @@ -260,7 +261,7 @@ MY(swap_ext_reloc_in) (abfd, bytes, cach { (*_bfd_error_handler) (_("%s: Bad relocation record imported: %d"), - bfd_get_filename (abfd), r_index); + bfd_archive_filename (abfd), r_index); bfd_set_error (bfd_error_wrong_format); diff -uprN binutils-2.11.90.0.31/bfd/aout-encap.c binutils-2.11.92.0.5/bfd/aout-encap.c --- binutils-2.11.90.0.31/bfd/aout-encap.c Fri Mar 9 11:15:25 2001 +++ binutils-2.11.92.0.5/bfd/aout-encap.c Mon Oct 1 15:25:20 2001 @@ -1,5 +1,6 @@ /* BFD back-end for a.out files encapsulated with COFF headers. - Copyright 1990, 1991, 1994, 1995, 2000 Free Software Foundation, Inc. + Copyright 1990, 1991, 1994, 1995, 2000, 2001 + Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -27,9 +28,9 @@ Foundation, Inc., 59 Temple Place - Suit #endif #include "bfd.h" -#include +#include "sysdep.h" #include "libbfd.h" -#include +#include "aout/aout64.h" #include "aout/stab_gnu.h" #include "aout/ar.h" #include "libaout.h" /* BFD a.out internal data structures */ @@ -45,33 +46,34 @@ encap_object_p (abfd) short coff_magic; struct external_exec exec_bytes; struct internal_exec exec; + bfd_size_type amt = sizeof (magicbuf); - if (bfd_read ((PTR)magicbuf, 1, sizeof (magicbuf), abfd) != - sizeof (magicbuf)) + if (bfd_bread ((PTR) magicbuf, amt, abfd) != amt) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); return 0; } - coff_magic = bfd_h_get_16 (abfd, magicbuf); + coff_magic = H_GET_16 (abfd, magicbuf); if (coff_magic != COFF_MAGIC) return 0; /* Not an encap coff file */ - __header_offset_temp==COFF_MAGIC ? sizeof (struct coffheader) : 0) - (fseek ((f), HEADER_OFFSET((f)), 1)) + magic = H_GET_32 (abfd, magicbuf); - magic = bfd_h_get_32 (abfd, magicbuf); - - if (N_BADMAG (*((struct internal_exec *) &magic))) return 0; + if (N_BADMAG (*((struct internal_exec *) &magic))) + return 0; - struct external_exec exec_bytes; - if (bfd_read ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd) - != EXEC_BYTES_SIZE) { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_wrong_format); + if (bfd_seek (abfd, (file_ptr) sizeof (struct coffheader), SEEK_SET) != 0) return 0; - } + + amt = EXEC_BYTES_SIZE; + if (bfd_bread ((PTR) &exec_bytes, amt, abfd) != amt) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return 0; + } NAME(aout,swap_exec_header_in) (abfd, &exec_bytes, &exec); return aout_32_some_aout_object_p (abfd, &exec, encap_realcallback); @@ -90,24 +92,26 @@ encap_real_callback (abfd) text_start and exec_data_start. This is particularly useful for remote debugging of embedded systems. */ if (N_FLAGS(exec_aouthdr) & N_FLAGS_COFF_ENCAPSULATE) - { - struct coffheader ch; - int val; - val = lseek (execchan, -(sizeof (AOUTHDR) + sizeof (ch)), 1); - if (val == -1) - perror_with_name (filename); - val = myread (execchan, &ch, sizeof (ch)); - if (val < 0) - perror_with_name (filename); - text_start = ch.text_start; - exec_data_start = ch.data_start; - } else - { - text_start = - IS_OBJECT_FILE (exec_aouthdr) ? 0 : N_TXTADDR (exec_aouthdr); - exec_data_start = IS_OBJECT_FILE (exec_aouthdr) - ? exec_aouthdr.a_text : N_DATADDR (exec_aouthdr); - } + { + struct coffheader ch; + int val; + val = lseek (execchan, -(sizeof (AOUTHDR) + sizeof (ch)), 1); + if (val == -1) + perror_with_name (filename); + val = myread (execchan, &ch, sizeof (ch)); + if (val < 0) + perror_with_name (filename); + text_start = ch.text_start; + exec_data_start = ch.data_start; + } + else + { + text_start = + IS_OBJECT_FILE (exec_aouthdr) ? 0 : N_TXTADDR (exec_aouthdr); + exec_data_start = (IS_OBJECT_FILE (exec_aouthdr) + ? exec_aouthdr.a_text + : N_DATADDR (exec_aouthdr)); + } /* Determine the architecture and machine type of the object file. */ bfd_default_set_arch_mach(abfd, bfd_arch_m68k, 0); /* FIXME */ @@ -127,10 +131,10 @@ encap_write_object_contents (abfd) struct external_exec exec_bytes; struct internal_exec *execp = exec_hdr (abfd); -/****** FIXME: Fragments from the old GNU LD program for dealing with - encap coff. */ -struct coffheader coffheader; -int need_coff_header; + /* FIXME: Fragments from the old GNU LD program for dealing with + encap coff. */ + struct coffheader coffheader; + int need_coff_header; /* Determine whether to count the header as part of the text size, and initialize the text size accordingly. diff -uprN binutils-2.11.90.0.31/bfd/aout-ns32k.c binutils-2.11.92.0.5/bfd/aout-ns32k.c --- binutils-2.11.90.0.31/bfd/aout-ns32k.c Wed Aug 22 08:52:09 2001 +++ binutils-2.11.92.0.5/bfd/aout-ns32k.c Thu Oct 4 14:35:43 2001 @@ -25,7 +25,11 @@ Foundation, Inc., 59 Temple Place - Suit #include "aout/aout64.h" #include "ns32k.h" -#define MYNS(OP) CAT(ns32kaout_,OP) +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MYNS(OP) CONCAT2 (ns32kaout_,OP) + reloc_howto_type * MYNS(bfd_reloc_type_lookup) PARAMS((bfd *abfd AND @@ -37,7 +41,7 @@ MYNS(write_object_contents) /* Avoid multiple definitions from aoutx if supporting standard a.out format(s) as well as this one. */ -#define NAME(x,y) CAT3(ns32kaout,_32_,y) +#define NAME(x,y) CONCAT3 (ns32kaout,_32_,y) void bfd_ns32k_arch PARAMS ((void)); @@ -59,7 +63,7 @@ reloc_howto_type * MY(reloc_howto) PARAMS ((bfd *, struct reloc_std_external *, int *, int *, int *)); void -MY(put_reloc) PARAMS ((bfd *, int, int, long, reloc_howto_type *, +MY(put_reloc) PARAMS ((bfd *, int, int, bfd_vma, reloc_howto_type *, struct reloc_std_external *)); /* The ns32k series is ah, unusual, when it comes to relocation. @@ -78,16 +82,16 @@ MY(put_reloc) PARAMS ((bfd *, int, int, pointer, the static base register and general purpose register etc. For example: - + sym1: .long . # pc relative 2's complement sym1: .long foo # 2's complement not pc relative - + self: movd @self, r0 # pc relative displacement movd foo, r0 # non pc relative displacement self: movd self, r0 # pc relative immediate movd foo, r0 # non pc relative immediate - + In addition, for historical reasons the encoding of the relocation types in the a.out format relocation entries is such that even the relocation methods which are standard are not encoded the standard way. */ @@ -180,14 +184,15 @@ MY(reloc_howto) (abfd, rel, r_index, r_e return (MY(howto_table) + r_length + 3 * (*r_pcrel) + 6 * r_ns32k_type); } -#define MY_reloc_howto(BFD,REL,IN,EX,PC) MY(reloc_howto) (BFD, REL, &IN, &EX, &PC) +#define MY_reloc_howto(BFD, REL, IN, EX, PC) \ + MY(reloc_howto) (BFD, REL, &IN, &EX, &PC) void MY(put_reloc) (abfd, r_extern, r_index, value, howto, reloc) bfd *abfd; int r_extern; int r_index; - long value; + bfd_vma value; reloc_howto_type *howto; struct reloc_std_external *reloc; { @@ -219,7 +224,7 @@ MY(put_reloc) (abfd, r_extern, r_index, #define MY_final_link_relocate _bfd_ns32k_final_link_relocate #define MY_relocate_contents _bfd_ns32k_relocate_contents -#include +#include "aoutx.h" reloc_howto_type * MY(bfd_reloc_type_lookup) (abfd,code) @@ -280,7 +285,7 @@ MY_swap_std_reloc_in (abfd, bytes, cache int r_pcrel; struct aoutdata *su = &(abfd->tdata.aout_data->a); - cache_ptr->address = bfd_h_get_32 (abfd, bytes->r_address); + cache_ptr->address = H_GET_32 (abfd, bytes->r_address); /* Now the fun stuff. */ cache_ptr->howto = MY_reloc_howto(abfd, bytes, r_index, r_extern, r_pcrel); @@ -349,8 +354,8 @@ _bfd_ns32k_relocate_contents (howto, inp bfd_byte *location; { int r_ns32k_type = (howto - MY(howto_table)) / 6; - long (*get_data) PARAMS ((bfd_byte *, long, long)); - int (*put_data) PARAMS ((long, bfd_byte *, long, long)); + bfd_vma (*get_data) PARAMS ((bfd_byte *, int)); + int (*put_data) PARAMS ((bfd_vma, bfd_byte *, int)); switch (r_ns32k_type) { diff -uprN binutils-2.11.90.0.31/bfd/aout-sparcle.c binutils-2.11.92.0.5/bfd/aout-sparcle.c --- binutils-2.11.90.0.31/bfd/aout-sparcle.c Fri Mar 9 11:15:25 2001 +++ binutils-2.11.92.0.5/bfd/aout-sparcle.c Thu Oct 4 14:35:43 2001 @@ -1,5 +1,5 @@ /* BFD backend for sparc little-endian aout binaries. - Copyright 1996 Free Software Foundation, Inc. + Copyright 1996, 2001 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -19,7 +19,11 @@ along with this program; if not, write t Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define TARGETNAME "a.out-sparc-little" -#define MY(OP) CAT(sparcle_aout_,OP) + +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (sparcle_aout_,OP) #include "bfd.h" #include "bfdlink.h" diff -uprN binutils-2.11.90.0.31/bfd/aout-target.h binutils-2.11.92.0.5/bfd/aout-target.h --- binutils-2.11.90.0.31/bfd/aout-target.h Wed Aug 22 08:52:09 2001 +++ binutils-2.11.92.0.5/bfd/aout-target.h Mon Oct 1 15:25:20 2001 @@ -88,9 +88,9 @@ MY(callback) (abfd) /* Determine the architecture and machine type of the object file. */ #ifdef SET_ARCH_MACH - SET_ARCH_MACH(abfd, *execp); + SET_ARCH_MACH (abfd, *execp); #else - bfd_default_set_arch_mach(abfd, DEFAULT_ARCH, 0); + bfd_default_set_arch_mach (abfd, DEFAULT_ARCH, 0); #endif /* The number of relocation records. This must be called after @@ -146,13 +146,14 @@ MY(object_p) (abfd) struct external_exec exec_bytes; /* Raw exec header from file */ struct internal_exec exec; /* Cleaned-up exec header */ const bfd_target *target; + bfd_size_type amt = EXEC_BYTES_SIZE; - if (bfd_read ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd) - != EXEC_BYTES_SIZE) { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_wrong_format); - return 0; - } + if (bfd_bread ((PTR) &exec_bytes, amt, abfd) != amt) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return 0; + } #ifdef SWAP_MAGIC exec.a_info = SWAP_MAGIC (exec_bytes.e_info); @@ -328,7 +329,7 @@ MY(set_sizes) (abfd) #define MY_finish_dynamic_link 0 #endif -static CONST struct aout_backend_data MY(backend_data) = { +static const struct aout_backend_data MY(backend_data) = { MY_zmagic_contiguous, MY_text_includes_header, MY_entry_is_text_address, diff -uprN binutils-2.11.90.0.31/bfd/aout-tic30.c binutils-2.11.92.0.5/bfd/aout-tic30.c --- binutils-2.11.90.0.31/bfd/aout-tic30.c Wed Aug 22 08:52:09 2001 +++ binutils-2.11.92.0.5/bfd/aout-tic30.c Thu Oct 4 14:35:43 2001 @@ -28,9 +28,12 @@ #define DEFAULT_ARCH bfd_arch_tic30 #define ARCH_SIZE 32 -#define MY(OP) CAT(tic30_aout_,OP) +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (tic30_aout_,OP) #define TARGETNAME "a.out-tic30" -#define NAME(x,y) CAT3(tic30_aout,_32_,y) +#define NAME(x,y) CONCAT3 (tic30_aout,_32_,y) #include "bfd.h" #include "sysdep.h" @@ -57,13 +60,18 @@ static const bfd_target *tic30_aout_obje static boolean tic30_aout_write_object_contents PARAMS ((bfd *)); static boolean tic30_aout_set_sizes PARAMS ((bfd *)); static const bfd_target * tic30_aout_callback PARAMS ((bfd *)); -static boolean MY_bfd_copy_private_section_data PARAMS ((bfd *, asection *, bfd *, asection *)); +static boolean MY_bfd_copy_private_section_data + PARAMS ((bfd *, asection *, bfd *, asection *)); static boolean MY_bfd_final_link PARAMS ((bfd *, struct bfd_link_info *)); -reloc_howto_type * tic30_aout_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type)); -enum machine_type tic30_aout_machine_type PARAMS ((enum bfd_architecture, unsigned long, boolean *)); -boolean tic30_aout_set_arch_mach PARAMS ((bfd *, enum bfd_architecture, unsigned long)); +reloc_howto_type * tic30_aout_reloc_type_lookup + PARAMS ((bfd *, bfd_reloc_code_real_type)); +enum machine_type tic30_aout_machine_type + PARAMS ((enum bfd_architecture, unsigned long, boolean *)); +boolean tic30_aout_set_arch_mach + PARAMS ((bfd *, enum bfd_architecture, unsigned long)); -#define MY_reloc_howto(BFD,REL,IN,EX,PC) tic30_aout_reloc_howto(BFD,REL,&IN,&EX,&PC) +#define MY_reloc_howto(BFD, REL, IN, EX, PC) \ + tic30_aout_reloc_howto(BFD, REL, &IN, &EX, &PC) #define MY_final_link_relocate tic30_aout_final_link_relocate #define MY_object_p tic30_aout_object_p #define MY_mkobject NAME(aout,mkobject) @@ -107,7 +115,7 @@ boolean tic30_aout_set_arch_mach PARAMS #define MY_finish_dynamic_link 0 #endif -static CONST struct aout_backend_data tic30_aout_backend_data = +static const struct aout_backend_data tic30_aout_backend_data = { MY_zmagic_contiguous, MY_text_includes_header, @@ -352,7 +360,7 @@ tic30_aout_callback (abfd) #ifdef SET_ARCH_MACH SET_ARCH_MACH (abfd, *execp); #else - bfd_default_set_arch_mach (abfd, DEFAULT_ARCH, 0); + bfd_default_set_arch_mach (abfd, DEFAULT_ARCH, 0L); #endif /* Now that we know the architecture, set the alignments of the @@ -496,7 +504,9 @@ tic30_aout_relocate_contents (howto, inp case complain_overflow_bitfield: { bfd_vma reloc_bits = (((1 << (howto->bitsize - 1)) - 1) << 1) | 1; - if ((check & ~reloc_bits) != 0 && (((bfd_vma) signed_check & ~reloc_bits) != (-1 & ~reloc_bits))) + if ((check & ~reloc_bits) != 0 + && (((bfd_vma) signed_check & ~reloc_bits) + != ((bfd_vma) -1 & ~reloc_bits))) overflow = true; } break; @@ -538,9 +548,9 @@ tic30_aout_object_p (abfd) struct external_exec exec_bytes; /* Raw exec header from file. */ struct internal_exec exec; /* Cleaned-up exec header. */ const bfd_target *target; + bfd_size_type amt = EXEC_BYTES_SIZE; - if (bfd_read ((PTR) & exec_bytes, 1, EXEC_BYTES_SIZE, abfd) - != EXEC_BYTES_SIZE) + if (bfd_bread ((PTR) &exec_bytes, amt, abfd) != amt) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -550,7 +560,7 @@ tic30_aout_object_p (abfd) #ifdef SWAP_MAGIC exec.a_info = SWAP_MAGIC (exec_bytes.e_info); #else - exec.a_info = bfd_h_get_32 (abfd, exec_bytes.e_info); + exec.a_info = H_GET_32 (abfd, exec_bytes.e_info); #endif /* SWAP_MAGIC */ if (N_BADMAG (exec)) @@ -638,9 +648,11 @@ tic30_aout_write_object_contents (abfd) if (adata (abfd).exec_bytes_size > 0) { + bfd_size_type amt; if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) return false; - if (bfd_write ((PTR) & exec_bytes, 1, adata (abfd).exec_bytes_size, abfd) != adata (abfd).exec_bytes_size) + amt = adata (abfd).exec_bytes_size; + if (bfd_bwrite ((PTR) &exec_bytes, amt, abfd) != amt) return false; } diff -uprN binutils-2.11.90.0.31/bfd/aout0.c binutils-2.11.92.0.5/bfd/aout0.c --- binutils-2.11.90.0.31/bfd/aout0.c Fri Mar 9 11:15:25 2001 +++ binutils-2.11.92.0.5/bfd/aout0.c Thu Oct 4 14:35:43 2001 @@ -1,5 +1,5 @@ /* BFD backend for SunOS style a.out with flags set to 0 - Copyright 1990, 1991, 1992, 1993, 1994, 1995 + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 2001 Free Software Foundation, Inc. Written by Cygnus Support. @@ -20,7 +20,11 @@ along with this program; if not, write t Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define TARGETNAME "a.out-zero-big" -#define MY(OP) CAT(aout0_big_,OP) + +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (aout0_big_,OP) #include "bfd.h" diff -uprN binutils-2.11.90.0.31/bfd/aoutf1.h binutils-2.11.92.0.5/bfd/aoutf1.h --- binutils-2.11.90.0.31/bfd/aoutf1.h Mon Aug 27 11:44:50 2001 +++ binutils-2.11.92.0.5/bfd/aoutf1.h Mon Oct 1 15:25:20 2001 @@ -1,5 +1,6 @@ /* A.out "format 1" file handling code for BFD. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000 + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, + 2001 Free Software Foundation, Inc. Written by Cygnus Support. @@ -75,7 +76,7 @@ The name put into the target vector. #endif static boolean sunos_merge_private_bfd_data PARAMS ((bfd *, bfd *)); -static void sunos_set_arch_mach PARAMS ((bfd *, int)); +static void sunos_set_arch_mach PARAMS ((bfd *, enum machine_type)); static void choose_reloc_size PARAMS ((bfd *)); static boolean sunos_write_object_contents PARAMS ((bfd *)); static const bfd_target *sunos4_core_file_p PARAMS ((bfd *)); @@ -113,11 +114,11 @@ sunos_merge_private_bfd_data (ibfd, obfd static void sunos_set_arch_mach (abfd, machtype) bfd *abfd; - int machtype; + enum machine_type machtype; { /* Determine the architecture and machine type of the object file. */ enum bfd_architecture arch; - long machine; + unsigned long machine; switch (machtype) { @@ -422,8 +423,8 @@ swapcore_sun3 (abfd, ext, intcore) { struct external_sun3_core *extcore = (struct external_sun3_core *) ext; - intcore->c_magic = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_magic); - intcore->c_len = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_len); + intcore->c_magic = H_GET_32 (abfd, &extcore->c_magic); + intcore->c_len = H_GET_32 (abfd, &extcore->c_len); intcore->c_regs_pos = (long) (((struct external_sun3_core *) 0)->c_regs); intcore->c_regs_size = sizeof (extcore->c_regs); #if ARCH_SIZE == 64 @@ -432,20 +433,21 @@ swapcore_sun3 (abfd, ext, intcore) aout_32_swap_exec_header_in #endif (abfd, &extcore->c_aouthdr, &intcore->c_aouthdr); - intcore->c_signo = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_signo); - intcore->c_tsize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_tsize); - intcore->c_dsize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_dsize); + intcore->c_signo = H_GET_32 (abfd, &extcore->c_signo); + intcore->c_tsize = H_GET_32 (abfd, &extcore->c_tsize); + intcore->c_dsize = H_GET_32 (abfd, &extcore->c_dsize); intcore->c_data_addr = N_DATADDR (intcore->c_aouthdr); - intcore->c_ssize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_ssize); + intcore->c_ssize = H_GET_32 (abfd, &extcore->c_ssize); memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname)); intcore->fp_stuff_pos = (long) (((struct external_sun3_core *) 0)->fp_stuff); /* FP stuff takes up whole rest of struct, except c_ucode. */ intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) - (file_ptr) (((struct external_sun3_core *) 0)->fp_stuff); /* Ucode is the last thing in the struct -- just before the end */ - intcore->c_ucode = - bfd_h_get_32 (abfd, - intcore->c_len - sizeof (extcore->c_ucode) + (unsigned char *) extcore); + intcore->c_ucode = H_GET_32 (abfd, + (intcore->c_len + - sizeof (extcore->c_ucode) + + (unsigned char *) extcore)); intcore->c_stacktop = 0x0E000000; /* By experimentation */ } @@ -458,8 +460,8 @@ swapcore_sparc (abfd, ext, intcore) { struct external_sparc_core *extcore = (struct external_sparc_core *) ext; - intcore->c_magic = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_magic); - intcore->c_len = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_len); + intcore->c_magic = H_GET_32 (abfd, &extcore->c_magic); + intcore->c_len = H_GET_32 (abfd, &extcore->c_len); intcore->c_regs_pos = (long) (((struct external_sparc_core *) 0)->c_regs); intcore->c_regs_size = sizeof (extcore->c_regs); #if ARCH_SIZE == 64 @@ -468,20 +470,21 @@ swapcore_sparc (abfd, ext, intcore) aout_32_swap_exec_header_in #endif (abfd, &extcore->c_aouthdr, &intcore->c_aouthdr); - intcore->c_signo = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_signo); - intcore->c_tsize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_tsize); - intcore->c_dsize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_dsize); + intcore->c_signo = H_GET_32 (abfd, &extcore->c_signo); + intcore->c_tsize = H_GET_32 (abfd, &extcore->c_tsize); + intcore->c_dsize = H_GET_32 (abfd, &extcore->c_dsize); intcore->c_data_addr = N_DATADDR (intcore->c_aouthdr); - intcore->c_ssize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_ssize); + intcore->c_ssize = H_GET_32 (abfd, &extcore->c_ssize); memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname)); intcore->fp_stuff_pos = (long) (((struct external_sparc_core *) 0)->fp_stuff); /* FP stuff takes up whole rest of struct, except c_ucode. */ intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) - (file_ptr) (((struct external_sparc_core *) 0)->fp_stuff); /* Ucode is the last thing in the struct -- just before the end */ - intcore->c_ucode = - bfd_h_get_32 (abfd, - intcore->c_len - sizeof (extcore->c_ucode) + (unsigned char *) extcore); + intcore->c_ucode = H_GET_32 (abfd, + (intcore->c_len + - sizeof (extcore->c_ucode) + + (unsigned char *) extcore)); /* Supposedly the user stack grows downward from the bottom of kernel memory. Presuming that this remains true, this definition will work. */ @@ -499,8 +502,7 @@ swapcore_sparc (abfd, ext, intcore) #define SPARC_USRSTACK_SPARC2 ((bfd_vma)0xf8000000) #define SPARC_USRSTACK_SPARC10 ((bfd_vma)0xf0000000) { - bfd_vma sp = bfd_h_get_32 - (abfd, (unsigned char *) &((struct regs *) &extcore->c_regs[0])->r_o6); + bfd_vma sp = H_GET_32 (abfd, &((struct regs *) &extcore->c_regs[0])->r_o6); if (sp < SPARC_USRSTACK_SPARC10) intcore->c_stacktop = SPARC_USRSTACK_SPARC10; else @@ -518,8 +520,8 @@ swapcore_solaris_bcp (abfd, ext, intcore struct external_solaris_bcp_core *extcore = (struct external_solaris_bcp_core *) ext; - intcore->c_magic = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_magic); - intcore->c_len = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_len); + intcore->c_magic = H_GET_32 (abfd, &extcore->c_magic); + intcore->c_len = H_GET_32 (abfd, &extcore->c_len); intcore->c_regs_pos = (long) (((struct external_solaris_bcp_core *) 0)->c_regs); intcore->c_regs_size = sizeof (extcore->c_regs); @@ -534,12 +536,11 @@ swapcore_solaris_bcp (abfd, ext, intcore the data section is written from address zero instead of the data start address. */ memset ((PTR) &intcore->c_aouthdr, 0, sizeof (struct internal_exec)); - intcore->c_data_addr = - bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_exdata_datorg); - intcore->c_signo = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_signo); - intcore->c_tsize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_tsize); - intcore->c_dsize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_dsize); - intcore->c_ssize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_ssize); + intcore->c_data_addr = H_GET_32 (abfd, &extcore->c_exdata_datorg); + intcore->c_signo = H_GET_32 (abfd, &extcore->c_signo); + intcore->c_tsize = H_GET_32 (abfd, &extcore->c_tsize); + intcore->c_dsize = H_GET_32 (abfd, &extcore->c_dsize); + intcore->c_ssize = H_GET_32 (abfd, &extcore->c_ssize); memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname)); intcore->fp_stuff_pos = (long) (((struct external_solaris_bcp_core *) 0)->fp_stuff); @@ -547,9 +548,10 @@ swapcore_solaris_bcp (abfd, ext, intcore intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) - (file_ptr) (((struct external_solaris_bcp_core *) 0)->fp_stuff); /* Ucode is the last thing in the struct -- just before the end */ - intcore->c_ucode = - bfd_h_get_32 (abfd, - intcore->c_len - sizeof (extcore->c_ucode) + (unsigned char *) extcore); + intcore->c_ucode = H_GET_32 (abfd, + (intcore->c_len + - sizeof (extcore->c_ucode) + + (unsigned char *) extcore)); /* Supposedly the user stack grows downward from the bottom of kernel memory. Presuming that this remains true, this definition will work. */ @@ -567,8 +569,7 @@ swapcore_solaris_bcp (abfd, ext, intcore #define SPARC_USRSTACK_SPARC2 ((bfd_vma)0xf8000000) #define SPARC_USRSTACK_SPARC10 ((bfd_vma)0xf0000000) { - bfd_vma sp = bfd_h_get_32 - (abfd, (unsigned char *) &((struct regs *) &extcore->c_regs[0])->r_o6); + bfd_vma sp = H_GET_32 (abfd, &((struct regs *) &extcore->c_regs[0])->r_o6); if (sp < SPARC_USRSTACK_SPARC10) intcore->c_stacktop = SPARC_USRSTACK_SPARC10; else @@ -598,7 +599,7 @@ sunos4_core_file_p (abfd) bfd *abfd; { unsigned char longbuf[4]; /* Raw bytes of various header fields */ - bfd_size_type core_size; + bfd_size_type core_size, amt; unsigned long core_mag; struct internal_sunos_core *core; char *extcore; @@ -607,37 +608,38 @@ sunos4_core_file_p (abfd) struct sun_core_struct suncoredata; struct internal_sunos_core internal_sunos_core; char external_core[1]; - } - *mergem; + } *mergem; - if (bfd_read ((PTR) longbuf, 1, sizeof (longbuf), abfd) != - sizeof (longbuf)) + if (bfd_bread ((PTR) longbuf, (bfd_size_type) sizeof (longbuf), abfd) + != sizeof (longbuf)) return 0; - core_mag = bfd_h_get_32 (abfd, longbuf); + core_mag = H_GET_32 (abfd, longbuf); if (core_mag != CORE_MAGIC) return 0; /* SunOS core headers can vary in length; second word is size; */ - if (bfd_read ((PTR) longbuf, 1, sizeof (longbuf), abfd) != - sizeof (longbuf)) + if (bfd_bread ((PTR) longbuf, (bfd_size_type) sizeof (longbuf), abfd) + != sizeof (longbuf)) return 0; - core_size = bfd_h_get_32 (abfd, longbuf); + core_size = H_GET_32 (abfd, longbuf); /* Sanity check */ if (core_size > 20000) return 0; - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) < 0) + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) return 0; - mergem = (struct mergem *) bfd_zalloc (abfd, core_size + sizeof (struct mergem)); + amt = core_size + sizeof (struct mergem); + mergem = (struct mergem *) bfd_zalloc (abfd, amt); if (mergem == NULL) return 0; extcore = mergem->external_core; - if ((bfd_read ((PTR) extcore, 1, core_size, abfd)) != core_size) + if ((bfd_bread ((PTR) extcore, core_size, abfd)) != core_size) { + loser: bfd_release (abfd, (char *) mergem); return 0; } @@ -659,8 +661,7 @@ sunos4_core_file_p (abfd) break; default: bfd_set_error (bfd_error_system_call); /* FIXME */ - bfd_release (abfd, (char *) mergem); - return 0; + goto loser; } abfd->tdata.sun_core_data = &mergem->suncoredata; @@ -668,33 +669,23 @@ sunos4_core_file_p (abfd) /* create the sections. This is raunchy, but bfd_close wants to reclaim them */ - core_stacksec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection)); + amt = sizeof (asection); + core_stacksec (abfd) = (asection *) bfd_zalloc (abfd, amt); if (core_stacksec (abfd) == NULL) - { - loser: - bfd_release (abfd, (char *) mergem); - return 0; - } - core_datasec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection)); + /* bfd_release frees everything allocated after it's arg. */ + goto loser; + + core_datasec (abfd) = (asection *) bfd_zalloc (abfd, amt); if (core_datasec (abfd) == NULL) - { - loser1: - bfd_release (abfd, core_stacksec (abfd)); - goto loser; - } - core_regsec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection)); + goto loser; + + core_regsec (abfd) = (asection *) bfd_zalloc (abfd, amt); if (core_regsec (abfd) == NULL) - { - loser2: - bfd_release (abfd, core_datasec (abfd)); - goto loser1; - } - core_reg2sec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection)); + goto loser; + + core_reg2sec (abfd) = (asection *) bfd_zalloc (abfd, amt); if (core_reg2sec (abfd) == NULL) - { - bfd_release (abfd, core_regsec (abfd)); - goto loser2; - } + goto loser; core_stacksec (abfd)->name = ".stack"; core_datasec (abfd)->name = ".data"; @@ -822,7 +813,7 @@ sunos4_set_sizes (abfd) #define MY_finish_dynamic_link 0 #endif -static CONST struct aout_backend_data sunos4_aout_backend = +static const struct aout_backend_data sunos4_aout_backend = { 0, /* zmagic files are not contiguous */ 1, /* text includes header */ diff -uprN binutils-2.11.90.0.31/bfd/aoutx.h binutils-2.11.92.0.5/bfd/aoutx.h --- binutils-2.11.90.0.31/bfd/aoutx.h Mon Aug 27 11:44:50 2001 +++ binutils-2.11.92.0.5/bfd/aoutx.h Mon Oct 1 15:25:20 2001 @@ -120,9 +120,9 @@ DESCRIPTION #define KEEPIT udata.i -#include #include "bfd.h" #include "sysdep.h" +#include "safe-ctype.h" #include "bfdlink.h" #include "libaout.h" @@ -139,7 +139,8 @@ static boolean translate_to_native_sym_f static void adjust_o_magic PARAMS ((bfd *, struct internal_exec *)); static void adjust_z_magic PARAMS ((bfd *, struct internal_exec *)); static void adjust_n_magic PARAMS ((bfd *, struct internal_exec *)); -reloc_howto_type * NAME(aout,reloc_type_lookup) PARAMS ((bfd *, bfd_reloc_code_real_type)); +reloc_howto_type * NAME(aout,reloc_type_lookup) + PARAMS ((bfd *, bfd_reloc_code_real_type)); /* SUBSECTION @@ -157,9 +158,10 @@ DESCRIPTION */ #ifndef CTOR_TABLE_RELOC_HOWTO #define CTOR_TABLE_RELOC_IDX 2 -#define CTOR_TABLE_RELOC_HOWTO(BFD) ((obj_reloc_entry_size(BFD) == RELOC_EXT_SIZE \ - ? howto_table_ext : howto_table_std) \ - + CTOR_TABLE_RELOC_IDX) +#define CTOR_TABLE_RELOC_HOWTO(BFD) \ + ((obj_reloc_entry_size (BFD) == RELOC_EXT_SIZE \ + ? howto_table_ext : howto_table_std) \ + + CTOR_TABLE_RELOC_IDX) #endif #ifndef MY_swap_std_reloc_in @@ -226,23 +228,23 @@ reloc_howto_type howto_table_ext[] = reloc_howto_type howto_table_std[] = { /* type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask pcdone */ -HOWTO( 0, 0, 0, 8, false, 0, complain_overflow_bitfield,0,"8", true, 0x000000ff,0x000000ff, false), -HOWTO( 1, 0, 1, 16, false, 0, complain_overflow_bitfield,0,"16", true, 0x0000ffff,0x0000ffff, false), -HOWTO( 2, 0, 2, 32, false, 0, complain_overflow_bitfield,0,"32", true, 0xffffffff,0xffffffff, false), -HOWTO( 3, 0, 4, 64, false, 0, complain_overflow_bitfield,0,"64", true, 0xdeaddead,0xdeaddead, false), -HOWTO( 4, 0, 0, 8, true, 0, complain_overflow_signed, 0,"DISP8", true, 0x000000ff,0x000000ff, false), -HOWTO( 5, 0, 1, 16, true, 0, complain_overflow_signed, 0,"DISP16", true, 0x0000ffff,0x0000ffff, false), -HOWTO( 6, 0, 2, 32, true, 0, complain_overflow_signed, 0,"DISP32", true, 0xffffffff,0xffffffff, false), -HOWTO( 7, 0, 4, 64, true, 0, complain_overflow_signed, 0,"DISP64", true, 0xfeedface,0xfeedface, false), -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), +HOWTO ( 0, 0, 0, 8, false, 0, complain_overflow_bitfield,0,"8", true, 0x000000ff,0x000000ff, false), +HOWTO ( 1, 0, 1, 16, false, 0, complain_overflow_bitfield,0,"16", true, 0x0000ffff,0x0000ffff, false), +HOWTO ( 2, 0, 2, 32, false, 0, complain_overflow_bitfield,0,"32", true, 0xffffffff,0xffffffff, false), +HOWTO ( 3, 0, 4, 64, false, 0, complain_overflow_bitfield,0,"64", true, 0xdeaddead,0xdeaddead, false), +HOWTO ( 4, 0, 0, 8, true, 0, complain_overflow_signed, 0,"DISP8", true, 0x000000ff,0x000000ff, false), +HOWTO ( 5, 0, 1, 16, true, 0, complain_overflow_signed, 0,"DISP16", true, 0x0000ffff,0x0000ffff, false), +HOWTO ( 6, 0, 2, 32, true, 0, complain_overflow_signed, 0,"DISP32", true, 0xffffffff,0xffffffff, false), +HOWTO ( 7, 0, 4, 64, true, 0, complain_overflow_signed, 0,"DISP64", true, 0xfeedface,0xfeedface, false), +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), 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), + HOWTO (16, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"JMP_TABLE", false, 0,0x00000000, false), EMPTY_HOWTO (-1), EMPTY_HOWTO (-1), EMPTY_HOWTO (-1), @@ -258,7 +260,7 @@ 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), + HOWTO (32, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"RELATIVE", false, 0,0x00000000, false), EMPTY_HOWTO (-1), EMPTY_HOWTO (-1), EMPTY_HOWTO (-1), @@ -266,18 +268,18 @@ 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), + HOWTO (40, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"BASEREL", false, 0,0x00000000, false), }; -#define TABLE_SIZE(TABLE) (sizeof (TABLE)/sizeof (TABLE[0])) +#define TABLE_SIZE(TABLE) (sizeof (TABLE) / sizeof (TABLE[0])) reloc_howto_type * NAME(aout,reloc_type_lookup) (abfd,code) bfd *abfd; bfd_reloc_code_real_type code; { -#define EXT(i,j) case i: return &howto_table_ext[j] -#define STD(i,j) case i: return &howto_table_std[j] +#define EXT(i, j) case i: return &howto_table_ext[j] +#define STD(i, j) case i: return &howto_table_std[j] int ext = obj_reloc_entry_size (abfd) == RELOC_EXT_SIZE; if (code == BFD_RELOC_CTOR) switch (bfd_get_arch_info (abfd)->bits_per_address) @@ -367,7 +369,7 @@ NAME(aout,swap_exec_header_in) (abfd, ra are memcmp'd, and thus the contents do matter. */ 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_info = H_GET_32 (abfd, bytes->e_info); execp->a_text = GET_WORD (abfd, bytes->e_text); execp->a_data = GET_WORD (abfd, bytes->e_data); execp->a_bss = GET_WORD (abfd, bytes->e_bss); @@ -402,7 +404,7 @@ NAME(aout,swap_exec_header_out) (abfd, e struct external_exec *bytes = (struct external_exec *)raw_bytes; /* 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); + 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); PUT_WORD (abfd, execp->a_bss , bytes->e_bss); @@ -455,8 +457,9 @@ NAME(aout,some_aout_object_p) (abfd, exe { struct aout_data_struct *rawptr, *oldrawptr; const bfd_target *result; + bfd_size_type amt = sizeof (struct aout_data_struct); - rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, sizeof (struct aout_data_struct )); + rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, amt); if (rawptr == NULL) return 0; @@ -481,7 +484,7 @@ NAME(aout,some_aout_object_p) (abfd, exe /* Setting of EXEC_P has been deferred to the bottom of this function */ if (execp->a_syms) abfd->flags |= HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS; - if (N_DYNAMIC(*execp)) + if (N_DYNAMIC (*execp)) abfd->flags |= DYNAMIC; if (N_MAGIC (*execp) == ZMAGIC) @@ -558,37 +561,38 @@ NAME(aout,some_aout_object_p) (abfd, exe struct exec *execp = exec_hdr (abfd); - obj_textsec (abfd)->size = N_TXTSIZE(*execp); - obj_textsec (abfd)->raw_size = N_TXTSIZE(*execp); + obj_textsec (abfd)->size = N_TXTSIZE (*execp); + obj_textsec (abfd)->raw_size = N_TXTSIZE (*execp); /* data and bss are already filled in since they're so standard */ /* The virtual memory addresses of the sections */ - obj_textsec (abfd)->vma = N_TXTADDR(*execp); - obj_datasec (abfd)->vma = N_DATADDR(*execp); - obj_bsssec (abfd)->vma = N_BSSADDR(*execp); + obj_textsec (abfd)->vma = N_TXTADDR (*execp); + obj_datasec (abfd)->vma = N_DATADDR (*execp); + obj_bsssec (abfd)->vma = N_BSSADDR (*execp); /* The file offsets of the sections */ - obj_textsec (abfd)->filepos = N_TXTOFF(*execp); - obj_datasec (abfd)->filepos = N_DATOFF(*execp); + obj_textsec (abfd)->filepos = N_TXTOFF (*execp); + obj_datasec (abfd)->filepos = N_DATOFF (*execp); /* The file offsets of the relocation info */ - obj_textsec (abfd)->rel_filepos = N_TRELOFF(*execp); - obj_datasec (abfd)->rel_filepos = N_DRELOFF(*execp); + obj_textsec (abfd)->rel_filepos = N_TRELOFF (*execp); + obj_datasec (abfd)->rel_filepos = N_DRELOFF (*execp); /* The file offsets of the string table and symbol table. */ obj_str_filepos (abfd) = N_STROFF (*execp); obj_sym_filepos (abfd) = N_SYMOFF (*execp); /* Determine the architecture and machine type of the object file. */ - switch (N_MACHTYPE (*exec_hdr (abfd))) { - default: - abfd->obj_arch = bfd_arch_obscure; - break; - } + switch (N_MACHTYPE (*exec_hdr (abfd))) + { + default: + abfd->obj_arch = bfd_arch_obscure; + break; + } - adata(abfd)->page_size = TARGET_PAGE_SIZE; - adata(abfd)->segment_size = SEGMENT_SIZE; - adata(abfd)->exec_bytes_size = EXEC_BYTES_SIZE; + adata (abfd)->page_size = TARGET_PAGE_SIZE; + adata (abfd)->segment_size = SEGMENT_SIZE; + adata (abfd)->exec_bytes_size = EXEC_BYTES_SIZE; return abfd->xvec; @@ -620,8 +624,9 @@ NAME(aout,some_aout_object_p) (abfd, exe sets the entry point, and that is likely to be non-zero for most systems. */ if (execp->a_entry != 0 - || (execp->a_entry >= obj_textsec(abfd)->vma - && execp->a_entry < obj_textsec(abfd)->vma + obj_textsec(abfd)->_raw_size)) + || (execp->a_entry >= obj_textsec (abfd)->vma + && execp->a_entry < (obj_textsec (abfd)->vma + + obj_textsec (abfd)->_raw_size))) abfd->flags |= EXEC_P; #ifdef STAT_FOR_EXEC else @@ -637,7 +642,7 @@ NAME(aout,some_aout_object_p) (abfd, exe issue. Many kernels are loaded at non standard addresses. */ if (abfd->iostream != NULL && (abfd->flags & BFD_IN_MEMORY) == 0 - && (fstat(fileno((FILE *) (abfd->iostream)), &stat_buf) == 0) + && (fstat (fileno ((FILE *) (abfd->iostream)), &stat_buf) == 0) && ((stat_buf.st_mode & 0111) != 0)) abfd->flags |= EXEC_P; } @@ -674,22 +679,21 @@ boolean NAME(aout,mkobject) (abfd) bfd *abfd; { - struct aout_data_struct *rawptr; + struct aout_data_struct *rawptr; + bfd_size_type amt = sizeof (struct aout_data_struct); 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 )); - + rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, amt); if (rawptr == NULL) return false; abfd->tdata.aout_data = rawptr; exec_hdr (abfd) = &(rawptr->e); - obj_textsec (abfd) = (asection *)NULL; - obj_datasec (abfd) = (asection *)NULL; - obj_bsssec (abfd) = (asection *)NULL; + obj_textsec (abfd) = (asection *) NULL; + obj_datasec (abfd) = (asection *) NULL; + obj_bsssec (abfd) = (asection *) NULL; return true; } @@ -724,95 +728,102 @@ NAME(aout,machine_type) (arch, machine, arch_flags = M_UNKNOWN; *unknown = true; - switch (arch) { - case bfd_arch_sparc: - 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) - arch_flags = M_SPARCLET; - break; - - case bfd_arch_m68k: - switch (machine) { - case 0: arch_flags = M_68010; break; - case bfd_mach_m68000: arch_flags = M_UNKNOWN; *unknown = false; break; - case bfd_mach_m68010: arch_flags = M_68010; break; - case bfd_mach_m68020: arch_flags = M_68020; break; - default: arch_flags = M_UNKNOWN; break; - } - break; - - case bfd_arch_i386: - if (machine == 0) arch_flags = M_386; - break; - - case bfd_arch_a29k: - if (machine == 0) arch_flags = M_29K; - break; - - case bfd_arch_arm: - if (machine == 0) arch_flags = M_ARM; - break; - - case bfd_arch_mips: - switch (machine) { - case 0: - case bfd_mach_mips3000: - case bfd_mach_mips3900: - arch_flags = M_MIPS1; + switch (arch) + { + case bfd_arch_sparc: + 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) + arch_flags = M_SPARCLET; break; - case bfd_mach_mips6000: - arch_flags = M_MIPS2; + + case bfd_arch_m68k: + switch (machine) + { + case 0: arch_flags = M_68010; break; + case bfd_mach_m68000: arch_flags = M_UNKNOWN; *unknown = false; break; + case bfd_mach_m68010: arch_flags = M_68010; break; + case bfd_mach_m68020: arch_flags = M_68020; break; + default: arch_flags = M_UNKNOWN; break; + } 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_mips12000: - case bfd_mach_mips16: - case bfd_mach_mips32: - case bfd_mach_mips32_4k: - case bfd_mach_mips5: - case bfd_mach_mips64: - case bfd_mach_mips_sb1: - /* FIXME: These should be MIPS3, MIPS4, MIPS16, MIPS32, etc. */ - arch_flags = M_MIPS2; + + case bfd_arch_i386: + if (machine == 0) + arch_flags = M_386; break; - default: - arch_flags = M_UNKNOWN; + + case bfd_arch_a29k: + if (machine == 0) + arch_flags = M_29K; break; - } - break; - case bfd_arch_ns32k: - switch (machine) { - case 0: arch_flags = M_NS32532; break; - case 32032: arch_flags = M_NS32032; break; - case 32532: arch_flags = M_NS32532; break; - default: arch_flags = M_UNKNOWN; break; - } - break; + case bfd_arch_arm: + if (machine == 0) + arch_flags = M_ARM; + break; - case bfd_arch_vax: - *unknown = false; - break; + case bfd_arch_mips: + switch (machine) + { + case 0: + 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_mips12000: + case bfd_mach_mips16: + case bfd_mach_mipsisa32: + case bfd_mach_mips5: + case bfd_mach_mipsisa64: + case bfd_mach_mips_sb1: + /* FIXME: These should be MIPS3, MIPS4, MIPS16, MIPS32, etc. */ + arch_flags = M_MIPS2; + break; + default: + arch_flags = M_UNKNOWN; + break; + } + break; - case bfd_arch_cris: - if (machine == 0 || machine == 255) arch_flags = M_CRIS; - break; + case bfd_arch_ns32k: + switch (machine) + { + case 0: arch_flags = M_NS32532; break; + case 32032: arch_flags = M_NS32032; break; + case 32532: arch_flags = M_NS32532; break; + default: arch_flags = M_UNKNOWN; break; + } + break; - default: - arch_flags = M_UNKNOWN; - } + case bfd_arch_vax: + *unknown = false; + break; + + case bfd_arch_cris: + if (machine == 0 || machine == 255) + arch_flags = M_CRIS; + break; + + default: + arch_flags = M_UNKNOWN; + } if (arch_flags != M_UNKNOWN) *unknown = false; @@ -855,18 +866,19 @@ NAME(aout,set_arch_mach) (abfd, arch, ma } /* Determine the size of a relocation entry */ - switch (arch) { - case bfd_arch_sparc: - case bfd_arch_a29k: - case bfd_arch_mips: - obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE; - break; - default: - obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; - break; - } + switch (arch) + { + case bfd_arch_sparc: + case bfd_arch_a29k: + case bfd_arch_mips: + obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE; + break; + default: + obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; + break; + } - return (*aout_backend_info(abfd)->set_sizes) (abfd); + return (*aout_backend_info (abfd)->set_sizes) (abfd); } static void @@ -879,42 +891,42 @@ adjust_o_magic (abfd, execp) int pad = 0; /* Text. */ - obj_textsec(abfd)->filepos = pos; - if (!obj_textsec(abfd)->user_set_vma) - obj_textsec(abfd)->vma = vma; + obj_textsec (abfd)->filepos = pos; + if (!obj_textsec (abfd)->user_set_vma) + obj_textsec (abfd)->vma = vma; else - vma = obj_textsec(abfd)->vma; + vma = obj_textsec (abfd)->vma; - pos += obj_textsec(abfd)->_raw_size; - vma += obj_textsec(abfd)->_raw_size; + pos += obj_textsec (abfd)->_raw_size; + vma += obj_textsec (abfd)->_raw_size; /* Data. */ - if (!obj_datasec(abfd)->user_set_vma) + 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; + pad = align_power (vma, obj_datasec (abfd)->alignment_power) - vma; #endif - obj_textsec(abfd)->_raw_size += pad; + obj_textsec (abfd)->_raw_size += pad; pos += pad; vma += pad; - obj_datasec(abfd)->vma = vma; + obj_datasec (abfd)->vma = vma; } else - vma = obj_datasec(abfd)->vma; - obj_datasec(abfd)->filepos = pos; - pos += obj_datasec(abfd)->_raw_size; - vma += obj_datasec(abfd)->_raw_size; + vma = obj_datasec (abfd)->vma; + obj_datasec (abfd)->filepos = pos; + pos += obj_datasec (abfd)->_raw_size; + vma += obj_datasec (abfd)->_raw_size; /* BSS. */ - if (!obj_bsssec(abfd)->user_set_vma) + if (!obj_bsssec (abfd)->user_set_vma) { #if 0 - pad = align_power (vma, obj_bsssec(abfd)->alignment_power) - vma; + pad = align_power (vma, obj_bsssec (abfd)->alignment_power) - vma; #endif - obj_datasec(abfd)->_raw_size += pad; + obj_datasec (abfd)->_raw_size += pad; pos += pad; vma += pad; - obj_bsssec(abfd)->vma = vma; + obj_bsssec (abfd)->vma = vma; } else { @@ -928,12 +940,12 @@ adjust_o_magic (abfd, execp) pos += pad; } } - obj_bsssec(abfd)->filepos = pos; + obj_bsssec (abfd)->filepos = pos; /* Fix up the exec header. */ - execp->a_text = obj_textsec(abfd)->_raw_size; - execp->a_data = obj_datasec(abfd)->_raw_size; - execp->a_bss = obj_bsssec(abfd)->_raw_size; + execp->a_text = obj_textsec (abfd)->_raw_size; + execp->a_data = obj_datasec (abfd)->_raw_size; + execp->a_bss = obj_bsssec (abfd)->_raw_size; N_SET_MAGIC (*execp, OMAGIC); } @@ -944,7 +956,7 @@ adjust_z_magic (abfd, execp) { bfd_size_type data_pad, text_pad; file_ptr text_end; - CONST struct aout_backend_data *abdp; + const struct aout_backend_data *abdp; int ztih; /* Nonzero if text includes exec header. */ abdp = aout_backend_info (abfd); @@ -953,18 +965,18 @@ adjust_z_magic (abfd, execp) ztih = (abdp != NULL && (abdp->text_includes_header || obj_aout_subformat (abfd) == q_magic_format)); - obj_textsec(abfd)->filepos = (ztih - ? adata(abfd).exec_bytes_size - : adata(abfd).zmagic_disk_block_size); - if (! obj_textsec(abfd)->user_set_vma) + obj_textsec (abfd)->filepos = (ztih + ? adata (abfd).exec_bytes_size + : adata (abfd).zmagic_disk_block_size); + if (! obj_textsec (abfd)->user_set_vma) { /* ?? Do we really need to check for relocs here? */ - obj_textsec(abfd)->vma = ((abfd->flags & HAS_RELOC) - ? 0 - : (ztih - ? (abdp->default_text_vma - + adata(abfd).exec_bytes_size) - : abdp->default_text_vma)); + obj_textsec (abfd)->vma = ((abfd->flags & HAS_RELOC) + ? 0 + : (ztih + ? (abdp->default_text_vma + + adata (abfd).exec_bytes_size) + : abdp->default_text_vma)); text_pad = 0; } else @@ -995,15 +1007,15 @@ adjust_z_magic (abfd, execp) text_pad += BFD_ALIGN (text_end, adata (abfd).page_size) - text_end; text_end += obj_textsec (abfd)->filepos; } - obj_textsec(abfd)->_raw_size += text_pad; + obj_textsec (abfd)->_raw_size += text_pad; text_end += text_pad; /* Data. */ - if (!obj_datasec(abfd)->user_set_vma) + if (!obj_datasec (abfd)->user_set_vma) { bfd_vma vma; - vma = obj_textsec(abfd)->vma + obj_textsec(abfd)->_raw_size; - obj_datasec(abfd)->vma = BFD_ALIGN (vma, adata(abfd).segment_size); + vma = obj_textsec (abfd)->vma + obj_textsec (abfd)->_raw_size; + obj_datasec (abfd)->vma = BFD_ALIGN (vma, adata (abfd).segment_size); } if (abdp && abdp->zmagic_mapped_contiguous) { @@ -1016,30 +1028,30 @@ adjust_z_magic (abfd, execp) if (text_pad > 0) text->_raw_size += text_pad; } - obj_datasec(abfd)->filepos = (obj_textsec(abfd)->filepos - + obj_textsec(abfd)->_raw_size); + obj_datasec (abfd)->filepos = (obj_textsec (abfd)->filepos + + obj_textsec (abfd)->_raw_size); /* Fix up exec header while we're at it. */ - execp->a_text = obj_textsec(abfd)->_raw_size; + execp->a_text = obj_textsec (abfd)->_raw_size; if (ztih && (!abdp || (abdp && !abdp->exec_header_not_counted))) - execp->a_text += adata(abfd).exec_bytes_size; + execp->a_text += adata (abfd).exec_bytes_size; if (obj_aout_subformat (abfd) == q_magic_format) N_SET_MAGIC (*execp, QMAGIC); else N_SET_MAGIC (*execp, ZMAGIC); /* Spec says data section should be rounded up to page boundary. */ - obj_datasec(abfd)->_raw_size - = align_power (obj_datasec(abfd)->_raw_size, - obj_bsssec(abfd)->alignment_power); - execp->a_data = BFD_ALIGN (obj_datasec(abfd)->_raw_size, - adata(abfd).page_size); - data_pad = execp->a_data - obj_datasec(abfd)->_raw_size; + obj_datasec (abfd)->_raw_size + = align_power (obj_datasec (abfd)->_raw_size, + obj_bsssec (abfd)->alignment_power); + execp->a_data = BFD_ALIGN (obj_datasec (abfd)->_raw_size, + adata (abfd).page_size); + data_pad = execp->a_data - obj_datasec (abfd)->_raw_size; /* BSS. */ - if (!obj_bsssec(abfd)->user_set_vma) - obj_bsssec(abfd)->vma = (obj_datasec(abfd)->vma - + obj_datasec(abfd)->_raw_size); + if (!obj_bsssec (abfd)->user_set_vma) + obj_bsssec (abfd)->vma = (obj_datasec (abfd)->vma + + obj_datasec (abfd)->_raw_size); /* If the BSS immediately follows the data section and extra space in the page is left after the data section, fudge data in the header so that the bss section looks smaller by that @@ -1047,12 +1059,12 @@ adjust_z_magic (abfd, execp) (Note that a linker script, as well as the above assignment, could have explicitly set the BSS vma to immediately follow the data section.) */ - if (align_power (obj_bsssec(abfd)->vma, obj_bsssec(abfd)->alignment_power) - == obj_datasec(abfd)->vma + obj_datasec(abfd)->_raw_size) - execp->a_bss = (data_pad > obj_bsssec(abfd)->_raw_size) ? 0 : - obj_bsssec(abfd)->_raw_size - data_pad; + if (align_power (obj_bsssec (abfd)->vma, obj_bsssec (abfd)->alignment_power) + == obj_datasec (abfd)->vma + obj_datasec (abfd)->_raw_size) + execp->a_bss = (data_pad > obj_bsssec (abfd)->_raw_size + ? 0 : obj_bsssec (abfd)->_raw_size - data_pad); else - execp->a_bss = obj_bsssec(abfd)->_raw_size; + execp->a_bss = obj_bsssec (abfd)->_raw_size; } static void @@ -1060,41 +1072,41 @@ adjust_n_magic (abfd, execp) bfd *abfd; struct internal_exec *execp; { - file_ptr pos = adata(abfd).exec_bytes_size; + file_ptr pos = adata (abfd).exec_bytes_size; bfd_vma vma = 0; int pad; /* Text. */ - obj_textsec(abfd)->filepos = pos; - if (!obj_textsec(abfd)->user_set_vma) - obj_textsec(abfd)->vma = vma; + obj_textsec (abfd)->filepos = pos; + if (!obj_textsec (abfd)->user_set_vma) + obj_textsec (abfd)->vma = vma; else - vma = obj_textsec(abfd)->vma; - pos += obj_textsec(abfd)->_raw_size; - vma += obj_textsec(abfd)->_raw_size; + vma = obj_textsec (abfd)->vma; + pos += obj_textsec (abfd)->_raw_size; + vma += obj_textsec (abfd)->_raw_size; /* Data. */ - obj_datasec(abfd)->filepos = pos; - if (!obj_datasec(abfd)->user_set_vma) - obj_datasec(abfd)->vma = BFD_ALIGN (vma, adata(abfd).segment_size); - vma = obj_datasec(abfd)->vma; + obj_datasec (abfd)->filepos = pos; + if (!obj_datasec (abfd)->user_set_vma) + obj_datasec (abfd)->vma = BFD_ALIGN (vma, adata (abfd).segment_size); + vma = obj_datasec (abfd)->vma; /* Since BSS follows data immediately, see if it needs alignment. */ - vma += obj_datasec(abfd)->_raw_size; - pad = align_power (vma, obj_bsssec(abfd)->alignment_power) - vma; - obj_datasec(abfd)->_raw_size += pad; - pos += obj_datasec(abfd)->_raw_size; + vma += obj_datasec (abfd)->_raw_size; + pad = align_power (vma, obj_bsssec (abfd)->alignment_power) - vma; + obj_datasec (abfd)->_raw_size += pad; + pos += obj_datasec (abfd)->_raw_size; /* BSS. */ - if (!obj_bsssec(abfd)->user_set_vma) - obj_bsssec(abfd)->vma = vma; + if (!obj_bsssec (abfd)->user_set_vma) + obj_bsssec (abfd)->vma = vma; else - vma = obj_bsssec(abfd)->vma; + vma = obj_bsssec (abfd)->vma; /* Fix up exec header. */ - execp->a_text = obj_textsec(abfd)->_raw_size; - execp->a_data = obj_datasec(abfd)->_raw_size; - execp->a_bss = obj_bsssec(abfd)->_raw_size; + execp->a_text = obj_textsec (abfd)->_raw_size; + execp->a_data = obj_datasec (abfd)->_raw_size; + execp->a_bss = obj_bsssec (abfd)->_raw_size; N_SET_MAGIC (*execp, NMAGIC); } @@ -1109,12 +1121,12 @@ NAME(aout,adjust_sizes_and_vmas) (abfd, if (! NAME(aout,make_sections) (abfd)) return false; - if (adata(abfd).magic != undecided_magic) + if (adata (abfd).magic != undecided_magic) return true; - obj_textsec(abfd)->_raw_size = - align_power(obj_textsec(abfd)->_raw_size, - obj_textsec(abfd)->alignment_power); + obj_textsec (abfd)->_raw_size = + align_power (obj_textsec (abfd)->_raw_size, + obj_textsec (abfd)->alignment_power); *text_size = obj_textsec (abfd)->_raw_size; /* Rule (heuristic) for when to pad to a new page. Note that there @@ -1135,34 +1147,35 @@ NAME(aout,adjust_sizes_and_vmas) (abfd, if (abfd->flags & D_PAGED) /* Whether or not WP_TEXT is set -- let D_PAGED override. */ - adata(abfd).magic = z_magic; + adata (abfd).magic = z_magic; else if (abfd->flags & WP_TEXT) - adata(abfd).magic = n_magic; + adata (abfd).magic = n_magic; else - adata(abfd).magic = o_magic; + adata (abfd).magic = o_magic; #ifdef BFD_AOUT_DEBUG /* requires gcc2 */ #if __GNUC__ >= 2 fprintf (stderr, "%s text=<%x,%x,%x> data=<%x,%x,%x> bss=<%x,%x,%x>\n", ({ char *str; - switch (adata(abfd).magic) { - case n_magic: str = "NMAGIC"; break; - case o_magic: str = "OMAGIC"; break; - case z_magic: str = "ZMAGIC"; break; - default: abort (); - } + switch (adata (abfd).magic) + { + case n_magic: str = "NMAGIC"; break; + case o_magic: str = "OMAGIC"; break; + case z_magic: str = "ZMAGIC"; break; + default: abort (); + } str; }), - obj_textsec(abfd)->vma, obj_textsec(abfd)->_raw_size, - obj_textsec(abfd)->alignment_power, - obj_datasec(abfd)->vma, obj_datasec(abfd)->_raw_size, - obj_datasec(abfd)->alignment_power, - obj_bsssec(abfd)->vma, obj_bsssec(abfd)->_raw_size, - obj_bsssec(abfd)->alignment_power); + obj_textsec (abfd)->vma, obj_textsec (abfd)->_raw_size, + obj_textsec (abfd)->alignment_power, + obj_datasec (abfd)->vma, obj_datasec (abfd)->_raw_size, + obj_datasec (abfd)->alignment_power, + obj_bsssec (abfd)->vma, obj_bsssec (abfd)->_raw_size, + obj_bsssec (abfd)->alignment_power); #endif #endif - switch (adata(abfd).magic) + switch (adata (abfd).magic) { case o_magic: adjust_o_magic (abfd, execp); @@ -1179,11 +1192,11 @@ NAME(aout,adjust_sizes_and_vmas) (abfd, #ifdef BFD_AOUT_DEBUG fprintf (stderr, " text=<%x,%x,%x> data=<%x,%x,%x> bss=<%x,%x>\n", - obj_textsec(abfd)->vma, obj_textsec(abfd)->_raw_size, - obj_textsec(abfd)->filepos, - obj_datasec(abfd)->vma, obj_datasec(abfd)->_raw_size, - obj_datasec(abfd)->filepos, - obj_bsssec(abfd)->vma, obj_bsssec(abfd)->_raw_size); + obj_textsec (abfd)->vma, obj_textsec (abfd)->_raw_size, + obj_textsec (abfd)->filepos, + obj_datasec (abfd)->vma, obj_datasec (abfd)->_raw_size, + obj_datasec (abfd)->filepos, + obj_bsssec (abfd)->vma, obj_bsssec (abfd)->_raw_size); #endif return true; @@ -1208,24 +1221,27 @@ NAME(aout,new_section_hook) (abfd, newse asection *newsect; { /* align to double at least */ - newsect->alignment_power = bfd_get_arch_info(abfd)->section_align_power; + newsect->alignment_power = bfd_get_arch_info (abfd)->section_align_power; if (bfd_get_format (abfd) == bfd_object) { - if (obj_textsec(abfd) == NULL && !strcmp(newsect->name, ".text")) { - obj_textsec(abfd)= newsect; + if (obj_textsec (abfd) == NULL && !strcmp (newsect->name, ".text")) + { + obj_textsec (abfd)= newsect; newsect->target_index = N_TEXT; return true; } - if (obj_datasec(abfd) == NULL && !strcmp(newsect->name, ".data")) { - obj_datasec(abfd) = newsect; + if (obj_datasec (abfd) == NULL && !strcmp (newsect->name, ".data")) + { + obj_datasec (abfd) = newsect; newsect->target_index = N_DATA; return true; } - if (obj_bsssec(abfd) == NULL && !strcmp(newsect->name, ".bss")) { - obj_bsssec(abfd) = newsect; + if (obj_bsssec (abfd) == NULL && !strcmp (newsect->name, ".bss")) + { + obj_bsssec (abfd) = newsect; newsect->target_index = N_BSS; return true; } @@ -1272,7 +1288,7 @@ NAME(aout,set_section_contents) (abfd, s if (count != 0) { if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0 - || bfd_write (location, 1, count, abfd) != count) + || bfd_bwrite (location, count, abfd) != count) return false; } @@ -1289,6 +1305,7 @@ aout_get_external_symbols (abfd) { bfd_size_type count; struct external_nlist *syms; + bfd_size_type amt; count = exec_hdr (abfd)->a_syms / EXTERNAL_NLIST_SIZE; @@ -1303,13 +1320,13 @@ aout_get_external_symbols (abfd) later on. If we put them on the objalloc it might not be possible to free them. */ syms = ((struct external_nlist *) - bfd_malloc ((size_t) count * EXTERNAL_NLIST_SIZE)); + bfd_malloc (count * EXTERNAL_NLIST_SIZE)); if (syms == (struct external_nlist *) NULL && count != 0) return false; + amt = exec_hdr (abfd)->a_syms; if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0 - || (bfd_read (syms, 1, exec_hdr (abfd)->a_syms, abfd) - != exec_hdr (abfd)->a_syms)) + || bfd_bread (syms, amt, abfd) != amt) { free (syms); return false; @@ -1326,11 +1343,11 @@ aout_get_external_symbols (abfd) unsigned char string_chars[BYTES_IN_WORD]; bfd_size_type stringsize; char *strings; + bfd_size_type amt = BYTES_IN_WORD; /* Get the size of the strings. */ if (bfd_seek (abfd, obj_str_filepos (abfd), SEEK_SET) != 0 - || (bfd_read ((PTR) string_chars, BYTES_IN_WORD, 1, abfd) - != BYTES_IN_WORD)) + || bfd_bread ((PTR) string_chars, amt, abfd) != amt) return false; stringsize = GET_WORD (abfd, string_chars); @@ -1340,15 +1357,14 @@ aout_get_external_symbols (abfd) return false; strings = (char *) obj_aout_string_window (abfd).data; #else - strings = (char *) bfd_malloc ((size_t) stringsize + 1); + strings = (char *) bfd_malloc (stringsize + 1); if (strings == NULL) return false; /* Skip space for the string count in the buffer for convenience when using indexes. */ - if (bfd_read (strings + BYTES_IN_WORD, 1, stringsize - BYTES_IN_WORD, - abfd) - != stringsize - BYTES_IN_WORD) + amt = stringsize - BYTES_IN_WORD; + if (bfd_bread (strings + BYTES_IN_WORD, amt, abfd) != amt) { free (strings); return false; @@ -1479,6 +1495,7 @@ translate_from_native_sym_flags (abfd, c 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 @@ -1495,7 +1512,8 @@ translate_from_native_sym_flags (abfd, c { char *copy; - copy = bfd_alloc (abfd, strlen (cache_ptr->symbol.name) + 1); + amt = strlen (cache_ptr->symbol.name) + 1; + copy = bfd_alloc (abfd, amt); if (copy == NULL) return false; @@ -1505,7 +1523,8 @@ translate_from_native_sym_flags (abfd, c return false; } - reloc = (arelent_chain *) bfd_alloc (abfd, sizeof (arelent_chain)); + amt = sizeof (arelent_chain); + reloc = (arelent_chain *) bfd_alloc (abfd, amt); if (reloc == NULL) return false; @@ -1550,7 +1569,7 @@ translate_from_native_sym_flags (abfd, c reloc->relent.address = section->_raw_size; section->_raw_size += BYTES_IN_WORD; - reloc->relent.howto = CTOR_TABLE_RELOC_HOWTO(abfd); + reloc->relent.howto = CTOR_TABLE_RELOC_HOWTO (abfd); #endif /* 0 */ @@ -1725,7 +1744,7 @@ translate_to_native_sym_flags (abfd, cac sym_pointer->e_type[0] = type; } - PUT_WORD(abfd, value, sym_pointer->e_value); + PUT_WORD (abfd, value, sym_pointer->e_value); return true; } @@ -1736,8 +1755,8 @@ asymbol * NAME(aout,make_empty_symbol) (abfd) bfd *abfd; { - aout_symbol_type *new = - (aout_symbol_type *)bfd_zalloc (abfd, sizeof (aout_symbol_type)); + bfd_size_type amt = sizeof (aout_symbol_type); + aout_symbol_type *new = (aout_symbol_type *) bfd_zalloc (abfd, amt); if (!new) return NULL; new->symbol.the_bfd = abfd; @@ -1780,9 +1799,9 @@ NAME(aout,translate_symbol_table) (abfd, return false; in->symbol.value = GET_SWORD (abfd, ext->e_value); - in->desc = bfd_h_get_16 (abfd, ext->e_desc); - in->other = bfd_h_get_8 (abfd, ext->e_other); - in->type = bfd_h_get_8 (abfd, ext->e_type); + in->desc = H_GET_16 (abfd, ext->e_desc); + in->other = H_GET_8 (abfd, ext->e_other); + in->type = H_GET_8 (abfd, ext->e_type); in->symbol.udata.p = NULL; if (! translate_from_native_sym_flags (abfd, in)) @@ -1805,7 +1824,7 @@ NAME(aout,slurp_symbol_table) (abfd) { struct external_nlist *old_external_syms; aout_symbol_type *cached; - size_t cached_size; + bfd_size_type cached_size; /* If there's no work to be done, don't do any */ if (obj_aout_symbols (abfd) != (aout_symbol_type *) NULL) @@ -1816,13 +1835,13 @@ NAME(aout,slurp_symbol_table) (abfd) if (! aout_get_external_symbols (abfd)) return false; - cached_size = (obj_aout_external_sym_count (abfd) - * sizeof (aout_symbol_type)); + cached_size = obj_aout_external_sym_count (abfd); + cached_size *= sizeof (aout_symbol_type); cached = (aout_symbol_type *) bfd_malloc (cached_size); if (cached == NULL && cached_size != 0) return false; if (cached_size != 0) - memset (cached, 0, cached_size); + memset (cached, 0, (size_t) cached_size); /* Convert from external symbol information to internal. */ if (! (NAME(aout,translate_symbol_table) @@ -1916,10 +1935,11 @@ emit_stringtab (abfd, tab) struct bfd_strtab_hash *tab; { bfd_byte buffer[BYTES_IN_WORD]; + bfd_size_type amt = BYTES_IN_WORD; /* The string table starts with the size. */ PUT_WORD (abfd, _bfd_stringtab_size (tab) + BYTES_IN_WORD, buffer); - if (bfd_write ((PTR) buffer, 1, BYTES_IN_WORD, abfd) != BYTES_IN_WORD) + if (bfd_bwrite ((PTR) buffer, amt, abfd) != amt) return false; return _bfd_stringtab_emit (abfd, tab); @@ -1942,30 +1962,31 @@ NAME(aout,write_syms) (abfd) asymbol *g = generic[count]; bfd_size_type indx; struct external_nlist nsp; + bfd_size_type amt; indx = add_to_stringtab (abfd, strtab, g->name, false); if (indx == (bfd_size_type) -1) goto error_return; PUT_WORD (abfd, indx, (bfd_byte *) nsp.e_strx); - if (bfd_asymbol_flavour(g) == abfd->xvec->flavour) + if (bfd_asymbol_flavour (g) == abfd->xvec->flavour) { - bfd_h_put_16(abfd, aout_symbol(g)->desc, nsp.e_desc); - bfd_h_put_8(abfd, aout_symbol(g)->other, nsp.e_other); - bfd_h_put_8(abfd, aout_symbol(g)->type, nsp.e_type); + H_PUT_16 (abfd, aout_symbol (g)->desc, nsp.e_desc); + H_PUT_8 (abfd, aout_symbol (g)->other, nsp.e_other); + H_PUT_8 (abfd, aout_symbol (g)->type, nsp.e_type); } else { - bfd_h_put_16(abfd,0, nsp.e_desc); - bfd_h_put_8(abfd, 0, nsp.e_other); - bfd_h_put_8(abfd, 0, nsp.e_type); + H_PUT_16 (abfd, 0, nsp.e_desc); + H_PUT_8 (abfd, 0, nsp.e_other); + H_PUT_8 (abfd, 0, nsp.e_type); } if (! translate_to_native_sym_flags (abfd, g, &nsp)) goto error_return; - if (bfd_write((PTR)&nsp,1,EXTERNAL_NLIST_SIZE, abfd) - != EXTERNAL_NLIST_SIZE) + amt = EXTERNAL_NLIST_SIZE; + if (bfd_bwrite ((PTR) &nsp, amt, abfd) != amt) goto error_return; /* NB: `KEEPIT' currently overlays `udata.p', so set this only @@ -1996,8 +2017,10 @@ NAME(aout,get_symtab) (abfd, location) if (!NAME(aout,slurp_symbol_table) (abfd)) return -1; - for (symbase = obj_aout_symbols(abfd); counter++ < bfd_get_symcount (abfd);) - *(location++) = (asymbol *) ( symbase++); + for (symbase = obj_aout_symbols (abfd); + counter++ < bfd_get_symcount (abfd); + ) + *(location++) = (asymbol *) (symbase++); *location++ =0; return bfd_get_symcount (abfd); } @@ -2022,7 +2045,7 @@ NAME(aout,swap_std_reloc_out) (abfd, g, int r_baserel, r_jmptable, r_relative; asection *output_section = sym->section->output_section; - PUT_WORD(abfd, g->address, natptr->r_address); + PUT_WORD (abfd, g->address, natptr->r_address); r_length = g->howto->size ; /* Size as a power of two */ r_pcrel = (int) g->howto->pc_relative; /* Relative to PC? */ @@ -2073,29 +2096,30 @@ NAME(aout,swap_std_reloc_out) (abfd, g, } /* now the fun stuff */ - if (bfd_header_big_endian (abfd)) { + if (bfd_header_big_endian (abfd)) + { natptr->r_index[0] = r_index >> 16; natptr->r_index[1] = r_index >> 8; natptr->r_index[2] = r_index; - natptr->r_type[0] = - (r_extern? RELOC_STD_BITS_EXTERN_BIG: 0) - | (r_pcrel? RELOC_STD_BITS_PCREL_BIG: 0) - | (r_baserel? RELOC_STD_BITS_BASEREL_BIG: 0) - | (r_jmptable? RELOC_STD_BITS_JMPTABLE_BIG: 0) - | (r_relative? RELOC_STD_BITS_RELATIVE_BIG: 0) - | (r_length << RELOC_STD_BITS_LENGTH_SH_BIG); - } else { - natptr->r_index[2] = r_index >> 16; - natptr->r_index[1] = r_index >> 8; - natptr->r_index[0] = r_index; - natptr->r_type[0] = - (r_extern? RELOC_STD_BITS_EXTERN_LITTLE: 0) - | (r_pcrel? RELOC_STD_BITS_PCREL_LITTLE: 0) - | (r_baserel? RELOC_STD_BITS_BASEREL_LITTLE: 0) - | (r_jmptable? RELOC_STD_BITS_JMPTABLE_LITTLE: 0) - | (r_relative? RELOC_STD_BITS_RELATIVE_LITTLE: 0) - | (r_length << RELOC_STD_BITS_LENGTH_SH_LITTLE); - } + natptr->r_type[0] = ((r_extern ? RELOC_STD_BITS_EXTERN_BIG : 0) + | (r_pcrel ? RELOC_STD_BITS_PCREL_BIG : 0) + | (r_baserel ? RELOC_STD_BITS_BASEREL_BIG : 0) + | (r_jmptable ? RELOC_STD_BITS_JMPTABLE_BIG : 0) + | (r_relative ? RELOC_STD_BITS_RELATIVE_BIG : 0) + | (r_length << RELOC_STD_BITS_LENGTH_SH_BIG)); + } + else + { + natptr->r_index[2] = r_index >> 16; + natptr->r_index[1] = r_index >> 8; + natptr->r_index[0] = r_index; + natptr->r_type[0] = ((r_extern ? RELOC_STD_BITS_EXTERN_LITTLE : 0) + | (r_pcrel ? RELOC_STD_BITS_PCREL_LITTLE : 0) + | (r_baserel ? RELOC_STD_BITS_BASEREL_LITTLE : 0) + | (r_jmptable ? RELOC_STD_BITS_JMPTABLE_LITTLE : 0) + | (r_relative ? RELOC_STD_BITS_RELATIVE_LITTLE : 0) + | (r_length << RELOC_STD_BITS_LENGTH_SH_LITTLE)); + } } /* Extended stuff */ @@ -2113,7 +2137,7 @@ NAME(aout,swap_ext_reloc_out) (abfd, g, int r_index; int r_extern; unsigned int r_type; - unsigned int r_addend; + bfd_vma r_addend; asymbol *sym = *(g->sym_ptr_ptr); asection *output_section = sym->section->output_section; @@ -2154,21 +2178,22 @@ NAME(aout,swap_ext_reloc_out) (abfd, g, } /* now the fun stuff */ - if (bfd_header_big_endian (abfd)) { - natptr->r_index[0] = r_index >> 16; - natptr->r_index[1] = r_index >> 8; - natptr->r_index[2] = r_index; - natptr->r_type[0] = - ((r_extern? RELOC_EXT_BITS_EXTERN_BIG: 0) - | (r_type << RELOC_EXT_BITS_TYPE_SH_BIG)); - } else { - natptr->r_index[2] = r_index >> 16; - natptr->r_index[1] = r_index >> 8; - natptr->r_index[0] = r_index; - natptr->r_type[0] = - (r_extern? RELOC_EXT_BITS_EXTERN_LITTLE: 0) - | (r_type << RELOC_EXT_BITS_TYPE_SH_LITTLE); - } + if (bfd_header_big_endian (abfd)) + { + natptr->r_index[0] = r_index >> 16; + natptr->r_index[1] = r_index >> 8; + natptr->r_index[2] = r_index; + natptr->r_type[0] = ((r_extern ? RELOC_EXT_BITS_EXTERN_BIG : 0) + | (r_type << RELOC_EXT_BITS_TYPE_SH_BIG)); + } + else + { + natptr->r_index[2] = r_index >> 16; + natptr->r_index[1] = r_index >> 8; + natptr->r_index[0] = r_index; + natptr->r_type[0] = ((r_extern ? RELOC_EXT_BITS_EXTERN_LITTLE : 0) + | (r_type << RELOC_EXT_BITS_TYPE_SH_LITTLE)); + } PUT_WORD (abfd, r_addend, natptr->r_addend); } @@ -2179,40 +2204,44 @@ NAME(aout,swap_ext_reloc_out) (abfd, g, Aout keeps all it's symbols based from zero, so the symbol would contain 60. This macro subs the base of each section from the value - to give the true offset from the section */ + to give the true offset from the section. */ -#define MOVE_ADDRESS(ad) \ - if (r_extern) { \ - /* undefined symbol */ \ - cache_ptr->sym_ptr_ptr = symbols + r_index; \ - cache_ptr->addend = ad; \ - } else { \ - /* defined, section relative. replace symbol with pointer to \ - symbol which points to section */ \ - switch (r_index) { \ - case N_TEXT: \ - case N_TEXT | N_EXT: \ - cache_ptr->sym_ptr_ptr = obj_textsec(abfd)->symbol_ptr_ptr; \ - cache_ptr->addend = ad - su->textsec->vma; \ - break; \ - case N_DATA: \ - case N_DATA | N_EXT: \ - cache_ptr->sym_ptr_ptr = obj_datasec(abfd)->symbol_ptr_ptr; \ - cache_ptr->addend = ad - su->datasec->vma; \ - break; \ - case N_BSS: \ - case N_BSS | N_EXT: \ - cache_ptr->sym_ptr_ptr = obj_bsssec(abfd)->symbol_ptr_ptr; \ - cache_ptr->addend = ad - su->bsssec->vma; \ - break; \ - default: \ - case N_ABS: \ - case N_ABS | N_EXT: \ - cache_ptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; \ +#define MOVE_ADDRESS(ad) \ + if (r_extern) \ + { \ + /* Undefined symbol. */ \ + cache_ptr->sym_ptr_ptr = symbols + r_index; \ cache_ptr->addend = ad; \ - break; \ } \ - } \ + else \ + { \ + /* Defined, section relative. Replace symbol with pointer to \ + symbol which points to section. */ \ + switch (r_index) \ + { \ + case N_TEXT: \ + case N_TEXT | N_EXT: \ + cache_ptr->sym_ptr_ptr = obj_textsec (abfd)->symbol_ptr_ptr; \ + cache_ptr->addend = ad - su->textsec->vma; \ + break; \ + case N_DATA: \ + case N_DATA | N_EXT: \ + cache_ptr->sym_ptr_ptr = obj_datasec (abfd)->symbol_ptr_ptr; \ + cache_ptr->addend = ad - su->datasec->vma; \ + break; \ + case N_BSS: \ + case N_BSS | N_EXT: \ + cache_ptr->sym_ptr_ptr = obj_bsssec (abfd)->symbol_ptr_ptr; \ + cache_ptr->addend = ad - su->bsssec->vma; \ + break; \ + default: \ + case N_ABS: \ + case N_ABS | N_EXT: \ + cache_ptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; \ + cache_ptr->addend = ad; \ + break; \ + } \ + } void NAME(aout,swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount) @@ -2230,21 +2259,24 @@ NAME(aout,swap_ext_reloc_in) (abfd, byte cache_ptr->address = (GET_SWORD (abfd, bytes->r_address)); /* now the fun stuff */ - if (bfd_header_big_endian (abfd)) { - r_index = (bytes->r_index[0] << 16) - | (bytes->r_index[1] << 8) - | bytes->r_index[2]; - r_extern = (0 != (bytes->r_type[0] & RELOC_EXT_BITS_EXTERN_BIG)); - r_type = (bytes->r_type[0] & RELOC_EXT_BITS_TYPE_BIG) - >> RELOC_EXT_BITS_TYPE_SH_BIG; - } else { - r_index = (bytes->r_index[2] << 16) - | (bytes->r_index[1] << 8) - | bytes->r_index[0]; - r_extern = (0 != (bytes->r_type[0] & RELOC_EXT_BITS_EXTERN_LITTLE)); - r_type = (bytes->r_type[0] & RELOC_EXT_BITS_TYPE_LITTLE) - >> RELOC_EXT_BITS_TYPE_SH_LITTLE; - } + if (bfd_header_big_endian (abfd)) + { + r_index = ((bytes->r_index[0] << 16) + | (bytes->r_index[1] << 8) + | bytes->r_index[2]); + r_extern = (0 != (bytes->r_type[0] & RELOC_EXT_BITS_EXTERN_BIG)); + r_type = ((bytes->r_type[0] & RELOC_EXT_BITS_TYPE_BIG) + >> RELOC_EXT_BITS_TYPE_SH_BIG); + } + else + { + r_index = ((bytes->r_index[2] << 16) + | (bytes->r_index[1] << 8) + | bytes->r_index[0]); + r_extern = (0 != (bytes->r_type[0] & RELOC_EXT_BITS_EXTERN_LITTLE)); + r_type = ((bytes->r_type[0] & RELOC_EXT_BITS_TYPE_LITTLE) + >> RELOC_EXT_BITS_TYPE_SH_LITTLE); + } cache_ptr->howto = howto_table_ext + r_type; @@ -2264,7 +2296,7 @@ NAME(aout,swap_ext_reloc_in) (abfd, byte r_index = N_ABS; } - MOVE_ADDRESS(GET_SWORD(abfd, bytes->r_addend)); + MOVE_ADDRESS (GET_SWORD (abfd, bytes->r_addend)); } void @@ -2283,35 +2315,38 @@ NAME(aout,swap_std_reloc_in) (abfd, byte struct aoutdata *su = &(abfd->tdata.aout_data->a); unsigned int howto_idx; - cache_ptr->address = bfd_h_get_32 (abfd, bytes->r_address); + cache_ptr->address = H_GET_32 (abfd, bytes->r_address); /* now the fun stuff */ - if (bfd_header_big_endian (abfd)) { - r_index = (bytes->r_index[0] << 16) - | (bytes->r_index[1] << 8) - | bytes->r_index[2]; - r_extern = (0 != (bytes->r_type[0] & RELOC_STD_BITS_EXTERN_BIG)); - r_pcrel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_PCREL_BIG)); - r_baserel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_BASEREL_BIG)); - r_jmptable= (0 != (bytes->r_type[0] & RELOC_STD_BITS_JMPTABLE_BIG)); - r_relative= (0 != (bytes->r_type[0] & RELOC_STD_BITS_RELATIVE_BIG)); - r_length = (bytes->r_type[0] & RELOC_STD_BITS_LENGTH_BIG) - >> RELOC_STD_BITS_LENGTH_SH_BIG; - } else { - r_index = (bytes->r_index[2] << 16) - | (bytes->r_index[1] << 8) - | bytes->r_index[0]; - r_extern = (0 != (bytes->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE)); - r_pcrel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE)); - r_baserel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_BASEREL_LITTLE)); - r_jmptable= (0 != (bytes->r_type[0] & RELOC_STD_BITS_JMPTABLE_LITTLE)); - r_relative= (0 != (bytes->r_type[0] & RELOC_STD_BITS_RELATIVE_LITTLE)); - r_length = (bytes->r_type[0] & RELOC_STD_BITS_LENGTH_LITTLE) - >> RELOC_STD_BITS_LENGTH_SH_LITTLE; - } + if (bfd_header_big_endian (abfd)) + { + r_index = ((bytes->r_index[0] << 16) + | (bytes->r_index[1] << 8) + | bytes->r_index[2]); + r_extern = (0 != (bytes->r_type[0] & RELOC_STD_BITS_EXTERN_BIG)); + r_pcrel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_PCREL_BIG)); + r_baserel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_BASEREL_BIG)); + r_jmptable= (0 != (bytes->r_type[0] & RELOC_STD_BITS_JMPTABLE_BIG)); + r_relative= (0 != (bytes->r_type[0] & RELOC_STD_BITS_RELATIVE_BIG)); + r_length = ((bytes->r_type[0] & RELOC_STD_BITS_LENGTH_BIG) + >> RELOC_STD_BITS_LENGTH_SH_BIG); + } + else + { + r_index = ((bytes->r_index[2] << 16) + | (bytes->r_index[1] << 8) + | bytes->r_index[0]); + r_extern = (0 != (bytes->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE)); + r_pcrel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE)); + r_baserel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_BASEREL_LITTLE)); + r_jmptable= (0 != (bytes->r_type[0] & RELOC_STD_BITS_JMPTABLE_LITTLE)); + r_relative= (0 != (bytes->r_type[0] & RELOC_STD_BITS_RELATIVE_LITTLE)); + r_length = ((bytes->r_type[0] & RELOC_STD_BITS_LENGTH_LITTLE) + >> RELOC_STD_BITS_LENGTH_SH_LITTLE); + } - howto_idx = r_length + 4 * r_pcrel + 8 * r_baserel - + 16 * r_jmptable + 32 * r_relative; + howto_idx = (r_length + 4 * r_pcrel + 8 * r_baserel + + 16 * r_jmptable + 32 * r_relative); BFD_ASSERT (howto_idx < TABLE_SIZE (howto_table_std)); cache_ptr->howto = howto_table_std + howto_idx; BFD_ASSERT (cache_ptr->howto->type != (unsigned int) -1); @@ -2330,7 +2365,7 @@ NAME(aout,swap_std_reloc_in) (abfd, byte r_index = N_ABS; } - MOVE_ADDRESS(0); + MOVE_ADDRESS (0); } /* Read and swap the relocs for a section. */ @@ -2341,13 +2376,14 @@ NAME(aout,slurp_reloc_table) (abfd, asec sec_ptr asect; asymbol **symbols; { - unsigned int count; + bfd_size_type count; bfd_size_type reloc_size; PTR relocs; arelent *reloc_cache; size_t each_size; unsigned int counter = 0; arelent *cache_ptr; + bfd_size_type amt; if (asect->relocation) return true; @@ -2356,9 +2392,9 @@ NAME(aout,slurp_reloc_table) (abfd, asec return true; if (asect == obj_datasec (abfd)) - reloc_size = exec_hdr(abfd)->a_drsize; + reloc_size = exec_hdr (abfd)->a_drsize; else if (asect == obj_textsec (abfd)) - reloc_size = exec_hdr(abfd)->a_trsize; + reloc_size = exec_hdr (abfd)->a_trsize; else if (asect == obj_bsssec (abfd)) reloc_size = 0; else @@ -2374,19 +2410,20 @@ NAME(aout,slurp_reloc_table) (abfd, asec count = reloc_size / each_size; - reloc_cache = (arelent *) bfd_malloc ((size_t) (count * sizeof (arelent))); + amt = count * sizeof (arelent); + reloc_cache = (arelent *) bfd_malloc (amt); if (reloc_cache == NULL && count != 0) return false; - memset (reloc_cache, 0, count * sizeof (arelent)); + memset (reloc_cache, 0, (size_t) amt); - relocs = bfd_malloc ((size_t) reloc_size); + relocs = bfd_malloc (reloc_size); if (relocs == NULL && reloc_size != 0) { free (reloc_cache); return false; } - if (bfd_read (relocs, 1, reloc_size, abfd) != reloc_size) + if (bfd_bread (relocs, reloc_size, abfd) != reloc_size) { free (relocs); free (reloc_cache); @@ -2396,21 +2433,19 @@ NAME(aout,slurp_reloc_table) (abfd, asec cache_ptr = reloc_cache; if (each_size == RELOC_EXT_SIZE) { - register struct reloc_ext_external *rptr = - (struct reloc_ext_external *) relocs; + struct reloc_ext_external *rptr = (struct reloc_ext_external *) relocs; for (; counter < count; counter++, rptr++, cache_ptr++) MY_swap_ext_reloc_in (abfd, rptr, cache_ptr, symbols, - bfd_get_symcount (abfd)); + (bfd_size_type) bfd_get_symcount (abfd)); } else { - register struct reloc_std_external *rptr = - (struct reloc_std_external *) relocs; + struct reloc_std_external *rptr = (struct reloc_std_external *) relocs; for (; counter < count; counter++, rptr++, cache_ptr++) MY_swap_std_reloc_in (abfd, rptr, cache_ptr, symbols, - bfd_get_symcount (abfd)); + (bfd_size_type) bfd_get_symcount (abfd)); } free (relocs); @@ -2433,13 +2468,13 @@ NAME(aout,squirt_out_relocs) (abfd, sect size_t each_size; unsigned int count = section->reloc_count; - size_t natsize; + bfd_size_type natsize; if (count == 0 || section->orelocation == NULL) return true; each_size = obj_reloc_entry_size (abfd); - natsize = each_size * count; + natsize = (bfd_size_type) each_size * count; native = (unsigned char *) bfd_zalloc (abfd, natsize); if (!native) return false; @@ -2459,13 +2494,15 @@ NAME(aout,squirt_out_relocs) (abfd, sect for (natptr = native; count != 0; --count, natptr += each_size, ++generic) - MY_swap_std_reloc_out(abfd, *generic, (struct reloc_std_external *)natptr); + MY_swap_std_reloc_out (abfd, *generic, + (struct reloc_std_external *) natptr); } - if ( bfd_write ((PTR) native, 1, natsize, abfd) != natsize) { - bfd_release(abfd, native); - return false; - } + if (bfd_bwrite ((PTR) native, natsize, abfd) != natsize) + { + bfd_release (abfd, native); + return false; + } bfd_release (abfd, native); return true; @@ -2491,21 +2528,24 @@ NAME(aout,canonicalize_reloc) (abfd, sec if (!(tblptr || NAME(aout,slurp_reloc_table) (abfd, section, symbols))) return -1; - if (section->flags & SEC_CONSTRUCTOR) { - arelent_chain *chain = section->constructor_chain; - for (count = 0; count < section->reloc_count; count ++) { - *relptr ++ = &chain->relent; - chain = chain->next; + if (section->flags & SEC_CONSTRUCTOR) + { + arelent_chain *chain = section->constructor_chain; + for (count = 0; count < section->reloc_count; count ++) + { + *relptr ++ = &chain->relent; + chain = chain->next; + } } - } - else { - tblptr = section->relocation; + else + { + tblptr = section->relocation; - for (count = 0; count++ < section->reloc_count;) - { - *relptr++ = tblptr++; - } - } + for (count = 0; count++ < section->reloc_count; ) + { + *relptr++ = tblptr++; + } + } *relptr = 0; return section->reloc_count; @@ -2516,22 +2556,24 @@ NAME(aout,get_reloc_upper_bound) (abfd, bfd *abfd; sec_ptr asect; { - if (bfd_get_format (abfd) != bfd_object) { - bfd_set_error (bfd_error_invalid_operation); - return -1; - } - if (asect->flags & SEC_CONSTRUCTOR) { - return (sizeof (arelent *) * (asect->reloc_count+1)); - } + if (bfd_get_format (abfd) != bfd_object) + { + bfd_set_error (bfd_error_invalid_operation); + return -1; + } + if (asect->flags & SEC_CONSTRUCTOR) + { + return (sizeof (arelent *) * (asect->reloc_count+1)); + } if (asect == obj_datasec (abfd)) return (sizeof (arelent *) - * ((exec_hdr(abfd)->a_drsize / obj_reloc_entry_size (abfd)) + * ((exec_hdr (abfd)->a_drsize / obj_reloc_entry_size (abfd)) + 1)); if (asect == obj_textsec (abfd)) return (sizeof (arelent *) - * ((exec_hdr(abfd)->a_trsize / obj_reloc_entry_size (abfd)) + * ((exec_hdr (abfd)->a_trsize / obj_reloc_entry_size (abfd)) + 1)); if (asect == obj_bsssec (abfd)) @@ -2572,7 +2614,7 @@ NAME(aout,get_symbol_info) (ignore_abfd, if (ret->type == '?') { - int type_code = aout_symbol(symbol)->type & 0xff; + int type_code = aout_symbol (symbol)->type & 0xff; const char *stab_name = bfd_get_stab_name (type_code); static char buf[10]; @@ -2583,8 +2625,8 @@ NAME(aout,get_symbol_info) (ignore_abfd, } ret->type = '-'; ret->stab_type = type_code; - ret->stab_other = (unsigned) (aout_symbol(symbol)->other & 0xff); - ret->stab_desc = (unsigned) (aout_symbol(symbol)->desc & 0xffff); + ret->stab_other = (unsigned) (aout_symbol (symbol)->other & 0xff); + ret->stab_desc = (unsigned) (aout_symbol (symbol)->desc & 0xffff); ret->stab_name = stab_name; } } @@ -2598,32 +2640,34 @@ NAME(aout,print_symbol) (abfd, afile, sy { FILE *file = (FILE *)afile; - switch (how) { - case bfd_print_symbol_name: - if (symbol->name) - fprintf (file,"%s", symbol->name); - break; - case bfd_print_symbol_more: - fprintf (file,"%4x %2x %2x",(unsigned) (aout_symbol(symbol)->desc & 0xffff), - (unsigned) (aout_symbol(symbol)->other & 0xff), - (unsigned) (aout_symbol(symbol)->type)); - break; - case bfd_print_symbol_all: - { - CONST char *section_name = symbol->section->name; - - bfd_print_symbol_vandf (abfd, (PTR)file, symbol); - - fprintf (file," %-5s %04x %02x %02x", - section_name, - (unsigned) (aout_symbol(symbol)->desc & 0xffff), - (unsigned) (aout_symbol(symbol)->other & 0xff), - (unsigned) (aout_symbol(symbol)->type & 0xff)); + switch (how) + { + case bfd_print_symbol_name: if (symbol->name) - fprintf (file," %s", symbol->name); + fprintf (file,"%s", symbol->name); + break; + case bfd_print_symbol_more: + fprintf (file,"%4x %2x %2x", + (unsigned) (aout_symbol (symbol)->desc & 0xffff), + (unsigned) (aout_symbol (symbol)->other & 0xff), + (unsigned) (aout_symbol (symbol)->type)); + break; + case bfd_print_symbol_all: + { + const char *section_name = symbol->section->name; + + bfd_print_symbol_vandf (abfd, (PTR)file, symbol); + + fprintf (file," %-5s %04x %02x %02x", + section_name, + (unsigned) (aout_symbol (symbol)->desc & 0xffff), + (unsigned) (aout_symbol (symbol)->other & 0xff), + (unsigned) (aout_symbol (symbol)->type & 0xff)); + if (symbol->name) + fprintf (file," %s", symbol->name); + } + break; } - break; - } } /* If we don't have to allocate more than 1MB to hold the generic @@ -2711,123 +2755,126 @@ NAME(aout,find_nearest_line) asection *section; asymbol **symbols; bfd_vma offset; - CONST char **filename_ptr; - CONST char **functionname_ptr; + const char **filename_ptr; + const char **functionname_ptr; unsigned int *line_ptr; { /* Run down the file looking for the filename, function and linenumber */ asymbol **p; - CONST char *directory_name = NULL; - 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. */ + const char *directory_name = NULL; + 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; - size_t filelen, funclen; + bfd_size_type filelen, funclen; char *buf; *filename_ptr = abfd->filename; *functionname_ptr = 0; *line_ptr = 0; - if (symbols != (asymbol **)NULL) { - for (p = symbols; *p; p++) { - aout_symbol_type *q = (aout_symbol_type *) (*p); - next: - switch (q->type){ - case N_TEXT: - /* If this looks like a file name symbol, and it comes after - the line number we have found so far, but before the - offset, then we have probably not found the right line - number. */ - if (q->symbol.value <= offset - && ((q->symbol.value > low_line_vma - && (line_file_name != NULL - || *line_ptr != 0)) - || (q->symbol.value > low_func_vma - && func != NULL))) - { - const char *symname; + if (symbols != (asymbol **)NULL) + { + for (p = symbols; *p; p++) + { + aout_symbol_type *q = (aout_symbol_type *) (*p); + next: + switch (q->type) + { + case N_TEXT: + /* If this looks like a file name symbol, and it comes after + the line number we have found so far, but before the + offset, then we have probably not found the right line + number. */ + if (q->symbol.value <= offset + && ((q->symbol.value > low_line_vma + && (line_file_name != NULL + || *line_ptr != 0)) + || (q->symbol.value > low_func_vma + && func != NULL))) + { + const char *symname; - symname = q->symbol.name; - if (strcmp (symname + strlen (symname) - 2, ".o") == 0) - { - if (q->symbol.value > low_line_vma) - { - *line_ptr = 0; - line_file_name = NULL; - } - if (q->symbol.value > low_func_vma) - func = NULL; - } - } - break; + symname = q->symbol.name; + if (strcmp (symname + strlen (symname) - 2, ".o") == 0) + { + if (q->symbol.value > low_line_vma) + { + *line_ptr = 0; + line_file_name = NULL; + } + if (q->symbol.value > low_func_vma) + func = NULL; + } + } + break; - case N_SO: - /* If this symbol is less than the offset, but greater than - the line number we have found so far, then we have not - found the right line number. */ - if (q->symbol.value <= offset) - { - if (q->symbol.value > low_line_vma) - { - *line_ptr = 0; - line_file_name = NULL; - } - if (q->symbol.value > low_func_vma) - func = NULL; - } + case N_SO: + /* If this symbol is less than the offset, but greater than + the line number we have found so far, then we have not + found the right line number. */ + if (q->symbol.value <= offset) + { + if (q->symbol.value > low_line_vma) + { + *line_ptr = 0; + line_file_name = NULL; + } + if (q->symbol.value > low_func_vma) + func = NULL; + } - main_file_name = current_file_name = q->symbol.name; - /* Look ahead to next symbol to check if that too is an N_SO. */ - p++; - if (*p == NULL) - break; - q = (aout_symbol_type *) (*p); - if (q->type != (int)N_SO) - goto next; - - /* Found a second N_SO First is directory; second is filename. */ - directory_name = current_file_name; - main_file_name = current_file_name = q->symbol.name; - if (obj_textsec(abfd) != section) - goto done; - break; - case N_SOL: - current_file_name = q->symbol.name; - break; + main_file_name = current_file_name = q->symbol.name; + /* Look ahead to next symbol to check if that too is an N_SO. */ + p++; + if (*p == NULL) + break; + q = (aout_symbol_type *) (*p); + if (q->type != (int)N_SO) + goto next; + + /* Found a second N_SO First is directory; second is filename. */ + directory_name = current_file_name; + main_file_name = current_file_name = q->symbol.name; + if (obj_textsec (abfd) != section) + goto done; + break; + case N_SOL: + current_file_name = q->symbol.name; + break; - case N_SLINE: + case N_SLINE: - case N_DSLINE: - case N_BSLINE: - /* We'll keep this if it resolves nearer than the one we have - already. */ - if (q->symbol.value >= low_line_vma - && q->symbol.value <= offset) - { - *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: - { - /* We'll keep this if it is nearer than the one we have already */ - if (q->symbol.value >= low_func_vma && - q->symbol.value <= offset) { - low_func_vma = q->symbol.value; - func = (asymbol *)q; - } - else if (q->symbol.value > offset) - goto done; + case N_DSLINE: + case N_BSLINE: + /* We'll keep this if it resolves nearer than the one we have + already. */ + if (q->symbol.value >= low_line_vma + && q->symbol.value <= offset) + { + *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: + { + /* We'll keep this if it is nearer than the one we have already */ + if (q->symbol.value >= low_func_vma && + q->symbol.value <= offset) { + low_func_vma = q->symbol.value; + func = (asymbol *)q; + } + else if (q->symbol.value > offset) + goto done; + } + break; + } } - break; - } } - } done: if (*line_ptr != 0) @@ -2874,7 +2921,7 @@ NAME(aout,find_nearest_line) if (func) { const char *function = func->name; - char *p; + char *colon; /* The caller expects a symbol name. We actually have a function name, without the leading underscore. Put the @@ -2887,9 +2934,9 @@ NAME(aout,find_nearest_line) strcpy (buf + 1, function); } /* Have to remove : stuff */ - p = strchr (buf, ':'); - if (p != NULL) - *p = '\0'; + colon = strchr (buf, ':'); + if (colon != NULL) + *colon = '\0'; *functionname_ptr = buf; } @@ -2901,7 +2948,7 @@ NAME(aout,sizeof_headers) (abfd, execabl bfd *abfd; boolean execable ATTRIBUTE_UNUSED; { - return adata(abfd).exec_bytes_size; + return adata (abfd).exec_bytes_size; } /* Free all information we have cached for this BFD. We can always @@ -2999,9 +3046,9 @@ NAME(aout,link_hash_table_create) (abfd) bfd *abfd; { struct aout_link_hash_table *ret; + bfd_size_type amt = sizeof (struct aout_link_hash_table); - ret = ((struct aout_link_hash_table *) - bfd_alloc (abfd, sizeof (struct aout_link_hash_table))); + ret = (struct aout_link_hash_table *) bfd_alloc (abfd, amt); if (ret == NULL) return (struct bfd_link_hash_table *) NULL; if (! NAME(aout,link_hash_table_init) (ret, abfd, @@ -3137,7 +3184,7 @@ aout_link_check_ar_symbols (abfd, info, strings = obj_aout_external_strings (abfd); for (; p < pend; p++) { - int type = bfd_h_get_8 (abfd, p->e_type); + int type = H_GET_8 (abfd, p->e_type); const char *name; struct bfd_link_hash_entry *h; @@ -3301,6 +3348,7 @@ aout_link_add_symbols (abfd, info) struct aout_link_hash_entry **sym_hash; register struct external_nlist *p; struct external_nlist *pend; + bfd_size_type amt; syms = obj_aout_external_syms (abfd); sym_count = obj_aout_external_sym_count (abfd); @@ -3321,10 +3369,8 @@ aout_link_add_symbols (abfd, info) to particular symbols. We could just look them up in the hash table, but keeping the list is more efficient. Perhaps this should be conditional on info->keep_memory. */ - sym_hash = ((struct aout_link_hash_entry **) - bfd_alloc (abfd, - ((size_t) sym_count - * sizeof (struct aout_link_hash_entry *)))); + amt = sym_count * sizeof (struct aout_link_hash_entry *); + sym_hash = (struct aout_link_hash_entry **) bfd_alloc (abfd, amt); if (sym_hash == NULL && sym_count != 0) return false; obj_aout_sym_hashes (abfd) = sym_hash; @@ -3346,7 +3392,7 @@ aout_link_add_symbols (abfd, info) *sym_hash = NULL; - type = bfd_h_get_8 (abfd, p->e_type); + type = H_GET_8 (abfd, p->e_type); /* Ignore debugging symbols. */ if ((type & N_STAB) != 0) @@ -3530,8 +3576,8 @@ struct aout_link_includes_entry /* Look up an entry in an the header file hash table. */ -#define aout_link_includes_lookup(table, string, create, copy) \ - ((struct aout_link_includes_entry *) \ +#define aout_link_includes_lookup(table, string, create, copy) \ + ((struct aout_link_includes_entry *) \ bfd_hash_lookup (&(table)->root, (string), (create), (copy))) /* During the final link step we need to pass around a bunch of @@ -3636,9 +3682,9 @@ NAME(aout,final_link) (abfd, info, callb boolean includes_hash_initialized = false; register bfd *sub; bfd_size_type trsize, drsize; - size_t max_contents_size; - size_t max_relocs_size; - size_t max_sym_count; + bfd_size_type max_contents_size; + bfd_size_type max_relocs_size; + bfd_size_type max_sym_count; bfd_size_type text_size; file_ptr text_end; register struct bfd_link_order *p; @@ -3670,7 +3716,7 @@ NAME(aout,final_link) (abfd, info, callb max_sym_count = 0; for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) { - size_t sz; + bfd_size_type sz; if (info->relocateable) { @@ -3939,14 +3985,12 @@ NAME(aout,final_link) (abfd, info, callb && obj_datasec (abfd)->reloc_count == 0) { bfd_byte b; + file_ptr pos; b = 0; - if (bfd_seek (abfd, - (obj_datasec (abfd)->filepos - + exec_hdr (abfd)->a_data - - 1), - SEEK_SET) != 0 - || bfd_write (&b, 1, 1, abfd) != 1) + pos = obj_datasec (abfd)->filepos + exec_hdr (abfd)->a_data - 1; + if (bfd_seek (abfd, pos, SEEK_SET) != 0 + || bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1) goto error_return; } @@ -4067,9 +4111,9 @@ aout_link_write_symbols (finfo, input_bf false, false) != NULL) && discard != discard_all) { - bfd_h_put_8 (output_bfd, N_TEXT, outsym->e_type); - bfd_h_put_8 (output_bfd, 0, outsym->e_other); - bfd_h_put_16 (output_bfd, (bfd_vma) 0, outsym->e_desc); + H_PUT_8 (output_bfd, N_TEXT, outsym->e_type); + H_PUT_8 (output_bfd, 0, outsym->e_other); + H_PUT_16 (output_bfd, 0, outsym->e_desc); strtab_index = add_to_stringtab (output_bfd, finfo->strtab, input_bfd->filename, false); if (strtab_index == (bfd_size_type) -1) @@ -4090,7 +4134,7 @@ aout_link_write_symbols (finfo, input_bf sym_end = sym + sym_count; sym_hash = obj_aout_sym_hashes (input_bfd); symbol_map = finfo->symbol_map; - memset (symbol_map, 0, sym_count * sizeof *symbol_map); + memset (symbol_map, 0, (size_t) sym_count * sizeof *symbol_map); for (; sym < sym_end; sym++, sym_hash++, symbol_map++) { const char *name; @@ -4113,7 +4157,7 @@ aout_link_write_symbols (finfo, input_bf we do copy the symbol over. */ *symbol_map = -1; - type = bfd_h_get_8 (input_bfd, sym->e_type); + type = H_GET_8 (input_bfd, sym->e_type); name = strings + GET_WORD (input_bfd, sym->e_strx); h = NULL; @@ -4384,7 +4428,7 @@ aout_link_write_symbols (finfo, input_bf { int incl_type; - incl_type = bfd_h_get_8 (input_bfd, incl_sym->e_type); + incl_type = H_GET_8 (input_bfd, incl_sym->e_type); if (incl_type == N_EINCL) { if (nest == 0) @@ -4405,7 +4449,7 @@ aout_link_write_symbols (finfo, input_bf { /* Skip the file number. */ ++s; - while (isdigit ((unsigned char) *s)) + while (ISDIGIT (*s)) ++s; --s; } @@ -4453,7 +4497,7 @@ aout_link_write_symbols (finfo, input_bf { int incl_type; - incl_type = bfd_h_get_8 (input_bfd, incl_sym->e_type); + incl_type = H_GET_8 (input_bfd, incl_sym->e_type); if (incl_type == N_EINCL) { if (nest == 0) @@ -4474,11 +4518,9 @@ aout_link_write_symbols (finfo, input_bf /* Copy this symbol into the list of symbols we are going to write out. */ - bfd_h_put_8 (output_bfd, type, outsym->e_type); - bfd_h_put_8 (output_bfd, bfd_h_get_8 (input_bfd, sym->e_other), - outsym->e_other); - bfd_h_put_16 (output_bfd, bfd_h_get_16 (input_bfd, sym->e_desc), - outsym->e_desc); + H_PUT_8 (output_bfd, type, outsym->e_type); + H_PUT_8 (output_bfd, H_GET_8 (input_bfd, sym->e_other), outsym->e_other); + H_PUT_16 (output_bfd, H_GET_16 (input_bfd, sym->e_desc), outsym->e_desc); copy = false; if (! finfo->info->keep_memory) { @@ -4504,17 +4546,16 @@ aout_link_write_symbols (finfo, input_bf /* Write out the output symbols we have just constructed. */ if (outsym > finfo->output_syms) { - bfd_size_type outsym_count; + bfd_size_type outsym_size; if (bfd_seek (output_bfd, finfo->symoff, SEEK_SET) != 0) return false; - outsym_count = outsym - finfo->output_syms; - if (bfd_write ((PTR) finfo->output_syms, - (bfd_size_type) EXTERNAL_NLIST_SIZE, - (bfd_size_type) outsym_count, output_bfd) - != outsym_count * EXTERNAL_NLIST_SIZE) + outsym_size = outsym - finfo->output_syms; + outsym_size *= EXTERNAL_NLIST_SIZE; + if (bfd_bwrite ((PTR) finfo->output_syms, outsym_size, output_bfd) + != outsym_size) return false; - finfo->symoff += outsym_count * EXTERNAL_NLIST_SIZE; + finfo->symoff += outsym_size; } return true; @@ -4534,6 +4575,7 @@ aout_link_write_other_symbol (h, data) bfd_vma val; struct external_nlist outsym; bfd_size_type indx; + bfd_size_type amt; output_bfd = finfo->output_bfd; @@ -4610,12 +4652,12 @@ aout_link_write_other_symbol (h, data) return true; } - bfd_h_put_8 (output_bfd, type, outsym.e_type); - bfd_h_put_8 (output_bfd, 0, outsym.e_other); - bfd_h_put_16 (output_bfd, 0, outsym.e_desc); + H_PUT_8 (output_bfd, type, outsym.e_type); + H_PUT_8 (output_bfd, 0, outsym.e_other); + H_PUT_16 (output_bfd, 0, outsym.e_desc); indx = add_to_stringtab (output_bfd, finfo->strtab, h->root.root.string, false); - if (indx == (bfd_size_type) -1) + if (indx == - (bfd_size_type) 1) { /* FIXME: No way to handle errors. */ abort (); @@ -4623,9 +4665,9 @@ aout_link_write_other_symbol (h, data) PUT_WORD (output_bfd, indx, outsym.e_strx); PUT_WORD (output_bfd, val, outsym.e_value); + amt = EXTERNAL_NLIST_SIZE; if (bfd_seek (output_bfd, finfo->symoff, SEEK_SET) != 0 - || bfd_write ((PTR) &outsym, (bfd_size_type) EXTERNAL_NLIST_SIZE, - (bfd_size_type) 1, output_bfd) != EXTERNAL_NLIST_SIZE) + || bfd_bwrite ((PTR) &outsym, amt, output_bfd) != amt) { /* FIXME: No way to handle errors. */ abort (); @@ -4669,7 +4711,7 @@ aout_link_input_section (finfo, input_bf if (rel_size > 0) { if (bfd_seek (input_bfd, input_section->rel_filepos, SEEK_SET) != 0 - || bfd_read (relocs, 1, rel_size, input_bfd) != rel_size) + || bfd_bread (relocs, rel_size, input_bfd) != rel_size) return false; } } @@ -4694,7 +4736,7 @@ aout_link_input_section (finfo, input_bf if (! bfd_set_section_contents (finfo->output_bfd, input_section->output_section, (PTR) finfo->contents, - input_section->output_offset, + (file_ptr) input_section->output_offset, input_size)) return false; @@ -4704,8 +4746,7 @@ aout_link_input_section (finfo, input_bf { if (bfd_seek (finfo->output_bfd, *reloff_ptr, SEEK_SET) != 0) return false; - if (bfd_write (relocs, (bfd_size_type) 1, rel_size, finfo->output_bfd) - != rel_size) + if (bfd_bwrite (relocs, rel_size, finfo->output_bfd) != rel_size) return false; *reloff_ptr += rel_size; @@ -4804,7 +4845,7 @@ aout_link_input_section_std (finfo, inpu r_addr = GET_SWORD (input_bfd, rel->r_address); #ifdef MY_reloc_howto - howto = MY_reloc_howto(input_bfd, rel, r_index, r_extern, r_pcrel); + howto = MY_reloc_howto (input_bfd, rel, r_index, r_extern, r_pcrel); #else { int r_jmptable; @@ -5363,7 +5404,7 @@ aout_link_input_section_ext (finfo, inpu /* For base relative relocs, r_index is always an index into the symbol table, even if r_extern is 0. */ sym = syms + r_index; - type = bfd_h_get_8 (input_bfd, sym->e_type); + type = H_GET_8 (input_bfd, sym->e_type); if ((type & N_TYPE) == N_TEXT || type == N_WEAKT) r_section = obj_textsec (input_bfd); @@ -5524,6 +5565,7 @@ aout_link_reloc_link_order (finfo, o, p) struct reloc_std_external srel; struct reloc_ext_external erel; PTR rel_ptr; + bfd_size_type amt; pr = p->u.reloc.p; @@ -5589,8 +5631,8 @@ aout_link_reloc_link_order (finfo, o, p) if (obj_reloc_entry_size (finfo->output_bfd) == RELOC_STD_SIZE) { #ifdef MY_put_reloc - MY_put_reloc(finfo->output_bfd, r_extern, r_index, p->offset, howto, - &srel); + MY_put_reloc (finfo->output_bfd, r_extern, r_index, p->offset, howto, + &srel); #else { int r_pcrel; @@ -5653,7 +5695,7 @@ aout_link_reloc_link_order (finfo, o, p) if (buf == (bfd_byte *) NULL) return false; r = MY_relocate_contents (howto, finfo->output_bfd, - pr->addend, buf); + (bfd_vma) pr->addend, buf); switch (r) { case bfd_reloc_ok: @@ -5676,10 +5718,8 @@ aout_link_reloc_link_order (finfo, o, p) } break; } - ok = bfd_set_section_contents (finfo->output_bfd, o, - (PTR) buf, - (file_ptr) p->offset, - size); + ok = bfd_set_section_contents (finfo->output_bfd, o, (PTR) buf, + (file_ptr) p->offset, size); free (buf); if (! ok) return false; @@ -5712,17 +5752,15 @@ aout_link_reloc_link_order (finfo, o, p) | (howto->type << RELOC_EXT_BITS_TYPE_SH_LITTLE); } - PUT_WORD (finfo->output_bfd, pr->addend, erel.r_addend); + PUT_WORD (finfo->output_bfd, (bfd_vma) pr->addend, erel.r_addend); #endif /* MY_put_ext_reloc */ rel_ptr = (PTR) &erel; } + amt = obj_reloc_entry_size (finfo->output_bfd); if (bfd_seek (finfo->output_bfd, *reloff_ptr, SEEK_SET) != 0 - || (bfd_write (rel_ptr, (bfd_size_type) 1, - obj_reloc_entry_size (finfo->output_bfd), - finfo->output_bfd) - != obj_reloc_entry_size (finfo->output_bfd))) + || bfd_bwrite (rel_ptr, amt, finfo->output_bfd) != amt) return false; *reloff_ptr += obj_reloc_entry_size (finfo->output_bfd); diff -uprN binutils-2.11.90.0.31/bfd/archive.c binutils-2.11.92.0.5/bfd/archive.c --- binutils-2.11.90.0.31/bfd/archive.c Wed Aug 22 08:52:09 2001 +++ binutils-2.11.92.0.5/bfd/archive.c Mon Oct 1 15:25:20 2001 @@ -1,6 +1,6 @@ /* BFD back-end for archive files (libraries). Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000 + 2000, 2001 Free Software Foundation, Inc. Written by Cygnus Support. Mostly Gumby Henkel-Wallace's fault. @@ -132,7 +132,7 @@ DESCRIPTION #include "libbfd.h" #include "aout/ar.h" #include "aout/ranlib.h" -#include +#include "safe-ctype.h" #ifndef errno extern int errno; @@ -173,9 +173,9 @@ boolean _bfd_generic_mkarchive (abfd) bfd *abfd; { - abfd->tdata.aout_ar_data = ((struct artdata *) - bfd_zalloc (abfd, sizeof (struct artdata))); + bfd_size_type amt = sizeof (struct artdata); + abfd->tdata.aout_ar_data = (struct artdata *) bfd_zalloc (abfd, amt); if (bfd_ardata (abfd) == NULL) return false; @@ -284,10 +284,9 @@ _bfd_add_bfd_to_archive_cache (arch_bfd, bfd *arch_bfd, *new_elt; file_ptr filepos; { - struct ar_cache *new_cache = ((struct ar_cache *) - bfd_zalloc (arch_bfd, - sizeof (struct ar_cache))); + bfd_size_type amt = sizeof (struct ar_cache); + struct ar_cache *new_cache = (struct ar_cache *) bfd_zalloc (arch_bfd, amt); if (new_cache == NULL) return false; @@ -358,14 +357,14 @@ _bfd_generic_read_ar_hdr_mag (abfd, mag) { struct ar_hdr hdr; char *hdrp = (char *) &hdr; - unsigned int parsed_size; + size_t parsed_size; struct areltdata *ared; char *filename = NULL; - unsigned int namelen = 0; - unsigned int allocsize = sizeof (struct areltdata) + sizeof (struct ar_hdr); + bfd_size_type namelen = 0; + bfd_size_type allocsize = sizeof (struct areltdata) + sizeof (struct ar_hdr); char *allocptr = 0; - if (bfd_read ((PTR) hdrp, 1, sizeof (struct ar_hdr), abfd) + if (bfd_bread ((PTR) hdrp, (bfd_size_type) sizeof (struct ar_hdr), abfd) != sizeof (struct ar_hdr)) { if (bfd_get_error () != bfd_error_system_call) @@ -408,7 +407,7 @@ _bfd_generic_read_ar_hdr_mag (abfd, mag) else if (hdr.ar_name[0] == '#' && hdr.ar_name[1] == '1' && hdr.ar_name[2] == '/' - && isdigit ((unsigned char) hdr.ar_name[3])) + && ISDIGIT (hdr.ar_name[3])) { /* BSD-4.4 extended name */ namelen = atoi (&hdr.ar_name[3]); @@ -421,7 +420,7 @@ _bfd_generic_read_ar_hdr_mag (abfd, mag) filename = (allocptr + sizeof (struct areltdata) + sizeof (struct ar_hdr)); - if (bfd_read (filename, 1, namelen, abfd) != namelen) + if (bfd_bread (filename, namelen, abfd) != namelen) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_no_more_archived_files); @@ -476,7 +475,7 @@ _bfd_generic_read_ar_hdr_mag (abfd, mag) ared->filename = allocptr + (sizeof (struct areltdata) + sizeof (struct ar_hdr)); if (namelen) - memcpy (ared->filename, hdr.ar_name, namelen); + memcpy (ared->filename, hdr.ar_name, (size_t) namelen); ared->filename[namelen] = '\0'; } @@ -601,10 +600,11 @@ bfd_generic_archive_p (abfd) { struct artdata *tdata_hold; char armag[SARMAG + 1]; + bfd_size_type amt; tdata_hold = abfd->tdata.aout_ar_data; - if (bfd_read ((PTR) armag, 1, SARMAG, abfd) != SARMAG) + if (bfd_bread ((PTR) armag, (bfd_size_type) SARMAG, abfd) != SARMAG) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -622,8 +622,8 @@ bfd_generic_archive_p (abfd) /* We are setting bfd_ardata(abfd) here, but since bfd_ardata involves a cast, we can't do it as the left operand of assignment. */ - abfd->tdata.aout_ar_data = ((struct artdata *) - bfd_zalloc (abfd, sizeof (struct artdata))); + amt = sizeof (struct artdata); + abfd->tdata.aout_ar_data = (struct artdata *) bfd_zalloc (abfd, amt); if (bfd_ardata (abfd) == NULL) return NULL; @@ -700,7 +700,7 @@ bfd_generic_archive_p (abfd) /* Some constants for a 32 bit BSD archive structure. We do not support 64 bit archives presently; so far as I know, none actually exist. Supporting them would require changing these constants, and - changing some bfd_h_get_32 to bfd_h_get_64. */ + changing some H_GET_32 to H_GET_64. */ /* The size of an external symdef structure. */ #define BSD_SYMDEF_SIZE 8 @@ -725,7 +725,7 @@ do_slurp_bsd_armap (abfd) bfd_byte *raw_armap, *rbase; struct artdata *ardata = bfd_ardata (abfd); char *stringbase; - unsigned int parsed_size; + bfd_size_type parsed_size, amt; carsym *set; mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd); @@ -738,7 +738,7 @@ do_slurp_bsd_armap (abfd) if (raw_armap == (bfd_byte *) NULL) return false; - if (bfd_read ((PTR) raw_armap, 1, parsed_size, abfd) != parsed_size) + if (bfd_bread ((PTR) raw_armap, parsed_size, abfd) != parsed_size) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_malformed_archive); @@ -747,7 +747,7 @@ do_slurp_bsd_armap (abfd) return false; } - ardata->symdef_count = bfd_h_get_32 (abfd, raw_armap) / BSD_SYMDEF_SIZE; + ardata->symdef_count = H_GET_32 (abfd, raw_armap) / BSD_SYMDEF_SIZE; if (ardata->symdef_count * BSD_SYMDEF_SIZE > parsed_size - BSD_SYMDEF_COUNT_SIZE) @@ -762,9 +762,8 @@ do_slurp_bsd_armap (abfd) stringbase = ((char *) rbase + ardata->symdef_count * BSD_SYMDEF_SIZE + BSD_STRING_COUNT_SIZE); - ardata->symdefs = (carsym *) bfd_alloc (abfd, - (ardata->symdef_count - * sizeof (carsym))); + amt = (bfd_size_type) ardata->symdef_count * sizeof (carsym); + ardata->symdefs = (carsym *) bfd_alloc (abfd, amt); if (!ardata->symdefs) return false; @@ -772,8 +771,8 @@ do_slurp_bsd_armap (abfd) counter < ardata->symdef_count; counter++, set++, rbase += BSD_SYMDEF_SIZE) { - set->name = bfd_h_get_32 (abfd, rbase) + stringbase; - set->file_offset = bfd_h_get_32 (abfd, rbase + BSD_SYMDEF_OFFSET_SIZE); + set->name = H_GET_32 (abfd, rbase) + stringbase; + set->file_offset = H_GET_32 (abfd, rbase + BSD_SYMDEF_OFFSET_SIZE); } ardata->first_file_filepos = bfd_tell (abfd); @@ -796,13 +795,14 @@ do_slurp_coff_armap (abfd) int *raw_armap, *rawptr; struct artdata *ardata = bfd_ardata (abfd); char *stringbase; - unsigned int stringsize; + bfd_size_type stringsize; unsigned int parsed_size; carsym *carsyms; - unsigned int nsymz; /* Number of symbols in armap. */ + bfd_size_type nsymz; /* Number of symbols in armap. */ bfd_vma (*swap) PARAMS ((const bfd_byte *)); char int_buf[sizeof (long)]; - unsigned int carsym_size, ptrsize, i; + bfd_size_type carsym_size, ptrsize; + unsigned int i; mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd); if (mapdata == NULL) @@ -810,7 +810,7 @@ do_slurp_coff_armap (abfd) parsed_size = mapdata->parsed_size; bfd_release (abfd, (PTR) mapdata); /* Don't need it any more. */ - if (bfd_read ((PTR) int_buf, 1, 4, abfd) != 4) + if (bfd_bread ((PTR) int_buf, (bfd_size_type) 4, abfd) != 4) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_malformed_archive); @@ -855,8 +855,8 @@ do_slurp_coff_armap (abfd) raw_armap = (int *) bfd_alloc (abfd, ptrsize); if (raw_armap == NULL) goto release_symdefs; - if (bfd_read ((PTR) raw_armap, 1, ptrsize, abfd) != ptrsize - || bfd_read ((PTR) stringbase, 1, stringsize, abfd) != stringsize) + if (bfd_bread ((PTR) raw_armap, ptrsize, abfd) != ptrsize + || (bfd_bread ((PTR) stringbase, stringsize, abfd) != stringsize)) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_malformed_archive); @@ -886,7 +886,7 @@ do_slurp_coff_armap (abfd) { struct areltdata *tmp; - bfd_seek (abfd, ardata->first_file_filepos, SEEK_SET); + bfd_seek (abfd, ardata->first_file_filepos, SEEK_SET); tmp = (struct areltdata *) _bfd_read_ar_hdr (abfd); if (tmp != NULL) { @@ -894,7 +894,7 @@ do_slurp_coff_armap (abfd) && tmp->arch_header[1] == ' ') { ardata->first_file_filepos += - (tmp->parsed_size + sizeof (struct ar_hdr) + 1) & ~1; + (tmp->parsed_size + sizeof (struct ar_hdr) + 1) & ~(unsigned) 1; } bfd_release (abfd, tmp); } @@ -917,14 +917,14 @@ bfd_slurp_armap (abfd) bfd *abfd; { char nextname[17]; - int i = bfd_read ((PTR) nextname, 1, 16, abfd); + int i = bfd_bread ((PTR) nextname, (bfd_size_type) 16, abfd); if (i == 0) return true; if (i != 16) return false; - if (bfd_seek (abfd, (file_ptr) - 16, SEEK_CUR) != 0) + if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0) return false; if (!strncmp (nextname, "__.SYMDEF ", 16) @@ -961,8 +961,9 @@ bfd_slurp_bsd_armap_f2 (abfd) struct artdata *ardata = bfd_ardata (abfd); char *stringbase; unsigned int stringsize; + bfd_size_type amt; carsym *set; - int i = bfd_read ((PTR) nextname, 1, 16, abfd); + int i = bfd_bread ((PTR) nextname, (bfd_size_type) 16, abfd); if (i == 0) return true; @@ -970,7 +971,7 @@ bfd_slurp_bsd_armap_f2 (abfd) return false; /* The archive has at least 16 bytes in it. */ - if (bfd_seek (abfd, -16L, SEEK_CUR) != 0) + if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0) return false; if (!strncmp (nextname, "__.SYMDEF ", 16) @@ -987,7 +988,8 @@ bfd_slurp_bsd_armap_f2 (abfd) if (mapdata == NULL) return false; - raw_armap = (bfd_byte *) bfd_zalloc (abfd, mapdata->parsed_size); + amt = mapdata->parsed_size; + raw_armap = (bfd_byte *) bfd_zalloc (abfd, amt); if (raw_armap == NULL) { byebye: @@ -995,8 +997,7 @@ bfd_slurp_bsd_armap_f2 (abfd) return false; } - if (bfd_read ((PTR) raw_armap, 1, mapdata->parsed_size, abfd) != - mapdata->parsed_size) + if (bfd_bread ((PTR) raw_armap, amt, abfd) != amt) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_malformed_archive); @@ -1005,7 +1006,7 @@ bfd_slurp_bsd_armap_f2 (abfd) goto byebye; } - ardata->symdef_count = bfd_h_get_16 (abfd, (PTR) raw_armap); + ardata->symdef_count = H_GET_16 (abfd, (PTR) raw_armap); if (ardata->symdef_count * BSD_SYMDEF_SIZE > mapdata->parsed_size - HPUX_SYMDEF_COUNT_SIZE) @@ -1017,15 +1018,14 @@ bfd_slurp_bsd_armap_f2 (abfd) ardata->cache = 0; - stringsize = bfd_h_get_32 (abfd, raw_armap + HPUX_SYMDEF_COUNT_SIZE); + stringsize = H_GET_32 (abfd, raw_armap + HPUX_SYMDEF_COUNT_SIZE); /* Skip sym count and string sz. */ stringbase = ((char *) raw_armap + HPUX_SYMDEF_COUNT_SIZE + BSD_STRING_COUNT_SIZE); rbase = (bfd_byte *) stringbase + stringsize; - ardata->symdefs = (carsym *) bfd_alloc (abfd, - (ardata->symdef_count - * BSD_SYMDEF_SIZE)); + amt = (bfd_size_type) ardata->symdef_count * BSD_SYMDEF_SIZE; + ardata->symdefs = (carsym *) bfd_alloc (abfd, amt); if (!ardata->symdefs) return false; @@ -1033,8 +1033,8 @@ bfd_slurp_bsd_armap_f2 (abfd) counter < ardata->symdef_count; counter++, set++, rbase += BSD_SYMDEF_SIZE) { - set->name = bfd_h_get_32 (abfd, rbase) + stringbase; - set->file_offset = bfd_h_get_32 (abfd, rbase + BSD_SYMDEF_OFFSET_SIZE); + set->name = H_GET_32 (abfd, rbase) + stringbase; + set->file_offset = H_GET_32 (abfd, rbase + BSD_SYMDEF_OFFSET_SIZE); } ardata->first_file_filepos = bfd_tell (abfd); @@ -1065,13 +1065,14 @@ _bfd_slurp_extended_name_table (abfd) { char nextname[17]; struct areltdata *namedata; + bfd_size_type amt; /* FIXME: Formatting sucks here, and in case of failure of BFD_READ, we probably don't want to return true. */ bfd_seek (abfd, bfd_ardata (abfd)->first_file_filepos, SEEK_SET); - if (bfd_read ((PTR) nextname, 1, 16, abfd) == 16) + if (bfd_bread ((PTR) nextname, (bfd_size_type) 16, abfd) == 16) { - if (bfd_seek (abfd, (file_ptr) - 16, SEEK_CUR) != 0) + if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0) return false; if (strncmp (nextname, "ARFILENAMES/ ", 16) != 0 && @@ -1085,8 +1086,8 @@ _bfd_slurp_extended_name_table (abfd) if (namedata == NULL) return false; - bfd_ardata (abfd)->extended_names = - bfd_zalloc (abfd, namedata->parsed_size); + amt = namedata->parsed_size; + bfd_ardata (abfd)->extended_names = bfd_zalloc (abfd, amt); if (bfd_ardata (abfd)->extended_names == NULL) { byebye: @@ -1094,8 +1095,7 @@ _bfd_slurp_extended_name_table (abfd) return false; } - if (bfd_read ((PTR) bfd_ardata (abfd)->extended_names, 1, - namedata->parsed_size, abfd) != namedata->parsed_size) + if (bfd_bread ((PTR) bfd_ardata (abfd)->extended_names, amt, abfd) != amt) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_malformed_archive); @@ -1145,8 +1145,8 @@ normalize (abfd, file) bfd *abfd; const char *file; { - CONST char *first; - CONST char *last; + const char *first; + const char *last; char *copy; first = file + strlen (file) - 1; @@ -1164,7 +1164,7 @@ normalize (abfd, file) first--; } - copy = (char *) bfd_alloc (abfd, last - first + 1); + copy = (char *) bfd_alloc (abfd, (bfd_size_type) (last - first + 1)); if (copy == NULL) return NULL; @@ -1242,7 +1242,7 @@ _bfd_construct_extended_name_table (abfd bfd_size_type *tablen; { unsigned int maxname = abfd->xvec->ar_max_namelen; - unsigned int total_namelen = 0; + bfd_size_type total_namelen = 0; bfd *current; char *strptr; @@ -1390,6 +1390,7 @@ bfd_ar_hdr_from_filesystem (abfd, filena struct areltdata *ared; struct ar_hdr *hdr; char *temp, *temp1; + bfd_size_type amt; if (member && (member->flags & BFD_IN_MEMORY) != 0) { @@ -1407,8 +1408,8 @@ bfd_ar_hdr_from_filesystem (abfd, filena return NULL; } - ared = (struct areltdata *) bfd_zalloc (abfd, sizeof (struct ar_hdr) + - sizeof (struct areltdata)); + amt = sizeof (struct ar_hdr) + sizeof (struct areltdata); + ared = (struct areltdata *) bfd_zalloc (abfd, amt); if (ared == NULL) return NULL; hdr = (struct ar_hdr *) (((char *) ared) + sizeof (struct areltdata)); @@ -1535,7 +1536,7 @@ bfd_generic_stat_arch_elt (abfd, buf) void bfd_dont_truncate_arname (abfd, pathname, arhdr) bfd *abfd; - CONST char *pathname; + const char *pathname; char *arhdr; { /* FIXME: This interacts unpleasantly with ar's quick-append option. @@ -1575,13 +1576,13 @@ bfd_dont_truncate_arname (abfd, pathname void bfd_bsd_truncate_arname (abfd, pathname, arhdr) bfd *abfd; - CONST char *pathname; + const char *pathname; char *arhdr; { struct ar_hdr *hdr = (struct ar_hdr *) arhdr; - int length; - CONST char *filename = strrchr (pathname, '/'); - int maxlen = ar_maxnamelen (abfd); + size_t length; + const char *filename = strrchr (pathname, '/'); + size_t maxlen = ar_maxnamelen (abfd); #ifdef HAVE_DOS_BASED_FILE_SYSTEM { @@ -1626,13 +1627,13 @@ bfd_bsd_truncate_arname (abfd, pathname, void bfd_gnu_truncate_arname (abfd, pathname, arhdr) bfd *abfd; - CONST char *pathname; + const char *pathname; char *arhdr; { struct ar_hdr *hdr = (struct ar_hdr *) arhdr; - int length; - CONST char *filename = strrchr (pathname, '/'); - int maxlen = ar_maxnamelen (abfd); + size_t length; + const char *filename = strrchr (pathname, '/'); + size_t maxlen = ar_maxnamelen (abfd); #ifdef HAVE_DOS_BASED_FILE_SYSTEM { @@ -1731,16 +1732,16 @@ _bfd_write_archive_contents (arch) if (bfd_seek (arch, (file_ptr) 0, SEEK_SET) != 0) return false; #ifdef GNU960 - wrote = bfd_write (BFD_GNU960_ARMAG (arch), 1, SARMAG, arch); + wrote = bfd_bwrite (BFD_GNU960_ARMAG (arch), (bfd_size_type) SARMAG, arch); #else - wrote = bfd_write (ARMAG, 1, SARMAG, arch); + wrote = bfd_bwrite (ARMAG, (bfd_size_type) SARMAG, arch); #endif if (wrote != SARMAG) return false; if (makemap && hasobjects) { - if (_bfd_compute_and_write_armap (arch, elength) != true) + if (_bfd_compute_and_write_armap (arch, (unsigned int) elength) != true) return false; } @@ -1752,18 +1753,18 @@ _bfd_write_archive_contents (arch) strcpy (hdr.ar_name, ename); /* Round size up to even number in archive header. */ sprintf (&(hdr.ar_size[0]), "%-10d", - (int) ((elength + 1) & ~1)); + (int) ((elength + 1) & ~(bfd_size_type) 1)); strncpy (hdr.ar_fmag, ARFMAG, 2); for (i = 0; i < sizeof (struct ar_hdr); i++) if (((char *) (&hdr))[i] == '\0') (((char *) (&hdr))[i]) = ' '; - if ((bfd_write ((char *) &hdr, 1, sizeof (struct ar_hdr), arch) + if ((bfd_bwrite ((PTR) &hdr, (bfd_size_type) sizeof (struct ar_hdr), arch) != sizeof (struct ar_hdr)) - || bfd_write (etable, 1, elength, arch) != elength) + || bfd_bwrite (etable, elength, arch) != elength) return false; if ((elength % 2) == 1) { - if (bfd_write ("\012", 1, 1, arch) != 1) + if (bfd_bwrite ("\012", (bfd_size_type) 1, arch) != 1) return false; } } @@ -1775,7 +1776,8 @@ _bfd_write_archive_contents (arch) struct ar_hdr *hdr = arch_hdr (current); /* Write ar header. */ - if (bfd_write ((char *) hdr, 1, sizeof (*hdr), arch) != sizeof (*hdr)) + if (bfd_bwrite ((PTR) hdr, (bfd_size_type) sizeof (*hdr), arch) + != sizeof (*hdr)) return false; if (bfd_seek (current, (file_ptr) 0, SEEK_SET) != 0) return false; @@ -1785,19 +1787,19 @@ _bfd_write_archive_contents (arch) if (amt > remaining) amt = remaining; errno = 0; - if (bfd_read (buffer, amt, 1, current) != amt) + if (bfd_bread (buffer, (bfd_size_type) amt, current) != amt) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_malformed_archive); return false; } - if (bfd_write (buffer, amt, 1, arch) != amt) + if (bfd_bwrite (buffer, (bfd_size_type) amt, arch) != amt) return false; remaining -= amt; } if ((arelt_size (current) % 2) == 1) { - if (bfd_write ("\012", 1, 1, arch) != 1) + if (bfd_bwrite ("\012", (bfd_size_type) 1, arch) != 1) return false; } } @@ -1835,25 +1837,27 @@ _bfd_compute_and_write_armap (arch, elen bfd *current; file_ptr elt_no = 0; struct orl *map = NULL; - int orl_max = 1024; /* fine initial default */ - int orl_count = 0; + unsigned int orl_max = 1024; /* fine initial default */ + unsigned int orl_count = 0; int stridx = 0; /* string index */ asymbol **syms = NULL; long syms_max = 0; boolean ret; + bfd_size_type amt; /* Dunno if this is the best place for this info... */ if (elength != 0) elength += sizeof (struct ar_hdr); elength += elength % 2; - map = (struct orl *) bfd_malloc (orl_max * sizeof (struct orl)); + amt = (bfd_size_type) orl_max * sizeof (struct orl); + map = (struct orl *) bfd_malloc (amt); if (map == NULL) goto error_return; /* We put the symbol names on the arch objalloc, and then discard them when done. */ - first_name = bfd_alloc (arch, 1); + first_name = bfd_alloc (arch, (bfd_size_type) 1); if (first_name == NULL) goto error_return; @@ -1885,7 +1889,7 @@ _bfd_compute_and_write_armap (arch, elen if (syms_max > 0) free (syms); syms_max = storage; - syms = (asymbol **) bfd_malloc ((size_t) syms_max); + syms = (asymbol **) bfd_malloc ((bfd_size_type) syms_max); if (syms == NULL) goto error_return; } @@ -1906,16 +1910,15 @@ _bfd_compute_and_write_armap (arch, elen bfd_is_com_section (sec)) && ! bfd_is_und_section (sec)) { - size_t namelen; + bfd_size_type namelen; struct orl *new_map; /* This symbol will go into the archive header. */ if (orl_count == orl_max) { orl_max *= 2; - new_map = - ((struct orl *) - bfd_realloc (map, orl_max * sizeof (struct orl))); + amt = (bfd_size_type) orl_max * sizeof (struct orl); + new_map = (struct orl *) bfd_realloc (map, amt); if (new_map == (struct orl *) NULL) goto error_return; @@ -1923,17 +1926,16 @@ _bfd_compute_and_write_armap (arch, elen } namelen = strlen (syms[src_count]->name); - map[orl_count].name = ((char **) - bfd_alloc (arch, - sizeof (char *))); + amt = sizeof (char *); + map[orl_count].name = (char **) bfd_alloc (arch, amt); if (map[orl_count].name == NULL) goto error_return; *(map[orl_count].name) = bfd_alloc (arch, namelen + 1); if (*(map[orl_count].name) == NULL) goto error_return; strcpy (*(map[orl_count].name), syms[src_count]->name); - (map[orl_count]).pos = (file_ptr) current; - (map[orl_count]).namidx = stridx; + map[orl_count].u.abfd = current; + map[orl_count].namidx = stridx; stridx += namelen + 1; ++orl_count; @@ -2011,18 +2013,18 @@ bsd_write_armap (arch, elength, map, orl for (i = 0; i < sizeof (struct ar_hdr); i++) if (((char *) (&hdr))[i] == '\0') (((char *) (&hdr))[i]) = ' '; - if (bfd_write ((char *) &hdr, 1, sizeof (struct ar_hdr), arch) + if (bfd_bwrite ((PTR) &hdr, (bfd_size_type) sizeof (struct ar_hdr), arch) != sizeof (struct ar_hdr)) return false; - bfd_h_put_32 (arch, (bfd_vma) ranlibsize, temp); - if (bfd_write (temp, 1, sizeof (temp), arch) != sizeof (temp)) + H_PUT_32 (arch, ranlibsize, temp); + if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), arch) != sizeof (temp)) return false; for (count = 0; count < orl_count; count++) { bfd_byte buf[BSD_SYMDEF_SIZE]; - if (((bfd *) (map[count]).pos) != last_elt) + if (map[count].u.abfd != last_elt) { do { @@ -2030,25 +2032,26 @@ bsd_write_armap (arch, elength, map, orl firstreal += firstreal % 2; current = current->next; } - while (current != (bfd *) (map[count]).pos); + while (current != map[count].u.abfd); } /* if new archive element */ last_elt = current; - bfd_h_put_32 (arch, map[count].namidx, buf); - bfd_h_put_32 (arch, firstreal, buf + BSD_SYMDEF_OFFSET_SIZE); - if (bfd_write (buf, BSD_SYMDEF_SIZE, 1, arch) != BSD_SYMDEF_SIZE) + H_PUT_32 (arch, map[count].namidx, buf); + H_PUT_32 (arch, firstreal, buf + BSD_SYMDEF_OFFSET_SIZE); + if (bfd_bwrite (buf, (bfd_size_type) BSD_SYMDEF_SIZE, arch) + != BSD_SYMDEF_SIZE) return false; } /* Now write the strings themselves. */ - bfd_h_put_32 (arch, stringsize, temp); - if (bfd_write (temp, 1, sizeof (temp), arch) != sizeof (temp)) + H_PUT_32 (arch, stringsize, temp); + if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), arch) != sizeof (temp)) return false; for (count = 0; count < orl_count; count++) { size_t len = strlen (*map[count].name) + 1; - if (bfd_write (*map[count].name, 1, len, arch) != len) + if (bfd_bwrite (*map[count].name, (bfd_size_type) len, arch) != len) return false; } @@ -2056,7 +2059,7 @@ bsd_write_armap (arch, elength, map, orl bug-compatible for sun's ar we use a null. */ if (padit) { - if (bfd_write ("", 1, 1, arch) != 1) + if (bfd_bwrite ("", (bfd_size_type) 1, arch) != 1) return false; } @@ -2105,7 +2108,7 @@ _bfd_archive_bsd_update_armap_timestamp bfd_ardata (arch)->armap_datepos = (SARMAG + offsetof (struct ar_hdr, ar_date[0])); if (bfd_seek (arch, bfd_ardata (arch)->armap_datepos, SEEK_SET) != 0 - || (bfd_write (hdr.ar_date, sizeof (hdr.ar_date), 1, arch) + || (bfd_bwrite (hdr.ar_date, (bfd_size_type) sizeof (hdr.ar_date), arch) != sizeof (hdr.ar_date))) { /* FIXME: bfd can't call perror. */ @@ -2146,7 +2149,7 @@ coff_write_armap (arch, elength, map, sy unsigned int ranlibsize = (symbol_count * 4) + 4; unsigned int stringsize = stridx; unsigned int mapsize = stringsize + ranlibsize; - file_ptr archive_member_file_ptr; + unsigned int archive_member_file_ptr; bfd *current = arch->archive_head; unsigned int count; struct ar_hdr hdr; @@ -2178,7 +2181,7 @@ coff_write_armap (arch, elength, map, sy /* Write the ar header for this item and the number of symbols. */ - if (bfd_write ((PTR) &hdr, 1, sizeof (struct ar_hdr), arch) + if (bfd_bwrite ((PTR) &hdr, (bfd_size_type) sizeof (struct ar_hdr), arch) != sizeof (struct ar_hdr)) return false; @@ -2197,7 +2200,7 @@ coff_write_armap (arch, elength, map, sy /* For each symbol which is used defined in this object, write out the object file's address in the archive. */ - while (count < symbol_count && ((bfd *) (map[count]).pos) == current) + while (count < symbol_count && map[count].u.abfd == current) { bfd_write_bigendian_4byte_int (arch, archive_member_file_ptr); count++; @@ -2215,7 +2218,7 @@ coff_write_armap (arch, elength, map, sy { size_t len = strlen (*map[count].name) + 1; - if (bfd_write (*map[count].name, 1, len, arch) != len) + if (bfd_bwrite (*map[count].name, (bfd_size_type) len, arch) != len) return false; } @@ -2223,7 +2226,7 @@ coff_write_armap (arch, elength, map, sy bug-compatible for arc960 we use a null. */ if (padit) { - if (bfd_write ("", 1, 1, arch) != 1) + if (bfd_bwrite ("", (bfd_size_type) 1, arch) != 1) return false; } diff -uprN binutils-2.11.90.0.31/bfd/archures.c binutils-2.11.92.0.5/bfd/archures.c --- binutils-2.11.90.0.31/bfd/archures.c Wed May 23 11:36:02 2001 +++ binutils-2.11.92.0.5/bfd/archures.c Mon Oct 1 15:25:20 2001 @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suit #include "bfd.h" #include "sysdep.h" #include "libbfd.h" -#include +#include "safe-ctype.h" /* @@ -137,11 +137,10 @@ DESCRIPTION .#define bfd_mach_mips10000 10000 .#define bfd_mach_mips12000 12000 .#define bfd_mach_mips16 16 -.#define bfd_mach_mips32 32 -.#define bfd_mach_mips32_4k 3204113 {* 32, 04, octal 'K' *} .#define bfd_mach_mips5 5 -.#define bfd_mach_mips64 64 .#define bfd_mach_mips_sb1 12310201 {* octal 'SB', 01 *} +.#define bfd_mach_mipsisa32 32 +.#define bfd_mach_mipsisa64 64 . bfd_arch_i386, {* Intel 386 *} .#define bfd_mach_i386_i386 0 .#define bfd_mach_i386_i8086 1 @@ -459,6 +458,7 @@ bfd_arch_list () const char **name_ptr; const char **name_list; const bfd_arch_info_type * const *app; + bfd_size_type amt; /* Determine the number of architectures. */ vec_length = 0; @@ -471,8 +471,8 @@ bfd_arch_list () } } - name_list = (const char **) - bfd_malloc ((vec_length + 1) * sizeof (char **)); + amt = (vec_length + 1) * sizeof (char **); + name_list = (const char **) bfd_malloc (amt); if (name_list == NULL) return NULL; @@ -752,7 +752,7 @@ bfd_default_scan (info, string) printable_name_colon = strchr (info->printable_name, ':'); if (printable_name_colon == NULL) { - int strlen_arch_name = strlen (info->arch_name); + size_t strlen_arch_name = strlen (info->arch_name); if (strncasecmp (string, info->arch_name, strlen_arch_name) == 0) { if (string[strlen_arch_name] == ':') @@ -774,7 +774,7 @@ bfd_default_scan (info, string) Attempt to match: ? */ if (printable_name_colon != NULL) { - int colon_index = printable_name_colon - info->printable_name; + size_t colon_index = printable_name_colon - info->printable_name; if (strncasecmp (string, info->printable_name, colon_index) == 0 && strcasecmp (string + colon_index, info->printable_name + colon_index + 1) == 0) @@ -813,7 +813,7 @@ bfd_default_scan (info, string) } number = 0; - while (isdigit ((unsigned char) *ptr_src)) + while (ISDIGIT (*ptr_src)) { number = number * 10 + *ptr_src - '0'; ptr_src++; diff -uprN binutils-2.11.90.0.31/bfd/armnetbsd.c binutils-2.11.92.0.5/bfd/armnetbsd.c --- binutils-2.11.90.0.31/bfd/armnetbsd.c Fri Mar 9 11:15:27 2001 +++ binutils-2.11.92.0.5/bfd/armnetbsd.c Thu Oct 4 14:35:43 2001 @@ -1,5 +1,5 @@ /* BFD back-end for NetBSD/ARM a.out-ish binaries. - Copyright 1999, 2000 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -27,12 +27,16 @@ Foundation, Inc., 59 Temple Place - Suit #define DEFAULT_MID M_ARM6_NETBSD /*#define MACHTYPE_OK(mtype) ((mtype) == M_ARM6_NETBSD)*/ -#define MY(OP) CAT (armnetbsd_, OP) +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (armnetbsd_, OP) + /* 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) CAT3(aoutarm,_32_,y) +#define NAME(x,y) CONCAT3 (aoutarm,_32_,y) #define aoutarm_32_get_section_contents aout_32_get_section_contents diff -uprN binutils-2.11.90.0.31/bfd/bfd-in.h binutils-2.11.92.0.5/bfd/bfd-in.h --- binutils-2.11.90.0.31/bfd/bfd-in.h Wed Aug 22 08:52:09 2001 +++ binutils-2.11.92.0.5/bfd/bfd-in.h Thu Oct 4 14:35:43 2001 @@ -4,10 +4,6 @@ Free Software Foundation, Inc. Contributed by Cygnus Support. -** NOTE: bfd.h and bfd-in2.h are GENERATED files. Don't change them; -** instead, change bfd-in.h or the other BFD source files processed to -** generate these files. - This file is part of BFD, the Binary File Descriptor library. This program is free software; you can redistribute it and/or modify @@ -24,25 +20,6 @@ You should have received a copy of the G along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* bfd.h -- The only header file required by users of the bfd library - -The bfd.h file is generated from bfd-in.h and various .c files; if you -change it, your changes will probably be lost. - -All the prototypes and definitions following the comment "THE FOLLOWING -IS EXTRACTED FROM THE SOURCE" are extracted from the source files for -BFD. If you change it, someone oneday will extract it from the source -again, and your changes will be lost. To save yourself from this bind, -change the definitions in the source in the bfd directory. Type "make -docs" and then "make headers" in that directory, and magically this file -will change to reflect your changes. - -If you don't have the tools to perform the extraction, then you are -safe from someone on your system trampling over your header files. -You should still maintain the equivalence between the source and this -file though; every change you make to the .c file should be reflected -here. */ - #ifndef __BFD_H_SEEN__ #define __BFD_H_SEEN__ @@ -51,8 +28,22 @@ extern "C" { #endif #include "ansidecl.h" +#include "symcat.h" +#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE) +#ifndef SABER +/* This hack is to avoid a problem with some strict ANSI C preprocessors. + The problem is, "32_" is not a valid preprocessing token, and we don't + want extra underscores (e.g., "nlm_32_"). The XCONCAT2 macro will + cause the inner CONCAT2 macros to be evaluated first, producing + still-valid pp-tokens. Then the final concatenation can be done. */ +#undef CONCAT4 +#define CONCAT4(a,b,c,d) XCONCAT2(CONCAT2(a,b),CONCAT2(c,d)) +#endif +#endif -#define BFD_VERSION "@VERSION@" +#define BFD_VERSION @bfd_version@ +#define BFD_VERSION_DATE @bfd_version_date@ +#define BFD_VERSION_STRING @bfd_version_string@ /* The word size used by BFD on the host. This may be 64 with a 32 bit target if the host is 64 bit, or if other 64 bit targets have @@ -113,16 +104,6 @@ typedef enum bfd_boolean {false, true} b typedef enum bfd_boolean {bfd_fffalse, bfd_tttrue} boolean; #endif -/* A pointer to a position in a file. */ -/* FIXME: This should be using off_t from . - For now, try to avoid breaking stuff by not including here. - This will break on systems with 64-bit file offsets (e.g. 4.4BSD). - Probably the best long-term answer is to avoid using file_ptr AND off_t - in this header file, and to handle this in the BFD implementation - rather than in its interface. */ -/* typedef off_t file_ptr; */ -typedef long int file_ptr; - /* Support for different sizes of target format ints and addresses. If the type `long' is at least 64 bits, BFD_HOST_64BIT_LONG will be set to 1 above. Otherwise, if gcc is being used, this code will @@ -190,6 +171,17 @@ typedef unsigned long bfd_size_type; #endif /* not BFD64 */ +/* A pointer to a position in a file. */ +/* FIXME: This should be using off_t from . + For now, try to avoid breaking stuff by not including here. + This will break on systems with 64-bit file offsets (e.g. 4.4BSD). + Probably the best long-term answer is to avoid using file_ptr AND off_t + in this header file, and to handle this in the BFD implementation + rather than in its interface. */ +/* typedef off_t file_ptr; */ +typedef bfd_signed_vma file_ptr; +typedef bfd_vma ufile_ptr; + extern void bfd_sprintf_vma PARAMS ((bfd *, char *, bfd_vma)); extern void bfd_fprintf_vma PARAMS ((bfd *, PTR, bfd_vma)); @@ -300,7 +292,10 @@ typedef struct carsym { Perhaps just a forward definition would do? */ struct orl { /* output ranlib */ char **name; /* symbol name */ - file_ptr pos; /* bfd* or file position */ + union { + file_ptr pos; + bfd *abfd; + } u; /* bfd* or file position */ int namidx; /* index into string table */ }; @@ -352,11 +347,11 @@ typedef struct _symbol_info { symvalue value; char type; - CONST char *name; /* Symbol name. */ + const char *name; /* Symbol name. */ unsigned char stab_type; /* Stab type. */ char stab_other; /* Stab other. */ short stab_desc; /* Stab desc. */ - CONST char *stab_name; /* String for stab type. */ + const char *stab_name; /* String for stab type. */ } symbol_info; /* Get the name of a stabs type code. */ @@ -449,47 +444,39 @@ extern void bfd_hash_traverse PARAMS ((s boolean (*) (struct bfd_hash_entry *, PTR), PTR info)); - -/* Semi-portable string concatenation in cpp. - The CAT4 hack is to avoid a problem with some strict ANSI C preprocessors. - The problem is, "32_" is not a valid preprocessing token, and we don't - want extra underscores (e.g., "nlm_32_"). The XCAT2 macro will cause the - inner CAT macros to be evaluated first, producing still-valid pp-tokens. - Then the final concatenation can be done. (Sigh.) */ -#ifndef CAT -#ifdef SABER -#define CAT(a,b) a##b -#define CAT3(a,b,c) a##b##c -#define CAT4(a,b,c,d) a##b##c##d -#else -#if defined(__STDC__) || defined(ALMOST_STDC) -#define CAT(a,b) a##b -#define CAT3(a,b,c) a##b##c -#define XCAT2(a,b) CAT(a,b) -#define CAT4(a,b,c,d) XCAT2(CAT(a,b),CAT(c,d)) -#else -#define CAT(a,b) a/**/b -#define CAT3(a,b,c) a/**/b/**/c -#define CAT4(a,b,c,d) a/**/b/**/c/**/d -#endif -#endif -#endif #define COFF_SWAP_TABLE (PTR) &bfd_coff_std_swap_table - + /* User program access to BFD facilities */ /* Direct I/O routines, for programs which know more about the object file than BFD does. Use higher level routines if possible. */ -extern bfd_size_type bfd_read - PARAMS ((PTR, bfd_size_type size, bfd_size_type nitems, bfd *abfd)); -extern bfd_size_type bfd_write - PARAMS ((const PTR, bfd_size_type size, bfd_size_type nitems, bfd *abfd)); -extern int bfd_seek PARAMS ((bfd *abfd, file_ptr fp, int direction)); -extern long bfd_tell PARAMS ((bfd *abfd)); -extern int bfd_flush PARAMS ((bfd *abfd)); -extern int bfd_stat PARAMS ((bfd *abfd, struct stat *)); +extern bfd_size_type bfd_bread PARAMS ((PTR, bfd_size_type, bfd *)); +extern bfd_size_type bfd_bwrite PARAMS ((const PTR, bfd_size_type, bfd *)); +extern int bfd_seek PARAMS ((bfd *, file_ptr, int)); +extern ufile_ptr bfd_tell PARAMS ((bfd *)); +extern int bfd_flush PARAMS ((bfd *)); +extern int bfd_stat PARAMS ((bfd *, struct stat *)); + +/* Deprecated old routines. */ +#if __GNUC__ +#define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \ + (warn_deprecated ("bfd_read", __FILE__, __LINE__, __FUNCTION__), \ + bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) +#define bfd_write(BUF, ELTSIZE, NITEMS, ABFD) \ + (warn_deprecated ("bfd_write", __FILE__, __LINE__, __FUNCTION__), \ + bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) +#else +#define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \ + (warn_deprecated ("bfd_read", (const char *) 0, 0, (const char *) 0), \ + bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) +#define bfd_write(BUF, ELTSIZE, NITEMS, ABFD) \ + (warn_deprecated ("bfd_write", (const char *) 0, 0, (const char *) 0),\ + bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) +#endif +extern void warn_deprecated + PARAMS ((const char *, const char *, int, const char *)); /* Cast from const char * to char * so that caller can assign to a char * without a warning. */ @@ -722,10 +709,9 @@ extern boolean bfd_xcoff_link_record_set bfd_size_type)); extern boolean bfd_xcoff_import_symbol PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, - bfd_vma, const char *, const char *, const char *)); + bfd_vma, const char *, const char *, const char *, unsigned int)); extern boolean bfd_xcoff_export_symbol - PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, - boolean)); + PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *)); extern boolean bfd_xcoff_link_count_reloc PARAMS ((bfd *, struct bfd_link_info *, const char *)); extern boolean bfd_xcoff_record_link_assignment diff -uprN binutils-2.11.90.0.31/bfd/bfd-in2.h binutils-2.11.92.0.5/bfd/bfd-in2.h --- binutils-2.11.90.0.31/bfd/bfd-in2.h Thu Aug 30 09:30:36 2001 +++ binutils-2.11.92.0.5/bfd/bfd-in2.h Thu Oct 4 14:35:43 2001 @@ -1,13 +1,15 @@ +/* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically + generated from "bfd-in.h", "init.c", "opncls.c", "libbfd.c", + "section.c", "archures.c", "reloc.c", "syms.c", "bfd.c", "archive.c", + "corefile.c", "targets.c" and "format.c". + Run "make headers" in your build bfd/ to regenerate. */ + /* Main header file for the bfd library -- portable access to object files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Contributed by Cygnus Support. -** NOTE: bfd.h and bfd-in2.h are GENERATED files. Don't change them; -** instead, change bfd-in.h or the other BFD source files processed to -** generate these files. - This file is part of BFD, the Binary File Descriptor library. This program is free software; you can redistribute it and/or modify @@ -24,25 +26,6 @@ You should have received a copy of the G along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* bfd.h -- The only header file required by users of the bfd library - -The bfd.h file is generated from bfd-in.h and various .c files; if you -change it, your changes will probably be lost. - -All the prototypes and definitions following the comment "THE FOLLOWING -IS EXTRACTED FROM THE SOURCE" are extracted from the source files for -BFD. If you change it, someone oneday will extract it from the source -again, and your changes will be lost. To save yourself from this bind, -change the definitions in the source in the bfd directory. Type "make -docs" and then "make headers" in that directory, and magically this file -will change to reflect your changes. - -If you don't have the tools to perform the extraction, then you are -safe from someone on your system trampling over your header files. -You should still maintain the equivalence between the source and this -file though; every change you make to the .c file should be reflected -here. */ - #ifndef __BFD_H_SEEN__ #define __BFD_H_SEEN__ @@ -51,8 +34,22 @@ extern "C" { #endif #include "ansidecl.h" +#include "symcat.h" +#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE) +#ifndef SABER +/* This hack is to avoid a problem with some strict ANSI C preprocessors. + The problem is, "32_" is not a valid preprocessing token, and we don't + want extra underscores (e.g., "nlm_32_"). The XCONCAT2 macro will + cause the inner CONCAT2 macros to be evaluated first, producing + still-valid pp-tokens. Then the final concatenation can be done. */ +#undef CONCAT4 +#define CONCAT4(a,b,c,d) XCONCAT2(CONCAT2(a,b),CONCAT2(c,d)) +#endif +#endif -#define BFD_VERSION "@VERSION@" +#define BFD_VERSION @bfd_version@ +#define BFD_VERSION_DATE @bfd_version_date@ +#define BFD_VERSION_STRING @bfd_version_string@ /* The word size used by BFD on the host. This may be 64 with a 32 bit target if the host is 64 bit, or if other 64 bit targets have @@ -113,16 +110,6 @@ typedef enum bfd_boolean {false, true} b typedef enum bfd_boolean {bfd_fffalse, bfd_tttrue} boolean; #endif -/* A pointer to a position in a file. */ -/* FIXME: This should be using off_t from . - For now, try to avoid breaking stuff by not including here. - This will break on systems with 64-bit file offsets (e.g. 4.4BSD). - Probably the best long-term answer is to avoid using file_ptr AND off_t - in this header file, and to handle this in the BFD implementation - rather than in its interface. */ -/* typedef off_t file_ptr; */ -typedef long int file_ptr; - /* Support for different sizes of target format ints and addresses. If the type `long' is at least 64 bits, BFD_HOST_64BIT_LONG will be set to 1 above. Otherwise, if gcc is being used, this code will @@ -190,6 +177,17 @@ typedef unsigned long bfd_size_type; #endif /* not BFD64 */ +/* A pointer to a position in a file. */ +/* FIXME: This should be using off_t from . + For now, try to avoid breaking stuff by not including here. + This will break on systems with 64-bit file offsets (e.g. 4.4BSD). + Probably the best long-term answer is to avoid using file_ptr AND off_t + in this header file, and to handle this in the BFD implementation + rather than in its interface. */ +/* typedef off_t file_ptr; */ +typedef bfd_signed_vma file_ptr; +typedef bfd_vma ufile_ptr; + extern void bfd_sprintf_vma PARAMS ((bfd *, char *, bfd_vma)); extern void bfd_fprintf_vma PARAMS ((bfd *, PTR, bfd_vma)); @@ -300,7 +298,10 @@ typedef struct carsym { Perhaps just a forward definition would do? */ struct orl { /* output ranlib */ char **name; /* symbol name */ - file_ptr pos; /* bfd* or file position */ + union { + file_ptr pos; + bfd *abfd; + } u; /* bfd* or file position */ int namidx; /* index into string table */ }; @@ -352,11 +353,11 @@ typedef struct _symbol_info { symvalue value; char type; - CONST char *name; /* Symbol name. */ + const char *name; /* Symbol name. */ unsigned char stab_type; /* Stab type. */ char stab_other; /* Stab other. */ short stab_desc; /* Stab desc. */ - CONST char *stab_name; /* String for stab type. */ + const char *stab_name; /* String for stab type. */ } symbol_info; /* Get the name of a stabs type code. */ @@ -449,47 +450,39 @@ extern void bfd_hash_traverse PARAMS ((s boolean (*) (struct bfd_hash_entry *, PTR), PTR info)); - -/* Semi-portable string concatenation in cpp. - The CAT4 hack is to avoid a problem with some strict ANSI C preprocessors. - The problem is, "32_" is not a valid preprocessing token, and we don't - want extra underscores (e.g., "nlm_32_"). The XCAT2 macro will cause the - inner CAT macros to be evaluated first, producing still-valid pp-tokens. - Then the final concatenation can be done. (Sigh.) */ -#ifndef CAT -#ifdef SABER -#define CAT(a,b) a##b -#define CAT3(a,b,c) a##b##c -#define CAT4(a,b,c,d) a##b##c##d -#else -#if defined(__STDC__) || defined(ALMOST_STDC) -#define CAT(a,b) a##b -#define CAT3(a,b,c) a##b##c -#define XCAT2(a,b) CAT(a,b) -#define CAT4(a,b,c,d) XCAT2(CAT(a,b),CAT(c,d)) -#else -#define CAT(a,b) a/**/b -#define CAT3(a,b,c) a/**/b/**/c -#define CAT4(a,b,c,d) a/**/b/**/c/**/d -#endif -#endif -#endif #define COFF_SWAP_TABLE (PTR) &bfd_coff_std_swap_table - + /* User program access to BFD facilities */ /* Direct I/O routines, for programs which know more about the object file than BFD does. Use higher level routines if possible. */ -extern bfd_size_type bfd_read - PARAMS ((PTR, bfd_size_type size, bfd_size_type nitems, bfd *abfd)); -extern bfd_size_type bfd_write - PARAMS ((const PTR, bfd_size_type size, bfd_size_type nitems, bfd *abfd)); -extern int bfd_seek PARAMS ((bfd *abfd, file_ptr fp, int direction)); -extern long bfd_tell PARAMS ((bfd *abfd)); -extern int bfd_flush PARAMS ((bfd *abfd)); -extern int bfd_stat PARAMS ((bfd *abfd, struct stat *)); +extern bfd_size_type bfd_bread PARAMS ((PTR, bfd_size_type, bfd *)); +extern bfd_size_type bfd_bwrite PARAMS ((const PTR, bfd_size_type, bfd *)); +extern int bfd_seek PARAMS ((bfd *, file_ptr, int)); +extern ufile_ptr bfd_tell PARAMS ((bfd *)); +extern int bfd_flush PARAMS ((bfd *)); +extern int bfd_stat PARAMS ((bfd *, struct stat *)); + +/* Deprecated old routines. */ +#if __GNUC__ +#define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \ + (warn_deprecated ("bfd_read", __FILE__, __LINE__, __FUNCTION__), \ + bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) +#define bfd_write(BUF, ELTSIZE, NITEMS, ABFD) \ + (warn_deprecated ("bfd_write", __FILE__, __LINE__, __FUNCTION__), \ + bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) +#else +#define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \ + (warn_deprecated ("bfd_read", (const char *) 0, 0, (const char *) 0), \ + bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) +#define bfd_write(BUF, ELTSIZE, NITEMS, ABFD) \ + (warn_deprecated ("bfd_write", (const char *) 0, 0, (const char *) 0),\ + bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) +#endif +extern void warn_deprecated + PARAMS ((const char *, const char *, int, const char *)); /* Cast from const char * to char * so that caller can assign to a char * without a warning. */ @@ -722,10 +715,9 @@ extern boolean bfd_xcoff_link_record_set bfd_size_type)); extern boolean bfd_xcoff_import_symbol PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, - bfd_vma, const char *, const char *, const char *)); + bfd_vma, const char *, const char *, const char *, unsigned int)); extern boolean bfd_xcoff_export_symbol - PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, - boolean)); + PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *)); extern boolean bfd_xcoff_link_count_reloc PARAMS ((bfd *, struct bfd_link_info *, const char *)); extern boolean bfd_xcoff_record_link_assignment @@ -797,16 +789,16 @@ void bfd_init PARAMS ((void)); bfd * -bfd_openr PARAMS ((CONST char *filename, CONST char *target)); +bfd_openr PARAMS ((const char *filename, const char *target)); bfd * -bfd_fdopenr PARAMS ((CONST char *filename, CONST char *target, int fd)); +bfd_fdopenr PARAMS ((const char *filename, const char *target, int fd)); bfd * bfd_openstreamr PARAMS ((const char *, const char *, PTR)); bfd * -bfd_openw PARAMS ((CONST char *filename, CONST char *target)); +bfd_openw PARAMS ((const char *filename, const char *target)); boolean bfd_close PARAMS ((bfd *abfd)); @@ -815,7 +807,7 @@ boolean bfd_close_all_done PARAMS ((bfd *)); bfd * -bfd_create PARAMS ((CONST char *filename, bfd *templ)); +bfd_create PARAMS ((const char *filename, bfd *templ)); boolean bfd_make_writable PARAMS ((bfd *abfd)); @@ -831,9 +823,9 @@ bfd_make_readable PARAMS ((bfd *abfd)); #define bfd_put_signed_8 \ bfd_put_8 #define bfd_get_8(abfd, ptr) \ - (*(unsigned char *) (ptr)) + (*(unsigned char *) (ptr) & 0xff) #define bfd_get_signed_8(abfd, ptr) \ - ((*(unsigned char *) (ptr) ^ 0x80) - 0x80) + (((*(unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80) #define bfd_put_16(abfd, val, ptr) \ BFD_SEND(abfd, bfd_putx16, ((val),(ptr))) @@ -863,14 +855,14 @@ bfd_make_readable PARAMS ((bfd *abfd)); BFD_SEND(abfd, bfd_getx_signed_64, (ptr)) #define bfd_get(bits, abfd, ptr) \ - ((bits) == 8 ? bfd_get_8 (abfd, ptr) \ + ( (bits) == 8 ? (bfd_vma) bfd_get_8 (abfd, ptr) \ : (bits) == 16 ? bfd_get_16 (abfd, ptr) \ : (bits) == 32 ? bfd_get_32 (abfd, ptr) \ : (bits) == 64 ? bfd_get_64 (abfd, ptr) \ : (abort (), (bfd_vma) - 1)) #define bfd_put(bits, abfd, val, ptr) \ - ((bits) == 8 ? bfd_put_8 (abfd, val, ptr) \ + ( (bits) == 8 ? bfd_put_8 (abfd, val, ptr) \ : (bits) == 16 ? bfd_put_16 (abfd, val, ptr) \ : (bits) == 32 ? bfd_put_32 (abfd, val, ptr) \ : (bits) == 64 ? bfd_put_64 (abfd, val, ptr) \ @@ -880,40 +872,88 @@ bfd_make_readable PARAMS ((bfd *abfd)); /* Byte swapping macros for file header data. */ #define bfd_h_put_8(abfd, val, ptr) \ - bfd_put_8 (abfd, val, ptr) + bfd_put_8 (abfd, val, ptr) #define bfd_h_put_signed_8(abfd, val, ptr) \ - bfd_put_8 (abfd, val, ptr) + bfd_put_8 (abfd, val, ptr) #define bfd_h_get_8(abfd, ptr) \ - bfd_get_8 (abfd, ptr) + bfd_get_8 (abfd, ptr) #define bfd_h_get_signed_8(abfd, ptr) \ - bfd_get_signed_8 (abfd, ptr) + bfd_get_signed_8 (abfd, ptr) #define bfd_h_put_16(abfd, val, ptr) \ - BFD_SEND(abfd, bfd_h_putx16,(val,ptr)) + BFD_SEND (abfd, bfd_h_putx16, (val, ptr)) #define bfd_h_put_signed_16 \ - bfd_h_put_16 + bfd_h_put_16 #define bfd_h_get_16(abfd, ptr) \ - BFD_SEND(abfd, bfd_h_getx16,(ptr)) + BFD_SEND (abfd, bfd_h_getx16, (ptr)) #define bfd_h_get_signed_16(abfd, ptr) \ - BFD_SEND(abfd, bfd_h_getx_signed_16, (ptr)) + BFD_SEND (abfd, bfd_h_getx_signed_16, (ptr)) #define bfd_h_put_32(abfd, val, ptr) \ - BFD_SEND(abfd, bfd_h_putx32,(val,ptr)) + BFD_SEND (abfd, bfd_h_putx32, (val, ptr)) #define bfd_h_put_signed_32 \ - bfd_h_put_32 + bfd_h_put_32 #define bfd_h_get_32(abfd, ptr) \ - BFD_SEND(abfd, bfd_h_getx32,(ptr)) + BFD_SEND (abfd, bfd_h_getx32, (ptr)) #define bfd_h_get_signed_32(abfd, ptr) \ - BFD_SEND(abfd, bfd_h_getx_signed_32, (ptr)) + BFD_SEND (abfd, bfd_h_getx_signed_32, (ptr)) #define bfd_h_put_64(abfd, val, ptr) \ - BFD_SEND(abfd, bfd_h_putx64,(val, ptr)) + BFD_SEND (abfd, bfd_h_putx64, (val, ptr)) #define bfd_h_put_signed_64 \ - bfd_h_put_64 + bfd_h_put_64 #define bfd_h_get_64(abfd, ptr) \ - BFD_SEND(abfd, bfd_h_getx64,(ptr)) + BFD_SEND (abfd, bfd_h_getx64, (ptr)) #define bfd_h_get_signed_64(abfd, ptr) \ - BFD_SEND(abfd, bfd_h_getx_signed_64, (ptr)) + BFD_SEND (abfd, bfd_h_getx_signed_64, (ptr)) + +/* Refinements on the above, which should eventually go away. Save + cluttering the source with (bfd_vma) and (bfd_byte *) casts. */ + +#define H_PUT_64(abfd, val, where) \ + bfd_h_put_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) + +#define H_PUT_32(abfd, val, where) \ + bfd_h_put_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) + +#define H_PUT_16(abfd, val, where) \ + bfd_h_put_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) + +#define H_PUT_8 bfd_h_put_8 + +#define H_PUT_S64(abfd, val, where) \ + bfd_h_put_signed_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) + +#define H_PUT_S32(abfd, val, where) \ + bfd_h_put_signed_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) + +#define H_PUT_S16(abfd, val, where) \ + bfd_h_put_signed_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) + +#define H_PUT_S8 bfd_h_put_signed_8 + +#define H_GET_64(abfd, where) \ + bfd_h_get_64 ((abfd), (bfd_byte *) (where)) + +#define H_GET_32(abfd, where) \ + bfd_h_get_32 ((abfd), (bfd_byte *) (where)) + +#define H_GET_16(abfd, where) \ + bfd_h_get_16 ((abfd), (bfd_byte *) (where)) + +#define H_GET_8 bfd_h_get_8 + +#define H_GET_S64(abfd, where) \ + bfd_h_get_signed_64 ((abfd), (bfd_byte *) (where)) + +#define H_GET_S32(abfd, where) \ + bfd_h_get_signed_32 ((abfd), (bfd_byte *) (where)) + +#define H_GET_S16(abfd, where) \ + bfd_h_get_signed_16 ((abfd), (bfd_byte *) (where)) + +#define H_GET_S8 bfd_h_get_signed_8 + /* This structure is used for a comdat section, as in PE. A comdat section is associated with a particular symbol. When the linker @@ -971,9 +1011,11 @@ typedef struct sec some relocation information too. */ #define SEC_RELOC 0x004 -#if 0 /* Obsolete ? */ -#define SEC_BALIGN 0x008 -#endif + /* ELF reserves 4 processor specific bits and 8 operating system + specific bits in sh_flags; at present we can get away with just + one in communicating between the assembler and BFD, but this + isn't a good long-term solution. */ +#define SEC_ARCH_BIT_0 0x008 /* A signal to the OS that the section contains read only data. */ #define SEC_READONLY 0x010 @@ -1249,10 +1291,6 @@ typedef struct sec struct bfd_comdat_info *comdat; - /* Points to the kept section if this section is a link-once section, - and is discarded. */ - struct sec *kept_section; - /* When a section is being output, this value changes as more linenumbers are written out. */ @@ -1348,18 +1386,18 @@ boolean bfd_set_section_size PARAMS ((bfd *abfd, asection *sec, bfd_size_type val)); boolean -bfd_set_section_contents PARAMS ((bfd *abfd, - asection *section, - PTR data, - file_ptr offset, +bfd_set_section_contents PARAMS ((bfd *abfd, asection *section, + PTR data, file_ptr offset, bfd_size_type count)); boolean -bfd_get_section_contents PARAMS ((bfd *abfd, asection *section, PTR location, - file_ptr offset, bfd_size_type count)); +bfd_get_section_contents PARAMS ((bfd *abfd, asection *section, + PTR location, file_ptr offset, + bfd_size_type count)); boolean -bfd_copy_private_section_data PARAMS ((bfd *ibfd, asection *isec, bfd *obfd, asection *osec)); +bfd_copy_private_section_data PARAMS ((bfd *ibfd, asection *isec, + bfd *obfd, asection *osec)); #define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \ BFD_SEND (obfd, _bfd_copy_private_section_data, \ @@ -1437,11 +1475,10 @@ enum bfd_architecture #define bfd_mach_mips10000 10000 #define bfd_mach_mips12000 12000 #define bfd_mach_mips16 16 -#define bfd_mach_mips32 32 -#define bfd_mach_mips32_4k 3204113 /* 32, 04, octal 'K' */ #define bfd_mach_mips5 5 -#define bfd_mach_mips64 64 #define bfd_mach_mips_sb1 12310201 /* octal 'SB', 01 */ +#define bfd_mach_mipsisa32 32 +#define bfd_mach_mipsisa64 64 bfd_arch_i386, /* Intel 386 */ #define bfd_mach_i386_i386 0 #define bfd_mach_i386_i8086 1 @@ -1631,31 +1668,31 @@ bfd_arch_mach_octets_per_byte PARAMS ((e typedef enum bfd_reloc_status { - /* No errors detected */ + /* No errors detected */ bfd_reloc_ok, - /* The relocation was performed, but there was an overflow. */ + /* The relocation was performed, but there was an overflow. */ bfd_reloc_overflow, - /* The address to relocate was not within the section supplied. */ + /* The address to relocate was not within the section supplied. */ bfd_reloc_outofrange, - /* Used by special functions */ + /* Used by special functions */ bfd_reloc_continue, - /* Unsupported relocation size requested. */ + /* Unsupported relocation size requested. */ bfd_reloc_notsupported, - /* Unused */ + /* Unused */ bfd_reloc_other, - /* The symbol to relocate against was undefined. */ + /* The symbol to relocate against was undefined. */ bfd_reloc_undefined, - /* The relocation was performed, but may not be ok - presently - generated only when linking i960 coff files with i960 b.out - symbols. If this type is returned, the error_message argument - to bfd_perform_relocation will be set. */ + /* The relocation was performed, but may not be ok - presently + generated only when linking i960 coff files with i960 b.out + symbols. If this type is returned, the error_message argument + to bfd_perform_relocation will be set. */ bfd_reloc_dangerous } bfd_reloc_status_type; @@ -1663,155 +1700,156 @@ typedef enum bfd_reloc_status typedef struct reloc_cache_entry { - /* A pointer into the canonical table of pointers */ + /* A pointer into the canonical table of pointers */ struct symbol_cache_entry **sym_ptr_ptr; - /* offset in section */ + /* offset in section */ bfd_size_type address; - /* addend for relocation value */ + /* addend for relocation value */ bfd_vma addend; - /* Pointer to how to perform the required relocation */ + /* Pointer to how to perform the required relocation */ reloc_howto_type *howto; } arelent; enum complain_overflow { - /* Do not complain on overflow. */ + /* Do not complain on overflow. */ complain_overflow_dont, - /* Complain if the bitfield overflows, whether it is considered - as signed or unsigned. */ + /* Complain if the bitfield overflows, whether it is considered + as signed or unsigned. */ complain_overflow_bitfield, - /* Complain if the value overflows when considered as signed - number. */ + /* Complain if the value overflows when considered as signed + number. */ complain_overflow_signed, - /* Complain if the value overflows when considered as an - unsigned number. */ + /* Complain if the value overflows when considered as an + unsigned number. */ complain_overflow_unsigned }; struct reloc_howto_struct { - /* The type field has mainly a documentary use - the back end can - do what it wants with it, though normally the back end's - external idea of what a reloc number is stored - in this field. For example, a PC relative word relocation - in a coff environment has the type 023 - because that's - what the outside world calls a R_PCRWORD reloc. */ + /* The type field has mainly a documentary use - the back end can + do what it wants with it, though normally the back end's + external idea of what a reloc number is stored + in this field. For example, a PC relative word relocation + in a coff environment has the type 023 - because that's + what the outside world calls a R_PCRWORD reloc. */ unsigned int type; - /* The value the final relocation is shifted right by. This drops - unwanted data from the relocation. */ + /* The value the final relocation is shifted right by. This drops + unwanted data from the relocation. */ unsigned int rightshift; - /* The size of the item to be relocated. This is *not* a - power-of-two measure. To get the number of bytes operated - on by a type of relocation, use bfd_get_reloc_size. */ + /* The size of the item to be relocated. This is *not* a + power-of-two measure. To get the number of bytes operated + on by a type of relocation, use bfd_get_reloc_size. */ int size; - /* The number of bits in the item to be relocated. This is used - when doing overflow checking. */ + /* The number of bits in the item to be relocated. This is used + when doing overflow checking. */ unsigned int bitsize; - /* Notes that the relocation is relative to the location in the - data section of the addend. The relocation function will - subtract from the relocation value the address of the location - being relocated. */ + /* Notes that the relocation is relative to the location in the + data section of the addend. The relocation function will + subtract from the relocation value the address of the location + being relocated. */ boolean pc_relative; - /* The bit position of the reloc value in the destination. - The relocated value is left shifted by this amount. */ + /* The bit position of the reloc value in the destination. + The relocated value is left shifted by this amount. */ unsigned int bitpos; - /* What type of overflow error should be checked for when - relocating. */ + /* What type of overflow error should be checked for when + relocating. */ enum complain_overflow complain_on_overflow; - /* If this field is non null, then the supplied function is - called rather than the normal function. This allows really - strange relocation methods to be accomodated (e.g., i960 callj - instructions). */ + /* If this field is non null, then the supplied function is + called rather than the normal function. This allows really + strange relocation methods to be accomodated (e.g., i960 callj + instructions). */ bfd_reloc_status_type (*special_function) - PARAMS ((bfd *abfd, - arelent *reloc_entry, - struct symbol_cache_entry *symbol, - PTR data, - asection *input_section, - bfd *output_bfd, - char **error_message)); + PARAMS ((bfd *, arelent *, struct symbol_cache_entry *, PTR, asection *, + bfd *, char **)); - /* The textual name of the relocation type. */ + /* The textual name of the relocation type. */ char *name; - /* Some formats record a relocation addend in the section contents - rather than with the relocation. For ELF formats this is the - distinction between USE_REL and USE_RELA (though the code checks - for USE_REL == 1/0). The value of this field is TRUE if the - addend is recorded with the section contents; when performing a - partial link (ld -r) the section contents (the data) will be - modified. The value of this field is FALSE if addends are - recorded with the relocation (in arelent.addend); when performing - a partial link the relocation will be modified. - All relocations for all ELF USE_RELA targets should set this field - to FALSE (values of TRUE should be looked on with suspicion). - However, the converse is not true: not all relocations of all ELF - USE_REL targets set this field to TRUE. Why this is so is peculiar - to each particular target. For relocs that aren't used in partial - links (e.g. GOT stuff) it doesn't matter what this is set to. */ + /* Some formats record a relocation addend in the section contents + rather than with the relocation. For ELF formats this is the + distinction between USE_REL and USE_RELA (though the code checks + for USE_REL == 1/0). The value of this field is TRUE if the + addend is recorded with the section contents; when performing a + partial link (ld -r) the section contents (the data) will be + modified. The value of this field is FALSE if addends are + recorded with the relocation (in arelent.addend); when performing + a partial link the relocation will be modified. + All relocations for all ELF USE_RELA targets should set this field + to FALSE (values of TRUE should be looked on with suspicion). + However, the converse is not true: not all relocations of all ELF + USE_REL targets set this field to TRUE. Why this is so is peculiar + to each particular target. For relocs that aren't used in partial + links (e.g. GOT stuff) it doesn't matter what this is set to. */ boolean partial_inplace; - /* The src_mask selects which parts of the read in data - are to be used in the relocation sum. E.g., if this was an 8 bit - byte of data which we read and relocated, this would be - 0x000000ff. When we have relocs which have an addend, such as - sun4 extended relocs, the value in the offset part of a - relocating field is garbage so we never use it. In this case - the mask would be 0x00000000. */ + /* The src_mask selects which parts of the read in data + are to be used in the relocation sum. E.g., if this was an 8 bit + byte of data which we read and relocated, this would be + 0x000000ff. When we have relocs which have an addend, such as + sun4 extended relocs, the value in the offset part of a + relocating field is garbage so we never use it. In this case + the mask would be 0x00000000. */ bfd_vma src_mask; - /* The dst_mask selects which parts of the instruction are replaced - into the instruction. In most cases src_mask == dst_mask, - except in the above special case, where dst_mask would be - 0x000000ff, and src_mask would be 0x00000000. */ + /* The dst_mask selects which parts of the instruction are replaced + into the instruction. In most cases src_mask == dst_mask, + except in the above special case, where dst_mask would be + 0x000000ff, and src_mask would be 0x00000000. */ bfd_vma dst_mask; - /* When some formats create PC relative instructions, they leave - the value of the pc of the place being relocated in the offset - slot of the instruction, so that a PC relative relocation can - be made just by adding in an ordinary offset (e.g., sun3 a.out). - Some formats leave the displacement part of an instruction - empty (e.g., m88k bcs); this flag signals the fact.*/ + /* When some formats create PC relative instructions, they leave + the value of the pc of the place being relocated in the offset + slot of the instruction, so that a PC relative relocation can + be made just by adding in an ordinary offset (e.g., sun3 a.out). + Some formats leave the displacement part of an instruction + empty (e.g., m88k bcs); this flag signals the fact. */ boolean pcrel_offset; - }; -#define HOWTO(C, R,S,B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \ - {(unsigned)C,R,S,B, P, BI, O,SF,NAME,INPLACE,MASKSRC,MASKDST,PC} -#define NEWHOWTO( FUNCTION, NAME,SIZE,REL,IN) HOWTO(0,0,SIZE,0,REL,0,complain_overflow_dont,FUNCTION, NAME,false,0,0,IN) +#define HOWTO(C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \ + { (unsigned) C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC } +#define NEWHOWTO(FUNCTION, NAME, SIZE, REL, IN) \ + HOWTO (0, 0, SIZE, 0, REL, 0, complain_overflow_dont, FUNCTION, \ + NAME, false, 0, 0, IN) #define EMPTY_HOWTO(C) \ - HOWTO((C),0,0,0,false,0,complain_overflow_dont,NULL,NULL,false,0,0,false) + HOWTO ((C), 0, 0, 0, false, 0, complain_overflow_dont, NULL, \ + NULL, false, 0, 0, false) -#define HOWTO_PREPARE(relocation, symbol) \ - { \ - if (symbol != (asymbol *)NULL) { \ - if (bfd_is_com_section (symbol->section)) { \ - relocation = 0; \ - } \ - else { \ - relocation = symbol->value; \ - } \ - } \ -} +#define HOWTO_PREPARE(relocation, symbol) \ + { \ + if (symbol != (asymbol *) NULL) \ + { \ + if (bfd_is_com_section (symbol->section)) \ + { \ + relocation = 0; \ + } \ + else \ + { \ + relocation = symbol->value; \ + } \ + } \ + } unsigned int bfd_get_reloc_size PARAMS ((reloc_howto_type *)); -typedef struct relent_chain { +typedef struct relent_chain +{ arelent relent; - struct relent_chain *next; + struct relent_chain *next; } arelent_chain; bfd_reloc_status_type bfd_check_overflow PARAMS ((enum complain_overflow how, @@ -2018,24 +2056,11 @@ as the absolute section symbol), and the of instruction using the register: 1 - "memory" fmt insn 2 - byte-manipulation (byte offset reg) -3 - jsr (target of branch) - -The GNU linker currently doesn't do any of this optimizing. */ +3 - jsr (target of branch) */ BFD_RELOC_ALPHA_LITERAL, BFD_RELOC_ALPHA_ELF_LITERAL, BFD_RELOC_ALPHA_LITUSE, -/* The BFD_RELOC_ALPHA_USER_* relocations are used by the assembler to -process the explicit !!sequence relocations, and are mapped -into the normal relocations at the end of processing. */ - BFD_RELOC_ALPHA_USER_LITERAL, - BFD_RELOC_ALPHA_USER_LITUSE_BASE, - BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF, - BFD_RELOC_ALPHA_USER_LITUSE_JSR, - BFD_RELOC_ALPHA_USER_GPDISP, - BFD_RELOC_ALPHA_USER_GPRELHIGH, - BFD_RELOC_ALPHA_USER_GPRELLOW, - /* The HINT relocation indicates a value that should be filled into the "hint" field of a jmp/jsr/ret instruction, for possible branch- prediction logic which may be provided on some processors. */ @@ -2049,6 +2074,11 @@ which is filled by the linker. */ which is filled by the linker. */ BFD_RELOC_ALPHA_CODEADDR, +/* The GPREL_HI/LO relocations together form a 32-bit offset from the +GP register. */ + BFD_RELOC_ALPHA_GPREL_HI16, + BFD_RELOC_ALPHA_GPREL_LO16, + /* Bits 27..2 of the relocation address shifted right 2 bits; simple reloc otherwise. */ BFD_RELOC_MIPS_JMP, @@ -2193,7 +2223,7 @@ to compensate for the borrow when the lo BFD_RELOC_PPC64_TOC16_HI, BFD_RELOC_PPC64_TOC16_HA, BFD_RELOC_PPC64_TOC, - BFD_RELOC_PPC64_PLTGOT16 , + BFD_RELOC_PPC64_PLTGOT16, BFD_RELOC_PPC64_PLTGOT16_LO, BFD_RELOC_PPC64_PLTGOT16_HI, BFD_RELOC_PPC64_PLTGOT16_HA, @@ -2854,7 +2884,7 @@ typedef struct symbol_cache_entry /* The text of the symbol. The name is left alone, and not copied; the application may not alter it. */ - CONST char *name; + const char *name; /* The value of the symbol. This really should be a union of a numeric value with a pointer, since some flags indicate that @@ -3034,7 +3064,7 @@ struct _bfd /* When a file is closed by the caching routines, BFD retains state information on the file here: */ - file_ptr where; + ufile_ptr where; /* and here: (``once'' means at least once) */ @@ -3072,7 +3102,7 @@ struct _bfd anything. I believe that this can become always an add of origin, with origin set to 0 for non archive files. */ - file_ptr origin; + ufile_ptr origin; /* Remember when output has begun, to stop strange things from happening. */ @@ -3202,6 +3232,9 @@ bfd_set_error_program_name PARAMS ((cons bfd_error_handler_type bfd_get_error_handler PARAMS ((void)); +const char * +bfd_archive_filename PARAMS ((bfd *)); + long bfd_get_reloc_upper_bound PARAMS ((bfd *abfd, asection *sect)); @@ -3340,7 +3373,7 @@ bfd_set_archive_head PARAMS ((bfd *outpu bfd * bfd_openr_next_archived_file PARAMS ((bfd *archive, bfd *previous)); -CONST char * +const char * bfd_core_file_failing_command PARAMS ((bfd *abfd)); int @@ -3406,241 +3439,232 @@ typedef struct bfd_target char symbol_leading_char; char ar_pad_char; unsigned short ar_max_namelen; - bfd_vma (*bfd_getx64) PARAMS ((const bfd_byte *)); + bfd_vma (*bfd_getx64) PARAMS ((const bfd_byte *)); bfd_signed_vma (*bfd_getx_signed_64) PARAMS ((const bfd_byte *)); - void (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *)); - bfd_vma (*bfd_getx32) PARAMS ((const bfd_byte *)); + void (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *)); + bfd_vma (*bfd_getx32) PARAMS ((const bfd_byte *)); bfd_signed_vma (*bfd_getx_signed_32) PARAMS ((const bfd_byte *)); - void (*bfd_putx32) PARAMS ((bfd_vma, bfd_byte *)); - bfd_vma (*bfd_getx16) PARAMS ((const bfd_byte *)); + void (*bfd_putx32) PARAMS ((bfd_vma, bfd_byte *)); + bfd_vma (*bfd_getx16) PARAMS ((const bfd_byte *)); bfd_signed_vma (*bfd_getx_signed_16) PARAMS ((const bfd_byte *)); - void (*bfd_putx16) PARAMS ((bfd_vma, bfd_byte *)); - bfd_vma (*bfd_h_getx64) PARAMS ((const bfd_byte *)); + void (*bfd_putx16) PARAMS ((bfd_vma, bfd_byte *)); + bfd_vma (*bfd_h_getx64) PARAMS ((const bfd_byte *)); bfd_signed_vma (*bfd_h_getx_signed_64) PARAMS ((const bfd_byte *)); - void (*bfd_h_putx64) PARAMS ((bfd_vma, bfd_byte *)); - bfd_vma (*bfd_h_getx32) PARAMS ((const bfd_byte *)); + void (*bfd_h_putx64) PARAMS ((bfd_vma, bfd_byte *)); + bfd_vma (*bfd_h_getx32) PARAMS ((const bfd_byte *)); bfd_signed_vma (*bfd_h_getx_signed_32) PARAMS ((const bfd_byte *)); - void (*bfd_h_putx32) PARAMS ((bfd_vma, bfd_byte *)); - bfd_vma (*bfd_h_getx16) PARAMS ((const bfd_byte *)); + void (*bfd_h_putx32) PARAMS ((bfd_vma, bfd_byte *)); + bfd_vma (*bfd_h_getx16) PARAMS ((const bfd_byte *)); bfd_signed_vma (*bfd_h_getx_signed_16) PARAMS ((const bfd_byte *)); - void (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *)); + void (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *)); const struct bfd_target *(*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *)); - boolean (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *)); - boolean (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *)); + boolean (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *)); + boolean (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *)); /* Generic entry points. */ -#define BFD_JUMP_TABLE_GENERIC(NAME)\ -CAT(NAME,_close_and_cleanup),\ -CAT(NAME,_bfd_free_cached_info),\ -CAT(NAME,_new_section_hook),\ -CAT(NAME,_get_section_contents),\ -CAT(NAME,_get_section_contents_in_window) +#define BFD_JUMP_TABLE_GENERIC(NAME) \ +CONCAT2 (NAME,_close_and_cleanup), \ +CONCAT2 (NAME,_bfd_free_cached_info), \ +CONCAT2 (NAME,_new_section_hook), \ +CONCAT2 (NAME,_get_section_contents), \ +CONCAT2 (NAME,_get_section_contents_in_window) /* Called when the BFD is being closed to do any necessary cleanup. */ - boolean (*_close_and_cleanup) PARAMS ((bfd *)); + boolean (*_close_and_cleanup) PARAMS ((bfd *)); /* Ask the BFD to free all cached information. */ - boolean (*_bfd_free_cached_info) PARAMS ((bfd *)); + boolean (*_bfd_free_cached_info) PARAMS ((bfd *)); /* Called when a new section is created. */ - boolean (*_new_section_hook) PARAMS ((bfd *, sec_ptr)); + boolean (*_new_section_hook) PARAMS ((bfd *, sec_ptr)); /* Read the contents of a section. */ - boolean (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR, - file_ptr, bfd_size_type)); - boolean (*_bfd_get_section_contents_in_window) - PARAMS ((bfd *, sec_ptr, bfd_window *, - file_ptr, bfd_size_type)); + boolean (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR, + file_ptr, bfd_size_type)); + boolean (*_bfd_get_section_contents_in_window) + PARAMS ((bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type)); /* Entry points to copy private data. */ -#define BFD_JUMP_TABLE_COPY(NAME)\ -CAT(NAME,_bfd_copy_private_bfd_data),\ -CAT(NAME,_bfd_merge_private_bfd_data),\ -CAT(NAME,_bfd_copy_private_section_data),\ -CAT(NAME,_bfd_copy_private_symbol_data),\ -CAT(NAME,_bfd_set_private_flags),\ -CAT(NAME,_bfd_print_private_bfd_data)\ +#define BFD_JUMP_TABLE_COPY(NAME) \ +CONCAT2 (NAME,_bfd_copy_private_bfd_data), \ +CONCAT2 (NAME,_bfd_merge_private_bfd_data), \ +CONCAT2 (NAME,_bfd_copy_private_section_data), \ +CONCAT2 (NAME,_bfd_copy_private_symbol_data), \ +CONCAT2 (NAME,_bfd_set_private_flags), \ +CONCAT2 (NAME,_bfd_print_private_bfd_data) \ /* Called to copy BFD general private data from one object file to another. */ - boolean (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *)); + boolean (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *)); /* Called to merge BFD general private data from one object file to a common output file when linking. */ - boolean (*_bfd_merge_private_bfd_data) PARAMS ((bfd *, bfd *)); + boolean (*_bfd_merge_private_bfd_data) PARAMS ((bfd *, bfd *)); /* Called to copy BFD private section data from one object file to another. */ - boolean (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr, - bfd *, sec_ptr)); + boolean (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr, + bfd *, sec_ptr)); /* Called to copy BFD private symbol data from one symbol to another. */ - boolean (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *, - bfd *, asymbol *)); + boolean (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *, + bfd *, asymbol *)); /* Called to set private backend flags */ - boolean (*_bfd_set_private_flags) PARAMS ((bfd *, flagword)); + boolean (*_bfd_set_private_flags) PARAMS ((bfd *, flagword)); /* Called to print private BFD data */ - boolean (*_bfd_print_private_bfd_data) PARAMS ((bfd *, PTR)); + boolean (*_bfd_print_private_bfd_data) PARAMS ((bfd *, PTR)); /* Core file entry points. */ -#define BFD_JUMP_TABLE_CORE(NAME)\ -CAT(NAME,_core_file_failing_command),\ -CAT(NAME,_core_file_failing_signal),\ -CAT(NAME,_core_file_matches_executable_p) +#define BFD_JUMP_TABLE_CORE(NAME) \ +CONCAT2 (NAME,_core_file_failing_command), \ +CONCAT2 (NAME,_core_file_failing_signal), \ +CONCAT2 (NAME,_core_file_matches_executable_p) char * (*_core_file_failing_command) PARAMS ((bfd *)); int (*_core_file_failing_signal) PARAMS ((bfd *)); boolean (*_core_file_matches_executable_p) PARAMS ((bfd *, bfd *)); /* Archive entry points. */ -#define BFD_JUMP_TABLE_ARCHIVE(NAME)\ -CAT(NAME,_slurp_armap),\ -CAT(NAME,_slurp_extended_name_table),\ -CAT(NAME,_construct_extended_name_table),\ -CAT(NAME,_truncate_arname),\ -CAT(NAME,_write_armap),\ -CAT(NAME,_read_ar_hdr),\ -CAT(NAME,_openr_next_archived_file),\ -CAT(NAME,_get_elt_at_index),\ -CAT(NAME,_generic_stat_arch_elt),\ -CAT(NAME,_update_armap_timestamp) +#define BFD_JUMP_TABLE_ARCHIVE(NAME) \ +CONCAT2 (NAME,_slurp_armap), \ +CONCAT2 (NAME,_slurp_extended_name_table), \ +CONCAT2 (NAME,_construct_extended_name_table), \ +CONCAT2 (NAME,_truncate_arname), \ +CONCAT2 (NAME,_write_armap), \ +CONCAT2 (NAME,_read_ar_hdr), \ +CONCAT2 (NAME,_openr_next_archived_file), \ +CONCAT2 (NAME,_get_elt_at_index), \ +CONCAT2 (NAME,_generic_stat_arch_elt), \ +CONCAT2 (NAME,_update_armap_timestamp) boolean (*_bfd_slurp_armap) PARAMS ((bfd *)); boolean (*_bfd_slurp_extended_name_table) PARAMS ((bfd *)); boolean (*_bfd_construct_extended_name_table) - PARAMS ((bfd *, char **, bfd_size_type *, const char **)); - void (*_bfd_truncate_arname) PARAMS ((bfd *, CONST char *, char *)); - boolean (*write_armap) PARAMS ((bfd *arch, - unsigned int elength, - struct orl *map, - unsigned int orl_count, - int stridx)); - PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *)); - bfd * (*openr_next_archived_file) PARAMS ((bfd *arch, bfd *prev)); + PARAMS ((bfd *, char **, bfd_size_type *, const char **)); + void (*_bfd_truncate_arname) PARAMS ((bfd *, const char *, char *)); + boolean (*write_armap) + PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int)); + PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *)); + bfd * (*openr_next_archived_file) PARAMS ((bfd *, bfd *)); #define bfd_get_elt_at_index(b,i) BFD_SEND(b, _bfd_get_elt_at_index, (b,i)) bfd * (*_bfd_get_elt_at_index) PARAMS ((bfd *, symindex)); int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *)); boolean (*_bfd_update_armap_timestamp) PARAMS ((bfd *)); /* Entry points used for symbols. */ -#define BFD_JUMP_TABLE_SYMBOLS(NAME)\ -CAT(NAME,_get_symtab_upper_bound),\ -CAT(NAME,_get_symtab),\ -CAT(NAME,_make_empty_symbol),\ -CAT(NAME,_print_symbol),\ -CAT(NAME,_get_symbol_info),\ -CAT(NAME,_bfd_is_local_label_name),\ -CAT(NAME,_get_lineno),\ -CAT(NAME,_find_nearest_line),\ -CAT(NAME,_bfd_make_debug_symbol),\ -CAT(NAME,_read_minisymbols),\ -CAT(NAME,_minisymbol_to_symbol) - long (*_bfd_get_symtab_upper_bound) PARAMS ((bfd *)); - long (*_bfd_canonicalize_symtab) PARAMS ((bfd *, - struct symbol_cache_entry **)); - struct symbol_cache_entry * - (*_bfd_make_empty_symbol) PARAMS ((bfd *)); - void (*_bfd_print_symbol) PARAMS ((bfd *, PTR, - struct symbol_cache_entry *, - bfd_print_symbol_type)); +#define BFD_JUMP_TABLE_SYMBOLS(NAME) \ +CONCAT2 (NAME,_get_symtab_upper_bound), \ +CONCAT2 (NAME,_get_symtab), \ +CONCAT2 (NAME,_make_empty_symbol), \ +CONCAT2 (NAME,_print_symbol), \ +CONCAT2 (NAME,_get_symbol_info), \ +CONCAT2 (NAME,_bfd_is_local_label_name), \ +CONCAT2 (NAME,_get_lineno), \ +CONCAT2 (NAME,_find_nearest_line), \ +CONCAT2 (NAME,_bfd_make_debug_symbol), \ +CONCAT2 (NAME,_read_minisymbols), \ +CONCAT2 (NAME,_minisymbol_to_symbol) + long (*_bfd_get_symtab_upper_bound) PARAMS ((bfd *)); + long (*_bfd_canonicalize_symtab) PARAMS ((bfd *, + struct symbol_cache_entry **)); + struct symbol_cache_entry * + (*_bfd_make_empty_symbol) PARAMS ((bfd *)); + void (*_bfd_print_symbol) PARAMS ((bfd *, PTR, + struct symbol_cache_entry *, + bfd_print_symbol_type)); #define bfd_print_symbol(b,p,s,e) BFD_SEND(b, _bfd_print_symbol, (b,p,s,e)) - void (*_bfd_get_symbol_info) PARAMS ((bfd *, - struct symbol_cache_entry *, - symbol_info *)); + void (*_bfd_get_symbol_info) PARAMS ((bfd *, + struct symbol_cache_entry *, + symbol_info *)); #define bfd_get_symbol_info(b,p,e) BFD_SEND(b, _bfd_get_symbol_info, (b,p,e)) - boolean (*_bfd_is_local_label_name) PARAMS ((bfd *, const char *)); + boolean (*_bfd_is_local_label_name) PARAMS ((bfd *, const char *)); - alent * (*_get_lineno) PARAMS ((bfd *, struct symbol_cache_entry *)); - boolean (*_bfd_find_nearest_line) PARAMS ((bfd *abfd, - struct sec *section, struct symbol_cache_entry **symbols, - bfd_vma offset, CONST char **file, CONST char **func, - unsigned int *line)); + alent * (*_get_lineno) PARAMS ((bfd *, struct symbol_cache_entry *)); + boolean (*_bfd_find_nearest_line) + PARAMS ((bfd *, struct sec *, struct symbol_cache_entry **, bfd_vma, + const char **, const char **, unsigned int *)); /* Back-door to allow format-aware applications to create debug symbols while using BFD for everything else. Currently used by the assembler when creating COFF files. */ - asymbol * (*_bfd_make_debug_symbol) PARAMS (( - bfd *abfd, - void *ptr, - unsigned long size)); + asymbol *(*_bfd_make_debug_symbol) PARAMS ((bfd *, void *, + unsigned long size)); #define bfd_read_minisymbols(b, d, m, s) \ BFD_SEND (b, _read_minisymbols, (b, d, m, s)) - long (*_read_minisymbols) PARAMS ((bfd *, boolean, PTR *, - unsigned int *)); + long (*_read_minisymbols) PARAMS ((bfd *, boolean, PTR *, + unsigned int *)); #define bfd_minisymbol_to_symbol(b, d, m, f) \ BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f)) asymbol *(*_minisymbol_to_symbol) PARAMS ((bfd *, boolean, const PTR, asymbol *)); /* Routines for relocs. */ -#define BFD_JUMP_TABLE_RELOCS(NAME)\ -CAT(NAME,_get_reloc_upper_bound),\ -CAT(NAME,_canonicalize_reloc),\ -CAT(NAME,_bfd_reloc_type_lookup) - long (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr)); - long (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **, - struct symbol_cache_entry **)); +#define BFD_JUMP_TABLE_RELOCS(NAME) \ +CONCAT2 (NAME,_get_reloc_upper_bound), \ +CONCAT2 (NAME,_canonicalize_reloc), \ +CONCAT2 (NAME,_bfd_reloc_type_lookup) + long (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr)); + long (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **, + struct symbol_cache_entry **)); /* See documentation on reloc types. */ reloc_howto_type * - (*reloc_type_lookup) PARAMS ((bfd *abfd, - bfd_reloc_code_real_type code)); + (*reloc_type_lookup) PARAMS ((bfd *, bfd_reloc_code_real_type)); /* Routines used when writing an object file. */ -#define BFD_JUMP_TABLE_WRITE(NAME)\ -CAT(NAME,_set_arch_mach),\ -CAT(NAME,_set_section_contents) - boolean (*_bfd_set_arch_mach) PARAMS ((bfd *, enum bfd_architecture, - unsigned long)); - boolean (*_bfd_set_section_contents) PARAMS ((bfd *, sec_ptr, PTR, - file_ptr, bfd_size_type)); +#define BFD_JUMP_TABLE_WRITE(NAME) \ +CONCAT2 (NAME,_set_arch_mach), \ +CONCAT2 (NAME,_set_section_contents) + boolean (*_bfd_set_arch_mach) PARAMS ((bfd *, enum bfd_architecture, + unsigned long)); + boolean (*_bfd_set_section_contents) PARAMS ((bfd *, sec_ptr, PTR, + file_ptr, bfd_size_type)); /* Routines used by the linker. */ -#define BFD_JUMP_TABLE_LINK(NAME)\ -CAT(NAME,_sizeof_headers),\ -CAT(NAME,_bfd_get_relocated_section_contents),\ -CAT(NAME,_bfd_relax_section),\ -CAT(NAME,_bfd_link_hash_table_create),\ -CAT(NAME,_bfd_link_add_symbols),\ -CAT(NAME,_bfd_final_link),\ -CAT(NAME,_bfd_link_split_section),\ -CAT(NAME,_bfd_gc_sections),\ -CAT(NAME,_bfd_merge_sections) - int (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean)); - bfd_byte * (*_bfd_get_relocated_section_contents) PARAMS ((bfd *, - struct bfd_link_info *, struct bfd_link_order *, - bfd_byte *data, boolean relocateable, - struct symbol_cache_entry **)); +#define BFD_JUMP_TABLE_LINK(NAME) \ +CONCAT2 (NAME,_sizeof_headers), \ +CONCAT2 (NAME,_bfd_get_relocated_section_contents), \ +CONCAT2 (NAME,_bfd_relax_section), \ +CONCAT2 (NAME,_bfd_link_hash_table_create), \ +CONCAT2 (NAME,_bfd_link_add_symbols), \ +CONCAT2 (NAME,_bfd_final_link), \ +CONCAT2 (NAME,_bfd_link_split_section), \ +CONCAT2 (NAME,_bfd_gc_sections), \ +CONCAT2 (NAME,_bfd_merge_sections) + int (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean)); + bfd_byte *(*_bfd_get_relocated_section_contents) + PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, + bfd_byte *, boolean, struct symbol_cache_entry **)); - boolean (*_bfd_relax_section) PARAMS ((bfd *, struct sec *, - struct bfd_link_info *, boolean *again)); + boolean (*_bfd_relax_section) + PARAMS ((bfd *, struct sec *, struct bfd_link_info *, boolean *)); /* Create a hash table for the linker. Different backends store different information in this table. */ struct bfd_link_hash_table *(*_bfd_link_hash_table_create) PARAMS ((bfd *)); /* Add symbols from this object file into the hash table. */ - boolean (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *)); + boolean (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *)); /* Do a link based on the link_order structures attached to each section of the BFD. */ - boolean (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *)); + boolean (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *)); /* Should this section be split up into smaller pieces during linking. */ - boolean (*_bfd_link_split_section) PARAMS ((bfd *, struct sec *)); + boolean (*_bfd_link_split_section) PARAMS ((bfd *, struct sec *)); /* Remove sections that are not referenced from the output. */ - boolean (*_bfd_gc_sections) PARAMS ((bfd *, struct bfd_link_info *)); + boolean (*_bfd_gc_sections) PARAMS ((bfd *, struct bfd_link_info *)); /* Attempt to merge SEC_MERGE sections. */ - boolean (*_bfd_merge_sections) PARAMS ((bfd *, struct bfd_link_info *)); + boolean (*_bfd_merge_sections) PARAMS ((bfd *, struct bfd_link_info *)); /* Routines to handle dynamic symbols and relocs. */ -#define BFD_JUMP_TABLE_DYNAMIC(NAME)\ -CAT(NAME,_get_dynamic_symtab_upper_bound),\ -CAT(NAME,_canonicalize_dynamic_symtab),\ -CAT(NAME,_get_dynamic_reloc_upper_bound),\ -CAT(NAME,_canonicalize_dynamic_reloc) +#define BFD_JUMP_TABLE_DYNAMIC(NAME) \ +CONCAT2 (NAME,_get_dynamic_symtab_upper_bound), \ +CONCAT2 (NAME,_canonicalize_dynamic_symtab), \ +CONCAT2 (NAME,_get_dynamic_reloc_upper_bound), \ +CONCAT2 (NAME,_canonicalize_dynamic_reloc) /* Get the amount of memory required to hold the dynamic symbols. */ - long (*_bfd_get_dynamic_symtab_upper_bound) PARAMS ((bfd *)); + long (*_bfd_get_dynamic_symtab_upper_bound) PARAMS ((bfd *)); /* Read in the dynamic symbols. */ - long (*_bfd_canonicalize_dynamic_symtab) + long (*_bfd_canonicalize_dynamic_symtab) PARAMS ((bfd *, struct symbol_cache_entry **)); /* Get the amount of memory required to hold the dynamic relocs. */ - long (*_bfd_get_dynamic_reloc_upper_bound) PARAMS ((bfd *)); + long (*_bfd_get_dynamic_reloc_upper_bound) PARAMS ((bfd *)); /* Read in the dynamic relocs. */ - long (*_bfd_canonicalize_dynamic_reloc) + long (*_bfd_canonicalize_dynamic_reloc) PARAMS ((bfd *, arelent **, struct symbol_cache_entry **)); /* Opposite endian version of this target. */ @@ -3653,7 +3677,7 @@ boolean bfd_set_default_target PARAMS ((const char *name)); const bfd_target * -bfd_find_target PARAMS ((CONST char *target_name, bfd *abfd)); +bfd_find_target PARAMS ((const char *target_name, bfd *abfd)); const char ** bfd_target_list PARAMS ((void)); diff -uprN binutils-2.11.90.0.31/bfd/bfd.c binutils-2.11.92.0.5/bfd/bfd.c --- binutils-2.11.90.0.31/bfd/bfd.c Mon Aug 27 11:44:50 2001 +++ binutils-2.11.92.0.5/bfd/bfd.c Mon Oct 1 15:25:20 2001 @@ -70,7 +70,7 @@ CODE_FRAGMENT . {* When a file is closed by the caching routines, BFD retains . state information on the file here: *} . -. file_ptr where; +. ufile_ptr where; . . {* and here: (``once'' means at least once) *} . @@ -108,7 +108,7 @@ CODE_FRAGMENT . anything. I believe that this can become always an add of . origin, with origin set to 0 for non archive files. *} . -. file_ptr origin; +. ufile_ptr origin; . . {* Remember when output has begun, to stop strange things . from happening. *} @@ -203,6 +203,7 @@ CODE_FRAGMENT #endif #include "libiberty.h" +#include "safe-ctype.h" #include "bfdlink.h" #include "libbfd.h" #include "coff/internal.h" @@ -211,8 +212,6 @@ CODE_FRAGMENT #include "libecoff.h" #undef obj_symbols #include "elf-bfd.h" - -#include /* provide storage for subsystem, stack and heap data which may have been passed in on the command line. Ld puts this data into a bfd_link_info @@ -411,57 +410,24 @@ static const char *_bfd_error_program_na /* This is the default routine to handle BFD error messages. */ -#ifdef ANSI_PROTOTYPES - static void _bfd_default_error_handler PARAMS ((const char *s, ...)); static void -_bfd_default_error_handler (const char *s, ...) +_bfd_default_error_handler VPARAMS ((const char *s, ...)) { - va_list p; - - if (_bfd_error_program_name != NULL) - fprintf (stderr, "%s: ", _bfd_error_program_name); - else - fprintf (stderr, "BFD: "); - - va_start (p, s); - - vfprintf (stderr, s, p); - - va_end (p); - - fprintf (stderr, "\n"); -} - -#else /* ! defined (ANSI_PROTOTYPES) */ - -static void _bfd_default_error_handler (); - -static void -_bfd_default_error_handler (va_alist) - va_dcl -{ - va_list p; - const char *s; - if (_bfd_error_program_name != NULL) fprintf (stderr, "%s: ", _bfd_error_program_name); else fprintf (stderr, "BFD: "); - va_start (p); - - s = va_arg (p, const char *); + VA_OPEN (p, s); + VA_FIXEDARG (p, const char *, s); vfprintf (stderr, s, p); - - va_end (p); + VA_CLOSE (p); fprintf (stderr, "\n"); } -#endif /* ! defined (ANSI_PROTOTYPES) */ - /* This is a function pointer to the routine which should handle BFD error messages. It is called when a BFD routine encounters an error for which it wants to print a message. Going through a @@ -530,6 +496,54 @@ bfd_get_error_handler () { return _bfd_error_handler; } + +/* +FUNCTION + bfd_archive_filename + +SYNOPSIS + const char *bfd_archive_filename (bfd *); + +DESCRIPTION + For a BFD that is a component of an archive, returns a string + with both the archive name and file name. For other BFDs, just + returns the file name. +*/ + +const char * +bfd_archive_filename (abfd) + bfd *abfd; +{ + if (abfd->my_archive) + { + static size_t curr = 0; + static char *buf; + size_t needed; + + needed = (strlen (bfd_get_filename (abfd->my_archive)) + + strlen (bfd_get_filename (abfd)) + 3); + if (needed > curr) + { + if (curr) + free (buf); + curr = needed + (needed >> 1); + buf = bfd_malloc ((bfd_size_type) curr); + /* If we can't malloc, fail safe by returning just the file + name. This function is only used when building error + messages. */ + if (!buf) + { + curr = 0; + return bfd_get_filename (abfd); + } + } + sprintf (buf, "%s(%s)", bfd_get_filename (abfd->my_archive), + bfd_get_filename (abfd)); + return buf; + } + else + return bfd_get_filename (abfd); +} /* SECTION @@ -1034,10 +1048,10 @@ bfd_scan_vma (string, end, base) /* Speed could be improved with a table like hex_value[] in gas. */ #define HEX_VALUE(c) \ - (isxdigit ((unsigned char) c) \ - ? (isdigit ((unsigned char) c) \ + (ISXDIGIT (c) \ + ? (ISDIGIT (c) \ ? (c - '0') \ - : (10 + c - (islower ((unsigned char) c) ? 'a' : 'A'))) \ + : (10 + c - (ISLOWER (c) ? 'a' : 'A'))) \ : 42) for (value = 0; (digit = HEX_VALUE (* string)) < base; string ++) @@ -1235,14 +1249,14 @@ bfd_record_phdr (abfd, type, flags_valid asection **secs; { struct elf_segment_map *m, **pm; + bfd_size_type amt; if (bfd_get_flavour (abfd) != bfd_target_elf_flavour) return true; - m = ((struct elf_segment_map *) - bfd_alloc (abfd, - (sizeof (struct elf_segment_map) - + ((size_t) count - 1) * sizeof (asection *)))); + amt = sizeof (struct elf_segment_map); + amt += ((bfd_size_type) count - 1) * sizeof (asection *); + m = (struct elf_segment_map *) bfd_alloc (abfd, amt); if (m == NULL) return false; diff -uprN binutils-2.11.90.0.31/bfd/binary.c binutils-2.11.92.0.5/bfd/binary.c --- binutils-2.11.90.0.31/bfd/binary.c Sat May 12 00:05:05 2001 +++ binutils-2.11.92.0.5/bfd/binary.c Mon Oct 1 15:25:20 2001 @@ -1,5 +1,5 @@ /* BFD back-end for binary objects. - Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000 + Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support, @@ -32,8 +32,7 @@ Foundation, Inc., 59 Temple Place - Suit the file. objcopy cooperates by specially setting the start address to zero by default. */ -#include - +#include "safe-ctype.h" #include "bfd.h" #include "sysdep.h" #include "libbfd.h" @@ -111,7 +110,7 @@ binary_object_p (abfd) && (bfd_external_binary_architecture != bfd_arch_unknown)) bfd_set_arch_info (abfd, bfd_lookup_arch (bfd_external_binary_architecture, 0)); } - + return abfd->xvec; } @@ -130,7 +129,7 @@ binary_get_section_contents (abfd, secti bfd_size_type count; { if (bfd_seek (abfd, offset, SEEK_SET) != 0 - || bfd_read (location, 1, count, abfd) != count) + || bfd_bread (location, count, abfd) != count) return false; return true; } @@ -151,7 +150,7 @@ mangle_name (abfd, suffix) bfd *abfd; char *suffix; { - int size; + bfd_size_type size; char *buf; char *p; @@ -167,7 +166,7 @@ mangle_name (abfd, suffix) /* Change any non-alphanumeric characters to underscores. */ for (p = buf; *p; p++) - if (! isalnum ((unsigned char) *p)) + if (! ISALNUM (*p)) *p = '_'; return buf; @@ -183,8 +182,9 @@ binary_get_symtab (abfd, alocation) asection *sec = (asection *) abfd->tdata.any; asymbol *syms; unsigned int i; + bfd_size_type amt = BIN_SYMS * sizeof (asymbol); - syms = (asymbol *) bfd_alloc (abfd, BIN_SYMS * sizeof (asymbol)); + syms = (asymbol *) bfd_alloc (abfd, amt); if (syms == NULL) return false; @@ -225,7 +225,7 @@ static asymbol * binary_make_empty_symbol (abfd) bfd *abfd; { - return (asymbol *) bfd_alloc (abfd, sizeof (asymbol)); + return (asymbol *) bfd_alloc (abfd, (bfd_size_type) sizeof (asymbol)); } #define binary_print_symbol _bfd_nosymbols_print_symbol diff -uprN binutils-2.11.90.0.31/bfd/bout.c binutils-2.11.92.0.5/bfd/bout.c --- binutils-2.11.90.0.31/bfd/bout.c Mon Aug 27 11:44:50 2001 +++ binutils-2.11.92.0.5/bfd/bout.c Mon Oct 1 15:25:20 2001 @@ -67,7 +67,7 @@ bout_swap_exec_header_in (abfd, raw_byte struct external_exec *bytes = (struct external_exec *)raw_bytes; /* 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_info = H_GET_32 (abfd, bytes->e_info); execp->a_text = GET_WORD (abfd, bytes->e_text); execp->a_data = GET_WORD (abfd, bytes->e_data); execp->a_bss = GET_WORD (abfd, bytes->e_bss); @@ -95,7 +95,7 @@ bout_swap_exec_header_out (abfd, execp, struct external_exec *bytes = (struct external_exec *)raw_bytes; /* 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); + 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); PUT_WORD (abfd, execp->a_bss , bytes->e_bss); @@ -117,16 +117,16 @@ b_out_object_p (abfd) { struct internal_exec anexec; struct external_exec exec_bytes; + bfd_size_type amt = EXEC_BYTES_SIZE; - if (bfd_read ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd) - != EXEC_BYTES_SIZE) + if (bfd_bread ((PTR) &exec_bytes, amt, abfd) != amt) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); return 0; } - anexec.a_info = bfd_h_get_32 (abfd, exec_bytes.e_info); + anexec.a_info = H_GET_32 (abfd, exec_bytes.e_info); if (N_BADMAG (anexec)) { @@ -206,17 +206,18 @@ b_out_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, 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; + obj_textsec (abfd) = (asection *) NULL; + obj_datasec (abfd) = (asection *) NULL; + obj_bsssec (abfd) = (asection *) NULL; return true; } @@ -257,6 +258,7 @@ b_out_write_object_contents (abfd) bfd *abfd; { struct external_exec swapped_hdr; + bfd_size_type amt; if (! aout_32_make_sections (abfd)) return false; @@ -282,9 +284,9 @@ b_out_write_object_contents (abfd) bout_swap_exec_header_out (abfd, exec_hdr (abfd), &swapped_hdr); + amt = EXEC_BYTES_SIZE; if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 - || (bfd_write ((PTR) &swapped_hdr, 1, EXEC_BYTES_SIZE, abfd) - != EXEC_BYTES_SIZE)) + || bfd_bwrite ((PTR) &swapped_hdr, amt, abfd) != amt) return false; /* Now write out reloc info, followed by syms and strings */ @@ -311,7 +313,8 @@ b_out_write_object_contents (abfd) } if (q > outsyms) - qsort (outsyms, q - outsyms, sizeof (asymbol*), b_out_symbol_cmp); + qsort (outsyms, (size_t) (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) @@ -321,7 +324,8 @@ b_out_write_object_contents (abfd) 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; @@ -372,7 +376,7 @@ calljx_callback (abfd, link_info, reloc_ BFD_ASSERT (IS_BALNAME (balsym->other)); inst &= BALX_MASK; inst |= BALX; - bfd_put_32 (abfd, inst, (bfd_byte *) dst-4); + bfd_put_32 (abfd, (bfd_vma) inst, (bfd_byte *) dst-4); symbol = balsym; value = (symbol->symbol.value + output_addr (symbol->symbol.section)); @@ -380,7 +384,7 @@ calljx_callback (abfd, link_info, reloc_ word += value + reloc_entry->addend; - bfd_put_32 (abfd, word, dst); + bfd_put_32 (abfd, (bfd_vma) word, dst); return bfd_reloc_ok; } @@ -445,7 +449,7 @@ callj_callback (abfd, link_info, reloc_e - output_addr (input_section)) & BAL_MASK); } - bfd_put_32 (abfd, word, (bfd_byte *) data + dstidx); + bfd_put_32 (abfd, (bfd_vma) word, (bfd_byte *) data + dstidx); return bfd_reloc_ok; } @@ -520,14 +524,14 @@ b_out_slurp_reloc_table (abfd, asect, sy asymbol **symbols; { register struct relocation_info *rptr; - unsigned int counter ; - arelent *cache_ptr ; + unsigned int counter; + arelent *cache_ptr; int extern_mask, pcrel_mask, callj_mask, length_shift; int incode_mask; int size_mask; bfd_vma prev_addr = 0; unsigned int count; - size_t reloc_size; + bfd_size_type reloc_size, amt; struct relocation_info *relocs; arelent *reloc_cache; @@ -559,7 +563,7 @@ b_out_slurp_reloc_table (abfd, asect, sy return false; doit: - if (bfd_seek (abfd, (file_ptr) (asect->rel_filepos), SEEK_SET) != 0) + if (bfd_seek (abfd, asect->rel_filepos, SEEK_SET) != 0) return false; count = reloc_size / sizeof (struct relocation_info); @@ -567,15 +571,16 @@ b_out_slurp_reloc_table (abfd, asect, sy if (!relocs && reloc_size != 0) return false; - reloc_cache = (arelent *) bfd_malloc ((count+1) * sizeof (arelent)); + amt = ((bfd_size_type) count + 1) * sizeof (arelent); + reloc_cache = (arelent *) bfd_malloc (amt); if (!reloc_cache) { if (relocs != NULL) - free ((char*)relocs); + free (relocs); return false; } - if (bfd_read ((PTR) relocs, 1, reloc_size, abfd) != reloc_size) + if (bfd_bread ((PTR) relocs, reloc_size, abfd) != reloc_size) { free (reloc_cache); if (relocs != NULL) @@ -611,7 +616,7 @@ b_out_slurp_reloc_table (abfd, asect, sy unsigned char *raw = (unsigned char *)rptr; unsigned int symnum; - cache_ptr->address = bfd_h_get_32 (abfd, raw + 0); + cache_ptr->address = H_GET_32 (abfd, raw + 0); cache_ptr->howto = 0; if (bfd_header_big_endian (abfd)) @@ -750,13 +755,14 @@ b_out_squirt_out_relocs (abfd, section) int len_1; unsigned int count = section->reloc_count; struct relocation_info *native, *natptr; - size_t natsize = count * sizeof (struct relocation_info); - int extern_mask, pcrel_mask, len_2, callj_mask; + bfd_size_type natsize; + int extern_mask, pcrel_mask, len_2, callj_mask; if (count == 0) return true; - generic = section->orelocation; + generic = section->orelocation; + natsize = (bfd_size_type) count * sizeof (struct relocation_info); native = ((struct relocation_info *) bfd_malloc (natsize)); if (!native && natsize != 0) return false; @@ -789,7 +795,7 @@ b_out_squirt_out_relocs (abfd, section) asymbol *sym = *(g->sym_ptr_ptr); asection *output_section = sym->section->output_section; - bfd_h_put_32(abfd, g->address, raw); + H_PUT_32 (abfd, g->address, raw); /* Find a type in the output format which matches the input howto - at the moment we assume input format == output format FIXME!! */ r_idx = 0; @@ -861,7 +867,7 @@ b_out_squirt_out_relocs (abfd, section) raw[7] |= extern_mask; } - if (bfd_write ((PTR) native, 1, natsize, abfd) != natsize) + if (bfd_bwrite ((PTR) native, natsize, abfd) != natsize) { free ((PTR)native); return false; @@ -965,10 +971,10 @@ b_out_set_section_contents (abfd, sectio if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0) return false; - if (count != 0) - return (bfd_write ((PTR)location, 1, count, abfd) == count) ? true : false; + if (count == 0) + return true; - return true; + return bfd_bwrite ((PTR) location, count, abfd) == count; } static boolean @@ -1151,7 +1157,7 @@ aligncode (abfd, input_section, r, shrin bfd_vma gap; bfd_vma old_end; bfd_vma new_end; - int shrink_delta; + unsigned int shrink_delta; int size = r->howto->size; /* Reduce the size of the alignment so that it's still aligned but @@ -1196,10 +1202,10 @@ b_out_bfd_relax_section (abfd, i, link_i /* Get enough memory to hold the stuff. */ bfd *input_bfd = i->owner; asection *input_section = i; - int shrink = 0 ; + unsigned int shrink = 0 ; arelent **reloc_vector = NULL; - long reloc_size = bfd_get_reloc_upper_bound(input_bfd, - input_section); + long reloc_size = bfd_get_reloc_upper_bound (input_bfd, + input_section); if (reloc_size < 0) return false; @@ -1212,7 +1218,7 @@ b_out_bfd_relax_section (abfd, i, link_i { long reloc_count; - reloc_vector = (arelent **) bfd_malloc (reloc_size); + reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size); if (reloc_vector == NULL && reloc_size != 0) goto error_return; @@ -1242,7 +1248,7 @@ b_out_bfd_relax_section (abfd, i, link_i link_info); break; case ABS32CODE_SHRUNK: - shrink+=4; + shrink += 4; break; } } @@ -1287,7 +1293,7 @@ b_out_bfd_get_relocated_section_contents data, relocateable, symbols); - reloc_vector = (arelent **) bfd_malloc (reloc_size); + reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size); if (reloc_vector == NULL && reloc_size != 0) goto error_return; @@ -1297,7 +1303,7 @@ b_out_bfd_get_relocated_section_contents BFD_ASSERT (true == bfd_get_section_contents (input_bfd, input_section, data, - 0, + (bfd_vma) 0, input_section->_raw_size)); reloc_count = bfd_canonicalize_reloc (input_bfd, @@ -1366,7 +1372,8 @@ b_out_bfd_get_relocated_section_contents break; case ALIGNDONE: BFD_ASSERT (reloc->addend >= src_address); - BFD_ASSERT (reloc->addend <= input_section->_raw_size); + BFD_ASSERT ((bfd_vma) reloc->addend + <= input_section->_raw_size); src_address = reloc->addend; dst_address = ((dst_address + reloc->howto->size) & ~reloc->howto->size); @@ -1394,7 +1401,7 @@ b_out_bfd_get_relocated_section_contents + reloc->addend) & BAL_MASK)); - bfd_put_32 (input_bfd, word, data + dst_address); + bfd_put_32 (input_bfd, (bfd_vma) word, data + dst_address); dst_address += 4; src_address += 4; @@ -1414,7 +1421,7 @@ b_out_bfd_get_relocated_section_contents - output_addr (input_section)) & PCREL13_MASK)); - bfd_put_32 (input_bfd, word, data + dst_address); + bfd_put_32 (input_bfd, (bfd_vma) word, data + dst_address); dst_address += 4; src_address += 4; } diff -uprN binutils-2.11.90.0.31/bfd/cache.c binutils-2.11.92.0.5/bfd/cache.c --- binutils-2.11.90.0.31/bfd/cache.c Fri Mar 9 11:37:54 2001 +++ binutils-2.11.92.0.5/bfd/cache.c Mon Oct 1 15:25:20 2001 @@ -364,7 +364,9 @@ bfd_cache_lookup_worker (abfd) { if (bfd_open_file (abfd) == NULL) return NULL; - if (fseek ((FILE *) abfd->iostream, abfd->where, SEEK_SET) != 0) + if (abfd->where != (unsigned long) abfd->where) + return NULL; + if (fseek ((FILE *) abfd->iostream, (long) abfd->where, SEEK_SET) != 0) return NULL; } diff -uprN binutils-2.11.90.0.31/bfd/cisco-core.c binutils-2.11.92.0.5/bfd/cisco-core.c --- binutils-2.11.90.0.31/bfd/cisco-core.c Fri Mar 9 11:15:28 2001 +++ binutils-2.11.92.0.5/bfd/cisco-core.c Mon Oct 1 15:25:20 2001 @@ -1,6 +1,5 @@ /* BFD back-end for CISCO crash dumps. - -Copyright 1994, 1997, 1999, 2000 Free Software Foundation, Inc. + Copyright 1994, 1997, 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -65,11 +64,17 @@ typedef struct { char database[4]; /* Base of .data section (not in V3 crash info) */ char bssbase[4]; /* Base of .bss section (not in V3 crash info) */ } crashinfo_external; - + struct cisco_core_struct { int sig; }; + +static const bfd_target *cisco_core_file_validate PARAMS ((bfd *, int)); +static const bfd_target *cisco_core_file_p PARAMS ((bfd *)); +char *cisco_core_file_failing_command PARAMS ((bfd *)); +int cisco_core_file_failing_signal PARAMS ((bfd *)); +boolean cisco_core_file_matches_executable_p PARAMS ((bfd *, bfd *)); /* Examine the file for a crash info struct at the offset given by CRASH_INFO_LOC. */ @@ -88,11 +93,12 @@ cisco_core_file_validate (abfd, crash_in unsigned int rambase; sec_ptr asect; struct stat statbuf; + bfd_size_type amt; - if (bfd_seek (abfd, crash_info_loc, SEEK_SET) != 0) + if (bfd_seek (abfd, (file_ptr) crash_info_loc, SEEK_SET) != 0) return NULL; - nread = bfd_read (buf, 1, 4, abfd); + nread = bfd_bread (buf, (bfd_size_type) 4, abfd); if (nread != 4) { if (bfd_get_error () != bfd_error_system_call) @@ -101,14 +107,14 @@ cisco_core_file_validate (abfd, crash_in } crashinfo_offset = MASK_ADDR (bfd_get_32 (abfd, buf)); - if (bfd_seek (abfd, crashinfo_offset, SEEK_SET) != 0) + if (bfd_seek (abfd, (file_ptr) crashinfo_offset, SEEK_SET) != 0) { /* Most likely we failed because of a bogus (huge) offset */ bfd_set_error (bfd_error_wrong_format); return NULL; } - nread = bfd_read (&crashinfo, 1, sizeof (crashinfo), abfd); + nread = bfd_bread (&crashinfo, (bfd_size_type) sizeof (crashinfo), abfd); if (nread != sizeof (crashinfo)) { if (bfd_get_error () != bfd_error_system_call) @@ -147,9 +153,8 @@ cisco_core_file_validate (abfd, crash_in /* OK, we believe you. You're a core file. */ - abfd->tdata.cisco_core_data = - ((struct cisco_core_struct *) - bfd_zmalloc (sizeof (struct cisco_core_struct))); + amt = sizeof (struct cisco_core_struct); + abfd->tdata.cisco_core_data = (struct cisco_core_struct *) bfd_zmalloc (amt); if (abfd->tdata.cisco_core_data == NULL) return NULL; @@ -238,7 +243,7 @@ cisco_core_file_validate (abfd, crash_in /* Create a ".reg" section to allow access to the saved registers. */ - asect = (asection *) bfd_zmalloc (sizeof (asection)); + asect = (asection *) bfd_zmalloc ((bfd_size_type) sizeof (asection)); if (asect == NULL) goto error_return; asect->name = ".reg"; @@ -257,7 +262,7 @@ cisco_core_file_validate (abfd, crash_in /* Create a ".crash" section to allow access to the saved crash information. */ - asect = (asection *) bfd_zmalloc (sizeof (asection)); + asect = (asection *) bfd_zmalloc ((bfd_size_type) sizeof (asection)); if (asect == NULL) goto error_return; asect->name = ".crash"; @@ -272,7 +277,7 @@ cisco_core_file_validate (abfd, crash_in /* Create a ".data" section that maps the entire file, which is essentially a dump of the target system's RAM. */ - asect = (asection *) bfd_zmalloc (sizeof (asection)); + asect = (asection *) bfd_zmalloc ((bfd_size_type) sizeof (asection)); if (asect == NULL) goto error_return; asect->name = ".data"; @@ -322,22 +327,22 @@ cisco_core_file_p (abfd) char * cisco_core_file_failing_command (abfd) - bfd *abfd; + bfd *abfd ATTRIBUTE_UNUSED; { return NULL; } int cisco_core_file_failing_signal (abfd) - bfd *abfd; + bfd *abfd ATTRIBUTE_UNUSED; { return abfd->tdata.cisco_core_data->sig; } boolean cisco_core_file_matches_executable_p (core_bfd, exec_bfd) - bfd *core_bfd; - bfd *exec_bfd; + bfd *core_bfd ATTRIBUTE_UNUSED; + bfd *exec_bfd ATTRIBUTE_UNUSED; { return true; } diff -uprN binutils-2.11.90.0.31/bfd/coff-a29k.c binutils-2.11.92.0.5/bfd/coff-a29k.c --- binutils-2.11.90.0.31/bfd/coff-a29k.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/coff-a29k.c Mon Oct 1 15:25:20 2001 @@ -154,14 +154,14 @@ a29k_reloc (abfd, reloc_entry, symbol_in } signed_value >>= 2; insn = INSERT_HWORD (insn, signed_value); - bfd_put_32 (abfd, insn ,hit_data); + bfd_put_32 (abfd, (bfd_vma) insn ,hit_data); break; case R_ILOHALF: insn = bfd_get_32 (abfd, hit_data); unsigned_value = EXTRACT_HWORD(insn); unsigned_value += sym_value + reloc_entry->addend; insn = INSERT_HWORD(insn, unsigned_value); - bfd_put_32 (abfd, insn, hit_data); + bfd_put_32 (abfd, (bfd_vma) insn, hit_data); break; case R_IHIHALF: insn = bfd_get_32 (abfd, hit_data); @@ -187,7 +187,7 @@ a29k_reloc (abfd, reloc_entry, symbol_in unsigned_value = unsigned_value >> 16; insn = INSERT_HWORD(insn, unsigned_value); part1_consth_active = false; - bfd_put_32 (abfd, insn, hit_data); + bfd_put_32 (abfd, (bfd_vma) insn, hit_data); break; case R_BYTE: insn = bfd_get_8 (abfd, hit_data); @@ -201,12 +201,12 @@ a29k_reloc (abfd, reloc_entry, symbol_in unsigned_value = insn + sym_value + reloc_entry->addend; if (unsigned_value & 0xffff0000) return bfd_reloc_overflow; - bfd_put_16 (abfd, insn, hit_data); + bfd_put_16 (abfd, (bfd_vma) insn, hit_data); break; case R_WORD: insn = bfd_get_32 (abfd, hit_data); insn += sym_value + reloc_entry->addend; - bfd_put_32 (abfd, insn, hit_data); + bfd_put_32 (abfd, (bfd_vma) insn, hit_data); break; default: *error_message = _("Unrecognized reloc"); @@ -482,7 +482,7 @@ coff_a29k_relocate_section (output_bfd, unsigned_value = EXTRACT_HWORD (insn); unsigned_value += val; insn = INSERT_HWORD (insn, unsigned_value); - bfd_put_32 (input_bfd, insn, loc); + bfd_put_32 (input_bfd, (bfd_vma) insn, loc); break; case R_IHIHALF: diff -uprN binutils-2.11.90.0.31/bfd/coff-alpha.c binutils-2.11.92.0.5/bfd/coff-alpha.c --- binutils-2.11.90.0.31/bfd/coff-alpha.c Wed Aug 22 08:52:09 2001 +++ binutils-2.11.92.0.5/bfd/coff-alpha.c Mon Oct 1 15:25:20 2001 @@ -76,32 +76,32 @@ static bfd *alpha_ecoff_get_elt_at_index symbol, and lineno ones. Give them ecoff names. Define some accessor macros for the large sizes used for Alpha ECOFF. */ -#define GET_FILEHDR_SYMPTR bfd_h_get_64 -#define PUT_FILEHDR_SYMPTR bfd_h_put_64 -#define GET_AOUTHDR_TSIZE bfd_h_get_64 -#define PUT_AOUTHDR_TSIZE bfd_h_put_64 -#define GET_AOUTHDR_DSIZE bfd_h_get_64 -#define PUT_AOUTHDR_DSIZE bfd_h_put_64 -#define GET_AOUTHDR_BSIZE bfd_h_get_64 -#define PUT_AOUTHDR_BSIZE bfd_h_put_64 -#define GET_AOUTHDR_ENTRY bfd_h_get_64 -#define PUT_AOUTHDR_ENTRY bfd_h_put_64 -#define GET_AOUTHDR_TEXT_START bfd_h_get_64 -#define PUT_AOUTHDR_TEXT_START bfd_h_put_64 -#define GET_AOUTHDR_DATA_START bfd_h_get_64 -#define PUT_AOUTHDR_DATA_START bfd_h_put_64 -#define GET_SCNHDR_PADDR bfd_h_get_64 -#define PUT_SCNHDR_PADDR bfd_h_put_64 -#define GET_SCNHDR_VADDR bfd_h_get_64 -#define PUT_SCNHDR_VADDR bfd_h_put_64 -#define GET_SCNHDR_SIZE bfd_h_get_64 -#define PUT_SCNHDR_SIZE bfd_h_put_64 -#define GET_SCNHDR_SCNPTR bfd_h_get_64 -#define PUT_SCNHDR_SCNPTR bfd_h_put_64 -#define GET_SCNHDR_RELPTR bfd_h_get_64 -#define PUT_SCNHDR_RELPTR bfd_h_put_64 -#define GET_SCNHDR_LNNOPTR bfd_h_get_64 -#define PUT_SCNHDR_LNNOPTR bfd_h_put_64 +#define GET_FILEHDR_SYMPTR H_GET_64 +#define PUT_FILEHDR_SYMPTR H_PUT_64 +#define GET_AOUTHDR_TSIZE H_GET_64 +#define PUT_AOUTHDR_TSIZE H_PUT_64 +#define GET_AOUTHDR_DSIZE H_GET_64 +#define PUT_AOUTHDR_DSIZE H_PUT_64 +#define GET_AOUTHDR_BSIZE H_GET_64 +#define PUT_AOUTHDR_BSIZE H_PUT_64 +#define GET_AOUTHDR_ENTRY H_GET_64 +#define PUT_AOUTHDR_ENTRY H_PUT_64 +#define GET_AOUTHDR_TEXT_START H_GET_64 +#define PUT_AOUTHDR_TEXT_START H_PUT_64 +#define GET_AOUTHDR_DATA_START H_GET_64 +#define PUT_AOUTHDR_DATA_START H_PUT_64 +#define GET_SCNHDR_PADDR H_GET_64 +#define PUT_SCNHDR_PADDR H_PUT_64 +#define GET_SCNHDR_VADDR H_GET_64 +#define PUT_SCNHDR_VADDR H_PUT_64 +#define GET_SCNHDR_SIZE H_GET_64 +#define PUT_SCNHDR_SIZE H_PUT_64 +#define GET_SCNHDR_SCNPTR H_GET_64 +#define PUT_SCNHDR_SCNPTR H_PUT_64 +#define GET_SCNHDR_RELPTR H_GET_64 +#define PUT_SCNHDR_RELPTR H_PUT_64 +#define GET_SCNHDR_LNNOPTR H_GET_64 +#define PUT_SCNHDR_LNNOPTR H_PUT_64 #define ALPHAECOFF @@ -530,8 +530,8 @@ alpha_ecoff_swap_reloc_in (abfd, ext_ptr { const RELOC *ext = (RELOC *) ext_ptr; - intern->r_vaddr = bfd_h_get_64 (abfd, (bfd_byte *) ext->r_vaddr); - intern->r_symndx = bfd_h_get_32 (abfd, (bfd_byte *) ext->r_symndx); + intern->r_vaddr = H_GET_64 (abfd, ext->r_vaddr); + intern->r_symndx = H_GET_32 (abfd, ext->r_symndx); BFD_ASSERT (bfd_header_little_endian (abfd)); @@ -603,8 +603,8 @@ alpha_ecoff_swap_reloc_out (abfd, intern BFD_ASSERT (intern->r_extern || (intern->r_symndx >= 0 && intern->r_symndx <= 14)); - bfd_h_put_64 (abfd, intern->r_vaddr, (bfd_byte *) ext->r_vaddr); - bfd_h_put_32 (abfd, symndx, (bfd_byte *) ext->r_symndx); + H_PUT_64 (abfd, intern->r_vaddr, ext->r_vaddr); + H_PUT_32 (abfd, symndx, ext->r_symndx); BFD_ASSERT (bfd_header_little_endian (abfd)); @@ -771,7 +771,7 @@ alpha_ecoff_get_relocated_section_conten if (reloc_size < 0) goto error_return; - reloc_vector = (arelent **) bfd_malloc (reloc_size); + reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size); if (reloc_vector == NULL && reloc_size != 0) goto error_return; @@ -1277,7 +1277,7 @@ alpha_convert_external_reloc (output_bfd hsec = h->root.u.def.section; name = bfd_get_section_name (output_bfd, hsec->output_section); - r_symndx = -1; + r_symndx = (unsigned long) -1; switch (name[1]) { case 'A': @@ -1356,8 +1356,7 @@ alpha_convert_external_reloc (output_bfd } /* Write out the new r_symndx value. */ - bfd_h_put_32 (input_bfd, (bfd_vma) r_symndx, - (bfd_byte *) ext_rel->r_symndx); + H_PUT_32 (input_bfd, r_symndx, ext_rel->r_symndx); return relocation; } @@ -1384,6 +1383,7 @@ alpha_relocate_section (output_bfd, info int tos = 0; struct external_reloc *ext_rel; struct external_reloc *ext_rel_end; + bfd_size_type amt; /* We keep a table mapping the symndx found in an internal reloc to the appropriate section. This is faster than looking up the @@ -1391,10 +1391,8 @@ alpha_relocate_section (output_bfd, info symndx_to_section = ecoff_data (input_bfd)->symndx_to_section; if (symndx_to_section == (asection **) NULL) { - symndx_to_section = ((asection **) - bfd_alloc (input_bfd, - (NUM_RELOC_SECTIONS - * sizeof (asection *)))); + amt = NUM_RELOC_SECTIONS * sizeof (asection *); + symndx_to_section = (asection **) bfd_alloc (input_bfd, amt); if (!symndx_to_section) return false; @@ -1451,9 +1449,9 @@ alpha_relocate_section (output_bfd, info lita_sec_data = ecoff_section_data (input_bfd, lita_sec); if (lita_sec_data == NULL) { + amt = sizeof (struct ecoff_section_tdata); lita_sec_data = ((struct ecoff_section_tdata *) - bfd_zalloc (input_bfd, - sizeof (struct ecoff_section_tdata))); + bfd_zalloc (input_bfd, amt)); ecoff_section_data (input_bfd, lita_sec) = lita_sec_data; } @@ -1522,8 +1520,8 @@ alpha_relocate_section (output_bfd, info boolean gp_usedp; bfd_vma addend; - r_vaddr = bfd_h_get_64 (input_bfd, (bfd_byte *) ext_rel->r_vaddr); - r_symndx = bfd_h_get_32 (input_bfd, (bfd_byte *) ext_rel->r_symndx); + r_vaddr = H_GET_64 (input_bfd, ext_rel->r_vaddr); + r_symndx = H_GET_32 (input_bfd, ext_rel->r_symndx); r_type = ((ext_rel->r_bits[0] & RELOC_BITS0_TYPE_LITTLE) >> RELOC_BITS0_TYPE_SH_LITTLE); @@ -1552,9 +1550,8 @@ alpha_relocate_section (output_bfd, info address of the relocation does not appear to include the section VMA, unlike the other relocation types. */ if (info->relocateable) - bfd_h_put_64 (input_bfd, - input_section->output_offset + r_vaddr, - (bfd_byte *) ext_rel->r_vaddr); + H_PUT_64 (input_bfd, input_section->output_offset + r_vaddr, + ext_rel->r_vaddr); adjust_addrp = false; break; @@ -1751,8 +1748,7 @@ alpha_relocate_section (output_bfd, info if (info->relocateable) { /* Adjust r_vaddr by the addend. */ - bfd_h_put_64 (input_bfd, addend, - (bfd_byte *) ext_rel->r_vaddr); + H_PUT_64 (input_bfd, addend, ext_rel->r_vaddr); } else { @@ -1979,12 +1975,12 @@ alpha_relocate_section (output_bfd, info if (info->relocateable && adjust_addrp) { /* Change the address of the relocation. */ - bfd_h_put_64 (input_bfd, - (input_section->output_section->vma - + input_section->output_offset - - input_section->vma - + r_vaddr), - (bfd_byte *) ext_rel->r_vaddr); + H_PUT_64 (input_bfd, + (input_section->output_section->vma + + input_section->output_offset + - input_section->vma + + r_vaddr), + ext_rel->r_vaddr); } if (gp_usedp && gp_undefined) @@ -2062,12 +2058,12 @@ alpha_ecoff_read_ar_hdr (abfd) /* This is a compressed file. We must set the size correctly. The size is the eight bytes after the dummy file header. */ - if (bfd_seek (abfd, FILHSZ, SEEK_CUR) != 0 - || bfd_read (ab, 1, 8, abfd) != 8 - || bfd_seek (abfd, - (FILHSZ + 8), SEEK_CUR) != 0) + if (bfd_seek (abfd, (file_ptr) FILHSZ, SEEK_CUR) != 0 + || bfd_bread (ab, (bfd_size_type) 8, abfd) != 8 + || bfd_seek (abfd, (file_ptr) (- (FILHSZ + 8)), SEEK_CUR) != 0) return NULL; - ret->parsed_size = bfd_h_get_64 (abfd, ab); + ret->parsed_size = H_GET_64 (abfd, ab); } return (PTR) ret; @@ -2105,20 +2101,20 @@ alpha_ecoff_get_elt_at_filepos (archive, return nbfd; /* We must uncompress this element. We do this by copying it into a - memory buffer, and making bfd_read and bfd_seek use that buffer. + memory buffer, and making bfd_bread and bfd_seek use that buffer. This can use a lot of memory, but it's simpler than getting a temporary file, making that work with the file descriptor caching code, and making sure that it is deleted at all appropriate times. It can be changed if it ever becomes important. */ /* The compressed file starts with a dummy ECOFF file header. */ - if (bfd_seek (nbfd, FILHSZ, SEEK_SET) != 0) + if (bfd_seek (nbfd, (file_ptr) FILHSZ, SEEK_SET) != 0) goto error_return; /* The next eight bytes are the real file size. */ - if (bfd_read (ab, 1, 8, nbfd) != 8) + if (bfd_bread (ab, (bfd_size_type) 8, nbfd) != 8) goto error_return; - size = bfd_h_get_64 (nbfd, ab); + size = H_GET_64 (nbfd, ab); if (size == 0) buf = NULL; @@ -2137,7 +2133,7 @@ alpha_ecoff_get_elt_at_filepos (archive, left = size; /* I don't know what the next eight bytes are for. */ - if (bfd_read (ab, 1, 8, nbfd) != 8) + if (bfd_bread (ab, (bfd_size_type) 8, nbfd) != 8) goto error_return; /* This is the uncompression algorithm. It's a simple @@ -2148,7 +2144,7 @@ alpha_ecoff_get_elt_at_filepos (archive, next eight bytes in the output stream. */ memset (dict, 0, sizeof dict); h = 0; - while (bfd_read (&b, 1, 1, nbfd) == 1) + while (bfd_bread (&b, (bfd_size_type) 1, nbfd) == 1) { unsigned int i; @@ -2160,7 +2156,7 @@ alpha_ecoff_get_elt_at_filepos (archive, n = dict[h]; else { - if (! bfd_read (&n, 1, 1, nbfd)) + if (! bfd_bread (&n, (bfd_size_type) 1, nbfd)) goto error_return; dict[h] = n; } @@ -2183,7 +2179,7 @@ alpha_ecoff_get_elt_at_filepos (archive, /* Now the uncompressed file contents are in buf. */ bim = ((struct bfd_in_memory *) - bfd_alloc (nbfd, sizeof (struct bfd_in_memory))); + bfd_alloc (nbfd, (bfd_size_type) sizeof (struct bfd_in_memory))); if (bim == NULL) goto error_return; bim->size = size; diff -uprN binutils-2.11.90.0.31/bfd/coff-arm.c binutils-2.11.92.0.5/bfd/coff-arm.c --- binutils-2.11.90.0.31/bfd/coff-arm.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/coff-arm.c Mon Oct 1 15:25:20 2001 @@ -36,18 +36,39 @@ Foundation, Inc., 59 Temple Place - Suit /* Macros for manipulation the bits in the flags field of the coff data structure. */ -#define APCS_26_FLAG( abfd ) (coff_data (abfd)->flags & F_APCS_26) -#define APCS_FLOAT_FLAG( abfd ) (coff_data (abfd)->flags & F_APCS_FLOAT) -#define PIC_FLAG( abfd ) (coff_data (abfd)->flags & F_PIC) -#define APCS_SET( abfd ) (coff_data (abfd)->flags & F_APCS_SET) -#define SET_APCS_FLAGS( abfd, flgs) (coff_data (abfd)->flags = \ - (coff_data (abfd)->flags & ~ (F_APCS_26 | F_APCS_FLOAT | F_PIC)) \ - | (flgs | F_APCS_SET)) -#define INTERWORK_FLAG( abfd ) (coff_data (abfd)->flags & F_INTERWORK) -#define INTERWORK_SET( abfd ) (coff_data (abfd)->flags & F_INTERWORK_SET) -#define SET_INTERWORK_FLAG( abfd, flg ) (coff_data (abfd)->flags = \ - (coff_data (abfd)->flags & ~ F_INTERWORK) \ - | (flg | F_INTERWORK_SET)) +#define APCS_26_FLAG(abfd) \ + (coff_data (abfd)->flags & F_APCS_26) + +#define APCS_FLOAT_FLAG(abfd) \ + (coff_data (abfd)->flags & F_APCS_FLOAT) + +#define PIC_FLAG(abfd) \ + (coff_data (abfd)->flags & F_PIC) + +#define APCS_SET(abfd) \ + (coff_data (abfd)->flags & F_APCS_SET) + +#define SET_APCS_FLAGS(abfd, flgs) \ + do \ + { \ + coff_data (abfd)->flags &= ~(F_APCS_26 | F_APCS_FLOAT | F_PIC); \ + coff_data (abfd)->flags |= (flgs) | F_APCS_SET; \ + } \ + while (0) + +#define INTERWORK_FLAG(abfd) \ + (coff_data (abfd)->flags & F_INTERWORK) + +#define INTERWORK_SET(abfd) \ + (coff_data (abfd)->flags & F_INTERWORK_SET) + +#define SET_INTERWORK_FLAG(abfd, flg) \ + do \ + { \ + coff_data (abfd)->flags &= ~F_INTERWORK; \ + coff_data (abfd)->flags |= (flg) | F_INTERWORK_SET; \ + } \ + while (0) #ifndef NUM_ELEM #define NUM_ELEM(a) ((sizeof (a)) / sizeof ((a)[0])) @@ -79,20 +100,21 @@ static boolean coff_arm_adjust_symndx asection *, struct internal_reloc *, boolean *)); static reloc_howto_type * coff_arm_rtype_to_howto PARAMS ((bfd *, asection *, struct internal_reloc *, - struct coff_link_hash_entry *, struct internal_syment *, bfd_vma *)); + struct coff_link_hash_entry *, struct internal_syment *, + bfd_vma *)); static bfd_reloc_status_type coff_thumb_pcrel_common PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **, thumb_pcrel_branchtype)); -static CONST struct reloc_howto_struct * coff_arm_reloc_type_lookup +static const struct reloc_howto_struct * coff_arm_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type)); static struct bfd_link_hash_table * coff_arm_link_hash_table_create PARAMS ((bfd *)); static insn32 insert_thumb_branch PARAMS ((insn32, int)); static struct coff_link_hash_entry * find_thumb_glue - PARAMS ((struct bfd_link_info *, CONST char *, bfd *)); + PARAMS ((struct bfd_link_info *, const char *, bfd *)); static struct coff_link_hash_entry * find_arm_glue - PARAMS ((struct bfd_link_info *, CONST char *, bfd *)); + PARAMS ((struct bfd_link_info *, const char *, bfd *)); #ifndef COFF_IMAGE_WITH_PE static void record_arm_to_thumb_glue PARAMS ((struct bfd_link_info *, struct coff_link_hash_entry *)); @@ -146,8 +168,9 @@ coff_arm_reloc (abfd, reloc_entry, symbo diff = reloc_entry->addend; -#define DOIT(x) \ - x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + diff) & howto->dst_mask)) +#define DOIT(x) \ + x = ((x & ~howto->dst_mask) \ + | (((x & howto->src_mask) + diff) & howto->dst_mask)) if (diff != 0) { @@ -168,7 +191,7 @@ coff_arm_reloc (abfd, reloc_entry, symbo { short x = bfd_get_16 (abfd, addr); DOIT (x); - bfd_put_16 (abfd, x, addr); + bfd_put_16 (abfd, (bfd_vma) x, addr); } break; @@ -176,7 +199,7 @@ coff_arm_reloc (abfd, reloc_entry, symbo { long x = bfd_get_32 (abfd, addr); DOIT (x); - bfd_put_32 (abfd, x, addr); + bfd_put_32 (abfd, (bfd_vma) x, addr); } break; @@ -636,12 +659,12 @@ aoutarm_fix_pcrel_26 (abfd, reloc_entry, if ((relocation & ~ (bfd_vma) 0x03ffffff) != ~ (bfd_vma) 0x03ffffff) flag = bfd_reloc_overflow; } - else if (relocation & ~0x03ffffff) + else if (relocation & ~(bfd_vma) 0x03ffffff) flag = bfd_reloc_overflow; target &= ~0x00ffffff; target |= (relocation >> 2) & 0x00ffffff; - bfd_put_32 (abfd, target, (bfd_byte *) data + addr); + bfd_put_32 (abfd, (bfd_vma) target, (bfd_byte *) data + addr); /* Now the ARM magic... Change the reloc type so that it is marked as done. Strictly this is only necessary if we are doing a partial relocation. */ @@ -757,16 +780,18 @@ coff_thumb_pcrel_common (abfd, reloc_ent case b23: if (bfd_big_endian (abfd)) - target |= ((relocation & 0xfff) >> 1) | ((relocation << 4) & 0x07ff0000); + target |= (((relocation & 0xfff) >> 1) + | ((relocation << 4) & 0x07ff0000)); else - target |= ((relocation & 0xffe) << 15) | ((relocation >> 12) & 0x7ff); + target |= (((relocation & 0xffe) << 15) + | ((relocation >> 12) & 0x7ff)); break; default: abort (); } - bfd_put_32 (abfd, target, (bfd_byte *) data + addr); + bfd_put_32 (abfd, (bfd_vma) target, (bfd_byte *) data + addr); /* Now the ARM magic... Change the reloc type so that it is marked as done. Strictly this is only necessary if we are doing a partial relocation. */ @@ -788,7 +813,8 @@ coff_thumb_pcrel_23 (abfd, reloc_entry, char **error_message; { return coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data, - input_section, output_bfd, error_message, b23); + input_section, output_bfd, error_message, + b23); } static bfd_reloc_status_type @@ -803,7 +829,8 @@ coff_thumb_pcrel_12 (abfd, reloc_entry, char **error_message; { return coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data, - input_section, output_bfd, error_message, b12); + input_section, output_bfd, error_message, + b12); } static bfd_reloc_status_type @@ -818,10 +845,11 @@ coff_thumb_pcrel_9 (abfd, reloc_entry, s char **error_message; { return coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data, - input_section, output_bfd, error_message, b9); + input_section, output_bfd, error_message, + b9); } -static CONST struct reloc_howto_struct * +static const struct reloc_howto_struct * coff_arm_reloc_type_lookup (abfd, code) bfd * abfd; bfd_reloc_code_real_type code; @@ -835,7 +863,7 @@ coff_arm_reloc_type_lookup (abfd, code) code = BFD_RELOC_32; break; default: - return (CONST struct reloc_howto_struct *) 0; + return (const struct reloc_howto_struct *) 0; } switch (code) @@ -860,7 +888,7 @@ coff_arm_reloc_type_lookup (abfd, code) ASTD (BFD_RELOC_THUMB_PCREL_BRANCH23, ARM_THUMB23); ASTD (BFD_RELOC_THUMB_PCREL_BLX, ARM_THUMB23); #endif - default: return (CONST struct reloc_howto_struct *) 0; + default: return (const struct reloc_howto_struct *) 0; } } @@ -881,10 +909,10 @@ struct coff_arm_link_hash_table struct coff_link_hash_table root; /* The size in bytes of the section containg the Thumb-to-ARM glue. */ - long int thumb_glue_size; + bfd_size_type thumb_glue_size; /* The size in bytes of the section containg the ARM-to-Thumb glue. */ - long int arm_glue_size; + bfd_size_type arm_glue_size; /* An arbitary input BFD chosen to hold the glue sections. */ bfd * bfd_of_glue_owner; @@ -904,9 +932,9 @@ coff_arm_link_hash_table_create (abfd) bfd * abfd; { struct coff_arm_link_hash_table * ret; + bfd_size_type amt = sizeof (struct coff_arm_link_hash_table); - ret = ((struct coff_arm_link_hash_table *) - bfd_alloc (abfd, sizeof (struct coff_arm_link_hash_table))); + ret = (struct coff_arm_link_hash_table *) bfd_alloc (abfd, amt); if (ret == (struct coff_arm_link_hash_table *) NULL) return NULL; @@ -992,7 +1020,8 @@ insert_thumb_branch (br_insn, rel_off) else if ((br_insn & HI_LOW_ORDER) == HI_LOW_ORDER) br_insn = HI_LOW_ORDER | (high_bits << 16) | low_bits; else - /* FIXME: the BFD library should never abort - it should return an error status. */ + /* FIXME: the BFD library should never abort except for internal errors + - it should return an error status. */ abort (); /* Error - not a valid branch instruction form. */ return br_insn; @@ -1000,15 +1029,15 @@ insert_thumb_branch (br_insn, rel_off) static struct coff_link_hash_entry * find_thumb_glue (info, name, input_bfd) - struct bfd_link_info * info; - CONST char * name; - bfd * input_bfd; + struct bfd_link_info *info; + const char *name; + bfd *input_bfd; { - char * tmp_name; - struct coff_link_hash_entry * myh; + char *tmp_name; + struct coff_link_hash_entry *myh; + bfd_size_type amt = strlen (name) + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1; - tmp_name = ((char *) - bfd_malloc (strlen (name) + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1)); + tmp_name = (char *) bfd_malloc (amt); BFD_ASSERT (tmp_name); @@ -1020,7 +1049,7 @@ find_thumb_glue (info, name, input_bfd) if (myh == NULL) /* xgettext:c-format */ _bfd_error_handler (_("%s: unable to find THUMB glue '%s' for `%s'"), - bfd_get_filename (input_bfd), tmp_name, name); + bfd_archive_filename (input_bfd), tmp_name, name); free (tmp_name); @@ -1029,15 +1058,15 @@ find_thumb_glue (info, name, input_bfd) static struct coff_link_hash_entry * find_arm_glue (info, name, input_bfd) - struct bfd_link_info * info; - CONST char * name; - bfd * input_bfd; + struct bfd_link_info *info; + const char *name; + bfd *input_bfd; { - char * tmp_name; + char *tmp_name; struct coff_link_hash_entry * myh; + bfd_size_type amt = strlen (name) + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1; - tmp_name = ((char *) - bfd_malloc (strlen (name) + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1)); + tmp_name = (char *) bfd_malloc (amt); BFD_ASSERT (tmp_name); @@ -1049,7 +1078,7 @@ find_arm_glue (info, name, input_bfd) if (myh == NULL) /* xgettext:c-format */ _bfd_error_handler (_("%s: unable to find ARM glue '%s' for `%s'"), - bfd_get_filename (input_bfd), tmp_name, name); + bfd_archive_filename (input_bfd), tmp_name, name); free (tmp_name); @@ -1211,7 +1240,8 @@ coff_arm_relocate_section (output_bfd, i && info->relocateable && (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) - && h->root.u.def.section->output_section == input_section->output_section) + && (h->root.u.def.section->output_section + == input_section->output_section)) { static reloc_howto_type fake_arm26_reloc = HOWTO (ARM_26, @@ -1311,7 +1341,7 @@ coff_arm_relocate_section (output_bfd, i { /* Arm code calling a Thumb function. */ unsigned long int tmp; - long int my_offset; + bfd_vma my_offset; asection * s; long int ret_offset; struct coff_link_hash_entry * myh; @@ -1343,20 +1373,20 @@ coff_arm_relocate_section (output_bfd, i _bfd_error_handler /* xgettext:c-format */ (_("%s(%s): warning: interworking not enabled."), - bfd_get_filename (h_sec->owner), name); + bfd_archive_filename (h_sec->owner), name); _bfd_error_handler /* xgettext:c-format */ (_(" first occurrence: %s: arm call to thumb"), - bfd_get_filename (input_bfd)); + bfd_archive_filename (input_bfd)); } --my_offset; myh->root.u.def.value = my_offset; - bfd_put_32 (output_bfd, a2t1_ldr_insn, + bfd_put_32 (output_bfd, (bfd_vma) a2t1_ldr_insn, s->contents + my_offset); - bfd_put_32 (output_bfd, a2t2_bx_r12_insn, + bfd_put_32 (output_bfd, (bfd_vma) a2t2_bx_r12_insn, s->contents + my_offset + 4); /* It's a thumb address. Add the low order bit. */ @@ -1365,7 +1395,7 @@ coff_arm_relocate_section (output_bfd, i if (info->base_file) arm_emit_base_file_entry (info, output_bfd, s, - my_offset + 8); + my_offset + 8); } @@ -1388,8 +1418,8 @@ coff_arm_relocate_section (output_bfd, i tmp = tmp | ((ret_offset >> 2) & 0x00FFFFFF); - bfd_put_32 (output_bfd, tmp, contents + rel->r_vaddr - - input_section->vma); + bfd_put_32 (output_bfd, (bfd_vma) tmp, + contents + rel->r_vaddr - input_section->vma); done = 1; } } @@ -1404,7 +1434,7 @@ coff_arm_relocate_section (output_bfd, i { /* Thumb code calling an ARM function */ asection * s = 0; - long int my_offset; + bfd_vma my_offset; unsigned long int tmp; long int ret_offset; struct coff_link_hash_entry * myh; @@ -1438,11 +1468,11 @@ coff_arm_relocate_section (output_bfd, i _bfd_error_handler /* xgettext:c-format */ (_("%s(%s): warning: interworking not enabled."), - bfd_get_filename (h_sec->owner), name); + bfd_archive_filename (h_sec->owner), name); _bfd_error_handler /* xgettext:c-format */ (_(" first occurrence: %s: thumb call to arm"), - bfd_get_filename (input_bfd)); + bfd_archive_filename (input_bfd)); _bfd_error_handler (_(" consider relinking with --support-old-code enabled")); } @@ -1452,22 +1482,22 @@ coff_arm_relocate_section (output_bfd, i if (globals->support_old_code) { - bfd_put_16 (output_bfd, t2a1_push_insn, + bfd_put_16 (output_bfd, (bfd_vma) t2a1_push_insn, s->contents + my_offset); - bfd_put_16 (output_bfd, t2a2_ldr_insn, + bfd_put_16 (output_bfd, (bfd_vma) t2a2_ldr_insn, s->contents + my_offset + 2); - bfd_put_16 (output_bfd, t2a3_mov_insn, + bfd_put_16 (output_bfd, (bfd_vma) t2a3_mov_insn, s->contents + my_offset + 4); - bfd_put_16 (output_bfd, t2a4_bx_insn, + bfd_put_16 (output_bfd, (bfd_vma) t2a4_bx_insn, s->contents + my_offset + 6); - bfd_put_32 (output_bfd, t2a5_pop_insn, + bfd_put_32 (output_bfd, (bfd_vma) t2a5_pop_insn, s->contents + my_offset + 8); - bfd_put_32 (output_bfd, t2a6_bx_insn, + bfd_put_32 (output_bfd, (bfd_vma) t2a6_bx_insn, s->contents + my_offset + 12); /* Store the address of the function in the last word of the stub. */ @@ -1475,14 +1505,15 @@ coff_arm_relocate_section (output_bfd, i s->contents + my_offset + 16); if (info->base_file) - arm_emit_base_file_entry (info, output_bfd, s, my_offset + 16); + arm_emit_base_file_entry (info, output_bfd, s, + my_offset + 16); } else { - bfd_put_16 (output_bfd, t2a1_bx_pc_insn, + bfd_put_16 (output_bfd, (bfd_vma) t2a1_bx_pc_insn, s->contents + my_offset); - bfd_put_16 (output_bfd, t2a2_noop_insn, + bfd_put_16 (output_bfd, (bfd_vma) t2a2_noop_insn, s->contents + my_offset + 2); ret_offset = @@ -1495,7 +1526,7 @@ coff_arm_relocate_section (output_bfd, i + 8); /* ARM branches work from the pc of the instruction + 8. */ bfd_put_32 (output_bfd, - t2a3_b_insn | ((ret_offset >> 2) & 0x00FFFFFF), + (bfd_vma) t2a3_b_insn | ((ret_offset >> 2) & 0x00FFFFFF), s->contents + my_offset + 4); } @@ -1516,9 +1547,9 @@ coff_arm_relocate_section (output_bfd, i - input_section->vma); bfd_put_32 (output_bfd, - insert_thumb_branch (tmp, ret_offset), - contents + rel->r_vaddr - - input_section->vma); + (bfd_vma) insert_thumb_branch (tmp, + ret_offset), + contents + rel->r_vaddr - input_section->vma); done = 1; } @@ -1558,7 +1589,8 @@ coff_arm_relocate_section (output_bfd, i { /* Emit a reloc if the backend thinks it needs it. */ if (sym && pe_data(output_bfd)->in_reloc_p(output_bfd, howto)) - arm_emit_base_file_entry (info, output_bfd, input_section, rel->r_vaddr); + arm_emit_base_file_entry (info, output_bfd, input_section, + rel->r_vaddr); } #if 1 /* THUMBEXTENSION */ @@ -1733,7 +1765,7 @@ coff_arm_relocate_section (output_bfd, i case bfd_reloc_outofrange: (*_bfd_error_handler) (_("%s: bad reloc address 0x%lx in section `%s'"), - bfd_get_filename (input_bfd), + bfd_archive_filename (input_bfd), (unsigned long) rel->r_vaddr, bfd_get_section_name (input_bfd, input_section)); return false; @@ -1790,10 +1822,10 @@ bfd_arm_allocate_interworking_sections ( BFD_ASSERT (s != NULL); - foo = (bfd_byte *) bfd_alloc - (globals->bfd_of_glue_owner, globals->arm_glue_size); + foo = (bfd_byte *) bfd_alloc (globals->bfd_of_glue_owner, + globals->arm_glue_size); #if 0 - memset (foo, test_char, globals->arm_glue_size); + memset (foo, test_char, (size_t) globals->arm_glue_size); #endif s->_raw_size = s->_cooked_size = globals->arm_glue_size; @@ -1809,10 +1841,10 @@ bfd_arm_allocate_interworking_sections ( BFD_ASSERT (s != NULL); - foo = (bfd_byte *) bfd_alloc - (globals->bfd_of_glue_owner, globals->thumb_glue_size); + foo = (bfd_byte *) bfd_alloc (globals->bfd_of_glue_owner, + globals->thumb_glue_size); #if 0 - memset (foo, test_char, globals->thumb_glue_size); + memset (foo, test_char, (size_t) globals->thumb_glue_size); #endif s->_raw_size = s->_cooked_size = globals->thumb_glue_size; @@ -1832,6 +1864,8 @@ record_arm_to_thumb_glue (info, h) char * tmp_name; struct coff_link_hash_entry * myh; struct coff_arm_link_hash_table * globals; + bfd_vma val; + bfd_size_type amt; globals = coff_arm_hash_table (info); @@ -1843,8 +1877,8 @@ record_arm_to_thumb_glue (info, h) BFD_ASSERT (s != NULL); - tmp_name = ((char *) - bfd_malloc (strlen (name) + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1)); + amt = strlen (name) + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1; + tmp_name = (char *) bfd_malloc (amt); BFD_ASSERT (tmp_name); @@ -1863,10 +1897,9 @@ record_arm_to_thumb_glue (info, h) though the section isn't allocated yet, this is where we will be putting it. */ + val = globals->arm_glue_size + 1; bfd_coff_link_add_one_symbol (info, globals->bfd_of_glue_owner, tmp_name, - BSF_GLOBAL, - s, globals->arm_glue_size + 1, - NULL, true, false, + BSF_GLOBAL, s, val, NULL, true, false, (struct bfd_link_hash_entry **) & myh); free (tmp_name); @@ -1886,6 +1919,8 @@ record_thumb_to_arm_glue (info, h) char * tmp_name; struct coff_link_hash_entry * myh; struct coff_arm_link_hash_table * globals; + bfd_vma val; + bfd_size_type amt; globals = coff_arm_hash_table (info); @@ -1897,7 +1932,8 @@ record_thumb_to_arm_glue (info, h) BFD_ASSERT (s != NULL); - tmp_name = (char *) bfd_malloc (strlen (name) + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1); + amt = strlen (name) + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1; + tmp_name = (char *) bfd_malloc (amt); BFD_ASSERT (tmp_name); @@ -1912,10 +1948,10 @@ record_thumb_to_arm_glue (info, h) return; /* we've already seen this guy */ } + val = globals->thumb_glue_size + 1; bfd_coff_link_add_one_symbol (info, globals->bfd_of_glue_owner, tmp_name, - BSF_GLOBAL, s, globals->thumb_glue_size + 1, - NULL, true, false, - (struct bfd_link_hash_entry **) & myh); + BSF_GLOBAL, s, val, NULL, true, false, + (struct bfd_link_hash_entry **) &myh); /* If we mark it 'thumb', the disassembler will do a better job. */ myh->class = C_THUMBEXTFUNC; @@ -1927,18 +1963,17 @@ record_thumb_to_arm_glue (info, h) #define CHANGE_TO_ARM "__%s_change_to_arm" #define BACK_FROM_ARM "__%s_back_from_arm" - tmp_name = (char *) bfd_malloc (strlen (name) + strlen (CHANGE_TO_ARM) + 1); + amt = strlen (name) + strlen (CHANGE_TO_ARM) + 1; + tmp_name = (char *) bfd_malloc (amt); BFD_ASSERT (tmp_name); sprintf (tmp_name, globals->support_old_code ? BACK_FROM_ARM : CHANGE_TO_ARM, name); myh = NULL; - + val = globals->thumb_glue_size + (globals->support_old_code ? 8 : 4); bfd_coff_link_add_one_symbol (info, globals->bfd_of_glue_owner, tmp_name, - BSF_LOCAL, s, globals->thumb_glue_size - + (globals->support_old_code ? 8 : 4), - NULL, true, false, + BSF_LOCAL, s, val, NULL, true, false, (struct bfd_link_hash_entry **) & myh); free (tmp_name); @@ -2070,7 +2105,7 @@ bfd_arm_process_before_allocation (abfd, if (symndx >= obj_conv_table_size (abfd)) { _bfd_error_handler (_("%s: illegal symbol index in reloc: %d"), - bfd_get_filename (abfd), symndx); + bfd_archive_filename (abfd), symndx); continue; } @@ -2198,7 +2233,7 @@ coff_arm_merge_private_bfd_data (ibfd, o _bfd_error_handler /* xgettext: c-format */ (_("%s: ERROR: compiled for APCS-%d whereas target %s uses APCS-%d"), - bfd_get_filename (ibfd), APCS_26_FLAG (ibfd) ? 26 : 32, + bfd_archive_filename (ibfd), APCS_26_FLAG (ibfd) ? 26 : 32, bfd_get_filename (obfd), APCS_26_FLAG (obfd) ? 26 : 32 ); @@ -2217,7 +2252,7 @@ coff_arm_merge_private_bfd_data (ibfd, o /* xgettext: c-format */ msg = _("%s: ERROR: passes floats in integer registers whereas target %s uses float registers"); - _bfd_error_handler (msg, bfd_get_filename (ibfd), + _bfd_error_handler (msg, bfd_archive_filename (ibfd), bfd_get_filename (obfd)); bfd_set_error (bfd_error_wrong_format); @@ -2234,7 +2269,7 @@ coff_arm_merge_private_bfd_data (ibfd, o else /* xgettext: c-format */ msg = _("%s: ERROR: compiled as absolute position code, whereas target %s is position independent"); - _bfd_error_handler (msg, bfd_get_filename (ibfd), + _bfd_error_handler (msg, bfd_archive_filename (ibfd), bfd_get_filename (obfd)); bfd_set_error (bfd_error_wrong_format); @@ -2267,7 +2302,7 @@ coff_arm_merge_private_bfd_data (ibfd, o /* xgettext: c-format */ msg = _("Warning: input file %s does not support interworking, whereas %s does."); - _bfd_error_handler (msg, bfd_get_filename (ibfd), + _bfd_error_handler (msg, bfd_archive_filename (ibfd), bfd_get_filename (obfd)); } } @@ -2364,11 +2399,11 @@ _bfd_coff_arm_set_private_flags (abfd, f if (flag) /* xgettext: c-format */ _bfd_error_handler (_("Warning: Not setting interworking flag of %s, since it has already been specified as non-interworking"), - bfd_get_filename (abfd)); + bfd_archive_filename (abfd)); else /* xgettext: c-format */ _bfd_error_handler (_("Warning: Clearing the interworking flag of %s due to outside request"), - bfd_get_filename (abfd)); + bfd_archive_filename (abfd)); flag = 0; } @@ -2428,7 +2463,7 @@ coff_arm_copy_private_bfd_data (src, des /* xgettext:c-format */ _bfd_error_handler (("Warning: Clearing the interworking bit of %s, because the non-interworking code in %s has been copied into it"), bfd_get_filename (dest), - bfd_get_filename (src)); + bfd_archive_filename (src)); } SET_INTERWORK_FLAG (dest, 0); @@ -2474,7 +2509,7 @@ coff_arm_is_local_label_name (abfd, name if (LOCAL_LABEL_PREFIX[0] != 0) { - int len = strlen (LOCAL_LABEL_PREFIX); + size_t len = strlen (LOCAL_LABEL_PREFIX); if (strncmp (name, LOCAL_LABEL_PREFIX, len) != 0) return false; diff -uprN binutils-2.11.90.0.31/bfd/coff-h8300.c binutils-2.11.92.0.5/bfd/coff-h8300.c --- binutils-2.11.90.0.31/bfd/coff-h8300.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/coff-h8300.c Mon Oct 1 15:25:20 2001 @@ -184,11 +184,13 @@ h8300_coff_link_hash_table_create (abfd) bfd *abfd; { struct h8300_coff_link_hash_table *ret; - ret = ((struct h8300_coff_link_hash_table *) - bfd_alloc (abfd, sizeof (struct h8300_coff_link_hash_table))); + bfd_size_type amt = sizeof (struct h8300_coff_link_hash_table); + + ret = (struct h8300_coff_link_hash_table *) bfd_alloc (abfd, amt); if (ret == NULL) return NULL; - if (!_bfd_link_hash_table_init (&ret->root.root, abfd, _bfd_generic_link_hash_newfunc)) + if (!_bfd_link_hash_table_init (&ret->root.root, abfd, + _bfd_generic_link_hash_newfunc)) { bfd_release (abfd, ret); return NULL; @@ -275,8 +277,8 @@ static reloc_howto_type howto_table[] = #define __A_MAGIC_SET__ /* Code to swap in the reloc. */ -#define SWAP_IN_RELOC_OFFSET bfd_h_get_32 -#define SWAP_OUT_RELOC_OFFSET bfd_h_put_32 +#define SWAP_IN_RELOC_OFFSET H_GET_32 +#define SWAP_OUT_RELOC_OFFSET H_PUT_32 #define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) \ dst->r_stuff[0] = 'S'; \ dst->r_stuff[1] = 'C'; @@ -719,7 +721,7 @@ h8300_reloc16_extra_cases (abfd, link_in /* Everything looks OK. Apply the relocation and update the src/dst address appropriately. */ - bfd_put_16 (abfd, gap, data + dst_address); + bfd_put_16 (abfd, (bfd_vma) gap, data + dst_address); dst_address += 2; src_address += 2; @@ -1055,8 +1057,8 @@ h8300_reloc16_extra_cases (abfd, link_in /* We need to find the symbol so we can determine it's address in the function vector table. */ asymbol *symbol; - bfd_vma value; const char *name; + struct funcvec_hash_table *ftab; struct funcvec_hash_entry *h; asection *vectors_sec = h8300_coff_hash_table (link_info)->vectors_sec; @@ -1097,7 +1099,7 @@ h8300_reloc16_extra_cases (abfd, link_in name = symbol->name; if (symbol->flags & BSF_LOCAL) { - char *new_name = bfd_malloc (strlen (name) + 9); + char *new_name = bfd_malloc ((bfd_size_type) strlen (name) + 9); if (new_name == NULL) abort (); @@ -1107,8 +1109,8 @@ h8300_reloc16_extra_cases (abfd, link_in name = new_name; } - h = funcvec_hash_lookup (h8300_coff_hash_table (link_info)->funcvec_hash_table, - name, false, false); + ftab = h8300_coff_hash_table (link_info)->funcvec_hash_table; + h = funcvec_hash_lookup (ftab, name, false, false); /* This shouldn't ever happen. If it does that means we've got data corruption of some kind. Aborting seems like a reasonable @@ -1147,7 +1149,7 @@ h8300_reloc16_extra_cases (abfd, link_in bfd_set_section_contents (vectors_sec->output_section->owner, vectors_sec->output_section, vectors_sec->contents, - vectors_sec->output_offset, + (file_ptr) vectors_sec->output_offset, vectors_sec->_raw_size); break; } @@ -1180,6 +1182,7 @@ h8300_bfd_link_add_symbols (abfd, info) { asection *sec; struct funcvec_hash_table *funcvec_hash_table; + bfd_size_type amt; /* If we haven't created a vectors section, do so now. */ if (!h8300_coff_hash_table (info)->vectors_sec) @@ -1201,8 +1204,8 @@ h8300_bfd_link_add_symbols (abfd, info) return false; /* Also create the vector hash table. */ - funcvec_hash_table = ((struct funcvec_hash_table *) - bfd_alloc (abfd, sizeof (struct funcvec_hash_table))); + amt = sizeof (struct funcvec_hash_table); + funcvec_hash_table = (struct funcvec_hash_table *) bfd_alloc (abfd, amt); if (!funcvec_hash_table) return false; @@ -1238,7 +1241,7 @@ h8300_bfd_link_add_symbols (abfd, info) if (reloc_size <= 0) continue; - relocs = (arelent **) bfd_malloc ((size_t) reloc_size); + relocs = (arelent **) bfd_malloc ((bfd_size_type) reloc_size); if (!relocs) return false; @@ -1269,13 +1272,15 @@ h8300_bfd_link_add_symbols (abfd, info) && symbol != bfd_abs_section_ptr->symbol) { + struct funcvec_hash_table *ftab; struct funcvec_hash_entry *h; name = symbol->name; if (symbol->flags & BSF_LOCAL) { - char *new_name = bfd_malloc (strlen (name) + 9); + char *new_name; + new_name = bfd_malloc ((bfd_size_type) strlen (name) + 9); if (new_name == NULL) abort (); @@ -1286,15 +1291,14 @@ h8300_bfd_link_add_symbols (abfd, info) } /* Look this symbol up in the function vector hash table. */ - h = funcvec_hash_lookup (h8300_coff_hash_table (info)->funcvec_hash_table, - name, false, false); + ftab = h8300_coff_hash_table (info)->funcvec_hash_table; + h = funcvec_hash_lookup (ftab, name, false, false); /* If this symbol isn't already in the hash table, add it and bump up the size of the hash table. */ if (h == NULL) { - h = funcvec_hash_lookup (h8300_coff_hash_table (info)->funcvec_hash_table, - name, true, true); + h = funcvec_hash_lookup (ftab, name, true, true); if (h == NULL) { free (relocs); @@ -1318,15 +1322,15 @@ h8300_bfd_link_add_symbols (abfd, info) /* Now actually allocate some space for the function vector. It's wasteful to do this more than once, but this is easier. */ - if (h8300_coff_hash_table (info)->vectors_sec->_raw_size != 0) + sec = h8300_coff_hash_table (info)->vectors_sec; + if (sec->_raw_size != 0) { /* Free the old contents. */ - if (h8300_coff_hash_table (info)->vectors_sec->contents) - free (h8300_coff_hash_table (info)->vectors_sec->contents); + if (sec->contents) + free (sec->contents); /* Allocate new contents. */ - h8300_coff_hash_table (info)->vectors_sec->contents - = bfd_malloc (h8300_coff_hash_table (info)->vectors_sec->_raw_size); + sec->contents = bfd_malloc (sec->_raw_size); } return true; diff -uprN binutils-2.11.90.0.31/bfd/coff-h8500.c binutils-2.11.92.0.5/bfd/coff-h8500.c --- binutils-2.11.90.0.31/bfd/coff-h8500.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/coff-h8500.c Mon Oct 1 15:25:20 2001 @@ -86,8 +86,8 @@ coff_h8500_select_reloc (howto) #define __A_MAGIC_SET__ /* Code to swap in the reloc. */ -#define SWAP_IN_RELOC_OFFSET bfd_h_get_32 -#define SWAP_OUT_RELOC_OFFSET bfd_h_put_32 +#define SWAP_IN_RELOC_OFFSET H_GET_32 +#define SWAP_OUT_RELOC_OFFSET H_PUT_32 #define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) \ dst->r_stuff[0] = 'S'; \ dst->r_stuff[1] = 'C'; @@ -227,7 +227,7 @@ extra_case (in_abfd, link_info, link_ord int v = bfd_coff_reloc16_get_value (reloc, link_info, input_section); int o = bfd_get_32 (in_abfd, data+ *dst_ptr -1); v = (v & 0x00ffffff) | (o & 0xff00000); - bfd_put_32 (in_abfd, v, data + *dst_ptr -1); + bfd_put_32 (in_abfd, (bfd_vma) v, data + *dst_ptr -1); (*dst_ptr) += 3; (*src_ptr) += 3;; } @@ -235,7 +235,7 @@ extra_case (in_abfd, link_info, link_ord case R_H8500_IMM32: { int v = bfd_coff_reloc16_get_value (reloc, link_info, input_section); - bfd_put_32 (in_abfd, v, data + *dst_ptr); + bfd_put_32 (in_abfd, (bfd_vma) v, data + *dst_ptr); (*dst_ptr) += 4; (*src_ptr) += 4;; } @@ -282,7 +282,7 @@ extra_case (in_abfd, link_info, link_ord input_section, reloc->address))) abort (); } - bfd_put_16 (in_abfd, gap, data + *dst_ptr); + bfd_put_16 (in_abfd, (bfd_vma) gap, data + *dst_ptr); (*dst_ptr) += 2; (*src_ptr) += 2; break; diff -uprN binutils-2.11.90.0.31/bfd/coff-i386.c binutils-2.11.92.0.5/bfd/coff-i386.c --- binutils-2.11.90.0.31/bfd/coff-i386.c Sat May 12 00:57:53 2001 +++ binutils-2.11.92.0.5/bfd/coff-i386.c Mon Oct 1 15:25:20 2001 @@ -157,7 +157,7 @@ coff_i386_reloc (abfd, reloc_entry, symb { short x = bfd_get_16 (abfd, addr); DOIT (x); - bfd_put_16 (abfd, x, addr); + bfd_put_16 (abfd, (bfd_vma) x, addr); } break; @@ -165,7 +165,7 @@ coff_i386_reloc (abfd, reloc_entry, symb { long x = bfd_get_32 (abfd, addr); DOIT (x); - bfd_put_32 (abfd, x, addr); + bfd_put_32 (abfd, (bfd_vma) x, addr); } break; diff -uprN binutils-2.11.90.0.31/bfd/coff-i860.c binutils-2.11.92.0.5/bfd/coff-i860.c --- binutils-2.11.90.0.31/bfd/coff-i860.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/coff-i860.c Mon Oct 1 15:25:20 2001 @@ -114,7 +114,7 @@ coff_i860_reloc (abfd, reloc_entry, symb { short x = bfd_get_16 (abfd, addr); DOIT (x); - bfd_put_16 (abfd, x, addr); + bfd_put_16 (abfd, (bfd_vma) x, addr); } break; @@ -122,7 +122,7 @@ coff_i860_reloc (abfd, reloc_entry, symb { long x = bfd_get_32 (abfd, addr); DOIT (x); - bfd_put_32 (abfd, x, addr); + bfd_put_32 (abfd, (bfd_vma) x, addr); } break; diff -uprN binutils-2.11.90.0.31/bfd/coff-i960.c binutils-2.11.92.0.5/bfd/coff-i960.c --- binutils-2.11.90.0.31/bfd/coff-i960.c Fri Mar 9 11:37:54 2001 +++ binutils-2.11.92.0.5/bfd/coff-i960.c Mon Oct 1 15:25:20 2001 @@ -1,5 +1,5 @@ /* BFD back-end for Intel 960 COFF files. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1997, 1999, 2000 + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1997, 1999, 2000, 2001 Free Software Foundation, Inc. Written by Cygnus Support. @@ -48,8 +48,8 @@ static boolean coff_i960_adjust_symndx #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3) #define COFF_ALIGN_IN_SECTION_HEADER 1 -#define GET_SCNHDR_ALIGN bfd_h_get_32 -#define PUT_SCNHDR_ALIGN bfd_h_put_32 +#define GET_SCNHDR_ALIGN H_GET_32 +#define PUT_SCNHDR_ALIGN H_PUT_32 /* The i960 does not support an MMU, so COFF_PAGE_SIZE can be arbitrarily small. */ @@ -156,7 +156,8 @@ optcall_callback (abfd, reloc_entry, sym sym and auxents untouched, so the delta between the two is the offset of the bal entry point. */ word = ((word + olf) & BAL_MASK) | BAL; - bfd_put_32 (abfd, word, (bfd_byte *) data + reloc_entry->address); + bfd_put_32 (abfd, (bfd_vma) word, + (bfd_byte *) data + reloc_entry->address); } result = bfd_reloc_ok; break; @@ -251,9 +252,8 @@ coff_i960_relocate (abfd, reloc_entry, s if (coff_section_data (output_bfd, osec) == NULL) { - osec->used_by_bfd = - ((PTR) bfd_zalloc (abfd, - sizeof (struct coff_section_tdata))); + bfd_size_type amt = sizeof (struct coff_section_tdata); + osec->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); if (osec->used_by_bfd == NULL) return bfd_reloc_overflow; } @@ -350,7 +350,7 @@ coff_i960_start_final_link (abfd, info) bfd_coff_swap_sym_out (abfd, (PTR) &isym, (PTR) esym); - if (bfd_write (esym, symesz, 1, abfd) != symesz) + if (bfd_bwrite (esym, symesz, abfd) != symesz) { free (esym); return false; @@ -519,9 +519,8 @@ coff_i960_relocate_section (output_bfd, + (rel->r_vaddr - input_section->vma))); word = ((word + olf - val) & BAL_MASK) | BAL; bfd_put_32 (input_bfd, - word, - (contents - + (rel->r_vaddr - input_section->vma))); + (bfd_vma) word, + contents + (rel->r_vaddr - input_section->vma)); done = true; } break; diff -uprN binutils-2.11.90.0.31/bfd/coff-ia64.c binutils-2.11.92.0.5/bfd/coff-ia64.c --- binutils-2.11.90.0.31/bfd/coff-ia64.c Wed Aug 22 08:52:09 2001 +++ binutils-2.11.92.0.5/bfd/coff-ia64.c Mon Oct 1 15:25:21 2001 @@ -77,9 +77,9 @@ ia64coff_object_p (abfd) struct external_PEI_IMAGE_hdr image_hdr; file_ptr offset; - if (bfd_seek (abfd, 0x00, SEEK_SET) != 0 - || bfd_read (&dos_hdr, 1, sizeof (dos_hdr), abfd) - != sizeof (dos_hdr)) + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 + || (bfd_bread (&dos_hdr, (bfd_size_type) sizeof (dos_hdr), abfd) + != sizeof (dos_hdr))) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -96,23 +96,23 @@ ia64coff_object_p (abfd) this routine can only be called correctly for a PEI file, check the e_magic number here, and, if it doesn't match, clobber the f_magic number so that we don't get a false match. */ - if (bfd_h_get_16 (abfd, (bfd_byte *) dos_hdr.e_magic) != DOSMAGIC) + if (H_GET_16 (abfd, dos_hdr.e_magic) != DOSMAGIC) { bfd_set_error (bfd_error_wrong_format); return NULL; } - offset = bfd_h_get_32 (abfd, (bfd_byte *) dos_hdr.e_lfanew); - if (bfd_seek (abfd, (file_ptr) offset, SEEK_SET) != 0 - || bfd_read (&image_hdr, 1, sizeof (image_hdr), abfd) - != sizeof (image_hdr)) + offset = H_GET_32 (abfd, dos_hdr.e_lfanew); + if (bfd_seek (abfd, offset, SEEK_SET) != 0 + || (bfd_bread (&image_hdr, (bfd_size_type) sizeof (image_hdr), abfd) + != sizeof (image_hdr))) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); return NULL; } - if (bfd_h_get_32 (abfd, (bfd_byte *) image_hdr.nt_signature) + if (H_GET_32 (abfd, image_hdr.nt_signature) != 0x4550) { bfd_set_error (bfd_error_wrong_format); @@ -122,10 +122,7 @@ ia64coff_object_p (abfd) /* Here is the hack. coff_object_p wants to read filhsz bytes to pick up the COFF header for PE, see "struct external_PEI_filehdr" in include/coff/pe.h. We adjust so that that will work. */ - if (bfd_seek (abfd, - (file_ptr) (offset - sizeof (dos_hdr)), - SEEK_SET) - != 0) + if (bfd_seek (abfd, offset - sizeof (dos_hdr), SEEK_SET) != 0) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); diff -uprN binutils-2.11.90.0.31/bfd/coff-m68k.c binutils-2.11.92.0.5/bfd/coff-m68k.c --- binutils-2.11.90.0.31/bfd/coff-m68k.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/coff-m68k.c Mon Oct 1 15:25:21 2001 @@ -316,7 +316,7 @@ m68kcoff_common_addend_special_fn (abfd, { short x = bfd_get_16 (abfd, addr); DOIT (x); - bfd_put_16 (abfd, x, addr); + bfd_put_16 (abfd, (bfd_vma) x, addr); } break; @@ -324,7 +324,7 @@ m68kcoff_common_addend_special_fn (abfd, { long x = bfd_get_32 (abfd, addr); DOIT (x); - bfd_put_32 (abfd, x, addr); + bfd_put_32 (abfd, (bfd_vma) x, addr); } break; @@ -442,6 +442,7 @@ bfd_m68k_coff_create_embedded_relocs (ab bfd_size_type symesz; struct internal_reloc *irel, *irelend; bfd_byte *p; + bfd_size_type amt; BFD_ASSERT (! info->relocateable); @@ -457,7 +458,8 @@ bfd_m68k_coff_create_embedded_relocs (ab NULL); irelend = irel + datasec->reloc_count; - relsec->contents = (bfd_byte *) bfd_alloc (abfd, datasec->reloc_count * 12); + amt = (bfd_size_type) datasec->reloc_count * 12; + relsec->contents = (bfd_byte *) bfd_alloc (abfd, amt); if (relsec->contents == NULL) return false; diff -uprN binutils-2.11.90.0.31/bfd/coff-m88k.c binutils-2.11.92.0.5/bfd/coff-m88k.c --- binutils-2.11.90.0.31/bfd/coff-m88k.c Fri Mar 9 11:15:30 2001 +++ binutils-2.11.92.0.5/bfd/coff-m88k.c Mon Oct 1 15:25:21 2001 @@ -1,5 +1,6 @@ /* BFD back-end for Motorola 88000 COFF "Binary Compatability Standard" files. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1997, 1998, 1999, 2000 + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1997, 1998, 1999, 2000, + 2001 Free Software Foundation, Inc. Written by Cygnus Support. @@ -36,8 +37,8 @@ static void reloc_processing #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3) -#define GET_SCNHDR_NRELOC bfd_h_get_32 -#define GET_SCNHDR_NLNNO bfd_h_get_32 +#define GET_SCNHDR_NRELOC H_GET_32 +#define GET_SCNHDR_NLNNO H_GET_32 /* On coff-m88k, local labels start with '@'. */ @@ -115,7 +116,8 @@ m88k_special_reloc (abfd, reloc_entry, s relocation <<= (bfd_vma) howto->bitpos; if (relocation) - bfd_put_16 (abfd, relocation, (unsigned char *) data + addr); + bfd_put_16 (abfd, (bfd_vma) relocation, + (unsigned char *) data + addr); } /* If we are not producing relocateable output, return an error if @@ -251,8 +253,8 @@ rtype2howto (cache_ptr, dst) #define RTYPE2HOWTO(cache_ptr, dst) rtype2howto (cache_ptr, dst) /* Code to swap in the reloc offset */ -#define SWAP_IN_RELOC_OFFSET bfd_h_get_16 -#define SWAP_OUT_RELOC_OFFSET bfd_h_put_16 +#define SWAP_IN_RELOC_OFFSET H_GET_16 +#define SWAP_OUT_RELOC_OFFSET H_PUT_16 #define RELOC_PROCESSING(relent,reloc,symbols,abfd,section) \ reloc_processing(relent, reloc, symbols, abfd, section) diff -uprN binutils-2.11.90.0.31/bfd/coff-mcore.c binutils-2.11.92.0.5/bfd/coff-mcore.c --- binutils-2.11.90.0.31/bfd/coff-mcore.c Thu Aug 30 09:30:36 2001 +++ binutils-2.11.92.0.5/bfd/coff-mcore.c Mon Oct 1 15:25:21 2001 @@ -39,9 +39,10 @@ Boston, MA 02111-1307, USA. */ final_link routine once. */ extern 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 boolean coff_mcore_relocate_section @@ -55,7 +56,6 @@ static reloc_howto_type * coff static void mcore_emit_base_file_entry PARAMS ((struct bfd_link_info *, bfd *, asection *, bfd_vma)); static boolean in_reloc_p PARAMS ((bfd *, reloc_howto_type *)); -static struct bfd_link_hash_table * coff_mcore_link_hash_table_create PARAMS ((bfd *)); /* The NT loader points the toc register to &toc + 32768, in order to use the complete range of a 16-bit displacement. We have to adjust @@ -220,6 +220,7 @@ 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 * @@ -228,7 +229,7 @@ coff_mcore_link_hash_table_create (abfd) { mcore_hash_table * ret; - ret = ((mcore_hash_table *) bfd_alloc (abfd, sizeof (* ret))); + ret = (mcore_hash_table *) bfd_alloc (abfd, (bfd_size_type) sizeof (* ret)); if (ret == (mcore_hash_table *) NULL) return NULL; @@ -247,6 +248,7 @@ coff_mcore_link_hash_table_create (abfd) return & ret->root.root; } +#endif /* Add an entry to the base file. */ @@ -282,7 +284,7 @@ mcore_coff_unsupported_reloc (abfd, relo BFD_ASSERT (reloc_entry->howto != (reloc_howto_type *)0); _bfd_error_handler (_("%s: Relocation %s (%d) is not currently supported.\n"), - bfd_get_filename (abfd), + bfd_archive_filename (abfd), reloc_entry->howto->name, reloc_entry->howto->type); @@ -396,10 +398,10 @@ coff_mcore_relocate_section (output_bfd, && output_bfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN) { (*_bfd_error_handler) - (_("%s: compiled for a %s endian system and target is %s endian.\n"), - bfd_get_filename (input_bfd), - bfd_big_endian (input_bfd) ? "big" : "little", - bfd_big_endian (output_bfd) ? "big" : "little"); + (_("%s: compiled for a %s system and target is %s.\n"), + bfd_archive_filename (input_bfd), + bfd_big_endian (input_bfd) ? _("big endian") : _("little endian"), + bfd_big_endian (output_bfd) ? _("big endian") : _("little endian")); bfd_set_error (bfd_error_wrong_format); return false; @@ -504,7 +506,7 @@ coff_mcore_relocate_section (output_bfd, { default: _bfd_error_handler (_("%s: unsupported relocation type 0x%02x"), - bfd_get_filename (input_bfd), r_type); + bfd_archive_filename (input_bfd), r_type); bfd_set_error (bfd_error_bad_value); return false; @@ -512,7 +514,7 @@ coff_mcore_relocate_section (output_bfd, fprintf (stderr, _("Warning: unsupported reloc %s \n"), howto->name, - bfd_get_filename (input_bfd), + bfd_archive_filename (input_bfd), input_section->name); fprintf (stderr,"sym %ld (%s), r_vaddr %ld (%lx)\n", diff -uprN binutils-2.11.90.0.31/bfd/coff-mips.c binutils-2.11.92.0.5/bfd/coff-mips.c --- binutils-2.11.90.0.31/bfd/coff-mips.c Sat May 12 00:57:53 2001 +++ binutils-2.11.92.0.5/bfd/coff-mips.c Mon Oct 1 15:25:21 2001 @@ -426,7 +426,7 @@ mips_ecoff_swap_reloc_in (abfd, ext_ptr, { const RELOC *ext = (RELOC *) ext_ptr; - intern->r_vaddr = bfd_h_get_32 (abfd, (bfd_byte *) ext->r_vaddr); + intern->r_vaddr = H_GET_32 (abfd, ext->r_vaddr); if (bfd_header_big_endian (abfd)) { intern->r_symndx = (((int) ext->r_bits[0] @@ -503,7 +503,7 @@ mips_ecoff_swap_reloc_out (abfd, intern, r_symndx = intern->r_offset & 0xffffff; } - bfd_h_put_32 (abfd, intern->r_vaddr, (bfd_byte *) ext->r_vaddr); + H_PUT_32 (abfd, intern->r_vaddr, ext->r_vaddr); if (bfd_header_big_endian (abfd)) { ext->r_bits[0] = r_symndx >> RELOC_BITS0_SYMNDX_SH_LEFT_BIG; @@ -691,7 +691,7 @@ mips_refhi_reloc (abfd, return bfd_reloc_outofrange; /* Save the information, and let REFLO do the actual relocation. */ - n = (struct mips_hi *) bfd_malloc (sizeof *n); + n = (struct mips_hi *) bfd_malloc ((bfd_size_type) sizeof *n); if (n == NULL) return bfd_reloc_outofrange; n->addr = (bfd_byte *) data + reloc_entry->address; @@ -758,8 +758,8 @@ mips_reflo_reloc (abfd, if ((val & 0x8000) != 0) val += 0x10000; - insn = (insn &~ 0xffff) | ((val >> 16) & 0xffff); - bfd_put_32 (abfd, insn, l->addr); + insn = (insn &~ (unsigned) 0xffff) | ((val >> 16) & 0xffff); + bfd_put_32 (abfd, (bfd_vma) insn, l->addr); next = l->next; free (l); @@ -854,7 +854,7 @@ mips_gprel_reloc (abfd, { for (i = 0; i < count; i++, sym++) { - register CONST char *name; + register const char *name; name = bfd_asymbol_name (*sym); if (*name == '_' && strcmp (name, "_gp") == 0) @@ -903,8 +903,8 @@ mips_gprel_reloc (abfd, || (symbol->flags & BSF_SECTION_SYM) != 0) val += relocation - gp; - insn = (insn &~ 0xffff) | (val & 0xffff); - bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address); + insn = (insn &~ (unsigned) 0xffff) | (val & 0xffff); + bfd_put_32 (abfd, (bfd_vma) insn, (bfd_byte *) data + reloc_entry->address); if (relocateable != false) reloc_entry->address += input_section->output_offset; @@ -982,7 +982,7 @@ mips_relhi_reloc (abfd, return bfd_reloc_outofrange; /* Save the information, and let RELLO do the actual relocation. */ - n = (struct mips_hi *) bfd_malloc (sizeof *n); + n = (struct mips_hi *) bfd_malloc ((bfd_size_type) sizeof *n); if (n == NULL) return bfd_reloc_outofrange; n->addr = (bfd_byte *) data + reloc_entry->address; @@ -1059,8 +1059,8 @@ mips_rello_reloc (abfd, if ((val & 0x8000) != 0) val += 0x10000; - insn = (insn &~ 0xffff) | ((val >> 16) & 0xffff); - bfd_put_32 (abfd, insn, l->addr); + insn = (insn &~ (unsigned) 0xffff) | ((val >> 16) & 0xffff); + bfd_put_32 (abfd, (bfd_vma) insn, l->addr); next = l->next; free (l); @@ -1223,7 +1223,7 @@ mips_relocate_hi (refhi, reflo, input_bf if ((val & 0x8000) != 0) val += 0x10000; - insn = (insn &~ 0xffff) | ((val >> 16) & 0xffff); + insn = (insn &~ (unsigned) 0xffff) | ((val >> 16) & 0xffff); bfd_put_32 (input_bfd, (bfd_vma) insn, contents + adjust + refhi->r_vaddr - input_section->vma); } @@ -1251,6 +1251,7 @@ mips_relocate_section (output_bfd, info, unsigned int i; boolean got_lo; struct internal_reloc lo_int_rel; + bfd_size_type amt; BFD_ASSERT (input_bfd->xvec->byteorder == output_bfd->xvec->byteorder); @@ -1261,10 +1262,8 @@ mips_relocate_section (output_bfd, info, symndx_to_section = ecoff_data (input_bfd)->symndx_to_section; if (symndx_to_section == (asection **) NULL) { - symndx_to_section = ((asection **) - bfd_alloc (input_bfd, - (NUM_RELOC_SECTIONS - * sizeof (asection *)))); + amt = NUM_RELOC_SECTIONS * sizeof (asection *); + symndx_to_section = (asection **) bfd_alloc (input_bfd, amt); if (!symndx_to_section) return false; @@ -1880,12 +1879,13 @@ mips_read_relocs (abfd, sec) asection *sec; { struct ecoff_section_tdata *section_tdata; + bfd_size_type amt; section_tdata = ecoff_section_data (abfd, sec); if (section_tdata == (struct ecoff_section_tdata *) NULL) { - sec->used_by_bfd = - (PTR) bfd_alloc (abfd, sizeof (struct ecoff_section_tdata)); + amt = sizeof (struct ecoff_section_tdata); + sec->used_by_bfd = (PTR) bfd_alloc (abfd, amt); if (sec->used_by_bfd == NULL) return false; @@ -1897,20 +1897,14 @@ mips_read_relocs (abfd, sec) if (section_tdata->external_relocs == NULL) { - bfd_size_type external_relocs_size; - - external_relocs_size = (ecoff_backend (abfd)->external_reloc_size - * sec->reloc_count); - - section_tdata->external_relocs = - (PTR) bfd_alloc (abfd, external_relocs_size); - if (section_tdata->external_relocs == NULL && external_relocs_size != 0) + amt = ecoff_backend (abfd)->external_reloc_size; + amt *= sec->reloc_count; + section_tdata->external_relocs = (PTR) bfd_alloc (abfd, amt); + if (section_tdata->external_relocs == NULL && amt != 0) return false; if (bfd_seek (abfd, sec->rel_filepos, SEEK_SET) != 0 - || (bfd_read (section_tdata->external_relocs, 1, - external_relocs_size, abfd) - != external_relocs_size)) + || bfd_bread (section_tdata->external_relocs, amt, abfd) != amt) return false; } @@ -2009,6 +2003,7 @@ mips_relax_section (abfd, sec, info, aga struct ecoff_link_hash_entry **adj_h_ptr; struct ecoff_link_hash_entry **adj_h_ptr_end; struct ecoff_value_adjust *adjust; + bfd_size_type amt; /* If we have already expanded this reloc, we certainly don't need to do it again. */ @@ -2085,7 +2080,7 @@ mips_relax_section (abfd, sec, info, aga if (info->keep_memory) contents = (bfd_byte *) bfd_alloc (abfd, sec->_raw_size); else - contents = (bfd_byte *) bfd_malloc ((size_t) sec->_raw_size); + contents = (bfd_byte *) bfd_malloc (sec->_raw_size); if (contents == (bfd_byte *) NULL) goto error_return; if (! bfd_get_section_contents (abfd, sec, (PTR) contents, @@ -2118,13 +2113,13 @@ mips_relax_section (abfd, sec, info, aga if (offsets == (long *) NULL) { - size_t size; + bfd_size_type size; - size = sec->reloc_count * sizeof (long); + size = (bfd_size_type) sec->reloc_count * sizeof (long); offsets = (long *) bfd_alloc (abfd, size); if (offsets == (long *) NULL) goto error_return; - memset (offsets, 0, size); + memset (offsets, 0, (size_t) size); section_tdata->offsets = offsets; } @@ -2297,8 +2292,8 @@ mips_relax_section (abfd, sec, info, aga /* Add an entry to the symbol value adjust list. This is used by bfd_ecoff_debug_accumulate to adjust the values of internal symbols and FDR's. */ - adjust = ((struct ecoff_value_adjust *) - bfd_alloc (abfd, sizeof (struct ecoff_value_adjust))); + amt = sizeof (struct ecoff_value_adjust); + adjust = (struct ecoff_value_adjust *) bfd_alloc (abfd, amt); if (adjust == (struct ecoff_value_adjust *) NULL) goto error_return; @@ -2351,15 +2346,17 @@ mips_relax_pcrel16 (info, input_bfd, inp if ((relocation & 0x8000) != 0) relocation += 0x10000; - bfd_put_32 (input_bfd, 0x04110001, location); /* bal .+8 */ + bfd_put_32 (input_bfd, (bfd_vma) 0x04110001, location); /* bal .+8 */ bfd_put_32 (input_bfd, 0x3c010000 | ((relocation >> 16) & 0xffff), /* lui $at,XX */ location + 4); bfd_put_32 (input_bfd, 0x24210000 | (relocation & 0xffff), /* addiu $at,$at,XX */ location + 8); - bfd_put_32 (input_bfd, 0x003f0821, location + 12); /* addu $at,$at,$ra */ - bfd_put_32 (input_bfd, 0x0020f809, location + 16); /* jalr $at */ + bfd_put_32 (input_bfd, + (bfd_vma) 0x003f0821, location + 12); /* addu $at,$at,$ra */ + bfd_put_32 (input_bfd, + (bfd_vma) 0x0020f809, location + 16); /* jalr $at */ return true; } @@ -2386,6 +2383,7 @@ bfd_mips_ecoff_create_embedded_relocs (a struct external_reloc *ext_rel; struct external_reloc *ext_rel_end; bfd_byte *p; + bfd_size_type amt; BFD_ASSERT (! info->relocateable); @@ -2399,7 +2397,8 @@ bfd_mips_ecoff_create_embedded_relocs (a if (! mips_read_relocs (abfd, datasec)) return false; - relsec->contents = (bfd_byte *) bfd_alloc (abfd, datasec->reloc_count * 4); + amt = (bfd_size_type) datasec->reloc_count * 4; + relsec->contents = (bfd_byte *) bfd_alloc (abfd, amt); if (relsec->contents == NULL) return false; diff -uprN binutils-2.11.90.0.31/bfd/coff-ppc.c binutils-2.11.92.0.5/bfd/coff-ppc.c --- binutils-2.11.90.0.31/bfd/coff-ppc.c Fri Mar 9 11:37:54 2001 +++ binutils-2.11.92.0.5/bfd/coff-ppc.c Mon Oct 1 15:25:21 2001 @@ -202,9 +202,9 @@ ppc_coff_link_hash_table_create (abfd) bfd *abfd; { struct ppc_coff_link_hash_table *ret; + bfd_size_type amt = sizeof (struct ppc_coff_link_hash_table); - ret = ((struct ppc_coff_link_hash_table *) - bfd_alloc (abfd, sizeof (struct ppc_coff_link_hash_table))); + ret = (struct ppc_coff_link_hash_table *) bfd_alloc (abfd, amt); if (ret == NULL) return NULL; if (! ppc_coff_link_hash_table_init (ret, abfd, @@ -833,7 +833,7 @@ enum ref_category { priv, pub, - data + tocdata }; struct list_ele @@ -849,18 +849,19 @@ extern struct list_ele *head; extern struct list_ele *tail; static void record_toc - PARAMS ((asection *, int, enum ref_category, const char *)); + PARAMS ((asection *, bfd_signed_vma, enum ref_category, const char *)); static void record_toc (toc_section, our_toc_offset, cat, name) asection *toc_section; - int our_toc_offset; + bfd_signed_vma our_toc_offset; enum ref_category cat; const char *name; { /* add this entry to our toc addr-offset-name list */ - struct list_ele *t; - t = (struct list_ele *) bfd_malloc (sizeof (struct list_ele)); + bfd_size_type amt = sizeof (struct list_ele); + struct list_ele *t = (struct list_ele *) bfd_malloc (amt); + if (t == NULL) abort (); t->next = 0; @@ -916,16 +917,16 @@ ppc_record_toc_entry(abfd, info, sec, sy if (local_syms == 0) { unsigned int i; + bfd_size_type amt; /* allocate a table */ - local_syms = - (int *) bfd_zalloc (abfd, - obj_raw_syment_count(abfd) * sizeof (int)); + amt = (bfd_size_type) obj_raw_syment_count (abfd) * sizeof (int); + local_syms = (int *) bfd_zalloc (abfd, amt); if (local_syms == 0) return false; - obj_coff_local_toc_table(abfd) = local_syms; - for (i = 0; i < obj_raw_syment_count(abfd); ++i) + obj_coff_local_toc_table (abfd) = local_syms; + for (i = 0; i < obj_raw_syment_count (abfd); ++i) { - SET_UNALLOCATED(local_syms[i]); + SET_UNALLOCATED (local_syms[i]); } } @@ -1194,12 +1195,12 @@ coff_ppc_relocate_section (output_bfd, i default: (*_bfd_error_handler) (_("%s: unsupported relocation type 0x%02x"), - bfd_get_filename (input_bfd), r_type); + bfd_archive_filename (input_bfd), r_type); bfd_set_error (bfd_error_bad_value); return false; case IMAGE_REL_PPC_TOCREL16: { - bfd_vma our_toc_offset; + bfd_signed_vma our_toc_offset; int fixit; DUMP_RELOC2(howto->name, rel); @@ -1246,13 +1247,10 @@ coff_ppc_relocate_section (output_bfd, i else { /* write out the toc entry */ - record_toc(toc_section, - our_toc_offset, - priv, - strdup(name)); + record_toc (toc_section, our_toc_offset, priv, + strdup (name)); - bfd_put_32 (output_bfd, - val, + bfd_put_32 (output_bfd, val, toc_section->contents + our_toc_offset); MARK_AS_WRITTEN(local_toc_table[symndx]); @@ -1282,21 +1280,22 @@ coff_ppc_relocate_section (output_bfd, i the IAT to be part of the toc, thus saving a load. */ - our_toc_offset = val - - (toc_section->output_section->vma + - toc_section->output_offset); + our_toc_offset = val - (toc_section->output_section->vma + + toc_section->output_offset); /* The size must still fit in a 16bit displacment */ - if (our_toc_offset >= 65535) + if ((bfd_vma) our_toc_offset >= 65535) { (*_bfd_error_handler) - (_("%s: Relocation for %s of %x exceeds Toc size limit"), - bfd_get_filename (input_bfd), name, our_toc_offset); + (_("%s: Relocation for %s of %lx exceeds Toc size limit"), + bfd_archive_filename (input_bfd), name, + (unsigned long) our_toc_offset); bfd_set_error (bfd_error_bad_value); return false; } - record_toc(toc_section, our_toc_offset, pub, strdup(name)); + record_toc (toc_section, our_toc_offset, pub, + strdup (name)); } else if (IS_WRITTEN(our_toc_offset)) { @@ -1308,11 +1307,11 @@ coff_ppc_relocate_section (output_bfd, i } else { - record_toc(toc_section, our_toc_offset, pub, strdup(name)); + record_toc(toc_section, our_toc_offset, pub, + strdup (name)); /* write out the toc entry */ - bfd_put_32 (output_bfd, - val, + bfd_put_32 (output_bfd, val, toc_section->contents + our_toc_offset); MARK_AS_WRITTEN(h->toc_offset); @@ -1331,8 +1330,8 @@ coff_ppc_relocate_section (output_bfd, i isn't absolute - we output the address here to a file */ - bfd_vma addr = toc_section->output_section->vma - + toc_section->output_offset + our_toc_offset; + bfd_vma addr = (toc_section->output_section->vma + + toc_section->output_offset + our_toc_offset); if (coff_data(output_bfd)->pe) addr -= pe_data(output_bfd)->pe_opthdr.ImageBase; @@ -1341,23 +1340,20 @@ coff_ppc_relocate_section (output_bfd, i } /* FIXME: this test is conservative */ - if ( (r_flags & IMAGE_REL_PPC_TOCDEFN) != IMAGE_REL_PPC_TOCDEFN && - our_toc_offset > toc_section->_raw_size) + if ((r_flags & IMAGE_REL_PPC_TOCDEFN) != IMAGE_REL_PPC_TOCDEFN + && (bfd_vma) our_toc_offset > toc_section->_raw_size) { (*_bfd_error_handler) - (_("%s: Relocation exceeds allocated TOC (%x)"), - bfd_get_filename (input_bfd), - toc_section->_raw_size); + (_("%s: Relocation exceeds allocated TOC (%lx)"), + bfd_archive_filename (input_bfd), + (unsigned long) toc_section->_raw_size); bfd_set_error (bfd_error_bad_value); return false; } /* Now we know the relocation for this toc reference */ relocation = our_toc_offset + TOC_LOAD_ADJUSTMENT; - rstat = _bfd_relocate_contents (howto, - input_bfd, - relocation, - loc); + rstat = _bfd_relocate_contents (howto, input_bfd, relocation, loc); } break; case IMAGE_REL_PPC_IFGLUE: @@ -1377,7 +1373,7 @@ coff_ppc_relocate_section (output_bfd, i if (h->symbol_is_glue == 1) { x = bfd_get_32 (input_bfd, loc); - bfd_put_32 (input_bfd, h->glue_insn, loc); + bfd_put_32 (input_bfd, (bfd_vma) h->glue_insn, loc); } } } @@ -1406,7 +1402,7 @@ coff_ppc_relocate_section (output_bfd, i fprintf (stderr, _("Warning: unsupported reloc %s \n"), howto->name, - bfd_get_filename(input_bfd), + bfd_archive_filename(input_bfd), input_section->name); fprintf (stderr,"sym %ld (%s), r_vaddr %ld (%lx)\n", @@ -1425,14 +1421,13 @@ coff_ppc_relocate_section (output_bfd, i (*_bfd_error_handler) (_("%s: Out of order IMGLUE reloc for %s"), - bfd_get_filename (input_bfd), my_name); + bfd_archive_filename (input_bfd), my_name); bfd_set_error (bfd_error_bad_value); return false; } case IMAGE_REL_PPC_ADDR32NB: { - struct coff_link_hash_entry *myh = 0; const char *name = 0; DUMP_RELOC2(howto->name, rel); @@ -1440,7 +1435,7 @@ coff_ppc_relocate_section (output_bfd, i { /* set magic values */ int idata5offset; - struct coff_link_hash_entry *myh = 0; + struct coff_link_hash_entry *myh; myh = coff_link_hash_lookup (coff_hash_table (info), "__idata5_magic__", false, false, true); @@ -1480,7 +1475,7 @@ coff_ppc_relocate_section (output_bfd, i if (target != 0) { - myh = 0; + struct coff_link_hash_entry *myh; myh = coff_link_hash_lookup (coff_hash_table (info), target, @@ -1654,7 +1649,7 @@ dump_toc (vfile) cat = _("private "); else if (t->cat == pub) cat = _("public "); - else if (t->cat == data) + else if (t->cat == tocdata) cat = _("data-in-toc "); if (t->offset > global_toc_size) @@ -1665,7 +1660,8 @@ dump_toc (vfile) { fprintf (file, _("**** global_toc_size %ld(%lx), thunk_size %ld(%lx)\n"), - global_toc_size, global_toc_size, thunk_size, thunk_size); + global_toc_size, global_toc_size, + thunk_size, thunk_size); cat = _("Out of bounds!"); } } @@ -1687,6 +1683,7 @@ ppc_allocate_toc_section (info) { asection *s; bfd_byte *foo; + bfd_size_type amt; static char test_char = '1'; if ( global_toc_size == 0 ) /* FIXME: does this get me in trouble? */ @@ -1705,8 +1702,9 @@ ppc_allocate_toc_section (info) abort (); } - foo = (bfd_byte *) bfd_alloc(bfd_of_toc_owner, global_toc_size); - memset(foo, test_char, global_toc_size); + amt = global_toc_size; + foo = (bfd_byte *) bfd_alloc (bfd_of_toc_owner, amt); + memset(foo, test_char, (size_t) global_toc_size); s->_raw_size = s->_cooked_size = global_toc_size; s->contents = foo; @@ -2178,10 +2176,6 @@ ppc_coff_reloc_type_lookup (abfd, code) #define RTYPE2HOWTO(cache_ptr, dst) ppc_coff_rtype2howto (cache_ptr, dst) -#ifndef COFF_IMAGE_WITH_PE -static void ppc_coff_swap_sym_in_hook PARAMS ((bfd *, PTR, PTR)); -#endif - /* We use the special COFF backend linker, with our own special touch. */ #define coff_bfd_reloc_type_lookup ppc_coff_reloc_type_lookup @@ -2191,8 +2185,10 @@ static void ppc_coff_swap_sym_in_hook PA #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;} @@ -2220,6 +2216,8 @@ static void ppc_coff_swap_sym_in_hook PA #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 @@ -2233,6 +2231,7 @@ static void ppc_coff_swap_sym_in_hook PA 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) @@ -2275,6 +2274,7 @@ ppc_coff_swap_sym_in_hook (abfd, ext1, i return; } #endif +#endif #ifndef COFF_IMAGE_WITH_PE @@ -2321,11 +2321,11 @@ ppc_bfd_coff_final_link (abfd, info) boolean debug_merge_allocated; asection *o; struct bfd_link_order *p; - size_t max_sym_count; - size_t max_lineno_count; - size_t max_reloc_count; - size_t max_output_reloc_count; - size_t max_contents_size; + bfd_size_type max_sym_count; + bfd_size_type max_lineno_count; + bfd_size_type max_reloc_count; + bfd_size_type max_output_reloc_count; + bfd_size_type max_contents_size; file_ptr rel_filepos; unsigned int relsz; file_ptr line_filepos; @@ -2333,6 +2333,7 @@ ppc_bfd_coff_final_link (abfd, info) bfd *sub; bfd_byte *external_relocs = NULL; char strbuf[STRING_SIZE_SIZE]; + bfd_size_type amt; symesz = bfd_coff_symesz (abfd); @@ -2433,10 +2434,9 @@ ppc_bfd_coff_final_link (abfd, info) /* We use section_count + 1, rather than section_count, because the target_index fields are 1 based. */ - finfo.section_info = - ((struct coff_link_section_info *) - bfd_malloc ((abfd->section_count + 1) - * sizeof (struct coff_link_section_info))); + amt = abfd->section_count + 1; + amt *= sizeof (struct coff_link_section_info); + finfo.section_info = (struct coff_link_section_info *) bfd_malloc (amt); if (finfo.section_info == NULL) goto error_return; for (i = 0; i <= abfd->section_count; i++) @@ -2477,13 +2477,14 @@ ppc_bfd_coff_final_link (abfd, info) but only when doing a relocateable link, which is not the common case. */ BFD_ASSERT (info->relocateable); + amt = o->reloc_count; + amt *= sizeof (struct internal_reloc); finfo.section_info[o->target_index].relocs = - ((struct internal_reloc *) - bfd_malloc (o->reloc_count * sizeof (struct internal_reloc))); + (struct internal_reloc *) bfd_malloc (amt); + amt = o->reloc_count; + amt *= sizeof (struct coff_link_hash_entry *); finfo.section_info[o->target_index].rel_hashes = - ((struct coff_link_hash_entry **) - bfd_malloc (o->reloc_count - * sizeof (struct coff_link_hash_entry *))); + (struct coff_link_hash_entry **) bfd_malloc (amt); if (finfo.section_info[o->target_index].relocs == NULL || finfo.section_info[o->target_index].rel_hashes == NULL) goto error_return; @@ -2506,7 +2507,7 @@ ppc_bfd_coff_final_link (abfd, info) max_sym_count = 0; for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) { - size_t sz; + bfd_size_type sz; sub->output_has_begun = false; sz = obj_raw_syment_count (sub); @@ -2515,22 +2516,23 @@ ppc_bfd_coff_final_link (abfd, info) } /* Allocate some buffers used while linking. */ - finfo.internal_syms = ((struct internal_syment *) - bfd_malloc (max_sym_count - * sizeof (struct internal_syment))); - finfo.sec_ptrs = (asection **) bfd_malloc (max_sym_count - * sizeof (asection *)); - finfo.sym_indices = (long *) bfd_malloc (max_sym_count * sizeof (long)); - finfo.outsyms = ((bfd_byte *) - bfd_malloc ((size_t) ((max_sym_count + 1) * symesz))); - finfo.linenos = (bfd_byte *) bfd_malloc (max_lineno_count - * bfd_coff_linesz (abfd)); + amt = max_sym_count * sizeof (struct internal_syment); + finfo.internal_syms = (struct internal_syment *) bfd_malloc (amt); + amt = max_sym_count * sizeof (asection *); + finfo.sec_ptrs = (asection **) bfd_malloc (amt); + amt = max_sym_count * sizeof (long); + finfo.sym_indices = (long *) bfd_malloc (amt); + amt = (max_sym_count + 1) * symesz; + finfo.outsyms = (bfd_byte *) bfd_malloc (amt); + amt = max_lineno_count * bfd_coff_linesz (abfd); + finfo.linenos = (bfd_byte *) bfd_malloc (amt); finfo.contents = (bfd_byte *) bfd_malloc (max_contents_size); finfo.external_relocs = (bfd_byte *) bfd_malloc (max_reloc_count * relsz); if (! info->relocateable) - finfo.internal_relocs = ((struct internal_reloc *) - bfd_malloc (max_reloc_count - * sizeof (struct internal_reloc))); + { + amt = max_reloc_count * sizeof (struct internal_reloc); + finfo.internal_relocs = (struct internal_reloc *) bfd_malloc (amt); + } if ((finfo.internal_syms == NULL && max_sym_count > 0) || (finfo.sec_ptrs == NULL && max_sym_count > 0) || (finfo.sym_indices == NULL && max_sym_count > 0) @@ -2649,14 +2651,14 @@ ppc_bfd_coff_final_link (abfd, info) if (finfo.last_file_index != -1 && (unsigned int) finfo.last_file.n_value != obj_raw_syment_count (abfd)) { + file_ptr pos; + finfo.last_file.n_value = obj_raw_syment_count (abfd); bfd_coff_swap_sym_out (abfd, (PTR) &finfo.last_file, (PTR) finfo.outsyms); - if (bfd_seek (abfd, - (obj_sym_filepos (abfd) - + finfo.last_file_index * symesz), - SEEK_SET) != 0 - || bfd_write (finfo.outsyms, symesz, 1, abfd) != symesz) + pos = obj_sym_filepos (abfd) + finfo.last_file_index * symesz; + if (bfd_seek (abfd, pos, SEEK_SET) != 0 + || bfd_bwrite (finfo.outsyms, symesz, abfd) != symesz) return false; } @@ -2679,8 +2681,8 @@ ppc_bfd_coff_final_link (abfd, info) /* Now that we have written out all the global symbols, we know the symbol indices to use for relocs against them, and we can finally write out the relocs. */ - external_relocs = ((bfd_byte *) - bfd_malloc (max_output_reloc_count * relsz)); + amt = max_output_reloc_count * relsz; + external_relocs = (bfd_byte *) bfd_malloc (amt); if (external_relocs == NULL) goto error_return; @@ -2708,9 +2710,9 @@ ppc_bfd_coff_final_link (abfd, info) bfd_coff_swap_reloc_out (abfd, (PTR) irel, (PTR) erel); } + amt = relsz * o->reloc_count; if (bfd_seek (abfd, o->rel_filepos, SEEK_SET) != 0 - || bfd_write ((PTR) external_relocs, relsz, o->reloc_count, - abfd) != relsz * o->reloc_count) + || bfd_bwrite ((PTR) external_relocs, amt, abfd) != amt) goto error_return; } @@ -2744,21 +2746,22 @@ ppc_bfd_coff_final_link (abfd, info) /* Write out the string table. */ if (obj_raw_syment_count (abfd) != 0) { - if (bfd_seek (abfd, - (obj_sym_filepos (abfd) - + obj_raw_syment_count (abfd) * symesz), - SEEK_SET) != 0) + file_ptr pos; + + pos = obj_sym_filepos (abfd) + obj_raw_syment_count (abfd) * symesz; + if (bfd_seek (abfd, pos, SEEK_SET) != 0) return false; #if STRING_SIZE_SIZE == 4 - bfd_h_put_32 (abfd, - _bfd_stringtab_size (finfo.strtab) + STRING_SIZE_SIZE, - (bfd_byte *) strbuf); + H_PUT_32 (abfd, + _bfd_stringtab_size (finfo.strtab) + STRING_SIZE_SIZE, + strbuf); #else - #error Change bfd_h_put_32 + #error Change H_PUT_32 above #endif - if (bfd_write (strbuf, 1, STRING_SIZE_SIZE, abfd) != STRING_SIZE_SIZE) + if (bfd_bwrite (strbuf, (bfd_size_type) STRING_SIZE_SIZE, abfd) + != STRING_SIZE_SIZE) return false; if (! _bfd_stringtab_emit (abfd, finfo.strtab)) diff -uprN binutils-2.11.90.0.31/bfd/coff-rs6000.c binutils-2.11.92.0.5/bfd/coff-rs6000.c --- binutils-2.11.90.0.31/bfd/coff-rs6000.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/coff-rs6000.c Mon Oct 1 15:25:21 2001 @@ -76,10 +76,10 @@ void _bfd_xcoff_rtype2howto PARAMS ((are #define COFF_LONG_FILENAMES #define NO_COFF_SYMBOLS #define RTYPE2HOWTO(cache_ptr, dst) _bfd_xcoff_rtype2howto (cache_ptr, dst) -#define coff_mkobject _bfd_xcoff_mkobject -#define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data -#define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name -#define coff_bfd_reloc_type_lookup _bfd_xcoff_reloc_type_lookup +#define coff_mkobject _bfd_xcoff_mkobject +#define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data +#define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name +#define coff_bfd_reloc_type_lookup _bfd_xcoff_reloc_type_lookup #ifdef AIX_CORE extern const bfd_target * rs6000coff_core_p (); extern boolean rs6000coff_core_file_matches_executable_p (); @@ -155,10 +155,9 @@ _bfd_xcoff_mkobject (abfd) bfd *abfd; { coff_data_type *coff; + bfd_size_type amt = sizeof (struct xcoff_tdata); - abfd->tdata.xcoff_obj_data = - ((struct xcoff_tdata *) - bfd_zalloc (abfd, sizeof (struct xcoff_tdata))); + abfd->tdata.xcoff_obj_data = (struct xcoff_tdata *) bfd_zalloc (abfd, amt); if (abfd->tdata.xcoff_obj_data == NULL) return false; coff = coff_data (abfd); @@ -240,8 +239,6 @@ _bfd_xcoff_is_local_label_name (abfd, na return false; } - - void _bfd_xcoff_swap_sym_in (abfd, ext1, in1) bfd *abfd; @@ -258,15 +255,14 @@ _bfd_xcoff_swap_sym_in (abfd, ext1, in1) else { in->_n._n_n._n_zeroes = 0; - in->_n._n_n._n_offset = - bfd_h_get_32 (abfd, (bfd_byte *) ext->e.e.e_offset); + in->_n._n_n._n_offset = H_GET_32 (abfd, ext->e.e.e_offset); } - in->n_value = bfd_h_get_32 (abfd, (bfd_byte *) ext->e_value); - in->n_scnum = bfd_h_get_16 (abfd, (bfd_byte *) ext->e_scnum); - in->n_type = bfd_h_get_16 (abfd, (bfd_byte *) ext->e_type); - in->n_sclass = bfd_h_get_8 (abfd, ext->e_sclass); - in->n_numaux = bfd_h_get_8 (abfd, ext->e_numaux); + in->n_value = H_GET_32 (abfd, ext->e_value); + in->n_scnum = H_GET_16 (abfd, ext->e_scnum); + in->n_type = H_GET_16 (abfd, ext->e_type); + in->n_sclass = H_GET_8 (abfd, ext->e_sclass); + in->n_numaux = H_GET_8 (abfd, ext->e_numaux); } unsigned int @@ -284,26 +280,18 @@ _bfd_xcoff_swap_sym_out (abfd, inp, extp } else { - bfd_h_put_32 (abfd, 0, (bfd_byte *) ext->e.e.e_zeroes); - bfd_h_put_32 (abfd, in->_n._n_n._n_offset, - (bfd_byte *) ext->e.e.e_offset); + H_PUT_32 (abfd, 0, ext->e.e.e_zeroes); + H_PUT_32 (abfd, in->_n._n_n._n_offset, ext->e.e.e_offset); } - bfd_h_put_32 (abfd, in->n_value , (bfd_byte *) ext->e_value); - bfd_h_put_16 (abfd, in->n_scnum , (bfd_byte *) ext->e_scnum); - bfd_h_put_16 (abfd, in->n_type , (bfd_byte *) ext->e_type); - bfd_h_put_8 (abfd, in->n_sclass , ext->e_sclass); - bfd_h_put_8 (abfd, in->n_numaux , ext->e_numaux); + H_PUT_32 (abfd, in->n_value, ext->e_value); + H_PUT_16 (abfd, in->n_scnum, ext->e_scnum); + H_PUT_16 (abfd, in->n_type, ext->e_type); + H_PUT_8 (abfd, in->n_sclass, ext->e_sclass); + H_PUT_8 (abfd, in->n_numaux, ext->e_numaux); return bfd_coff_symesz (abfd); } -#define PUTWORD bfd_h_put_32 -#define PUTHALF bfd_h_put_16 -#define PUTBYTE bfd_h_put_8 -#define GETWORD bfd_h_get_32 -#define GETHALF bfd_h_get_16 -#define GETBYTE bfd_h_get_8 - void _bfd_xcoff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1) bfd *abfd; @@ -323,8 +311,8 @@ _bfd_xcoff_swap_aux_in (abfd, ext1, type if (ext->x_file.x_fname[0] == 0) { in->x_file.x_n.x_zeroes = 0; - in->x_file.x_n.x_offset = - bfd_h_get_32 (abfd, (bfd_byte *) ext->x_file.x_n.x_offset); + in->x_file.x_n.x_offset = + H_GET_32 (abfd, ext->x_file.x_n.x_offset); } else { @@ -346,18 +334,16 @@ _bfd_xcoff_swap_aux_in (abfd, ext1, type case C_HIDEXT: if (indx + 1 == numaux) { - in->x_csect.x_scnlen.l = - bfd_h_get_32 (abfd, ext->x_csect.x_scnlen); - in->x_csect.x_parmhash = bfd_h_get_32 (abfd, - ext->x_csect.x_parmhash); - in->x_csect.x_snhash = bfd_h_get_16 (abfd, ext->x_csect.x_snhash); + in->x_csect.x_scnlen.l = H_GET_32 (abfd, ext->x_csect.x_scnlen); + in->x_csect.x_parmhash = H_GET_32 (abfd, ext->x_csect.x_parmhash); + in->x_csect.x_snhash = H_GET_16 (abfd, ext->x_csect.x_snhash); /* We don't have to hack bitfields in x_smtyp because it's defined by shifts-and-ands, which are equivalent on all byte orders. */ - in->x_csect.x_smtyp = bfd_h_get_8 (abfd, ext->x_csect.x_smtyp); - in->x_csect.x_smclas = bfd_h_get_8 (abfd, ext->x_csect.x_smclas); - in->x_csect.x_stab = bfd_h_get_32 (abfd, ext->x_csect.x_stab); - in->x_csect.x_snstab = bfd_h_get_16 (abfd, ext->x_csect.x_snstab); + in->x_csect.x_smtyp = H_GET_8 (abfd, ext->x_csect.x_smtyp); + in->x_csect.x_smclas = H_GET_8 (abfd, ext->x_csect.x_smclas); + in->x_csect.x_stab = H_GET_32 (abfd, ext->x_csect.x_stab); + in->x_csect.x_snstab = H_GET_16 (abfd, ext->x_csect.x_snstab); goto end; } break; @@ -367,12 +353,9 @@ _bfd_xcoff_swap_aux_in (abfd, ext1, type case C_HIDDEN: if (type == T_NULL) { - in->x_scn.x_scnlen = bfd_h_get_32(abfd, - (bfd_byte *) ext->x_scn.x_scnlen); - in->x_scn.x_nreloc = bfd_h_get_16(abfd, - (bfd_byte *) ext->x_scn.x_nreloc); - in->x_scn.x_nlinno = bfd_h_get_16(abfd, - (bfd_byte *) ext->x_scn.x_nlinno); + in->x_scn.x_scnlen = H_GET_32 (abfd, ext->x_scn.x_scnlen); + in->x_scn.x_nreloc = H_GET_16 (abfd, ext->x_scn.x_nreloc); + in->x_scn.x_nlinno = H_GET_16 (abfd, ext->x_scn.x_nlinno); /* PE defines some extra fields; we zero them out for safety. */ in->x_scn.x_checksum = 0; @@ -384,38 +367,38 @@ _bfd_xcoff_swap_aux_in (abfd, ext1, type break; } - in->x_sym.x_tagndx.l = bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_tagndx); - in->x_sym.x_tvndx = bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_tvndx); + in->x_sym.x_tagndx.l = H_GET_32 (abfd, ext->x_sym.x_tagndx); + in->x_sym.x_tvndx = H_GET_16 (abfd, ext->x_sym.x_tvndx); if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class)) { - in->x_sym.x_fcnary.x_fcn.x_lnnoptr = bfd_h_get_32(abfd, (bfd_byte *) - ext->x_sym.x_fcnary.x_fcn.x_lnnoptr); - in->x_sym.x_fcnary.x_fcn.x_endndx.l = bfd_h_get_32(abfd, (bfd_byte *) - ext->x_sym.x_fcnary.x_fcn.x_endndx); + in->x_sym.x_fcnary.x_fcn.x_lnnoptr = + H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr); + in->x_sym.x_fcnary.x_fcn.x_endndx.l = + H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_endndx); } else { in->x_sym.x_fcnary.x_ary.x_dimen[0] = - bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[0]); + H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[0]); in->x_sym.x_fcnary.x_ary.x_dimen[1] = - bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[1]); + H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[1]); in->x_sym.x_fcnary.x_ary.x_dimen[2] = - bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[2]); + H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[2]); in->x_sym.x_fcnary.x_ary.x_dimen[3] = - bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[3]); + H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[3]); } if (ISFCN (type)) { - in->x_sym.x_misc.x_fsize = bfd_h_get_32 (abfd, (bfd_byte *) ext->x_sym.x_misc.x_fsize); + in->x_sym.x_misc.x_fsize = H_GET_32 (abfd, ext->x_sym.x_misc.x_fsize); } else { - in->x_sym.x_misc.x_lnsz.x_lnno = bfd_h_get_16 (abfd, (bfd_byte *) - ext->x_sym.x_misc.x_lnsz.x_lnno); - in->x_sym.x_misc.x_lnsz.x_size = bfd_h_get_16 (abfd, (bfd_byte *) - ext->x_sym.x_misc.x_lnsz.x_size); + in->x_sym.x_misc.x_lnsz.x_lnno = + H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_lnno); + in->x_sym.x_misc.x_lnsz.x_size = + H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_size); } end: ; @@ -445,10 +428,8 @@ _bfd_xcoff_swap_aux_out (abfd, inp, type case C_FILE: if (in->x_file.x_fname[0] == 0) { - PUTWORD (abfd, 0, (bfd_byte *) ext->x_file.x_n.x_zeroes); - PUTWORD (abfd, - in->x_file.x_n.x_offset, - (bfd_byte *) ext->x_file.x_n.x_offset); + H_PUT_32 (abfd, 0, ext->x_file.x_n.x_zeroes); + H_PUT_32 (abfd, in->x_file.x_n.x_offset, ext->x_file.x_n.x_offset); } else { @@ -461,16 +442,16 @@ _bfd_xcoff_swap_aux_out (abfd, inp, type case C_HIDEXT: if (indx + 1 == numaux) { - PUTWORD (abfd, in->x_csect.x_scnlen.l,ext->x_csect.x_scnlen); - PUTWORD (abfd, in->x_csect.x_parmhash, ext->x_csect.x_parmhash); - PUTHALF (abfd, in->x_csect.x_snhash, ext->x_csect.x_snhash); + H_PUT_32 (abfd, in->x_csect.x_scnlen.l, ext->x_csect.x_scnlen); + H_PUT_32 (abfd, in->x_csect.x_parmhash, ext->x_csect.x_parmhash); + H_PUT_16 (abfd, in->x_csect.x_snhash, ext->x_csect.x_snhash); /* We don't have to hack bitfields in x_smtyp because it's defined by shifts-and-ands, which are equivalent on all byte orders. */ - PUTBYTE (abfd, in->x_csect.x_smtyp, ext->x_csect.x_smtyp); - PUTBYTE (abfd, in->x_csect.x_smclas, ext->x_csect.x_smclas); - PUTWORD (abfd, in->x_csect.x_stab, ext->x_csect.x_stab); - PUTHALF (abfd, in->x_csect.x_snstab, ext->x_csect.x_snstab); + H_PUT_8 (abfd, in->x_csect.x_smtyp, ext->x_csect.x_smtyp); + H_PUT_8 (abfd, in->x_csect.x_smclas, ext->x_csect.x_smclas); + H_PUT_32 (abfd, in->x_csect.x_stab, ext->x_csect.x_stab); + H_PUT_16 (abfd, in->x_csect.x_snstab, ext->x_csect.x_snstab); goto end; } break; @@ -480,45 +461,44 @@ _bfd_xcoff_swap_aux_out (abfd, inp, type case C_HIDDEN: if (type == T_NULL) { - bfd_h_put_32(abfd, in->x_scn.x_scnlen, (bfd_byte *) ext->x_scn.x_scnlen); - bfd_h_put_16(abfd, in->x_scn.x_nreloc, (bfd_byte *) ext->x_scn.x_nreloc); - bfd_h_put_16(abfd, in->x_scn.x_nlinno, (bfd_byte *) ext->x_scn.x_nlinno); + H_PUT_32 (abfd, in->x_scn.x_scnlen, ext->x_scn.x_scnlen); + H_PUT_16 (abfd, in->x_scn.x_nreloc, ext->x_scn.x_nreloc); + H_PUT_16 (abfd, in->x_scn.x_nlinno, ext->x_scn.x_nlinno); goto end; } break; } - PUTWORD (abfd, in->x_sym.x_tagndx.l, (bfd_byte *) ext->x_sym.x_tagndx); - bfd_h_put_16 (abfd, in->x_sym.x_tvndx , (bfd_byte *) ext->x_sym.x_tvndx); + H_PUT_32 (abfd, in->x_sym.x_tagndx.l, ext->x_sym.x_tagndx); + H_PUT_16 (abfd, in->x_sym.x_tvndx, ext->x_sym.x_tvndx); if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class)) { - bfd_h_put_32 (abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr, - (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr); - PUTWORD (abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l, - (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx); + H_PUT_32 (abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr, + ext->x_sym.x_fcnary.x_fcn.x_lnnoptr); + H_PUT_32 (abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l, + ext->x_sym.x_fcnary.x_fcn.x_endndx); } else { - bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[0], - (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[0]); - bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[1], - (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[1]); - bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[2], - (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[2]); - bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[3], - (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[3]); + H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[0], + ext->x_sym.x_fcnary.x_ary.x_dimen[0]); + H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[1], + ext->x_sym.x_fcnary.x_ary.x_dimen[1]); + H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[2], + ext->x_sym.x_fcnary.x_ary.x_dimen[2]); + H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[3], + ext->x_sym.x_fcnary.x_ary.x_dimen[3]); } if (ISFCN (type)) - PUTWORD (abfd, in->x_sym.x_misc.x_fsize, - (bfd_byte *) ext->x_sym.x_misc.x_fsize); + H_PUT_32 (abfd, in->x_sym.x_misc.x_fsize, ext->x_sym.x_misc.x_fsize); else { - bfd_h_put_16 (abfd, in->x_sym.x_misc.x_lnsz.x_lnno, - (bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_lnno); - bfd_h_put_16 (abfd, in->x_sym.x_misc.x_lnsz.x_size, - (bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_size); + H_PUT_16 (abfd, in->x_sym.x_misc.x_lnsz.x_lnno, + ext->x_sym.x_misc.x_lnsz.x_lnno); + H_PUT_16 (abfd, in->x_sym.x_misc.x_lnsz.x_size, + ext->x_sym.x_misc.x_lnsz.x_size); } end: @@ -913,7 +893,7 @@ _bfd_xcoff_rtype2howto (relent, internal type matches this information. The bitsize is not significant for R_REF relocs. */ if (relent->howto->dst_mask != 0 - && (relent->howto->bitsize + && (relent->howto->bitsize != ((unsigned int) internal->r_size & 0x3f) + 1)) abort (); #if 0 @@ -1031,12 +1011,14 @@ _bfd_xcoff_slurp_armap (abfd) return false; /* The symbol table starts with a normal archive header. */ - if (bfd_read ((PTR) &hdr, SIZEOF_AR_HDR, 1, abfd) != SIZEOF_AR_HDR) + if (bfd_bread ((PTR) &hdr, (bfd_size_type) SIZEOF_AR_HDR, abfd) + != SIZEOF_AR_HDR) return false; /* Skip the name (normally empty). */ namlen = strtol (hdr.namlen, (char **) NULL, 10); - if (bfd_seek (abfd, ((namlen + 1) & ~1) + SXCOFFARFMAG, SEEK_CUR) != 0) + off = ((namlen + 1) & ~ (size_t) 1) + SXCOFFARFMAG; + if (bfd_seek (abfd, off, SEEK_CUR) != 0) return false; sz = strtol (hdr.size, (char **) NULL, 10); @@ -1045,28 +1027,28 @@ _bfd_xcoff_slurp_armap (abfd) contents = (bfd_byte *) bfd_alloc (abfd, sz); if (contents == NULL) return false; - if (bfd_read ((PTR) contents, 1, sz, abfd) != sz) + if (bfd_bread ((PTR) contents, sz, abfd) != sz) return false; /* The symbol table starts with a four byte count. */ - c = bfd_h_get_32 (abfd, contents); - + c = H_GET_32 (abfd, contents); + if (c * 4 >= sz) { bfd_set_error (bfd_error_bad_value); return false; } - - bfd_ardata (abfd)->symdefs = ((carsym *) - bfd_alloc (abfd, c * sizeof (carsym))); + + bfd_ardata (abfd)->symdefs = + ((carsym *) bfd_alloc (abfd, c * sizeof (carsym))); if (bfd_ardata (abfd)->symdefs == NULL) return false; - + /* After the count comes a list of four byte file offsets. */ for (i = 0, arsym = bfd_ardata (abfd)->symdefs, p = contents + 4; i < c; ++i, ++arsym, p += 4) - arsym->file_offset = bfd_h_get_32 (abfd, p); + arsym->file_offset = H_GET_32 (abfd, p); } else { @@ -1084,13 +1066,14 @@ _bfd_xcoff_slurp_armap (abfd) return false; /* The symbol table starts with a normal archive header. */ - if (bfd_read ((PTR) &hdr, SIZEOF_AR_HDR_BIG, 1, abfd) + if (bfd_bread ((PTR) &hdr, (bfd_size_type) SIZEOF_AR_HDR_BIG, abfd) != SIZEOF_AR_HDR_BIG) return false; /* Skip the name (normally empty). */ namlen = strtol (hdr.namlen, (char **) NULL, 10); - if (bfd_seek (abfd, ((namlen + 1) & ~1) + SXCOFFARFMAG, SEEK_CUR) != 0) + off = ((namlen + 1) & ~ (size_t) 1) + SXCOFFARFMAG; + if (bfd_seek (abfd, off, SEEK_CUR) != 0) return false; /* XXX This actually has to be a call to strtoll (at least on 32-bit @@ -1102,28 +1085,28 @@ _bfd_xcoff_slurp_armap (abfd) contents = (bfd_byte *) bfd_alloc (abfd, sz); if (contents == NULL) return false; - if (bfd_read ((PTR) contents, 1, sz, abfd) != sz) + if (bfd_bread ((PTR) contents, sz, abfd) != sz) return false; /* The symbol table starts with an eight byte count. */ - c = bfd_h_get_64 (abfd, contents); + c = H_GET_64 (abfd, contents); if (c * 8 >= sz) { bfd_set_error (bfd_error_bad_value); return false; } - - bfd_ardata (abfd)->symdefs = ((carsym *) - bfd_alloc (abfd, c * sizeof (carsym))); + + bfd_ardata (abfd)->symdefs = + ((carsym *) bfd_alloc (abfd, c * sizeof (carsym))); if (bfd_ardata (abfd)->symdefs == NULL) return false; - + /* After the count comes a list of eight byte file offsets. */ for (i = 0, arsym = bfd_ardata (abfd)->symdefs, p = contents + 8; i < c; ++i, ++arsym, p += 8) - arsym->file_offset = bfd_h_get_64 (abfd, p); + arsym->file_offset = H_GET_64 (abfd, p); } /* After the file offsets come null terminated symbol names. */ @@ -1153,8 +1136,9 @@ _bfd_xcoff_archive_p (abfd) bfd *abfd; { char magic[SXCOFFARMAG]; + bfd_size_type amt; - if (bfd_read ((PTR) magic, SXCOFFARMAG, 1, abfd) != SXCOFFARMAG) + if (bfd_bread ((PTR) magic, (bfd_size_type) SXCOFFARMAG, abfd) != SXCOFFARMAG) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -1171,9 +1155,8 @@ _bfd_xcoff_archive_p (abfd) /* We are setting bfd_ardata(abfd) here, but since bfd_ardata involves a cast, we can't do it as the left operand of assignment. */ - abfd->tdata.aout_ar_data = - (struct artdata *) bfd_zalloc (abfd, sizeof (struct artdata)); - + amt = sizeof (struct artdata); + abfd->tdata.aout_ar_data = (struct artdata *) bfd_zalloc (abfd, amt); if (bfd_ardata (abfd) == (struct artdata *) NULL) return NULL; @@ -1192,8 +1175,9 @@ _bfd_xcoff_archive_p (abfd) memcpy (hdr.magic, magic, SXCOFFARMAG); /* Now read the rest of the file header. */ - if (bfd_read ((PTR) &hdr.memoff, SIZEOF_AR_FILE_HDR - SXCOFFARMAG, 1, - abfd) != SIZEOF_AR_FILE_HDR - SXCOFFARMAG) + if (bfd_bread ((PTR) &hdr.memoff, + (bfd_size_type) SIZEOF_AR_FILE_HDR - SXCOFFARMAG, abfd) + != SIZEOF_AR_FILE_HDR - SXCOFFARMAG) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -1203,7 +1187,8 @@ _bfd_xcoff_archive_p (abfd) bfd_ardata (abfd)->first_file_filepos = strtol (hdr.firstmemoff, (char **) NULL, 10); - bfd_ardata (abfd)->tdata = bfd_zalloc (abfd, SIZEOF_AR_FILE_HDR); + amt = SIZEOF_AR_FILE_HDR; + bfd_ardata (abfd)->tdata = bfd_zalloc (abfd, amt); if (bfd_ardata (abfd)->tdata == NULL) return NULL; @@ -1218,8 +1203,9 @@ _bfd_xcoff_archive_p (abfd) memcpy (hdr.magic, magic, SXCOFFARMAG); /* Now read the rest of the file header. */ - if (bfd_read ((PTR) &hdr.memoff, SIZEOF_AR_FILE_HDR_BIG - SXCOFFARMAG, 1, - abfd) != SIZEOF_AR_FILE_HDR_BIG - SXCOFFARMAG) + if (bfd_bread ((PTR) &hdr.memoff, + (bfd_size_type) SIZEOF_AR_FILE_HDR_BIG - SXCOFFARMAG, abfd) + != SIZEOF_AR_FILE_HDR_BIG - SXCOFFARMAG) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -1232,7 +1218,8 @@ _bfd_xcoff_archive_p (abfd) bfd_ardata (abfd)->first_file_filepos = strtol (hdr.firstmemoff, (char **) NULL, 10); - bfd_ardata (abfd)->tdata = bfd_zalloc (abfd, SIZEOF_AR_FILE_HDR_BIG); + amt = SIZEOF_AR_FILE_HDR_BIG; + bfd_ardata (abfd)->tdata = bfd_zalloc (abfd, amt); if (bfd_ardata (abfd)->tdata == NULL) return NULL; @@ -1255,10 +1242,11 @@ PTR _bfd_xcoff_read_ar_hdr (abfd) bfd *abfd; { - size_t namlen; + bfd_size_type namlen; struct areltdata *ret; + bfd_size_type amt = sizeof (struct areltdata); - ret = (struct areltdata *) bfd_alloc (abfd, sizeof (struct areltdata)); + ret = (struct areltdata *) bfd_alloc (abfd, amt); if (ret == NULL) return NULL; @@ -1267,22 +1255,23 @@ _bfd_xcoff_read_ar_hdr (abfd) struct xcoff_ar_hdr hdr; struct xcoff_ar_hdr *hdrp; - if (bfd_read ((PTR) &hdr, SIZEOF_AR_HDR, 1, abfd) != SIZEOF_AR_HDR) + if (bfd_bread ((PTR) &hdr, (bfd_size_type) SIZEOF_AR_HDR, abfd) + != SIZEOF_AR_HDR) { free (ret); return NULL; } namlen = strtol (hdr.namlen, (char **) NULL, 10); - hdrp = (struct xcoff_ar_hdr *) bfd_alloc (abfd, - SIZEOF_AR_HDR + namlen + 1); + amt = SIZEOF_AR_HDR + namlen + 1; + hdrp = (struct xcoff_ar_hdr *) bfd_alloc (abfd, amt); if (hdrp == NULL) { free (ret); return NULL; } memcpy (hdrp, &hdr, SIZEOF_AR_HDR); - if (bfd_read ((char *) hdrp + SIZEOF_AR_HDR, 1, namlen, abfd) != namlen) + if (bfd_bread ((char *) hdrp + SIZEOF_AR_HDR, namlen, abfd) != namlen) { free (ret); return NULL; @@ -1298,7 +1287,7 @@ _bfd_xcoff_read_ar_hdr (abfd) struct xcoff_ar_hdr_big hdr; struct xcoff_ar_hdr_big *hdrp; - if (bfd_read ((PTR) &hdr, SIZEOF_AR_HDR_BIG, 1, abfd) + if (bfd_bread ((PTR) &hdr, (bfd_size_type) SIZEOF_AR_HDR_BIG, abfd) != SIZEOF_AR_HDR_BIG) { free (ret); @@ -1306,16 +1295,15 @@ _bfd_xcoff_read_ar_hdr (abfd) } namlen = strtol (hdr.namlen, (char **) NULL, 10); - hdrp = (struct xcoff_ar_hdr_big *) bfd_alloc (abfd, - SIZEOF_AR_HDR_BIG - + namlen + 1); + amt = SIZEOF_AR_HDR_BIG + namlen + 1; + hdrp = (struct xcoff_ar_hdr_big *) bfd_alloc (abfd, amt); if (hdrp == NULL) { free (ret); return NULL; } memcpy (hdrp, &hdr, SIZEOF_AR_HDR_BIG); - if (bfd_read ((char *) hdrp + SIZEOF_AR_HDR_BIG, 1, namlen, abfd) != namlen) + if (bfd_bread ((char *) hdrp + SIZEOF_AR_HDR_BIG, namlen, abfd) != namlen) { free (ret); return NULL; @@ -1331,7 +1319,7 @@ _bfd_xcoff_read_ar_hdr (abfd) } /* Skip over the XCOFFARFMAG at the end of the file name. */ - if (bfd_seek (abfd, (namlen & 1) + SXCOFFARFMAG, SEEK_CUR) != 0) + if (bfd_seek (abfd, (file_ptr) ((namlen & 1) + SXCOFFARFMAG), SEEK_CUR) != 0) return NULL; return (PTR) ret; @@ -1486,12 +1474,14 @@ xcoff_write_armap_old (abfd, elength, ma if (*p == '\0') *p = ' '; - if (bfd_write ((PTR) &hdr, SIZEOF_AR_HDR, 1, abfd) != SIZEOF_AR_HDR - || bfd_write (XCOFFARFMAG, 1, SXCOFFARFMAG, abfd) != SXCOFFARFMAG) + if (bfd_bwrite ((PTR) &hdr, (bfd_size_type) SIZEOF_AR_HDR, abfd) + != SIZEOF_AR_HDR + || (bfd_bwrite (XCOFFARFMAG, (bfd_size_type) SXCOFFARFMAG, abfd) + != SXCOFFARFMAG)) return false; - bfd_h_put_32 (abfd, orl_count, buf); - if (bfd_write (buf, 1, 4, abfd) != 4) + H_PUT_32 (abfd, orl_count, buf); + if (bfd_bwrite (buf, (bfd_size_type) 4, abfd) != 4) return false; sub = abfd->archive_head; @@ -1501,15 +1491,15 @@ xcoff_write_armap_old (abfd, elength, ma { size_t namlen; - while (((bfd *) (map[i]).pos) == sub) + while (map[i].u.abfd == sub) { - bfd_h_put_32 (abfd, fileoff, buf); - if (bfd_write (buf, 1, 4, abfd) != 4) + H_PUT_32 (abfd, fileoff, buf); + if (bfd_bwrite (buf, (bfd_size_type) 4, abfd) != 4) return false; ++i; } namlen = strlen (normalize_filename (sub)); - namlen = (namlen + 1) &~ 1; + namlen = (namlen + 1) &~ (size_t) 1; fileoff += (SIZEOF_AR_HDR + namlen + SXCOFFARFMAG @@ -1525,7 +1515,7 @@ xcoff_write_armap_old (abfd, elength, ma name = *map[i].name; namlen = strlen (name); - if (bfd_write (name, 1, namlen + 1, abfd) != namlen + 1) + if (bfd_bwrite (name, (bfd_size_type) (namlen + 1), abfd) != namlen + 1) return false; } @@ -1534,7 +1524,7 @@ xcoff_write_armap_old (abfd, elength, ma char b; b = '\0'; - if (bfd_write (&b, 1, 1, abfd) != 1) + if (bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1) return false; } @@ -1579,7 +1569,7 @@ xcoff_write_one_armap_big (abfd, map, or sprintf (hdr.nextoff, "%ld", (strtol (prevoff, (char **) NULL, 10) + (long) (4 + orl_ccount * 4 + stridx))); } - + memcpy (hdr.prevoff, prevoff, sizeof (hdr.prevoff)); sprintf (hdr.date, "%d", 0); sprintf (hdr.uid, "%d", 0); @@ -1594,12 +1584,14 @@ xcoff_write_one_armap_big (abfd, map, or memcpy (nextoff, hdr.nextoff, sizeof (hdr.nextoff)); - if (bfd_write ((PTR) &hdr, SIZEOF_AR_HDR_BIG, 1, abfd) != SIZEOF_AR_HDR_BIG - || bfd_write (XCOFFARFMAG, 1, SXCOFFARFMAG, abfd) != SXCOFFARFMAG) + if ((bfd_bwrite ((PTR) &hdr, (bfd_size_type) SIZEOF_AR_HDR_BIG, abfd) + != SIZEOF_AR_HDR_BIG) + || (bfd_bwrite (XCOFFARFMAG, (bfd_size_type) SXCOFFARFMAG, abfd) + != SXCOFFARFMAG)) return false; - bfd_h_put_32 (abfd, orl_ccount, buf); - if (bfd_write (buf, 1, 4, abfd) != 4) + H_PUT_32 (abfd, orl_ccount, buf); + if (bfd_bwrite (buf, (bfd_size_type) 4, abfd) != 4) return false; sub = abfd->archive_head; @@ -1609,20 +1601,20 @@ xcoff_write_one_armap_big (abfd, map, or { size_t namlen; - if ((bfd_arch_bits_per_address ((bfd *) map[i].pos) == 64) == bits64) - while (((bfd *) (map[i]).pos) == sub) + if ((bfd_arch_bits_per_address (map[i].u.abfd) == 64) == bits64) + while (map[i].u.abfd == sub) { - bfd_h_put_32 (abfd, fileoff, buf); - if (bfd_write (buf, 1, 4, abfd) != 4) + H_PUT_32 (abfd, fileoff, buf); + if (bfd_bwrite (buf, (bfd_size_type) 4, abfd) != 4) return false; i++; } else - while (((bfd *) (map[i]).pos) == sub) + while (map[i].u.abfd == sub) i++; namlen = strlen (normalize_filename (sub)); - namlen = (namlen + 1) &~ 1; + namlen = (namlen + 1) &~ (size_t) 1; fileoff += (SIZEOF_AR_HDR_BIG + namlen + SXCOFFARFMAG @@ -1636,7 +1628,7 @@ xcoff_write_one_armap_big (abfd, map, or { const char *name; size_t namlen; - bfd *ob = (bfd *)map[i].pos; + bfd *ob = map[i].u.abfd; if (ob != object_bfd) arch_info = bfd_get_arch_info (ob); @@ -1645,7 +1637,7 @@ xcoff_write_one_armap_big (abfd, map, or name = *map[i].name; namlen = strlen (name); - if (bfd_write (name, 1, namlen + 1, abfd) != namlen + 1) + if (bfd_bwrite (name, (bfd_size_type) (namlen + 1), abfd) != namlen + 1) return false; } @@ -1654,7 +1646,7 @@ xcoff_write_one_armap_big (abfd, map, or char b; b = '\0'; - if (bfd_write (&b, 1, 1, abfd) != 1) + if (bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1) return false; } @@ -1684,7 +1676,7 @@ xcoff_write_armap_big (abfd, elength, ma object_bfd = NULL; for (i = 0; i < orl_count; i++) { - bfd *ob = (bfd *)map[i].pos; + bfd *ob = map[i].u.abfd; unsigned int len; if (ob != object_bfd) arch_info = bfd_get_arch_info (ob); @@ -1708,7 +1700,7 @@ xcoff_write_armap_big (abfd, elength, ma /* Now write out each map. */ if (! xcoff_write_one_armap_big (abfd, map, orl_count, orl_count_32, - stridx_32, false, + stridx_32, false, xcoff_ardata_big (abfd)->memoff, xcoff_ardata_big (abfd)->symoff)) return false; @@ -1717,7 +1709,7 @@ xcoff_write_armap_big (abfd, elength, ma xcoff_ardata_big (abfd)->symoff, xcoff_ardata_big (abfd)->symoff64)) return false; - + return true; } @@ -1743,14 +1735,14 @@ xcoff_write_archive_contents_old (abfd) bfd *abfd; { struct xcoff_ar_file_hdr fhdr; - size_t count; - size_t total_namlen; + bfd_size_type count; + bfd_size_type total_namlen; file_ptr *offsets; boolean makemap; boolean hasobjects; - file_ptr prevoff, nextoff; + ufile_ptr prevoff, nextoff; bfd *sub; - unsigned int i; + size_t i; struct xcoff_ar_hdr ahdr; bfd_size_type size; char *p; @@ -1772,7 +1764,7 @@ xcoff_write_archive_contents_old (abfd) if (offsets == NULL) return false; - if (bfd_seek (abfd, SIZEOF_AR_FILE_HDR, SEEK_SET) != 0) + if (bfd_seek (abfd, (file_ptr) SIZEOF_AR_FILE_HDR, SEEK_SET) != 0) return false; makemap = bfd_has_map (abfd); @@ -1782,7 +1774,7 @@ xcoff_write_archive_contents_old (abfd) for (sub = abfd->archive_head, i = 0; sub != NULL; sub = sub->next, i++) { const char *name; - size_t namlen; + bfd_size_type namlen; struct xcoff_ar_hdr *ahdrp; bfd_size_type remaining; @@ -1820,7 +1812,8 @@ xcoff_write_archive_contents_old (abfd) if (sub->arelt_data == NULL) { - sub->arelt_data = bfd_alloc (sub, sizeof (struct areltdata)); + size = sizeof (struct areltdata); + sub->arelt_data = bfd_alloc (sub, size); if (sub->arelt_data == NULL) return false; } @@ -1833,7 +1826,7 @@ xcoff_write_archive_contents_old (abfd) /* If the length of the name is odd, we write out the null byte after the name as well. */ - namlen = (namlen + 1) &~ 1; + namlen = (namlen + 1) &~ (bfd_size_type) 1; remaining = arelt_size (sub); size = (SIZEOF_AR_HDR @@ -1855,9 +1848,10 @@ xcoff_write_archive_contents_old (abfd) if (*p == '\0') *p = ' '; - if (bfd_write ((PTR) ahdrp, 1, SIZEOF_AR_HDR, abfd) != SIZEOF_AR_HDR - || bfd_write ((PTR) name, 1, namlen, abfd) != namlen - || (bfd_write ((PTR) XCOFFARFMAG, 1, SXCOFFARFMAG, abfd) + if ((bfd_bwrite ((PTR) ahdrp, (bfd_size_type) SIZEOF_AR_HDR, abfd) + != SIZEOF_AR_HDR) + || (bfd_bwrite ((PTR) name, namlen, abfd) != namlen) + || (bfd_bwrite ((PTR) XCOFFARFMAG, (bfd_size_type) SXCOFFARFMAG, abfd) != SXCOFFARFMAG)) return false; @@ -1871,8 +1865,8 @@ xcoff_write_archive_contents_old (abfd) amt = sizeof buffer; if (amt > remaining) amt = remaining; - if (bfd_read (buffer, 1, amt, sub) != amt - || bfd_write (buffer, 1, amt, abfd) != amt) + if (bfd_bread (buffer, amt, sub) != amt + || bfd_bwrite (buffer, amt, abfd) != amt) return false; remaining -= amt; } @@ -1882,7 +1876,7 @@ xcoff_write_archive_contents_old (abfd) bfd_byte b; b = '\0'; - if (bfd_write (&b, 1, 1, abfd) != 1) + if (bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1) return false; } } @@ -1922,28 +1916,29 @@ xcoff_write_archive_contents_old (abfd) if (*p == '\0') *p = ' '; - if (bfd_write ((PTR) &ahdr, 1, SIZEOF_AR_HDR, abfd) != SIZEOF_AR_HDR - || (bfd_write ((PTR) XCOFFARFMAG, 1, SXCOFFARFMAG, abfd) + if ((bfd_bwrite ((PTR) &ahdr, (bfd_size_type) SIZEOF_AR_HDR, abfd) + != SIZEOF_AR_HDR) + || (bfd_bwrite ((PTR) XCOFFARFMAG, (bfd_size_type) SXCOFFARFMAG, abfd) != SXCOFFARFMAG)) return false; sprintf (decbuf, "%-12ld", (long) count); - if (bfd_write ((PTR) decbuf, 1, 12, abfd) != 12) + if (bfd_bwrite ((PTR) decbuf, (bfd_size_type) 12, abfd) != 12) return false; - for (i = 0; i < count; i++) + for (i = 0; i < (size_t) count; i++) { sprintf (decbuf, "%-12ld", (long) offsets[i]); - if (bfd_write ((PTR) decbuf, 1, 12, abfd) != 12) + if (bfd_bwrite ((PTR) decbuf, (bfd_size_type) 12, abfd) != 12) return false; } for (sub = abfd->archive_head; sub != NULL; sub = sub->next) { const char *name; - size_t namlen; + bfd_size_type namlen; name = normalize_filename (sub); namlen = strlen (name); - if (bfd_write ((PTR) name, 1, namlen + 1, abfd) != namlen + 1) + if (bfd_bwrite ((PTR) name, namlen + 1, abfd) != namlen + 1) return false; } if ((size & 1) != 0) @@ -1951,7 +1946,7 @@ xcoff_write_archive_contents_old (abfd) bfd_byte b; b = '\0'; - if (bfd_write ((PTR) &b, 1, 1, abfd) != 1) + if (bfd_bwrite ((PTR) &b, (bfd_size_type) 1, abfd) != 1) return false; } @@ -1976,8 +1971,8 @@ xcoff_write_archive_contents_old (abfd) *p = ' '; if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 - || (bfd_write ((PTR) &fhdr, SIZEOF_AR_FILE_HDR, 1, abfd) != - SIZEOF_AR_FILE_HDR)) + || (bfd_bwrite ((PTR) &fhdr, (bfd_size_type) SIZEOF_AR_FILE_HDR, abfd) + != SIZEOF_AR_FILE_HDR)) return false; return true; @@ -1988,14 +1983,14 @@ xcoff_write_archive_contents_big (abfd) bfd *abfd; { struct xcoff_ar_file_hdr_big fhdr; - size_t count; - size_t total_namlen; + bfd_size_type count; + bfd_size_type total_namlen; file_ptr *offsets; boolean makemap; boolean hasobjects; - file_ptr prevoff, nextoff; + ufile_ptr prevoff, nextoff; bfd *sub; - unsigned int i; + size_t i; struct xcoff_ar_hdr_big ahdr; bfd_size_type size; char *p; @@ -2017,7 +2012,7 @@ xcoff_write_archive_contents_big (abfd) if (offsets == NULL) return false; - if (bfd_seek (abfd, SIZEOF_AR_FILE_HDR_BIG, SEEK_SET) != 0) + if (bfd_seek (abfd, (file_ptr) SIZEOF_AR_FILE_HDR_BIG, SEEK_SET) != 0) return false; makemap = bfd_has_map (abfd); @@ -2027,7 +2022,7 @@ xcoff_write_archive_contents_big (abfd) for (sub = abfd->archive_head, i = 0; sub != NULL; sub = sub->next, i++) { const char *name; - size_t namlen; + bfd_size_type namlen; struct xcoff_ar_hdr_big *ahdrp; bfd_size_type remaining; @@ -2070,7 +2065,8 @@ xcoff_write_archive_contents_big (abfd) if (sub->arelt_data == NULL) { - sub->arelt_data = bfd_alloc (sub, sizeof (struct areltdata)); + size = sizeof (struct areltdata); + sub->arelt_data = bfd_alloc (sub, size); if (sub->arelt_data == NULL) return false; } @@ -2086,7 +2082,7 @@ xcoff_write_archive_contents_big (abfd) /* If the length of the name is odd, we write out the null byte after the name as well. */ - namlen = (namlen + 1) &~ 1; + namlen = (namlen + 1) &~ (bfd_size_type) 1; remaining = arelt_size (sub); size = (SIZEOF_AR_HDR_BIG @@ -2108,10 +2104,10 @@ xcoff_write_archive_contents_big (abfd) if (*p == '\0') *p = ' '; - if (bfd_write ((PTR) ahdrp, 1, SIZEOF_AR_HDR_BIG, abfd) - != SIZEOF_AR_HDR_BIG - || bfd_write ((PTR) name, 1, namlen, abfd) != namlen - || (bfd_write ((PTR) XCOFFARFMAG, 1, SXCOFFARFMAG, abfd) + if ((bfd_bwrite ((PTR) ahdrp, (bfd_size_type) SIZEOF_AR_HDR_BIG, abfd) + != SIZEOF_AR_HDR_BIG) + || bfd_bwrite ((PTR) name, (bfd_size_type) namlen, abfd) != namlen + || (bfd_bwrite ((PTR) XCOFFARFMAG, (bfd_size_type) SXCOFFARFMAG, abfd) != SXCOFFARFMAG)) return false; @@ -2125,8 +2121,8 @@ xcoff_write_archive_contents_big (abfd) amt = sizeof buffer; if (amt > remaining) amt = remaining; - if (bfd_read (buffer, 1, amt, sub) != amt - || bfd_write (buffer, 1, amt, abfd) != amt) + if (bfd_bread (buffer, amt, sub) != amt + || bfd_bwrite (buffer, amt, abfd) != amt) return false; remaining -= amt; } @@ -2136,7 +2132,7 @@ xcoff_write_archive_contents_big (abfd) bfd_byte b; b = '\0'; - if (bfd_write (&b, 1, 1, abfd) != 1) + if (bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1) return false; } } @@ -2188,18 +2184,19 @@ xcoff_write_archive_contents_big (abfd) if (*p == '\0') *p = ' '; - if (bfd_write ((PTR) &ahdr, 1, SIZEOF_AR_HDR_BIG, abfd) != SIZEOF_AR_HDR_BIG - || (bfd_write ((PTR) XCOFFARFMAG, 1, SXCOFFARFMAG, abfd) + if ((bfd_bwrite ((PTR) &ahdr, (bfd_size_type) SIZEOF_AR_HDR_BIG, abfd) + != SIZEOF_AR_HDR_BIG) + || (bfd_bwrite ((PTR) XCOFFARFMAG, (bfd_size_type) SXCOFFARFMAG, abfd) != SXCOFFARFMAG)) return false; sprintf (decbuf, "%-12ld", (long) count); - if (bfd_write ((PTR) decbuf, 1, 12, abfd) != 12) + if (bfd_bwrite ((PTR) decbuf, (bfd_size_type) 12, abfd) != 12) return false; - for (i = 0; i < count; i++) + for (i = 0; i < (size_t) count; i++) { sprintf (decbuf, "%-12ld", (long) offsets[i]); - if (bfd_write ((PTR) decbuf, 1, 12, abfd) != 12) + if (bfd_bwrite ((PTR) decbuf, (bfd_size_type) 12, abfd) != 12) return false; } for (sub = abfd->archive_head; sub != NULL; sub = sub->next) @@ -2209,7 +2206,8 @@ xcoff_write_archive_contents_big (abfd) name = normalize_filename (sub); namlen = strlen (name); - if (bfd_write ((PTR) name, 1, namlen + 1, abfd) != namlen + 1) + if (bfd_bwrite ((PTR) name, (bfd_size_type) (namlen + 1), abfd) + != namlen + 1) return false; } if ((size & 1) != 0) @@ -2217,7 +2215,7 @@ xcoff_write_archive_contents_big (abfd) bfd_byte b; b = '\0'; - if (bfd_write ((PTR) &b, 1, 1, abfd) != 1) + if (bfd_bwrite ((PTR) &b, (bfd_size_type) 1, abfd) != 1) return false; } @@ -2244,8 +2242,8 @@ xcoff_write_archive_contents_big (abfd) *p = ' '; if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 - || (bfd_write ((PTR) &fhdr, SIZEOF_AR_FILE_HDR_BIG, 1, abfd) != - SIZEOF_AR_FILE_HDR_BIG)) + || (bfd_bwrite ((PTR) &fhdr, (bfd_size_type) SIZEOF_AR_FILE_HDR_BIG, abfd) + != SIZEOF_AR_FILE_HDR_BIG)) return false; return true; @@ -2315,7 +2313,7 @@ xcoff_swap_ldhdr_out (abfd, src, d) { struct external_ldhdr *dst = (struct external_ldhdr *) d; - bfd_put_32 (abfd, src->l_version, dst->l_version); + bfd_put_32 (abfd, (bfd_vma) src->l_version, dst->l_version); bfd_put_32 (abfd, src->l_nsyms, dst->l_nsyms); bfd_put_32 (abfd, src->l_nreloc, dst->l_nreloc); bfd_put_32 (abfd, src->l_istlen, dst->l_istlen); @@ -2363,11 +2361,12 @@ xcoff_swap_ldsym_out (abfd, src, d) memcpy (dst->_l._l_name, src->_l._l_name, SYMNMLEN); else { - bfd_put_32 (abfd, 0, dst->_l._l_l._l_zeroes); - bfd_put_32 (abfd, src->_l._l_l._l_offset, dst->_l._l_l._l_offset); + bfd_put_32 (abfd, (bfd_vma) 0, dst->_l._l_l._l_zeroes); + bfd_put_32 (abfd, (bfd_vma) src->_l._l_l._l_offset, + dst->_l._l_l._l_offset); } bfd_put_32 (abfd, src->l_value, dst->l_value); - bfd_put_16 (abfd, src->l_scnum, dst->l_scnum); + bfd_put_16 (abfd, (bfd_vma) src->l_scnum, dst->l_scnum); bfd_put_8 (abfd, src->l_smtype, dst->l_smtype); bfd_put_8 (abfd, src->l_smclas, dst->l_smclas); bfd_put_32 (abfd, src->l_ifile, dst->l_ifile); @@ -2402,8 +2401,8 @@ xcoff_swap_ldrel_out (abfd, src, d) bfd_put_32 (abfd, src->l_vaddr, dst->l_vaddr); bfd_put_32 (abfd, src->l_symndx, dst->l_symndx); - bfd_put_16 (abfd, src->l_rtype, dst->l_rtype); - bfd_put_16 (abfd, src->l_rsecnm, dst->l_rsecnm); + bfd_put_16 (abfd, (bfd_vma) src->l_rtype, dst->l_rtype); + bfd_put_16 (abfd, (bfd_vma) src->l_rsecnm, dst->l_rsecnm); } @@ -2456,7 +2455,7 @@ xcoff_ppc_relocate_section (output_bfd, addend = 0; } else - { + { h = obj_xcoff_sym_hashes (input_bfd)[symndx]; sym = syms + symndx; addend = - sym->n_value; @@ -2577,7 +2576,7 @@ xcoff_ppc_relocate_section (output_bfd, default: (*_bfd_error_handler) (_("%s: unsupported relocation type 0x%02x"), - bfd_get_filename (input_bfd), (unsigned int) rel->r_type); + bfd_archive_filename (input_bfd), (unsigned int) rel->r_type); bfd_set_error (bfd_error_bad_value); return false; case R_POS: @@ -2623,7 +2622,7 @@ xcoff_ppc_relocate_section (output_bfd, { (*_bfd_error_handler) (_("%s: TOC reloc at 0x%x to symbol `%s' with no TOC entry"), - bfd_get_filename (input_bfd), rel->r_vaddr, + bfd_archive_filename (input_bfd), rel->r_vaddr, h->root.root.string); bfd_set_error (bfd_error_bad_value); return false; @@ -2715,12 +2714,16 @@ xcoff_ppc_relocate_section (output_bfd, if (next == 0x4def7b82 /* cror 15,15,15 */ || next == 0x4ffffb82 /* cror 31,31,31 */ || next == 0x60000000) /* ori r0,r0,0 */ - bfd_put_32 (input_bfd, 0x80410014, pnext); /* lwz r1,20(r1) */ + bfd_put_32 (input_bfd, + (bfd_vma) 0x80410014, /* lwz r1,20(r1) */ + pnext); } else { if (next == 0x80410014) /* lwz r1,20(r1) */ - bfd_put_32 (input_bfd, 0x60000000, pnext); /* ori r0,r0,0 */ + bfd_put_32 (input_bfd, + (bfd_vma) 0x60000000, /* ori r0,r0,0 */ + pnext); } } @@ -2785,7 +2788,7 @@ _bfd_xcoff_put_ldsymbol_name (abfd, ldin { if (ldinfo->string_size + len + 3 > ldinfo->string_alc) { - size_t newalc; + bfd_size_type newalc; bfd_byte *newstrings; newalc = ldinfo->string_alc * 2; @@ -2805,8 +2808,8 @@ _bfd_xcoff_put_ldsymbol_name (abfd, ldin ldinfo->strings = newstrings; } - bfd_put_16 (ldinfo->output_bfd, len + 1, - ldinfo->strings + ldinfo->string_size); + bfd_put_16 (ldinfo->output_bfd, (bfd_vma) (len + 1), + ldinfo->strings + ldinfo->string_size); strcpy (ldinfo->strings + ldinfo->string_size + 2, name); ldsym->_l._l_l._l_zeroes = 0; ldsym->_l._l_l._l_offset = ldinfo->string_size + 2; @@ -2817,7 +2820,7 @@ _bfd_xcoff_put_ldsymbol_name (abfd, ldin } static boolean -_bfd_xcoff_put_symbol_name (bfd *abfd, struct bfd_strtab_hash *strtab, +_bfd_xcoff_put_symbol_name (bfd *abfd, struct bfd_strtab_hash *strtab, struct internal_syment *sym, const char *name) { @@ -2843,7 +2846,7 @@ _bfd_xcoff_put_symbol_name (bfd *abfd, s } static asection * -xcoff_create_csect_from_smclas (abfd, aux, symbol_name) +xcoff_create_csect_from_smclas (abfd, aux, symbol_name) bfd *abfd; union internal_auxent *aux; const char *symbol_name; @@ -2856,27 +2859,27 @@ xcoff_create_csect_from_smclas (abfd, au { ".pr", ".ro", ".db", ".tc", ".ua", ".rw", ".gl", ".xo", ".sv", ".bs", ".ds", ".uc", ".ti", ".tb", NULL, ".tc0", - ".td", NULL, ".sv3264" + ".td", NULL, ".sv3264" }; if ((19 >= aux->x_csect.x_smclas) && (NULL != names[aux->x_csect.x_smclas])) { - return_value = bfd_make_section_anyway + return_value = bfd_make_section_anyway (abfd, names[aux->x_csect.x_smclas]); } else { (*_bfd_error_handler) (_("%s: symbol `%s' has unrecognized smclas %d"), - bfd_get_filename (abfd), symbol_name, aux->x_csect.x_smclas); + bfd_archive_filename (abfd), symbol_name, aux->x_csect.x_smclas); bfd_set_error (bfd_error_bad_value); } return return_value; } -static boolean +static boolean xcoff_is_lineno_count_overflow (abfd, value) bfd *abfd ATTRIBUTE_UNUSED; bfd_vma value; @@ -2887,7 +2890,7 @@ xcoff_is_lineno_count_overflow (abfd, va return false; } -static boolean +static boolean xcoff_is_reloc_count_overflow (abfd, value) bfd *abfd ATTRIBUTE_UNUSED; bfd_vma value; @@ -2911,29 +2914,29 @@ xcoff_loader_reloc_offset (abfd, ldhdr) bfd *abfd; struct internal_ldhdr *ldhdr; { - return bfd_xcoff_ldhdrsz(abfd) + + return bfd_xcoff_ldhdrsz(abfd) + (ldhdr->l_nsyms * bfd_xcoff_ldsymsz(abfd)); } static reloc_howto_type xcoff_dynamic_reloc = -HOWTO (0, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ +HOWTO (0, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_POS", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ + 0, /* special_function */ + "R_POS", /* name */ + true, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ false); /* pcrel_offset */ -/* glink - - The first word of global linkage code must be modified by filling in +/* glink + + The first word of global linkage code must be modified by filling in the correct TOC offset. */ static unsigned long xcoff_glink_code[9] = @@ -2950,11 +2953,11 @@ static unsigned long xcoff_glink_code[9] }; -static const struct xcoff_backend_data_rec bfd_xcoff_backend_data = +static const struct xcoff_backend_data_rec bfd_xcoff_backend_data = { { /* COFF backend, defined in libcoff.h. */ _bfd_xcoff_swap_aux_in, /* _bfd_coff_swap_aux_in */ - _bfd_xcoff_swap_sym_in, /* _bfd_coff_swap_sym_in */ + _bfd_xcoff_swap_sym_in, /* _bfd_coff_swap_sym_in */ coff_swap_lineno_in, /* _bfd_coff_swap_lineno_in */ _bfd_xcoff_swap_aux_out, /* _bfd_swap_aux_out */ _bfd_xcoff_swap_sym_out, /* _bfd_swap_sym_out */ @@ -2993,10 +2996,10 @@ static const struct xcoff_backend_data_r dummy_reloc16_estimate, /* _bfd_coff_reloc16_estimate */ NULL, /* bfd_coff_sym_is_global */ coff_compute_section_file_positions, /* _bfd_coff_compute_section_file_positions */ - NULL , /* _bfd_coff_start_final_link */ + NULL, /* _bfd_coff_start_final_link */ xcoff_ppc_relocate_section, /* _bfd_coff_relocate_section */ coff_rtype_to_howto, /* _bfd_coff_rtype_to_howto */ - NULL , /* _bfd_coff_addust_symndx */ + NULL, /* _bfd_coff_addust_symndx */ _bfd_generic_link_add_one_symbol, /* _bfd_coff_add_one_symbol */ coff_link_output_has_begun, /* _bfd_coff_link_output_has_begun */ coff_final_link_postscript /* _bfd_coff_final_link_postscript */ @@ -3005,7 +3008,7 @@ static const struct xcoff_backend_data_r 0x01DF, /* magic number */ bfd_arch_rs6000, /* architecture */ bfd_mach_rs6k, /* machine */ - + /* Function pointers to xcoff specific swap routines. */ xcoff_swap_ldhdr_in, /* _xcoff_swap_ldhdr_in */ xcoff_swap_ldhdr_out, /* _xcoff_swap_ldhdr_out */ @@ -3070,7 +3073,7 @@ const bfd_target rs6000coff_vec = bfd_putb32, /* bfd_putx32 */ bfd_getb16, /* bfd_getx16 */ bfd_getb_signed_16, /* bfd_getx_signed_16 */ - bfd_putb16, /* bfd_putx16 */ + bfd_putb16, /* bfd_putx16 */ /* hdrs */ bfd_getb64, /* bfd_h_getx64 */ @@ -3082,39 +3085,39 @@ const bfd_target rs6000coff_vec = bfd_getb16, /* bfd_h_getx16 */ bfd_getb_signed_16, /* bfd_h_getx_signed_16 */ bfd_putb16, /* bfd_h_putx16 */ - + { /* bfd_check_format */ - _bfd_dummy_target, - coff_object_p, - _bfd_xcoff_archive_p, + _bfd_dummy_target, + coff_object_p, + _bfd_xcoff_archive_p, CORE_FILE_P }, - + { /* bfd_set_format */ - bfd_false, + bfd_false, coff_mkobject, - _bfd_generic_mkarchive, + _bfd_generic_mkarchive, bfd_false }, - + {/* bfd_write_contents */ - bfd_false, + bfd_false, coff_write_object_contents, - _bfd_xcoff_write_archive_contents, + _bfd_xcoff_write_archive_contents, bfd_false }, - + /* Generic */ bfd_true, /* _close_and_cleanup */ bfd_true, /* _bfd_free_cached_info */ coff_new_section_hook, /* _new_section_hook */ _bfd_generic_get_section_contents, /* _bfd_get_section_contents */ /* _bfd_get_section_contents_in_window */ - _bfd_generic_get_section_contents_in_window, + _bfd_generic_get_section_contents_in_window, /* Copy */ _bfd_xcoff_copy_private_bfd_data, /* _bfd_copy_private_bfd */ - /* _bfd_merge_private_bfd_data */ + /* _bfd_merge_private_bfd_data */ ((boolean (*) (bfd *, bfd *)) bfd_true), /* _bfd_copy_pivate_section_data */ ((boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true), @@ -3127,12 +3130,12 @@ const bfd_target rs6000coff_vec = coff_core_file_failing_command, /* _core_file_failing_command */ coff_core_file_failing_signal, /* _core_file_failing_signal */ /* _core_file_matches_executable_p */ - coff_core_file_matches_executable_p, + coff_core_file_matches_executable_p, /* Archive */ _bfd_xcoff_slurp_armap, /* _slurp_armap */ - /* XCOFF archives do not have - anything which corresponds to + /* XCOFF archives do not have + anything which corresponds to an extended name table. */ bfd_false, /* _slurp_extended_name_table */ /* _construct_extended_name_table */ @@ -3143,7 +3146,7 @@ const bfd_target rs6000coff_vec = _bfd_xcoff_openr_next_archived_file, /* _openr_next_archived_file */ _bfd_generic_get_elt_at_index, /* _get_elt_at_index */ _bfd_xcoff_generic_stat_arch_elt, /* _generic_dtat_arch_elt */ - /* XCOFF archives do not have + /* XCOFF archives do not have a timestamp. */ bfd_true, /* _update_armap_timestamp */ @@ -3179,37 +3182,37 @@ const bfd_target rs6000coff_vec = _bfd_xcoff_bfd_final_link, /* _bfd_filnal_link */ _bfd_generic_link_split_section, /* _bfd_link_split_section */ bfd_generic_gc_sections, /* _bfd_gc_sections */ - bfd_generic_merge_sections, /* _bfd_merge_sections */ + bfd_generic_merge_sections, /* _bfd_merge_sections */ /* Dynamic */ /* _get_dynamic_symtab_upper_bound */ - _bfd_xcoff_get_dynamic_symtab_upper_bound, + _bfd_xcoff_get_dynamic_symtab_upper_bound, _bfd_xcoff_canonicalize_dynamic_symtab, /* _cononicalize_dynamic_symtab */ _bfd_xcoff_get_dynamic_reloc_upper_bound,/* _get_dynamic_reloc_upper_bound */ _bfd_xcoff_canonicalize_dynamic_reloc, /* _cononicalize_dynamic_reloc */ /* Opposite endian version, none exists */ NULL, - + /* back end data */ (void *) &bfd_xcoff_backend_data, }; -/* +/* * xcoff-powermac target * Old target. - * Only difference between this target and the rs6000 target is the + * Only difference between this target and the rs6000 target is the * the default architecture and machine type used in coffcode.h * * PowerPC Macs use the same magic numbers as RS/6000 * (because that's how they were bootstrapped originally), - * but they are always PowerPC architecture. + * but they are always PowerPC architecture. */ -static const struct xcoff_backend_data_rec bfd_pmac_xcoff_backend_data = +static const struct xcoff_backend_data_rec bfd_pmac_xcoff_backend_data = { { /* COFF backend, defined in libcoff.h */ _bfd_xcoff_swap_aux_in, /* _bfd_coff_swap_aux_in */ - _bfd_xcoff_swap_sym_in, /* _bfd_coff_swap_sym_in */ + _bfd_xcoff_swap_sym_in, /* _bfd_coff_swap_sym_in */ coff_swap_lineno_in, /* _bfd_coff_swap_lineno_in */ _bfd_xcoff_swap_aux_out, /* _bfd_swap_aux_out */ _bfd_xcoff_swap_sym_out, /* _bfd_swap_sym_out */ @@ -3225,7 +3228,7 @@ static const struct xcoff_backend_data_r AUXESZ, /* _bfd_auxesz */ RELSZ, /* _bfd_relsz */ LINESZ, /* _bfd_linesz */ - FILNMLEN, /* _bfd_filnmlen */ + FILNMLEN, /* _bfd_filnmlen */ true, /* _bfd_coff_long_filenames */ false, /* _bfd_coff_long_section_names */ (3), /* _bfd_coff_default_section_alignment_power */ @@ -3240,7 +3243,7 @@ static const struct xcoff_backend_data_r coff_mkobject_hook, /* _bfd_mkobject_hook */ styp_to_sec_flags, /* _bfd_syp_to_sec_flags */ coff_set_alignment_hook, /* _bfd_set_alignment_hook */ - coff_slurp_symbol_table, /* _bfd_coff_slurp_symbol_table */ + coff_slurp_symbol_table, /* _bfd_coff_slurp_symbol_table */ symname_in_debug_hook, /* _coff_symname_in_debug_hook */ coff_pointerize_aux_hook, /* _bfd_coff_pointerize_aux_hook */ coff_print_aux, /* bfd_coff_print_aux */ @@ -3249,10 +3252,10 @@ static const struct xcoff_backend_data_r NULL, /* bfd_coff_sym_is_global */ /* _bfd_coff_compute_section_file_positions */ coff_compute_section_file_positions, - NULL , /* _bfd_coff_start_final_link */ - xcoff_ppc_relocate_section, /* _bfd_coff_relocate_section */ + NULL, /* _bfd_coff_start_final_link */ + xcoff_ppc_relocate_section, /* _bfd_coff_relocate_section */ coff_rtype_to_howto, /* _bfd_coff_rtype_to_howto */ - NULL , /* _bfd_coff_addust_symndx */ + NULL, /* _bfd_coff_addust_symndx */ _bfd_generic_link_add_one_symbol, /* _bfd_coff_add_one_symbol */ coff_link_output_has_begun, /* _bfd_coff_link_output_has_begun */ coff_final_link_postscript /* _bfd_coff_final_link_postscript */ @@ -3298,7 +3301,7 @@ static const struct xcoff_backend_data_r /* glink */ &xcoff_glink_code[0], (36), /* _xcoff_glink_size */ - + }; /* The transfer vector that leads the outside world to all of the above. */ @@ -3327,7 +3330,7 @@ const bfd_target pmac_xcoff_vec = bfd_putb32, /* bfd_putx32 */ bfd_getb16, /* bfd_getx16 */ bfd_getb_signed_16, /* bfd_getx_signed_16 */ - bfd_putb16, /* bfd_putx16 */ + bfd_putb16, /* bfd_putx16 */ /* hdrs */ bfd_getb64, /* bfd_h_getx64 */ @@ -3339,39 +3342,39 @@ const bfd_target pmac_xcoff_vec = bfd_getb16, /* bfd_h_getx16 */ bfd_getb_signed_16, /* bfd_h_getx_signed_16 */ bfd_putb16, /* bfd_h_putx16 */ - + { /* bfd_check_format */ - _bfd_dummy_target, - coff_object_p, - _bfd_xcoff_archive_p, + _bfd_dummy_target, + coff_object_p, + _bfd_xcoff_archive_p, CORE_FILE_P }, - + { /* bfd_set_format */ - bfd_false, + bfd_false, coff_mkobject, - _bfd_generic_mkarchive, + _bfd_generic_mkarchive, bfd_false }, - + {/* bfd_write_contents */ - bfd_false, + bfd_false, coff_write_object_contents, - _bfd_xcoff_write_archive_contents, + _bfd_xcoff_write_archive_contents, bfd_false }, - + /* Generic */ bfd_true, /* _close_and_cleanup */ bfd_true, /* _bfd_free_cached_info */ coff_new_section_hook, /* _new_section_hook */ _bfd_generic_get_section_contents, /* _bfd_get_section_contents */ /* _bfd_get_section_contents_in_window */ - _bfd_generic_get_section_contents_in_window, + _bfd_generic_get_section_contents_in_window, /* Copy */ _bfd_xcoff_copy_private_bfd_data, /* _bfd_copy_private_bfd */ - /* _bfd_merge_private_bfd_data */ + /* _bfd_merge_private_bfd_data */ ((boolean (*) (bfd *, bfd *)) bfd_true), /* _bfd_copy_pivate_section_data */ ((boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true), @@ -3384,12 +3387,12 @@ const bfd_target pmac_xcoff_vec = coff_core_file_failing_command, /* _core_file_failing_command */ coff_core_file_failing_signal, /* _core_file_failing_signal */ /* _core_file_matches_executable_p */ - coff_core_file_matches_executable_p, + coff_core_file_matches_executable_p, /* Archive */ _bfd_xcoff_slurp_armap, /* _slurp_armap */ - /* XCOFF archives do not have - anything which corresponds to + /* XCOFF archives do not have + anything which corresponds to an extended name table. */ bfd_false, /* _slurp_extended_name_table */ /* _construct_extended_name_table */ @@ -3400,7 +3403,7 @@ const bfd_target pmac_xcoff_vec = _bfd_xcoff_openr_next_archived_file, /* _openr_next_archived_file */ _bfd_generic_get_elt_at_index, /* _get_elt_at_index */ _bfd_xcoff_generic_stat_arch_elt, /* _generic_dtat_arch_elt */ - /* XCOFF archives do not have + /* XCOFF archives do not have a timestamp. */ bfd_true, /* _update_armap_timestamp */ @@ -3440,14 +3443,14 @@ const bfd_target pmac_xcoff_vec = /* Dynamic */ /* _get_dynamic_symtab_upper_bound */ - _bfd_xcoff_get_dynamic_symtab_upper_bound, + _bfd_xcoff_get_dynamic_symtab_upper_bound, _bfd_xcoff_canonicalize_dynamic_symtab, /* _cononicalize_dynamic_symtab */ _bfd_xcoff_get_dynamic_reloc_upper_bound,/* _get_dynamic_reloc_upper_bound */ _bfd_xcoff_canonicalize_dynamic_reloc, /* _cononicalize_dynamic_reloc */ /* Opposite endian version, none exists */ NULL, - + /* back end data */ (void *) &bfd_pmac_xcoff_backend_data, }; diff -uprN binutils-2.11.90.0.31/bfd/coff-sh.c binutils-2.11.92.0.5/bfd/coff-sh.c --- binutils-2.11.90.0.31/bfd/coff-sh.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/coff-sh.c Mon Oct 1 15:25:21 2001 @@ -379,8 +379,8 @@ static reloc_howto_type sh_coff_howtos[] #ifndef COFF_WITH_PE /* Swap the r_offset field in and out. */ -#define SWAP_IN_RELOC_OFFSET bfd_h_get_32 -#define SWAP_OUT_RELOC_OFFSET bfd_h_put_32 +#define SWAP_IN_RELOC_OFFSET H_GET_32 +#define SWAP_OUT_RELOC_OFFSET H_PUT_32 /* Swap out extra information in the reloc structure. */ #define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) \ @@ -589,14 +589,14 @@ sh_reloc (abfd, reloc_entry, symbol_in, #endif insn = bfd_get_32 (abfd, hit_data); insn += sym_value + reloc_entry->addend; - bfd_put_32 (abfd, insn, hit_data); + bfd_put_32 (abfd, (bfd_vma) insn, hit_data); break; #ifdef COFF_WITH_PE case R_SH_IMAGEBASE: insn = bfd_get_32 (abfd, hit_data); - insn += (sym_value + reloc_entry->addend - - pe_data (input_section->output_section->owner)->pe_opthdr.ImageBase); - bfd_put_32 (abfd, insn, hit_data); + insn += sym_value + reloc_entry->addend; + insn -= pe_data (input_section->output_section->owner)->pe_opthdr.ImageBase; + bfd_put_32 (abfd, (bfd_vma) insn, hit_data); break; #endif case R_SH_PCDISP: @@ -610,7 +610,7 @@ sh_reloc (abfd, reloc_entry, symbol_in, if (insn & 0x800) sym_value -= 0x1000; insn = (insn & 0xf000) | (sym_value & 0xfff); - bfd_put_16 (abfd, insn, hit_data); + bfd_put_16 (abfd, (bfd_vma) insn, hit_data); if (sym_value < (bfd_vma) -0x1000 || sym_value >= 0x1000) return bfd_reloc_overflow; break; @@ -761,7 +761,7 @@ sh_relax_section (abfd, sec, link_info, if (laddr >= sec->_raw_size) { (*_bfd_error_handler) ("%s: 0x%lx: warning: bad R_SH_USES offset", - bfd_get_filename (abfd), + bfd_archive_filename (abfd), (unsigned long) irel->r_vaddr); continue; } @@ -772,7 +772,7 @@ sh_relax_section (abfd, sec, link_info, { ((*_bfd_error_handler) ("%s: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x", - bfd_get_filename (abfd), (unsigned long) irel->r_vaddr, insn)); + bfd_archive_filename (abfd), (unsigned long) irel->r_vaddr, insn)); continue; } @@ -784,12 +784,12 @@ sh_relax_section (abfd, sec, link_info, on a four byte boundary. */ paddr = insn & 0xff; paddr *= 4; - paddr += (laddr + 4) &~ 3; + paddr += (laddr + 4) &~ (bfd_vma) 3; if (paddr >= sec->_raw_size) { ((*_bfd_error_handler) ("%s: 0x%lx: warning: bad R_SH_USES load offset", - bfd_get_filename (abfd), (unsigned long) irel->r_vaddr)); + bfd_archive_filename (abfd), (unsigned long) irel->r_vaddr)); continue; } @@ -812,7 +812,7 @@ sh_relax_section (abfd, sec, link_info, { ((*_bfd_error_handler) ("%s: 0x%lx: warning: could not find expected reloc", - bfd_get_filename (abfd), (unsigned long) paddr)); + bfd_archive_filename (abfd), (unsigned long) paddr)); continue; } @@ -828,7 +828,7 @@ sh_relax_section (abfd, sec, link_info, { ((*_bfd_error_handler) ("%s: 0x%lx: warning: symbol in unexpected section", - bfd_get_filename (abfd), (unsigned long) paddr)); + bfd_archive_filename (abfd), (unsigned long) paddr)); continue; } @@ -886,8 +886,8 @@ sh_relax_section (abfd, sec, link_info, if (coff_section_data (abfd, sec) == NULL) { - sec->used_by_bfd = - ((PTR) bfd_zalloc (abfd, sizeof (struct coff_section_tdata))); + bfd_size_type amt = sizeof (struct coff_section_tdata); + sec->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); if (sec->used_by_bfd == NULL) goto error_return; } @@ -914,7 +914,7 @@ sh_relax_section (abfd, sec, link_info, it will be handled here like other internal PCDISP relocs. */ bfd_put_16 (abfd, - 0xb000 | ((foff >> 1) & 0xfff), + (bfd_vma) 0xb000 | ((foff >> 1) & 0xfff), contents + irel->r_vaddr - sec->vma); } else @@ -922,7 +922,8 @@ sh_relax_section (abfd, sec, link_info, /* 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, 0xb000, contents + irel->r_vaddr - sec->vma); + bfd_put_16 (abfd, (bfd_vma) 0xb000, + contents + irel->r_vaddr - sec->vma); } /* See if there is another R_SH_USES reloc referring to the same @@ -962,7 +963,7 @@ sh_relax_section (abfd, sec, link_info, { ((*_bfd_error_handler) ("%s: 0x%lx: warning: could not find expected COUNT reloc", - bfd_get_filename (abfd), (unsigned long) paddr)); + bfd_archive_filename (abfd), (unsigned long) paddr)); continue; } @@ -971,7 +972,7 @@ sh_relax_section (abfd, sec, link_info, if (irelcount->r_offset == 0) { ((*_bfd_error_handler) ("%s: 0x%lx: warning: bad count", - bfd_get_filename (abfd), + bfd_archive_filename (abfd), (unsigned long) paddr)); continue; } @@ -1023,8 +1024,8 @@ sh_relax_section (abfd, sec, link_info, { if (coff_section_data (abfd, sec) == NULL) { - sec->used_by_bfd = - ((PTR) bfd_zalloc (abfd, sizeof (struct coff_section_tdata))); + bfd_size_type amt = sizeof (struct coff_section_tdata); + sec->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); if (sec->used_by_bfd == NULL) goto error_return; } @@ -1056,8 +1057,8 @@ sh_relax_section (abfd, sec, link_info, /* Cache the section contents for coff_link_input_bfd. */ if (coff_section_data (abfd, sec) == NULL) { - sec->used_by_bfd = - ((PTR) bfd_zalloc (abfd, sizeof (struct coff_section_tdata))); + bfd_size_type amt = sizeof (struct coff_section_tdata); + sec->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); if (sec->used_by_bfd == NULL) goto error_return; coff_section_data (abfd, sec)->relocs = NULL; @@ -1117,7 +1118,8 @@ sh_relax_delete_bytes (abfd, sec, addr, } /* Actually delete the bytes. */ - memmove (contents + addr, contents + addr + count, toaddr - addr - count); + memmove (contents + addr, contents + addr + count, + (size_t) (toaddr - addr - count)); if (irelalign == NULL) sec->_cooked_size -= count; else @@ -1128,7 +1130,7 @@ sh_relax_delete_bytes (abfd, sec, addr, BFD_ASSERT ((count & 1) == 0); for (i = 0; i < count; i += 2) - bfd_put_16 (abfd, NOP_OPCODE, contents + toaddr - count + i); + bfd_put_16 (abfd, (bfd_vma) NOP_OPCODE, contents + toaddr - count + i); } /* Adjust all the relocs. */ @@ -1314,14 +1316,14 @@ sh_relax_delete_bytes (abfd, sec, addr, insn += adjust / 2; if ((oinsn & 0xff00) != (insn & 0xff00)) overflow = true; - bfd_put_16 (abfd, insn, contents + nraddr); + bfd_put_16 (abfd, (bfd_vma) insn, contents + nraddr); break; case R_SH_PCDISP: insn += adjust / 2; if ((oinsn & 0xf000) != (insn & 0xf000)) overflow = true; - bfd_put_16 (abfd, insn, contents + nraddr); + bfd_put_16 (abfd, (bfd_vma) insn, contents + nraddr); break; case R_SH_PCRELIMM8BY4: @@ -1335,26 +1337,26 @@ sh_relax_delete_bytes (abfd, sec, addr, } if ((oinsn & 0xff00) != (insn & 0xff00)) overflow = true; - bfd_put_16 (abfd, insn, contents + nraddr); + bfd_put_16 (abfd, (bfd_vma) insn, contents + nraddr); break; case R_SH_SWITCH8: voff += adjust; if (voff < 0 || voff >= 0xff) overflow = true; - bfd_put_8 (abfd, voff, contents + nraddr); + bfd_put_8 (abfd, (bfd_vma) voff, contents + nraddr); break; case R_SH_SWITCH16: voff += adjust; if (voff < - 0x8000 || voff >= 0x8000) overflow = true; - bfd_put_signed_16 (abfd, voff, contents + nraddr); + bfd_put_signed_16 (abfd, (bfd_vma) voff, contents + nraddr); break; case R_SH_SWITCH32: voff += adjust; - bfd_put_signed_32 (abfd, voff, contents + nraddr); + bfd_put_signed_32 (abfd, (bfd_vma) voff, contents + nraddr); break; case R_SH_USES: @@ -1366,7 +1368,7 @@ sh_relax_delete_bytes (abfd, sec, addr, { ((*_bfd_error_handler) ("%s: 0x%lx: fatal: reloc overflow while relaxing", - bfd_get_filename (abfd), (unsigned long) irel->r_vaddr)); + bfd_archive_filename (abfd), (unsigned long) irel->r_vaddr)); bfd_set_error (bfd_error_bad_value); return false; } @@ -1466,7 +1468,7 @@ sh_relax_delete_bytes (abfd, sec, addr, { ((*_bfd_error_handler) ("%s: fatal: generic symbols retrieved before relaxing", - bfd_get_filename (abfd))); + bfd_archive_filename (abfd))); bfd_set_error (bfd_error_invalid_operation); return false; } @@ -1517,7 +1519,7 @@ sh_relax_delete_bytes (abfd, sec, addr, { /* Tail recursion. */ return sh_relax_delete_bytes (abfd, sec, alignaddr, - alignto - alignaddr); + (int) (alignto - alignaddr)); } } @@ -2643,13 +2645,15 @@ sh_align_loads (abfd, sec, internal_relo struct internal_reloc *irel, *irelend; bfd_vma *labels = NULL; bfd_vma *label, *label_end; + bfd_size_type amt; *pswapped = false; irelend = internal_relocs + sec->reloc_count; /* Get all the addresses with labels on them. */ - labels = (bfd_vma *) bfd_malloc (sec->reloc_count * sizeof (bfd_vma)); + amt = (bfd_size_type) sec->reloc_count * sizeof (bfd_vma); + labels = (bfd_vma *) bfd_malloc (amt); if (labels == NULL) goto error_return; label_end = labels; @@ -2718,8 +2722,8 @@ sh_swap_insns (abfd, sec, relocs, conten /* Swap the instructions themselves. */ i1 = bfd_get_16 (abfd, contents + addr); i2 = bfd_get_16 (abfd, contents + addr + 2); - bfd_put_16 (abfd, i2, contents + addr); - bfd_put_16 (abfd, i1, contents + addr + 2); + bfd_put_16 (abfd, (bfd_vma) i2, contents + addr); + bfd_put_16 (abfd, (bfd_vma) i1, contents + addr + 2); /* Adjust all reloc addresses. */ irelend = internal_relocs + sec->reloc_count; @@ -2787,7 +2791,7 @@ sh_swap_insns (abfd, sec, relocs, conten insn += add / 2; if ((oinsn & 0xff00) != (insn & 0xff00)) overflow = true; - bfd_put_16 (abfd, insn, loc); + bfd_put_16 (abfd, (bfd_vma) insn, loc); break; case R_SH_PCDISP: @@ -2796,7 +2800,7 @@ sh_swap_insns (abfd, sec, relocs, conten insn += add / 2; if ((oinsn & 0xf000) != (insn & 0xf000)) overflow = true; - bfd_put_16 (abfd, insn, loc); + bfd_put_16 (abfd, (bfd_vma) insn, loc); break; case R_SH_PCRELIMM8BY4: @@ -2813,7 +2817,7 @@ sh_swap_insns (abfd, sec, relocs, conten insn += add / 2; if ((oinsn & 0xff00) != (insn & 0xff00)) overflow = true; - bfd_put_16 (abfd, insn, loc); + bfd_put_16 (abfd, (bfd_vma) insn, loc); } break; @@ -2823,7 +2827,7 @@ sh_swap_insns (abfd, sec, relocs, conten { ((*_bfd_error_handler) ("%s: 0x%lx: fatal: reloc overflow while relaxing", - bfd_get_filename (abfd), (unsigned long) irel->r_vaddr)); + bfd_archive_filename (abfd), (unsigned long) irel->r_vaddr)); bfd_set_error (bfd_error_bad_value); return false; } @@ -2887,7 +2891,7 @@ sh_relocate_section (output_bfd, info, i { (*_bfd_error_handler) ("%s: illegal symbol index %ld in relocs", - bfd_get_filename (input_bfd), symndx); + bfd_archive_filename (input_bfd), symndx); bfd_set_error (bfd_error_bad_value); return false; } @@ -3035,7 +3039,7 @@ sh_coff_get_relocated_section_contents ( symbols); memcpy (data, coff_section_data (input_bfd, input_section)->contents, - input_section->_raw_size); + (size_t) input_section->_raw_size); if ((input_section->flags & SEC_RELOC) != 0 && input_section->reloc_count > 0) @@ -3044,6 +3048,7 @@ sh_coff_get_relocated_section_contents ( bfd_byte *esym, *esymend; struct internal_syment *isymp; asection **secpp; + bfd_size_type amt; if (! _bfd_coff_get_external_symbols (input_bfd)) goto error_return; @@ -3054,14 +3059,15 @@ sh_coff_get_relocated_section_contents ( if (internal_relocs == NULL) goto error_return; - internal_syms = ((struct internal_syment *) - bfd_malloc (obj_raw_syment_count (input_bfd) - * sizeof (struct internal_syment))); + amt = obj_raw_syment_count (input_bfd); + amt *= sizeof (struct internal_syment); + internal_syms = (struct internal_syment *) bfd_malloc (amt); if (internal_syms == NULL) goto error_return; - sections = (asection **) bfd_malloc (obj_raw_syment_count (input_bfd) - * sizeof (asection *)); + amt = obj_raw_syment_count (input_bfd); + amt *= sizeof (asection *); + sections = (asection **) bfd_malloc (amt); if (sections == NULL) goto error_return; diff -uprN binutils-2.11.90.0.31/bfd/coff-sparc.c binutils-2.11.92.0.5/bfd/coff-sparc.c --- binutils-2.11.90.0.31/bfd/coff-sparc.c Wed Aug 22 08:52:09 2001 +++ binutils-2.11.92.0.5/bfd/coff-sparc.c Mon Oct 1 15:25:21 2001 @@ -37,7 +37,7 @@ Foundation, Inc., 59 Temple Place - Suit static reloc_howto_type *coff_sparc_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type)); static void rtype2howto PARAMS ((arelent *, struct internal_reloc *)); - + enum reloc_type { R_SPARC_NONE = 0, @@ -57,7 +57,7 @@ enum reloc_type }; #if 0 -static CONST char *CONST reloc_type_names[] = +static const char *const reloc_type_names[] = { "R_SPARC_NONE", "R_SPARC_8", "R_SPARC_16", "R_SPARC_32", @@ -134,7 +134,7 @@ struct coff_reloc_map { unsigned char coff_reloc_val; }; -static CONST struct coff_reloc_map sparc_reloc_map[] = +static const struct coff_reloc_map sparc_reloc_map[] = { { BFD_RELOC_NONE, R_SPARC_NONE, }, { BFD_RELOC_16, R_SPARC_16, }, @@ -188,8 +188,8 @@ rtype2howto (cache_ptr, dst) #define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry) -#define SWAP_IN_RELOC_OFFSET bfd_h_get_32 -#define SWAP_OUT_RELOC_OFFSET bfd_h_put_32 +#define SWAP_IN_RELOC_OFFSET H_GET_32 +#define SWAP_OUT_RELOC_OFFSET H_PUT_32 #define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \ cache_ptr->addend = reloc.r_offset; diff -uprN binutils-2.11.90.0.31/bfd/coff-stgo32.c binutils-2.11.92.0.5/bfd/coff-stgo32.c --- binutils-2.11.90.0.31/bfd/coff-stgo32.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/coff-stgo32.c Mon Oct 1 15:25:21 2001 @@ -114,7 +114,7 @@ static boolean /* This macro is used, because I cannot assume the endianess of the host system */ -#define _H(index) (bfd_h_get_16(abfd, (bfd_byte *) (header+index*2))) +#define _H(index) (H_GET_16 (abfd, (header+index*2))) /* These bytes are a 2048-byte DOS executable, which loads the COFF image into memory and then runs it. It is called 'stub' */ @@ -149,7 +149,7 @@ adjust_filehdr_in_post (abfd, src, dst) ADJUST_VAL (filehdr_dst->f_symptr, STUBSIZE); /* Save now the stub to be used later */ - bfd_coff_go32stub (abfd) = (PTR) bfd_alloc (abfd, STUBSIZE); + bfd_coff_go32stub (abfd) = (PTR) bfd_alloc (abfd, (bfd_size_type) STUBSIZE); /* Since this function returns no status, I do not set here any bfd_error_... @@ -312,7 +312,8 @@ create_go32_stub (abfd) int f; unsigned char header[10]; char magic[8]; - unsigned long coff_start, exe_start; + unsigned long coff_start; + long exe_start; /* Check at first the environment variable $(GO32STUB) */ stub = getenv ("GO32STUB"); @@ -354,7 +355,7 @@ create_go32_stub (abfd) goto stub_end; } exe_start = _H (4) * 16; - if ((unsigned long) lseek (f, exe_start, SEEK_SET) != exe_start) + if ((long) lseek (f, exe_start, SEEK_SET) != exe_start) { close (f); goto stub_end; @@ -370,7 +371,8 @@ create_go32_stub (abfd) goto stub_end; } /* Now we found a correct stub (hopefully) */ - bfd_coff_go32stub (abfd) = (PTR) bfd_alloc (abfd, coff_start); + bfd_coff_go32stub (abfd) + = (PTR) bfd_alloc (abfd, (bfd_size_type) coff_start); if (bfd_coff_go32stub (abfd) == NULL) { close (f); @@ -390,7 +392,8 @@ stub_end: stub */ if (bfd_coff_go32stub (abfd) == NULL) { - bfd_coff_go32stub (abfd) = (PTR) bfd_alloc (abfd, STUBSIZE); + bfd_coff_go32stub (abfd) + = (PTR) bfd_alloc (abfd, (bfd_size_type) STUBSIZE); if (bfd_coff_go32stub (abfd) == NULL) { return; diff -uprN binutils-2.11.90.0.31/bfd/coff-tic30.c binutils-2.11.92.0.5/bfd/coff-tic30.c --- binutils-2.11.90.0.31/bfd/coff-tic30.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/coff-tic30.c Mon Oct 1 15:25:21 2001 @@ -98,8 +98,8 @@ coff_tic30_select_reloc (howto) #define __A_MAGIC_SET__ /* Code to swap in the reloc */ -#define SWAP_IN_RELOC_OFFSET bfd_h_get_32 -#define SWAP_OUT_RELOC_OFFSET bfd_h_put_32 +#define SWAP_IN_RELOC_OFFSET H_GET_32 +#define SWAP_OUT_RELOC_OFFSET H_PUT_32 #define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) dst->r_stuff[0] = 'S'; \ dst->r_stuff[1] = 'C'; diff -uprN binutils-2.11.90.0.31/bfd/coff-tic54x.c binutils-2.11.92.0.5/bfd/coff-tic54x.c --- binutils-2.11.90.0.31/bfd/coff-tic54x.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/coff-tic54x.c Mon Oct 1 15:25:21 2001 @@ -388,7 +388,7 @@ tic54x_reloc_processing (relent, reloc, { (*_bfd_error_handler) (_("%s: warning: illegal symbol index %ld in relocs"), - bfd_get_filename (abfd), reloc->r_symndx); + bfd_archive_filename (abfd), reloc->r_symndx); relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; ptr = NULL; } @@ -423,7 +423,7 @@ tic54x_reloc_processing (relent, reloc, } /* COFF0 differs in file/section header size and relocation entry size. */ -static CONST bfd_coff_backend_data ticoff0_swap_table = +static const bfd_coff_backend_data ticoff0_swap_table = { coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in, coff_SWAP_aux_out, coff_SWAP_sym_out, @@ -464,7 +464,7 @@ static CONST bfd_coff_backend_data ticof }; /* COFF1 differs in section header size. */ -static CONST bfd_coff_backend_data ticoff1_swap_table = +static const bfd_coff_backend_data ticoff1_swap_table = { coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in, coff_SWAP_aux_out, coff_SWAP_sym_out, diff -uprN binutils-2.11.90.0.31/bfd/coff-tic80.c binutils-2.11.92.0.5/bfd/coff-tic80.c --- binutils-2.11.90.0.31/bfd/coff-tic80.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/coff-tic80.c Mon Oct 1 15:25:21 2001 @@ -35,8 +35,8 @@ Boston, MA 02111-1307, USA. */ #define COFF_ALIGN_IN_SECTION_HEADER 1 #define COFF_ALIGN_IN_SFLAGS 1 -#define GET_SCNHDR_FLAGS bfd_h_get_16 -#define PUT_SCNHDR_FLAGS bfd_h_put_16 +#define GET_SCNHDR_FLAGS H_GET_16 +#define PUT_SCNHDR_FLAGS H_PUT_16 static void rtype2howto PARAMS ((arelent *cache_ptr, struct internal_reloc *dst)); @@ -684,7 +684,7 @@ coff_tic80_relocate_section (output_bfd, case bfd_reloc_outofrange: (*_bfd_error_handler) (_("%s: bad reloc address 0x%lx in section `%s'"), - bfd_get_filename (input_bfd), + bfd_archive_filename (input_bfd), (unsigned long) rel->r_vaddr, bfd_get_section_name (input_bfd, input_section)); return false; diff -uprN binutils-2.11.90.0.31/bfd/coff-w65.c binutils-2.11.92.0.5/bfd/coff-w65.c --- binutils-2.11.90.0.31/bfd/coff-w65.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/coff-w65.c Mon Oct 1 15:25:21 2001 @@ -57,8 +57,8 @@ static reloc_howto_type howto_table[] = #define __A_MAGIC_SET__ /* Code to swap in the reloc */ -#define SWAP_IN_RELOC_OFFSET bfd_h_get_32 -#define SWAP_OUT_RELOC_OFFSET bfd_h_put_32 +#define SWAP_IN_RELOC_OFFSET H_GET_32 +#define SWAP_OUT_RELOC_OFFSET H_PUT_32 #define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) \ dst->r_stuff[0] = 'S'; \ dst->r_stuff[1] = 'C'; @@ -274,7 +274,7 @@ w65_reloc16_extra_cases (abfd, link_info unsigned int gap = bfd_coff_reloc16_get_value (reloc, link_info, input_section); - bfd_put_16 (abfd, gap, data + dst_address); + bfd_put_16 (abfd, (bfd_vma) gap, data + dst_address); dst_address += 2; src_address += 2; } @@ -284,7 +284,7 @@ w65_reloc16_extra_cases (abfd, link_info unsigned int gap = bfd_coff_reloc16_get_value (reloc, link_info, input_section); gap >>= 8; - bfd_put_16 (abfd, gap, data + dst_address); + bfd_put_16 (abfd, (bfd_vma) gap, data + dst_address); dst_address += 2; src_address += 2; } @@ -294,7 +294,7 @@ w65_reloc16_extra_cases (abfd, link_info unsigned int gap = bfd_coff_reloc16_get_value (reloc, link_info, input_section); gap >>= 16; - bfd_put_16 (abfd, gap, data + dst_address); + bfd_put_16 (abfd, (bfd_vma) gap, data + dst_address); dst_address += 2; src_address += 2; } @@ -304,7 +304,7 @@ w65_reloc16_extra_cases (abfd, link_info { unsigned int gap = bfd_coff_reloc16_get_value (reloc, link_info, input_section); - bfd_put_16 (abfd, gap, data + dst_address); + bfd_put_16 (abfd, (bfd_vma) gap, data + dst_address); bfd_put_8 (abfd, gap >> 16, data+dst_address + 2); dst_address += 3; src_address += 3; diff -uprN binutils-2.11.90.0.31/bfd/coff-z8k.c binutils-2.11.92.0.5/bfd/coff-z8k.c --- binutils-2.11.90.0.31/bfd/coff-z8k.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/coff-z8k.c Mon Oct 1 15:25:21 2001 @@ -87,8 +87,8 @@ coff_z8k_select_reloc (howto) #define __A_MAGIC_SET__ /* Code to swap in the reloc. */ -#define SWAP_IN_RELOC_OFFSET bfd_h_get_32 -#define SWAP_OUT_RELOC_OFFSET bfd_h_put_32 +#define SWAP_IN_RELOC_OFFSET H_GET_32 +#define SWAP_OUT_RELOC_OFFSET H_PUT_32 #define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) \ dst->r_stuff[0] = 'S'; \ dst->r_stuff[1] = 'C'; @@ -314,7 +314,7 @@ extra_case (in_abfd, link_info, link_ord input_section, reloc->address))) abort (); } - bfd_put_16 (in_abfd,gap,data + *dst_ptr); + bfd_put_16 (in_abfd, (bfd_vma) gap, data + *dst_ptr); (*dst_ptr) += 2; (*src_ptr) += 2; break; diff -uprN binutils-2.11.90.0.31/bfd/coff64-rs6000.c binutils-2.11.92.0.5/bfd/coff64-rs6000.c --- binutils-2.11.90.0.31/bfd/coff64-rs6000.c Fri Aug 10 14:08:01 2001 +++ binutils-2.11.92.0.5/bfd/coff64-rs6000.c Mon Oct 1 15:25:21 2001 @@ -27,179 +27,272 @@ Foundation, Inc., 59 Temple Place - Suit #include "coff/internal.h" #include "coff/xcoff.h" #include "coff/rs6k64.h" -#include "libcoff.h" +#include "libcoff.h" #include "libxcoff.h" -#define GET_FILEHDR_SYMPTR bfd_h_get_64 -#define PUT_FILEHDR_SYMPTR bfd_h_put_64 -#define GET_AOUTHDR_DATA_START bfd_h_get_64 -#define PUT_AOUTHDR_DATA_START bfd_h_put_64 -#define GET_AOUTHDR_TEXT_START bfd_h_get_64 -#define PUT_AOUTHDR_TEXT_START bfd_h_put_64 -#define GET_AOUTHDR_TSIZE bfd_h_get_64 -#define PUT_AOUTHDR_TSIZE bfd_h_put_64 -#define GET_AOUTHDR_DSIZE bfd_h_get_64 -#define PUT_AOUTHDR_DSIZE bfd_h_put_64 -#define GET_AOUTHDR_BSIZE bfd_h_get_64 -#define PUT_AOUTHDR_BSIZE bfd_h_put_64 -#define GET_AOUTHDR_ENTRY bfd_h_get_64 -#define PUT_AOUTHDR_ENTRY bfd_h_put_64 -#define GET_SCNHDR_PADDR bfd_h_get_64 -#define PUT_SCNHDR_PADDR bfd_h_put_64 -#define GET_SCNHDR_VADDR bfd_h_get_64 -#define PUT_SCNHDR_VADDR bfd_h_put_64 -#define GET_SCNHDR_SIZE bfd_h_get_64 -#define PUT_SCNHDR_SIZE bfd_h_put_64 -#define GET_SCNHDR_SCNPTR bfd_h_get_64 -#define PUT_SCNHDR_SCNPTR bfd_h_put_64 -#define GET_SCNHDR_RELPTR bfd_h_get_64 -#define PUT_SCNHDR_RELPTR bfd_h_put_64 -#define GET_SCNHDR_LNNOPTR bfd_h_get_64 -#define PUT_SCNHDR_LNNOPTR bfd_h_put_64 -#define GET_SCNHDR_NRELOC bfd_h_get_32 +#define GET_FILEHDR_SYMPTR H_GET_64 +#define PUT_FILEHDR_SYMPTR H_PUT_64 +#define GET_AOUTHDR_DATA_START H_GET_64 +#define PUT_AOUTHDR_DATA_START H_PUT_64 +#define GET_AOUTHDR_TEXT_START H_GET_64 +#define PUT_AOUTHDR_TEXT_START H_PUT_64 +#define GET_AOUTHDR_TSIZE H_GET_64 +#define PUT_AOUTHDR_TSIZE H_PUT_64 +#define GET_AOUTHDR_DSIZE H_GET_64 +#define PUT_AOUTHDR_DSIZE H_PUT_64 +#define GET_AOUTHDR_BSIZE H_GET_64 +#define PUT_AOUTHDR_BSIZE H_PUT_64 +#define GET_AOUTHDR_ENTRY H_GET_64 +#define PUT_AOUTHDR_ENTRY H_PUT_64 +#define GET_SCNHDR_PADDR H_GET_64 +#define PUT_SCNHDR_PADDR H_PUT_64 +#define GET_SCNHDR_VADDR H_GET_64 +#define PUT_SCNHDR_VADDR H_PUT_64 +#define GET_SCNHDR_SIZE H_GET_64 +#define PUT_SCNHDR_SIZE H_PUT_64 +#define GET_SCNHDR_SCNPTR H_GET_64 +#define PUT_SCNHDR_SCNPTR H_PUT_64 +#define GET_SCNHDR_RELPTR H_GET_64 +#define PUT_SCNHDR_RELPTR H_PUT_64 +#define GET_SCNHDR_LNNOPTR H_GET_64 +#define PUT_SCNHDR_LNNOPTR H_PUT_64 +#define GET_SCNHDR_NRELOC H_GET_32 #define MAX_SCNHDR_NRELOC 0xffffffff -#define PUT_SCNHDR_NRELOC bfd_h_put_32 -#define GET_SCNHDR_NLNNO bfd_h_get_32 +#define PUT_SCNHDR_NRELOC H_PUT_32 +#define GET_SCNHDR_NLNNO H_GET_32 #define MAX_SCNHDR_NLNNO 0xffffffff -#define PUT_SCNHDR_NLNNO bfd_h_put_32 -#define GET_RELOC_VADDR bfd_h_get_64 -#define PUT_RELOC_VADDR bfd_h_put_64 +#define PUT_SCNHDR_NLNNO H_PUT_32 +#define GET_RELOC_VADDR H_GET_64 +#define PUT_RELOC_VADDR H_PUT_64 #define COFF_FORCE_SYMBOLS_IN_STRINGS #define COFF_DEBUG_STRING_WIDE_PREFIX -#define COFF_ADJUST_SCNHDR_OUT_POST(ABFD,INT,EXT) \ -do { \ - memset (((SCNHDR *)EXT)->s_pad, 0, sizeof (((SCNHDR *)EXT)->s_pad));\ -} while(0) - -/* In case we're on a 32-bit machine, construct a 64-bit "-1" value - from smaller values. Start with zero, widen, *then* decrement. */ -#define MINUS_ONE (((bfd_vma)0) - 1) - +#define COFF_ADJUST_SCNHDR_OUT_POST(ABFD, INT, EXT) \ + do \ + { \ + memset (((SCNHDR *) EXT)->s_pad, 0, \ + sizeof (((SCNHDR *) EXT)->s_pad)); \ + } \ + while (0) #define NO_COFF_LINENOS #define coff_SWAP_lineno_in _bfd_xcoff64_swap_lineno_in #define coff_SWAP_lineno_out _bfd_xcoff64_swap_lineno_out -#define PUTWORD bfd_h_put_32 -#define PUTHALF bfd_h_put_16 -#define PUTBYTE bfd_h_put_8 -#define GETWORD bfd_h_get_32 -#define GETHALF bfd_h_get_16 -#define GETBYTE bfd_h_get_8 - - static void _bfd_xcoff64_swap_lineno_in PARAMS ((bfd *, PTR, PTR)); static unsigned int _bfd_xcoff64_swap_lineno_out PARAMS ((bfd *, PTR, PTR)); static boolean _bfd_xcoff64_put_ldsymbol_name PARAMS ((bfd *, struct xcoff_loader_info *, struct internal_ldsym *, const char *)); +static void _bfd_xcoff64_swap_sym_in PARAMS ((bfd *, PTR, PTR)); +static unsigned int _bfd_xcoff64_swap_sym_out PARAMS ((bfd *, PTR, PTR)); +static void _bfd_xcoff64_swap_aux_in + PARAMS ((bfd *, PTR, int, int, int, int, PTR)); +static unsigned int _bfd_xcoff64_swap_aux_out + PARAMS ((bfd *, PTR, int, int, int, int, PTR)); +extern boolean _bfd_xcoff_mkobject PARAMS ((bfd *)); +extern boolean _bfd_xcoff_copy_private_bfd_data PARAMS ((bfd *, bfd *)); +extern boolean _bfd_xcoff_is_local_label_name PARAMS ((bfd *, const char *)); +extern void xcoff64_rtype2howto + PARAMS ((arelent *, struct internal_reloc *)); +extern reloc_howto_type * xcoff64_reloc_type_lookup + PARAMS ((bfd *, bfd_reloc_code_real_type)); +extern boolean _bfd_xcoff_slurp_armap PARAMS ((bfd *)); +extern PTR _bfd_xcoff_read_ar_hdr PARAMS ((bfd *)); +extern bfd *_bfd_xcoff_openr_next_archived_file PARAMS ((bfd *, bfd *)); +extern int _bfd_xcoff_generic_stat_arch_elt PARAMS ((bfd *, struct stat *)); +extern boolean _bfd_xcoff_write_armap + PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int)); +extern boolean _bfd_xcoff_write_archive_contents PARAMS ((bfd *)); +extern int _bfd_xcoff_sizeof_headers PARAMS ((bfd *, boolean)); +extern void _bfd_xcoff_swap_sym_in PARAMS ((bfd *, PTR, PTR)); +extern unsigned int _bfd_xcoff_swap_sym_out PARAMS ((bfd *, PTR, PTR)); +extern void _bfd_xcoff_swap_aux_in + PARAMS ((bfd *, PTR, int, int, int, int, PTR)); +extern unsigned int _bfd_xcoff_swap_aux_out + PARAMS ((bfd *, PTR, int, int, int, int, PTR)); +static void xcoff64_swap_ldhdr_in + PARAMS ((bfd *, const PTR, struct internal_ldhdr *)); +static void xcoff64_swap_ldhdr_out + PARAMS ((bfd *, const struct internal_ldhdr *, PTR d)); +static void xcoff64_swap_ldsym_in + PARAMS ((bfd *, const PTR, struct internal_ldsym *)); +static void xcoff64_swap_ldsym_out + PARAMS ((bfd *, const struct internal_ldsym *, PTR d)); +static void xcoff64_swap_ldrel_in + PARAMS ((bfd *, const PTR, struct internal_ldrel *)); +static void xcoff64_swap_ldrel_out + PARAMS ((bfd *, const struct internal_ldrel *, PTR d)); +static boolean xcoff64_write_object_contents PARAMS ((bfd *)); +static boolean xcoff64_ppc_relocate_section + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + struct internal_reloc *, struct internal_syment *, + asection **sections)); +static boolean xcoff64_slurp_armap PARAMS ((bfd *)); +static const bfd_target *xcoff64_archive_p PARAMS ((bfd *)); +static bfd *xcoff64_openr_next_archived_file PARAMS ((bfd *, bfd *)); +static int xcoff64_sizeof_headers PARAMS ((bfd *, boolean)); +static asection *xcoff64_create_csect_from_smclas + PARAMS ((bfd *, union internal_auxent *, const char *)); +static boolean xcoff64_is_lineno_count_overflow PARAMS ((bfd *, bfd_vma)); +static boolean xcoff64_is_reloc_count_overflow PARAMS ((bfd *, bfd_vma)); +static bfd_vma xcoff64_loader_symbol_offset + PARAMS ((bfd *, struct internal_ldhdr *)); +static bfd_vma xcoff64_loader_reloc_offset + PARAMS ((bfd *, struct internal_ldhdr *)); + +/* coffcode.h needs these to be defined */ +/* Internalcoff.h and coffcode.h modify themselves based on these flags. */ +#define XCOFF64 +#define RS6000COFF_C 1 + +#define SELECT_RELOC(internal, howto) \ + { \ + internal.r_type = howto->type; \ + internal.r_size = \ + ((howto->complain_on_overflow == complain_overflow_signed \ + ? 0x80 \ + : 0) \ + | (howto->bitsize - 1)); \ + } -/* For XCOFF64, the effective width of symndx changes depending on +#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3) +#define COFF_LONG_FILENAMES +#define NO_COFF_SYMBOLS +#define RTYPE2HOWTO(cache_ptr, dst) xcoff64_rtype2howto (cache_ptr, dst) +#define coff_mkobject _bfd_xcoff_mkobject +#define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data +#define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name +#define coff_bfd_reloc_type_lookup xcoff64_reloc_type_lookup +#ifdef AIX_CORE +extern const bfd_target * rs6000coff_core_p (); +extern boolean rs6000coff_core_file_matches_executable_p (); +extern char *rs6000coff_core_file_failing_command PARAMS ((bfd *abfd)); +extern int rs6000coff_core_file_failing_signal PARAMS ((bfd *abfd)); +#define CORE_FILE_P rs6000coff_core_p +#define coff_core_file_failing_command \ + rs6000coff_core_file_failing_command +#define coff_core_file_failing_signal \ + rs6000coff_core_file_failing_signal +#define coff_core_file_matches_executable_p \ + rs6000coff_core_file_matches_executable_p +#else +#define CORE_FILE_P _bfd_dummy_target +#define coff_core_file_failing_command \ + _bfd_nocore_core_file_failing_command +#define coff_core_file_failing_signal \ + _bfd_nocore_core_file_failing_signal +#define coff_core_file_matches_executable_p \ + _bfd_nocore_core_file_matches_executable_p +#endif +#define coff_SWAP_sym_in _bfd_xcoff64_swap_sym_in +#define coff_SWAP_sym_out _bfd_xcoff64_swap_sym_out +#define coff_SWAP_aux_in _bfd_xcoff64_swap_aux_in +#define coff_SWAP_aux_out _bfd_xcoff64_swap_aux_out + + +#include "coffcode.h" + +/* For XCOFF64, the effective width of symndx changes depending on whether we are the first entry. Sigh. */ static void _bfd_xcoff64_swap_lineno_in (abfd, ext1, in1) - bfd *abfd; + bfd *abfd; PTR ext1; PTR in1; { - LINENO *ext = (LINENO *)ext1; - struct internal_lineno *in = (struct internal_lineno *)in1; + LINENO *ext = (LINENO *) ext1; + struct internal_lineno *in = (struct internal_lineno *) in1; - in->l_lnno = bfd_h_get_32(abfd, (bfd_byte *) (ext->l_lnno)); + in->l_lnno = H_GET_32 (abfd, (ext->l_lnno)); if (in->l_lnno == 0) - in->l_addr.l_symndx = - bfd_h_get_32(abfd, (bfd_byte *) ext->l_addr.l_symndx); + in->l_addr.l_symndx = H_GET_32 (abfd, ext->l_addr.l_symndx); else - in->l_addr.l_paddr = - bfd_h_get_64(abfd, (bfd_byte *) ext->l_addr.l_paddr); + in->l_addr.l_paddr = H_GET_64 (abfd, ext->l_addr.l_paddr); } static unsigned int _bfd_xcoff64_swap_lineno_out (abfd, inp, outp) - bfd *abfd; - PTR inp; - PTR outp; -{ - struct internal_lineno *in = (struct internal_lineno *)inp; - struct external_lineno *ext = (struct external_lineno *)outp; - PUTWORD(abfd, in->l_addr.l_symndx, (bfd_byte *) - ext->l_addr.l_symndx); + bfd *abfd; + PTR inp; + PTR outp; +{ + struct internal_lineno *in = (struct internal_lineno *) inp; + struct external_lineno *ext = (struct external_lineno *) outp; + + H_PUT_32 (abfd, in->l_addr.l_symndx, ext->l_addr.l_symndx); + H_PUT_32 (abfd, in->l_lnno, (ext->l_lnno)); - bfd_h_put_32 (abfd, in->l_lnno, (bfd_byte *) (ext->l_lnno)); if (in->l_lnno == 0) - bfd_h_put_32 (abfd, in->l_addr.l_symndx, (bfd_byte *)ext->l_addr.l_symndx); + H_PUT_32 (abfd, in->l_addr.l_symndx, ext->l_addr.l_symndx); else - bfd_h_put_64 (abfd, in->l_addr.l_paddr, (bfd_byte *)ext->l_addr.l_paddr); + H_PUT_64 (abfd, in->l_addr.l_paddr, ext->l_addr.l_paddr); return bfd_coff_linesz (abfd); } - -static void _bfd_xcoff64_swap_sym_in PARAMS ((bfd *, PTR, PTR)); -static unsigned int _bfd_xcoff64_swap_sym_out PARAMS ((bfd *, PTR, PTR)); -static void _bfd_xcoff64_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR)); -static unsigned int _bfd_xcoff64_swap_aux_out PARAMS ((bfd *, PTR, int, int, int, int, PTR)); - static void _bfd_xcoff64_swap_sym_in (abfd, ext1, in1) - bfd *abfd; + bfd *abfd; PTR ext1; PTR in1; { - struct external_syment *ext = (struct external_syment *)ext1; - struct internal_syment *in = (struct internal_syment *)in1; + struct external_syment *ext = (struct external_syment *) ext1; + struct internal_syment *in = (struct internal_syment *) in1; in->_n._n_n._n_zeroes = 0; - in->_n._n_n._n_offset = bfd_h_get_32(abfd, (bfd_byte *) ext->e_offset); - in->n_value = bfd_h_get_64(abfd, (bfd_byte *) ext->e_value); - in->n_scnum = bfd_h_get_16(abfd, (bfd_byte *) ext->e_scnum); - in->n_type = bfd_h_get_16(abfd, (bfd_byte *) ext->e_type); - in->n_sclass = bfd_h_get_8(abfd, ext->e_sclass); - in->n_numaux = bfd_h_get_8(abfd, ext->e_numaux); + in->_n._n_n._n_offset = H_GET_32 (abfd, ext->e_offset); + in->n_value = H_GET_64 (abfd, ext->e_value); + in->n_scnum = H_GET_16 (abfd, ext->e_scnum); + in->n_type = H_GET_16 (abfd, ext->e_type); + in->n_sclass = H_GET_8 (abfd, ext->e_sclass); + in->n_numaux = H_GET_8 (abfd, ext->e_numaux); } static unsigned int _bfd_xcoff64_swap_sym_out (abfd, inp, extp) - bfd *abfd; - PTR inp; - PTR extp; -{ - struct internal_syment *in = (struct internal_syment *)inp; - struct external_syment *ext =(struct external_syment *)extp; - - bfd_h_put_32(abfd, in->_n._n_n._n_offset, (bfd_byte *) ext->e_offset); - bfd_h_put_64(abfd, in->n_value , (bfd_byte *) ext->e_value); - bfd_h_put_16(abfd, in->n_scnum , (bfd_byte *) ext->e_scnum); - bfd_h_put_16(abfd, in->n_type , (bfd_byte *) ext->e_type); - bfd_h_put_8(abfd, in->n_sclass , ext->e_sclass); - bfd_h_put_8(abfd, in->n_numaux , ext->e_numaux); + bfd *abfd; + PTR inp; + PTR extp; +{ + struct internal_syment *in = (struct internal_syment *) inp; + struct external_syment *ext = (struct external_syment *) extp; + + H_PUT_32 (abfd, in->_n._n_n._n_offset, ext->e_offset); + H_PUT_64 (abfd, in->n_value, ext->e_value); + H_PUT_16 (abfd, in->n_scnum, ext->e_scnum); + H_PUT_16 (abfd, in->n_type, ext->e_type); + H_PUT_8 (abfd, in->n_sclass, ext->e_sclass); + H_PUT_8 (abfd, in->n_numaux, ext->e_numaux); return bfd_coff_symesz (abfd); } static void _bfd_xcoff64_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1) - bfd *abfd; - PTR ext1; - int type; - int class; - int indx; - int numaux; - PTR in1; + bfd *abfd; + PTR ext1; + int type; + int class; + int indx; + int numaux; + PTR in1; { - union external_auxent *ext = (union external_auxent *)ext1; - union internal_auxent *in = (union internal_auxent *)in1; + union external_auxent *ext = (union external_auxent *) ext1; + union internal_auxent *in = (union internal_auxent *) in1; - switch (class) { + switch (class) + { case C_FILE: - if (ext->x_file.x_n.x_zeroes == 0) { + if (ext->x_file.x_n.x_zeroes == 0) + { in->x_file.x_n.x_zeroes = 0; - in->x_file.x_n.x_offset = - bfd_h_get_32(abfd, (bfd_byte *) ext->x_file.x_n.x_offset); - } else { + in->x_file.x_n.x_offset = H_GET_32 (abfd, ext->x_file.x_n.x_offset); + } + else + { memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN); } goto end; @@ -212,19 +305,18 @@ _bfd_xcoff64_swap_aux_in (abfd, ext1, ty bfd_signed_vma h = 0; bfd_vma l = 0; - h = bfd_h_get_signed_32(abfd, ext->x_csect.x_scnlen_hi); - l = bfd_h_get_32 (abfd, ext->x_csect.x_scnlen_lo); + h = H_GET_S32 (abfd, ext->x_csect.x_scnlen_hi); + l = H_GET_32 (abfd, ext->x_csect.x_scnlen_lo); in->x_csect.x_scnlen.l = h << 32 | (l & 0xffffffff); - in->x_csect.x_parmhash = bfd_h_get_32 (abfd, - ext->x_csect.x_parmhash); - in->x_csect.x_snhash = bfd_h_get_16 (abfd, ext->x_csect.x_snhash); + in->x_csect.x_parmhash = H_GET_32 (abfd, ext->x_csect.x_parmhash); + in->x_csect.x_snhash = H_GET_16 (abfd, ext->x_csect.x_snhash); /* We don't have to hack bitfields in x_smtyp because it's defined by shifts-and-ands, which are equivalent on all byte orders. */ - in->x_csect.x_smtyp = bfd_h_get_8 (abfd, ext->x_csect.x_smtyp); - in->x_csect.x_smclas = bfd_h_get_8 (abfd, ext->x_csect.x_smclas); + in->x_csect.x_smtyp = H_GET_8 (abfd, ext->x_csect.x_smtyp); + in->x_csect.x_smclas = H_GET_8 (abfd, ext->x_csect.x_smclas); goto end; } break; @@ -232,9 +324,10 @@ _bfd_xcoff64_swap_aux_in (abfd, ext1, ty case C_STAT: case C_LEAFSTAT: case C_HIDDEN: - if (type == T_NULL) { + if (type == T_NULL) + { /* PE defines some extra fields; we zero them out for - safety. */ + safety. */ in->x_scn.x_checksum = 0; in->x_scn.x_associated = 0; in->x_scn.x_comdat = 0; @@ -246,284 +339,187 @@ _bfd_xcoff64_swap_aux_in (abfd, ext1, ty if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class)) { - in->x_sym.x_fcnary.x_fcn.x_lnnoptr = bfd_h_get_64(abfd, (bfd_byte *) - ext->x_sym.x_fcnary.x_fcn.x_lnnoptr); - in->x_sym.x_fcnary.x_fcn.x_endndx.l = bfd_h_get_32(abfd, (bfd_byte *) - ext->x_sym.x_fcnary.x_fcn.x_endndx); + in->x_sym.x_fcnary.x_fcn.x_lnnoptr + = H_GET_64 (abfd, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr); + in->x_sym.x_fcnary.x_fcn.x_endndx.l + = H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_endndx); + } + if (ISFCN (type)) + { + in->x_sym.x_misc.x_fsize + = H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_fsize); + } + else + { + in->x_sym.x_misc.x_lnsz.x_lnno + = H_GET_32 (abfd, ext->x_sym.x_fcnary.x_lnsz.x_lnno); + in->x_sym.x_misc.x_lnsz.x_size + = H_GET_16 (abfd, ext->x_sym.x_fcnary.x_lnsz.x_size); } - if (ISFCN(type)) { - in->x_sym.x_misc.x_fsize = bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_fsize); - } - else { - in->x_sym.x_misc.x_lnsz.x_lnno = bfd_h_get_32(abfd, (bfd_byte *) - ext->x_sym.x_fcnary.x_lnsz.x_lnno); - in->x_sym.x_misc.x_lnsz.x_size = bfd_h_get_16(abfd, (bfd_byte *) - ext->x_sym.x_fcnary.x_lnsz.x_size); - } - -end: ; - /* the semicolon is because MSVC doesn't like labels at - end of block. */ + end: ; } - - static unsigned int _bfd_xcoff64_swap_aux_out (abfd, inp, type, class, indx, numaux, extp) - bfd *abfd; - PTR inp; - int type; - int class; - int indx ATTRIBUTE_UNUSED; - int numaux ATTRIBUTE_UNUSED; - PTR extp; + bfd *abfd; + PTR inp; + int type; + int class; + int indx ATTRIBUTE_UNUSED; + int numaux ATTRIBUTE_UNUSED; + PTR extp; { - union internal_auxent *in = (union internal_auxent *)inp; - union external_auxent *ext = (union external_auxent *)extp; + union internal_auxent *in = (union internal_auxent *) inp; + union external_auxent *ext = (union external_auxent *) extp; - memset((PTR)ext, 0, bfd_coff_auxesz (abfd)); + memset ((PTR) ext, 0, bfd_coff_auxesz (abfd)); switch (class) { - case C_FILE: - if (ext->x_file.x_n.x_zeroes == 0) { - bfd_h_put_32 (abfd, 0, (bfd_byte *) ext->x_file.x_n.x_zeroes); - bfd_h_put_32 (abfd, in->x_file.x_n.x_offset, - (bfd_byte *) ext->x_file.x_n.x_offset); - } else { - memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN); - } - bfd_h_put_8 (abfd, _AUX_FILE, (bfd_byte *) ext->x_auxtype.x_auxtype); - goto end; - - /* RS/6000 "csect" auxents */ - case C_EXT: - case C_HIDEXT: - if (indx + 1 == numaux) - { - bfd_vma temp; - - temp = in->x_csect.x_scnlen.l & 0xffffffff; - bfd_h_put_32 (abfd, temp, ext->x_csect.x_scnlen_lo); - temp = in->x_csect.x_scnlen.l >> 32; - bfd_h_put_32 (abfd, temp, ext->x_csect.x_scnlen_hi); - bfd_h_put_32 (abfd, in->x_csect.x_parmhash, ext->x_csect.x_parmhash); - bfd_h_put_16 (abfd, in->x_csect.x_snhash, ext->x_csect.x_snhash); - /* We don't have to hack bitfields in x_smtyp because it's - defined by shifts-and-ands, which are equivalent on all - byte orders. */ - bfd_h_put_8 (abfd, in->x_csect.x_smtyp, ext->x_csect.x_smtyp); - bfd_h_put_8 (abfd, in->x_csect.x_smclas, ext->x_csect.x_smclas); - bfd_h_put_8 (abfd, _AUX_CSECT, (bfd_byte *) ext->x_auxtype.x_auxtype); - goto end; - } - break; - - case C_STAT: - case C_LEAFSTAT: - case C_HIDDEN: - if (type == T_NULL) { + case C_FILE: + if (ext->x_file.x_n.x_zeroes == 0) + { + H_PUT_32 (abfd, 0, ext->x_file.x_n.x_zeroes); + H_PUT_32 (abfd, in->x_file.x_n.x_offset, ext->x_file.x_n.x_offset); + } + else + { + memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN); + } + H_PUT_8 (abfd, _AUX_FILE, ext->x_auxtype.x_auxtype); goto end; + + /* RS/6000 "csect" auxents */ + case C_EXT: + case C_HIDEXT: + if (indx + 1 == numaux) + { + bfd_vma temp; + + temp = in->x_csect.x_scnlen.l & 0xffffffff; + H_PUT_32 (abfd, temp, ext->x_csect.x_scnlen_lo); + temp = in->x_csect.x_scnlen.l >> 32; + H_PUT_32 (abfd, temp, ext->x_csect.x_scnlen_hi); + H_PUT_32 (abfd, in->x_csect.x_parmhash, ext->x_csect.x_parmhash); + H_PUT_16 (abfd, in->x_csect.x_snhash, ext->x_csect.x_snhash); + /* We don't have to hack bitfields in x_smtyp because it's + defined by shifts-and-ands, which are equivalent on all + byte orders. */ + H_PUT_8 (abfd, in->x_csect.x_smtyp, ext->x_csect.x_smtyp); + H_PUT_8 (abfd, in->x_csect.x_smclas, ext->x_csect.x_smclas); + H_PUT_8 (abfd, _AUX_CSECT, ext->x_auxtype.x_auxtype); + goto end; + } + break; + + case C_STAT: + case C_LEAFSTAT: + case C_HIDDEN: + if (type == T_NULL) + { + goto end; + } + break; } - break; - } if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class)) { - bfd_h_put_64(abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr, - (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr); - bfd_h_put_8 (abfd, _AUX_FCN, (bfd_byte *) ext->x_auxtype.x_auxtype); - bfd_h_put_32(abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l, - (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx); + H_PUT_64 (abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr, + ext->x_sym.x_fcnary.x_fcn.x_lnnoptr); + H_PUT_8 (abfd, _AUX_FCN, + ext->x_auxtype.x_auxtype); + H_PUT_32 (abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l, + ext->x_sym.x_fcnary.x_fcn.x_endndx); } if (ISFCN (type)) - bfd_h_put_32 (abfd, in->x_sym.x_misc.x_fsize, - (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_fsize); + { + H_PUT_32 (abfd, in->x_sym.x_misc.x_fsize, + ext->x_sym.x_fcnary.x_fcn.x_fsize); + } else { - bfd_h_put_32(abfd, in->x_sym.x_misc.x_lnsz.x_lnno, - (bfd_byte *)ext->x_sym.x_fcnary.x_lnsz.x_lnno); - bfd_h_put_16(abfd, in->x_sym.x_misc.x_lnsz.x_size, - (bfd_byte *)ext->x_sym.x_fcnary.x_lnsz.x_size); + H_PUT_32 (abfd, in->x_sym.x_misc.x_lnsz.x_lnno, + ext->x_sym.x_fcnary.x_lnsz.x_lnno); + H_PUT_16 (abfd, in->x_sym.x_misc.x_lnsz.x_size, + ext->x_sym.x_fcnary.x_lnsz.x_size); } -end: + end: return bfd_coff_auxesz (abfd); } static boolean -_bfd_xcoff64_put_symbol_name (bfd *abfd, struct bfd_strtab_hash *strtab, +_bfd_xcoff64_put_symbol_name (bfd *abfd, struct bfd_strtab_hash *strtab, struct internal_syment *sym, const char *name) { boolean hash; bfd_size_type indx; - + hash = true; - + if ((abfd->flags & BFD_TRADITIONAL_FORMAT) != 0) hash = false; - + indx = _bfd_stringtab_add (strtab, name, hash, false); - + if (indx == (bfd_size_type) -1) return false; - + sym->_n._n_n._n_zeroes = 0; sym->_n._n_n._n_offset = STRING_SIZE_SIZE + indx; - + return true; } static boolean _bfd_xcoff64_put_ldsymbol_name (abfd, ldinfo, ldsym, name) bfd *abfd ATTRIBUTE_UNUSED; - struct xcoff_loader_info *ldinfo; - struct internal_ldsym *ldsym; - const char *name; + struct xcoff_loader_info *ldinfo; + struct internal_ldsym *ldsym; + const char *name; { size_t len; len = strlen (name); - if (ldinfo->string_size + len + 3 > ldinfo->string_alc){ - size_t newalc; - bfd_byte *newstrings; - - newalc = ldinfo->string_alc * 2; - if (newalc == 0) - newalc = 32; - while (ldinfo->string_size + len + 3 > newalc) - newalc *= 2; - - newstrings = ((bfd_byte *) - bfd_realloc ((PTR) ldinfo->strings, newalc)); - if (newstrings == NULL) { - ldinfo->failed = true; - return false; + if (ldinfo->string_size + len + 3 > ldinfo->string_alc) + { + bfd_size_type newalc; + bfd_byte *newstrings; + + newalc = ldinfo->string_alc * 2; + if (newalc == 0) + newalc = 32; + while (ldinfo->string_size + len + 3 > newalc) + newalc *= 2; + + newstrings = ((bfd_byte *) + bfd_realloc ((PTR) ldinfo->strings, newalc)); + if (newstrings == NULL) + { + ldinfo->failed = true; + return false; + } + ldinfo->string_alc = newalc; + ldinfo->strings = newstrings; } - ldinfo->string_alc = newalc; - ldinfo->strings = newstrings; - } - - bfd_put_16 (ldinfo->output_bfd, len + 1, + + bfd_put_16 (ldinfo->output_bfd, (bfd_vma) (len + 1), ldinfo->strings + ldinfo->string_size); strcpy (ldinfo->strings + ldinfo->string_size + 2, name); ldsym->_l._l_l._l_zeroes = 0; ldsym->_l._l_l._l_offset = ldinfo->string_size + 2; ldinfo->string_size += len + 3; - + return true; } -extern boolean _bfd_xcoff_mkobject PARAMS ((bfd *)); -extern boolean _bfd_xcoff_copy_private_bfd_data PARAMS ((bfd *, bfd *)); -extern boolean _bfd_xcoff_is_local_label_name PARAMS ((bfd *, const char *)); -extern void xcoff64_rtype2howto - PARAMS ((arelent *, struct internal_reloc *)); -extern reloc_howto_type * xcoff64_reloc_type_lookup - PARAMS ((bfd *, bfd_reloc_code_real_type)); -extern boolean _bfd_xcoff_slurp_armap PARAMS ((bfd *)); -extern PTR _bfd_xcoff_read_ar_hdr PARAMS ((bfd *)); -extern bfd *_bfd_xcoff_openr_next_archived_file PARAMS ((bfd *, bfd *)); -extern int _bfd_xcoff_generic_stat_arch_elt PARAMS ((bfd *, struct stat *)); -extern boolean _bfd_xcoff_write_armap - PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int)); -extern boolean _bfd_xcoff_write_archive_contents PARAMS ((bfd *)); -extern int _bfd_xcoff_sizeof_headers PARAMS ((bfd *, boolean)); -extern void _bfd_xcoff_swap_sym_in PARAMS ((bfd *, PTR, PTR)); -extern unsigned int _bfd_xcoff_swap_sym_out PARAMS ((bfd *, PTR, PTR)); -extern void _bfd_xcoff_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR)); -extern unsigned int _bfd_xcoff_swap_aux_out PARAMS ((bfd *, PTR, int, int, int, int, PTR)); - -/* coffcode.h needs these to be defined */ -/* Internalcoff.h and coffcode.h modify themselves based on these flags. */ -#define XCOFF64 -#define RS6000COFF_C 1 - -#define SELECT_RELOC(internal, howto) \ - { \ - internal.r_type = howto->type; \ - internal.r_size = \ - ((howto->complain_on_overflow == complain_overflow_signed \ - ? 0x80 \ - : 0) \ - | (howto->bitsize - 1)); \ - } - -#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3) -#define COFF_LONG_FILENAMES -#define NO_COFF_SYMBOLS -#define RTYPE2HOWTO(cache_ptr, dst) xcoff64_rtype2howto (cache_ptr, dst) -#define coff_mkobject _bfd_xcoff_mkobject -#define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data -#define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name -#define coff_bfd_reloc_type_lookup xcoff64_reloc_type_lookup -#ifdef AIX_CORE -extern const bfd_target * rs6000coff_core_p (); -extern boolean rs6000coff_core_file_matches_executable_p (); -extern char *rs6000coff_core_file_failing_command PARAMS ((bfd *abfd)); -extern int rs6000coff_core_file_failing_signal PARAMS ((bfd *abfd)); -#define CORE_FILE_P rs6000coff_core_p -#define coff_core_file_failing_command \ - rs6000coff_core_file_failing_command -#define coff_core_file_failing_signal \ - rs6000coff_core_file_failing_signal -#define coff_core_file_matches_executable_p \ - rs6000coff_core_file_matches_executable_p -#else -#define CORE_FILE_P _bfd_dummy_target -#define coff_core_file_failing_command \ - _bfd_nocore_core_file_failing_command -#define coff_core_file_failing_signal \ - _bfd_nocore_core_file_failing_signal -#define coff_core_file_matches_executable_p \ - _bfd_nocore_core_file_matches_executable_p -#endif -#define coff_SWAP_sym_in _bfd_xcoff64_swap_sym_in -#define coff_SWAP_sym_out _bfd_xcoff64_swap_sym_out -#define coff_SWAP_aux_in _bfd_xcoff64_swap_aux_in -#define coff_SWAP_aux_out _bfd_xcoff64_swap_aux_out - - - -#include "coffcode.h" - /* Routines to swap information in the XCOFF .loader section. If we ever need to write an XCOFF loader, this stuff will need to be moved to another file shared by the linker (which XCOFF calls the ``binder'') and the loader. */ -static void xcoff64_swap_ldhdr_in - PARAMS ((bfd *, const PTR, struct internal_ldhdr *)); -static void xcoff64_swap_ldhdr_out - PARAMS ((bfd *, const struct internal_ldhdr *, PTR d)); -static void xcoff64_swap_ldsym_in - PARAMS ((bfd *, const PTR, struct internal_ldsym *)); -static void xcoff64_swap_ldsym_out - PARAMS ((bfd *, const struct internal_ldsym *, PTR d)); -static void xcoff64_swap_ldrel_in - PARAMS ((bfd *, const PTR, struct internal_ldrel *)); -static void xcoff64_swap_ldrel_out - PARAMS ((bfd *, const struct internal_ldrel *, PTR d)); -static boolean xcoff64_write_object_contents PARAMS ((bfd *)); -static boolean xcoff64_ppc_relocate_section - PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, - struct internal_reloc *, struct internal_syment *, - asection **sections)); -static boolean xcoff64_slurp_armap PARAMS ((bfd *)); -static const bfd_target *xcoff64_archive_p PARAMS ((bfd *)); -static bfd *xcoff64_openr_next_archived_file PARAMS ((bfd *, bfd *)); -static int xcoff64_sizeof_headers PARAMS ((bfd *, boolean)); -static asection *xcoff64_create_csect_from_smclas - PARAMS ((bfd *, union internal_auxent *, const char *)); -static boolean xcoff64_is_lineno_count_overflow PARAMS ((bfd *, bfd_vma)); -static boolean xcoff64_is_reloc_count_overflow PARAMS ((bfd *, bfd_vma)); -static bfd_vma xcoff64_loader_symbol_offset - PARAMS ((bfd *, struct internal_ldhdr *)); -static bfd_vma xcoff64_loader_reloc_offset - PARAMS ((bfd *, struct internal_ldhdr *)); - /* Swap in the ldhdr structure. */ static void @@ -556,7 +552,7 @@ xcoff64_swap_ldhdr_out (abfd, src, d) { struct external_ldhdr *dst = (struct external_ldhdr *) d; - bfd_put_32 (abfd, src->l_version, dst->l_version); + bfd_put_32 (abfd, (bfd_vma) src->l_version, dst->l_version); bfd_put_32 (abfd, src->l_nsyms, dst->l_nsyms); bfd_put_32 (abfd, src->l_nreloc, dst->l_nreloc); bfd_put_32 (abfd, src->l_istlen, dst->l_istlen); @@ -577,11 +573,9 @@ xcoff64_swap_ldsym_in (abfd, s, dst) struct internal_ldsym *dst; { const struct external_ldsym *src = (const struct external_ldsym *) s; - /* - * XCOFF64 does not use l_zeroes like XCOFF32 - * Set the internal l_zeroes to 0 so the common 32/64 code uses l_value - * as an offset into the loader symbol table - */ + /* XCOFF64 does not use l_zeroes like XCOFF32 + Set the internal l_zeroes to 0 so the common 32/64 code uses l_value + as an offset into the loader symbol table. */ dst->_l._l_l._l_zeroes = 0; dst->_l._l_l._l_offset = bfd_get_32 (abfd, src->l_offset); dst->l_value = bfd_get_64 (abfd, src->l_value); @@ -603,8 +597,8 @@ xcoff64_swap_ldsym_out (abfd, src, d) struct external_ldsym *dst = (struct external_ldsym *) d; bfd_put_64 (abfd, src->l_value, dst->l_value); - bfd_put_32 (abfd, src->_l._l_l._l_offset, dst->l_offset); - bfd_put_16 (abfd, src->l_scnum, dst->l_scnum); + bfd_put_32 (abfd, (bfd_vma) src->_l._l_l._l_offset, dst->l_offset); + bfd_put_16 (abfd, (bfd_vma) src->l_scnum, dst->l_scnum); bfd_put_8 (abfd, src->l_smtype, dst->l_smtype); bfd_put_8 (abfd, src->l_smclas, dst->l_smclas); bfd_put_32 (abfd, src->l_ifile, dst->l_ifile); @@ -638,8 +632,8 @@ xcoff64_swap_ldrel_out (abfd, src, d) struct external_ldrel *dst = (struct external_ldrel *) d; bfd_put_64 (abfd, src->l_vaddr, dst->l_vaddr); - bfd_put_16 (abfd, src->l_rtype, dst->l_rtype); - bfd_put_16 (abfd, src->l_rsecnm, dst->l_rsecnm); + bfd_put_16 (abfd, (bfd_vma) src->l_rtype, dst->l_rtype); + bfd_put_16 (abfd, (bfd_vma) src->l_rsecnm, dst->l_rsecnm); bfd_put_32 (abfd, src->l_symndx, dst->l_symndx); } @@ -657,25 +651,25 @@ xcoff64_write_object_contents (abfd) unsigned long reloc_size = 0; unsigned long lnno_size = 0; boolean long_section_names; - asection *text_sec = ((void *)0) ; - asection *data_sec = ((void *)0) ; - asection *bss_sec = ((void *)0) ; + asection *text_sec = ((void *) 0); + asection *data_sec = ((void *) 0); + asection *bss_sec = ((void *) 0); struct internal_filehdr internal_f; struct internal_aouthdr internal_a; bfd_set_error (bfd_error_system_call); - if (abfd->output_has_begun == false) { - if (! bfd_coff_compute_section_file_positions (abfd)) - return false; - } + if (abfd->output_has_begun == false) + { + if (! bfd_coff_compute_section_file_positions (abfd)) + return false; + } /* Work out the size of the reloc and linno areas */ reloc_base = obj_relocbase (abfd); - for (current = abfd->sections; current != NULL; current = current->next) { + for (current = abfd->sections; current != NULL; current = current->next) reloc_size += current->reloc_count * bfd_coff_relsz (abfd); - } lineno_base = reloc_base + reloc_size; @@ -685,31 +679,41 @@ xcoff64_write_object_contents (abfd) sym_base = lineno_base + lnno_size; - /* Indicate in each section->line_filepos its actual file address */ - for (current = abfd->sections; current != NULL; current = current->next) { - if (current->lineno_count) { - current->line_filepos = lineno_base; - current->moving_line_filepos = lineno_base; - lineno_base += current->lineno_count * bfd_coff_linesz (abfd); - } else { - current->line_filepos = 0; - } - - if (current->reloc_count) { - current->rel_filepos = reloc_base; - reloc_base += current->reloc_count * bfd_coff_relsz (abfd); - } else { - current->rel_filepos = 0; + /* Indicate in each section->line_filepos its actual file address */ + for (current = abfd->sections; current != NULL; current = current->next) + { + if (current->lineno_count) + { + current->line_filepos = lineno_base; + current->moving_line_filepos = lineno_base; + lineno_base += current->lineno_count * bfd_coff_linesz (abfd); + } + else + { + current->line_filepos = 0; + } + + if (current->reloc_count) + { + current->rel_filepos = reloc_base; + reloc_base += current->reloc_count * bfd_coff_relsz (abfd); + } + else + { + current->rel_filepos = 0; + } + } + + if ((abfd->flags & EXEC_P) != 0) + { + scn_base = bfd_coff_filhsz (abfd) + bfd_coff_aoutsz (abfd); + internal_f.f_opthdr = bfd_coff_aoutsz (abfd); + } + else + { + scn_base = bfd_coff_filhsz (abfd); + internal_f.f_opthdr = 0; } - } - - if ((abfd->flags & EXEC_P) != 0) { - scn_base = bfd_coff_filhsz (abfd) + bfd_coff_aoutsz (abfd); - internal_f.f_opthdr = bfd_coff_aoutsz (abfd); - } else { - scn_base = bfd_coff_filhsz (abfd); - internal_f.f_opthdr = 0; - } internal_f.f_nscns = 0; @@ -717,55 +721,62 @@ xcoff64_write_object_contents (abfd) return false; long_section_names = false; - for (current = abfd->sections; current != NULL; current = current->next) { - - struct internal_scnhdr section; - struct external_scnhdr buff; - - internal_f.f_nscns++; - - strncpy (section.s_name, current->name, SCNNMLEN); - - section.s_vaddr = current->vma; - section.s_paddr = current->lma; - section.s_size = current->_raw_size; - - /* - If this section has no size or is unloadable then the scnptr - will be 0 too - */ - if (current->_raw_size == 0 || - (current->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0) { - section.s_scnptr = 0; - } else { - section.s_scnptr = current->filepos; - } - - section.s_relptr = current->rel_filepos; - section.s_lnnoptr = current->line_filepos; - section.s_nreloc = current->reloc_count; - - section.s_nlnno = current->lineno_count; - if (current->reloc_count != 0) - hasrelocs = true; - if (current->lineno_count != 0) - haslinno = true; - - section.s_flags = sec_to_styp_flags (current->name, current->flags); - - if (!strcmp (current->name, _TEXT)) { - text_sec = current; - } else if (!strcmp (current->name, _DATA)) { - data_sec = current; - } else if (!strcmp (current->name, _BSS)) { - bss_sec = current; - } - - if (bfd_coff_swap_scnhdr_out (abfd, §ion, &buff) == 0 - || bfd_write ((PTR) (&buff), 1, bfd_coff_scnhsz (abfd), abfd) - != bfd_coff_scnhsz (abfd)) + for (current = abfd->sections; current != NULL; current = current->next) + { + struct internal_scnhdr section; + struct external_scnhdr buff; + bfd_size_type amount; + + internal_f.f_nscns++; + + strncpy (section.s_name, current->name, SCNNMLEN); + + section.s_vaddr = current->vma; + section.s_paddr = current->lma; + section.s_size = current->_raw_size; + + /* If this section has no size or is unloadable then the scnptr + will be 0 too. */ + if (current->_raw_size == 0 + || (current->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0) + { + section.s_scnptr = 0; + } + else + { + section.s_scnptr = current->filepos; + } + + section.s_relptr = current->rel_filepos; + section.s_lnnoptr = current->line_filepos; + section.s_nreloc = current->reloc_count; + + section.s_nlnno = current->lineno_count; + if (current->reloc_count != 0) + hasrelocs = true; + if (current->lineno_count != 0) + haslinno = true; + + section.s_flags = sec_to_styp_flags (current->name, current->flags); + + if (!strcmp (current->name, _TEXT)) + { + text_sec = current; + } + else if (!strcmp (current->name, _DATA)) + { + data_sec = current; + } + else if (!strcmp (current->name, _BSS)) + { + bss_sec = current; + } + + amount = bfd_coff_scnhsz (abfd); + if (bfd_coff_swap_scnhdr_out (abfd, §ion, &buff) == 0 + || bfd_bwrite ((PTR) (&buff), amount, abfd) != amount) return false; - } + } internal_f.f_timdat = 0; @@ -792,10 +803,8 @@ xcoff64_write_object_contents (abfd) memset (&internal_a, 0, sizeof internal_a); - /* - * This can only be called from the xcoff64 backend so the magic # must - * be for xcoff64 - */ + /* This can only be called from the xcoff64 backend so the magic # + must be for xcoff64. */ internal_f.f_magic = 0757; internal_a.magic = (abfd->flags & D_PAGED) ? RS6K_AOUTHDR_ZMAGIC : @@ -811,59 +820,63 @@ xcoff64_write_object_contents (abfd) internal_f.f_symptr = 0; internal_f.f_nsyms = 0; - /* - * If bfd_get_symcount (abfd) != 0, then we are not using the COFF - * backend linker, and obj_raw_syment_count is not valid until after - * coff_write_symbols is called. - */ - if (bfd_get_symcount (abfd) != 0) { - int firstundef; + /* If bfd_get_symcount (abfd) != 0, then we are not using the COFF + backend linker, and obj_raw_syment_count is not valid until after + coff_write_symbols is called. */ + if (bfd_get_symcount (abfd) != 0) + { + int firstundef; - if (!coff_renumber_symbols (abfd, &firstundef)) - return false; - coff_mangle_symbols (abfd); - if (! coff_write_symbols (abfd)) - return false; - if (! coff_write_linenumbers (abfd)) - return false; - if (! coff_write_relocs (abfd, firstundef)) - return false; + if (!coff_renumber_symbols (abfd, &firstundef)) + return false; + coff_mangle_symbols (abfd); + if (! coff_write_symbols (abfd)) + return false; + if (! coff_write_linenumbers (abfd)) + return false; + if (! coff_write_relocs (abfd, firstundef)) + return false; - internal_f.f_symptr = sym_base; - internal_f.f_nsyms = bfd_get_symcount (abfd); - } else if (obj_raw_syment_count (abfd) != 0) { - internal_f.f_symptr = sym_base; - - /* - * AIX appears to require that F_RELFLG not be set if there are - * local symbols but no relocations. - */ - internal_f.f_flags &=~ F_RELFLG; - } else { - internal_f.f_flags |= F_LSYMS; - } + internal_f.f_symptr = sym_base; + internal_f.f_nsyms = bfd_get_symcount (abfd); + } + else if (obj_raw_syment_count (abfd) != 0) + { + internal_f.f_symptr = sym_base; + + /* AIX appears to require that F_RELFLG not be set if there are + local symbols but no relocations. */ + internal_f.f_flags &=~ F_RELFLG; + } + else + { + internal_f.f_flags |= F_LSYMS; + } - if (text_sec) { - internal_a.tsize = bfd_get_section_size_before_reloc (text_sec); + if (text_sec) + { + internal_a.tsize = bfd_get_section_size_before_reloc (text_sec); internal_a.text_start = internal_a.tsize ? text_sec->vma : 0; - } + } - if (data_sec) { - internal_a.dsize = bfd_get_section_size_before_reloc (data_sec); - internal_a.data_start = internal_a.dsize ? data_sec->vma : 0; - } + if (data_sec) + { + internal_a.dsize = bfd_get_section_size_before_reloc (data_sec); + internal_a.data_start = internal_a.dsize ? data_sec->vma : 0; + } - if (bss_sec) { - internal_a.bsize = bfd_get_section_size_before_reloc (bss_sec); - if (internal_a.bsize && bss_sec->vma < internal_a.data_start) - internal_a.data_start = bss_sec->vma; - } + if (bss_sec) + { + internal_a.bsize = bfd_get_section_size_before_reloc (bss_sec); + if (internal_a.bsize && bss_sec->vma < internal_a.data_start) + internal_a.data_start = bss_sec->vma; + } internal_a.entry = bfd_get_start_address (abfd); internal_f.f_nsyms = obj_raw_syment_count (abfd); - if (xcoff_data (abfd)->full_aouthdr) { - + if (xcoff_data (abfd)->full_aouthdr) + { bfd_vma toc; asection *loader_sec; @@ -873,21 +886,27 @@ xcoff64_write_object_contents (abfd) if (internal_a.o_snentry == 0) internal_a.entry = (bfd_vma) -1; - if (text_sec != NULL) { + if (text_sec != NULL) + { internal_a.o_sntext = text_sec->target_index; internal_a.o_algntext = bfd_get_section_alignment (abfd, text_sec); - } else { - internal_a.o_sntext = 0; - internal_a.o_algntext = 0; - } - - if (data_sec != NULL) { - internal_a.o_sndata = data_sec->target_index; - internal_a.o_algndata = bfd_get_section_alignment (abfd, data_sec); - } else { - internal_a.o_sndata = 0; - internal_a.o_algndata = 0; - } + } + else + { + internal_a.o_sntext = 0; + internal_a.o_algntext = 0; + } + + if (data_sec != NULL) + { + internal_a.o_sndata = data_sec->target_index; + internal_a.o_algndata = bfd_get_section_alignment (abfd, data_sec); + } + else + { + internal_a.o_sndata = 0; + internal_a.o_algndata = 0; + } loader_sec = bfd_get_section_by_name (abfd, ".loader"); if (loader_sec != NULL) @@ -925,46 +944,45 @@ xcoff64_write_object_contents (abfd) } internal_a.o_maxstack = xcoff_data (abfd)->maxstack; internal_a.o_maxdata = xcoff_data (abfd)->maxdata; - } - - if (bfd_seek (abfd, (file_ptr) 0, 0 ) != 0) + } + + if (bfd_seek (abfd, (file_ptr) 0, 0) != 0) return false; - + { char * buff; - bfd_size_type amount; - - buff = bfd_malloc (bfd_coff_filhsz (abfd)); - if (buff == ((void *)0) ) + bfd_size_type amount = bfd_coff_filhsz (abfd); + + buff = bfd_malloc (amount); + if (buff == NULL) return false; - - bfd_coff_swap_filehdr_out (abfd, (PTR) & internal_f, (PTR) buff); - amount = bfd_write ((PTR) buff, 1, bfd_coff_filhsz (abfd), abfd); - + + bfd_coff_swap_filehdr_out (abfd, (PTR) &internal_f, (PTR) buff); + amount = bfd_bwrite ((PTR) buff, amount, abfd); + free (buff); - + if (amount != bfd_coff_filhsz (abfd)) return false; } - - if (abfd->flags & EXEC_P) { - char * buff; - bfd_size_type amount; + if (abfd->flags & EXEC_P) + { + char * buff; + bfd_size_type amount = bfd_coff_aoutsz (abfd); - buff = bfd_malloc (bfd_coff_aoutsz (abfd)); - if (buff == NULL) - return false; - - bfd_coff_swap_aouthdr_out (abfd, (PTR) & internal_a, (PTR) buff); - amount = bfd_write ((PTR) buff, 1, bfd_coff_aoutsz (abfd), abfd); + buff = bfd_malloc (amount); + if (buff == NULL) + return false; - free (buff); - - if (amount != bfd_coff_aoutsz (abfd)) - return false; - } + bfd_coff_swap_aouthdr_out (abfd, (PTR) & internal_a, (PTR) buff); + amount = bfd_bwrite ((PTR) buff, amount, abfd); + free (buff); + + if (amount != bfd_coff_aoutsz (abfd)) + return false; + } return true; } @@ -1009,15 +1027,18 @@ xcoff64_ppc_relocate_section (output_bfd symndx = rel->r_symndx; - if (symndx == -1) { - h = NULL; - sym = NULL; - addend = 0; - } else { - h = obj_xcoff_sym_hashes (input_bfd)[symndx]; - sym = syms + symndx; - addend = - sym->n_value; - } + if (symndx == -1) + { + h = NULL; + sym = NULL; + addend = 0; + } + else + { + h = obj_xcoff_sym_hashes (input_bfd)[symndx]; + sym = syms + symndx; + addend = - sym->n_value; + } /* We build the howto information on the fly. */ @@ -1035,71 +1056,89 @@ xcoff64_ppc_relocate_section (output_bfd howto.name = "internal"; howto.partial_inplace = true; - if (howto.bitsize == 64) { - howto.src_mask = howto.dst_mask = MINUS_ONE; - } else if (howto.bitsize == 32) { - howto.src_mask = howto.dst_mask = 0xffffffff; - } else { - howto.src_mask = howto.dst_mask = (1 << howto.bitsize) - 1; - if (howto.bitsize == 16) - howto.size = 1; - } + if (howto.bitsize == 64) + { + howto.src_mask = howto.dst_mask = MINUS_ONE; + } + else if (howto.bitsize == 32) + { + howto.src_mask = howto.dst_mask = 0xffffffff; + } + else + { + howto.src_mask = howto.dst_mask = (1 << howto.bitsize) - 1; + if (howto.bitsize == 16) + howto.size = 1; + } howto.pcrel_offset = false; val = 0; - if (h == NULL) { - asection *sec; + if (h == NULL) + { + asection *sec; - if (symndx == -1) { - sec = bfd_abs_section_ptr; - val = 0; - } else { - sec = sections[symndx]; - /* Hack to make sure we use the right TOC anchor value - if this reloc is against the TOC anchor. */ - if (sec->name[3] == '0' - && strcmp (sec->name, ".tc0") == 0) - val = xcoff_data (output_bfd)->toc; + if (symndx == -1) + { + sec = bfd_abs_section_ptr; + val = 0; + } else - val = (sec->output_section->vma - + sec->output_offset - + sym->n_value - - sec->vma); + { + sec = sections[symndx]; + /* Hack to make sure we use the right TOC anchor value + if this reloc is against the TOC anchor. */ + if (sec->name[3] == '0' + && strcmp (sec->name, ".tc0") == 0) + val = xcoff_data (output_bfd)->toc; + else + val = (sec->output_section->vma + + sec->output_offset + + sym->n_value + - sec->vma); + } + } + else + { - } else { + if (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + { + asection *sec; - if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) { - asection *sec; - - sec = h->root.u.def.section; - val = (h->root.u.def.value - + sec->output_section->vma - + sec->output_offset); + sec = h->root.u.def.section; + val = (h->root.u.def.value + + sec->output_section->vma + + sec->output_offset); - } else if (h->root.type == bfd_link_hash_common) { - asection *sec; - - sec = h->root.u.c.p->section; - val = (sec->output_section->vma - + sec->output_offset); - } else if ((h->flags & XCOFF_DEF_DYNAMIC) != 0 - || (h->flags & XCOFF_IMPORT) != 0) { - /* Every symbol in a shared object is defined somewhere. */ - val = 0; - } else if (! info->relocateable) { - if (! ((*info->callbacks->undefined_symbol) - (info, h->root.root.string, input_bfd, input_section, - rel->r_vaddr - input_section->vma, true))) - return false; - - /* Don't try to process the reloc. It can't help, and - it may generate another error. */ - continue; + } + else if (h->root.type == bfd_link_hash_common) + { + asection *sec; + + sec = h->root.u.c.p->section; + val = (sec->output_section->vma + + sec->output_offset); + } + else if ((h->flags & XCOFF_DEF_DYNAMIC) != 0 + || (h->flags & XCOFF_IMPORT) != 0) + { + /* Every symbol in a shared object is defined somewhere. */ + val = 0; + } + else if (! info->relocateable) + { + if (! ((*info->callbacks->undefined_symbol) + (info, h->root.root.string, input_bfd, input_section, + rel->r_vaddr - input_section->vma, true))) + return false; + + /* Don't try to process the reloc. It can't help, and + it may generate another error. */ + continue; + } } - } /* I took the relocation type definitions from two documents: the PowerPC AIX Version 4 Application Binary Interface, First @@ -1107,133 +1146,132 @@ xcoff64_ppc_relocate_section (output_bfd 32-Bit Hardware Implementation (June 30, 1994). Differences between the documents are noted below. */ - switch (rel->r_type) { - case R_RTB: - case R_RRTBI: - case R_RRTBA: - /* These relocs are defined by the PowerPC ABI to be - relative branches which use half of the difference - between the symbol and the program counter. I can't - quite figure out when this is useful. These relocs are - not defined by the PowerOpen ABI. */ - default: - (*_bfd_error_handler) - (_("%s: unsupported relocation type 0x%02x"), - bfd_get_filename (input_bfd), (unsigned int) rel->r_type); - bfd_set_error (bfd_error_bad_value); - return false; - case R_POS: - /* Simple positive relocation. */ - break; - case R_NEG: - /* Simple negative relocation. */ - val = - val; - break; - case R_REL: - /* Simple PC relative relocation. */ - howto.pc_relative = true; - break; - case R_TOC: - /* TOC relative relocation. The value in the instruction in - the input file is the offset from the input file TOC to - the desired location. We want the offset from the final - TOC to the desired location. We have: - isym = iTOC + in - iinsn = in + o - osym = oTOC + on - oinsn = on + o - so we must change insn by on - in. - */ - case R_GL: - /* Global linkage relocation. The value of this relocation - is the address of the entry in the TOC section. */ - case R_TCL: - /* Local object TOC address. I can't figure out the - difference between this and case R_GL. */ - case R_TRL: - /* TOC relative relocation. A TOC relative load instruction - which may be changed to a load address instruction. - FIXME: We don't currently implement this optimization. */ - case R_TRLA: - /* TOC relative relocation. This is a TOC relative load - address instruction which may be changed to a load - instruction. FIXME: I don't know if this is the correct - implementation. */ - if (h != NULL && h->smclas != XMC_TD) - { - if (h->toc_section == NULL) - { - (*_bfd_error_handler) - (_("%s: TOC reloc at 0x%x to symbol `%s' with no TOC entry"), - bfd_get_filename (input_bfd), rel->r_vaddr, - h->root.root.string); - bfd_set_error (bfd_error_bad_value); - return false; - } - - BFD_ASSERT ((h->flags & XCOFF_SET_TOC) == 0); - val = (h->toc_section->output_section->vma - + h->toc_section->output_offset); - - } + switch (rel->r_type) + { + case R_RTB: + case R_RRTBI: + case R_RRTBA: + /* These relocs are defined by the PowerPC ABI to be + relative branches which use half of the difference + between the symbol and the program counter. I can't + quite figure out when this is useful. These relocs are + not defined by the PowerOpen ABI. */ + default: + (*_bfd_error_handler) + (_("%s: unsupported relocation type 0x%02x"), + bfd_archive_filename (input_bfd), (unsigned int) rel->r_type); + bfd_set_error (bfd_error_bad_value); + return false; + case R_POS: + /* Simple positive relocation. */ + break; + case R_NEG: + /* Simple negative relocation. */ + val = - val; + break; + case R_REL: + /* Simple PC relative relocation. */ + howto.pc_relative = true; + break; + case R_TOC: + /* TOC relative relocation. The value in the instruction in + the input file is the offset from the input file TOC to + the desired location. We want the offset from the final + TOC to the desired location. We have: + isym = iTOC + in + iinsn = in + o + osym = oTOC + on + oinsn = on + o + so we must change insn by on - in. + */ + case R_GL: + /* Global linkage relocation. The value of this relocation + is the address of the entry in the TOC section. */ + case R_TCL: + /* Local object TOC address. I can't figure out the + difference between this and case R_GL. */ + case R_TRL: + /* TOC relative relocation. A TOC relative load instruction + which may be changed to a load address instruction. + FIXME: We don't currently implement this optimization. */ + case R_TRLA: + /* TOC relative relocation. This is a TOC relative load + address instruction which may be changed to a load + instruction. FIXME: I don't know if this is the correct + implementation. */ + if (h != NULL && h->smclas != XMC_TD) + { + if (h->toc_section == NULL) + { + (*_bfd_error_handler) + (_("%s: TOC reloc at 0x%x to symbol `%s' with no TOC entry"), + bfd_archive_filename (input_bfd), rel->r_vaddr, + h->root.root.string); + bfd_set_error (bfd_error_bad_value); + return false; + } + BFD_ASSERT ((h->flags & XCOFF_SET_TOC) == 0); + val = (h->toc_section->output_section->vma + + h->toc_section->output_offset); + } - val = ((val - xcoff_data (output_bfd)->toc) - - (sym->n_value - xcoff_data (input_bfd)->toc)); + val = ((val - xcoff_data (output_bfd)->toc) + - (sym->n_value - xcoff_data (input_bfd)->toc)); - addend = 0; - break; - case R_BA: - /* Absolute branch. We don't want to mess with the lower - two bits of the instruction. */ - case R_CAI: - /* The PowerPC ABI defines this as an absolute call which - may be modified to become a relative call. The PowerOpen - ABI does not define this relocation type. */ - case R_RBA: - /* Absolute branch which may be modified to become a - relative branch. */ - case R_RBAC: - /* The PowerPC ABI defines this as an absolute branch to a - fixed address which may be modified to an absolute branch - to a symbol. The PowerOpen ABI does not define this - relocation type. */ - case R_RBRC: - /* The PowerPC ABI defines this as an absolute branch to a - fixed address which may be modified to a relative branch. - The PowerOpen ABI does not define this relocation type. */ - howto.src_mask &= ~3; - howto.dst_mask = howto.src_mask; - break; - case R_BR: - /* Relative branch. We don't want to mess with the lower - two bits of the instruction. */ - case R_CREL: - /* The PowerPC ABI defines this as a relative call which may - be modified to become an absolute call. The PowerOpen - ABI does not define this relocation type. */ - case R_RBR: - /* A relative branch which may be modified to become an - absolute branch. FIXME: We don't implement this, - although we should for symbols of storage mapping class - XMC_XO. */ - howto.pc_relative = true; - howto.src_mask &= ~3; - howto.dst_mask = howto.src_mask; - howto.size = 2; - howto.complain_on_overflow = complain_overflow_bitfield; - break; - case R_RL: - /* The PowerPC AIX ABI describes this as a load which may be - changed to a load address. The PowerOpen ABI says this - is the same as case R_POS. */ - break; - case R_RLA: - /* The PowerPC AIX ABI describes this as a load address - which may be changed to a load. The PowerOpen ABI says - this is the same as R_POS. */ - break; - } + addend = 0; + break; + case R_BA: + /* Absolute branch. We don't want to mess with the lower + two bits of the instruction. */ + case R_CAI: + /* The PowerPC ABI defines this as an absolute call which + may be modified to become a relative call. The PowerOpen + ABI does not define this relocation type. */ + case R_RBA: + /* Absolute branch which may be modified to become a + relative branch. */ + case R_RBAC: + /* The PowerPC ABI defines this as an absolute branch to a + fixed address which may be modified to an absolute branch + to a symbol. The PowerOpen ABI does not define this + relocation type. */ + case R_RBRC: + /* The PowerPC ABI defines this as an absolute branch to a + fixed address which may be modified to a relative branch. + The PowerOpen ABI does not define this relocation type. */ + howto.src_mask &= ~3; + howto.dst_mask = howto.src_mask; + break; + case R_BR: + /* Relative branch. We don't want to mess with the lower + two bits of the instruction. */ + case R_CREL: + /* The PowerPC ABI defines this as a relative call which may + be modified to become an absolute call. The PowerOpen + ABI does not define this relocation type. */ + case R_RBR: + /* A relative branch which may be modified to become an + absolute branch. FIXME: We don't implement this, + although we should for symbols of storage mapping class + XMC_XO. */ + howto.pc_relative = true; + howto.src_mask &= ~3; + howto.dst_mask = howto.src_mask; + howto.size = 2; + howto.complain_on_overflow = complain_overflow_bitfield; + break; + case R_RL: + /* The PowerPC AIX ABI describes this as a load which may be + changed to a load address. The PowerOpen ABI says this + is the same as case R_POS. */ + break; + case R_RLA: + /* The PowerPC AIX ABI describes this as a load address + which may be changed to a load. The PowerOpen ABI says + this is the same as R_POS. */ + break; + } /* If we see an R_BR or R_RBR reloc which is jumping to global linkage code, and it is followed by an appropriate cror nop @@ -1242,12 +1280,12 @@ xcoff64_ppc_relocate_section (output_bfd call is followed by a ld r2,40(r1), but the call is not going to global linkage code, we can replace the load with a cror. */ - if ((rel->r_type == R_BR || rel->r_type == R_RBR) && - h != NULL && - h->root.type == bfd_link_hash_defined && - (rel->r_vaddr - input_section->vma + 8 - <= input_section->_cooked_size)) { - + if ((rel->r_type == R_BR || rel->r_type == R_RBR) + && h != NULL + && h->root.type == bfd_link_hash_defined + && (rel->r_vaddr - input_section->vma + 8 + <= input_section->_cooked_size)) + { bfd_byte *pnext; unsigned long next; @@ -1256,22 +1294,24 @@ xcoff64_ppc_relocate_section (output_bfd /* The _ptrgl function is magic. It is used by the AIX - * compiler to call a function through a pointer. - * + * compiler to call a function through a pointer. + * * special case XMC_GL, global linkage */ if (h->smclas == XMC_GL || strcmp (h->root.root.string, "._ptrgl") == 0) { - if (next == 0x4def7b82 /* cror 15,15,15 */ - || next == 0x4ffffb82 /* cror 31,31,31 */ - || next == 0x60000000) /* ori r0,r0,0 */ - bfd_put_32 (input_bfd, 0xe8410028, pnext); /* ld r2,40(r1) */ + if (next == 0x4def7b82 /* cror 15,15,15 */ + || next == 0x4ffffb82 /* cror 31,31,31 */ + || next == 0x60000000 /* ori r0,r0,0 */) + bfd_put_32 (input_bfd, (bfd_vma) 0xe8410028 /* ld r2,40(r1) */, + pnext); } else { - if (next == 0xe8410028) /* ld r2,40(r1) */ - bfd_put_32 (input_bfd, 0x60000000, pnext); /* ori r0,r0,0 */ + if (next == 0xe8410028 /* ld r2,40(r1) */) + bfd_put_32 (input_bfd, (bfd_vma) 0x60000000 /* ori r0,r0,0 */, + pnext); } } @@ -1331,360 +1371,359 @@ xcoff64_ppc_relocate_section (output_bfd reloc_howto_type xcoff64_howto_table[] = { /* Standard 64 bit relocation. */ - HOWTO (0, /* type */ - 0, /* rightshift */ - 4, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ + HOWTO (0, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_POS", /* name */ - true, /* partial_inplace */ - MINUS_ONE, /* src_mask */ - MINUS_ONE, /* dst_mask */ - false), /* pcrel_offset */ + 0, /* special_function */ + "R_POS", /* name */ + true, /* partial_inplace */ + MINUS_ONE, /* src_mask */ + MINUS_ONE, /* dst_mask */ + false), /* pcrel_offset */ /* 64 bit relocation, but store negative value. */ - HOWTO (1, /* type */ - 0, /* rightshift */ - -4, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ + HOWTO (1, /* type */ + 0, /* rightshift */ + -4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_NEG", /* name */ - true, /* partial_inplace */ - MINUS_ONE, /* src_mask */ - MINUS_ONE, /* dst_mask */ - false), /* pcrel_offset */ + 0, /* special_function */ + "R_NEG", /* name */ + true, /* partial_inplace */ + MINUS_ONE, /* src_mask */ + MINUS_ONE, /* dst_mask */ + false), /* pcrel_offset */ /* 32 bit PC relative relocation. */ - HOWTO (2, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ + HOWTO (2, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - 0, /* special_function */ - "R_REL", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ + 0, /* special_function */ + "R_REL", /* name */ + true, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + false), /* pcrel_offset */ /* 16 bit TOC relative relocation. */ - HOWTO (3, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ + HOWTO (3, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_TOC", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* I don't really know what this is. */ - HOWTO (4, /* type */ - 1, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ + 0, /* special_function */ + "R_TOC", /* name */ + true, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + false), /* pcrel_offset */ + + /* I don't really know what this is. */ + HOWTO (4, /* type */ + 1, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_RTB", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ + 0, /* special_function */ + "R_RTB", /* name */ + true, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + false), /* pcrel_offset */ /* External TOC relative symbol. */ - HOWTO (5, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ + HOWTO (5, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_GL", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Local TOC relative symbol. */ - HOWTO (6, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ + 0, /* special_function */ + "R_GL", /* name */ + true, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + false), /* pcrel_offset */ + + /* Local TOC relative symbol. */ + HOWTO (6, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_TCL", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ + 0, /* special_function */ + "R_TCL", /* name */ + true, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + false), /* pcrel_offset */ EMPTY_HOWTO (7), /* Non modifiable absolute branch. */ - HOWTO (8, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 26, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ + HOWTO (8, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 26, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_BA", /* name */ - true, /* partial_inplace */ - 0x3fffffc, /* src_mask */ - 0x3fffffc, /* dst_mask */ - false), /* pcrel_offset */ + 0, /* special_function */ + "R_BA", /* name */ + true, /* partial_inplace */ + 0x3fffffc, /* src_mask */ + 0x3fffffc, /* dst_mask */ + false), /* pcrel_offset */ EMPTY_HOWTO (9), /* Non modifiable relative branch. */ - HOWTO (0xa, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 26, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ + HOWTO (0xa, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 26, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - 0, /* special_function */ - "R_BR", /* name */ - true, /* partial_inplace */ - 0x3fffffc, /* src_mask */ - 0x3fffffc, /* dst_mask */ - false), /* pcrel_offset */ + 0, /* special_function */ + "R_BR", /* name */ + true, /* partial_inplace */ + 0x3fffffc, /* src_mask */ + 0x3fffffc, /* dst_mask */ + false), /* pcrel_offset */ EMPTY_HOWTO (0xb), /* Indirect load. */ - HOWTO (0xc, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ + HOWTO (0xc, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_RL", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ + 0, /* special_function */ + "R_RL", /* name */ + true, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + false), /* pcrel_offset */ /* Load address. */ - HOWTO (0xd, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ + HOWTO (0xd, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_RLA", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ + 0, /* special_function */ + "R_RLA", /* name */ + true, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + false), /* pcrel_offset */ EMPTY_HOWTO (0xe), - /* Non-relocating reference. */ - HOWTO (0xf, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ + /* Non-relocating reference. */ + HOWTO (0xf, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_REF", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ + 0, /* special_function */ + "R_REF", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + false), /* pcrel_offset */ EMPTY_HOWTO (0x10), EMPTY_HOWTO (0x11), /* TOC relative indirect load. */ - HOWTO (0x12, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ + HOWTO (0x12, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_TRL", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* TOC relative load address. */ - HOWTO (0x13, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ + 0, /* special_function */ + "R_TRL", /* name */ + true, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + false), /* pcrel_offset */ + + /* TOC relative load address. */ + HOWTO (0x13, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_TRLA", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ + 0, /* special_function */ + "R_TRLA", /* name */ + true, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + false), /* pcrel_offset */ /* Modifiable relative branch. */ - HOWTO (0x14, /* type */ - 1, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ + HOWTO (0x14, /* type */ + 1, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_RRTBI", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ + 0, /* special_function */ + "R_RRTBI", /* name */ + true, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + false), /* pcrel_offset */ /* Modifiable absolute branch. */ - HOWTO (0x15, /* type */ - 1, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ + HOWTO (0x15, /* type */ + 1, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_RRTBA", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Modifiable call absolute indirect. */ - HOWTO (0x16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ + 0, /* special_function */ + "R_RRTBA", /* name */ + true, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + false), /* pcrel_offset */ + + /* Modifiable call absolute indirect. */ + HOWTO (0x16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_CAI", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Modifiable call relative. */ - HOWTO (0x17, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ + 0, /* special_function */ + "R_CAI", /* name */ + true, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + false), /* pcrel_offset */ + + /* Modifiable call relative. */ + HOWTO (0x17, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_CREL", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ + 0, /* special_function */ + "R_CREL", /* name */ + true, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + false), /* pcrel_offset */ /* Modifiable branch absolute. */ - HOWTO (0x18, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 26, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ + HOWTO (0x18, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 26, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_RBA", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ + 0, /* special_function */ + "R_RBA", /* name */ + true, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + false), /* pcrel_offset */ /* Modifiable branch absolute. */ - HOWTO (0x19, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ + HOWTO (0x19, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_RBAC", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ + 0, /* special_function */ + "R_RBAC", /* name */ + true, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + false), /* pcrel_offset */ /* Modifiable branch relative. */ - HOWTO (0x1a, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 26, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ + HOWTO (0x1a, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 26, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - 0, /* special_function */ - "R_RBR", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ + 0, /* special_function */ + "R_RBR", /* name */ + true, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + false), /* pcrel_offset */ /* Modifiable branch absolute. */ - HOWTO (0x1b, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ + HOWTO (0x1b, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_RBRC", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (0, /* type */ - 0, /* rightshift */ - 4, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_POS", /* name */ - true, /* partial_inplace */ - MINUS_ONE, /* src_mask */ - MINUS_ONE, /* dst_mask */ - false) /* pcrel_offset */ - + 0, /* special_function */ + "R_RBRC", /* name */ + true, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + false), /* pcrel_offset */ + + HOWTO (0, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + 0, /* special_function */ + "R_POS", /* name */ + true, /* partial_inplace */ + MINUS_ONE, /* src_mask */ + MINUS_ONE, /* dst_mask */ + false) /* pcrel_offset */ }; void @@ -1707,7 +1746,7 @@ xcoff64_rtype2howto (relent, internal) type matches this information. The bitsize is not significant for R_REF relocs. */ if (relent->howto->dst_mask != 0 - && (relent->howto->bitsize + && (relent->howto->bitsize != ((unsigned int) internal->r_size & 0x3f) + 1)) abort (); #if 0 @@ -1751,36 +1790,41 @@ xcoff64_slurp_armap (abfd) { file_ptr off; size_t namlen; - bfd_size_type sz; + bfd_size_type sz, amt; bfd_byte *contents, *cend; bfd_vma c, i; carsym *arsym; bfd_byte *p; + file_ptr pos; /* This is for the new format. */ struct xcoff_ar_hdr_big hdr; - if (xcoff_ardata (abfd) == NULL) { - bfd_has_map (abfd) = false; - return true; - } + if (xcoff_ardata (abfd) == NULL) + { + bfd_has_map (abfd) = false; + return true; + } off = strtol (xcoff_ardata_big (abfd)->symoff64, (char **) NULL, 10); - if (off == 0) { - bfd_has_map (abfd) = false; - return true; - } + if (off == 0) + { + bfd_has_map (abfd) = false; + return true; + } if (bfd_seek (abfd, off, SEEK_SET) != 0) return false; /* The symbol table starts with a normal archive header. */ - if (bfd_read ((PTR) &hdr, SIZEOF_AR_HDR_BIG, 1, abfd) != SIZEOF_AR_HDR_BIG) + if (bfd_bread ((PTR) &hdr, (bfd_size_type) SIZEOF_AR_HDR_BIG, abfd) + != SIZEOF_AR_HDR_BIG) return false; /* Skip the name (normally empty). */ namlen = strtol (hdr.namlen, (char **) NULL, 10); - if (bfd_seek (abfd, ((namlen + 1) & ~1) + SXCOFFARFMAG, SEEK_CUR) != 0) + pos = ((namlen + 1) & ~(size_t) 1) + SXCOFFARFMAG; + if (bfd_seek (abfd, pos, SEEK_CUR) != 0) return false; /* XXX This actually has to be a call to strtoll (at least on 32-bit @@ -1792,27 +1836,28 @@ xcoff64_slurp_armap (abfd) contents = (bfd_byte *) bfd_alloc (abfd, sz); if (contents == NULL) return false; - if (bfd_read ((PTR) contents, 1, sz, abfd) != sz) + if (bfd_bread ((PTR) contents, sz, abfd) != sz) return false; /* The symbol table starts with an eight byte count. */ - c = bfd_h_get_64 (abfd, contents); + c = H_GET_64 (abfd, contents); - if (c * 8 >= sz) { - bfd_set_error (bfd_error_bad_value); - return false; - } - - bfd_ardata (abfd)->symdefs = ((carsym *) - bfd_alloc (abfd, c * sizeof (carsym))); + if (c * 8 >= sz) + { + bfd_set_error (bfd_error_bad_value); + return false; + } + amt = c; + amt *= sizeof (carsym); + bfd_ardata (abfd)->symdefs = (carsym *) bfd_alloc (abfd, amt); if (bfd_ardata (abfd)->symdefs == NULL) return false; - + /* After the count comes a list of eight byte file offsets. */ for (i = 0, arsym = bfd_ardata (abfd)->symdefs, p = contents + 8; i < c; ++i, ++arsym, p += 8) - arsym->file_offset = bfd_h_get_64 (abfd, p); + arsym->file_offset = H_GET_64 (abfd, p); /* After the file offsets come null terminated symbol names. */ cend = contents + sz; @@ -1835,7 +1880,6 @@ xcoff64_slurp_armap (abfd) } - /* See if this is an NEW XCOFF archive. */ static const bfd_target * @@ -1845,23 +1889,26 @@ xcoff64_archive_p (abfd) char magic[SXCOFFARMAG]; /* This is the new format. */ struct xcoff_ar_file_hdr_big hdr; - - if (bfd_read ((PTR) magic, SXCOFFARMAG, 1, abfd) != SXCOFFARMAG) { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_wrong_format); - return NULL; - } + bfd_size_type amt = SXCOFFARMAG; - if (strncmp (magic, XCOFFARMAGBIG, SXCOFFARMAG) != 0) { - bfd_set_error (bfd_error_wrong_format); - return NULL; - } + if (bfd_bread ((PTR) magic, amt, abfd) != amt) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return NULL; + } + + if (strncmp (magic, XCOFFARMAGBIG, SXCOFFARMAG) != 0) + { + bfd_set_error (bfd_error_wrong_format); + return NULL; + } /* We are setting bfd_ardata(abfd) here, but since bfd_ardata involves a cast, we can't do it as the left operand of assignment. */ - abfd->tdata.aout_ar_data = - (struct artdata *) bfd_zalloc (abfd, sizeof (struct artdata)); + amt = sizeof (struct artdata); + abfd->tdata.aout_ar_data = (struct artdata *) bfd_zalloc (abfd, amt); if (bfd_ardata (abfd) == (struct artdata *) NULL) return NULL; @@ -1875,12 +1922,14 @@ xcoff64_archive_p (abfd) memcpy (hdr.magic, magic, SXCOFFARMAG); /* Now read the rest of the file header. */ - if (bfd_read ((PTR) &hdr.memoff, SIZEOF_AR_FILE_HDR_BIG - SXCOFFARMAG, 1, - abfd) != SIZEOF_AR_FILE_HDR_BIG - SXCOFFARMAG) { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_wrong_format); - return NULL; - } + if (bfd_bread ((PTR) &hdr.memoff, + (bfd_size_type) (SIZEOF_AR_FILE_HDR_BIG - SXCOFFARMAG), + abfd) != SIZEOF_AR_FILE_HDR_BIG - SXCOFFARMAG) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return NULL; + } /* XXX This actually has to be a call to strtoll (at least on 32-bit machines) since the field width is 20 and there numbers with more @@ -1888,18 +1937,19 @@ xcoff64_archive_p (abfd) bfd_ardata (abfd)->first_file_filepos = strtol (hdr.firstmemoff, (char **) NULL, 10); - bfd_ardata (abfd)->tdata = bfd_zalloc (abfd, SIZEOF_AR_FILE_HDR_BIG); + amt = SIZEOF_AR_FILE_HDR_BIG; + bfd_ardata (abfd)->tdata = bfd_zalloc (abfd, amt); if (bfd_ardata (abfd)->tdata == NULL) return NULL; - + memcpy (bfd_ardata (abfd)->tdata, &hdr, SIZEOF_AR_FILE_HDR_BIG); - if (! xcoff64_slurp_armap (abfd)) { - - bfd_release (abfd, bfd_ardata (abfd)); - abfd->tdata.aout_ar_data = (struct artdata *) NULL; - return NULL; - } + if (! xcoff64_slurp_armap (abfd)) + { + bfd_release (abfd, bfd_ardata (abfd)); + abfd->tdata.aout_ar_data = (struct artdata *) NULL; + return NULL; + } return abfd->xvec; } @@ -1914,21 +1964,25 @@ xcoff64_openr_next_archived_file (archiv { file_ptr filestart; - if ((xcoff_ardata (archive) == NULL) || - (! xcoff_big_format_p (archive))) { - bfd_set_error (bfd_error_invalid_operation); - return NULL; - } + if ((xcoff_ardata (archive) == NULL) + || ! xcoff_big_format_p (archive)) + { + bfd_set_error (bfd_error_invalid_operation); + return NULL; + } - if (last_file == NULL) { + if (last_file == NULL) + { filestart = bfd_ardata (archive)->first_file_filepos; - } else { - /* XXX These actually have to be a calls to strtoll (at least - on 32-bit machines) since the fields's width is 20 and - there numbers with more than 32 bits can be represented. */ - filestart = strtol (arch_xhdr_big (last_file)->nextoff, (char **) NULL, - 10); - } + } + else + { + /* XXX These actually have to be a calls to strtoll (at least + on 32-bit machines) since the fields's width is 20 and + there numbers with more than 32 bits can be represented. */ + filestart = strtol (arch_xhdr_big (last_file)->nextoff, (char **) NULL, + 10); + } /* XXX These actually have to be calls to strtoll (at least on 32-bit machines) since the fields's width is 20 and there numbers with more than 32 bits can be represented. */ @@ -1936,10 +1990,11 @@ xcoff64_openr_next_archived_file (archiv || filestart == strtol (xcoff_ardata_big (archive)->memoff, (char **) NULL, 10) || filestart == strtol (xcoff_ardata_big (archive)->symoff, - (char **) NULL, 10)) { - bfd_set_error (bfd_error_no_more_archived_files); - return NULL; - } + (char **) NULL, 10)) + { + bfd_set_error (bfd_error_no_more_archived_files); + return NULL; + } return _bfd_get_elt_at_filepos (archive, filestart); } @@ -1955,86 +2010,86 @@ xcoff64_sizeof_headers (abfd, reloc) { int size; - size = bfd_coff_filhsz(abfd); + size = bfd_coff_filhsz (abfd); - /* - * Don't think the small aout header can be used since some of the the - * old elements have been reordered past the end of the old coff - * small aout size - */ + /* Don't think the small aout header can be used since some of the the + old elements have been reordered past the end of the old coff + small aout size. */ if (xcoff_data (abfd)->full_aouthdr) - size += bfd_coff_aoutsz(abfd); + size += bfd_coff_aoutsz (abfd); - size += abfd->section_count * bfd_coff_scnhsz(abfd); + size += abfd->section_count * bfd_coff_scnhsz (abfd); return size; } static asection * -xcoff64_create_csect_from_smclas (abfd, aux, symbol_name) +xcoff64_create_csect_from_smclas (abfd, aux, symbol_name) bfd *abfd; union internal_auxent *aux; const char *symbol_name; { asection *return_value = NULL; - /* - * Changes from 32 : - * .sv == 8, is only for 32 bit programs - * .ti == 12 and .tb == 13 are now reserved - */ - static const char *names[19] = { + /* Changes from 32 : + .sv == 8, is only for 32 bit programs + .ti == 12 and .tb == 13 are now reserved. */ + static const char *names[19] = + { ".pr", ".ro", ".db", ".tc", ".ua", ".rw", ".gl", ".xo", NULL, ".bs", ".ds", ".uc", NULL, NULL, NULL, ".tc0", - ".td", ".sv64", ".sv3264" + ".td", ".sv64", ".sv3264" }; - if ((19 >= aux->x_csect.x_smclas) && - (NULL != names[aux->x_csect.x_smclas])) { + if ((19 >= aux->x_csect.x_smclas) + && (NULL != names[aux->x_csect.x_smclas])) + { - return_value = bfd_make_section_anyway - (abfd, names[aux->x_csect.x_smclas]); + return_value = bfd_make_section_anyway + (abfd, names[aux->x_csect.x_smclas]); - } else { - (*_bfd_error_handler) - (_("%s: symbol `%s' has unrecognized smclas %d"), - bfd_get_filename (abfd), symbol_name, aux->x_csect.x_smclas); - bfd_set_error (bfd_error_bad_value); - } + } + else + { + (*_bfd_error_handler) + (_("%s: symbol `%s' has unrecognized smclas %d"), + bfd_archive_filename (abfd), symbol_name, aux->x_csect.x_smclas); + bfd_set_error (bfd_error_bad_value); + } return return_value; } -static boolean +static boolean xcoff64_is_lineno_count_overflow (abfd, value) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_vma value ATTRIBUTE_UNUSED; + bfd *abfd ATTRIBUTE_UNUSED; + bfd_vma value ATTRIBUTE_UNUSED; { return false; } -static boolean +static boolean xcoff64_is_reloc_count_overflow (abfd, value) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_vma value ATTRIBUTE_UNUSED; + bfd *abfd ATTRIBUTE_UNUSED; + bfd_vma value ATTRIBUTE_UNUSED; { return false; } static bfd_vma xcoff64_loader_symbol_offset (abfd, ldhdr) - bfd *abfd ATTRIBUTE_UNUSED; - struct internal_ldhdr *ldhdr; + bfd *abfd ATTRIBUTE_UNUSED; + struct internal_ldhdr *ldhdr; { return (ldhdr->l_symoff); } static bfd_vma xcoff64_loader_reloc_offset (abfd, ldhdr) - bfd *abfd ATTRIBUTE_UNUSED; - struct internal_ldhdr *ldhdr; + bfd *abfd ATTRIBUTE_UNUSED; + struct internal_ldhdr *ldhdr; { return (ldhdr->l_rldoff); } @@ -2042,19 +2097,19 @@ xcoff64_loader_reloc_offset (abfd, ldhdr /* The typical dynamic reloc. */ static reloc_howto_type xcoff64_dynamic_reloc = - HOWTO (0, /* type */ - 0, /* rightshift */ - 4, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_POS", /* name */ - true, /* partial_inplace */ - MINUS_ONE, /* src_mask */ - MINUS_ONE, /* dst_mask */ - false); /* pcrel_offset */ +HOWTO (0, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + 0, /* special_function */ + "R_POS", /* name */ + true, /* partial_inplace */ + MINUS_ONE, /* src_mask */ + MINUS_ONE, /* dst_mask */ + false); /* pcrel_offset */ static unsigned long xcoff64_glink_code[10] = { @@ -2070,11 +2125,11 @@ static unsigned long xcoff64_glink_code[ 0x00000018, /* ??? */ }; -static const struct xcoff_backend_data_rec bfd_xcoff_backend_data = +static const struct xcoff_backend_data_rec bfd_xcoff_backend_data = { { /* COFF backend, defined in libcoff.h */ _bfd_xcoff64_swap_aux_in, /* _bfd_coff_swap_aux_in */ - _bfd_xcoff64_swap_sym_in, /* _bfd_coff_swap_sym_in */ + _bfd_xcoff64_swap_sym_in, /* _bfd_coff_swap_sym_in */ _bfd_xcoff64_swap_lineno_in, /* _bfd_coff_swap_lineno_in */ _bfd_xcoff64_swap_aux_out, /* _bfd_swap_aux_out */ _bfd_xcoff64_swap_sym_out, /* _bfd_swap_sym_out */ @@ -2112,7 +2167,7 @@ static const struct xcoff_backend_data_r dummy_reloc16_extra_cases, /* _bfd_coff_reloc16_extra_cases */ dummy_reloc16_estimate, /* _bfd_coff_reloc16_estimate */ NULL, /* bfd_coff_sym_is_global */ - /* _bfd_coff_compute_section_file_positions */ + /* _bfd_coff_compute_section_file_positions */ coff_compute_section_file_positions, NULL , /* _bfd_coff_start_final_link */ xcoff64_ppc_relocate_section, /* _bfd_coff_relocate_section */ @@ -2151,12 +2206,12 @@ static const struct xcoff_backend_data_r /* dynamic reloc howto */ &xcoff64_dynamic_reloc, - xcoff64_create_csect_from_smclas, + xcoff64_create_csect_from_smclas, /* lineno and reloc count overflow */ xcoff64_is_lineno_count_overflow, xcoff64_is_reloc_count_overflow, - + xcoff64_loader_symbol_offset, xcoff64_loader_reloc_offset, @@ -2183,7 +2238,7 @@ const bfd_target rs6000coff64_vec = '/', /* ar_pad_char */ 15, /* ar_max_namelen??? FIXMEmgo */ - /* data */ + /* data */ bfd_getb64, /* bfd_getx64 */ bfd_getb_signed_64, /* bfd_getx_signed_64 */ bfd_putb64, /* bfd_putx64 */ @@ -2192,9 +2247,9 @@ const bfd_target rs6000coff64_vec = bfd_putb32, /* bfd_putx32 */ bfd_getb16, /* bfd_getx16 */ bfd_getb_signed_16, /* bfd_getx_signed_16 */ - bfd_putb16, /* bfd_putx16 */ + bfd_putb16, /* bfd_putx16 */ - /* hdrs */ + /* hdrs */ bfd_getb64, /* bfd_h_getx64 */ bfd_getb_signed_64, /* bfd_h_getx_signed_64 */ bfd_putb64, /* bfd_h_putx64 */ @@ -2204,43 +2259,43 @@ const bfd_target rs6000coff64_vec = bfd_getb16, /* bfd_h_getx16 */ bfd_getb_signed_16, /* bfd_h_getx_signed_16 */ bfd_putb16, /* bfd_h_putx16 */ - + { /* bfd_check_format */ - _bfd_dummy_target, - coff_object_p, - xcoff64_archive_p, - CORE_FILE_P + _bfd_dummy_target, + coff_object_p, + xcoff64_archive_p, + CORE_FILE_P }, - + { /* bfd_set_format */ - bfd_false, + bfd_false, coff_mkobject, - _bfd_generic_mkarchive, + _bfd_generic_mkarchive, bfd_false }, - + {/* bfd_write_contents */ - bfd_false, + bfd_false, xcoff64_write_object_contents, - _bfd_xcoff_write_archive_contents, + _bfd_xcoff_write_archive_contents, bfd_false }, - + /* Generic */ bfd_true, /* _close_and_cleanup */ bfd_true, /* _bfd_free_cached_info */ coff_new_section_hook, /* _new_section_hook */ _bfd_generic_get_section_contents, /* _bfd_get_section_contents */ - /* _bfd_get_section_contents_in_window */ - _bfd_generic_get_section_contents_in_window, + /* _bfd_get_section_contents_in_window */ + _bfd_generic_get_section_contents_in_window, /* Copy */ _bfd_xcoff_copy_private_bfd_data, /* _bfd_copy_private_bfd */ - /* _bfd_merge_private_bfd_data */ + /* _bfd_merge_private_bfd_data */ ((boolean (*) (bfd *, bfd *)) bfd_true), - /* _bfd_copy_pivate_section_data */ + /* _bfd_copy_pivate_section_data */ ((boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true), - /* _bfd_copy_private_symbol_data */ + /* _bfd_copy_private_symbol_data */ ((boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true), ((boolean (*) (bfd *, flagword)) bfd_true), /* _bfd_set_private_flags */ ((boolean (*) (bfd *, void * )) bfd_true), /* _bfd_print_private_bfd_data */ @@ -2248,16 +2303,16 @@ const bfd_target rs6000coff64_vec = /* Core */ coff_core_file_failing_command, /* _core_file_failing_command */ coff_core_file_failing_signal, /* _core_file_failing_signal */ - /* _core_file_matches_executable_p */ - coff_core_file_matches_executable_p, + /* _core_file_matches_executable_p */ + coff_core_file_matches_executable_p, /* Archive */ xcoff64_slurp_armap, /* _slurp_armap */ - /* XCOFF archives do not have - anything which corresponds to - an extended name table. */ + /* XCOFF archives do not have + anything which corresponds to + an extended name table. */ bfd_false, /* _slurp_extended_name_table */ - /* _construct_extended_name_table */ + /* _construct_extended_name_table */ ((boolean (*) (bfd *, char **, bfd_size_type *, const char **)) bfd_false), bfd_dont_truncate_arname, /* _truncate_arname */ _bfd_xcoff_write_armap, /* _write_armap */ @@ -2265,8 +2320,8 @@ const bfd_target rs6000coff64_vec = xcoff64_openr_next_archived_file, /* _openr_next_archived_file */ _bfd_generic_get_elt_at_index, /* _get_elt_at_index */ _bfd_xcoff_generic_stat_arch_elt, /* _generic_dtat_arch_elt */ - /* XCOFF archives do not have - a timestamp. */ + /* XCOFF archives do not have + a timestamp. */ bfd_true, /* _update_armap_timestamp */ /* Symbols */ @@ -2293,7 +2348,7 @@ const bfd_target rs6000coff64_vec = /* Link */ xcoff64_sizeof_headers, /* _sizeof_headers */ - /* _bfd_get_relocated_section_contents */ + /* _bfd_get_relocated_section_contents */ bfd_generic_get_relocated_section_contents, bfd_generic_relax_section, /* _bfd_relax_section */ _bfd_xcoff_bfd_link_hash_table_create, /* _bfd_link_hash_table_create */ @@ -2304,15 +2359,15 @@ const bfd_target rs6000coff64_vec = bfd_generic_merge_sections, /* _bfd_merge_sections */ /* Dynamic */ - /* _get_dynamic_symtab_upper_bound */ - _bfd_xcoff_get_dynamic_symtab_upper_bound, + /* _get_dynamic_symtab_upper_bound */ + _bfd_xcoff_get_dynamic_symtab_upper_bound, _bfd_xcoff_canonicalize_dynamic_symtab, /* _cononicalize_dynamic_symtab */ _bfd_xcoff_get_dynamic_reloc_upper_bound,/* _get_dynamic_reloc_upper_bound */ _bfd_xcoff_canonicalize_dynamic_reloc, /* _cononicalize_dynamic_reloc */ /* Opposite endian version, none exists */ NULL, - + /* back end data */ (void *) &bfd_xcoff_backend_data, }; diff -uprN binutils-2.11.90.0.31/bfd/coffcode.h binutils-2.11.92.0.5/bfd/coffcode.h --- binutils-2.11.90.0.31/bfd/coffcode.h Wed Aug 22 08:52:09 2001 +++ binutils-2.11.92.0.5/bfd/coffcode.h Mon Oct 1 15:25:21 2001 @@ -248,39 +248,37 @@ CODE_FRAGMENT . .typedef struct coff_ptr_struct .{ -. -. {* Remembers the offset from the first symbol in the file for -. this symbol. Generated by coff_renumber_symbols. *} -.unsigned int offset; -. -. {* Should the value of this symbol be renumbered. Used for -. XCOFF C_BSTAT symbols. Set by coff_slurp_symbol_table. *} -.unsigned int fix_value : 1; -. -. {* Should the tag field of this symbol be renumbered. -. Created by coff_pointerize_aux. *} -.unsigned int fix_tag : 1; -. -. {* Should the endidx field of this symbol be renumbered. -. Created by coff_pointerize_aux. *} -.unsigned int fix_end : 1; -. -. {* Should the x_csect.x_scnlen field be renumbered. -. Created by coff_pointerize_aux. *} -.unsigned int fix_scnlen : 1; -. -. {* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the -. index into the line number entries. Set by -. coff_slurp_symbol_table. *} -.unsigned int fix_line : 1; -. -. {* The container for the symbol structure as read and translated -. from the file. *} -. -.union { -. union internal_auxent auxent; -. struct internal_syment syment; -. } u; +. {* Remembers the offset from the first symbol in the file for +. this symbol. Generated by coff_renumber_symbols. *} +. unsigned int offset; +. +. {* Should the value of this symbol be renumbered. Used for +. XCOFF C_BSTAT symbols. Set by coff_slurp_symbol_table. *} +. unsigned int fix_value : 1; +. +. {* Should the tag field of this symbol be renumbered. +. Created by coff_pointerize_aux. *} +. unsigned int fix_tag : 1; +. +. {* Should the endidx field of this symbol be renumbered. +. Created by coff_pointerize_aux. *} +. unsigned int fix_end : 1; +. +. {* Should the x_csect.x_scnlen field be renumbered. +. Created by coff_pointerize_aux. *} +. unsigned int fix_scnlen : 1; +. +. {* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the +. index into the line number entries. Set by coff_slurp_symbol_table. *} +. unsigned int fix_line : 1; +. +. {* The container for the symbol structure as read and translated +. from the file. *} +. union +. { +. union internal_auxent auxent; +. struct internal_syment syment; +. } u; .} combined_entry_type; . . @@ -288,17 +286,17 @@ CODE_FRAGMENT . .typedef struct coff_symbol_struct .{ -. {* The actual symbol which the rest of BFD works with *} -.asymbol symbol; +. {* The actual symbol which the rest of BFD works with *} +. asymbol symbol; . -. {* A pointer to the hidden information for this symbol *} -.combined_entry_type *native; +. {* A pointer to the hidden information for this symbol *} +. combined_entry_type *native; . -. {* A pointer to the linenumber information for this symbol *} -.struct lineno_cache_entry *lineno; +. {* A pointer to the linenumber information for this symbol *} +. struct lineno_cache_entry *lineno; . -. {* Have the line numbers been relocated yet ? *} -.boolean done_lineno; +. {* Have the line numbers been relocated yet ? *} +. boolean done_lineno; .} coff_symbol_type; */ @@ -324,12 +322,12 @@ static boolean coff_write_relocs PARAMS static boolean coff_set_flags PARAMS ((bfd *, unsigned int *, unsigned short *)); static boolean coff_set_arch_mach - PARAMS ((bfd *, enum bfd_architecture, unsigned long)); + PARAMS ((bfd *, enum bfd_architecture, unsigned long)) ATTRIBUTE_UNUSED; static boolean coff_compute_section_file_positions PARAMS ((bfd *)); static boolean coff_write_object_contents PARAMS ((bfd *)) ATTRIBUTE_UNUSED; static boolean coff_set_section_contents PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); -static PTR buy_and_read PARAMS ((bfd *, file_ptr, int, size_t)); +static PTR buy_and_read PARAMS ((bfd *, file_ptr, bfd_size_type)); static boolean coff_slurp_line_table PARAMS ((bfd *, asection *)); static boolean coff_slurp_symbol_table PARAMS ((bfd *)); static enum coff_symbol_classification coff_classify_symbol @@ -368,7 +366,7 @@ static flagword handle_COMDAT PARAMS ((b static long sec_to_styp_flags (sec_name, sec_flags) - CONST char *sec_name; + const char *sec_name; flagword sec_flags; { long styp_flags = 0; @@ -508,7 +506,7 @@ sec_to_styp_flags (sec_name, sec_flags) if ((sec_flags & SEC_ALLOC) != 0 && (sec_flags & SEC_LOAD) == 0) styp_flags |= IMAGE_SCN_CNT_UNINITIALIZED_DATA; /* ==STYP_BSS */ /* skip ROM */ - /* skip CONSTRUCTOR */ + /* skip constRUCTOR */ /* skip CONTENTS */ #ifdef STYP_NOLOAD if ((sec_flags & (SEC_NEVER_LOAD | SEC_COFF_SHARED_LIBRARY)) != 0) @@ -730,7 +728,7 @@ handle_COMDAT (abfd, sec_flags, hdr, nam if (! _bfd_coff_get_external_symbols (abfd)) return sec_flags; - + esymstart = esym = (bfd_byte *) obj_coff_external_syms (abfd); esymend = esym + obj_raw_syment_count (abfd) * bfd_coff_symesz (abfd); @@ -917,21 +915,23 @@ handle_COMDAT (abfd, sec_flags, hdr, nam drop through from the above). */ { char *newname; + bfd_size_type amt; /* This must the the second symbol with the section #. It is the actual symbol name. Intel puts the two adjacent, but Alpha (at least) spreads them out. */ - section->comdat = - bfd_alloc (abfd, sizeof (struct bfd_comdat_info)); + amt = sizeof (struct bfd_comdat_info); + section->comdat = bfd_alloc (abfd, amt); if (section->comdat == NULL) abort (); section->comdat->symbol = (esym - esymstart) / bfd_coff_symesz (abfd); - newname = bfd_alloc (abfd, strlen (symname) + 1); + amt = strlen (symname) + 1; + newname = bfd_alloc (abfd, amt); if (newname == NULL) abort (); @@ -981,7 +981,7 @@ styp_to_sec_flags (abfd, hdr, name, sect { long flag = styp_flags & - styp_flags; char * unhandled = NULL; - + styp_flags &= ~ flag; /* We infer from the distinct read/write/execute bits the settings @@ -1006,7 +1006,7 @@ styp_to_sec_flags (abfd, hdr, name, sect case STYP_NOLOAD: sec_flags |= SEC_NEVER_LOAD; break; -#endif +#endif case IMAGE_SCN_MEM_READ: /* Ignored, assume it always to be true. */ break; @@ -1063,7 +1063,7 @@ styp_to_sec_flags (abfd, hdr, name, sect break; default: /* Silently ignore for now. */ - break; + break; } /* If the section flag was not handled, report it here. */ @@ -1071,7 +1071,7 @@ styp_to_sec_flags (abfd, hdr, name, sect { (*_bfd_error_handler) (_("%s (%s): Section flag %s (0x%x) ignored"), - bfd_get_filename (abfd), name, unhandled, flag); + bfd_archive_filename (abfd), name, unhandled, flag); result = false; } } @@ -1089,7 +1089,7 @@ styp_to_sec_flags (abfd, hdr, name, sect if (flags_ptr) * flags_ptr = sec_flags; - + return result; } @@ -1122,235 +1122,166 @@ CODE_FRAGMENT Special entry points for gdb to swap in coff symbol table parts: .typedef struct .{ -. void (*_bfd_coff_swap_aux_in) PARAMS (( -. bfd *abfd, -. PTR ext, -. int type, -. int class, -. int indaux, -. int numaux, -. PTR in)); -. -. void (*_bfd_coff_swap_sym_in) PARAMS (( -. bfd *abfd , -. PTR ext, -. PTR in)); -. -. void (*_bfd_coff_swap_lineno_in) PARAMS (( -. bfd *abfd, -. PTR ext, -. PTR in)); -. - -Special entry points for gas to swap out coff parts: - -. unsigned int (*_bfd_coff_swap_aux_out) PARAMS (( -. bfd *abfd, -. PTR in, -. int type, -. int class, -. int indaux, -. int numaux, -. PTR ext)); -. -. unsigned int (*_bfd_coff_swap_sym_out) PARAMS (( -. bfd *abfd, -. PTR in, -. PTR ext)); -. -. unsigned int (*_bfd_coff_swap_lineno_out) PARAMS (( -. bfd *abfd, -. PTR in, -. PTR ext)); -. -. unsigned int (*_bfd_coff_swap_reloc_out) PARAMS (( -. bfd *abfd, -. PTR src, -. PTR dst)); -. -. unsigned int (*_bfd_coff_swap_filehdr_out) PARAMS (( -. bfd *abfd, -. PTR in, -. PTR out)); -. -. unsigned int (*_bfd_coff_swap_aouthdr_out) PARAMS (( -. bfd *abfd, -. PTR in, -. PTR out)); -. -. unsigned int (*_bfd_coff_swap_scnhdr_out) PARAMS (( -. bfd *abfd, -. PTR in, -. PTR out)); -. - -Special entry points for generic COFF routines to call target -dependent COFF routines: - -. unsigned int _bfd_filhsz; -. unsigned int _bfd_aoutsz; -. unsigned int _bfd_scnhsz; -. unsigned int _bfd_symesz; -. unsigned int _bfd_auxesz; -. unsigned int _bfd_relsz; -. unsigned int _bfd_linesz; -. unsigned int _bfd_filnmlen; -. boolean _bfd_coff_long_filenames; -. boolean _bfd_coff_long_section_names; -. unsigned int _bfd_coff_default_section_alignment_power; -. boolean _bfd_coff_force_symnames_in_strings; -. unsigned int _bfd_coff_debug_string_prefix_length; -. void (*_bfd_coff_swap_filehdr_in) PARAMS (( -. bfd *abfd, -. PTR ext, -. PTR in)); -. void (*_bfd_coff_swap_aouthdr_in) PARAMS (( -. bfd *abfd, -. PTR ext, -. PTR in)); -. void (*_bfd_coff_swap_scnhdr_in) PARAMS (( -. bfd *abfd, -. PTR ext, -. PTR in)); -. void (*_bfd_coff_swap_reloc_in) PARAMS (( -. bfd *abfd, -. PTR ext, -. PTR in)); -. boolean (*_bfd_coff_bad_format_hook) PARAMS (( -. bfd *abfd, -. PTR internal_filehdr)); -. boolean (*_bfd_coff_set_arch_mach_hook) PARAMS (( -. bfd *abfd, -. PTR internal_filehdr)); -. PTR (*_bfd_coff_mkobject_hook) PARAMS (( -. bfd *abfd, -. PTR internal_filehdr, -. PTR internal_aouthdr)); -. boolean (*_bfd_styp_to_sec_flags_hook) PARAMS (( -. bfd *abfd, -. PTR internal_scnhdr, -. const char *name, -. asection *section, -. flagword *flags_ptr)); -. void (*_bfd_set_alignment_hook) PARAMS (( -. bfd *abfd, -. asection *sec, -. PTR internal_scnhdr)); -. boolean (*_bfd_coff_slurp_symbol_table) PARAMS (( -. bfd *abfd)); -. boolean (*_bfd_coff_symname_in_debug) PARAMS (( -. bfd *abfd, -. struct internal_syment *sym)); -. boolean (*_bfd_coff_pointerize_aux_hook) PARAMS (( -. bfd *abfd, -. combined_entry_type *table_base, -. combined_entry_type *symbol, -. unsigned int indaux, -. combined_entry_type *aux)); -. boolean (*_bfd_coff_print_aux) PARAMS (( -. bfd *abfd, -. FILE *file, -. combined_entry_type *table_base, -. combined_entry_type *symbol, -. combined_entry_type *aux, -. unsigned int indaux)); -. void (*_bfd_coff_reloc16_extra_cases) PARAMS (( -. bfd *abfd, -. struct bfd_link_info *link_info, -. struct bfd_link_order *link_order, -. arelent *reloc, -. bfd_byte *data, -. unsigned int *src_ptr, -. unsigned int *dst_ptr)); -. int (*_bfd_coff_reloc16_estimate) PARAMS (( -. bfd *abfd, -. asection *input_section, -. arelent *r, -. unsigned int shrink, -. struct bfd_link_info *link_info)); -. enum coff_symbol_classification (*_bfd_coff_classify_symbol) PARAMS (( -. bfd *abfd, -. struct internal_syment *)); -. boolean (*_bfd_coff_compute_section_file_positions) PARAMS (( -. bfd *abfd)); -. boolean (*_bfd_coff_start_final_link) PARAMS (( -. bfd *output_bfd, -. struct bfd_link_info *info)); -. boolean (*_bfd_coff_relocate_section) PARAMS (( -. bfd *output_bfd, -. struct bfd_link_info *info, -. bfd *input_bfd, -. asection *input_section, -. bfd_byte *contents, -. struct internal_reloc *relocs, -. struct internal_syment *syms, -. asection **sections)); -. reloc_howto_type *(*_bfd_coff_rtype_to_howto) PARAMS (( -. bfd *abfd, -. asection *sec, -. struct internal_reloc *rel, -. struct coff_link_hash_entry *h, -. struct internal_syment *sym, -. bfd_vma *addendp)); -. boolean (*_bfd_coff_adjust_symndx) PARAMS (( -. bfd *obfd, -. struct bfd_link_info *info, -. bfd *ibfd, -. asection *sec, -. struct internal_reloc *reloc, -. boolean *adjustedp)); -. boolean (*_bfd_coff_link_add_one_symbol) PARAMS (( -. struct bfd_link_info *info, -. bfd *abfd, -. const char *name, -. flagword flags, -. asection *section, -. bfd_vma value, -. const char *string, -. boolean copy, -. boolean collect, -. struct bfd_link_hash_entry **hashp)); -. -. boolean (*_bfd_coff_link_output_has_begun) PARAMS (( -. bfd * abfd, -. struct coff_final_link_info * pfinfo)); -. boolean (*_bfd_coff_final_link_postscript) PARAMS (( -. bfd * abfd, -. struct coff_final_link_info * pfinfo)); +. void (*_bfd_coff_swap_aux_in) +. PARAMS ((bfd *, PTR, int, int, int, int, PTR)); +. +. void (*_bfd_coff_swap_sym_in) +. PARAMS ((bfd *, PTR, PTR)); +. +. void (*_bfd_coff_swap_lineno_in) +. PARAMS ((bfd *, PTR, PTR)); +. +. unsigned int (*_bfd_coff_swap_aux_out) +. PARAMS ((bfd *, PTR, int, int, int, int, PTR)); +. +. unsigned int (*_bfd_coff_swap_sym_out) +. PARAMS ((bfd *, PTR, PTR)); +. +. unsigned int (*_bfd_coff_swap_lineno_out) +. PARAMS ((bfd *, PTR, PTR)); +. +. unsigned int (*_bfd_coff_swap_reloc_out) +. PARAMS ((bfd *, PTR, PTR)); +. +. unsigned int (*_bfd_coff_swap_filehdr_out) +. PARAMS ((bfd *, PTR, PTR)); +. +. unsigned int (*_bfd_coff_swap_aouthdr_out) +. PARAMS ((bfd *, PTR, PTR)); +. +. unsigned int (*_bfd_coff_swap_scnhdr_out) +. PARAMS ((bfd *, PTR, PTR)); +. +. unsigned int _bfd_filhsz; +. unsigned int _bfd_aoutsz; +. unsigned int _bfd_scnhsz; +. unsigned int _bfd_symesz; +. unsigned int _bfd_auxesz; +. unsigned int _bfd_relsz; +. unsigned int _bfd_linesz; +. unsigned int _bfd_filnmlen; +. boolean _bfd_coff_long_filenames; +. boolean _bfd_coff_long_section_names; +. unsigned int _bfd_coff_default_section_alignment_power; +. boolean _bfd_coff_force_symnames_in_strings; +. unsigned int _bfd_coff_debug_string_prefix_length; +. +. void (*_bfd_coff_swap_filehdr_in) +. PARAMS ((bfd *, PTR, PTR)); +. +. void (*_bfd_coff_swap_aouthdr_in) +. PARAMS ((bfd *, PTR, PTR)); +. +. void (*_bfd_coff_swap_scnhdr_in) +. PARAMS ((bfd *, PTR, PTR)); +. +. void (*_bfd_coff_swap_reloc_in) +. PARAMS ((bfd *abfd, PTR, PTR)); +. +. boolean (*_bfd_coff_bad_format_hook) +. PARAMS ((bfd *, PTR)); +. +. boolean (*_bfd_coff_set_arch_mach_hook) +. PARAMS ((bfd *, PTR)); +. +. PTR (*_bfd_coff_mkobject_hook) +. PARAMS ((bfd *, PTR, PTR)); +. +. boolean (*_bfd_styp_to_sec_flags_hook) +. PARAMS ((bfd *, PTR, const char *, asection *, flagword *)); +. +. void (*_bfd_set_alignment_hook) +. PARAMS ((bfd *, asection *, PTR)); +. +. boolean (*_bfd_coff_slurp_symbol_table) +. PARAMS ((bfd *)); +. +. boolean (*_bfd_coff_symname_in_debug) +. PARAMS ((bfd *, struct internal_syment *)); +. +. boolean (*_bfd_coff_pointerize_aux_hook) +. PARAMS ((bfd *, combined_entry_type *, combined_entry_type *, +. unsigned int, combined_entry_type *)); +. +. boolean (*_bfd_coff_print_aux) +. PARAMS ((bfd *, FILE *, combined_entry_type *, combined_entry_type *, +. combined_entry_type *, unsigned int)); +. +. void (*_bfd_coff_reloc16_extra_cases) +. PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *, +. bfd_byte *, unsigned int *, unsigned int *)); +. +. int (*_bfd_coff_reloc16_estimate) +. PARAMS ((bfd *, asection *, arelent *, unsigned int, +. struct bfd_link_info *)); +. +. enum coff_symbol_classification (*_bfd_coff_classify_symbol) +. PARAMS ((bfd *, struct internal_syment *)); +. +. boolean (*_bfd_coff_compute_section_file_positions) +. PARAMS ((bfd *)); +. +. boolean (*_bfd_coff_start_final_link) +. PARAMS ((bfd *, struct bfd_link_info *)); +. +. boolean (*_bfd_coff_relocate_section) +. PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, +. struct internal_reloc *, struct internal_syment *, asection **)); +. +. reloc_howto_type *(*_bfd_coff_rtype_to_howto) +. PARAMS ((bfd *, asection *, struct internal_reloc *, +. struct coff_link_hash_entry *, struct internal_syment *, +. bfd_vma *)); +. +. boolean (*_bfd_coff_adjust_symndx)\ +. PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, +. struct internal_reloc *, boolean *)); +. +. boolean (*_bfd_coff_link_add_one_symbol) +. PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword, +. asection *, bfd_vma, const char *, boolean, boolean, +. struct bfd_link_hash_entry **)); +. +. boolean (*_bfd_coff_link_output_has_begun) +. PARAMS ((bfd *, struct coff_final_link_info *)); +. +. boolean (*_bfd_coff_final_link_postscript) +. PARAMS ((bfd *, struct coff_final_link_info *)); . .} bfd_coff_backend_data; . -.#define coff_backend_info(abfd) ((bfd_coff_backend_data *) (abfd)->xvec->backend_data) +.#define coff_backend_info(abfd) \ +. ((bfd_coff_backend_data *) (abfd)->xvec->backend_data) . .#define bfd_coff_swap_aux_in(a,e,t,c,ind,num,i) \ -. ((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i)) +. ((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i)) . .#define bfd_coff_swap_sym_in(a,e,i) \ -. ((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i)) +. ((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i)) . .#define bfd_coff_swap_lineno_in(a,e,i) \ -. ((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i)) +. ((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i)) . .#define bfd_coff_swap_reloc_out(abfd, i, o) \ -. ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o)) +. ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o)) . .#define bfd_coff_swap_lineno_out(abfd, i, o) \ -. ((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o)) +. ((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o)) . .#define bfd_coff_swap_aux_out(a,i,t,c,ind,num,o) \ -. ((coff_backend_info (a)->_bfd_coff_swap_aux_out) (a,i,t,c,ind,num,o)) +. ((coff_backend_info (a)->_bfd_coff_swap_aux_out) (a,i,t,c,ind,num,o)) . .#define bfd_coff_swap_sym_out(abfd, i,o) \ -. ((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o)) +. ((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o)) . .#define bfd_coff_swap_scnhdr_out(abfd, i,o) \ -. ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o)) +. ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o)) . .#define bfd_coff_swap_filehdr_out(abfd, i,o) \ -. ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o)) +. ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o)) . .#define bfd_coff_swap_aouthdr_out(abfd, i,o) \ -. ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o)) +. ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o)) . .#define bfd_coff_filhsz(abfd) (coff_backend_info (abfd)->_bfd_filhsz) .#define bfd_coff_aoutsz(abfd) (coff_backend_info (abfd)->_bfd_aoutsz) @@ -1360,90 +1291,91 @@ dependent COFF routines: .#define bfd_coff_relsz(abfd) (coff_backend_info (abfd)->_bfd_relsz) .#define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz) .#define bfd_coff_filnmlen(abfd) (coff_backend_info (abfd)->_bfd_filnmlen) -.#define bfd_coff_long_filenames(abfd) (coff_backend_info (abfd)->_bfd_coff_long_filenames) +.#define bfd_coff_long_filenames(abfd) \ +. (coff_backend_info (abfd)->_bfd_coff_long_filenames) .#define bfd_coff_long_section_names(abfd) \ -. (coff_backend_info (abfd)->_bfd_coff_long_section_names) +. (coff_backend_info (abfd)->_bfd_coff_long_section_names) .#define bfd_coff_default_section_alignment_power(abfd) \ -. (coff_backend_info (abfd)->_bfd_coff_default_section_alignment_power) +. (coff_backend_info (abfd)->_bfd_coff_default_section_alignment_power) .#define bfd_coff_swap_filehdr_in(abfd, i,o) \ -. ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o)) +. ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o)) . .#define bfd_coff_swap_aouthdr_in(abfd, i,o) \ -. ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o)) +. ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o)) . .#define bfd_coff_swap_scnhdr_in(abfd, i,o) \ -. ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o)) +. ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o)) . .#define bfd_coff_swap_reloc_in(abfd, i, o) \ -. ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_in) (abfd, i, o)) +. ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_in) (abfd, i, o)) . .#define bfd_coff_bad_format_hook(abfd, filehdr) \ -. ((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr)) +. ((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr)) . .#define bfd_coff_set_arch_mach_hook(abfd, filehdr)\ -. ((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr)) +. ((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr)) .#define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\ -. ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook) (abfd, filehdr, aouthdr)) +. ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook) (abfd, filehdr, aouthdr)) . .#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name, section, flags_ptr)\ -. ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook)\ -. (abfd, scnhdr, name, section, flags_ptr)) +. ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook)\ +. (abfd, scnhdr, name, section, flags_ptr)) . .#define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\ -. ((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr)) +. ((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr)) . .#define bfd_coff_slurp_symbol_table(abfd)\ -. ((coff_backend_info (abfd)->_bfd_coff_slurp_symbol_table) (abfd)) +. ((coff_backend_info (abfd)->_bfd_coff_slurp_symbol_table) (abfd)) . .#define bfd_coff_symname_in_debug(abfd, sym)\ -. ((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym)) +. ((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym)) . .#define bfd_coff_force_symnames_in_strings(abfd)\ -. (coff_backend_info (abfd)->_bfd_coff_force_symnames_in_strings) +. (coff_backend_info (abfd)->_bfd_coff_force_symnames_in_strings) . .#define bfd_coff_debug_string_prefix_length(abfd)\ -. (coff_backend_info (abfd)->_bfd_coff_debug_string_prefix_length) +. (coff_backend_info (abfd)->_bfd_coff_debug_string_prefix_length) . .#define bfd_coff_print_aux(abfd, file, base, symbol, aux, indaux)\ -. ((coff_backend_info (abfd)->_bfd_coff_print_aux)\ -. (abfd, file, base, symbol, aux, indaux)) +. ((coff_backend_info (abfd)->_bfd_coff_print_aux)\ +. (abfd, file, base, symbol, aux, indaux)) . .#define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)\ -. ((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\ -. (abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)) +. ((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\ +. (abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)) . .#define bfd_coff_reloc16_estimate(abfd, section, reloc, shrink, link_info)\ -. ((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\ -. (abfd, section, reloc, shrink, link_info)) +. ((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\ +. (abfd, section, reloc, shrink, link_info)) . .#define bfd_coff_classify_symbol(abfd, sym)\ -. ((coff_backend_info (abfd)->_bfd_coff_classify_symbol)\ -. (abfd, sym)) +. ((coff_backend_info (abfd)->_bfd_coff_classify_symbol)\ +. (abfd, sym)) . .#define bfd_coff_compute_section_file_positions(abfd)\ -. ((coff_backend_info (abfd)->_bfd_coff_compute_section_file_positions)\ -. (abfd)) +. ((coff_backend_info (abfd)->_bfd_coff_compute_section_file_positions)\ +. (abfd)) . .#define bfd_coff_start_final_link(obfd, info)\ -. ((coff_backend_info (obfd)->_bfd_coff_start_final_link)\ -. (obfd, info)) +. ((coff_backend_info (obfd)->_bfd_coff_start_final_link)\ +. (obfd, info)) .#define bfd_coff_relocate_section(obfd,info,ibfd,o,con,rel,isyms,secs)\ -. ((coff_backend_info (ibfd)->_bfd_coff_relocate_section)\ -. (obfd, info, ibfd, o, con, rel, isyms, secs)) +. ((coff_backend_info (ibfd)->_bfd_coff_relocate_section)\ +. (obfd, info, ibfd, o, con, rel, isyms, secs)) .#define bfd_coff_rtype_to_howto(abfd, sec, rel, h, sym, addendp)\ -. ((coff_backend_info (abfd)->_bfd_coff_rtype_to_howto)\ -. (abfd, sec, rel, h, sym, addendp)) +. ((coff_backend_info (abfd)->_bfd_coff_rtype_to_howto)\ +. (abfd, sec, rel, h, sym, addendp)) .#define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\ -. ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\ -. (obfd, info, ibfd, sec, rel, adjustedp)) +. ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\ +. (obfd, info, ibfd, sec, rel, adjustedp)) .#define bfd_coff_link_add_one_symbol(info,abfd,name,flags,section,value,string,cp,coll,hashp)\ -. ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\ -. (info, abfd, name, flags, section, value, string, cp, coll, hashp)) +. ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\ +. (info, abfd, name, flags, section, value, string, cp, coll, hashp)) . .#define bfd_coff_link_output_has_begun(a,p) \ -. ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a,p)) +. ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a,p)) .#define bfd_coff_final_link_postscript(a,p) \ -. ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a,p)) +. ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a,p)) . */ @@ -1506,7 +1438,10 @@ coff_set_custom_section_alignment (abfd, return; if (alignment_table[i].default_alignment_max != COFF_ALIGNMENT_FIELD_EMPTY - && default_alignment > alignment_table[i].default_alignment_max) +#if COFF_DEFAULT_SECTION_ALIGNMENT_POWER != 0 + && default_alignment > alignment_table[i].default_alignment_max +#endif + ) return; section->alignment_power = alignment_table[i].alignment_power; @@ -1545,6 +1480,7 @@ coff_new_section_hook (abfd, section) asection * section; { combined_entry_type *native; + bfd_size_type amt; section->alignment_power = COFF_DEFAULT_SECTION_ALIGNMENT_POWER; @@ -1562,8 +1498,8 @@ coff_new_section_hook (abfd, section) @@ The 10 is a guess at a plausible maximum number of aux entries (but shouldn't be a constant). */ - native = ((combined_entry_type *) - bfd_zalloc (abfd, sizeof (combined_entry_type) * 10)); + amt = sizeof (combined_entry_type) * 10; + native = (combined_entry_type *) bfd_zalloc (abfd, amt); if (native == NULL) return false; @@ -1645,6 +1581,7 @@ coff_set_alignment_hook (abfd, section, PTR scnhdr; { struct internal_scnhdr *hdr = (struct internal_scnhdr *) scnhdr; + bfd_size_type amt; ALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_64BYTES, 6) ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_32BYTES, 5) @@ -1660,8 +1597,8 @@ coff_set_alignment_hook (abfd, section, mapped onto a generic BFD section bit. */ if (coff_section_data (abfd, section) == NULL) { - section->used_by_bfd = - (PTR) bfd_zalloc (abfd, sizeof (struct coff_section_tdata)); + amt = sizeof (struct coff_section_tdata); + section->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); if (section->used_by_bfd == NULL) { /* FIXME: Return error. */ @@ -1670,8 +1607,8 @@ coff_set_alignment_hook (abfd, section, } if (pei_section_data (abfd, section) == NULL) { - coff_section_data (abfd, section)->tdata = - (PTR) bfd_zalloc (abfd, sizeof (struct pei_section_tdata)); + amt = sizeof (struct pei_section_tdata); + coff_section_data (abfd, section)->tdata = (PTR) bfd_zalloc (abfd, amt); if (coff_section_data (abfd, section)->tdata == NULL) { /* FIXME: Return error. */ @@ -1688,16 +1625,15 @@ coff_set_alignment_hook (abfd, section, { struct external_reloc dst; struct internal_reloc n; - int oldpos = bfd_tell (abfd); - bfd_seek (abfd, hdr->s_relptr, 0); - if (bfd_read ((PTR) & dst, 1, bfd_coff_relsz (abfd), abfd) + file_ptr oldpos = bfd_tell (abfd); + bfd_seek (abfd, (file_ptr) hdr->s_relptr, 0); + if (bfd_bread ((PTR) &dst, (bfd_size_type) bfd_coff_relsz (abfd), abfd) != bfd_coff_relsz (abfd)) return; coff_swap_reloc_in (abfd, &dst, &n); bfd_seek (abfd, oldpos, 0); - section->reloc_count = - hdr->s_nreloc = n.r_vaddr; + section->reloc_count = hdr->s_nreloc = n.r_vaddr; } } #undef ALIGN_SET @@ -1725,7 +1661,7 @@ coff_set_alignment_hook (abfd, section, if ((hdr->s_flags & STYP_OVRFLO) == 0) return; - real_sec = coff_section_from_bfd_index (abfd, hdr->s_nreloc); + real_sec = coff_section_from_bfd_index (abfd, (int) hdr->s_nreloc); if (real_sec == NULL) return; @@ -1761,8 +1697,9 @@ coff_mkobject (abfd) bfd * abfd; { coff_data_type *coff; + bfd_size_type amt = sizeof (coff_data_type); - abfd->tdata.coff_obj_data = (struct coff_tdata *) bfd_zalloc (abfd, sizeof (coff_data_type)); + abfd->tdata.coff_obj_data = (struct coff_tdata *) bfd_zalloc (abfd, amt); if (abfd->tdata.coff_obj_data == 0) return false; coff = coff_data (abfd); @@ -1870,7 +1807,7 @@ coff_set_arch_mach_hook (abfd, filehdr) bfd *abfd; PTR filehdr; { - long machine; + unsigned long machine; enum bfd_architecture arch; struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr; @@ -2030,11 +1967,11 @@ coff_set_arch_mach_hook (abfd, filehdr) { bfd_byte *buf; struct internal_syment sym; + bfd_size_type amt = bfd_coff_symesz (abfd); - buf = (bfd_byte *) bfd_malloc (bfd_coff_symesz (abfd)); + buf = (bfd_byte *) bfd_malloc (amt); if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0 - || (bfd_read (buf, 1, bfd_coff_symesz (abfd), abfd) - != bfd_coff_symesz (abfd))) + || bfd_bread (buf, amt, abfd) != amt) { free (buf); return false; @@ -2325,7 +2262,7 @@ coff_print_aux (abfd, file, table_base, if (SMTYP_SMTYP (aux->u.auxent.x_csect.x_smtyp) != XTY_LD) { BFD_ASSERT (! aux->fix_scnlen); -#ifdef XCOFF64 +#ifdef XCOFF64 fprintf (file, "val %5lld", aux->u.auxent.x_csect.x_scnlen.l); #else fprintf (file, "val %5ld", (long) aux->u.auxent.x_csect.x_scnlen.l); @@ -2413,12 +2350,18 @@ coff_write_relocs (abfd, first_undef) #ifndef TARG_AUX p = s->orelocation; #else - /* sort relocations before we write them out */ - p = (arelent **) bfd_malloc (s->reloc_count * sizeof (arelent *)); - if (p == NULL && s->reloc_count > 0) - return false; - memcpy (p, s->orelocation, s->reloc_count * sizeof (arelent *)); - qsort (p, s->reloc_count, sizeof (arelent *), compare_arelent_ptr); + { + /* sort relocations before we write them out */ + bfd_size_type amt; + + amt = s->reloc_count; + amt *= sizeof (arelent *); + p = (arelent **) bfd_malloc (amt); + if (p == NULL && s->reloc_count > 0) + return false; + memcpy (p, s->orelocation, (size_t) amt); + qsort (p, s->reloc_count, sizeof (arelent *), compare_arelent_ptr); + } #endif if (bfd_seek (abfd, s->rel_filepos, SEEK_SET) != 0) @@ -2433,8 +2376,8 @@ coff_write_relocs (abfd, first_undef) /* add one to count *this* reloc (grr) */ n.r_vaddr = s->reloc_count + 1; coff_swap_reloc_out (abfd, &n, &dst); - if (bfd_write ((PTR) & dst, 1, bfd_coff_relsz (abfd), abfd) - != bfd_coff_relsz (abfd)) + if (bfd_bwrite ((PTR) & dst, (bfd_size_type) bfd_coff_relsz (abfd), + abfd) != bfd_coff_relsz (abfd)) return false; } #endif @@ -2457,15 +2400,15 @@ coff_write_relocs (abfd, first_undef) if (q->sym_ptr_ptr[0]->the_bfd != abfd) { - int i; + int j; const char *sname = q->sym_ptr_ptr[0]->name; asymbol **outsyms = abfd->outsymbols; - for (i = first_undef; outsyms[i]; i++) + for (j = first_undef; outsyms[j]; j++) { - const char *intable = outsyms[i]->name; + const char *intable = outsyms[j]->name; if (strcmp (intable, sname) == 0) { /* got a hit, so repoint the reloc */ - q->sym_ptr_ptr = outsyms + i; + q->sym_ptr_ptr = outsyms + j; break; } } @@ -2512,8 +2455,8 @@ coff_write_relocs (abfd, first_undef) n.r_type = q->howto->type; #endif coff_swap_reloc_out (abfd, &n, &dst); - if (bfd_write ((PTR) & dst, 1, bfd_coff_relsz (abfd), abfd) - != bfd_coff_relsz (abfd)) + if (bfd_bwrite ((PTR) & dst, (bfd_size_type) bfd_coff_relsz (abfd), + abfd) != bfd_coff_relsz (abfd)) return false; } @@ -2989,17 +2932,19 @@ coff_compute_section_file_positions (abf right order in the image file itself, but we do need to get the target_index values right. */ - int count; + unsigned int count; asection **section_list; - int i; + unsigned int i; int target_index; + bfd_size_type amt; count = 0; for (current = abfd->sections; current != NULL; current = current->next) ++count; /* We allocate an extra cell to simplify the final loop. */ - section_list = bfd_malloc (sizeof (struct asection *) * (count + 1)); + amt = sizeof (struct asection *) * (count + 1); + section_list = bfd_malloc (amt); if (section_list == NULL) return false; @@ -3063,15 +3008,16 @@ coff_compute_section_file_positions (abf page size too, and remember both sizes. */ if (coff_section_data (abfd, current) == NULL) { - current->used_by_bfd = - (PTR) bfd_zalloc (abfd, sizeof (struct coff_section_tdata)); + bfd_size_type amt = sizeof (struct coff_section_tdata); + current->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); if (current->used_by_bfd == NULL) return false; } if (pei_section_data (abfd, current) == NULL) { - coff_section_data (abfd, current)->tdata = - (PTR) bfd_zalloc (abfd, sizeof (struct pei_section_tdata)); + bfd_size_type amt = sizeof (struct pei_section_tdata); + coff_section_data (abfd, current)->tdata + = (PTR) bfd_zalloc (abfd, amt); if (coff_section_data (abfd, current)->tdata == NULL) return false; } @@ -3176,7 +3122,7 @@ coff_compute_section_file_positions (abf b = 0; if (bfd_seek (abfd, sofar - 1, SEEK_SET) != 0 - || bfd_write (&b, 1, 1, abfd) != 1) + || bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1) return false; } @@ -3209,11 +3155,12 @@ coff_add_missing_symbols (abfd) 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; + const char *name; if (csym) { /* only do this if there is a coff representation of the input @@ -3245,7 +3192,9 @@ coff_add_missing_symbols (abfd) if (!need_text && !need_data && !need_bss && !need_file) return true; nsyms += need_text + need_data + need_bss + need_file; - sympp2 = (asymbol **) bfd_alloc (abfd, nsyms * sizeof (asymbol *)); + amt = nsyms; + amt *= sizeof (asymbol *); + sympp2 = (asymbol **) bfd_alloc (abfd, amt); if (!sympp2) return false; memcpy (sympp2, sympp, i * sizeof (asymbol *)); @@ -3365,12 +3314,12 @@ coff_write_object_contents (abfd) { scn_base = bfd_coff_filhsz (abfd); #ifdef RS6000COFF_C -#ifndef XCOFF64 +#ifndef XCOFF64 if (xcoff_data (abfd)->full_aouthdr) scn_base += bfd_coff_aoutsz (abfd); else scn_base += SMALL_AOUTSZ; -#endif +#endif #endif } @@ -3520,9 +3469,10 @@ coff_write_object_contents (abfd) #endif { SCNHDR buff; + bfd_size_type amt = bfd_coff_scnhsz (abfd); + if (coff_swap_scnhdr_out (abfd, §ion, &buff) == 0 - || bfd_write ((PTR) (&buff), 1, bfd_coff_scnhsz (abfd), abfd) - != bfd_coff_scnhsz (abfd)) + || bfd_bwrite ((PTR) &buff, amt, abfd) != amt) return false; } @@ -3622,7 +3572,7 @@ coff_write_object_contents (abfd) } #ifdef RS6000COFF_C -#ifndef XCOFF64 +#ifndef XCOFF64 /* XCOFF handles overflows in the reloc and line number count fields by creating a new section header to hold the correct values. */ for (current = abfd->sections; current != NULL; current = current->next) @@ -3631,6 +3581,7 @@ coff_write_object_contents (abfd) { struct internal_scnhdr scnhdr; SCNHDR buff; + bfd_size_type amt; internal_f.f_nscns++; strncpy (&(scnhdr.s_name[0]), current->name, 8); @@ -3643,9 +3594,9 @@ coff_write_object_contents (abfd) scnhdr.s_nreloc = current->target_index; scnhdr.s_nlnno = current->target_index; scnhdr.s_flags = STYP_OVRFLO; + amt = bfd_coff_scnhsz (abfd); if (coff_swap_scnhdr_out (abfd, &scnhdr, &buff) == 0 - || bfd_write ((PTR) &buff, 1, bfd_coff_scnhsz (abfd), abfd) - != bfd_coff_scnhsz (abfd)) + || bfd_bwrite ((PTR) &buff, amt, abfd) != amt) return false; } } @@ -3672,12 +3623,12 @@ coff_write_object_contents (abfd) { internal_f.f_opthdr = 0; #ifdef RS6000COFF_C -#ifndef XCOFF64 +#ifndef XCOFF64 if (xcoff_data (abfd)->full_aouthdr) internal_f.f_opthdr = bfd_coff_aoutsz (abfd); else internal_f.f_opthdr = SMALL_AOUTSZ; -#endif +#endif #endif } @@ -3891,9 +3842,9 @@ coff_write_object_contents (abfd) rounded up to the page size. */ b = 0; if (bfd_seek (abfd, - BFD_ALIGN (sym_base, COFF_PAGE_SIZE) - 1, + (file_ptr) BFD_ALIGN (sym_base, COFF_PAGE_SIZE) - 1, SEEK_SET) != 0 - || bfd_write (&b, 1, 1, abfd) != 1) + || bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1) return false; } #endif @@ -4017,14 +3968,14 @@ coff_write_object_contents (abfd) { char * buff; - bfd_size_type amount; + bfd_size_type amount = bfd_coff_filhsz (abfd); - buff = bfd_malloc (bfd_coff_filhsz (abfd)); + buff = bfd_malloc (amount); if (buff == NULL) return false; - bfd_coff_swap_filehdr_out (abfd, (PTR) & internal_f, (PTR) buff); - amount = bfd_write ((PTR) buff, 1, bfd_coff_filhsz (abfd), abfd); + bfd_coff_swap_filehdr_out (abfd, (PTR) &internal_f, (PTR) buff); + amount = bfd_bwrite ((PTR) buff, amount, abfd); free (buff); @@ -4037,14 +3988,14 @@ coff_write_object_contents (abfd) /* Note that peicode.h fills in a PEAOUTHDR, not an AOUTHDR. include/coff/pe.h sets AOUTSZ == sizeof (PEAOUTHDR)) */ char * buff; - bfd_size_type amount; + bfd_size_type amount = bfd_coff_aoutsz (abfd); - buff = bfd_malloc (bfd_coff_aoutsz (abfd)); + buff = bfd_malloc (amount); if (buff == NULL) return false; - coff_swap_aouthdr_out (abfd, (PTR) & internal_a, (PTR) buff); - amount = bfd_write ((PTR) buff, 1, bfd_coff_aoutsz (abfd), abfd); + coff_swap_aouthdr_out (abfd, (PTR) &internal_a, (PTR) buff); + amount = bfd_bwrite ((PTR) buff, amount, abfd); free (buff); @@ -4063,7 +4014,7 @@ coff_write_object_contents (abfd) size = bfd_coff_aoutsz (abfd); else size = SMALL_AOUTSZ; - if (bfd_write ((PTR) &buff, 1, size, abfd) != size) + if (bfd_bwrite ((PTR) &buff, (bfd_size_type) size, abfd) != size) return false; } #endif @@ -4130,14 +4081,13 @@ coff_set_section_contents (abfd, section if (section->filepos == 0) return true; - if (bfd_seek (abfd, (file_ptr) (section->filepos + offset), SEEK_SET) != 0) + if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0) return false; - if (count != 0) - { - return (bfd_write (location, 1, count, abfd) == count) ? true : false; - } - return true; + if (count == 0) + return true; + + return bfd_bwrite (location, count, abfd) == count; } #if 0 static boolean @@ -4167,17 +4117,16 @@ coff_close_and_cleanup (abfd) #endif static PTR -buy_and_read (abfd, where, seek_direction, size) +buy_and_read (abfd, where, size) bfd *abfd; file_ptr where; - int seek_direction; - size_t size; + bfd_size_type size; { PTR area = (PTR) bfd_alloc (abfd, size); if (!area) return (NULL); - if (bfd_seek (abfd, where, seek_direction) != 0 - || bfd_read (area, 1, size, abfd) != size) + if (bfd_seek (abfd, where, SEEK_SET) != 0 + || bfd_bread (area, size, abfd) != size) return (NULL); return (area); } /* buy_and_read() */ @@ -4213,16 +4162,14 @@ coff_slurp_line_table (abfd, asect) { LINENO *native_lineno; alent *lineno_cache; + bfd_size_type amt; BFD_ASSERT (asect->lineno == (alent *) NULL); - native_lineno = (LINENO *) buy_and_read (abfd, - asect->line_filepos, - SEEK_SET, - (size_t) (bfd_coff_linesz (abfd) * - asect->lineno_count)); - lineno_cache = - (alent *) bfd_alloc (abfd, (size_t) ((asect->lineno_count + 1) * sizeof (alent))); + amt = (bfd_size_type) bfd_coff_linesz (abfd) * asect->lineno_count; + native_lineno = (LINENO *) buy_and_read (abfd, asect->line_filepos, amt); + amt = ((bfd_size_type) asect->lineno_count + 1) * sizeof (alent); + lineno_cache = (alent *) bfd_alloc (abfd, amt); if (lineno_cache == NULL) return false; else @@ -4250,7 +4197,7 @@ coff_slurp_line_table (abfd, asect) { (*_bfd_error_handler) (_("%s: warning: illegal symbol index %ld in line numbers"), - bfd_get_filename (abfd), dst.l_addr.l_symndx); + bfd_archive_filename (abfd), dst.l_addr.l_symndx); symndx = 0; warned = true; } @@ -4264,7 +4211,7 @@ coff_slurp_line_table (abfd, asect) { (*_bfd_error_handler) (_("%s: warning: duplicate line number information for `%s'"), - bfd_get_filename (abfd), + bfd_archive_filename (abfd), bfd_asymbol_name (&sym->symbol)); } sym->lineno = cache_ptr; @@ -4298,6 +4245,7 @@ coff_slurp_symbol_table (abfd) combined_entry_type *native_symbols; coff_symbol_type *cached_area; unsigned int *table_ptr; + bfd_size_type amt; unsigned int number_of_symbols = 0; @@ -4311,17 +4259,15 @@ coff_slurp_symbol_table (abfd) } /* on error */ /* Allocate enough room for all the symbols in cached form */ - cached_area = ((coff_symbol_type *) - bfd_alloc (abfd, - (obj_raw_syment_count (abfd) - * sizeof (coff_symbol_type)))); - + amt = obj_raw_syment_count (abfd); + amt *= sizeof (coff_symbol_type); + cached_area = (coff_symbol_type *) bfd_alloc (abfd, amt); if (cached_area == NULL) return false; - table_ptr = ((unsigned int *) - bfd_alloc (abfd, - (obj_raw_syment_count (abfd) - * sizeof (unsigned int)))); + + amt = obj_raw_syment_count (abfd); + amt *= sizeof (unsigned int); + table_ptr = (unsigned int *) bfd_alloc (abfd, amt); if (table_ptr == NULL) return false; @@ -4624,7 +4570,7 @@ coff_slurp_symbol_table (abfd) default: (*_bfd_error_handler) (_("%s: Unrecognized storage class %d for %s symbol `%s'"), - bfd_get_filename (abfd), src->u.syment.n_sclass, + bfd_archive_filename (abfd), src->u.syment.n_sclass, dst->symbol.section->name, dst->symbol.name); dst->symbol.flags = BSF_DEBUGGING; dst->symbol.value = (src->u.syment.n_value); @@ -4755,7 +4701,7 @@ coff_classify_symbol (abfd, syment) (*_bfd_error_handler) (_("warning: %s: local symbol `%s' has no section"), - bfd_get_filename (abfd), + bfd_archive_filename (abfd), _bfd_coff_internal_syment_name (abfd, syment, buf)); } @@ -4819,8 +4765,8 @@ coff_slurp_reloc_table (abfd, asect, sym RELOC *native_relocs; arelent *reloc_cache; arelent *cache_ptr; - unsigned int idx; + bfd_size_type amt; if (asect->relocation) return true; @@ -4830,14 +4776,10 @@ coff_slurp_reloc_table (abfd, asect, sym return true; if (!coff_slurp_symbol_table (abfd)) return false; - native_relocs = - (RELOC *) buy_and_read (abfd, - asect->rel_filepos, - SEEK_SET, - (size_t) (bfd_coff_relsz (abfd) * - asect->reloc_count)); - reloc_cache = (arelent *) - bfd_alloc (abfd, (size_t) (asect->reloc_count * sizeof (arelent))); + amt = (bfd_size_type) bfd_coff_relsz (abfd) * asect->reloc_count; + native_relocs = (RELOC *) buy_and_read (abfd, asect->rel_filepos, amt); + amt = (bfd_size_type) asect->reloc_count * sizeof (arelent); + reloc_cache = (arelent *) bfd_alloc (abfd, amt); if (reloc_cache == NULL) return false; @@ -4866,7 +4808,7 @@ coff_slurp_reloc_table (abfd, asect, sym { (*_bfd_error_handler) (_("%s: warning: illegal symbol index %ld in relocs"), - bfd_get_filename (abfd), dst.r_symndx); + bfd_archive_filename (abfd), dst.r_symndx); cache_ptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; ptr = NULL; } @@ -4904,7 +4846,7 @@ coff_slurp_reloc_table (abfd, asect, sym { (*_bfd_error_handler) (_("%s: illegal relocation type %d at address 0x%lx"), - bfd_get_filename (abfd), dst.r_type, (long) dst.r_vaddr); + bfd_archive_filename (abfd), dst.r_type, (long) dst.r_vaddr); bfd_set_error (bfd_error_bad_value); return false; } diff -uprN binutils-2.11.90.0.31/bfd/coffgen.c binutils-2.11.92.0.5/bfd/coffgen.c --- binutils-2.11.90.0.31/bfd/coffgen.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/coffgen.c Mon Oct 1 15:25:21 2001 @@ -68,7 +68,7 @@ static void fixup_symbol_value static char *build_debug_section PARAMS ((bfd *)); static char *copy_name - PARAMS ((bfd *, char *, int)); + PARAMS ((bfd *, char *, size_t)); #define STRING_SIZE_SIZE (4) @@ -108,7 +108,7 @@ make_a_section_from_file (abfd, hdr, tar strindex does not run us past the end, but right now we don't know the length of the string table. */ strings += strindex; - name = bfd_alloc (abfd, strlen (strings) + 1); + name = bfd_alloc (abfd, (bfd_size_type) strlen (strings) + 1); if (name == NULL) return false; strcpy (name, strings); @@ -118,7 +118,7 @@ make_a_section_from_file (abfd, hdr, tar if (name == NULL) { /* Assorted wastage to null-terminate the name, thanks AT&T! */ - name = bfd_alloc (abfd, sizeof (hdr->s_name) + 1); + name = bfd_alloc (abfd, (bfd_size_type) sizeof (hdr->s_name) + 1); if (name == NULL) return false; strncpy (name, (char *) &hdr->s_name[0], sizeof (hdr->s_name)); @@ -148,7 +148,7 @@ make_a_section_from_file (abfd, hdr, tar if (! bfd_coff_styp_to_sec_flags_hook (abfd, hdr, name, return_section, & flags)) result = false; - + return_section->flags = flags; /* At least on i386-coff, the line number count for a shared library @@ -178,7 +178,7 @@ coff_real_object_p (abfd, nscns, interna flagword oflags = abfd->flags; bfd_vma ostart = bfd_get_start_address (abfd); PTR tdata; - size_t readsize; /* length of file_info */ + bfd_size_type readsize; /* length of file_info */ unsigned int scnhsz; char *external_sections; @@ -211,12 +211,12 @@ coff_real_object_p (abfd, nscns, interna return 0; scnhsz = bfd_coff_scnhsz (abfd); - readsize = nscns * scnhsz; + readsize = (bfd_size_type) nscns * scnhsz; external_sections = (char *) bfd_alloc (abfd, readsize); if (!external_sections) goto fail; - if (bfd_read ((PTR) external_sections, 1, readsize, abfd) != readsize) + if (bfd_bread ((PTR) external_sections, readsize, abfd) != readsize) goto fail; /* Set the arch/mach *before* swapping in sections; section header swapping @@ -257,9 +257,9 @@ const bfd_target * coff_object_p (abfd) bfd *abfd; { - unsigned int filhsz; - unsigned int aoutsz; - int nscns; + bfd_size_type filhsz; + bfd_size_type aoutsz; + unsigned int nscns; PTR filehdr; struct internal_filehdr internal_f; struct internal_aouthdr internal_a; @@ -271,7 +271,7 @@ coff_object_p (abfd) filehdr = bfd_alloc (abfd, filhsz); if (filehdr == NULL) return 0; - if (bfd_read (filehdr, 1, filhsz, abfd) != filhsz) + if (bfd_bread (filehdr, filhsz, abfd) != filhsz) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -294,7 +294,7 @@ coff_object_p (abfd) opthdr = bfd_alloc (abfd, aoutsz); if (opthdr == NULL) return 0;; - if (bfd_read (opthdr, 1, internal_f.f_opthdr, abfd) + if (bfd_bread (opthdr, (bfd_size_type) internal_f.f_opthdr, abfd) != internal_f.f_opthdr) { return 0; @@ -431,6 +431,7 @@ _bfd_coff_read_internal_relocs (abfd, se bfd_byte *erel; bfd_byte *erel_end; struct internal_reloc *irel; + bfd_size_type amt; if (coff_section_data (abfd, sec) != NULL && coff_section_data (abfd, sec)->relocs != NULL) @@ -444,24 +445,24 @@ _bfd_coff_read_internal_relocs (abfd, se relsz = bfd_coff_relsz (abfd); + amt = sec->reloc_count * relsz; if (external_relocs == NULL) { - free_external = (bfd_byte *) bfd_malloc (sec->reloc_count * relsz); + free_external = (bfd_byte *) bfd_malloc (amt); if (free_external == NULL && sec->reloc_count > 0) goto error_return; external_relocs = free_external; } if (bfd_seek (abfd, sec->rel_filepos, SEEK_SET) != 0 - || (bfd_read (external_relocs, relsz, sec->reloc_count, abfd) - != relsz * sec->reloc_count)) + || bfd_bread (external_relocs, amt, abfd) != amt) goto error_return; if (internal_relocs == NULL) { - free_internal = ((struct internal_reloc *) - bfd_malloc (sec->reloc_count - * sizeof (struct internal_reloc))); + amt = sec->reloc_count; + amt *= sizeof (struct internal_reloc); + free_internal = (struct internal_reloc *) bfd_malloc (amt); if (free_internal == NULL && sec->reloc_count > 0) goto error_return; internal_relocs = free_internal; @@ -484,9 +485,8 @@ _bfd_coff_read_internal_relocs (abfd, se { if (coff_section_data (abfd, sec) == NULL) { - sec->used_by_bfd = - (PTR) bfd_zalloc (abfd, - sizeof (struct coff_section_tdata)); + amt = sizeof (struct coff_section_tdata); + sec->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); if (sec->used_by_bfd == NULL) goto error_return; coff_section_data (abfd, sec)->contents = NULL; @@ -661,9 +661,10 @@ coff_renumber_symbols (bfd_ptr, first_un { asymbol **newsyms; unsigned int i; + bfd_size_type amt; - newsyms = (asymbol **) bfd_alloc (bfd_ptr, - sizeof (asymbol *) * (symbol_count + 1)); + amt = sizeof (asymbol *) * ((bfd_size_type) symbol_count + 1); + newsyms = (asymbol **) bfd_alloc (bfd_ptr, amt); if (!newsyms) return false; bfd_ptr->outsymbols = newsyms; @@ -756,8 +757,8 @@ coff_mangle_symbols (bfd_ptr) if (s->fix_value) { /* FIXME: We should use a union here. */ - s->u.syment.n_value = - (bfd_vma)((combined_entry_type *) + s->u.syment.n_value = + (bfd_vma)((combined_entry_type *) ((unsigned long) s->u.syment.n_value))->offset; s->fix_value = 0; } @@ -876,7 +877,7 @@ coff_fix_symbol_name (abfd, symbol, nati } else { - long filepos; + file_ptr filepos; bfd_byte buf[4]; int prefix_len = bfd_coff_debug_string_prefix_length (abfd); @@ -889,9 +890,9 @@ coff_fix_symbol_name (abfd, symbol, nati *debug_string_section_p = bfd_get_section_by_name (abfd, ".debug"); filepos = bfd_tell (abfd); if (prefix_len == 4) - bfd_put_32 (abfd, name_length + 1, buf); + bfd_put_32 (abfd, (bfd_vma) (name_length + 1), buf); else - bfd_put_16 (abfd, name_length + 1, buf); + bfd_put_16 (abfd, (bfd_vma) (name_length + 1), buf); if (!bfd_set_section_contents (abfd, *debug_string_section_p, @@ -901,8 +902,8 @@ coff_fix_symbol_name (abfd, symbol, nati || !bfd_set_section_contents (abfd, *debug_string_section_p, (PTR) symbol->name, - ((file_ptr) *debug_string_size_p - + prefix_len), + (file_ptr) (*debug_string_size_p + + prefix_len), (bfd_size_type) name_length + 1)) abort (); if (bfd_seek (abfd, filepos, SEEK_SET) != 0) @@ -970,7 +971,7 @@ coff_write_symbol (abfd, symbol, native, if (!buf) return false; bfd_coff_swap_sym_out (abfd, &native->u.syment, buf); - if (bfd_write (buf, 1, symesz, abfd) != symesz) + if (bfd_bwrite (buf, symesz, abfd) != symesz) return false; bfd_release (abfd, buf); @@ -989,10 +990,10 @@ coff_write_symbol (abfd, symbol, native, &((native + j + 1)->u.auxent), type, class, - j, + (int) j, native->u.syment.n_numaux, buf); - if (bfd_write (buf, 1, auxesz, abfd) != auxesz) + if (bfd_bwrite (buf, auxesz, abfd) != auxesz) return false; } bfd_release (abfd, buf); @@ -1219,11 +1220,12 @@ coff_write_symbols (abfd) bfd_byte buffer[STRING_SIZE_SIZE]; #if STRING_SIZE_SIZE == 4 - bfd_h_put_32 (abfd, size, buffer); + H_PUT_32 (abfd, size, buffer); #else - #error Change bfd_h_put_32 + #error Change H_PUT_32 #endif - if (bfd_write ((PTR) buffer, 1, sizeof (buffer), abfd) != sizeof (buffer)) + if (bfd_bwrite ((PTR) buffer, (bfd_size_type) sizeof (buffer), abfd) + != sizeof (buffer)) return false; /* Handle long section names. This code must handle section @@ -1239,7 +1241,8 @@ coff_write_symbols (abfd) len = strlen (o->name); if (len > SCNNMLEN) { - if (bfd_write (o->name, 1, len + 1, abfd) != len + 1) + if (bfd_bwrite (o->name, (bfd_size_type) (len + 1), abfd) + != len + 1) return false; } } @@ -1279,7 +1282,10 @@ coff_write_symbols (abfd) && c_symbol->native->u.syment.n_numaux > 0) { if (bfd_coff_force_symnames_in_strings (abfd)) - bfd_write (".file", 1, 6, abfd); + { + if (bfd_bwrite (".file", (bfd_size_type) 6, abfd) != 6) + return false; + } maxlen = bfd_coff_filnmlen (abfd); } else @@ -1287,8 +1293,8 @@ coff_write_symbols (abfd) if (name_length > maxlen) { - if (bfd_write ((PTR) (q->name), 1, name_length + 1, abfd) - != name_length + 1) + if (bfd_bwrite ((PTR) (q->name), (bfd_size_type) name_length + 1, + abfd) != name_length + 1) return false; } } @@ -1302,11 +1308,11 @@ coff_write_symbols (abfd) bfd_byte buffer[STRING_SIZE_SIZE]; #if STRING_SIZE_SIZE == 4 - bfd_h_put_32 (abfd, size, buffer); + H_PUT_32 (abfd, size, buffer); #else - #error Change bfd_h_put_32 + #error Change H_PUT_32 #endif - if (bfd_write ((PTR) buffer, 1, STRING_SIZE_SIZE, abfd) + if (bfd_bwrite ((PTR) buffer, (bfd_size_type) STRING_SIZE_SIZE, abfd) != STRING_SIZE_SIZE) return false; } @@ -1361,7 +1367,8 @@ coff_write_linenumbers (abfd) out.l_lnno = 0; out.l_addr.l_symndx = l->u.offset; bfd_coff_swap_lineno_out (abfd, &out, buff); - if (bfd_write (buff, 1, linesz, abfd) != linesz) + if (bfd_bwrite (buff, (bfd_size_type) linesz, abfd) + != linesz) return false; l++; while (l->line_number) @@ -1369,7 +1376,8 @@ coff_write_linenumbers (abfd) out.l_lnno = l->line_number; out.l_addr.l_symndx = l->u.offset; bfd_coff_swap_lineno_out (abfd, &out, buff); - if (bfd_write (buff, 1, linesz, abfd) != linesz) + if (bfd_bwrite (buff, (bfd_size_type) linesz, abfd) + != linesz) return false; l++; } @@ -1417,7 +1425,7 @@ coff_section_symbol (abfd, name) combined_entry_type e[10]; }; struct foo *f; - f = (struct foo *) bfd_alloc (abfd, sizeof (*f)); + f = (struct foo *) bfd_alloc (abfd, (bfd_size_type) sizeof (*f)); if (!f) { bfd_set_error (bfd_error_no_error); @@ -1500,7 +1508,8 @@ build_debug_section (abfd) bfd *abfd; { char *debug_section; - long position; + file_ptr position; + bfd_size_type sec_size; asection *sect = bfd_get_section_by_name (abfd, ".debug"); @@ -1510,8 +1519,8 @@ build_debug_section (abfd) return NULL; } - debug_section = (PTR) bfd_alloc (abfd, - bfd_get_section_size_before_reloc (sect)); + sec_size = bfd_get_section_size_before_reloc (sect); + debug_section = (PTR) bfd_alloc (abfd, sec_size); if (debug_section == NULL) return NULL; @@ -1521,9 +1530,7 @@ build_debug_section (abfd) position = bfd_tell (abfd); if (bfd_seek (abfd, sect->filepos, SEEK_SET) != 0 - || (bfd_read (debug_section, - bfd_get_section_size_before_reloc (sect), 1, abfd) - != bfd_get_section_size_before_reloc (sect)) + || bfd_bread (debug_section, sec_size, abfd) != sec_size || bfd_seek (abfd, position, SEEK_SET) != 0) return NULL; return debug_section; @@ -1536,9 +1543,9 @@ static char * copy_name (abfd, name, maxlen) bfd *abfd; char *name; - int maxlen; + size_t maxlen; { - int len; + size_t len; char *newname; for (len = 0; len < maxlen; ++len) @@ -1549,7 +1556,7 @@ copy_name (abfd, name, maxlen) } } - if ((newname = (PTR) bfd_alloc (abfd, len + 1)) == NULL) + if ((newname = (PTR) bfd_alloc (abfd, (bfd_size_type) len + 1)) == NULL) return (NULL); strncpy (newname, name, len); newname[len] = '\0'; @@ -1563,7 +1570,7 @@ _bfd_coff_get_external_symbols (abfd) bfd *abfd; { bfd_size_type symesz; - size_t size; + bfd_size_type size; PTR syms; if (obj_coff_external_syms (abfd) != NULL) @@ -1578,7 +1585,7 @@ _bfd_coff_get_external_symbols (abfd) return false; if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0 - || bfd_read (syms, size, 1, abfd) != size) + || bfd_bread (syms, size, abfd) != size) { if (syms != NULL) free (syms); @@ -1599,8 +1606,9 @@ _bfd_coff_read_string_table (abfd) bfd *abfd; { char extstrsize[STRING_SIZE_SIZE]; - size_t strsize; + bfd_size_type strsize; char *strings; + file_ptr pos; if (obj_coff_strings (abfd) != NULL) return obj_coff_strings (abfd); @@ -1611,13 +1619,13 @@ _bfd_coff_read_string_table (abfd) return NULL; } - if (bfd_seek (abfd, - (obj_sym_filepos (abfd) - + obj_raw_syment_count (abfd) * bfd_coff_symesz (abfd)), - SEEK_SET) != 0) + pos = obj_sym_filepos (abfd); + pos += obj_raw_syment_count (abfd) * bfd_coff_symesz (abfd); + if (bfd_seek (abfd, pos, SEEK_SET) != 0) return NULL; - if (bfd_read (extstrsize, sizeof extstrsize, 1, abfd) != sizeof extstrsize) + if (bfd_bread (extstrsize, (bfd_size_type) sizeof extstrsize, abfd) + != sizeof extstrsize) { if (bfd_get_error () != bfd_error_file_truncated) return NULL; @@ -1628,16 +1636,16 @@ _bfd_coff_read_string_table (abfd) else { #if STRING_SIZE_SIZE == 4 - strsize = bfd_h_get_32 (abfd, (bfd_byte *) extstrsize); + strsize = H_GET_32 (abfd, extstrsize); #else - #error Change bfd_h_get_32 + #error Change H_GET_32 #endif } if (strsize < STRING_SIZE_SIZE) { (*_bfd_error_handler) - (_("%s: bad string table size %lu"), bfd_get_filename (abfd), + (_("%s: bad string table size %lu"), bfd_archive_filename (abfd), (unsigned long) strsize); bfd_set_error (bfd_error_bad_value); return NULL; @@ -1647,8 +1655,7 @@ _bfd_coff_read_string_table (abfd) if (strings == NULL) return NULL; - if (bfd_read (strings + STRING_SIZE_SIZE, - strsize - STRING_SIZE_SIZE, 1, abfd) + if (bfd_bread (strings + STRING_SIZE_SIZE, strsize - STRING_SIZE_SIZE, abfd) != strsize - STRING_SIZE_SIZE) { free (strings); @@ -1694,12 +1701,12 @@ coff_get_normalized_symtab (abfd) combined_entry_type *internal_ptr; combined_entry_type *symbol_ptr; combined_entry_type *internal_end; - bfd_size_type symesz; + size_t symesz; char *raw_src; char *raw_end; const char *string_table = NULL; char *debug_section = NULL; - unsigned long size; + bfd_size_type size; if (obj_raw_syments (abfd) != NULL) return obj_raw_syments (abfd); @@ -1742,7 +1749,7 @@ coff_get_normalized_symtab (abfd) bfd_coff_swap_aux_in (abfd, (PTR) raw_src, symbol_ptr->u.syment.n_type, symbol_ptr->u.syment.n_sclass, - i, symbol_ptr->u.syment.n_numaux, + (int) i, symbol_ptr->u.syment.n_numaux, &(internal_ptr->u.auxent)); coff_pointerize_aux (abfd, internal, symbol_ptr, i, internal_ptr); @@ -1797,7 +1804,7 @@ coff_get_normalized_symtab (abfd) ((long) copy_name (abfd, (internal_ptr + 1)->u.auxent.x_file.x_fname, - bfd_coff_filnmlen (abfd))); + (size_t) bfd_coff_filnmlen (abfd))); } } } @@ -1806,23 +1813,20 @@ coff_get_normalized_symtab (abfd) if (internal_ptr->u.syment._n._n_n._n_zeroes != 0) { /* This is a "short" name. Make it long. */ - unsigned long i = 0; - char *newstring = NULL; + size_t i; + char *newstring; /* find the length of this string without walking into memory that isn't ours. */ for (i = 0; i < 8; ++i) - { - if (internal_ptr->u.syment._n._n_name[i] == '\0') - { - break; - } /* if end of string */ - } /* possible lengths of this string. */ + if (internal_ptr->u.syment._n._n_name[i] == '\0') + break; - if ((newstring = (PTR) bfd_alloc (abfd, ++i)) == NULL) + newstring = (PTR) bfd_alloc (abfd, (bfd_size_type) (i + 1)); + if (newstring == NULL) return (NULL); - memset (newstring, 0, i); - strncpy (newstring, internal_ptr->u.syment._n._n_name, i - 1); + memset (newstring, 0, i + 1); + strncpy (newstring, internal_ptr->u.syment._n._n_name, i); internal_ptr->u.syment._n._n_n._n_offset = (long int) newstring; internal_ptr->u.syment._n._n_n._n_zeroes = 0; } @@ -1879,7 +1883,8 @@ asymbol * coff_make_empty_symbol (abfd) bfd *abfd; { - coff_symbol_type *new = (coff_symbol_type *) bfd_alloc (abfd, sizeof (coff_symbol_type)); + bfd_size_type amt = sizeof (coff_symbol_type); + coff_symbol_type *new = (coff_symbol_type *) bfd_alloc (abfd, amt); if (new == NULL) return (NULL); memset (new, 0, sizeof *new); @@ -1899,12 +1904,14 @@ coff_bfd_make_debug_symbol (abfd, ptr, s PTR ptr ATTRIBUTE_UNUSED; unsigned long sz ATTRIBUTE_UNUSED; { - coff_symbol_type *new = (coff_symbol_type *) bfd_alloc (abfd, sizeof (coff_symbol_type)); + bfd_size_type amt = sizeof (coff_symbol_type); + coff_symbol_type *new = (coff_symbol_type *) bfd_alloc (abfd, amt); if (new == NULL) return (NULL); /* @@ The 10 is a guess at a plausible maximum number of aux entries (but shouldn't be a constant). */ - new->native = (combined_entry_type *) bfd_zalloc (abfd, sizeof (combined_entry_type) * 10); + amt = sizeof (combined_entry_type) * 10; + new->native = (combined_entry_type *) bfd_zalloc (abfd, amt); if (!new->native) return (NULL); new->symbol.section = bfd_abs_section_ptr; @@ -1950,7 +1957,7 @@ bfd_coff_get_syment (abfd, symbol, psyme *psyment = csym->native->u.syment; if (csym->native->fix_value) - psyment->n_value = psyment->n_value - + psyment->n_value = psyment->n_value - (unsigned long) obj_raw_syments (abfd); /* FIXME: We should handle fix_line here. */ @@ -2185,8 +2192,8 @@ coff_find_nearest_line (abfd, section, s asection *section; asymbol **symbols; bfd_vma offset; - CONST char **filename_ptr; - CONST char **functionname_ptr; + const char **filename_ptr; + const char **functionname_ptr; unsigned int *line_ptr; { boolean found; @@ -2198,6 +2205,7 @@ coff_find_nearest_line (abfd, section, s combined_entry_type *pend; alent *l; struct coff_section_tdata *sec_data; + bfd_size_type amt; /* Before looking through the symbol table, try to use a .stab section to find the information. */ @@ -2372,9 +2380,8 @@ coff_find_nearest_line (abfd, section, s /* Cache the results for the next call. */ if (sec_data == NULL && section->owner == abfd) { - section->used_by_bfd = - ((PTR) bfd_zalloc (abfd, - sizeof (struct coff_section_tdata))); + amt = sizeof (struct coff_section_tdata); + section->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); sec_data = (struct coff_section_tdata *) section->used_by_bfd; } if (sec_data != NULL) @@ -2431,8 +2438,9 @@ bfd_coff_set_symbol_class (abfd, symbol, coff_write_alien_symbol(). */ combined_entry_type * native; + bfd_size_type amt = sizeof (* native); - native = (combined_entry_type *) bfd_alloc (abfd, sizeof (* native)); + native = (combined_entry_type *) bfd_alloc (abfd, amt); if (native == NULL) return false; diff -uprN binutils-2.11.90.0.31/bfd/cofflink.c binutils-2.11.92.0.5/bfd/cofflink.c --- binutils-2.11.90.0.31/bfd/cofflink.c Wed Aug 22 08:52:09 2001 +++ binutils-2.11.92.0.5/bfd/cofflink.c Mon Oct 1 15:25:21 2001 @@ -117,9 +117,9 @@ _bfd_coff_link_hash_table_create (abfd) bfd *abfd; { struct coff_link_hash_table *ret; + bfd_size_type amt = sizeof (struct coff_link_hash_table); - ret = ((struct coff_link_hash_table *) - bfd_alloc (abfd, sizeof (struct coff_link_hash_table))); + ret = (struct coff_link_hash_table *) bfd_alloc (abfd, amt); if (ret == NULL) return NULL; if (! _bfd_coff_link_hash_table_init (ret, abfd, @@ -325,6 +325,7 @@ coff_link_add_symbols (abfd, info) bfd_size_type symesz; bfd_byte *esym; bfd_byte *esym_end; + bfd_size_type amt; /* Keep the symbols during this function, in case the linker needs to read the generic symbols in order to report an error message. */ @@ -340,10 +341,8 @@ coff_link_add_symbols (abfd, info) /* We keep a list of the linker hash table entries that correspond to particular symbols. */ - sym_hash = ((struct coff_link_hash_entry **) - bfd_alloc (abfd, - ((size_t) symcount - * sizeof (struct coff_link_hash_entry *)))); + amt = symcount * sizeof (struct coff_link_hash_entry *); + sym_hash = (struct coff_link_hash_entry **) bfd_alloc (abfd, amt); if (sym_hash == NULL && symcount != 0) goto error_return; obj_coff_sym_hashes (abfd) = sym_hash; @@ -536,7 +535,7 @@ coff_link_add_symbols (abfd, info) (*_bfd_error_handler) (_("Warning: type of symbol `%s' changed from %d to %d in %s"), name, (*sym_hash)->type, sym.n_type, - bfd_get_filename (abfd)); + bfd_archive_filename (abfd)); /* We don't want to change from a meaningful base type to a null one, but if we know @@ -564,8 +563,8 @@ coff_link_add_symbols (abfd, info) i < sym.n_numaux; i++, eaux += symesz, iaux++) bfd_coff_swap_aux_in (abfd, (PTR) eaux, sym.n_type, - sym.n_sclass, i, sym.n_numaux, - (PTR) iaux); + sym.n_sclass, (int) i, + sym.n_numaux, (PTR) iaux); (*sym_hash)->aux = alloc; } } @@ -618,9 +617,8 @@ coff_link_add_symbols (abfd, info) secdata = coff_section_data (abfd, stab); if (secdata == NULL) { - stab->used_by_bfd = - (PTR) bfd_zalloc (abfd, - sizeof (struct coff_section_tdata)); + amt = sizeof (struct coff_section_tdata); + stab->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); if (stab->used_by_bfd == NULL) goto error_return; secdata = coff_section_data (abfd, stab); @@ -658,11 +656,11 @@ _bfd_coff_final_link (abfd, info) boolean long_section_names; asection *o; struct bfd_link_order *p; - size_t max_sym_count; - size_t max_lineno_count; - size_t max_reloc_count; - size_t max_output_reloc_count; - size_t max_contents_size; + bfd_size_type max_sym_count; + bfd_size_type max_lineno_count; + bfd_size_type max_reloc_count; + bfd_size_type max_output_reloc_count; + bfd_size_type max_contents_size; file_ptr rel_filepos; unsigned int relsz; file_ptr line_filepos; @@ -670,6 +668,7 @@ _bfd_coff_final_link (abfd, info) bfd *sub; bfd_byte *external_relocs = NULL; char strbuf[STRING_SIZE_SIZE]; + bfd_size_type amt; symesz = bfd_coff_symesz (abfd); @@ -785,10 +784,9 @@ _bfd_coff_final_link (abfd, info) /* We use section_count + 1, rather than section_count, because the target_index fields are 1 based. */ - finfo.section_info = - ((struct coff_link_section_info *) - bfd_malloc ((abfd->section_count + 1) - * sizeof (struct coff_link_section_info))); + amt = abfd->section_count + 1; + amt *= sizeof (struct coff_link_section_info); + finfo.section_info = (struct coff_link_section_info *) bfd_malloc (amt); if (finfo.section_info == NULL) goto error_return; for (i = 0; i <= abfd->section_count; i++) @@ -829,13 +827,14 @@ _bfd_coff_final_link (abfd, info) but only when doing a relocateable link, which is not the common case. */ BFD_ASSERT (info->relocateable); + amt = o->reloc_count; + amt *= sizeof (struct internal_reloc); finfo.section_info[o->target_index].relocs = - ((struct internal_reloc *) - bfd_malloc (o->reloc_count * sizeof (struct internal_reloc))); + (struct internal_reloc *) bfd_malloc (amt); + amt = o->reloc_count; + amt *= sizeof (struct coff_link_hash_entry *); finfo.section_info[o->target_index].rel_hashes = - ((struct coff_link_hash_entry **) - bfd_malloc (o->reloc_count - * sizeof (struct coff_link_hash_entry *))); + (struct coff_link_hash_entry **) bfd_malloc (amt); if (finfo.section_info[o->target_index].relocs == NULL || finfo.section_info[o->target_index].rel_hashes == NULL) goto error_return; @@ -867,22 +866,23 @@ _bfd_coff_final_link (abfd, info) } /* Allocate some buffers used while linking. */ - finfo.internal_syms = ((struct internal_syment *) - bfd_malloc (max_sym_count - * sizeof (struct internal_syment))); - finfo.sec_ptrs = (asection **) bfd_malloc (max_sym_count - * sizeof (asection *)); - finfo.sym_indices = (long *) bfd_malloc (max_sym_count * sizeof (long)); - finfo.outsyms = ((bfd_byte *) - bfd_malloc ((size_t) ((max_sym_count + 1) * symesz))); - finfo.linenos = (bfd_byte *) bfd_malloc (max_lineno_count - * bfd_coff_linesz (abfd)); + amt = max_sym_count * sizeof (struct internal_syment); + finfo.internal_syms = (struct internal_syment *) bfd_malloc (amt); + amt = max_sym_count * sizeof (asection *); + finfo.sec_ptrs = (asection **) bfd_malloc (amt); + amt = max_sym_count * sizeof (long); + finfo.sym_indices = (long *) bfd_malloc (amt); + finfo.outsyms = (bfd_byte *) bfd_malloc ((max_sym_count + 1) * symesz); + amt = max_lineno_count * bfd_coff_linesz (abfd); + finfo.linenos = (bfd_byte *) bfd_malloc (amt); finfo.contents = (bfd_byte *) bfd_malloc (max_contents_size); - finfo.external_relocs = (bfd_byte *) bfd_malloc (max_reloc_count * relsz); + amt = max_reloc_count * relsz; + finfo.external_relocs = (bfd_byte *) bfd_malloc (amt); if (! info->relocateable) - finfo.internal_relocs = ((struct internal_reloc *) - bfd_malloc (max_reloc_count - * sizeof (struct internal_reloc))); + { + amt = max_reloc_count * sizeof (struct internal_reloc); + finfo.internal_relocs = (struct internal_reloc *) bfd_malloc (amt); + } if ((finfo.internal_syms == NULL && max_sym_count > 0) || (finfo.sec_ptrs == NULL && max_sym_count > 0) || (finfo.sym_indices == NULL && max_sym_count > 0) @@ -987,14 +987,15 @@ _bfd_coff_final_link (abfd, info) if (finfo.last_file_index != -1 && (unsigned int) finfo.last_file.n_value != obj_raw_syment_count (abfd)) { + file_ptr pos; + finfo.last_file.n_value = obj_raw_syment_count (abfd); bfd_coff_swap_sym_out (abfd, (PTR) &finfo.last_file, (PTR) finfo.outsyms); - if (bfd_seek (abfd, - (obj_sym_filepos (abfd) - + finfo.last_file_index * symesz), - SEEK_SET) != 0 - || bfd_write (finfo.outsyms, symesz, 1, abfd) != symesz) + + pos = obj_sym_filepos (abfd) + finfo.last_file_index * symesz; + if (bfd_seek (abfd, pos, SEEK_SET) != 0 + || bfd_bwrite (finfo.outsyms, symesz, abfd) != symesz) return false; } @@ -1029,8 +1030,8 @@ _bfd_coff_final_link (abfd, info) /* Now that we have written out all the global symbols, we know the symbol indices to use for relocs against them, and we can finally write out the relocs. */ - external_relocs = ((bfd_byte *) - bfd_malloc (max_output_reloc_count * relsz)); + amt = max_output_reloc_count * relsz; + external_relocs = (bfd_byte *) bfd_malloc (amt); if (external_relocs == NULL) goto error_return; @@ -1059,8 +1060,9 @@ _bfd_coff_final_link (abfd, info) } if (bfd_seek (abfd, o->rel_filepos, SEEK_SET) != 0 - || bfd_write ((PTR) external_relocs, relsz, o->reloc_count, - abfd) != relsz * o->reloc_count) + || (bfd_bwrite ((PTR) external_relocs, + (bfd_size_type) relsz * o->reloc_count, abfd) + != (bfd_size_type) relsz * o->reloc_count)) goto error_return; } @@ -1094,21 +1096,22 @@ _bfd_coff_final_link (abfd, info) /* Write out the string table. */ if (obj_raw_syment_count (abfd) != 0 || long_section_names) { - if (bfd_seek (abfd, - (obj_sym_filepos (abfd) - + obj_raw_syment_count (abfd) * symesz), - SEEK_SET) != 0) + file_ptr pos; + + pos = obj_sym_filepos (abfd) + obj_raw_syment_count (abfd) * symesz; + if (bfd_seek (abfd, pos, SEEK_SET) != 0) return false; #if STRING_SIZE_SIZE == 4 - bfd_h_put_32 (abfd, - _bfd_stringtab_size (finfo.strtab) + STRING_SIZE_SIZE, - (bfd_byte *) strbuf); + H_PUT_32 (abfd, + _bfd_stringtab_size (finfo.strtab) + STRING_SIZE_SIZE, + strbuf); #else - #error Change bfd_h_put_32 + #error Change H_PUT_32 above #endif - if (bfd_write (strbuf, 1, STRING_SIZE_SIZE, abfd) != STRING_SIZE_SIZE) + if (bfd_bwrite (strbuf, (bfd_size_type) STRING_SIZE_SIZE, abfd) + != STRING_SIZE_SIZE) return false; if (! _bfd_stringtab_emit (abfd, finfo.strtab)) @@ -1176,17 +1179,17 @@ dores_com (ptr, output_bfd, heap) { int val = strtoul (ptr, &ptr, 0); if (heap) - pe_data(output_bfd)->pe_opthdr.SizeOfHeapReserve =val; + pe_data(output_bfd)->pe_opthdr.SizeOfHeapReserve = val; else - pe_data(output_bfd)->pe_opthdr.SizeOfStackReserve =val; + pe_data(output_bfd)->pe_opthdr.SizeOfStackReserve = val; if (ptr[0] == ',') { - int val = strtoul (ptr+1, &ptr, 0); + val = strtoul (ptr+1, &ptr, 0); if (heap) - pe_data(output_bfd)->pe_opthdr.SizeOfHeapCommit =val; + pe_data(output_bfd)->pe_opthdr.SizeOfHeapCommit = val; else - pe_data(output_bfd)->pe_opthdr.SizeOfStackCommit =val; + pe_data(output_bfd)->pe_opthdr.SizeOfStackCommit = val; } } return ptr; @@ -1220,10 +1223,10 @@ process_embedded_commands (output_bfd, i if (!sec) return 1; - copy = bfd_malloc ((size_t) sec->_raw_size); + copy = bfd_malloc (sec->_raw_size); if (!copy) return 0; - if (! bfd_get_section_contents(abfd, sec, copy, 0, sec->_raw_size)) + if (! bfd_get_section_contents(abfd, sec, copy, (bfd_vma) 0, sec->_raw_size)) { free (copy); return 0; @@ -1513,15 +1516,13 @@ _bfd_coff_link_input_bfd (finfo, input_b #ifndef COFF_WITH_PE /* Skip section symbols for sections which are not going to be - emitted, or which belong to linkonce sections that are going - to be discarded. */ + emitted. */ if (!skip && isym.n_sclass == C_STAT && isym.n_type == T_NULL && isym.n_numaux > 0) { - if ((*secpp)->output_section == bfd_abs_section_ptr - || (*secpp)->kept_section) + if ((*secpp)->output_section == bfd_abs_section_ptr) skip = true; } #endif @@ -1586,6 +1587,7 @@ _bfd_coff_link_input_bfd (finfo, input_b struct coff_debug_merge_element **epp; bfd_byte *esl, *eslend; struct internal_syment *islp; + bfd_size_type amt; name = _bfd_coff_internal_syment_name (input_bfd, &isym, buf); if (name == NULL) @@ -1606,9 +1608,8 @@ _bfd_coff_link_input_bfd (finfo, input_b /* Allocate memory to hold type information. If this turns out to be a duplicate, we pass this address to bfd_release. */ - mt = ((struct coff_debug_merge_type *) - bfd_alloc (input_bfd, - sizeof (struct coff_debug_merge_type))); + amt = sizeof (struct coff_debug_merge_type); + mt = (struct coff_debug_merge_type *) bfd_alloc (input_bfd, amt); if (mt == NULL) return false; mt->class = isym.n_sclass; @@ -1634,9 +1635,9 @@ _bfd_coff_link_input_bfd (finfo, input_b bfd_coff_swap_sym_in (input_bfd, (PTR) esl, (PTR) islp); + amt = sizeof (struct coff_debug_merge_element); *epp = ((struct coff_debug_merge_element *) - bfd_alloc (input_bfd, - sizeof (struct coff_debug_merge_element))); + bfd_alloc (input_bfd, amt)); if (*epp == NULL) return false; @@ -1645,8 +1646,8 @@ _bfd_coff_link_input_bfd (finfo, input_b if (elename == NULL) return false; - name_copy = (char *) bfd_alloc (input_bfd, - strlen (elename) + 1); + amt = strlen (elename) + 1; + name_copy = (char *) bfd_alloc (input_bfd, amt); if (name_copy == NULL) return false; strcpy (name_copy, elename); @@ -1846,18 +1847,18 @@ _bfd_coff_link_input_bfd (finfo, input_b } else { + file_ptr pos; + /* We have already written out the last C_FILE symbol. We need to write it out again. We borrow *outsym temporarily. */ bfd_coff_swap_sym_out (output_bfd, (PTR) &finfo->last_file, (PTR) outsym); - if (bfd_seek (output_bfd, - (obj_sym_filepos (output_bfd) - + finfo->last_file_index * osymesz), - SEEK_SET) != 0 - || (bfd_write (outsym, osymesz, 1, output_bfd) - != osymesz)) + pos = obj_sym_filepos (output_bfd); + pos += finfo->last_file_index * osymesz; + if (bfd_seek (output_bfd, pos, SEEK_SET) != 0 + || bfd_bwrite (outsym, osymesz, output_bfd) != osymesz) return false; } } @@ -2079,6 +2080,8 @@ _bfd_coff_link_input_bfd (finfo, input_b } else { + file_ptr pos; + /* We have already written out the last .bf aux entry. We need to write it out again. We borrow *outsym @@ -2090,12 +2093,11 @@ _bfd_coff_link_input_bfd (finfo, input_b isymp->n_sclass, 0, isymp->n_numaux, (PTR) outsym); - if (bfd_seek (output_bfd, - (obj_sym_filepos (output_bfd) - + finfo->last_bf_index * osymesz), - SEEK_SET) != 0 - || bfd_write (outsym, osymesz, 1, - output_bfd) != osymesz) + pos = obj_sym_filepos (output_bfd); + pos += finfo->last_bf_index * osymesz; + if (bfd_seek (output_bfd, pos, SEEK_SET) != 0 + || (bfd_bwrite (outsym, osymesz, output_bfd) + != osymesz)) return false; } } @@ -2143,6 +2145,8 @@ _bfd_coff_link_input_bfd (finfo, input_b bfd_byte *elineend; bfd_byte *oeline; boolean skipping; + file_ptr pos; + bfd_size_type amt; /* FIXME: If SEC_HAS_CONTENTS is not for the section, then build_link_order in ldwrite.c will not have created a @@ -2158,7 +2162,7 @@ _bfd_coff_link_input_bfd (finfo, input_b continue; if (bfd_seek (input_bfd, o->line_filepos, SEEK_SET) != 0 - || bfd_read (finfo->linenos, linesz, o->lineno_count, + || bfd_bread (finfo->linenos, linesz * o->lineno_count, input_bfd) != linesz * o->lineno_count) return false; @@ -2246,17 +2250,14 @@ _bfd_coff_link_input_bfd (finfo, input_b } } - if (bfd_seek (output_bfd, - (o->output_section->line_filepos - + o->output_section->lineno_count * linesz), - SEEK_SET) != 0 - || (bfd_write (finfo->linenos, 1, oeline - finfo->linenos, - output_bfd) - != (bfd_size_type) (oeline - finfo->linenos))) + pos = o->output_section->line_filepos; + pos += o->output_section->lineno_count * linesz; + amt = oeline - finfo->linenos; + if (bfd_seek (output_bfd, pos, SEEK_SET) != 0 + || bfd_bwrite (finfo->linenos, amt, output_bfd) != amt) return false; - o->output_section->lineno_count += - (oeline - finfo->linenos) / linesz; + o->output_section->lineno_count += amt / linesz; } } @@ -2277,12 +2278,13 @@ _bfd_coff_link_input_bfd (finfo, input_b /* Write the modified symbols to the output file. */ if (outsym > finfo->outsyms) { - if (bfd_seek (output_bfd, - obj_sym_filepos (output_bfd) + syment_base * osymesz, - SEEK_SET) != 0 - || (bfd_write (finfo->outsyms, outsym - finfo->outsyms, 1, - output_bfd) - != (bfd_size_type) (outsym - finfo->outsyms))) + file_ptr pos; + bfd_size_type amt; + + pos = obj_sym_filepos (output_bfd) + syment_base * osymesz; + amt = outsym - finfo->outsyms; + if (bfd_seek (output_bfd, pos, SEEK_SET) != 0 + || bfd_bwrite (finfo->outsyms, amt, output_bfd) != amt) return false; BFD_ASSERT ((obj_raw_syment_count (output_bfd) @@ -2313,7 +2315,7 @@ _bfd_coff_link_input_bfd (finfo, input_b { ((*_bfd_error_handler) (_("%s: relocs in section `%s', but it has no contents"), - bfd_get_filename (input_bfd), + bfd_archive_filename (input_bfd), bfd_get_section_name (input_bfd, o))); bfd_set_error (bfd_error_no_contents); return false; @@ -2454,14 +2456,11 @@ _bfd_coff_link_input_bfd (finfo, input_b /* Write out the modified section contents. */ if (secdata == NULL || secdata->stab_info == NULL) { + file_ptr loc = o->output_offset * bfd_octets_per_byte (output_bfd); + bfd_size_type amt = (o->_cooked_size != 0 + ? o->_cooked_size : o->_raw_size); if (! bfd_set_section_contents (output_bfd, o->output_section, - contents, - (file_ptr) - (o->output_offset * - bfd_octets_per_byte (output_bfd)), - (o->_cooked_size != 0 - ? o->_cooked_size - : o->_raw_size))) + contents, loc, amt)) return false; } else @@ -2494,6 +2493,7 @@ _bfd_coff_write_global_sym (h, data) struct internal_syment isym; bfd_size_type symesz; unsigned int i; + file_ptr pos; output_bfd = finfo->output_bfd; @@ -2602,11 +2602,10 @@ _bfd_coff_write_global_sym (h, data) symesz = bfd_coff_symesz (output_bfd); - if (bfd_seek (output_bfd, - (obj_sym_filepos (output_bfd) - + obj_raw_syment_count (output_bfd) * symesz), - SEEK_SET) != 0 - || bfd_write (finfo->outsyms, symesz, 1, output_bfd) != symesz) + pos = obj_sym_filepos (output_bfd); + pos += obj_raw_syment_count (output_bfd) * symesz; + if (bfd_seek (output_bfd, pos, SEEK_SET) != 0 + || bfd_bwrite (finfo->outsyms, symesz, output_bfd) != symesz) { finfo->failed = true; return false; @@ -2674,9 +2673,9 @@ _bfd_coff_write_global_sym (h, data) } bfd_coff_swap_aux_out (output_bfd, (PTR) auxp, isym.n_type, - isym.n_sclass, i, isym.n_numaux, + isym.n_sclass, (int) i, isym.n_numaux, (PTR) finfo->outsyms); - if (bfd_write (finfo->outsyms, symesz, 1, output_bfd) != symesz) + if (bfd_bwrite (finfo->outsyms, symesz, output_bfd) != symesz) { finfo->failed = true; return false; @@ -2744,6 +2743,7 @@ _bfd_coff_reloc_link_order (output_bfd, bfd_byte *buf; bfd_reloc_status_type rstat; boolean ok; + file_ptr loc; size = bfd_get_reloc_size (howto); buf = (bfd_byte *) bfd_zmalloc (size); @@ -2751,7 +2751,8 @@ _bfd_coff_reloc_link_order (output_bfd, return false; rstat = _bfd_relocate_contents (howto, output_bfd, - link_order->u.reloc.p->addend, buf); + (bfd_vma) link_order->u.reloc.p->addend,\ + buf); switch (rstat) { case bfd_reloc_ok: @@ -2774,10 +2775,9 @@ _bfd_coff_reloc_link_order (output_bfd, } break; } + loc = link_order->offset * bfd_octets_per_byte (output_bfd); ok = bfd_set_section_contents (output_bfd, output_section, (PTR) buf, - (file_ptr) - (link_order->offset * - bfd_octets_per_byte (output_bfd)), size); + loc, size); free (buf); if (! ok) return false; @@ -2893,7 +2893,7 @@ _bfd_coff_generic_relocate_section (outp { (*_bfd_error_handler) ("%s: illegal symbol index %ld in relocs", - bfd_get_filename (input_bfd), symndx); + bfd_archive_filename (input_bfd), symndx); return false; } else @@ -3015,7 +3015,7 @@ _bfd_coff_generic_relocate_section (outp case bfd_reloc_outofrange: (*_bfd_error_handler) (_("%s: bad reloc address 0x%lx in section `%s'"), - bfd_get_filename (input_bfd), + bfd_archive_filename (input_bfd), (unsigned long) rel->r_vaddr, bfd_get_section_name (input_bfd, input_section)); return false; diff -uprN binutils-2.11.90.0.31/bfd/coffswap.h binutils-2.11.92.0.5/bfd/coffswap.h --- binutils-2.11.90.0.31/bfd/coffswap.h Thu May 24 21:22:43 2001 +++ binutils-2.11.92.0.5/bfd/coffswap.h Mon Oct 1 15:25:21 2001 @@ -1,5 +1,6 @@ /* Generic COFF swapping routines, for BFD. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000 + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, + 2001 Free Software Foundation, Inc. Written by Cygnus Support. @@ -27,174 +28,186 @@ Foundation, Inc., 59 Temple Place - Suit Any file which uses this must first include "coff/internal.h" and "coff/CPU.h". The functions will then be correct for that CPU. */ -#define PUTWORD bfd_h_put_32 -#define PUTHALF bfd_h_put_16 -#define PUTBYTE bfd_h_put_8 - #ifndef GET_FCN_LNNOPTR -#define GET_FCN_LNNOPTR(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr) +#define GET_FCN_LNNOPTR(abfd, ext) \ + H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr) #endif #ifndef GET_FCN_ENDNDX -#define GET_FCN_ENDNDX(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx) +#define GET_FCN_ENDNDX(abfd, ext) \ + H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_endndx) #endif #ifndef PUT_FCN_LNNOPTR -#define PUT_FCN_LNNOPTR(abfd, in, ext) PUTWORD(abfd, in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr) +#define PUT_FCN_LNNOPTR(abfd, in, ext) \ + H_PUT_32 (abfd, in, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr) #endif #ifndef PUT_FCN_ENDNDX -#define PUT_FCN_ENDNDX(abfd, in, ext) PUTWORD(abfd, in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx) +#define PUT_FCN_ENDNDX(abfd, in, ext) \ + H_PUT_32 (abfd, in, ext->x_sym.x_fcnary.x_fcn.x_endndx) #endif #ifndef GET_LNSZ_LNNO -#define GET_LNSZ_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_lnno) +#define GET_LNSZ_LNNO(abfd, ext) \ + H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_lnno) #endif #ifndef GET_LNSZ_SIZE -#define GET_LNSZ_SIZE(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_size) +#define GET_LNSZ_SIZE(abfd, ext) \ + H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_size) #endif #ifndef PUT_LNSZ_LNNO -#define PUT_LNSZ_LNNO(abfd, in, ext) bfd_h_put_16(abfd, in, (bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_lnno) +#define PUT_LNSZ_LNNO(abfd, in, ext) \ + H_PUT_16 (abfd, in, ext->x_sym.x_misc.x_lnsz.x_lnno) #endif #ifndef PUT_LNSZ_SIZE -#define PUT_LNSZ_SIZE(abfd, in, ext) bfd_h_put_16(abfd, in, (bfd_byte*) ext->x_sym.x_misc.x_lnsz.x_size) +#define PUT_LNSZ_SIZE(abfd, in, ext) \ + H_PUT_16 (abfd, in, ext->x_sym.x_misc.x_lnsz.x_size) #endif #ifndef GET_SCN_SCNLEN -#define GET_SCN_SCNLEN(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_scn.x_scnlen) +#define GET_SCN_SCNLEN(abfd, ext) \ + H_GET_32 (abfd, ext->x_scn.x_scnlen) #endif #ifndef GET_SCN_NRELOC -#define GET_SCN_NRELOC(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *)ext->x_scn.x_nreloc) +#define GET_SCN_NRELOC(abfd, ext) \ + H_GET_16 (abfd, ext->x_scn.x_nreloc) #endif #ifndef GET_SCN_NLINNO -#define GET_SCN_NLINNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *)ext->x_scn.x_nlinno) +#define GET_SCN_NLINNO(abfd, ext) \ + H_GET_16 (abfd, ext->x_scn.x_nlinno) #endif #ifndef PUT_SCN_SCNLEN -#define PUT_SCN_SCNLEN(abfd,in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_scn.x_scnlen) +#define PUT_SCN_SCNLEN(abfd, in, ext) \ + H_PUT_32 (abfd, in, ext->x_scn.x_scnlen) #endif #ifndef PUT_SCN_NRELOC -#define PUT_SCN_NRELOC(abfd,in, ext) bfd_h_put_16(abfd, in, (bfd_byte *)ext->x_scn.x_nreloc) +#define PUT_SCN_NRELOC(abfd, in, ext) \ + H_PUT_16 (abfd, in, ext->x_scn.x_nreloc) #endif #ifndef PUT_SCN_NLINNO -#define PUT_SCN_NLINNO(abfd,in, ext) bfd_h_put_16(abfd,in, (bfd_byte *) ext->x_scn.x_nlinno) +#define PUT_SCN_NLINNO(abfd, in, ext) \ + H_PUT_16 (abfd, in, ext->x_scn.x_nlinno) #endif #ifndef GET_LINENO_LNNO -#define GET_LINENO_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) (ext->l_lnno)); +#define GET_LINENO_LNNO(abfd, ext) \ + H_GET_16 (abfd, ext->l_lnno); #endif #ifndef PUT_LINENO_LNNO -#define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_16(abfd,val, (bfd_byte *) (ext->l_lnno)); +#define PUT_LINENO_LNNO(abfd, val, ext) \ + H_PUT_16 (abfd, val, ext->l_lnno); #endif /* The f_symptr field in the filehdr is sometimes 64 bits. */ #ifndef GET_FILEHDR_SYMPTR -#define GET_FILEHDR_SYMPTR bfd_h_get_32 +#define GET_FILEHDR_SYMPTR H_GET_32 #endif #ifndef PUT_FILEHDR_SYMPTR -#define PUT_FILEHDR_SYMPTR bfd_h_put_32 +#define PUT_FILEHDR_SYMPTR H_PUT_32 #endif /* Some fields in the aouthdr are sometimes 64 bits. */ #ifndef GET_AOUTHDR_TSIZE -#define GET_AOUTHDR_TSIZE bfd_h_get_32 +#define GET_AOUTHDR_TSIZE H_GET_32 #endif #ifndef PUT_AOUTHDR_TSIZE -#define PUT_AOUTHDR_TSIZE bfd_h_put_32 +#define PUT_AOUTHDR_TSIZE H_PUT_32 #endif #ifndef GET_AOUTHDR_DSIZE -#define GET_AOUTHDR_DSIZE bfd_h_get_32 +#define GET_AOUTHDR_DSIZE H_GET_32 #endif #ifndef PUT_AOUTHDR_DSIZE -#define PUT_AOUTHDR_DSIZE bfd_h_put_32 +#define PUT_AOUTHDR_DSIZE H_PUT_32 #endif #ifndef GET_AOUTHDR_BSIZE -#define GET_AOUTHDR_BSIZE bfd_h_get_32 +#define GET_AOUTHDR_BSIZE H_GET_32 #endif #ifndef PUT_AOUTHDR_BSIZE -#define PUT_AOUTHDR_BSIZE bfd_h_put_32 +#define PUT_AOUTHDR_BSIZE H_PUT_32 #endif #ifndef GET_AOUTHDR_ENTRY -#define GET_AOUTHDR_ENTRY bfd_h_get_32 +#define GET_AOUTHDR_ENTRY H_GET_32 #endif #ifndef PUT_AOUTHDR_ENTRY -#define PUT_AOUTHDR_ENTRY bfd_h_put_32 +#define PUT_AOUTHDR_ENTRY H_PUT_32 #endif #ifndef GET_AOUTHDR_TEXT_START -#define GET_AOUTHDR_TEXT_START bfd_h_get_32 +#define GET_AOUTHDR_TEXT_START H_GET_32 #endif #ifndef PUT_AOUTHDR_TEXT_START -#define PUT_AOUTHDR_TEXT_START bfd_h_put_32 +#define PUT_AOUTHDR_TEXT_START H_PUT_32 #endif #ifndef GET_AOUTHDR_DATA_START -#define GET_AOUTHDR_DATA_START bfd_h_get_32 +#define GET_AOUTHDR_DATA_START H_GET_32 #endif #ifndef PUT_AOUTHDR_DATA_START -#define PUT_AOUTHDR_DATA_START bfd_h_put_32 +#define PUT_AOUTHDR_DATA_START H_PUT_32 #endif /* Some fields in the scnhdr are sometimes 64 bits. */ #ifndef GET_SCNHDR_PADDR -#define GET_SCNHDR_PADDR bfd_h_get_32 +#define GET_SCNHDR_PADDR H_GET_32 #endif #ifndef PUT_SCNHDR_PADDR -#define PUT_SCNHDR_PADDR bfd_h_put_32 +#define PUT_SCNHDR_PADDR H_PUT_32 #endif #ifndef GET_SCNHDR_VADDR -#define GET_SCNHDR_VADDR bfd_h_get_32 +#define GET_SCNHDR_VADDR H_GET_32 #endif #ifndef PUT_SCNHDR_VADDR -#define PUT_SCNHDR_VADDR bfd_h_put_32 +#define PUT_SCNHDR_VADDR H_PUT_32 #endif #ifndef GET_SCNHDR_SIZE -#define GET_SCNHDR_SIZE bfd_h_get_32 +#define GET_SCNHDR_SIZE H_GET_32 #endif #ifndef PUT_SCNHDR_SIZE -#define PUT_SCNHDR_SIZE bfd_h_put_32 +#define PUT_SCNHDR_SIZE H_PUT_32 #endif #ifndef GET_SCNHDR_SCNPTR -#define GET_SCNHDR_SCNPTR bfd_h_get_32 +#define GET_SCNHDR_SCNPTR H_GET_32 #endif #ifndef PUT_SCNHDR_SCNPTR -#define PUT_SCNHDR_SCNPTR bfd_h_put_32 +#define PUT_SCNHDR_SCNPTR H_PUT_32 #endif #ifndef GET_SCNHDR_RELPTR -#define GET_SCNHDR_RELPTR bfd_h_get_32 +#define GET_SCNHDR_RELPTR H_GET_32 #endif #ifndef PUT_SCNHDR_RELPTR -#define PUT_SCNHDR_RELPTR bfd_h_put_32 +#define PUT_SCNHDR_RELPTR H_PUT_32 #endif #ifndef GET_SCNHDR_LNNOPTR -#define GET_SCNHDR_LNNOPTR bfd_h_get_32 +#define GET_SCNHDR_LNNOPTR H_GET_32 #endif #ifndef PUT_SCNHDR_LNNOPTR -#define PUT_SCNHDR_LNNOPTR bfd_h_put_32 +#define PUT_SCNHDR_LNNOPTR H_PUT_32 #endif #ifndef GET_SCNHDR_NRELOC -#define GET_SCNHDR_NRELOC bfd_h_get_16 +#define GET_SCNHDR_NRELOC H_GET_16 #endif #ifndef MAX_SCNHDR_NRELOC #define MAX_SCNHDR_NRELOC 0xffff #endif #ifndef PUT_SCNHDR_NRELOC -#define PUT_SCNHDR_NRELOC bfd_h_put_16 +#define PUT_SCNHDR_NRELOC H_PUT_16 #endif #ifndef GET_SCNHDR_NLNNO -#define GET_SCNHDR_NLNNO bfd_h_get_16 +#define GET_SCNHDR_NLNNO H_GET_16 #endif #ifndef MAX_SCNHDR_NLNNO #define MAX_SCNHDR_NLNNO 0xffff #endif #ifndef PUT_SCNHDR_NLNNO -#define PUT_SCNHDR_NLNNO bfd_h_put_16 +#define PUT_SCNHDR_NLNNO H_PUT_16 #endif #ifndef GET_SCNHDR_FLAGS -#define GET_SCNHDR_FLAGS bfd_h_get_32 +#define GET_SCNHDR_FLAGS H_GET_32 #endif #ifndef PUT_SCNHDR_FLAGS -#define PUT_SCNHDR_FLAGS bfd_h_put_32 +#define PUT_SCNHDR_FLAGS H_PUT_32 #endif #ifndef GET_RELOC_VADDR -#define GET_RELOC_VADDR bfd_h_get_32 +#define GET_RELOC_VADDR H_GET_32 #endif #ifndef PUT_RELOC_VADDR -#define PUT_RELOC_VADDR bfd_h_put_32 +#define PUT_RELOC_VADDR H_PUT_32 #endif static void coff_swap_aouthdr_in PARAMS ((bfd *, PTR, PTR)); @@ -229,48 +242,44 @@ coff_swap_reloc_in (abfd, src, dst) RELOC *reloc_src = (RELOC *) src; struct internal_reloc *reloc_dst = (struct internal_reloc *) dst; - reloc_dst->r_vaddr = GET_RELOC_VADDR (abfd, (bfd_byte *)reloc_src->r_vaddr); - reloc_dst->r_symndx = bfd_h_get_signed_32(abfd, (bfd_byte *) reloc_src->r_symndx); + reloc_dst->r_vaddr = GET_RELOC_VADDR (abfd, reloc_src->r_vaddr); + reloc_dst->r_symndx = H_GET_S32 (abfd, reloc_src->r_symndx); #ifdef RS6000COFF_C - reloc_dst->r_type = bfd_h_get_8(abfd, reloc_src->r_type); - reloc_dst->r_size = bfd_h_get_8(abfd, reloc_src->r_size); + reloc_dst->r_type = H_GET_8 (abfd, reloc_src->r_type); + reloc_dst->r_size = H_GET_8 (abfd, reloc_src->r_size); #else - reloc_dst->r_type = bfd_h_get_16(abfd, (bfd_byte *) reloc_src->r_type); + reloc_dst->r_type = H_GET_16 (abfd, reloc_src->r_type); #endif #ifdef SWAP_IN_RELOC_OFFSET - reloc_dst->r_offset = SWAP_IN_RELOC_OFFSET(abfd, - (bfd_byte *) reloc_src->r_offset); + reloc_dst->r_offset = SWAP_IN_RELOC_OFFSET (abfd, reloc_src->r_offset); #endif } static unsigned int coff_swap_reloc_out (abfd, src, dst) - bfd *abfd; - PTR src; - PTR dst; -{ - struct internal_reloc *reloc_src = (struct internal_reloc *)src; - struct external_reloc *reloc_dst = (struct external_reloc *)dst; - PUT_RELOC_VADDR (abfd, reloc_src->r_vaddr, (bfd_byte *) reloc_dst->r_vaddr); - bfd_h_put_32(abfd, reloc_src->r_symndx, (bfd_byte *) reloc_dst->r_symndx); + bfd *abfd; + PTR src; + PTR dst; +{ + struct internal_reloc *reloc_src = (struct internal_reloc *) src; + struct external_reloc *reloc_dst = (struct external_reloc *) dst; + PUT_RELOC_VADDR (abfd, reloc_src->r_vaddr, reloc_dst->r_vaddr); + H_PUT_32 (abfd, reloc_src->r_symndx, reloc_dst->r_symndx); #ifdef RS6000COFF_C - bfd_h_put_8 (abfd, reloc_src->r_type, (bfd_byte *) reloc_dst->r_type); - bfd_h_put_8 (abfd, reloc_src->r_size, (bfd_byte *) reloc_dst->r_size); + H_PUT_8 (abfd, reloc_src->r_type, reloc_dst->r_type); + H_PUT_8 (abfd, reloc_src->r_size, reloc_dst->r_size); #else - bfd_h_put_16(abfd, reloc_src->r_type, (bfd_byte *) - reloc_dst->r_type); + H_PUT_16 (abfd, reloc_src->r_type, reloc_dst->r_type); #endif #ifdef SWAP_OUT_RELOC_OFFSET - SWAP_OUT_RELOC_OFFSET(abfd, - reloc_src->r_offset, - (bfd_byte *) reloc_dst->r_offset); + SWAP_OUT_RELOC_OFFSET (abfd, reloc_src->r_offset, reloc_dst->r_offset); #endif #ifdef SWAP_OUT_RELOC_EXTRA - SWAP_OUT_RELOC_EXTRA(abfd,reloc_src, reloc_dst); + SWAP_OUT_RELOC_EXTRA (abfd, reloc_src, reloc_dst); #endif return bfd_coff_relsz (abfd); @@ -280,9 +289,9 @@ coff_swap_reloc_out (abfd, src, dst) static void coff_swap_filehdr_in (abfd, src, dst) - bfd *abfd; - PTR src; - PTR dst; + bfd *abfd; + PTR src; + PTR dst; { FILHDR *filehdr_src = (FILHDR *) src; struct internal_filehdr *filehdr_dst = (struct internal_filehdr *) dst; @@ -290,16 +299,15 @@ coff_swap_filehdr_in (abfd, src, dst) #ifdef COFF_ADJUST_FILEHDR_IN_PRE COFF_ADJUST_FILEHDR_IN_PRE (abfd, src, dst); #endif - filehdr_dst->f_magic = bfd_h_get_16(abfd, (bfd_byte *) filehdr_src->f_magic); - filehdr_dst->f_nscns = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_nscns); - filehdr_dst->f_timdat = bfd_h_get_32(abfd, (bfd_byte *)filehdr_src-> f_timdat); - filehdr_dst->f_symptr = - GET_FILEHDR_SYMPTR (abfd, (bfd_byte *) filehdr_src->f_symptr); - filehdr_dst->f_nsyms = bfd_h_get_32(abfd, (bfd_byte *)filehdr_src-> f_nsyms); - filehdr_dst->f_opthdr = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_opthdr); - filehdr_dst->f_flags = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_flags); + filehdr_dst->f_magic = H_GET_16 (abfd, filehdr_src->f_magic); + filehdr_dst->f_nscns = H_GET_16 (abfd, filehdr_src->f_nscns); + filehdr_dst->f_timdat = H_GET_32 (abfd, filehdr_src->f_timdat); + filehdr_dst->f_symptr = GET_FILEHDR_SYMPTR (abfd, filehdr_src->f_symptr); + filehdr_dst->f_nsyms = H_GET_32 (abfd, filehdr_src->f_nsyms); + filehdr_dst->f_opthdr = H_GET_16 (abfd, filehdr_src->f_opthdr); + filehdr_dst->f_flags = H_GET_16 (abfd, filehdr_src->f_flags); #ifdef TIC80_TARGET_ID - filehdr_dst->f_target_id = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_target_id); + filehdr_dst->f_target_id = H_GET_16 (abfd, filehdr_src->f_target_id); #endif #ifdef COFF_ADJUST_FILEHDR_IN_POST @@ -309,26 +317,25 @@ coff_swap_filehdr_in (abfd, src, dst) static unsigned int coff_swap_filehdr_out (abfd, in, out) - bfd *abfd; - PTR in; - PTR out; + bfd *abfd; + PTR in; + PTR out; { - struct internal_filehdr *filehdr_in = (struct internal_filehdr *)in; - FILHDR *filehdr_out = (FILHDR *)out; + struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in; + FILHDR *filehdr_out = (FILHDR *) out; #ifdef COFF_ADJUST_FILEHDR_OUT_PRE COFF_ADJUST_FILEHDR_OUT_PRE (abfd, in, out); #endif - bfd_h_put_16(abfd, filehdr_in->f_magic, (bfd_byte *) filehdr_out->f_magic); - bfd_h_put_16(abfd, filehdr_in->f_nscns, (bfd_byte *) filehdr_out->f_nscns); - bfd_h_put_32(abfd, filehdr_in->f_timdat, (bfd_byte *) filehdr_out->f_timdat); - PUT_FILEHDR_SYMPTR (abfd, (bfd_vma) filehdr_in->f_symptr, - (bfd_byte *) filehdr_out->f_symptr); - bfd_h_put_32(abfd, filehdr_in->f_nsyms, (bfd_byte *) filehdr_out->f_nsyms); - bfd_h_put_16(abfd, filehdr_in->f_opthdr, (bfd_byte *) filehdr_out->f_opthdr); - bfd_h_put_16(abfd, filehdr_in->f_flags, (bfd_byte *) filehdr_out->f_flags); + H_PUT_16 (abfd, filehdr_in->f_magic, filehdr_out->f_magic); + H_PUT_16 (abfd, filehdr_in->f_nscns, filehdr_out->f_nscns); + H_PUT_32 (abfd, filehdr_in->f_timdat, filehdr_out->f_timdat); + PUT_FILEHDR_SYMPTR (abfd, filehdr_in->f_symptr, filehdr_out->f_symptr); + H_PUT_32 (abfd, filehdr_in->f_nsyms, filehdr_out->f_nsyms); + H_PUT_16 (abfd, filehdr_in->f_opthdr, filehdr_out->f_opthdr); + H_PUT_16 (abfd, filehdr_in->f_flags, filehdr_out->f_flags); #ifdef TIC80_TARGET_ID - bfd_h_put_16(abfd, filehdr_in->f_target_id, (bfd_byte *) filehdr_out->f_target_id); + H_PUT_16 (abfd, filehdr_in->f_target_id, filehdr_out->f_target_id); #endif #ifdef COFF_ADJUST_FILEHDR_OUT_POST @@ -341,34 +348,38 @@ coff_swap_filehdr_out (abfd, in, out) static void coff_swap_sym_in (abfd, ext1, in1) - bfd *abfd; + bfd *abfd; PTR ext1; PTR in1; { - SYMENT *ext = (SYMENT *)ext1; - struct internal_syment *in = (struct internal_syment *)in1; + SYMENT *ext = (SYMENT *) ext1; + struct internal_syment *in = (struct internal_syment *) in1; - if( ext->e.e_name[0] == 0) { - in->_n._n_n._n_zeroes = 0; - in->_n._n_n._n_offset = bfd_h_get_32(abfd, (bfd_byte *) ext->e.e.e_offset); - } - else { + if (ext->e.e_name[0] == 0) + { + in->_n._n_n._n_zeroes = 0; + in->_n._n_n._n_offset = H_GET_32 (abfd, ext->e.e.e_offset); + } + else + { #if SYMNMLEN != E_SYMNMLEN - -> Error, we need to cope with truncating or extending SYMNMLEN!; + -> Error, we need to cope with truncating or extending SYMNMLEN!; #else - memcpy(in->_n._n_name, ext->e.e_name, SYMNMLEN); + memcpy (in->_n._n_name, ext->e.e_name, SYMNMLEN); #endif - } - in->n_value = bfd_h_get_32(abfd, (bfd_byte *) ext->e_value); - in->n_scnum = bfd_h_get_16(abfd, (bfd_byte *) ext->e_scnum); - if (sizeof (ext->e_type) == 2){ - in->n_type = bfd_h_get_16(abfd, (bfd_byte *) ext->e_type); - } - else { - in->n_type = bfd_h_get_32(abfd, (bfd_byte *) ext->e_type); - } - in->n_sclass = bfd_h_get_8(abfd, ext->e_sclass); - in->n_numaux = bfd_h_get_8(abfd, ext->e_numaux); + } + in->n_value = H_GET_32 (abfd, ext->e_value); + in->n_scnum = H_GET_16 (abfd, ext->e_scnum); + if (sizeof (ext->e_type) == 2) + { + in->n_type = H_GET_16 (abfd, ext->e_type); + } + else + { + in->n_type = H_GET_32 (abfd, ext->e_type); + } + in->n_sclass = H_GET_8 (abfd, ext->e_sclass); + in->n_numaux = H_GET_8 (abfd, ext->e_numaux); #ifdef COFF_ADJUST_SYM_IN_POST COFF_ADJUST_SYM_IN_POST (abfd, ext1, in1); #endif @@ -376,35 +387,37 @@ coff_swap_sym_in (abfd, ext1, in1) static unsigned int coff_swap_sym_out (abfd, inp, extp) - bfd *abfd; - PTR inp; - PTR extp; -{ - struct internal_syment *in = (struct internal_syment *)inp; - SYMENT *ext =(SYMENT *)extp; - if(in->_n._n_name[0] == 0) { - bfd_h_put_32(abfd, 0, (bfd_byte *) ext->e.e.e_zeroes); - bfd_h_put_32(abfd, in->_n._n_n._n_offset, (bfd_byte *) ext->e.e.e_offset); - } - else { + bfd *abfd; + PTR inp; + PTR extp; +{ + struct internal_syment *in = (struct internal_syment *) inp; + SYMENT *ext =(SYMENT *) extp; + if(in->_n._n_name[0] == 0) + { + H_PUT_32 (abfd, 0, ext->e.e.e_zeroes); + H_PUT_32 (abfd, in->_n._n_n._n_offset, ext->e.e.e_offset); + } + else + { #if SYMNMLEN != E_SYMNMLEN - -> Error, we need to cope with truncating or extending SYMNMLEN!; + -> Error, we need to cope with truncating or extending SYMNMLEN!; #else - memcpy(ext->e.e_name, in->_n._n_name, SYMNMLEN); + memcpy(ext->e.e_name, in->_n._n_name, SYMNMLEN); #endif - } - bfd_h_put_32(abfd, in->n_value , (bfd_byte *) ext->e_value); - bfd_h_put_16(abfd, in->n_scnum , (bfd_byte *) ext->e_scnum); + } + H_PUT_32 (abfd, in->n_value, ext->e_value); + H_PUT_16 (abfd, in->n_scnum, ext->e_scnum); if (sizeof (ext->e_type) == 2) - { - bfd_h_put_16(abfd, in->n_type , (bfd_byte *) ext->e_type); - } + { + H_PUT_16 (abfd, in->n_type, ext->e_type); + } else - { - bfd_h_put_32(abfd, in->n_type , (bfd_byte *) ext->e_type); - } - bfd_h_put_8(abfd, in->n_sclass , ext->e_sclass); - bfd_h_put_8(abfd, in->n_numaux , ext->e_numaux); + { + H_PUT_32 (abfd, in->n_type, ext->e_type); + } + H_PUT_8 (abfd, in->n_sclass, ext->e_sclass); + H_PUT_8 (abfd, in->n_numaux, ext->e_numaux); #ifdef COFF_ADJUST_SYM_OUT_POST COFF_ADJUST_SYM_OUT_POST (abfd, inp, extp); #endif @@ -413,42 +426,45 @@ coff_swap_sym_out (abfd, inp, extp) static void coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1) - bfd *abfd; - PTR ext1; - int type; - int class; - int indx; - int numaux; - PTR in1; + bfd *abfd; + PTR ext1; + int type; + int class; + int indx; + int numaux; + PTR in1; { - AUXENT *ext = (AUXENT *)ext1; - union internal_auxent *in = (union internal_auxent *)in1; + AUXENT *ext = (AUXENT *) ext1; + union internal_auxent *in = (union internal_auxent *) in1; #ifdef COFF_ADJUST_AUX_IN_PRE COFF_ADJUST_AUX_IN_PRE (abfd, ext1, type, class, indx, numaux, in1); #endif - switch (class) { + switch (class) + { case C_FILE: - if (ext->x_file.x_fname[0] == 0) { + if (ext->x_file.x_fname[0] == 0) + { in->x_file.x_n.x_zeroes = 0; - in->x_file.x_n.x_offset = - bfd_h_get_32(abfd, (bfd_byte *) ext->x_file.x_n.x_offset); - } else { + in->x_file.x_n.x_offset = H_GET_32 (abfd, ext->x_file.x_n.x_offset); + } + else + { #if FILNMLEN != E_FILNMLEN - -> Error, we need to cope with truncating or extending FILNMLEN!; + -> Error, we need to cope with truncating or extending FILNMLEN!; #else - if (numaux > 1) - { - if (indx == 0) - memcpy (in->x_file.x_fname, ext->x_file.x_fname, - numaux * sizeof (AUXENT)); - } - else - { - memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN); - } + if (numaux > 1) + { + if (indx == 0) + memcpy (in->x_file.x_fname, ext->x_file.x_fname, + numaux * sizeof (AUXENT)); + } + else + { + memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN); + } #endif - } + } goto end; case C_STAT: @@ -456,10 +472,11 @@ coff_swap_aux_in (abfd, ext1, type, clas case C_LEAFSTAT: #endif case C_HIDDEN: - if (type == T_NULL) { - in->x_scn.x_scnlen = GET_SCN_SCNLEN(abfd, ext); - in->x_scn.x_nreloc = GET_SCN_NRELOC(abfd, ext); - in->x_scn.x_nlinno = GET_SCN_NLINNO(abfd, ext); + if (type == T_NULL) + { + in->x_scn.x_scnlen = GET_SCN_SCNLEN (abfd, ext); + in->x_scn.x_nreloc = GET_SCN_NRELOC (abfd, ext); + in->x_scn.x_nlinno = GET_SCN_NLINNO (abfd, ext); /* PE defines some extra fields; we zero them out for safety. */ @@ -472,9 +489,9 @@ coff_swap_aux_in (abfd, ext1, type, clas break; } - in->x_sym.x_tagndx.l = bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_tagndx); + in->x_sym.x_tagndx.l = H_GET_32 (abfd, ext->x_sym.x_tagndx); #ifndef NO_TVNDX - in->x_sym.x_tvndx = bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_tvndx); + in->x_sym.x_tvndx = H_GET_16 (abfd, ext->x_sym.x_tvndx); #endif if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class)) @@ -485,29 +502,29 @@ coff_swap_aux_in (abfd, ext1, type, clas else { #if DIMNUM != E_DIMNUM - #error we need to cope with truncating or extending DIMNUM +#error we need to cope with truncating or extending DIMNUM #endif in->x_sym.x_fcnary.x_ary.x_dimen[0] = - bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[0]); + H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[0]); in->x_sym.x_fcnary.x_ary.x_dimen[1] = - bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[1]); + H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[1]); in->x_sym.x_fcnary.x_ary.x_dimen[2] = - bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[2]); + H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[2]); in->x_sym.x_fcnary.x_ary.x_dimen[3] = - bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[3]); + H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[3]); + } + + if (ISFCN(type)) + { + in->x_sym.x_misc.x_fsize = H_GET_32 (abfd, ext->x_sym.x_misc.x_fsize); + } + else + { + in->x_sym.x_misc.x_lnsz.x_lnno = GET_LNSZ_LNNO (abfd, ext); + in->x_sym.x_misc.x_lnsz.x_size = GET_LNSZ_SIZE (abfd, ext); } - if (ISFCN(type)) { - in->x_sym.x_misc.x_fsize = bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_misc.x_fsize); - } - else { - in->x_sym.x_misc.x_lnsz.x_lnno = GET_LNSZ_LNNO(abfd, ext); - in->x_sym.x_misc.x_lnsz.x_size = GET_LNSZ_SIZE(abfd, ext); - } - -end: ; - /* the semicolon is because MSVC doesn't like labels at - end of block. */ + end: ; #ifdef COFF_ADJUST_AUX_IN_POST COFF_ADJUST_AUX_IN_POST (abfd, ext1, type, class, indx, numaux, in1); @@ -516,87 +533,88 @@ end: ; static unsigned int coff_swap_aux_out (abfd, inp, type, class, indx, numaux, extp) - bfd *abfd; - PTR inp; - int type; - int class; - int indx ATTRIBUTE_UNUSED; - int numaux ATTRIBUTE_UNUSED; - PTR extp; + bfd *abfd; + PTR inp; + int type; + int class; + int indx ATTRIBUTE_UNUSED; + int numaux ATTRIBUTE_UNUSED; + PTR extp; { - union internal_auxent *in = (union internal_auxent *)inp; - AUXENT *ext = (AUXENT *)extp; + union internal_auxent *in = (union internal_auxent *) inp; + AUXENT *ext = (AUXENT *) extp; #ifdef COFF_ADJUST_AUX_OUT_PRE COFF_ADJUST_AUX_OUT_PRE (abfd, inp, type, class, indx, numaux, extp); #endif memset((PTR)ext, 0, AUXESZ); - switch (class) { - case C_FILE: - if (in->x_file.x_fname[0] == 0) { - PUTWORD(abfd, 0, (bfd_byte *) ext->x_file.x_n.x_zeroes); - PUTWORD(abfd, - in->x_file.x_n.x_offset, - (bfd_byte *) ext->x_file.x_n.x_offset); - } - else { + switch (class) + { + case C_FILE: + if (in->x_file.x_fname[0] == 0) + { + H_PUT_32 (abfd, 0, ext->x_file.x_n.x_zeroes); + H_PUT_32 (abfd, in->x_file.x_n.x_offset, ext->x_file.x_n.x_offset); + } + else + { #if FILNMLEN != E_FILNMLEN - -> Error, we need to cope with truncating or extending FILNMLEN!; + -> Error, we need to cope with truncating or extending FILNMLEN!; #else - memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN); + memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN); #endif - } - goto end; + } + goto end; - case C_STAT: + case C_STAT: #ifdef C_LEAFSTAT - case C_LEAFSTAT: + case C_LEAFSTAT: #endif - case C_HIDDEN: - if (type == T_NULL) { - PUT_SCN_SCNLEN(abfd, in->x_scn.x_scnlen, ext); - PUT_SCN_NRELOC(abfd, in->x_scn.x_nreloc, ext); - PUT_SCN_NLINNO(abfd, in->x_scn.x_nlinno, ext); - goto end; + case C_HIDDEN: + if (type == T_NULL) + { + PUT_SCN_SCNLEN (abfd, in->x_scn.x_scnlen, ext); + PUT_SCN_NRELOC (abfd, in->x_scn.x_nreloc, ext); + PUT_SCN_NLINNO (abfd, in->x_scn.x_nlinno, ext); + goto end; + } + break; } - break; - } - PUTWORD(abfd, in->x_sym.x_tagndx.l, (bfd_byte *) ext->x_sym.x_tagndx); + H_PUT_32 (abfd, in->x_sym.x_tagndx.l, ext->x_sym.x_tagndx); #ifndef NO_TVNDX - bfd_h_put_16(abfd, in->x_sym.x_tvndx , (bfd_byte *) ext->x_sym.x_tvndx); + H_PUT_16 (abfd, in->x_sym.x_tvndx, ext->x_sym.x_tvndx); #endif if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class)) { - PUT_FCN_LNNOPTR(abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr, ext); - PUT_FCN_ENDNDX(abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l, ext); + PUT_FCN_LNNOPTR (abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr, ext); + PUT_FCN_ENDNDX (abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l, ext); } else { #if DIMNUM != E_DIMNUM - #error we need to cope with truncating or extending DIMNUM +#error we need to cope with truncating or extending DIMNUM #endif - bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[0], - (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[0]); - bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[1], - (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[1]); - bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[2], - (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[2]); - bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[3], - (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[3]); + H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[0], + ext->x_sym.x_fcnary.x_ary.x_dimen[0]); + H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[1], + ext->x_sym.x_fcnary.x_ary.x_dimen[1]); + H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[2], + ext->x_sym.x_fcnary.x_ary.x_dimen[2]); + H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[3], + ext->x_sym.x_fcnary.x_ary.x_dimen[3]); } if (ISFCN (type)) - PUTWORD (abfd, in->x_sym.x_misc.x_fsize, - (bfd_byte *) ext->x_sym.x_misc.x_fsize); + H_PUT_32 (abfd, in->x_sym.x_misc.x_fsize, ext->x_sym.x_misc.x_fsize); else { PUT_LNSZ_LNNO (abfd, in->x_sym.x_misc.x_lnsz.x_lnno, ext); PUT_LNSZ_SIZE (abfd, in->x_sym.x_misc.x_lnsz.x_size, ext); } -end: + end: #ifdef COFF_ADJUST_AUX_OUT_POST COFF_ADJUST_AUX_OUT_POST (abfd, inp, type, class, indx, numaux, extp); #endif @@ -609,27 +627,26 @@ end: static void coff_swap_lineno_in (abfd, ext1, in1) - bfd *abfd; + bfd *abfd; PTR ext1; PTR in1; { - LINENO *ext = (LINENO *)ext1; - struct internal_lineno *in = (struct internal_lineno *)in1; + LINENO *ext = (LINENO *) ext1; + struct internal_lineno *in = (struct internal_lineno *) in1; - in->l_addr.l_symndx = bfd_h_get_32(abfd, (bfd_byte *) ext->l_addr.l_symndx); - in->l_lnno = GET_LINENO_LNNO(abfd, ext); + in->l_addr.l_symndx = H_GET_32 (abfd, ext->l_addr.l_symndx); + in->l_lnno = GET_LINENO_LNNO (abfd, ext); } static unsigned int coff_swap_lineno_out (abfd, inp, outp) - bfd *abfd; - PTR inp; - PTR outp; -{ - struct internal_lineno *in = (struct internal_lineno *)inp; - struct external_lineno *ext = (struct external_lineno *)outp; - PUTWORD(abfd, in->l_addr.l_symndx, (bfd_byte *) - ext->l_addr.l_symndx); + bfd *abfd; + PTR inp; + PTR outp; +{ + struct internal_lineno *in = (struct internal_lineno *) inp; + struct external_lineno *ext = (struct external_lineno *) outp; + H_PUT_32 (abfd, in->l_addr.l_symndx, ext->l_addr.l_symndx); PUT_LINENO_LNNO (abfd, in->l_lnno, ext); return LINESZ; @@ -639,128 +656,126 @@ coff_swap_lineno_out (abfd, inp, outp) static void coff_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1) - bfd *abfd; + bfd *abfd; PTR aouthdr_ext1; PTR aouthdr_int1; { - AOUTHDR *aouthdr_ext = (AOUTHDR *) aouthdr_ext1; - struct internal_aouthdr *aouthdr_int = (struct internal_aouthdr *)aouthdr_int1; + AOUTHDR *aouthdr_ext; + struct internal_aouthdr *aouthdr_int; - aouthdr_int->magic = bfd_h_get_16(abfd, (bfd_byte *) aouthdr_ext->magic); - aouthdr_int->vstamp = bfd_h_get_16(abfd, (bfd_byte *) aouthdr_ext->vstamp); - aouthdr_int->tsize = - GET_AOUTHDR_TSIZE (abfd, (bfd_byte *) aouthdr_ext->tsize); - aouthdr_int->dsize = - GET_AOUTHDR_DSIZE (abfd, (bfd_byte *) aouthdr_ext->dsize); - aouthdr_int->bsize = - GET_AOUTHDR_BSIZE (abfd, (bfd_byte *) aouthdr_ext->bsize); - aouthdr_int->entry = - GET_AOUTHDR_ENTRY (abfd, (bfd_byte *) aouthdr_ext->entry); + aouthdr_ext = (AOUTHDR *) aouthdr_ext1; + aouthdr_int = (struct internal_aouthdr *) aouthdr_int1; + aouthdr_int->magic = H_GET_16 (abfd, aouthdr_ext->magic); + aouthdr_int->vstamp = H_GET_16 (abfd, aouthdr_ext->vstamp); + aouthdr_int->tsize = GET_AOUTHDR_TSIZE (abfd, aouthdr_ext->tsize); + aouthdr_int->dsize = GET_AOUTHDR_DSIZE (abfd, aouthdr_ext->dsize); + aouthdr_int->bsize = GET_AOUTHDR_BSIZE (abfd, aouthdr_ext->bsize); + aouthdr_int->entry = GET_AOUTHDR_ENTRY (abfd, aouthdr_ext->entry); aouthdr_int->text_start = - GET_AOUTHDR_TEXT_START (abfd, (bfd_byte *) aouthdr_ext->text_start); + GET_AOUTHDR_TEXT_START (abfd, aouthdr_ext->text_start); aouthdr_int->data_start = - GET_AOUTHDR_DATA_START (abfd, (bfd_byte *) aouthdr_ext->data_start); + GET_AOUTHDR_DATA_START (abfd, aouthdr_ext->data_start); #ifdef I960 - aouthdr_int->tagentries = bfd_h_get_32(abfd, (bfd_byte *) aouthdr_ext->tagentries); + aouthdr_int->tagentries = H_GET_32 (abfd, aouthdr_ext->tagentries); #endif #ifdef APOLLO_M68 - bfd_h_put_32(abfd, aouthdr_int->o_inlib, (bfd_byte *) aouthdr_ext->o_inlib); - bfd_h_put_32(abfd, aouthdr_int->o_sri, (bfd_byte *) aouthdr_ext->o_sri); - bfd_h_put_32(abfd, aouthdr_int->vid[0], (bfd_byte *) aouthdr_ext->vid); - bfd_h_put_32(abfd, aouthdr_int->vid[1], (bfd_byte *) aouthdr_ext->vid + 4); + H_PUT_32 (abfd, aouthdr_int->o_inlib, aouthdr_ext->o_inlib); + H_PUT_32 (abfd, aouthdr_int->o_sri, aouthdr_ext->o_sri); + H_PUT_32 (abfd, aouthdr_int->vid[0], aouthdr_ext->vid); + H_PUT_32 (abfd, aouthdr_int->vid[1], aouthdr_ext->vid + 4); #endif #ifdef RS6000COFF_C #ifdef XCOFF64 - aouthdr_int->o_toc = bfd_h_get_64(abfd, aouthdr_ext->o_toc); + aouthdr_int->o_toc = H_GET_64 (abfd, aouthdr_ext->o_toc); #else - aouthdr_int->o_toc = bfd_h_get_32(abfd, aouthdr_ext->o_toc); + aouthdr_int->o_toc = H_GET_32 (abfd, aouthdr_ext->o_toc); #endif - aouthdr_int->o_snentry = bfd_h_get_16(abfd, aouthdr_ext->o_snentry); - aouthdr_int->o_sntext = bfd_h_get_16(abfd, aouthdr_ext->o_sntext); - aouthdr_int->o_sndata = bfd_h_get_16(abfd, aouthdr_ext->o_sndata); - aouthdr_int->o_sntoc = bfd_h_get_16(abfd, aouthdr_ext->o_sntoc); - aouthdr_int->o_snloader = bfd_h_get_16(abfd, aouthdr_ext->o_snloader); - aouthdr_int->o_snbss = bfd_h_get_16(abfd, aouthdr_ext->o_snbss); - aouthdr_int->o_algntext = bfd_h_get_16(abfd, aouthdr_ext->o_algntext); - aouthdr_int->o_algndata = bfd_h_get_16(abfd, aouthdr_ext->o_algndata); - aouthdr_int->o_modtype = bfd_h_get_16(abfd, aouthdr_ext->o_modtype); - aouthdr_int->o_cputype = bfd_h_get_16(abfd, aouthdr_ext->o_cputype); + aouthdr_int->o_snentry = H_GET_16 (abfd, aouthdr_ext->o_snentry); + aouthdr_int->o_sntext = H_GET_16 (abfd, aouthdr_ext->o_sntext); + aouthdr_int->o_sndata = H_GET_16 (abfd, aouthdr_ext->o_sndata); + aouthdr_int->o_sntoc = H_GET_16 (abfd, aouthdr_ext->o_sntoc); + aouthdr_int->o_snloader = H_GET_16 (abfd, aouthdr_ext->o_snloader); + aouthdr_int->o_snbss = H_GET_16 (abfd, aouthdr_ext->o_snbss); + aouthdr_int->o_algntext = H_GET_16 (abfd, aouthdr_ext->o_algntext); + aouthdr_int->o_algndata = H_GET_16 (abfd, aouthdr_ext->o_algndata); + aouthdr_int->o_modtype = H_GET_16 (abfd, aouthdr_ext->o_modtype); + aouthdr_int->o_cputype = H_GET_16 (abfd, aouthdr_ext->o_cputype); #ifdef XCOFF64 - aouthdr_int->o_maxstack = bfd_h_get_64(abfd, aouthdr_ext->o_maxstack); - aouthdr_int->o_maxdata = bfd_h_get_64(abfd, aouthdr_ext->o_maxdata); + aouthdr_int->o_maxstack = H_GET_64 (abfd, aouthdr_ext->o_maxstack); + aouthdr_int->o_maxdata = H_GET_64 (abfd, aouthdr_ext->o_maxdata); #else - aouthdr_int->o_maxstack = bfd_h_get_32(abfd, aouthdr_ext->o_maxstack); - aouthdr_int->o_maxdata = bfd_h_get_32(abfd, aouthdr_ext->o_maxdata); + aouthdr_int->o_maxstack = H_GET_32 (abfd, aouthdr_ext->o_maxstack); + aouthdr_int->o_maxdata = H_GET_32 (abfd, aouthdr_ext->o_maxdata); #endif #endif #ifdef MIPSECOFF - aouthdr_int->bss_start = bfd_h_get_32(abfd, aouthdr_ext->bss_start); - aouthdr_int->gp_value = bfd_h_get_32(abfd, aouthdr_ext->gp_value); - aouthdr_int->gprmask = bfd_h_get_32(abfd, aouthdr_ext->gprmask); - aouthdr_int->cprmask[0] = bfd_h_get_32(abfd, aouthdr_ext->cprmask[0]); - aouthdr_int->cprmask[1] = bfd_h_get_32(abfd, aouthdr_ext->cprmask[1]); - aouthdr_int->cprmask[2] = bfd_h_get_32(abfd, aouthdr_ext->cprmask[2]); - aouthdr_int->cprmask[3] = bfd_h_get_32(abfd, aouthdr_ext->cprmask[3]); + aouthdr_int->bss_start = H_GET_32 (abfd, aouthdr_ext->bss_start); + aouthdr_int->gp_value = H_GET_32 (abfd, aouthdr_ext->gp_value); + aouthdr_int->gprmask = H_GET_32 (abfd, aouthdr_ext->gprmask); + aouthdr_int->cprmask[0] = H_GET_32 (abfd, aouthdr_ext->cprmask[0]); + aouthdr_int->cprmask[1] = H_GET_32 (abfd, aouthdr_ext->cprmask[1]); + aouthdr_int->cprmask[2] = H_GET_32 (abfd, aouthdr_ext->cprmask[2]); + aouthdr_int->cprmask[3] = H_GET_32 (abfd, aouthdr_ext->cprmask[3]); #endif #ifdef ALPHAECOFF - aouthdr_int->bss_start = bfd_h_get_64(abfd, aouthdr_ext->bss_start); - aouthdr_int->gp_value = bfd_h_get_64(abfd, aouthdr_ext->gp_value); - aouthdr_int->gprmask = bfd_h_get_32(abfd, aouthdr_ext->gprmask); - aouthdr_int->fprmask = bfd_h_get_32(abfd, aouthdr_ext->fprmask); + aouthdr_int->bss_start = H_GET_64 (abfd, aouthdr_ext->bss_start); + aouthdr_int->gp_value = H_GET_64 (abfd, aouthdr_ext->gp_value); + aouthdr_int->gprmask = H_GET_32 (abfd, aouthdr_ext->gprmask); + aouthdr_int->fprmask = H_GET_32 (abfd, aouthdr_ext->fprmask); #endif } static unsigned int coff_swap_aouthdr_out (abfd, in, out) - bfd *abfd; - PTR in; - PTR out; -{ - struct internal_aouthdr *aouthdr_in = (struct internal_aouthdr *)in; - AOUTHDR *aouthdr_out = (AOUTHDR *)out; - - bfd_h_put_16(abfd, aouthdr_in->magic, (bfd_byte *) aouthdr_out->magic); - bfd_h_put_16(abfd, aouthdr_in->vstamp, (bfd_byte *) aouthdr_out->vstamp); - PUT_AOUTHDR_TSIZE (abfd, aouthdr_in->tsize, (bfd_byte *) aouthdr_out->tsize); - PUT_AOUTHDR_DSIZE (abfd, aouthdr_in->dsize, (bfd_byte *) aouthdr_out->dsize); - PUT_AOUTHDR_BSIZE (abfd, aouthdr_in->bsize, (bfd_byte *) aouthdr_out->bsize); - PUT_AOUTHDR_ENTRY (abfd, aouthdr_in->entry, (bfd_byte *) aouthdr_out->entry); + bfd *abfd; + PTR in; + PTR out; +{ + struct internal_aouthdr *aouthdr_in = (struct internal_aouthdr *) in; + AOUTHDR *aouthdr_out = (AOUTHDR *) out; + + H_PUT_16 (abfd, aouthdr_in->magic, aouthdr_out->magic); + H_PUT_16 (abfd, aouthdr_in->vstamp, aouthdr_out->vstamp); + PUT_AOUTHDR_TSIZE (abfd, aouthdr_in->tsize, aouthdr_out->tsize); + PUT_AOUTHDR_DSIZE (abfd, aouthdr_in->dsize, aouthdr_out->dsize); + PUT_AOUTHDR_BSIZE (abfd, aouthdr_in->bsize, aouthdr_out->bsize); + PUT_AOUTHDR_ENTRY (abfd, aouthdr_in->entry, aouthdr_out->entry); PUT_AOUTHDR_TEXT_START (abfd, aouthdr_in->text_start, - (bfd_byte *) aouthdr_out->text_start); + aouthdr_out->text_start); PUT_AOUTHDR_DATA_START (abfd, aouthdr_in->data_start, - (bfd_byte *) aouthdr_out->data_start); + aouthdr_out->data_start); #ifdef I960 - bfd_h_put_32(abfd, aouthdr_in->tagentries, (bfd_byte *) aouthdr_out->tagentries); + H_PUT_32 (abfd, aouthdr_in->tagentries, aouthdr_out->tagentries); #endif #ifdef RS6000COFF_C #ifdef XCOFF64 - bfd_h_put_64 (abfd, aouthdr_in->o_toc, aouthdr_out->o_toc); + H_PUT_64 (abfd, aouthdr_in->o_toc, aouthdr_out->o_toc); #else - bfd_h_put_32 (abfd, aouthdr_in->o_toc, aouthdr_out->o_toc); + H_PUT_32 (abfd, aouthdr_in->o_toc, aouthdr_out->o_toc); #endif - bfd_h_put_16 (abfd, aouthdr_in->o_snentry, aouthdr_out->o_snentry); - bfd_h_put_16 (abfd, aouthdr_in->o_sntext, aouthdr_out->o_sntext); - bfd_h_put_16 (abfd, aouthdr_in->o_sndata, aouthdr_out->o_sndata); - bfd_h_put_16 (abfd, aouthdr_in->o_sntoc, aouthdr_out->o_sntoc); - bfd_h_put_16 (abfd, aouthdr_in->o_snloader, aouthdr_out->o_snloader); - bfd_h_put_16 (abfd, aouthdr_in->o_snbss, aouthdr_out->o_snbss); - bfd_h_put_16 (abfd, aouthdr_in->o_algntext, aouthdr_out->o_algntext); - bfd_h_put_16 (abfd, aouthdr_in->o_algndata, aouthdr_out->o_algndata); - bfd_h_put_16 (abfd, aouthdr_in->o_modtype, aouthdr_out->o_modtype); - bfd_h_put_16 (abfd, aouthdr_in->o_cputype, aouthdr_out->o_cputype); + H_PUT_16 (abfd, aouthdr_in->o_snentry, aouthdr_out->o_snentry); + H_PUT_16 (abfd, aouthdr_in->o_sntext, aouthdr_out->o_sntext); + H_PUT_16 (abfd, aouthdr_in->o_sndata, aouthdr_out->o_sndata); + H_PUT_16 (abfd, aouthdr_in->o_sntoc, aouthdr_out->o_sntoc); + H_PUT_16 (abfd, aouthdr_in->o_snloader, aouthdr_out->o_snloader); + H_PUT_16 (abfd, aouthdr_in->o_snbss, aouthdr_out->o_snbss); + H_PUT_16 (abfd, aouthdr_in->o_algntext, aouthdr_out->o_algntext); + H_PUT_16 (abfd, aouthdr_in->o_algndata, aouthdr_out->o_algndata); + H_PUT_16 (abfd, aouthdr_in->o_modtype, aouthdr_out->o_modtype); + H_PUT_16 (abfd, aouthdr_in->o_cputype, aouthdr_out->o_cputype); #ifdef XCOFF64 - bfd_h_put_64 (abfd, aouthdr_in->o_maxstack, aouthdr_out->o_maxstack); - bfd_h_put_64 (abfd, aouthdr_in->o_maxdata, aouthdr_out->o_maxdata); + H_PUT_64 (abfd, aouthdr_in->o_maxstack, aouthdr_out->o_maxstack); + H_PUT_64 (abfd, aouthdr_in->o_maxdata, aouthdr_out->o_maxdata); #else - bfd_h_put_32 (abfd, aouthdr_in->o_maxstack, aouthdr_out->o_maxstack); - bfd_h_put_32 (abfd, aouthdr_in->o_maxdata, aouthdr_out->o_maxdata); + H_PUT_32 (abfd, aouthdr_in->o_maxstack, aouthdr_out->o_maxstack); + H_PUT_32 (abfd, aouthdr_in->o_maxdata, aouthdr_out->o_maxdata); #endif memset (aouthdr_out->o_resv2, 0, sizeof aouthdr_out->o_resv2); #ifdef XCOFF64 @@ -770,23 +785,23 @@ coff_swap_aouthdr_out (abfd, in, out) #endif #ifdef MIPSECOFF - bfd_h_put_32(abfd, aouthdr_in->bss_start, (bfd_byte *) aouthdr_out->bss_start); - bfd_h_put_32(abfd, aouthdr_in->gp_value, (bfd_byte *) aouthdr_out->gp_value); - bfd_h_put_32(abfd, aouthdr_in->gprmask, (bfd_byte *) aouthdr_out->gprmask); - bfd_h_put_32(abfd, aouthdr_in->cprmask[0], (bfd_byte *) aouthdr_out->cprmask[0]); - bfd_h_put_32(abfd, aouthdr_in->cprmask[1], (bfd_byte *) aouthdr_out->cprmask[1]); - bfd_h_put_32(abfd, aouthdr_in->cprmask[2], (bfd_byte *) aouthdr_out->cprmask[2]); - bfd_h_put_32(abfd, aouthdr_in->cprmask[3], (bfd_byte *) aouthdr_out->cprmask[3]); + H_PUT_32 (abfd, aouthdr_in->bss_start, aouthdr_out->bss_start); + H_PUT_32 (abfd, aouthdr_in->gp_value, aouthdr_out->gp_value); + H_PUT_32 (abfd, aouthdr_in->gprmask, aouthdr_out->gprmask); + H_PUT_32 (abfd, aouthdr_in->cprmask[0], aouthdr_out->cprmask[0]); + H_PUT_32 (abfd, aouthdr_in->cprmask[1], aouthdr_out->cprmask[1]); + H_PUT_32 (abfd, aouthdr_in->cprmask[2], aouthdr_out->cprmask[2]); + H_PUT_32 (abfd, aouthdr_in->cprmask[3], aouthdr_out->cprmask[3]); #endif #ifdef ALPHAECOFF /* FIXME: What does bldrev mean? */ - bfd_h_put_16(abfd, (bfd_vma) 2, (bfd_byte *) aouthdr_out->bldrev); - bfd_h_put_16(abfd, (bfd_vma) 0, (bfd_byte *) aouthdr_out->padding); - bfd_h_put_64(abfd, aouthdr_in->bss_start, (bfd_byte *) aouthdr_out->bss_start); - bfd_h_put_64(abfd, aouthdr_in->gp_value, (bfd_byte *) aouthdr_out->gp_value); - bfd_h_put_32(abfd, aouthdr_in->gprmask, (bfd_byte *) aouthdr_out->gprmask); - bfd_h_put_32(abfd, aouthdr_in->fprmask, (bfd_byte *) aouthdr_out->fprmask); + H_PUT_16 (abfd, 2, aouthdr_out->bldrev); + H_PUT_16 (abfd, 0, aouthdr_out->padding); + H_PUT_64 (abfd, aouthdr_in->bss_start, aouthdr_out->bss_start); + H_PUT_64 (abfd, aouthdr_in->gp_value, aouthdr_out->gp_value); + H_PUT_32 (abfd, aouthdr_in->gprmask, aouthdr_out->gprmask); + H_PUT_32 (abfd, aouthdr_in->fprmask, aouthdr_out->fprmask); #endif return AOUTSZ; @@ -794,9 +809,9 @@ coff_swap_aouthdr_out (abfd, in, out) static void coff_swap_scnhdr_in (abfd, ext, in) - bfd *abfd; - PTR ext; - PTR in; + bfd *abfd; + PTR ext; + PTR in; { SCNHDR *scnhdr_ext = (SCNHDR *) ext; struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in; @@ -805,28 +820,18 @@ coff_swap_scnhdr_in (abfd, ext, in) COFF_ADJUST_SCNHDR_IN_PRE (abfd, ext, in); #endif memcpy(scnhdr_int->s_name, scnhdr_ext->s_name, sizeof (scnhdr_int->s_name)); - scnhdr_int->s_vaddr = - GET_SCNHDR_VADDR (abfd, (bfd_byte *) scnhdr_ext->s_vaddr); - scnhdr_int->s_paddr = - GET_SCNHDR_PADDR (abfd, (bfd_byte *) scnhdr_ext->s_paddr); - scnhdr_int->s_size = - GET_SCNHDR_SIZE (abfd, (bfd_byte *) scnhdr_ext->s_size); - - scnhdr_int->s_scnptr = - GET_SCNHDR_SCNPTR (abfd, (bfd_byte *) scnhdr_ext->s_scnptr); - scnhdr_int->s_relptr = - GET_SCNHDR_RELPTR (abfd, (bfd_byte *) scnhdr_ext->s_relptr); - scnhdr_int->s_lnnoptr = - GET_SCNHDR_LNNOPTR (abfd, (bfd_byte *) scnhdr_ext->s_lnnoptr); - scnhdr_int->s_flags = - GET_SCNHDR_FLAGS (abfd, (bfd_byte *) scnhdr_ext->s_flags); - scnhdr_int->s_nreloc = - GET_SCNHDR_NRELOC (abfd, (bfd_byte *) scnhdr_ext->s_nreloc); - scnhdr_int->s_nlnno = - GET_SCNHDR_NLNNO (abfd, (bfd_byte *) scnhdr_ext->s_nlnno); + scnhdr_int->s_vaddr = GET_SCNHDR_VADDR (abfd, scnhdr_ext->s_vaddr); + scnhdr_int->s_paddr = GET_SCNHDR_PADDR (abfd, scnhdr_ext->s_paddr); + scnhdr_int->s_size = GET_SCNHDR_SIZE (abfd, scnhdr_ext->s_size); + + scnhdr_int->s_scnptr = GET_SCNHDR_SCNPTR (abfd, scnhdr_ext->s_scnptr); + scnhdr_int->s_relptr = GET_SCNHDR_RELPTR (abfd, scnhdr_ext->s_relptr); + scnhdr_int->s_lnnoptr = GET_SCNHDR_LNNOPTR (abfd, scnhdr_ext->s_lnnoptr); + scnhdr_int->s_flags = GET_SCNHDR_FLAGS (abfd, scnhdr_ext->s_flags); + scnhdr_int->s_nreloc = GET_SCNHDR_NRELOC (abfd, scnhdr_ext->s_nreloc); + scnhdr_int->s_nlnno = GET_SCNHDR_NLNNO (abfd, scnhdr_ext->s_nlnno); #ifdef I960 - scnhdr_int->s_align = - GET_SCNHDR_ALIGN (abfd, (bfd_byte *) scnhdr_ext->s_align); + scnhdr_int->s_align = GET_SCNHDR_ALIGN (abfd, scnhdr_ext->s_align); #endif #ifdef COFF_ADJUST_SCNHDR_IN_POST COFF_ADJUST_SCNHDR_IN_POST (abfd, ext, in); @@ -835,42 +840,32 @@ coff_swap_scnhdr_in (abfd, ext, in) static unsigned int coff_swap_scnhdr_out (abfd, in, out) - bfd *abfd; - PTR in; - PTR out; + bfd *abfd; + PTR in; + PTR out; { - struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *)in; - SCNHDR *scnhdr_ext = (SCNHDR *)out; + struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in; + SCNHDR *scnhdr_ext = (SCNHDR *) out; unsigned int ret = bfd_coff_scnhsz (abfd); #ifdef COFF_ADJUST_SCNHDR_OUT_PRE COFF_ADJUST_SCNHDR_OUT_PRE (abfd, in, out); #endif - memcpy(scnhdr_ext->s_name, scnhdr_int->s_name, sizeof (scnhdr_int->s_name)); - - PUT_SCNHDR_VADDR (abfd, scnhdr_int->s_vaddr, - (bfd_byte *) scnhdr_ext->s_vaddr); + memcpy (scnhdr_ext->s_name, scnhdr_int->s_name, sizeof (scnhdr_int->s_name)); - PUT_SCNHDR_PADDR (abfd, scnhdr_int->s_paddr, - (bfd_byte *) scnhdr_ext->s_paddr); - PUT_SCNHDR_SIZE (abfd, scnhdr_int->s_size, - (bfd_byte *) scnhdr_ext->s_size); - - PUT_SCNHDR_SCNPTR (abfd, scnhdr_int->s_scnptr, - (bfd_byte *) scnhdr_ext->s_scnptr); - PUT_SCNHDR_RELPTR (abfd, scnhdr_int->s_relptr, - (bfd_byte *) scnhdr_ext->s_relptr); - PUT_SCNHDR_LNNOPTR (abfd, scnhdr_int->s_lnnoptr, - (bfd_byte *) scnhdr_ext->s_lnnoptr); - PUT_SCNHDR_FLAGS (abfd, scnhdr_int->s_flags, - (bfd_byte *) scnhdr_ext->s_flags); + PUT_SCNHDR_VADDR (abfd, scnhdr_int->s_vaddr, scnhdr_ext->s_vaddr); + PUT_SCNHDR_PADDR (abfd, scnhdr_int->s_paddr, scnhdr_ext->s_paddr); + PUT_SCNHDR_SIZE (abfd, scnhdr_int->s_size, scnhdr_ext->s_size); + PUT_SCNHDR_SCNPTR (abfd, scnhdr_int->s_scnptr, scnhdr_ext->s_scnptr); + PUT_SCNHDR_RELPTR (abfd, scnhdr_int->s_relptr, scnhdr_ext->s_relptr); + PUT_SCNHDR_LNNOPTR (abfd, scnhdr_int->s_lnnoptr, scnhdr_ext->s_lnnoptr); + PUT_SCNHDR_FLAGS (abfd, scnhdr_int->s_flags, scnhdr_ext->s_flags); #if defined(M88) - PUTWORD(abfd, scnhdr_int->s_nlnno, (bfd_byte *) scnhdr_ext->s_nlnno); - PUTWORD(abfd, scnhdr_int->s_nreloc, (bfd_byte *) scnhdr_ext->s_nreloc); + H_PUT_32 (abfd, scnhdr_int->s_nlnno, scnhdr_ext->s_nlnno); + H_PUT_32 (abfd, scnhdr_int->s_nreloc, scnhdr_ext->s_nreloc); #else if (scnhdr_int->s_nlnno <= MAX_SCNHDR_NLNNO) - PUT_SCNHDR_NLNNO(abfd, scnhdr_int->s_nlnno, - (bfd_byte *) scnhdr_ext->s_nlnno); + PUT_SCNHDR_NLNNO (abfd, scnhdr_int->s_nlnno, scnhdr_ext->s_nlnno); else { char buf[sizeof (scnhdr_int->s_name) + 1]; @@ -881,11 +876,10 @@ coff_swap_scnhdr_out (abfd, in, out) (_("%s: warning: %s: line number overflow: 0x%lx > 0xffff"), bfd_get_filename (abfd), buf, scnhdr_int->s_nlnno); - PUT_SCNHDR_NLNNO(abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nlnno); + PUT_SCNHDR_NLNNO (abfd, 0xffff, scnhdr_ext->s_nlnno); } if (scnhdr_int->s_nreloc <= MAX_SCNHDR_NRELOC) - PUT_SCNHDR_NRELOC(abfd, scnhdr_int->s_nreloc, - (bfd_byte *) scnhdr_ext->s_nreloc); + PUT_SCNHDR_NRELOC (abfd, scnhdr_int->s_nreloc, scnhdr_ext->s_nreloc); else { char buf[sizeof (scnhdr_int->s_name) + 1]; @@ -896,13 +890,13 @@ coff_swap_scnhdr_out (abfd, in, out) bfd_get_filename (abfd), buf, scnhdr_int->s_nreloc); bfd_set_error (bfd_error_file_truncated); - PUT_SCNHDR_NRELOC(abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nreloc); + PUT_SCNHDR_NRELOC (abfd, 0xffff, scnhdr_ext->s_nreloc); ret = 0; } #endif #ifdef I960 - PUT_SCNHDR_ALIGN (abfd, scnhdr_int->s_align, (bfd_byte *) scnhdr_ext->s_align); + PUT_SCNHDR_ALIGN (abfd, scnhdr_int->s_align, scnhdr_ext->s_align); #endif #ifdef COFF_ADJUST_SCNHDR_OUT_POST COFF_ADJUST_SCNHDR_OUT_POST (abfd, in, out); diff -uprN binutils-2.11.90.0.31/bfd/config.bfd binutils-2.11.92.0.5/bfd/config.bfd --- binutils-2.11.90.0.31/bfd/config.bfd Thu Aug 30 09:30:36 2001 +++ binutils-2.11.92.0.5/bfd/config.bfd Mon Oct 1 15:25:21 2001 @@ -112,7 +112,7 @@ case "${targ}" in targ_selvecs=bfd_elf32_bigarc_vec ;; - arm-*-netbsd*) + arm-*-netbsd* | arm-*-openbsd*) targ_defvec=armnetbsd_vec targ_underscore=yes ;; @@ -613,7 +613,7 @@ case "${targ}" in targ_defvec=ecoff_big_vec targ_selvecs=ecoff_little_vec ;; - mips-dec-netbsd* | mips*el*-*-netbsd*) + mips-dec-netbsd* | mips*el-*-netbsd*) targ_defvec=bfd_elf32_littlemips_vec targ_selvecs="bfd_elf32_bigmips_vec ecoff_little_vec ecoff_big_vec" ;; @@ -682,19 +682,27 @@ case "${targ}" in targ_defvec=bfd_elf32_bigmips_vec targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec" ;; - mips*el*-*-openbsd*) + mips*el-*-openbsd*) targ_defvec=bfd_elf32_littlemips_vec targ_selvecs="bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec ecoff_little_vec ecoff_big_vec" ;; - mips*el*-*-linux-gnu*) - targ_defvec=bfd_elf32_tradlittlemips_vec - targ_selvecs="bfd_elf32_tradbigmips_vec bfd_elf64_tradlittlemips_vec bfd_elf64_tradbigmips_vec ecoff_little_vec ecoff_big_vec" - ;; mips*-*-openbsd*) targ_defvec=bfd_elf32_bigmips_vec targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec ecoff_big_vec ecoff_little_vec" ;; - mips*-*-linux-gnu*) + mips64*el-*-linux*) + targ_defvec=bfd_elf32_tradlittlemips_vec + targ_selvecs="bfd_elf32_tradbigmips_vec bfd_elf64_tradlittlemips_vec bfd_elf64_tradbigmips_vec" + ;; + mips*el-*-linux*) + targ_defvec=bfd_elf32_tradlittlemips_vec + targ_selvecs="bfd_elf32_tradbigmips_vec bfd_elf64_tradlittlemips_vec bfd_elf64_tradbigmips_vec ecoff_little_vec ecoff_big_vec" + ;; + mips64*-*-linux*) + targ_defvec=bfd_elf32_tradbigmips_vec + targ_selvecs="bfd_elf32_tradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec" + ;; + mips*-*-linux*) targ_defvec=bfd_elf32_tradbigmips_vec targ_selvecs="bfd_elf32_tradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec ecoff_big_vec ecoff_little_vec" ;; diff -uprN binutils-2.11.90.0.31/bfd/configure binutils-2.11.92.0.5/bfd/configure --- binutils-2.11.90.0.31/bfd/configure Thu Aug 30 14:58:39 2001 +++ binutils-2.11.92.0.5/bfd/configure Fri Oct 5 14:11:21 2001 @@ -1116,7 +1116,7 @@ fi PACKAGE=bfd -VERSION=2.11.90.0.31 +VERSION=2.11.92.0.5 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } @@ -1198,6 +1198,19 @@ else fi +# Uncomment the next line to remove the date from the reported bfd version +#is_release=y + +bfd_version=`echo "${VERSION}" | sed -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$/\1\2\3\4\5/'` + +bfd_version_string="\"${VERSION}\"" +bfd_version_date=`sed -e 's/.*DATE //' < ${srcdir}/version.h` +if test x${is_release} = x; then + bfd_version_string="\"${VERSION} ${bfd_version_date}\"" +fi + + + if test $host != $build; then ac_tool_prefix=${host_alias}- @@ -1208,7 +1221,7 @@ fi # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1212: checking for $ac_word" >&5 +echo "configure:1225: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1240,7 +1253,7 @@ fi # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1244: checking for $ac_word" >&5 +echo "configure:1257: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1272,7 +1285,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1276: checking for $ac_word" >&5 +echo "configure:1289: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1387,7 +1400,7 @@ ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 -echo "configure:1391: checking for ld used by GCC" >&5 +echo "configure:1404: checking for ld used by GCC" >&5 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw @@ -1417,10 +1430,10 @@ echo "configure:1391: checking for ld us esac elif test "$with_gnu_ld" = yes; then echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 -echo "configure:1421: checking for GNU ld" >&5 +echo "configure:1434: checking for GNU ld" >&5 else echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 -echo "configure:1424: checking for non-GNU ld" >&5 +echo "configure:1437: checking for non-GNU ld" >&5 fi if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1455,7 +1468,7 @@ else fi test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 -echo "configure:1459: checking if the linker ($LD) is GNU ld" >&5 +echo "configure:1472: checking if the linker ($LD) is GNU ld" >&5 if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1472,7 +1485,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6 -echo "configure:1476: checking for $LD option to reload object files" >&5 +echo "configure:1489: checking for $LD option to reload object files" >&5 if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1484,7 +1497,7 @@ reload_flag=$lt_cv_ld_reload_flag test -n "$reload_flag" && reload_flag=" $reload_flag" echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 -echo "configure:1488: checking for BSD-compatible nm" >&5 +echo "configure:1501: checking for BSD-compatible nm" >&5 if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1522,7 +1535,7 @@ NM="$lt_cv_path_NM" echo "$ac_t""$NM" 1>&6 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1526: checking whether ln -s works" >&5 +echo "configure:1539: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1543,7 +1556,7 @@ else fi echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6 -echo "configure:1547: checking how to recognise dependant libraries" >&5 +echo "configure:1560: checking how to recognise dependant libraries" >&5 if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1707,13 +1720,13 @@ file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method echo $ac_n "checking for object suffix""... $ac_c" 1>&6 -echo "configure:1711: checking for object suffix" >&5 +echo "configure:1724: checking for object suffix" >&5 if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else rm -f conftest* echo 'int i = 1;' > conftest.$ac_ext -if { (eval echo configure:1717: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1730: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then for ac_file in conftest.*; do case $ac_file in *.c) ;; @@ -1733,7 +1746,7 @@ ac_objext=$ac_cv_objext echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:1737: checking for executable suffix" >&5 +echo "configure:1750: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1743,7 +1756,7 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:1747: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:1760: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in *.c | *.o | *.obj) ;; @@ -1770,7 +1783,7 @@ case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6 -echo "configure:1774: checking for ${ac_tool_prefix}file" >&5 +echo "configure:1787: checking for ${ac_tool_prefix}file" >&5 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1832,7 +1845,7 @@ fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then echo $ac_n "checking for file""... $ac_c" 1>&6 -echo "configure:1836: checking for file" >&5 +echo "configure:1849: checking for file" >&5 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1903,7 +1916,7 @@ esac # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1907: checking for $ac_word" >&5 +echo "configure:1920: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1935,7 +1948,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1939: checking for $ac_word" >&5 +echo "configure:1952: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1970,7 +1983,7 @@ fi # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1974: checking for $ac_word" >&5 +echo "configure:1987: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2002,7 +2015,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2006: checking for $ac_word" >&5 +echo "configure:2019: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2069,8 +2082,8 @@ test x"$pic_mode" = xno && libtool_flags case $host in *-*-irix6*) # Find out which ABI we are using. - echo '#line 2073 "configure"' > conftest.$ac_ext - if { (eval echo configure:2074: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + echo '#line 2086 "configure"' > conftest.$ac_ext + if { (eval echo configure:2087: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" @@ -2091,7 +2104,7 @@ case $host in SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 -echo "configure:2095: checking whether the C compiler needs -belf" >&5 +echo "configure:2108: checking whether the C compiler needs -belf" >&5 if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2104,14 +2117,14 @@ ac_link='${CC-cc} -o conftest${ac_exeext cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2128: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* lt_cv_cc_needs_belf=yes else @@ -2301,7 +2314,7 @@ if test -z "$target" ; then fi echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:2305: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:2318: checking whether to enable maintainer-specific portions of Makefiles" >&5 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" @@ -2326,7 +2339,7 @@ fi echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:2330: checking for executable suffix" >&5 +echo "configure:2343: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2336,7 +2349,7 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:2340: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:2353: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in *.c | *.o | *.obj) ;; @@ -2366,7 +2379,7 @@ bfd_default_target_size=32 # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2370: checking for $ac_word" >&5 +echo "configure:2383: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2396,7 +2409,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2400: checking for $ac_word" >&5 +echo "configure:2413: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2447,7 +2460,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2451: checking for $ac_word" >&5 +echo "configure:2464: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2479,7 +2492,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2483: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:2496: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -2490,12 +2503,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 2494 "configure" +#line 2507 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:2499: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2512: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -2521,12 +2534,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2525: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2538: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:2530: checking whether we are using GNU C" >&5 +echo "configure:2543: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2535,7 +2548,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2539: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2552: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -2554,7 +2567,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:2558: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:2571: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2588,7 +2601,7 @@ fi ALL_LINGUAS= echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:2592: checking how to run the C preprocessor" >&5 +echo "configure:2605: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -2603,13 +2616,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2613: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2626: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2620,13 +2633,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2630: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2643: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2637,13 +2650,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2647: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2660: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2670,7 +2683,7 @@ echo "$ac_t""$CPP" 1>&6 # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2674: checking for $ac_word" >&5 +echo "configure:2687: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2698,12 +2711,12 @@ else fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:2702: checking for ANSI C header files" >&5 +echo "configure:2715: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2711,7 +2724,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2715: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2728: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2728,7 +2741,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -2746,7 +2759,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -2767,7 +2780,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -2778,7 +2791,7 @@ if (XOR (islower (i), ISLOWER (i)) || to exit (0); } EOF -if { (eval echo configure:2782: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2795: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -2802,12 +2815,12 @@ EOF fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:2806: checking for working const" >&5 +echo "configure:2819: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2873: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -2877,21 +2890,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:2881: checking for inline" >&5 +echo "configure:2894: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2908: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -2917,12 +2930,12 @@ EOF esac echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:2921: checking for off_t" >&5 +echo "configure:2934: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -2950,12 +2963,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:2954: checking for size_t" >&5 +echo "configure:2967: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -2985,19 +2998,19 @@ fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:2989: checking for working alloca.h" >&5 +echo "configure:3002: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:3001: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3014: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -3018,12 +3031,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:3022: checking for alloca" >&5 +echo "configure:3035: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3068: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -3083,12 +3096,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:3087: checking whether alloca needs Cray hooks" >&5 +echo "configure:3100: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3117: checking for $ac_func" >&5 +echo "configure:3130: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3158: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3168,7 +3181,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:3172: checking stack direction for C alloca" >&5 +echo "configure:3185: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3176,7 +3189,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3212: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -3220,17 +3233,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3224: checking for $ac_hdr" >&5 +echo "configure:3237: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3234: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3247: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3259,12 +3272,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3263: checking for $ac_func" >&5 +echo "configure:3276: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3304: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3312,7 +3325,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:3316: checking for working mmap" >&5 +echo "configure:3329: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3320,7 +3333,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3477: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -3488,17 +3501,17 @@ unistd.h values.h sys/param.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3492: checking for $ac_hdr" >&5 +echo "configure:3505: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3502: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3515: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3528,12 +3541,12 @@ done __argz_count __argz_stringify __argz_next do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3532: checking for $ac_func" >&5 +echo "configure:3545: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3573: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3585,12 +3598,12 @@ done for ac_func in stpcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3589: checking for $ac_func" >&5 +echo "configure:3602: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3630: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3647,19 +3660,19 @@ EOF if test $ac_cv_header_locale_h = yes; then echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:3651: checking for LC_MESSAGES" >&5 +echo "configure:3664: checking for LC_MESSAGES" >&5 if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return LC_MESSAGES ; return 0; } EOF -if { (eval echo configure:3663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3676: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_val_LC_MESSAGES=yes else @@ -3680,7 +3693,7 @@ EOF fi fi echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 -echo "configure:3684: checking whether NLS is requested" >&5 +echo "configure:3697: checking whether NLS is requested" >&5 # Check whether --enable-nls or --disable-nls was given. if test "${enable_nls+set}" = set; then enableval="$enable_nls" @@ -3700,7 +3713,7 @@ fi EOF echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 -echo "configure:3704: checking whether included gettext is requested" >&5 +echo "configure:3717: checking whether included gettext is requested" >&5 # Check whether --with-included-gettext or --without-included-gettext was given. if test "${with_included_gettext+set}" = set; then withval="$with_included_gettext" @@ -3719,17 +3732,17 @@ fi ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 -echo "configure:3723: checking for libintl.h" >&5 +echo "configure:3736: checking for libintl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3733: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3746: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3746,19 +3759,19 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6 -echo "configure:3750: checking for gettext in libc" >&5 +echo "configure:3763: checking for gettext in libc" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return (int) gettext ("") ; return 0; } EOF -if { (eval echo configure:3762: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3775: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gettext_libc=yes else @@ -3774,7 +3787,7 @@ echo "$ac_t""$gt_cv_func_gettext_libc" 1 if test "$gt_cv_func_gettext_libc" != "yes"; then echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6 -echo "configure:3778: checking for bindtextdomain in -lintl" >&5 +echo "configure:3791: checking for bindtextdomain in -lintl" >&5 ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3782,7 +3795,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3810: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3809,19 +3822,19 @@ fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6 -echo "configure:3813: checking for gettext in libintl" >&5 +echo "configure:3826: checking for gettext in libintl" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3838: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gettext_libintl=yes else @@ -3849,7 +3862,7 @@ EOF # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3853: checking for $ac_word" >&5 +echo "configure:3866: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3883,12 +3896,12 @@ fi for ac_func in dcgettext do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3887: checking for $ac_func" >&5 +echo "configure:3900: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3928: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3938,7 +3951,7 @@ done # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3942: checking for $ac_word" >&5 +echo "configure:3955: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3974,7 +3987,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3978: checking for $ac_word" >&5 +echo "configure:3991: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4006,7 +4019,7 @@ else fi cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4031: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* CATOBJEXT=.gmo DATADIRNAME=share @@ -4046,7 +4059,7 @@ fi # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4050: checking for $ac_word" >&5 +echo "configure:4063: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4080,7 +4093,7 @@ fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4084: checking for $ac_word" >&5 +echo "configure:4097: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4116,7 +4129,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4120: checking for $ac_word" >&5 +echo "configure:4133: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4206,7 +4219,7 @@ fi LINGUAS= else echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 -echo "configure:4210: checking for catalogs to be installed" >&5 +echo "configure:4223: checking for catalogs to be installed" >&5 NEW_LINGUAS= for lang in ${LINGUAS=$ALL_LINGUAS}; do case "$ALL_LINGUAS" in @@ -4234,17 +4247,17 @@ echo "configure:4210: checking for catal if test "$CATOBJEXT" = ".cat"; then ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6 -echo "configure:4238: checking for linux/version.h" >&5 +echo "configure:4251: checking for linux/version.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4248: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4261: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4289,7 +4302,7 @@ fi l= - if test -d $srcdir/po; then + if test -f $srcdir/po/POTFILES.in; then test -d po || mkdir po if test "x$srcdir" != "x."; then if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then @@ -4322,7 +4335,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:4326: checking for a BSD compatible install" >&5 +echo "configure:4339: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4405,7 +4418,7 @@ if test "x$cross_compiling" = "xno"; the EXEEXT_FOR_BUILD='$(EXEEXT)' else echo $ac_n "checking for build system executable suffix""... $ac_c" 1>&6 -echo "configure:4409: checking for build system executable suffix" >&5 +echo "configure:4422: checking for build system executable suffix" >&5 if eval "test \"`echo '$''{'bfd_cv_build_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4433,17 +4446,17 @@ for ac_hdr in stddef.h string.h strings. do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4437: checking for $ac_hdr" >&5 +echo "configure:4450: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4447: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4460: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4473,17 +4486,17 @@ for ac_hdr in fcntl.h sys/file.h sys/tim do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4477: checking for $ac_hdr" >&5 +echo "configure:4490: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4487: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4500: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4510,12 +4523,12 @@ fi done echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:4514: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:4527: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -4524,7 +4537,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:4528: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4541: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -4549,12 +4562,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/di do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:4553: checking for $ac_hdr that defines DIR" >&5 +echo "configure:4566: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_hdr> @@ -4562,7 +4575,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:4566: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4579: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -4587,7 +4600,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:4591: checking for opendir in -ldir" >&5 +echo "configure:4604: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4595,7 +4608,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4623: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4628,7 +4641,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:4632: checking for opendir in -lx" >&5 +echo "configure:4645: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4636,7 +4649,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4664: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4672,12 +4685,12 @@ fi for ac_func in fcntl getpagesize setitimer sysconf fdopen getuid getgid do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4676: checking for $ac_func" >&5 +echo "configure:4689: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4717: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4735,12 +4748,12 @@ EOF esac echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6 -echo "configure:4739: checking whether strstr must be declared" >&5 +echo "configure:4752: checking whether strstr must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_strstr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -4761,7 +4774,7 @@ int main() { char *(*pfn) = (char *(*)) strstr ; return 0; } EOF -if { (eval echo configure:4765: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4778: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strstr=no else @@ -4782,12 +4795,12 @@ EOF fi echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6 -echo "configure:4786: checking whether malloc must be declared" >&5 +echo "configure:4799: checking whether malloc must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_malloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -4808,7 +4821,7 @@ int main() { char *(*pfn) = (char *(*)) malloc ; return 0; } EOF -if { (eval echo configure:4812: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4825: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_malloc=no else @@ -4829,12 +4842,12 @@ EOF fi echo $ac_n "checking whether realloc must be declared""... $ac_c" 1>&6 -echo "configure:4833: checking whether realloc must be declared" >&5 +echo "configure:4846: checking whether realloc must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_realloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -4855,7 +4868,7 @@ int main() { char *(*pfn) = (char *(*)) realloc ; return 0; } EOF -if { (eval echo configure:4859: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4872: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_realloc=no else @@ -4876,12 +4889,12 @@ EOF fi echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6 -echo "configure:4880: checking whether free must be declared" >&5 +echo "configure:4893: checking whether free must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_free'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -4902,7 +4915,7 @@ int main() { char *(*pfn) = (char *(*)) free ; return 0; } EOF -if { (eval echo configure:4906: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4919: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_free=no else @@ -4923,12 +4936,12 @@ EOF fi echo $ac_n "checking whether getenv must be declared""... $ac_c" 1>&6 -echo "configure:4927: checking whether getenv must be declared" >&5 +echo "configure:4940: checking whether getenv must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_getenv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -4949,7 +4962,7 @@ int main() { char *(*pfn) = (char *(*)) getenv ; return 0; } EOF -if { (eval echo configure:4953: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4966: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_getenv=no else @@ -4992,7 +5005,7 @@ if test "${target}" = "${host}"; then hppa*-*-mpeix*) COREFILE=hpux-core.lo ;; hppa*-*-bsd*) COREFILE="hpux-core.lo hppabsd-core.lo" COREFLAG="-DHPUX_CORE -DHPPABSD_CORE" ;; - i370-*-*) + i370-*-*) COREFILE=trad-core.lo TRAD_HEADER='"hosts/i370linux.h"' ;; @@ -5130,7 +5143,7 @@ if test "${target}" = "${host}"; then powerpc-*-freebsd*) COREFILE='' ;; powerpc-*-netbsd*) COREFILE=netbsd-core.lo ;; powerpc-*-*bsd*) COREFILE=netbsd-core.lo ;; - s390*-*-*) COREFILE=trad-core.lo ;; + s390*-*-*) COREFILE=trad-core.lo ;; sparc-*-netbsd* | sparc-*-openbsd*) COREFILE=netbsd-core.lo ;; @@ -5172,17 +5185,17 @@ if test "${target}" = "${host}"; then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5176: checking for $ac_hdr" >&5 +echo "configure:5189: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5186: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5199: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5210,12 +5223,12 @@ done if test "$ac_cv_header_sys_procfs_h" = yes; then echo $ac_n "checking for prstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5214: checking for prstatus_t in sys/procfs.h" >&5 +echo "configure:5227: checking for prstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5241: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prstatus_t=yes else @@ -5246,12 +5259,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus_t" 1>&6 echo $ac_n "checking for prstatus32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5250: checking for prstatus32_t in sys/procfs.h" >&5 +echo "configure:5263: checking for prstatus32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prstatus32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5277: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prstatus32_t=yes else @@ -5282,12 +5295,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus32_t" 1>&6 echo $ac_n "checking for prstatus_t.pr_who in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5286: checking for prstatus_t.pr_who in sys/procfs.h" >&5 +echo "configure:5299: checking for prstatus_t.pr_who in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5313: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who=yes else @@ -5318,12 +5331,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who" 1>&6 echo $ac_n "checking for prstatus32_t.pr_who in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5322: checking for prstatus32_t.pr_who in sys/procfs.h" >&5 +echo "configure:5335: checking for prstatus32_t.pr_who in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5349: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who=yes else @@ -5354,12 +5367,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who" 1>&6 echo $ac_n "checking for pstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5358: checking for pstatus_t in sys/procfs.h" >&5 +echo "configure:5371: checking for pstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5385: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pstatus_t=yes else @@ -5390,12 +5403,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus_t" 1>&6 echo $ac_n "checking for pxstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5394: checking for pxstatus_t in sys/procfs.h" >&5 +echo "configure:5407: checking for pxstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pxstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5421: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pxstatus_t=yes else @@ -5426,12 +5439,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pxstatus_t" 1>&6 echo $ac_n "checking for pstatus32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5430: checking for pstatus32_t in sys/procfs.h" >&5 +echo "configure:5443: checking for pstatus32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5457: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pstatus32_t=yes else @@ -5462,12 +5475,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus32_t" 1>&6 echo $ac_n "checking for prpsinfo_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5466: checking for prpsinfo_t in sys/procfs.h" >&5 +echo "configure:5479: checking for prpsinfo_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prpsinfo_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5493: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prpsinfo_t=yes else @@ -5498,12 +5511,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo_t" 1>&6 echo $ac_n "checking for prpsinfo32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5502: checking for prpsinfo32_t in sys/procfs.h" >&5 +echo "configure:5515: checking for prpsinfo32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prpsinfo32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5529: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prpsinfo32_t=yes else @@ -5534,12 +5547,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo32_t" 1>&6 echo $ac_n "checking for psinfo_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5538: checking for psinfo_t in sys/procfs.h" >&5 +echo "configure:5551: checking for psinfo_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psinfo_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5565: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_psinfo_t=yes else @@ -5570,12 +5583,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo_t" 1>&6 echo $ac_n "checking for psinfo32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5574: checking for psinfo32_t in sys/procfs.h" >&5 +echo "configure:5587: checking for psinfo32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psinfo32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5601: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_psinfo32_t=yes else @@ -5606,12 +5619,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo32_t" 1>&6 echo $ac_n "checking for lwpstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5610: checking for lwpstatus_t in sys/procfs.h" >&5 +echo "configure:5623: checking for lwpstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5637: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_lwpstatus_t=yes else @@ -5642,12 +5655,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpstatus_t" 1>&6 echo $ac_n "checking for lwpxstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5646: checking for lwpxstatus_t in sys/procfs.h" >&5 +echo "configure:5659: checking for lwpxstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpxstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5673: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_lwpxstatus_t=yes else @@ -5678,12 +5691,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpxstatus_t" 1>&6 echo $ac_n "checking for lwpstatus_t.pr_context in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5682: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5 +echo "configure:5695: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5709: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context=yes else @@ -5714,12 +5727,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context" 1>&6 echo $ac_n "checking for lwpstatus_t.pr_reg in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5718: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5 +echo "configure:5731: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5745: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg=yes else @@ -5750,12 +5763,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg" 1>&6 echo $ac_n "checking for win32_pstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5754: checking for win32_pstatus_t in sys/procfs.h" >&5 +echo "configure:5767: checking for win32_pstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_win32_pstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5781: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_win32_pstatus_t=yes else @@ -5885,76 +5898,55 @@ do target_size=32 case "$vec" in # This list is alphabetized to make it easy to compare - # with the two vector lists in targets.c. + # with the two vector lists in targets.c. For the same reason, + # use one entry per line, even though this leads to long lines. a29kcoff_big_vec) tb="$tb coff-a29k.lo cofflink.lo" ;; a_out_adobe_vec) tb="$tb aout-adobe.lo aout32.lo" ;; - armcoff_little_vec) tb="$tb coff-arm.lo cofflink.lo " ;; - armcoff_big_vec) tb="$tb coff-arm.lo cofflink.lo " ;; - armnetbsd_vec) tb="$tb armnetbsd.lo aout32.lo" ;; - armpe_little_vec) tb="$tb pe-arm.lo peigen.lo cofflink.lo " ;; - armpe_big_vec) tb="$tb pe-arm.lo peigen.lo cofflink.lo " ;; - armpei_little_vec) tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;; - armpei_big_vec) tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;; - arm_epoc_pe_little_vec) tb="$tb epoc-pe-arm.lo peigen.lo cofflink.lo " ;; - arm_epoc_pe_big_vec) tb="$tb epoc-pe-arm.lo peigen.lo cofflink.lo " ;; - arm_epoc_pei_little_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;; - arm_epoc_pei_big_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;; aout0_big_vec) tb="$tb aout0.lo aout32.lo" ;; aout_arm_big_vec) tb="$tb aout-arm.lo aout32.lo" ;; aout_arm_little_vec) tb="$tb aout-arm.lo aout32.lo" ;; aout_mips_big_vec) tb="$tb mipsbsd.lo aout32.lo" ;; aout_mips_little_vec) tb="$tb mipsbsd.lo aout32.lo" ;; apollocoff_vec) tb="$tb coff-apollo.lo" ;; + arm_epoc_pe_big_vec) tb="$tb epoc-pe-arm.lo peigen.lo cofflink.lo " ;; + arm_epoc_pe_little_vec) tb="$tb epoc-pe-arm.lo peigen.lo cofflink.lo " ;; + arm_epoc_pei_big_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;; + arm_epoc_pei_little_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;; + armcoff_big_vec) tb="$tb coff-arm.lo cofflink.lo " ;; + armcoff_little_vec) tb="$tb coff-arm.lo cofflink.lo " ;; + armnetbsd_vec) tb="$tb armnetbsd.lo aout32.lo" ;; + armpe_big_vec) tb="$tb pe-arm.lo peigen.lo cofflink.lo " ;; + armpe_little_vec) tb="$tb pe-arm.lo peigen.lo cofflink.lo " ;; + armpei_big_vec) tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;; + armpei_little_vec) tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;; b_out_vec_big_host) tb="$tb bout.lo aout32.lo" ;; b_out_vec_little_host) tb="$tb bout.lo aout32.lo" ;; bfd_efi_app_ia32_vec) tb="$tb efi-app-ia32.lo peigen.lo cofflink.lo" ;; - bfd_efi_app_ia64_vec) tb="$tb efi-app-ia64.lo pepigen.lo cofflink.lo" - target_size=64 ;; - bfd_elf64_alpha_vec) tb="$tb elf64-alpha.lo elf64.lo $elf" - target_size=64 ;; - bfd_elf64_hppa_vec | bfd_elf64_hppa_linux_vec) - tb="$tb elf64-hppa.lo elf64.lo $elf" - target_size=64 ;; - bfd_elf64_ia64_little_vec) tb="$tb elf64-ia64.lo elf64.lo $elf" - target_size=64 ;; - bfd_elf64_ia64_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf" - target_size=64 ;; - bfd_elf64_ia64_aix_little_vec) - tb="$tb elf64-ia64.lo elf64.lo $elf" - target_size=64 ;; - bfd_elf64_ia64_aix_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf" - target_size=64 ;; - bfd_elf32_ia64_big_vec) tb="$tb elf32-ia64.lo elf32.lo $elf" ;; + bfd_efi_app_ia64_vec) tb="$tb efi-app-ia64.lo pepigen.lo cofflink.lo"; target_size=64 ;; bfd_elf32_avr_vec) tb="$tb elf32-avr.lo elf32.lo $elf" ;; - bfd_elf32_littlearc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;; - bfd_elf32_littlearm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;; - bfd_elf32_littlearm_oabi_vec) tb="$tb elfarm-oabi.lo elf32.lo $elf" ;; + bfd_elf32_big_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;; bfd_elf32_bigarc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;; - bfd_elf32_bigarm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;; bfd_elf32_bigarm_oabi_vec) tb="$tb elfarm-oabi.lo elf32.lo $elf" ;; - bfd_elf32_big_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;; + bfd_elf32_bigarm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;; bfd_elf32_bigmips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;; - bfd_elf64_bigmips_vec) tb="$tb elf64-mips.lo elf64.lo elf32-mips.lo elf32.lo $elf ecofflink.lo" - target_size=64 ;; bfd_elf32_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;; - bfd_elf32_us_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;; bfd_elf32_d10v_vec) tb="$tb elf32-d10v.lo elf32.lo $elf" ;; bfd_elf32_d30v_vec) tb="$tb elf32-d30v.lo elf32.lo $elf" ;; bfd_elf32_fr30_vec) tb="$tb elf32-fr30.lo elf32.lo $elf" ;; bfd_elf32_h8300_vec) tb="$tb elf32-h8300.lo elf32.lo $elf" ;; - bfd_elf32_hppa_vec | bfd_elf32_hppa_linux_vec) - tb="$tb elf32-hppa.lo elf32.lo $elf" ;; + bfd_elf32_hppa_linux_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;; + bfd_elf32_hppa_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;; bfd_elf32_i370_vec) tb="$tb elf32-i370.lo elf32.lo $elf" ;; bfd_elf32_i386_vec) tb="$tb elf32-i386.lo elf32.lo $elf" ;; - bfd_elf64_x86_64_vec) tb="$tb elf64-x86-64.lo elf64.lo $elf" - target_size=64 ;; - bfd_elf32_i860_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;; bfd_elf32_i860_little_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;; + bfd_elf32_i860_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;; bfd_elf32_i960_vec) tb="$tb elf32-i960.lo elf32.lo $elf" ;; + bfd_elf32_ia64_big_vec) tb="$tb elf32-ia64.lo elf32.lo $elf" ;; bfd_elf32_little_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;; + bfd_elf32_littlearc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;; + bfd_elf32_littlearm_oabi_vec) tb="$tb elfarm-oabi.lo elf32.lo $elf" ;; + bfd_elf32_littlearm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;; bfd_elf32_littlemips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;; - bfd_elf64_littlemips_vec) tb="$tb elf64-mips.lo elf64.lo elf32-mips.lo elf32.lo $elf ecofflink.lo" - target_size=64 ;; bfd_elf32_m32r_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;; bfd_elf32_m68hc11_vec) tb="$tb elf32-m68hc11.lo elf32.lo $elf" ;; bfd_elf32_m68hc12_vec) tb="$tb elf32-m68hc12.lo elf32.lo $elf" ;; @@ -5969,41 +5961,46 @@ do bfd_elf32_pjl_vec) tb="$tb elf32-pj.lo elf32.lo $elf";; bfd_elf32_powerpc_vec) tb="$tb elf32-ppc.lo elf32.lo $elf" ;; bfd_elf32_powerpcle_vec) tb="$tb elf32-ppc.lo elf32.lo $elf" ;; - bfd_elf64_powerpc_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf" - target_size=64 ;; - bfd_elf64_powerpcle_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf" - target_size=64 ;; bfd_elf32_s390_vec) tb="$tb elf32-s390.lo elf32.lo $elf" ;; bfd_elf32_sh_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;; + bfd_elf32_shblin_vec) tb="$tb elf32-sh-lin.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; bfd_elf32_shl_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;; bfd_elf32_shlin_vec) tb="$tb elf32-sh-lin.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; - bfd_elf32_shblin_vec) tb="$tb elf32-sh-lin.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elf32.lo $elf" ;; bfd_elf32_tradbigmips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;; bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;; + bfd_elf32_us_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;; bfd_elf32_v850_vec) tb="$tb elf32-v850.lo elf32.lo $elf" ;; - bfd_elf64_big_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf" - target_size=64 ;; - bfd_elf64_little_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf" - target_size=64 ;; - bfd_elf64_s390_vec) tb="$tb elf64-s390.lo elf64.lo $elf" - target_size=64 ;; - bfd_elf64_sparc_vec) tb="$tb elf64-sparc.lo elf64.lo $elf" - target_size=64 ;; - bfd_elf64_tradbigmips_vec) tb="$tb elf64-mips.lo elf64.lo $elf ecofflink.lo" - target_size=64 ;; - bfd_elf64_tradlittlemips_vec) tb="$tb elf64-mips.lo elf64.lo $elf ecofflink.lo" - target_size=64 ;; + bfd_elf64_alpha_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_big_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_bigmips_vec) tb="$tb elf64-mips.lo elf64.lo elf32-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; + bfd_elf64_hppa_linux_vec) tb="$tb elf64-hppa.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_hppa_vec) tb="$tb elf64-hppa.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_ia64_aix_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_ia64_aix_little_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_ia64_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_ia64_little_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_little_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_littlemips_vec) tb="$tb elf64-mips.lo elf64.lo elf32-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; + bfd_elf64_powerpc_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_powerpcle_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf" target_size=64 ;; + bfd_elf64_s390_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_sparc_vec) tb="$tb elf64-sparc.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_tradbigmips_vec) tb="$tb elf64-mips.lo elf64.lo $elf ecofflink.lo"; target_size=64 ;; + bfd_elf64_tradlittlemips_vec) tb="$tb elf64-mips.lo elf64.lo $elf ecofflink.lo"; target_size=64 ;; + bfd_elf64_x86_64_vec) tb="$tb elf64-x86-64.lo elf64.lo $elf"; target_size=64 ;; + bfd_powerpc_pe_vec) tb="$tb pe-ppc.lo peigen.lo cofflink.lo" ;; + bfd_powerpc_pei_vec) tb="$tb pei-ppc.lo peigen.lo cofflink.lo" ;; + bfd_powerpcle_pe_vec) tb="$tb pe-ppc.lo peigen.lo cofflink.lo" ;; + bfd_powerpcle_pei_vec) tb="$tb pei-ppc.lo peigen.lo cofflink.lo" ;; cisco_core_big_vec) tb="$tb cisco-core.lo" ;; cisco_core_little_vec) tb="$tb cisco-core.lo" ;; cris_aout_vec) tb="$tb aout-cris.lo" ;; - demo_64_vec) tb="$tb demo64.lo aout64.lo" - target_size=64 ;; + demo_64_vec) tb="$tb demo64.lo aout64.lo"; target_size=64 ;; ecoff_big_vec) tb="$tb coff-mips.lo ecoff.lo ecofflink.lo" ;; - ecoff_little_vec) tb="$tb coff-mips.lo ecoff.lo ecofflink.lo" ;; ecoff_biglittle_vec) tb="$tb coff-mips.lo ecoff.lo ecofflink.lo" ;; - ecoffalpha_little_vec) tb="$tb coff-alpha.lo ecoff.lo ecofflink.lo" - target_size=64 ;; + ecoff_little_vec) tb="$tb coff-mips.lo ecoff.lo ecofflink.lo" ;; + ecoffalpha_little_vec) tb="$tb coff-alpha.lo ecoff.lo ecofflink.lo"; target_size=64 ;; go32coff_vec) tb="$tb coff-go32.lo cofflink.lo" ;; go32stubbedcoff_vec) tb="$tb coff-stgo32.lo cofflink.lo" ;; h8300coff_vec) tb="$tb coff-h8300.lo reloc16.lo" ;; @@ -6016,83 +6013,76 @@ do i386coff_vec) tb="$tb coff-i386.lo cofflink.lo" ;; i386dynix_vec) tb="$tb i386dynix.lo aout32.lo" ;; i386freebsd_vec) tb="$tb i386freebsd.lo aout32.lo" ;; - i386msdos_vec) tb="$tb i386msdos.lo" ;; - i386pe_vec) tb="$tb pe-i386.lo peigen.lo cofflink.lo" ;; - i386pei_vec) tb="$tb pei-i386.lo peigen.lo cofflink.lo" ;; i386linux_vec) tb="$tb i386linux.lo aout32.lo" ;; i386lynx_aout_vec) tb="$tb i386lynx.lo lynx-core.lo aout32.lo" ;; i386lynx_coff_vec) tb="$tb cf-i386lynx.lo cofflink.lo lynx-core.lo" ;; i386mach3_vec) tb="$tb i386mach3.lo aout32.lo" ;; + i386msdos_vec) tb="$tb i386msdos.lo" ;; i386netbsd_vec) tb="$tb i386netbsd.lo aout32.lo" ;; i386os9k_vec) tb="$tb i386os9k.lo aout32.lo" ;; + i386pe_vec) tb="$tb pe-i386.lo peigen.lo cofflink.lo" ;; + i386pei_vec) tb="$tb pei-i386.lo peigen.lo cofflink.lo" ;; i860coff_vec) tb="$tb coff-i860.lo cofflink.lo" ;; icoff_big_vec) tb="$tb coff-i960.lo cofflink.lo" ;; icoff_little_vec) tb="$tb coff-i960.lo cofflink.lo" ;; ieee_vec) tb="$tb ieee.lo" ;; + m68k4knetbsd_vec) tb="$tb m68k4knetbsd.lo aout32.lo" ;; + m68kaux_coff_vec) tb="$tb coff-aux.lo coff-m68k.lo cofflink.lo" ;; m68kcoff_vec) tb="$tb coff-m68k.lo cofflink.lo" ;; m68kcoffun_vec) tb="$tb coff-u68k.lo coff-m68k.lo cofflink.lo" ;; m68klinux_vec) tb="$tb m68klinux.lo aout32.lo" ;; m68klynx_aout_vec) tb="$tb m68klynx.lo lynx-core.lo aout32.lo" ;; m68klynx_coff_vec) tb="$tb cf-m68klynx.lo coff-m68k.lo cofflink.lo lynx-core.lo" ;; m68knetbsd_vec) tb="$tb m68knetbsd.lo aout32.lo" ;; - m68k4knetbsd_vec) tb="$tb m68k4knetbsd.lo aout32.lo" ;; - m68kaux_coff_vec) tb="$tb coff-aux.lo coff-m68k.lo cofflink.lo" ;; m68ksysvcoff_vec) tb="$tb coff-svm68k.lo cofflink.lo" ;; m88kbcs_vec) tb="$tb coff-m88k.lo" ;; - mipslpe_vec) tb="$tb pe-mips.lo peigen.lo cofflink.lo" ;; - mipslpei_vec) tb="$tb pei-mips.lo peigen.lo cofflink.lo" ;; mcore_pe_big_vec) tb="$tb pe-mcore.lo peigen.lo cofflink.lo" ;; mcore_pe_little_vec) tb="$tb pe-mcore.lo peigen.lo cofflink.lo" ;; mcore_pei_big_vec) tb="$tb pei-mcore.lo peigen.lo cofflink.lo" ;; mcore_pei_little_vec) tb="$tb pei-mcore.lo peigen.lo cofflink.lo" ;; + mipslpe_vec) tb="$tb pe-mips.lo peigen.lo cofflink.lo" ;; + mipslpei_vec) tb="$tb pei-mips.lo peigen.lo cofflink.lo" ;; newsos3_vec) tb="$tb newsos3.lo aout32.lo" ;; + nlm32_alpha_vec) tb="$tb nlm32-alpha.lo nlm32.lo nlm.lo"; target_size=64 ;; nlm32_i386_vec) tb="$tb nlm32-i386.lo nlm32.lo nlm.lo" ;; - rs6000coff64_vec) tb="$tb coff64-rs6000.lo xcofflink.lo" - target_size=64 ;; - nlm32_sparc_vec) tb="$tb nlm32-sparc.lo nlm32.lo nlm.lo" ;; - nlm32_alpha_vec) tb="$tb nlm32-alpha.lo nlm32.lo nlm.lo" - target_size=64 ;; - riscix_vec) tb="$tb aout32.lo riscix.lo" ;; nlm32_powerpc_vec) tb="$tb nlm32-ppc.lo nlm32.lo nlm.lo" ;; - pc532netbsd_vec) tb="$tb ns32knetbsd.lo aout-ns32k.lo" ;; + nlm32_sparc_vec) tb="$tb nlm32-sparc.lo nlm32.lo nlm.lo" ;; pc532machaout_vec) tb="$tb pc532-mach.lo aout-ns32k.lo" ;; + pc532netbsd_vec) tb="$tb ns32knetbsd.lo aout-ns32k.lo" ;; pdp11_aout_vec) tb="$tb pdp11.lo" ;; pmac_xcoff_vec) tb="$tb coff-rs6000.lo xcofflink.lo" ;; - rs6000coff_vec) tb="$tb coff-rs6000.lo xcofflink.lo" ;; - bfd_powerpc_pe_vec) tb="$tb pe-ppc.lo peigen.lo cofflink.lo" ;; - bfd_powerpcle_pe_vec) tb="$tb pe-ppc.lo peigen.lo cofflink.lo" ;; - bfd_powerpc_pei_vec) tb="$tb pei-ppc.lo peigen.lo cofflink.lo" ;; - bfd_powerpcle_pei_vec) tb="$tb pei-ppc.lo peigen.lo cofflink.lo" ;; ppcboot_vec) tb="$tb ppcboot.lo" ;; - shcoff_vec) tb="$tb coff-sh.lo cofflink.lo" ;; - shlcoff_vec) tb="$tb coff-sh.lo cofflink.lo" ;; + riscix_vec) tb="$tb aout32.lo riscix.lo" ;; + rs6000coff64_vec) tb="$tb coff64-rs6000.lo xcofflink.lo"; target_size=64 ;; + rs6000coff_vec) tb="$tb coff-rs6000.lo xcofflink.lo" ;; shcoff_small_vec) tb="$tb coff-sh.lo cofflink.lo" ;; + shcoff_vec) tb="$tb coff-sh.lo cofflink.lo" ;; shlcoff_small_vec) tb="$tb coff-sh.lo cofflink.lo" ;; + shlcoff_vec) tb="$tb coff-sh.lo cofflink.lo" ;; shlpe_vec) tb="$tb pe-sh.lo coff-sh.lo peigen.lo cofflink.lo" ;; shlpei_vec) tb="$tb pei-sh.lo coff-sh.lo peigen.lo cofflink.lo" ;; som_vec) tb="$tb som.lo" ;; + sparccoff_vec) tb="$tb coff-sparc.lo" ;; sparcle_aout_vec) tb="$tb aout-sparcle.lo aout32.lo" ;; sparclinux_vec) tb="$tb sparclinux.lo aout32.lo" ;; sparclynx_aout_vec) tb="$tb sparclynx.lo lynx-core.lo aout32.lo" ;; sparclynx_coff_vec) tb="$tb cf-sparclynx.lo lynx-core.lo" ;; sparcnetbsd_vec) tb="$tb sparcnetbsd.lo aout32.lo" ;; - sparccoff_vec) tb="$tb coff-sparc.lo" ;; srec_vec) tb="$tb srec.lo" ;; sunos_big_vec) tb="$tb sunos.lo aout32.lo" ;; symbolsrec_vec) tb="$tb srec.lo" ;; tekhex_vec) tb="$tb tekhex.lo" ;; tic30_aout_vec) tb="$tb aout-tic30.lo" ;; tic30_coff_vec) tb="$tb coff-tic30.lo" ;; - tic54x_coff0_vec) tb="$tb coff-tic54x.lo" ;; tic54x_coff0_beh_vec) tb="$tb coff-tic54x.lo" ;; - tic54x_coff1_vec) tb="$tb coff-tic54x.lo" ;; + tic54x_coff0_vec) tb="$tb coff-tic54x.lo" ;; tic54x_coff1_beh_vec) tb="$tb coff-tic54x.lo" ;; - tic54x_coff2_vec) tb="$tb coff-tic54x.lo" ;; + tic54x_coff1_vec) tb="$tb coff-tic54x.lo" ;; tic54x_coff2_beh_vec) tb="$tb coff-tic54x.lo" ;; + tic54x_coff2_vec) tb="$tb coff-tic54x.lo" ;; tic80coff_vec) tb="$tb coff-tic80.lo cofflink.lo" ;; versados_vec) tb="$tb versados.lo" ;; - vms_alpha_vec) tb="$tb vms.lo vms-hdr.lo vms-gsd.lo vms-tir.lo vms-misc.lo" - target_size=64 ;; + vms_alpha_vec) tb="$tb vms.lo vms-hdr.lo vms-gsd.lo vms-tir.lo vms-misc.lo"; target_size=64 ;; vms_vax_vec) tb="$tb vms.lo vms-hdr.lo vms-gsd.lo vms-tir.lo vms-misc.lo" ;; w65_vec) tb="$tb coff-w65.lo reloc16.lo" ;; we32kcoff_vec) tb="$tb coff-we32k.lo" ;; @@ -6186,17 +6176,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6190: checking for $ac_hdr" >&5 +echo "configure:6180: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6200: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6190: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6225,12 +6215,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6229: checking for $ac_func" >&5 +echo "configure:6219: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6247: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6278,7 +6268,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:6282: checking for working mmap" >&5 +echo "configure:6272: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6286,7 +6276,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6420: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -6451,12 +6441,12 @@ fi for ac_func in madvise mprotect do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6455: checking for $ac_func" >&5 +echo "configure:6445: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6473: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6671,6 +6661,9 @@ s%@AUTOMAKE@%$AUTOMAKE%g s%@AUTOHEADER@%$AUTOHEADER%g s%@MAKEINFO@%$MAKEINFO%g s%@SET_MAKE@%$SET_MAKE%g +s%@bfd_version@%$bfd_version%g +s%@bfd_version_date@%$bfd_version_date%g +s%@bfd_version_string@%$bfd_version_string%g s%@AR@%$AR%g s%@RANLIB@%$RANLIB%g s%@LN_S@%$LN_S%g diff -uprN binutils-2.11.90.0.31/bfd/configure.in binutils-2.11.92.0.5/bfd/configure.in --- binutils-2.11.90.0.31/bfd/configure.in Thu Aug 30 14:58:39 2001 +++ binutils-2.11.92.0.5/bfd/configure.in Fri Oct 5 14:11:21 2001 @@ -7,7 +7,27 @@ AC_INIT(libbfd.c) AC_CANONICAL_SYSTEM AC_ISC_POSIX -AM_INIT_AUTOMAKE(bfd, 2.11.90.0.31) +AM_INIT_AUTOMAKE(bfd, 2.11.92.0.5) +# Uncomment the next line to remove the date from the reported bfd version +#is_release=y + +changequote(,)dnl +bfd_version=`echo "${VERSION}" | sed -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$/\1\2\3\4\5/'` +changequote([,])dnl + +bfd_version_string="\"${VERSION}\"" +bfd_version_date=`sed -e 's/.*DATE //' < ${srcdir}/version.h` +if test x${is_release} = x; then +dnl Sad, but we can't use XSTRING here to pick up the date from version.h +dnl because traditional C doesn't allow it. + bfd_version_string="\"${VERSION} ${bfd_version_date}\"" +fi +dnl Since we need to edit bfd-in3.h to get the date for bfd_version_string, +dnl we may as well substitute for bfd_version_date too. That way we don't +dnl need to #include version.h +AC_SUBST(bfd_version) +AC_SUBST(bfd_version_date) +AC_SUBST(bfd_version_string) dnl These must be called before AM_PROG_LIBTOOL, because it may want dnl to call AC_CHECK_PROG. @@ -151,7 +171,7 @@ if test "${target}" = "${host}"; then hppa*-*-mpeix*) COREFILE=hpux-core.lo ;; hppa*-*-bsd*) COREFILE="hpux-core.lo hppabsd-core.lo" COREFLAG="-DHPUX_CORE -DHPPABSD_CORE" ;; - i370-*-*) + i370-*-*) COREFILE=trad-core.lo TRAD_HEADER='"hosts/i370linux.h"' ;; @@ -315,7 +335,7 @@ changequote([,])dnl powerpc-*-freebsd*) COREFILE='' ;; powerpc-*-netbsd*) COREFILE=netbsd-core.lo ;; powerpc-*-*bsd*) COREFILE=netbsd-core.lo ;; - s390*-*-*) COREFILE=trad-core.lo ;; + s390*-*-*) COREFILE=trad-core.lo ;; sparc-*-netbsd* | sparc-*-openbsd*) COREFILE=netbsd-core.lo ;; @@ -469,76 +489,55 @@ do target_size=32 case "$vec" in # This list is alphabetized to make it easy to compare - # with the two vector lists in targets.c. + # with the two vector lists in targets.c. For the same reason, + # use one entry per line, even though this leads to long lines. a29kcoff_big_vec) tb="$tb coff-a29k.lo cofflink.lo" ;; a_out_adobe_vec) tb="$tb aout-adobe.lo aout32.lo" ;; - armcoff_little_vec) tb="$tb coff-arm.lo cofflink.lo " ;; - armcoff_big_vec) tb="$tb coff-arm.lo cofflink.lo " ;; - armnetbsd_vec) tb="$tb armnetbsd.lo aout32.lo" ;; - armpe_little_vec) tb="$tb pe-arm.lo peigen.lo cofflink.lo " ;; - armpe_big_vec) tb="$tb pe-arm.lo peigen.lo cofflink.lo " ;; - armpei_little_vec) tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;; - armpei_big_vec) tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;; - arm_epoc_pe_little_vec) tb="$tb epoc-pe-arm.lo peigen.lo cofflink.lo " ;; - arm_epoc_pe_big_vec) tb="$tb epoc-pe-arm.lo peigen.lo cofflink.lo " ;; - arm_epoc_pei_little_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;; - arm_epoc_pei_big_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;; aout0_big_vec) tb="$tb aout0.lo aout32.lo" ;; aout_arm_big_vec) tb="$tb aout-arm.lo aout32.lo" ;; aout_arm_little_vec) tb="$tb aout-arm.lo aout32.lo" ;; aout_mips_big_vec) tb="$tb mipsbsd.lo aout32.lo" ;; aout_mips_little_vec) tb="$tb mipsbsd.lo aout32.lo" ;; apollocoff_vec) tb="$tb coff-apollo.lo" ;; + arm_epoc_pe_big_vec) tb="$tb epoc-pe-arm.lo peigen.lo cofflink.lo " ;; + arm_epoc_pe_little_vec) tb="$tb epoc-pe-arm.lo peigen.lo cofflink.lo " ;; + arm_epoc_pei_big_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;; + arm_epoc_pei_little_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;; + armcoff_big_vec) tb="$tb coff-arm.lo cofflink.lo " ;; + armcoff_little_vec) tb="$tb coff-arm.lo cofflink.lo " ;; + armnetbsd_vec) tb="$tb armnetbsd.lo aout32.lo" ;; + armpe_big_vec) tb="$tb pe-arm.lo peigen.lo cofflink.lo " ;; + armpe_little_vec) tb="$tb pe-arm.lo peigen.lo cofflink.lo " ;; + armpei_big_vec) tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;; + armpei_little_vec) tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;; b_out_vec_big_host) tb="$tb bout.lo aout32.lo" ;; b_out_vec_little_host) tb="$tb bout.lo aout32.lo" ;; bfd_efi_app_ia32_vec) tb="$tb efi-app-ia32.lo peigen.lo cofflink.lo" ;; - bfd_efi_app_ia64_vec) tb="$tb efi-app-ia64.lo pepigen.lo cofflink.lo" - target_size=64 ;; - bfd_elf64_alpha_vec) tb="$tb elf64-alpha.lo elf64.lo $elf" - target_size=64 ;; - bfd_elf64_hppa_vec | bfd_elf64_hppa_linux_vec) - tb="$tb elf64-hppa.lo elf64.lo $elf" - target_size=64 ;; - bfd_elf64_ia64_little_vec) tb="$tb elf64-ia64.lo elf64.lo $elf" - target_size=64 ;; - bfd_elf64_ia64_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf" - target_size=64 ;; - bfd_elf64_ia64_aix_little_vec) - tb="$tb elf64-ia64.lo elf64.lo $elf" - target_size=64 ;; - bfd_elf64_ia64_aix_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf" - target_size=64 ;; - bfd_elf32_ia64_big_vec) tb="$tb elf32-ia64.lo elf32.lo $elf" ;; + bfd_efi_app_ia64_vec) tb="$tb efi-app-ia64.lo pepigen.lo cofflink.lo"; target_size=64 ;; bfd_elf32_avr_vec) tb="$tb elf32-avr.lo elf32.lo $elf" ;; - bfd_elf32_littlearc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;; - bfd_elf32_littlearm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;; - bfd_elf32_littlearm_oabi_vec) tb="$tb elfarm-oabi.lo elf32.lo $elf" ;; + bfd_elf32_big_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;; bfd_elf32_bigarc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;; - bfd_elf32_bigarm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;; bfd_elf32_bigarm_oabi_vec) tb="$tb elfarm-oabi.lo elf32.lo $elf" ;; - bfd_elf32_big_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;; + bfd_elf32_bigarm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;; bfd_elf32_bigmips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;; - bfd_elf64_bigmips_vec) tb="$tb elf64-mips.lo elf64.lo elf32-mips.lo elf32.lo $elf ecofflink.lo" - target_size=64 ;; bfd_elf32_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;; - bfd_elf32_us_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;; bfd_elf32_d10v_vec) tb="$tb elf32-d10v.lo elf32.lo $elf" ;; bfd_elf32_d30v_vec) tb="$tb elf32-d30v.lo elf32.lo $elf" ;; bfd_elf32_fr30_vec) tb="$tb elf32-fr30.lo elf32.lo $elf" ;; bfd_elf32_h8300_vec) tb="$tb elf32-h8300.lo elf32.lo $elf" ;; - bfd_elf32_hppa_vec | bfd_elf32_hppa_linux_vec) - tb="$tb elf32-hppa.lo elf32.lo $elf" ;; + bfd_elf32_hppa_linux_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;; + bfd_elf32_hppa_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;; bfd_elf32_i370_vec) tb="$tb elf32-i370.lo elf32.lo $elf" ;; bfd_elf32_i386_vec) tb="$tb elf32-i386.lo elf32.lo $elf" ;; - bfd_elf64_x86_64_vec) tb="$tb elf64-x86-64.lo elf64.lo $elf" - target_size=64 ;; - bfd_elf32_i860_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;; bfd_elf32_i860_little_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;; + bfd_elf32_i860_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;; bfd_elf32_i960_vec) tb="$tb elf32-i960.lo elf32.lo $elf" ;; + bfd_elf32_ia64_big_vec) tb="$tb elf32-ia64.lo elf32.lo $elf" ;; bfd_elf32_little_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;; + bfd_elf32_littlearc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;; + bfd_elf32_littlearm_oabi_vec) tb="$tb elfarm-oabi.lo elf32.lo $elf" ;; + bfd_elf32_littlearm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;; bfd_elf32_littlemips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;; - bfd_elf64_littlemips_vec) tb="$tb elf64-mips.lo elf64.lo elf32-mips.lo elf32.lo $elf ecofflink.lo" - target_size=64 ;; bfd_elf32_m32r_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;; bfd_elf32_m68hc11_vec) tb="$tb elf32-m68hc11.lo elf32.lo $elf" ;; bfd_elf32_m68hc12_vec) tb="$tb elf32-m68hc12.lo elf32.lo $elf" ;; @@ -553,41 +552,46 @@ do bfd_elf32_pjl_vec) tb="$tb elf32-pj.lo elf32.lo $elf";; bfd_elf32_powerpc_vec) tb="$tb elf32-ppc.lo elf32.lo $elf" ;; bfd_elf32_powerpcle_vec) tb="$tb elf32-ppc.lo elf32.lo $elf" ;; - bfd_elf64_powerpc_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf" - target_size=64 ;; - bfd_elf64_powerpcle_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf" - target_size=64 ;; bfd_elf32_s390_vec) tb="$tb elf32-s390.lo elf32.lo $elf" ;; bfd_elf32_sh_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;; + bfd_elf32_shblin_vec) tb="$tb elf32-sh-lin.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; bfd_elf32_shl_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;; bfd_elf32_shlin_vec) tb="$tb elf32-sh-lin.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; - bfd_elf32_shblin_vec) tb="$tb elf32-sh-lin.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elf32.lo $elf" ;; bfd_elf32_tradbigmips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;; bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;; + bfd_elf32_us_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;; bfd_elf32_v850_vec) tb="$tb elf32-v850.lo elf32.lo $elf" ;; - bfd_elf64_big_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf" - target_size=64 ;; - bfd_elf64_little_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf" - target_size=64 ;; - bfd_elf64_s390_vec) tb="$tb elf64-s390.lo elf64.lo $elf" - target_size=64 ;; - bfd_elf64_sparc_vec) tb="$tb elf64-sparc.lo elf64.lo $elf" - target_size=64 ;; - bfd_elf64_tradbigmips_vec) tb="$tb elf64-mips.lo elf64.lo $elf ecofflink.lo" - target_size=64 ;; - bfd_elf64_tradlittlemips_vec) tb="$tb elf64-mips.lo elf64.lo $elf ecofflink.lo" - target_size=64 ;; + bfd_elf64_alpha_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_big_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_bigmips_vec) tb="$tb elf64-mips.lo elf64.lo elf32-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; + bfd_elf64_hppa_linux_vec) tb="$tb elf64-hppa.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_hppa_vec) tb="$tb elf64-hppa.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_ia64_aix_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_ia64_aix_little_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_ia64_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_ia64_little_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_little_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_littlemips_vec) tb="$tb elf64-mips.lo elf64.lo elf32-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; + bfd_elf64_powerpc_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_powerpcle_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf" target_size=64 ;; + bfd_elf64_s390_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_sparc_vec) tb="$tb elf64-sparc.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_tradbigmips_vec) tb="$tb elf64-mips.lo elf64.lo $elf ecofflink.lo"; target_size=64 ;; + bfd_elf64_tradlittlemips_vec) tb="$tb elf64-mips.lo elf64.lo $elf ecofflink.lo"; target_size=64 ;; + bfd_elf64_x86_64_vec) tb="$tb elf64-x86-64.lo elf64.lo $elf"; target_size=64 ;; + bfd_powerpc_pe_vec) tb="$tb pe-ppc.lo peigen.lo cofflink.lo" ;; + bfd_powerpc_pei_vec) tb="$tb pei-ppc.lo peigen.lo cofflink.lo" ;; + bfd_powerpcle_pe_vec) tb="$tb pe-ppc.lo peigen.lo cofflink.lo" ;; + bfd_powerpcle_pei_vec) tb="$tb pei-ppc.lo peigen.lo cofflink.lo" ;; cisco_core_big_vec) tb="$tb cisco-core.lo" ;; cisco_core_little_vec) tb="$tb cisco-core.lo" ;; cris_aout_vec) tb="$tb aout-cris.lo" ;; - demo_64_vec) tb="$tb demo64.lo aout64.lo" - target_size=64 ;; + demo_64_vec) tb="$tb demo64.lo aout64.lo"; target_size=64 ;; ecoff_big_vec) tb="$tb coff-mips.lo ecoff.lo ecofflink.lo" ;; - ecoff_little_vec) tb="$tb coff-mips.lo ecoff.lo ecofflink.lo" ;; ecoff_biglittle_vec) tb="$tb coff-mips.lo ecoff.lo ecofflink.lo" ;; - ecoffalpha_little_vec) tb="$tb coff-alpha.lo ecoff.lo ecofflink.lo" - target_size=64 ;; + ecoff_little_vec) tb="$tb coff-mips.lo ecoff.lo ecofflink.lo" ;; + ecoffalpha_little_vec) tb="$tb coff-alpha.lo ecoff.lo ecofflink.lo"; target_size=64 ;; go32coff_vec) tb="$tb coff-go32.lo cofflink.lo" ;; go32stubbedcoff_vec) tb="$tb coff-stgo32.lo cofflink.lo" ;; h8300coff_vec) tb="$tb coff-h8300.lo reloc16.lo" ;; @@ -600,83 +604,76 @@ do i386coff_vec) tb="$tb coff-i386.lo cofflink.lo" ;; i386dynix_vec) tb="$tb i386dynix.lo aout32.lo" ;; i386freebsd_vec) tb="$tb i386freebsd.lo aout32.lo" ;; - i386msdos_vec) tb="$tb i386msdos.lo" ;; - i386pe_vec) tb="$tb pe-i386.lo peigen.lo cofflink.lo" ;; - i386pei_vec) tb="$tb pei-i386.lo peigen.lo cofflink.lo" ;; i386linux_vec) tb="$tb i386linux.lo aout32.lo" ;; i386lynx_aout_vec) tb="$tb i386lynx.lo lynx-core.lo aout32.lo" ;; i386lynx_coff_vec) tb="$tb cf-i386lynx.lo cofflink.lo lynx-core.lo" ;; i386mach3_vec) tb="$tb i386mach3.lo aout32.lo" ;; + i386msdos_vec) tb="$tb i386msdos.lo" ;; i386netbsd_vec) tb="$tb i386netbsd.lo aout32.lo" ;; i386os9k_vec) tb="$tb i386os9k.lo aout32.lo" ;; + i386pe_vec) tb="$tb pe-i386.lo peigen.lo cofflink.lo" ;; + i386pei_vec) tb="$tb pei-i386.lo peigen.lo cofflink.lo" ;; i860coff_vec) tb="$tb coff-i860.lo cofflink.lo" ;; icoff_big_vec) tb="$tb coff-i960.lo cofflink.lo" ;; icoff_little_vec) tb="$tb coff-i960.lo cofflink.lo" ;; ieee_vec) tb="$tb ieee.lo" ;; + m68k4knetbsd_vec) tb="$tb m68k4knetbsd.lo aout32.lo" ;; + m68kaux_coff_vec) tb="$tb coff-aux.lo coff-m68k.lo cofflink.lo" ;; m68kcoff_vec) tb="$tb coff-m68k.lo cofflink.lo" ;; m68kcoffun_vec) tb="$tb coff-u68k.lo coff-m68k.lo cofflink.lo" ;; m68klinux_vec) tb="$tb m68klinux.lo aout32.lo" ;; m68klynx_aout_vec) tb="$tb m68klynx.lo lynx-core.lo aout32.lo" ;; m68klynx_coff_vec) tb="$tb cf-m68klynx.lo coff-m68k.lo cofflink.lo lynx-core.lo" ;; m68knetbsd_vec) tb="$tb m68knetbsd.lo aout32.lo" ;; - m68k4knetbsd_vec) tb="$tb m68k4knetbsd.lo aout32.lo" ;; - m68kaux_coff_vec) tb="$tb coff-aux.lo coff-m68k.lo cofflink.lo" ;; m68ksysvcoff_vec) tb="$tb coff-svm68k.lo cofflink.lo" ;; m88kbcs_vec) tb="$tb coff-m88k.lo" ;; - mipslpe_vec) tb="$tb pe-mips.lo peigen.lo cofflink.lo" ;; - mipslpei_vec) tb="$tb pei-mips.lo peigen.lo cofflink.lo" ;; mcore_pe_big_vec) tb="$tb pe-mcore.lo peigen.lo cofflink.lo" ;; mcore_pe_little_vec) tb="$tb pe-mcore.lo peigen.lo cofflink.lo" ;; mcore_pei_big_vec) tb="$tb pei-mcore.lo peigen.lo cofflink.lo" ;; mcore_pei_little_vec) tb="$tb pei-mcore.lo peigen.lo cofflink.lo" ;; + mipslpe_vec) tb="$tb pe-mips.lo peigen.lo cofflink.lo" ;; + mipslpei_vec) tb="$tb pei-mips.lo peigen.lo cofflink.lo" ;; newsos3_vec) tb="$tb newsos3.lo aout32.lo" ;; + nlm32_alpha_vec) tb="$tb nlm32-alpha.lo nlm32.lo nlm.lo"; target_size=64 ;; nlm32_i386_vec) tb="$tb nlm32-i386.lo nlm32.lo nlm.lo" ;; - rs6000coff64_vec) tb="$tb coff64-rs6000.lo xcofflink.lo" - target_size=64 ;; - nlm32_sparc_vec) tb="$tb nlm32-sparc.lo nlm32.lo nlm.lo" ;; - nlm32_alpha_vec) tb="$tb nlm32-alpha.lo nlm32.lo nlm.lo" - target_size=64 ;; - riscix_vec) tb="$tb aout32.lo riscix.lo" ;; nlm32_powerpc_vec) tb="$tb nlm32-ppc.lo nlm32.lo nlm.lo" ;; - pc532netbsd_vec) tb="$tb ns32knetbsd.lo aout-ns32k.lo" ;; + nlm32_sparc_vec) tb="$tb nlm32-sparc.lo nlm32.lo nlm.lo" ;; pc532machaout_vec) tb="$tb pc532-mach.lo aout-ns32k.lo" ;; + pc532netbsd_vec) tb="$tb ns32knetbsd.lo aout-ns32k.lo" ;; pdp11_aout_vec) tb="$tb pdp11.lo" ;; pmac_xcoff_vec) tb="$tb coff-rs6000.lo xcofflink.lo" ;; - rs6000coff_vec) tb="$tb coff-rs6000.lo xcofflink.lo" ;; - bfd_powerpc_pe_vec) tb="$tb pe-ppc.lo peigen.lo cofflink.lo" ;; - bfd_powerpcle_pe_vec) tb="$tb pe-ppc.lo peigen.lo cofflink.lo" ;; - bfd_powerpc_pei_vec) tb="$tb pei-ppc.lo peigen.lo cofflink.lo" ;; - bfd_powerpcle_pei_vec) tb="$tb pei-ppc.lo peigen.lo cofflink.lo" ;; ppcboot_vec) tb="$tb ppcboot.lo" ;; - shcoff_vec) tb="$tb coff-sh.lo cofflink.lo" ;; - shlcoff_vec) tb="$tb coff-sh.lo cofflink.lo" ;; + riscix_vec) tb="$tb aout32.lo riscix.lo" ;; + rs6000coff64_vec) tb="$tb coff64-rs6000.lo xcofflink.lo"; target_size=64 ;; + rs6000coff_vec) tb="$tb coff-rs6000.lo xcofflink.lo" ;; shcoff_small_vec) tb="$tb coff-sh.lo cofflink.lo" ;; + shcoff_vec) tb="$tb coff-sh.lo cofflink.lo" ;; shlcoff_small_vec) tb="$tb coff-sh.lo cofflink.lo" ;; + shlcoff_vec) tb="$tb coff-sh.lo cofflink.lo" ;; shlpe_vec) tb="$tb pe-sh.lo coff-sh.lo peigen.lo cofflink.lo" ;; shlpei_vec) tb="$tb pei-sh.lo coff-sh.lo peigen.lo cofflink.lo" ;; som_vec) tb="$tb som.lo" ;; + sparccoff_vec) tb="$tb coff-sparc.lo" ;; sparcle_aout_vec) tb="$tb aout-sparcle.lo aout32.lo" ;; sparclinux_vec) tb="$tb sparclinux.lo aout32.lo" ;; sparclynx_aout_vec) tb="$tb sparclynx.lo lynx-core.lo aout32.lo" ;; sparclynx_coff_vec) tb="$tb cf-sparclynx.lo lynx-core.lo" ;; sparcnetbsd_vec) tb="$tb sparcnetbsd.lo aout32.lo" ;; - sparccoff_vec) tb="$tb coff-sparc.lo" ;; srec_vec) tb="$tb srec.lo" ;; sunos_big_vec) tb="$tb sunos.lo aout32.lo" ;; symbolsrec_vec) tb="$tb srec.lo" ;; tekhex_vec) tb="$tb tekhex.lo" ;; tic30_aout_vec) tb="$tb aout-tic30.lo" ;; tic30_coff_vec) tb="$tb coff-tic30.lo" ;; - tic54x_coff0_vec) tb="$tb coff-tic54x.lo" ;; tic54x_coff0_beh_vec) tb="$tb coff-tic54x.lo" ;; - tic54x_coff1_vec) tb="$tb coff-tic54x.lo" ;; + tic54x_coff0_vec) tb="$tb coff-tic54x.lo" ;; tic54x_coff1_beh_vec) tb="$tb coff-tic54x.lo" ;; - tic54x_coff2_vec) tb="$tb coff-tic54x.lo" ;; + tic54x_coff1_vec) tb="$tb coff-tic54x.lo" ;; tic54x_coff2_beh_vec) tb="$tb coff-tic54x.lo" ;; + tic54x_coff2_vec) tb="$tb coff-tic54x.lo" ;; tic80coff_vec) tb="$tb coff-tic80.lo cofflink.lo" ;; versados_vec) tb="$tb versados.lo" ;; - vms_alpha_vec) tb="$tb vms.lo vms-hdr.lo vms-gsd.lo vms-tir.lo vms-misc.lo" - target_size=64 ;; + vms_alpha_vec) tb="$tb vms.lo vms-hdr.lo vms-gsd.lo vms-tir.lo vms-misc.lo"; target_size=64 ;; vms_vax_vec) tb="$tb vms.lo vms-hdr.lo vms-gsd.lo vms-tir.lo vms-misc.lo" ;; w65_vec) tb="$tb coff-w65.lo reloc16.lo" ;; we32kcoff_vec) tb="$tb coff-we32k.lo" ;; diff -uprN binutils-2.11.90.0.31/bfd/corefile.c binutils-2.11.92.0.5/bfd/corefile.c --- binutils-2.11.90.0.31/bfd/corefile.c Fri Mar 9 11:15:43 2001 +++ binutils-2.11.92.0.5/bfd/corefile.c Mon Oct 1 15:25:21 2001 @@ -1,5 +1,5 @@ /* Core file generic interface routines for BFD. - Copyright 1990, 1991, 1992, 1993, 1994, 2000 + Copyright 1990, 1991, 1992, 1993, 1994, 2000, 2001 Free Software Foundation, Inc. Written by Cygnus Support. @@ -36,7 +36,7 @@ FUNCTION bfd_core_file_failing_command SYNOPSIS - CONST char *bfd_core_file_failing_command(bfd *abfd); + const char *bfd_core_file_failing_command(bfd *abfd); DESCRIPTION Return a read-only string explaining which program was running diff -uprN binutils-2.11.90.0.31/bfd/cpu-arc.c binutils-2.11.92.0.5/bfd/cpu-arc.c --- binutils-2.11.90.0.31/bfd/cpu-arc.c Sat May 12 08:21:30 2001 +++ binutils-2.11.92.0.5/bfd/cpu-arc.c Mon Oct 1 15:25:21 2001 @@ -55,6 +55,8 @@ const bfd_arch_info_type bfd_arc_arch = /* Given cpu type NAME, return its bfd_mach_arc_xxx value. Returns -1 if not found. */ +int arc_get_mach PARAMS ((char *)); + int arc_get_mach (name) char *name; diff -uprN binutils-2.11.90.0.31/bfd/cpu-h8300.c binutils-2.11.92.0.5/bfd/cpu-h8300.c --- binutils-2.11.90.0.31/bfd/cpu-h8300.c Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/bfd/cpu-h8300.c Mon Oct 1 15:25:21 2001 @@ -23,8 +23,6 @@ Foundation, Inc., 59 Temple Place - Suit #include "sysdep.h" #include "libbfd.h" -int bfd_default_scan_num_mach (); - static boolean h8300_scan PARAMS ((const struct bfd_arch_info *, const char *)); static const bfd_arch_info_type * compatible diff -uprN binutils-2.11.90.0.31/bfd/cpu-h8500.c binutils-2.11.92.0.5/bfd/cpu-h8500.c --- binutils-2.11.90.0.31/bfd/cpu-h8500.c Fri Mar 9 11:15:43 2001 +++ binutils-2.11.92.0.5/bfd/cpu-h8500.c Mon Oct 1 15:25:21 2001 @@ -1,5 +1,5 @@ /* BFD library support routines for the H8/500 architecture. - Copyright 1993, 1995, 2000 Free Software Foundation, Inc. + Copyright 1993, 1995, 2000, 2001 Free Software Foundation, Inc. Hacked by Steve Chamberlain of Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -22,8 +22,9 @@ Foundation, Inc., 59 Temple Place - Suit #include "sysdep.h" #include "libbfd.h" -#if 0 +static boolean scan_mach PARAMS ((const struct bfd_arch_info *, const char *)); +#if 0 /* Relocations for the Z8K @@ -147,8 +148,6 @@ local_bfd_reloc_type_lookup (arch, code) } #endif -int bfd_default_scan_num_mach(); - static boolean scan_mach (info, string) const struct bfd_arch_info *info ATTRIBUTE_UNUSED; diff -uprN binutils-2.11.90.0.31/bfd/cpu-i960.c binutils-2.11.92.0.5/bfd/cpu-i960.c --- binutils-2.11.90.0.31/bfd/cpu-i960.c Sun Jun 24 09:45:41 2001 +++ binutils-2.11.92.0.5/bfd/cpu-i960.c Mon Oct 1 15:25:21 2001 @@ -1,5 +1,5 @@ /* BFD library support routines for the i960 architecture. - Copyright 1990, 1991, 1993, 1994, 1996, 1999, 2000 + Copyright 1990, 1991, 1993, 1994, 1996, 1999, 2000, 2001 Free Software Foundation, Inc. Hacked by Steve Chamberlain of Cygnus Support. @@ -23,6 +23,11 @@ Foundation, Inc., 59 Temple Place - Suit #include "sysdep.h" #include "libbfd.h" +static boolean scan_960_mach + PARAMS ((const bfd_arch_info_type *, const char *)); +static const bfd_arch_info_type *compatible + PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *)); + /* This routine is provided a string, and tries to work out if it could possibly refer to the i960 machine pointed at in the info_struct pointer */ @@ -136,7 +141,7 @@ compatible (a,b) #define HX bfd_mach_i960_hx /*8*/ #define MAX_ARCH ((int)HX) - static CONST unsigned long matrix[MAX_ARCH+1][MAX_ARCH+1] = + static const unsigned long matrix[MAX_ARCH+1][MAX_ARCH+1] = { { ERROR, CORE, KA, KB, MC, XA, CA, JX, HX }, { CORE, CORE, KA, KB, MC, XA, CA, JX, HX }, @@ -159,7 +164,6 @@ compatible (a,b) } } -int bfd_default_scan_num_mach(); #define N(a,b,d,n) \ { 32, 32, 8,bfd_arch_i960,a,"i960",b,3,d,compatible,scan_960_mach,n,} diff -uprN binutils-2.11.90.0.31/bfd/cpu-ia64-opc.c binutils-2.11.92.0.5/bfd/cpu-ia64-opc.c --- binutils-2.11.90.0.31/bfd/cpu-ia64-opc.c Fri Mar 9 11:15:44 2001 +++ binutils-2.11.92.0.5/bfd/cpu-ia64-opc.c Mon Oct 1 15:25:21 2001 @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suit /* Logically, this code should be part of libopcode but since some of the operand insertion/extraction functions help bfd to implement - relocations, this code is included as part of elf64-ia64.c. This + relocations, this code is included as part of cpu-ia64.c. This avoids circular dependencies between libopcode and libbfd and also obviates the need for applications to link in libopcode when all they really want is libbfd. diff -uprN binutils-2.11.90.0.31/bfd/cpu-mips.c binutils-2.11.92.0.5/bfd/cpu-mips.c --- binutils-2.11.90.0.31/bfd/cpu-mips.c Wed May 23 10:54:03 2001 +++ binutils-2.11.92.0.5/bfd/cpu-mips.c Mon Oct 1 15:25:21 2001 @@ -57,10 +57,9 @@ enum I_mips10000, I_mips12000, I_mips16, - I_mips32, - I_mips32_4k, I_mips5, - I_mips64, + I_mipsisa32, + I_mipsisa64, I_sb1, }; @@ -84,10 +83,9 @@ static const bfd_arch_info_type arch_inf N (64, 64, bfd_mach_mips10000,"mips:10000", false, NN(I_mips10000)), N (64, 64, bfd_mach_mips12000,"mips:12000", false, NN(I_mips12000)), N (64, 64, bfd_mach_mips16, "mips:16", false, NN(I_mips16)), - N (32, 32, bfd_mach_mips32, "mips:mips32", false, NN(I_mips32)), - N (32, 32, bfd_mach_mips32_4k,"mips:mips32-4k", false, NN(I_mips32_4k)), N (64, 64, bfd_mach_mips5, "mips:mips5", false, NN(I_mips5)), - N (64, 64, bfd_mach_mips64, "mips:mips64", false, NN(I_mips64)), + N (32, 32, bfd_mach_mipsisa32, "mips:isa32", false, NN(I_mipsisa32)), + N (64, 64, bfd_mach_mipsisa64, "mips:isa64", false, NN(I_mipsisa64)), N (64, 64, bfd_mach_mips_sb1, "mips:sb1", false, 0), }; diff -uprN binutils-2.11.90.0.31/bfd/cpu-ns32k.c binutils-2.11.92.0.5/bfd/cpu-ns32k.c --- binutils-2.11.90.0.31/bfd/cpu-ns32k.c Fri Mar 9 11:15:44 2001 +++ binutils-2.11.92.0.5/bfd/cpu-ns32k.c Mon Oct 1 15:25:21 2001 @@ -1,5 +1,5 @@ /* BFD support for the ns32k architecture. - Copyright 1990, 1991, 1994, 1995, 1998, 2000 + Copyright 1990, 1991, 1994, 1995, 1998, 2000, 2001 Free Software Foundation, Inc. Almost totally rewritten by Ian Dall from initial work by Andrew Cagney. @@ -36,40 +36,36 @@ static const bfd_arch_info_type arch_inf const bfd_arch_info_type bfd_ns32k_arch = N(32032,"ns32k:32032",false, &arch_info_struct[0]); -static long -ns32k_sign_extend(value, bits) - int value; - int bits; -{ - value = value & ((1 << bits) - 1); - return (value & (1 << (bits-1)) - ? value | (~((1 << bits) - 1)) - : value); -} +static bfd_reloc_status_type do_ns32k_reloc + PARAMS ((bfd *, arelent *, struct symbol_cache_entry *, PTR, asection *, + bfd *, char **, + bfd_vma (*) (bfd_byte *, int), + int (*) (bfd_vma, bfd_byte *, int))); -long -_bfd_ns32k_get_displacement(buffer, offset, size) +bfd_vma +_bfd_ns32k_get_displacement (buffer, size) bfd_byte *buffer; - long offset; - long size; + int size; { - long value; - buffer += offset; + bfd_signed_vma value; switch (size) { case 1: - value = ns32k_sign_extend (*buffer, 7); + value = ((*buffer & 0x7f) ^ 0x40) - 0x40; break; + case 2: - value = ns32k_sign_extend(*buffer++, 6); + value = ((*buffer++ & 0x3f) ^ 0x20) - 0x20; value = (value << 8) | (0xff & *buffer); break; + case 4: - value = ns32k_sign_extend(*buffer++, 6); + value = ((*buffer++ & 0x3f) ^ 0x20) - 0x20; value = (value << 8) | (0xff & *buffer++); value = (value << 8) | (0xff & *buffer++); value = (value << 8) | (0xff & *buffer); break; + default: abort (); return 0; @@ -78,37 +74,38 @@ _bfd_ns32k_get_displacement(buffer, offs } int -_bfd_ns32k_put_displacement(value, buffer, offset, size) - long value; +_bfd_ns32k_put_displacement (value, buffer, size) + bfd_vma value; bfd_byte *buffer; - long offset; - long size; + int size; { - buffer += offset; switch (size) { case 1: - if (value < -64 || value > 63) + if (value + 0x40 > 0x7f) return -1; - value&=0x7f; - *buffer++=value; + value &= 0x7f; + *buffer++ = value; break; + case 2: - if (value < -8192 || value > 8191) + if (value + 0x2000 > 0x3fff) return -1; - value&=0x3fff; - value|=0x8000; - *buffer++=(value>>8); - *buffer++=value; + value &= 0x3fff; + value |= 0x8000; + *buffer++ = (value >> 8); + *buffer++ = value; break; + case 4: - if (value < -0x1f000000 || value >= 0x20000000) + /* FIXME: is this correct? -0x1f000000 <= value < 0x2000000 */ + if (value + 0x1f000000 > 0x3effffff) return -1; - value|=0xc0000000; - *buffer++=(value>>24); - *buffer++=(value>>16); - *buffer++=(value>>8); - *buffer++=value; + value |= (bfd_vma) 0xc0000000; + *buffer++ = (value >> 24); + *buffer++ = (value >> 16); + *buffer++ = (value >> 8); + *buffer++ = value; break; default: return -1; @@ -116,19 +113,21 @@ _bfd_ns32k_put_displacement(value, buffe return 0; } -long -_bfd_ns32k_get_immediate (buffer, offset, size) +bfd_vma +_bfd_ns32k_get_immediate (buffer, size) bfd_byte *buffer; - long offset; - long size; + int size; { - long value = 0; - buffer += offset; + bfd_vma value = 0; switch (size) { + case 8: + value = (value << 8) | (*buffer++ & 0xff); + value = (value << 8) | (*buffer++ & 0xff); + value = (value << 8) | (*buffer++ & 0xff); + value = (value << 8) | (*buffer++ & 0xff); case 4: value = (value << 8) | (*buffer++ & 0xff); - case 3: value = (value << 8) | (*buffer++ & 0xff); case 2: value = (value << 8) | (*buffer++ & 0xff); @@ -139,18 +138,21 @@ _bfd_ns32k_get_immediate (buffer, offset } int -_bfd_ns32k_put_immediate (value, buffer, offset, size) - long value; +_bfd_ns32k_put_immediate (value, buffer, size) + bfd_vma value; bfd_byte *buffer; - long offset; - long size; + int size; { - buffer += offset + size - 1; + buffer += size - 1; switch (size) { + case 8: + *buffer-- = (value & 0xff); value >>= 8; + *buffer-- = (value & 0xff); value >>= 8; + *buffer-- = (value & 0xff); value >>= 8; + *buffer-- = (value & 0xff); value >>= 8; case 4: *buffer-- = (value & 0xff); value >>= 8; - case 3: *buffer-- = (value & 0xff); value >>= 8; case 2: *buffer-- = (value & 0xff); value >>= 8; @@ -175,8 +177,8 @@ do_ns32k_reloc (abfd, reloc_entry, symbo asection *input_section; bfd *output_bfd; char **error_message ATTRIBUTE_UNUSED; - long (*get_data) (); - int (*put_data) (); + bfd_vma (*get_data) PARAMS ((bfd_byte *, int)); + int (*put_data) PARAMS ((bfd_vma, bfd_byte *, int)); { int overflow = 0; bfd_vma relocation; @@ -185,6 +187,7 @@ do_ns32k_reloc (abfd, reloc_entry, symbo bfd_vma output_base = 0; reloc_howto_type *howto = reloc_entry->howto; asection *reloc_target_output_section; + bfd_byte *location; if ((symbol->section == &bfd_abs_section) && output_bfd != (bfd *) NULL) @@ -433,7 +436,8 @@ space consuming. For each target: bfd_vma reloc_bits = (((1 << (howto->bitsize - 1)) - 1) << 1) | 1; if (((bfd_vma) check & ~reloc_bits) != 0 - && ((bfd_vma) check & ~reloc_bits) != (-1 & ~reloc_bits)) + && (((bfd_vma) check & ~reloc_bits) + != (-(bfd_vma) 1 & ~reloc_bits))) { /* The above right shift is incorrect for a signed value. See if turning on the upper bits fixes the @@ -444,7 +448,8 @@ space consuming. For each target: check |= ((bfd_vma) - 1 & ~((bfd_vma) - 1 >> (howto->rightshift - howto->bitpos))); - if (((bfd_vma) check & ~reloc_bits) != (-1 & ~reloc_bits)) + if (((bfd_vma) check & ~reloc_bits) + != (-(bfd_vma) 1 & ~reloc_bits)) flag = bfd_reloc_overflow; } else @@ -528,38 +533,39 @@ space consuming. For each target: #define DOIT(x) \ x = ( (x & ~howto->dst_mask) | (((x & howto->src_mask) + relocation) & howto->dst_mask)) + location = (bfd_byte *) data + addr; switch (howto->size) { case 0: { - char x = get_data (data, addr, 1); + char x = get_data (location, 1); DOIT (x); - overflow = put_data(x, data, addr, 1); + overflow = put_data ((bfd_vma) x, location, 1); } break; case 1: if (relocation) { - short x = get_data (data, addr, 2); + short x = get_data (location, 2); DOIT (x); - overflow = put_data(x, (unsigned char *) data, addr, 2); + overflow = put_data ((bfd_vma) x, location, 2); } break; case 2: if (relocation) { - long x = get_data (data, addr, 4); + long x = get_data (location, 4); DOIT (x); - overflow = put_data(x, data, addr, 4); + overflow = put_data ((bfd_vma) x, location, 4); } break; case -2: { - long x = get_data(data, addr, 4); + long x = get_data (location, 4); relocation = -relocation; DOIT(x); - overflow = put_data(x, data , addr, 4); + overflow = put_data ((bfd_vma) x, location, 4); } break; @@ -571,9 +577,9 @@ space consuming. For each target: #ifdef BFD64 if (relocation) { - bfd_vma x = get_data (data, addr, 8); + bfd_vma x = get_data (location, 8); DOIT (x); - overflow = put_data(x, data, addr, 8); + overflow = put_data (x, location, 8); } #else abort (); @@ -591,14 +597,14 @@ space consuming. For each target: /* Relocate a given location using a given value and howto. */ bfd_reloc_status_type -_bfd_do_ns32k_reloc_contents ( howto, input_bfd, relocation, location, +_bfd_do_ns32k_reloc_contents (howto, input_bfd, relocation, location, get_data, put_data) reloc_howto_type *howto; bfd *input_bfd ATTRIBUTE_UNUSED; bfd_vma relocation; bfd_byte *location; - long (*get_data) (); - int (*put_data) (); + bfd_vma (*get_data) PARAMS ((bfd_byte *, int)); + int (*put_data) PARAMS ((bfd_vma, bfd_byte *, int)); { int size; bfd_vma x; @@ -622,7 +628,7 @@ _bfd_do_ns32k_reloc_contents ( howto, in #ifdef BFD64 case 8: #endif - x = get_data (location, 0, size); + x = get_data (location, size); break; } @@ -729,7 +735,7 @@ _bfd_do_ns32k_reloc_contents ( howto, in if ((check & ~reloc_bits) != 0 && (((bfd_vma) signed_check & ~reloc_bits) - != (-1 & ~reloc_bits))) + != (-(bfd_vma) 1 & ~reloc_bits))) overflow = true; } break; @@ -758,7 +764,7 @@ _bfd_do_ns32k_reloc_contents ( howto, in #ifdef BFD64 case 8: #endif - put_data(x, location, 0, size); + put_data (x, location, size); break; } diff -uprN binutils-2.11.90.0.31/bfd/cpu-pdp11.c binutils-2.11.92.0.5/bfd/cpu-pdp11.c --- binutils-2.11.90.0.31/bfd/cpu-pdp11.c Fri Mar 9 11:15:44 2001 +++ binutils-2.11.92.0.5/bfd/cpu-pdp11.c Mon Oct 1 15:25:21 2001 @@ -32,7 +32,7 @@ const bfd_arch_info_type bfd_pdp11_arch "pdp11", 1, /* aligment = 16 bit */ true, /* the one and only */ - bfd_default_compatible, + bfd_default_compatible, bfd_default_scan , 0, }; diff -uprN binutils-2.11.90.0.31/bfd/cpu-pj.c binutils-2.11.92.0.5/bfd/cpu-pj.c --- binutils-2.11.90.0.31/bfd/cpu-pj.c Fri Mar 9 11:15:44 2001 +++ binutils-2.11.92.0.5/bfd/cpu-pj.c Mon Oct 1 15:25:21 2001 @@ -1,5 +1,5 @@ /* BFD library support routines for the Pico Java architecture. - Copyright 1999, 2000 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001 Free Software Foundation, Inc. Hacked by Steve Chamberlain of Transmeta. sac@pobox.com This file is part of BFD, the Binary File Descriptor library. @@ -22,6 +22,9 @@ Foundation, Inc., 59 Temple Place - Suit #include "sysdep.h" #include "libbfd.h" +static boolean scan_mach + PARAMS ((const struct bfd_arch_info *, const char *)); + static boolean scan_mach (info, string) const struct bfd_arch_info *info; diff -uprN binutils-2.11.90.0.31/bfd/cpu-sh.c binutils-2.11.92.0.5/bfd/cpu-sh.c --- binutils-2.11.90.0.31/bfd/cpu-sh.c Fri Mar 9 11:15:44 2001 +++ binutils-2.11.92.0.5/bfd/cpu-sh.c Mon Oct 1 15:25:21 2001 @@ -1,5 +1,6 @@ /* BFD library support routines for the Hitachi-SH architecture. - Copyright 1993, 1994, 1997, 1998, 2000 Free Software Foundation, Inc. + Copyright 1993, 1994, 1997, 1998, 2000, 2001 + Free Software Foundation, Inc. Hacked by Steve Chamberlain of Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -22,6 +23,9 @@ Foundation, Inc., 59 Temple Place - Suit #include "sysdep.h" #include "libbfd.h" +static boolean scan_mach + PARAMS ((const struct bfd_arch_info *, const char *)); + static boolean scan_mach (info, string) const struct bfd_arch_info *info; diff -uprN binutils-2.11.90.0.31/bfd/cpu-v850.c binutils-2.11.92.0.5/bfd/cpu-v850.c --- binutils-2.11.90.0.31/bfd/cpu-v850.c Wed Aug 22 08:52:09 2001 +++ binutils-2.11.92.0.5/bfd/cpu-v850.c Mon Oct 1 15:25:21 2001 @@ -20,8 +20,7 @@ Foundation, Inc., 59 Temple Place - Suit #include "bfd.h" #include "sysdep.h" #include "libbfd.h" - -#include +#include "safe-ctype.h" static boolean scan PARAMS ((const struct bfd_arch_info *, const char *)); @@ -59,7 +58,7 @@ scan (info, string) return info->the_default; number = 0; - while (isdigit ((unsigned char) *ptr_src)) + while (ISDIGIT (*ptr_src)) { number = number * 10 + * ptr_src - '0'; ptr_src ++; diff -uprN binutils-2.11.90.0.31/bfd/cpu-w65.c binutils-2.11.92.0.5/bfd/cpu-w65.c --- binutils-2.11.90.0.31/bfd/cpu-w65.c Fri Mar 9 11:15:44 2001 +++ binutils-2.11.92.0.5/bfd/cpu-w65.c Mon Oct 1 15:25:21 2001 @@ -1,5 +1,5 @@ /* BFD library support routines for the WDC 65816 architecture. - Copyright 1995, 1999, 2000 Free Software Foundation, Inc. + Copyright 1995, 1999, 2000, 2001 Free Software Foundation, Inc. Hacked by Steve Chamberlain of Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -22,7 +22,8 @@ Foundation, Inc., 59 Temple Place - Suit #include "sysdep.h" #include "libbfd.h" -int bfd_default_scan_num_mach(); +static boolean scan_mach + PARAMS ((const struct bfd_arch_info *, const char *)); static boolean scan_mach (info, string) diff -uprN binutils-2.11.90.0.31/bfd/cpu-z8k.c binutils-2.11.92.0.5/bfd/cpu-z8k.c --- binutils-2.11.90.0.31/bfd/cpu-z8k.c Fri Mar 9 11:15:45 2001 +++ binutils-2.11.92.0.5/bfd/cpu-z8k.c Mon Oct 1 15:25:21 2001 @@ -1,5 +1,5 @@ /* BFD library support routines for the Z800n architecture. - Copyright 1992, 1993, 1994, 2000 Free Software Foundation, Inc. + Copyright 1992, 1993, 1994, 2000, 2001 Free Software Foundation, Inc. Hacked by Steve Chamberlain of Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -22,6 +22,11 @@ Foundation, Inc., 59 Temple Place - Suit #include "sysdep.h" #include "libbfd.h" +static boolean scan_mach + PARAMS ((const struct bfd_arch_info *, const char *)); +static const bfd_arch_info_type *compatible + PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *)); + #if 0 /* not used currently */ /* Relocations for the Z8K @@ -148,8 +153,6 @@ local_bfd_reloc_type_lookup (arch, code) } #endif -int bfd_default_scan_num_mach (); - static boolean scan_mach (info, string) const struct bfd_arch_info *info; diff -uprN binutils-2.11.90.0.31/bfd/demo64.c binutils-2.11.92.0.5/bfd/demo64.c --- binutils-2.11.90.0.31/bfd/demo64.c Fri Mar 9 11:15:45 2001 +++ binutils-2.11.92.0.5/bfd/demo64.c Thu Oct 4 14:35:43 2001 @@ -1,5 +1,6 @@ /* BFD backend for demonstration 64-bit a.out binaries. - Copyright 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. + Copyright 1990, 1991, 1992, 1993, 1994, 2001 + Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -19,6 +20,11 @@ along with this program; if not, write t Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define ARCH_SIZE 64 -#define MY(OP) CAT(demo_64_,OP) + +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (demo_64_,OP) + #define TARGETNAME "demo64" #include "aoutf1.h" diff -uprN binutils-2.11.90.0.31/bfd/dep-in.sed binutils-2.11.92.0.5/bfd/dep-in.sed --- binutils-2.11.90.0.31/bfd/dep-in.sed Tue May 2 10:07:07 2000 +++ binutils-2.11.92.0.5/bfd/dep-in.sed Thu Oct 4 14:35:43 2001 @@ -9,12 +9,13 @@ s!@INCDIR@!$(INCDIR)!g s!@SRCDIR@/../opcodes!$(srcdir)/../opcodes!g s!@SRCDIR@/!!g s! hosts/[^ ]*\.h! !g -s/ sysdep.h//g +s! sysdep.h!!g s! \.\./bfd/sysdep.h!!g -s/ libbfd.h//g -s/ config.h//g +s! libbfd.h!!g +s! config.h!!g s! \$(INCDIR)/fopen-[^ ]*\.h!!g s! \$(INCDIR)/ansidecl\.h!!g +s! \$(INCDIR)/symcat\.h!!g s/\\\n */ /g diff -uprN binutils-2.11.90.0.31/bfd/doc/ChangeLog binutils-2.11.92.0.5/bfd/doc/ChangeLog --- binutils-2.11.90.0.31/bfd/doc/ChangeLog Thu Jul 26 18:02:55 2001 +++ binutils-2.11.92.0.5/bfd/doc/ChangeLog Thu Oct 4 14:35:43 2001 @@ -1,3 +1,28 @@ +2001-10-03 Alan Modra + + * Makefile.am (BFD_H_DEP): Add ../version.h. + * Makefile.in: Regenerate. + +2001-10-02 Alan Modra + + * Makefile.in: Regenerate. + +2001-10-01 Alan Modra + + * header.sed: New file, adds header to generated files. + * Makefile.am: Rewrite rules generating libbfd.h, libcoff.h and + bfd.h, using above. Add missing elf.c dependecy for libbfd.h. + * Makefile.in: Regenerate. + +2001-09-21 Alan Modra + + * Makefile.in: Regenerate. + +2001-09-18 Alan Modra + + * bfdint.texi: Replace reference to bfd_read with bfd_bread. + Likewise for bfd_write. + 2001-07-24 Alan Modra * Makefile.in: Regenerate. diff -uprN binutils-2.11.90.0.31/bfd/doc/Makefile.am binutils-2.11.92.0.5/bfd/doc/Makefile.am --- binutils-2.11.90.0.31/bfd/doc/Makefile.am Thu Jun 3 11:01:55 1999 +++ binutils-2.11.92.0.5/bfd/doc/Makefile.am Thu Oct 4 14:35:43 2001 @@ -183,30 +183,47 @@ s-linker: $(MKDOC) $(srcdir)/../linker.c touch s-linker linker.texi: s-linker -libbfd.h: $(srcdir)/../libbfd-in.h \ +LIBBFD_H_DEP = \ + $(srcdir)/../libbfd-in.h \ $(srcdir)/../init.c \ $(srcdir)/../libbfd.c \ $(srcdir)/../cache.c \ $(srcdir)/../reloc.c \ $(srcdir)/../archures.c \ + $(srcdir)/../elf.c \ + $(srcdir)/header.sed \ $(srcdir)/proto.str \ $(MKDOC) - cat $(srcdir)/../libbfd-in.h >libbfd.h - ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../init.c >>libbfd.h - ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../libbfd.c >>libbfd.h - ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../cache.c >>libbfd.h - ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../reloc.c >>libbfd.h - ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../archures.c >>libbfd.h - ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../elf.c >>libbfd.h -libcoff.h: $(srcdir)/../libcoff-in.h \ +libbfd.h: $(LIBBFD_H_DEP) + echo "$(LIBBFD_H_DEP)" | sed -f $(srcdir)/header.sed > $@ + for file in $(LIBBFD_H_DEP); do \ + case $$file in \ + *-in.h) cat $$file >> $@ ;; \ + */header.sed) break ;; \ + *) ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \ + esac; \ + done + +LIBCOFF_H_DEP = \ + $(srcdir)/../libcoff-in.h \ $(srcdir)/../coffcode.h \ + $(srcdir)/header.sed \ $(srcdir)/proto.str \ $(MKDOC) - cat $(srcdir)/../libcoff-in.h >libcoff.h - ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../coffcode.h >>libcoff.h -bfd.h: $(srcdir)/../bfd-in.h \ +libcoff.h: $(LIBCOFF_H_DEP) + echo "$(LIBCOFF_H_DEP)" | sed -f $(srcdir)/header.sed > $@ + for file in $(LIBCOFF_H_DEP); do \ + case $$file in \ + *-in.h) cat $$file >> $@ ;; \ + */header.sed) break ;; \ + *) ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \ + esac; \ + done + +BFD_H_DEP = \ + $(srcdir)/../bfd-in.h \ $(srcdir)/../init.c \ $(srcdir)/../opncls.c \ $(srcdir)/../libbfd.c \ @@ -219,25 +236,24 @@ bfd.h: $(srcdir)/../bfd-in.h \ $(srcdir)/../corefile.c \ $(srcdir)/../targets.c \ $(srcdir)/../format.c \ + $(srcdir)/header.sed \ $(srcdir)/proto.str \ + $(srcdir)/../version.h \ $(MKDOC) - cat $(srcdir)/../bfd-in.h >bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../init.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../opncls.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../libbfd.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../section.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../archures.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../reloc.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../syms.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../bfd.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../archive.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../corefile.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../targets.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../format.c >>bfd.h - echo "#ifdef __cplusplus" >>bfd.h - echo "}" >>bfd.h - echo "#endif" >>bfd.h - echo "#endif" >>bfd.h + +bfd.h: $(BFD_H_DEP) + echo "$(BFD_H_DEP)" | sed -f $(srcdir)/header.sed > $@ + for file in $(BFD_H_DEP); do \ + case $$file in \ + *-in.h) cat $$file >> $@ ;; \ + */header.sed) break ;; \ + *) ./$(MKDOC) -f $(srcdir)/proto.str < $$file >> $@ ;; \ + esac; \ + done + echo "#ifdef __cplusplus" >> $@ + echo "}" >> $@ + echo "#endif" >> $@ + echo "#endif" >> $@ noinst_TEXINFOS = bfdint.texi diff -uprN binutils-2.11.90.0.31/bfd/doc/Makefile.in binutils-2.11.92.0.5/bfd/doc/Makefile.in --- binutils-2.11.90.0.31/bfd/doc/Makefile.in Thu Jul 26 18:02:55 2001 +++ binutils-2.11.92.0.5/bfd/doc/Makefile.in Thu Oct 4 14:35:43 2001 @@ -115,7 +115,11 @@ WIN32LDFLAGS = @WIN32LDFLAGS@ WIN32LIBADD = @WIN32LIBADD@ all_backends = @all_backends@ bfd_backends = @bfd_backends@ +bfd_default_target_size = @bfd_default_target_size@ bfd_machines = @bfd_machines@ +bfd_version = @bfd_version@ +bfd_version_date = @bfd_version_date@ +bfd_version_string = @bfd_version_string@ l = @l@ tdefaults = @tdefaults@ wordsize = @wordsize@ @@ -172,6 +176,47 @@ info_TEXINFOS = bfd.texinfo MKDOC = chew$(EXEEXT_FOR_BUILD) +LIBBFD_H_DEP = \ + $(srcdir)/../libbfd-in.h \ + $(srcdir)/../init.c \ + $(srcdir)/../libbfd.c \ + $(srcdir)/../cache.c \ + $(srcdir)/../reloc.c \ + $(srcdir)/../archures.c \ + $(srcdir)/../elf.c \ + $(srcdir)/header.sed \ + $(srcdir)/proto.str \ + $(MKDOC) + + +LIBCOFF_H_DEP = \ + $(srcdir)/../libcoff-in.h \ + $(srcdir)/../coffcode.h \ + $(srcdir)/header.sed \ + $(srcdir)/proto.str \ + $(MKDOC) + + +BFD_H_DEP = \ + $(srcdir)/../bfd-in.h \ + $(srcdir)/../init.c \ + $(srcdir)/../opncls.c \ + $(srcdir)/../libbfd.c \ + $(srcdir)/../section.c \ + $(srcdir)/../archures.c \ + $(srcdir)/../reloc.c \ + $(srcdir)/../syms.c \ + $(srcdir)/../bfd.c \ + $(srcdir)/../archive.c \ + $(srcdir)/../corefile.c \ + $(srcdir)/../targets.c \ + $(srcdir)/../format.c \ + $(srcdir)/header.sed \ + $(srcdir)/proto.str \ + $(srcdir)/../version.h \ + $(MKDOC) + + noinst_TEXINFOS = bfdint.texi MOSTLYCLEANFILES = $(MKDOC) *.o @@ -544,61 +589,39 @@ s-linker: $(MKDOC) $(srcdir)/../linker.c touch s-linker linker.texi: s-linker -libbfd.h: $(srcdir)/../libbfd-in.h \ - $(srcdir)/../init.c \ - $(srcdir)/../libbfd.c \ - $(srcdir)/../cache.c \ - $(srcdir)/../reloc.c \ - $(srcdir)/../archures.c \ - $(srcdir)/proto.str \ - $(MKDOC) - cat $(srcdir)/../libbfd-in.h >libbfd.h - ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../init.c >>libbfd.h - ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../libbfd.c >>libbfd.h - ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../cache.c >>libbfd.h - ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../reloc.c >>libbfd.h - ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../archures.c >>libbfd.h - ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../elf.c >>libbfd.h +libbfd.h: $(LIBBFD_H_DEP) + echo "$(LIBBFD_H_DEP)" | sed -f $(srcdir)/header.sed > $@ + for file in $(LIBBFD_H_DEP); do \ + case $$file in \ + *-in.h) cat $$file >> $@ ;; \ + */header.sed) break ;; \ + *) ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \ + esac; \ + done -libcoff.h: $(srcdir)/../libcoff-in.h \ - $(srcdir)/../coffcode.h \ - $(srcdir)/proto.str \ - $(MKDOC) - cat $(srcdir)/../libcoff-in.h >libcoff.h - ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../coffcode.h >>libcoff.h +libcoff.h: $(LIBCOFF_H_DEP) + echo "$(LIBCOFF_H_DEP)" | sed -f $(srcdir)/header.sed > $@ + for file in $(LIBCOFF_H_DEP); do \ + case $$file in \ + *-in.h) cat $$file >> $@ ;; \ + */header.sed) break ;; \ + *) ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \ + esac; \ + done -bfd.h: $(srcdir)/../bfd-in.h \ - $(srcdir)/../init.c \ - $(srcdir)/../opncls.c \ - $(srcdir)/../libbfd.c \ - $(srcdir)/../section.c \ - $(srcdir)/../archures.c \ - $(srcdir)/../reloc.c \ - $(srcdir)/../syms.c \ - $(srcdir)/../bfd.c \ - $(srcdir)/../archive.c \ - $(srcdir)/../corefile.c \ - $(srcdir)/../targets.c \ - $(srcdir)/../format.c \ - $(srcdir)/proto.str \ - $(MKDOC) - cat $(srcdir)/../bfd-in.h >bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../init.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../opncls.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../libbfd.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../section.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../archures.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../reloc.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../syms.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../bfd.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../archive.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../corefile.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../targets.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../format.c >>bfd.h - echo "#ifdef __cplusplus" >>bfd.h - echo "}" >>bfd.h - echo "#endif" >>bfd.h - echo "#endif" >>bfd.h +bfd.h: $(BFD_H_DEP) + echo "$(BFD_H_DEP)" | sed -f $(srcdir)/header.sed > $@ + for file in $(BFD_H_DEP); do \ + case $$file in \ + *-in.h) cat $$file >> $@ ;; \ + */header.sed) break ;; \ + *) ./$(MKDOC) -f $(srcdir)/proto.str < $$file >> $@ ;; \ + esac; \ + done + echo "#ifdef __cplusplus" >> $@ + echo "}" >> $@ + echo "#endif" >> $@ + echo "#endif" >> $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff -uprN binutils-2.11.90.0.31/bfd/doc/bfdint.texi binutils-2.11.92.0.5/bfd/doc/bfdint.texi --- binutils-2.11.90.0.31/bfd/doc/bfdint.texi Sat Jun 23 00:05:22 2001 +++ binutils-2.11.92.0.5/bfd/doc/bfdint.texi Mon Oct 1 15:25:22 2001 @@ -1,6 +1,6 @@ \input texinfo @c Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, -@c 2000 +@c 2000, 2001 @c Free Software Foundation, Inc. @setfilename bfdint.info @@ -503,7 +503,7 @@ corresponds to an actual section in an a Get the contents of a section. This is called from @samp{bfd_get_section_contents}. Most targets set this to @samp{_bfd_generic_get_section_contents}, which does a @samp{bfd_seek} -based on the section's @samp{filepos} field and a @samp{bfd_read}. The +based on the section's @samp{filepos} field and a @samp{bfd_bread}. The corresponding field in the target vector is named @samp{_bfd_get_section_contents}. @@ -636,7 +636,7 @@ always uses extended name tables anyhow. target vector is named @samp{_bfd_truncate_arname}. @item _write_armap -Write out the archive symbol table using calls to @samp{bfd_write}. +Write out the archive symbol table using calls to @samp{bfd_bwrite}. This is normally called from the archive @samp{write_contents} routine. The corresponding field in the target vector is named @samp{write_armap} (no leading underscore). diff -uprN binutils-2.11.90.0.31/bfd/doc/header.sed binutils-2.11.92.0.5/bfd/doc/header.sed --- binutils-2.11.90.0.31/bfd/doc/header.sed Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/bfd/doc/header.sed Mon Oct 1 15:25:22 2001 @@ -0,0 +1,12 @@ +s|\(.*\) [^ ]*header.sed.*|\1| +s|[^ ]*/||g +s|^ *|"| +s| |", "|g +s|$|"| +s|, \([^ ]*\)$| and \1| +s|^|/* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically generated from | +s|\(.\{60\}[^ ]* \)|\1\ + |g +s|$|.\ + Run "make headers" in your build bfd/ to regenerate. */\ +| diff -uprN binutils-2.11.90.0.31/bfd/dwarf1.c binutils-2.11.92.0.5/bfd/dwarf1.c --- binutils-2.11.90.0.31/bfd/dwarf1.c Fri Aug 10 14:08:01 2001 +++ binutils-2.11.92.0.5/bfd/dwarf1.c Mon Oct 1 15:25:21 2001 @@ -129,7 +129,7 @@ struct linenumber { static struct dwarf1_unit *alloc_dwarf1_unit PARAMS ((struct dwarf1_debug *)); static struct dwarf1_func *alloc_dwarf1_func PARAMS ((struct dwarf1_debug *, struct dwarf1_unit *)); -static boolean parse_die PARAMS ((bfd *, struct die_info *, char *)); +static boolean parse_die PARAMS ((bfd *, struct die_info *, char *, char *)); static boolean parse_line_table PARAMS ((struct dwarf1_debug *, struct dwarf1_unit *)); static boolean parse_functions_in_unit @@ -145,9 +145,9 @@ static struct dwarf1_unit* alloc_dwarf1_unit (stash) struct dwarf1_debug* stash; { - struct dwarf1_unit* x = - (struct dwarf1_unit*) bfd_zalloc (stash->abfd, - sizeof (struct dwarf1_unit)); + bfd_size_type amt = sizeof (struct dwarf1_unit); + + struct dwarf1_unit* x = (struct dwarf1_unit*) bfd_zalloc (stash->abfd, amt); x->prev = stash->lastUnit; stash->lastUnit = x; @@ -162,9 +162,9 @@ alloc_dwarf1_func (stash, aUnit) struct dwarf1_debug* stash; struct dwarf1_unit* aUnit; { - struct dwarf1_func* x = - (struct dwarf1_func*) bfd_zalloc (stash->abfd, - sizeof (struct dwarf1_func)); + bfd_size_type amt = sizeof (struct dwarf1_func); + + struct dwarf1_func* x = (struct dwarf1_func*) bfd_zalloc (stash->abfd, amt); x->prev = aUnit->func_list; aUnit->func_list = x; @@ -179,10 +179,11 @@ alloc_dwarf1_func (stash, aUnit) Return false if the die is invalidly formatted; true otherwise. */ static boolean -parse_die (abfd, aDieInfo, aDiePtr) +parse_die (abfd, aDieInfo, aDiePtr, aDiePtrEnd) bfd* abfd; struct die_info* aDieInfo; char* aDiePtr; + char* aDiePtrEnd; { char* this_die = aDiePtr; char* xptr = this_die; @@ -192,7 +193,8 @@ parse_die (abfd, aDieInfo, aDiePtr) /* First comes the length. */ aDieInfo->length = bfd_get_32 (abfd, (bfd_byte *) xptr); xptr += 4; - if (aDieInfo->length == 0) + if (aDieInfo->length == 0 + || (this_die + aDieInfo->length) >= aDiePtrEnd) return false; if (aDieInfo->length < 6) { @@ -275,7 +277,7 @@ parse_line_table (stash, aUnit) if (stash->line_section == 0) { asection *msec; - unsigned long size; + bfd_size_type size; msec = bfd_get_section_by_name (stash->abfd, ".line"); if (! msec) @@ -287,7 +289,8 @@ parse_line_table (stash, aUnit) if (! stash->line_section) return false; - if (! bfd_get_section_contents (stash->abfd, msec, stash->line_section, 0, size)) + if (! bfd_get_section_contents (stash->abfd, msec, stash->line_section, + (bfd_vma) 0, size)) { stash->line_section = 0; return false; @@ -300,9 +303,9 @@ parse_line_table (stash, aUnit) if (xptr < stash->line_section_end) { unsigned long eachLine; - - char* tblend; + char *tblend; unsigned long base; + bfd_size_type amt; /* First comes the length. */ tblend = bfd_get_32 (stash->abfd, (bfd_byte *) xptr) + xptr; @@ -317,9 +320,9 @@ parse_line_table (stash, aUnit) aUnit->line_count = (tblend - xptr) / 10; /* Allocate an array for the entries. */ - aUnit->linenumber_table = (struct linenumber *) - bfd_alloc (stash->abfd, - sizeof (struct linenumber) * aUnit->line_count); + amt = sizeof (struct linenumber) * aUnit->line_count; + aUnit->linenumber_table = ((struct linenumber *) + bfd_alloc (stash->abfd, amt)); for (eachLine = 0; eachLine < aUnit->line_count; eachLine++) { @@ -360,7 +363,8 @@ parse_functions_in_unit (stash, aUnit) { struct die_info eachDieInfo; - if (! parse_die (stash->abfd, &eachDieInfo, eachDie)) + if (! parse_die (stash->abfd, &eachDieInfo, eachDie, + stash->debug_section_end)) return false; if (eachDieInfo.tag == TAG_global_subroutine @@ -479,10 +483,10 @@ _bfd_dwarf1_find_nearest_line (abfd, sec if (! stash) { asection *msec; - unsigned long size; + bfd_size_type size = sizeof (struct dwarf1_debug); - stash = elf_tdata (abfd)->dwarf1_find_line_info = - (struct dwarf1_debug*) bfd_zalloc (abfd, sizeof (struct dwarf1_debug)); + stash = elf_tdata (abfd)->dwarf1_find_line_info + = (struct dwarf1_debug *) bfd_zalloc (abfd, size); if (! stash) return false; @@ -502,7 +506,8 @@ _bfd_dwarf1_find_nearest_line (abfd, sec if (! stash->debug_section) return false; - if (! bfd_get_section_contents (abfd, msec, stash->debug_section, 0, size)) + if (! bfd_get_section_contents (abfd, msec, stash->debug_section, + (bfd_vma) 0, size)) { stash->debug_section = 0; return false; @@ -534,7 +539,8 @@ _bfd_dwarf1_find_nearest_line (abfd, sec { struct die_info aDieInfo; - if (! parse_die (stash->abfd, &aDieInfo, stash->currentDie)) + if (! parse_die (stash->abfd, &aDieInfo, stash->currentDie, + stash->debug_section_end)) return false; if (aDieInfo.tag == TAG_compile_unit) diff -uprN binutils-2.11.90.0.31/bfd/dwarf2.c binutils-2.11.92.0.5/bfd/dwarf2.c --- binutils-2.11.90.0.31/bfd/dwarf2.c Fri Aug 10 14:08:01 2001 +++ binutils-2.11.92.0.5/bfd/dwarf2.c Mon Oct 1 15:25:21 2001 @@ -463,6 +463,7 @@ read_abbrevs (abfd, offset, stash) struct abbrev_info *cur_abbrev; unsigned int abbrev_number, bytes_read, abbrev_name; unsigned int abbrev_form, hash_number; + bfd_size_type amt; if (! stash->dwarf_abbrev_buffer) { @@ -477,13 +478,12 @@ read_abbrevs (abfd, offset, stash) } stash->dwarf_abbrev_size = msec->_raw_size; - stash->dwarf_abbrev_buffer = (char*) bfd_alloc (abfd, stash->dwarf_abbrev_size); + stash->dwarf_abbrev_buffer = (char*) bfd_alloc (abfd, msec->_raw_size); if (! stash->dwarf_abbrev_buffer) return 0; - if (! bfd_get_section_contents (abfd, msec, - stash->dwarf_abbrev_buffer, 0, - stash->dwarf_abbrev_size)) + if (! bfd_get_section_contents (abfd, msec, stash->dwarf_abbrev_buffer, + (bfd_vma) 0, msec->_raw_size)) return 0; } @@ -495,7 +495,8 @@ read_abbrevs (abfd, offset, stash) return 0; } - abbrevs = (struct abbrev_info**) bfd_zalloc (abfd, sizeof (struct abbrev_info*) * ABBREV_HASH_SIZE); + amt = sizeof (struct abbrev_info*) * ABBREV_HASH_SIZE; + abbrevs = (struct abbrev_info**) bfd_zalloc (abfd, amt); abbrev_ptr = stash->dwarf_abbrev_buffer + offset; abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); @@ -504,7 +505,8 @@ read_abbrevs (abfd, offset, stash) /* Loop until we reach an abbrev number of 0. */ while (abbrev_number) { - cur_abbrev = (struct abbrev_info*)bfd_zalloc (abfd, sizeof (struct abbrev_info)); + amt = sizeof (struct abbrev_info); + cur_abbrev = (struct abbrev_info *) bfd_zalloc (abfd, amt); /* Read in abbrev header. */ cur_abbrev->number = abbrev_number; @@ -523,10 +525,10 @@ read_abbrevs (abfd, offset, stash) { if ((cur_abbrev->num_attrs % ATTR_ALLOC_CHUNK) == 0) { - cur_abbrev->attrs = (struct attr_abbrev *) - bfd_realloc (cur_abbrev->attrs, - (cur_abbrev->num_attrs + ATTR_ALLOC_CHUNK) - * sizeof (struct attr_abbrev)); + amt = cur_abbrev->num_attrs + ATTR_ALLOC_CHUNK; + amt *= sizeof (struct attr_abbrev); + cur_abbrev->attrs = ((struct attr_abbrev *) + bfd_realloc (cur_abbrev->attrs, amt)); if (! cur_abbrev->attrs) return 0; } @@ -574,6 +576,7 @@ read_attribute (attr, abbrev, unit, info bfd *abfd = unit->abfd; unsigned int bytes_read; struct dwarf_block *blk; + bfd_size_type amt; attr->name = abbrev->name; attr->form = abbrev->form; @@ -586,7 +589,8 @@ read_attribute (attr, abbrev, unit, info info_ptr += unit->addr_size; break; case DW_FORM_block2: - blk = (struct dwarf_block *) bfd_alloc (abfd, sizeof (struct dwarf_block)); + amt = sizeof (struct dwarf_block); + blk = (struct dwarf_block *) bfd_alloc (abfd, amt); blk->size = read_2_bytes (abfd, info_ptr); info_ptr += 2; blk->data = read_n_bytes (abfd, info_ptr, blk->size); @@ -594,7 +598,8 @@ read_attribute (attr, abbrev, unit, info DW_BLOCK (attr) = blk; break; case DW_FORM_block4: - blk = (struct dwarf_block *) bfd_alloc (abfd, sizeof (struct dwarf_block)); + amt = sizeof (struct dwarf_block); + blk = (struct dwarf_block *) bfd_alloc (abfd, amt); blk->size = read_4_bytes (abfd, info_ptr); info_ptr += 4; blk->data = read_n_bytes (abfd, info_ptr, blk->size); @@ -618,7 +623,8 @@ read_attribute (attr, abbrev, unit, info info_ptr += bytes_read; break; case DW_FORM_block: - blk = (struct dwarf_block *) bfd_alloc (abfd, sizeof (struct dwarf_block)); + amt = sizeof (struct dwarf_block); + blk = (struct dwarf_block *) bfd_alloc (abfd, amt); blk->size = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); info_ptr += bytes_read; blk->data = read_n_bytes (abfd, info_ptr, blk->size); @@ -626,7 +632,8 @@ read_attribute (attr, abbrev, unit, info DW_BLOCK (attr) = blk; break; case DW_FORM_block1: - blk = (struct dwarf_block *) bfd_alloc (abfd, sizeof (struct dwarf_block)); + amt = sizeof (struct dwarf_block); + blk = (struct dwarf_block *) bfd_alloc (abfd, amt); blk->size = read_1_byte (abfd, info_ptr); info_ptr += 1; blk->data = read_n_bytes (abfd, info_ptr, blk->size); @@ -722,8 +729,8 @@ add_line_info (table, address, filename, unsigned int column; int end_sequence; { - struct line_info* info = (struct line_info*) - bfd_alloc (table->abfd, sizeof (struct line_info)); + bfd_size_type amt = sizeof (struct line_info); + struct line_info* info = (struct line_info*) bfd_alloc (table->abfd, amt); info->prev_line = table->last_line; table->last_line = info; @@ -799,7 +806,7 @@ arange_add (unit, low_pc, high_pc) } /* Need to allocate a new arange and insert it into the arange list. */ - arange = bfd_zalloc (unit->abfd, sizeof (*arange)); + arange = bfd_zalloc (unit->abfd, (bfd_size_type) sizeof (*arange)); arange->low = low_pc; arange->high = high_pc; @@ -822,6 +829,7 @@ decode_line_info (unit, stash) unsigned int i, bytes_read; char *cur_file, *cur_dir; unsigned char op_code, extended_op, adj_opcode; + bfd_size_type amt; if (! stash->dwarf_line_buffer) { @@ -836,13 +844,12 @@ decode_line_info (unit, stash) } stash->dwarf_line_size = msec->_raw_size; - stash->dwarf_line_buffer = (char *) bfd_alloc (abfd, stash->dwarf_line_size); + stash->dwarf_line_buffer = (char *) bfd_alloc (abfd, msec->_raw_size); if (! stash->dwarf_line_buffer) return 0; - if (! bfd_get_section_contents (abfd, msec, - stash->dwarf_line_buffer, 0, - stash->dwarf_line_size)) + if (! bfd_get_section_contents (abfd, msec, stash->dwarf_line_buffer, + (bfd_vma) 0, msec->_raw_size)) return 0; /* FIXME: We ought to apply the relocs against this section before @@ -860,8 +867,8 @@ decode_line_info (unit, stash) return 0; } - table = (struct line_info_table*) bfd_alloc (abfd, - sizeof (struct line_info_table)); + amt = sizeof (struct line_info_table); + table = (struct line_info_table*) bfd_alloc (abfd, amt); table->abfd = abfd; table->comp_dir = unit->comp_dir; @@ -894,8 +901,8 @@ decode_line_info (unit, stash) line_ptr += 1; lh.opcode_base = read_1_byte (abfd, line_ptr); line_ptr += 1; - lh.standard_opcode_lengths = (unsigned char *) - bfd_alloc (abfd, lh.opcode_base * sizeof (unsigned char)); + amt = lh.opcode_base * sizeof (unsigned char); + lh.standard_opcode_lengths = (unsigned char *) bfd_alloc (abfd, amt); lh.standard_opcode_lengths[0] = 1; @@ -912,9 +919,9 @@ decode_line_info (unit, stash) if ((table->num_dirs % DIR_ALLOC_CHUNK) == 0) { - table->dirs = (char **) - bfd_realloc (table->dirs, - (table->num_dirs + DIR_ALLOC_CHUNK) * sizeof (char *)); + amt = table->num_dirs + DIR_ALLOC_CHUNK; + amt *= sizeof (char *); + table->dirs = (char **) bfd_realloc (table->dirs, amt); if (! table->dirs) return 0; } @@ -931,10 +938,9 @@ decode_line_info (unit, stash) if ((table->num_files % FILE_ALLOC_CHUNK) == 0) { - table->files = (struct fileinfo *) - bfd_realloc (table->files, - (table->num_files + FILE_ALLOC_CHUNK) - * sizeof (struct fileinfo)); + amt = table->num_files + FILE_ALLOC_CHUNK; + amt *= sizeof (struct fileinfo); + table->files = (struct fileinfo *) bfd_realloc (table->files, amt); if (! table->files) return 0; } @@ -1001,10 +1007,10 @@ decode_line_info (unit, stash) line_ptr += bytes_read; if ((table->num_files % FILE_ALLOC_CHUNK) == 0) { - table->files = (struct fileinfo *) - bfd_realloc (table->files, - (table->num_files + FILE_ALLOC_CHUNK) - * sizeof (struct fileinfo)); + amt = table->num_files + FILE_ALLOC_CHUNK; + amt *= sizeof (struct fileinfo); + table->files = + (struct fileinfo *) bfd_realloc (table->files, amt); if (! table->files) return 0; } @@ -1208,7 +1214,8 @@ scan_unit_for_functions (unit) if (abbrev->tag == DW_TAG_subprogram) { - func = (struct funcinfo*) bfd_zalloc (abfd, sizeof (struct funcinfo)); + bfd_size_type amt = sizeof (struct funcinfo); + func = (struct funcinfo *) bfd_zalloc (abfd, amt); func->prev_func = unit->function_table; unit->function_table = func; } @@ -1295,7 +1302,7 @@ find_rela_addend (abfd, sec, offset, sym if (reloc_size <= 0) return 0; - relocs = (arelent **) bfd_malloc ((size_t) reloc_size); + relocs = (arelent **) bfd_malloc ((bfd_size_type) reloc_size); if (relocs == NULL) return 0; @@ -1318,7 +1325,7 @@ find_rela_addend (abfd, sec, offset, sym free (relocs); return addend; } - + free (relocs); return 0; } @@ -1353,6 +1360,8 @@ parse_comp_unit (abfd, stash, unit_lengt char *info_ptr = stash->info_ptr; char *end_ptr = info_ptr + unit_length; + bfd_size_type amt; + bfd_size_type off; version = read_2_bytes (abfd, info_ptr); info_ptr += 2; @@ -1367,9 +1376,8 @@ parse_comp_unit (abfd, stash, unit_lengt .debug_abbrev+offset. On RELA targets, we have to find the relocation and extract the addend to obtain the actual abbrev_offset, so do it here. */ - abbrev_offset += find_rela_addend (abfd, stash->sec, - info_ptr - stash->sec_info_ptr, - stash->syms); + off = info_ptr - stash->sec_info_ptr; + abbrev_offset += find_rela_addend (abfd, stash->sec, off, stash->syms); info_ptr += abbrev_length; addr_size = read_1_byte (abfd, info_ptr); info_ptr += 1; @@ -1421,7 +1429,8 @@ parse_comp_unit (abfd, stash, unit_lengt return 0; } - unit = (struct comp_unit*) bfd_zalloc (abfd, sizeof (struct comp_unit)); + amt = sizeof (struct comp_unit); + unit = (struct comp_unit*) bfd_zalloc (abfd, amt); unit->abfd = abfd; unit->addr_size = addr_size; unit->abbrevs = abbrevs; @@ -1645,11 +1654,11 @@ _bfd_dwarf2_find_nearest_line (abfd, sec if (! stash) { - unsigned long total_size; + bfd_size_type total_size; asection *msec; + bfd_size_type amt = sizeof (struct dwarf2_debug); - stash = - (struct dwarf2_debug*) bfd_zalloc (abfd, sizeof (struct dwarf2_debug)); + stash = (struct dwarf2_debug*) bfd_zalloc (abfd, amt); if (! stash) return false; @@ -1680,8 +1689,8 @@ _bfd_dwarf2_find_nearest_line (abfd, sec msec; msec = find_debug_info (abfd, msec)) { - unsigned long size; - unsigned long start; + bfd_size_type size; + bfd_size_type start; size = msec->_raw_size; if (size == 0) @@ -1689,7 +1698,8 @@ _bfd_dwarf2_find_nearest_line (abfd, sec start = stash->info_ptr_end - stash->info_ptr; - if (! bfd_get_section_contents (abfd, msec, stash->info_ptr + start, 0, size)) + if (! bfd_get_section_contents (abfd, msec, stash->info_ptr + start, + (bfd_vma) 0, size)) continue; stash->info_ptr_end = stash->info_ptr + start + size; @@ -1732,7 +1742,6 @@ _bfd_dwarf2_find_nearest_line (abfd, sec /* Read each remaining comp. units checking each as they are read. */ while (stash->info_ptr < stash->info_ptr_end) { - struct comp_unit* each; bfd_vma length; boolean found; diff -uprN binutils-2.11.90.0.31/bfd/ecoff.c binutils-2.11.92.0.5/bfd/ecoff.c --- binutils-2.11.90.0.31/bfd/ecoff.c Tue Jun 19 11:57:32 2001 +++ binutils-2.11.92.0.5/bfd/ecoff.c Mon Oct 1 15:25:21 2001 @@ -65,7 +65,7 @@ static boolean ecoff_compute_section_fil static bfd_size_type ecoff_compute_reloc_file_positions PARAMS ((bfd *abfd)); static boolean ecoff_get_extr PARAMS ((asymbol *, EXTR *)); static void ecoff_set_index PARAMS ((asymbol *, bfd_size_type)); -static unsigned int ecoff_armap_hash PARAMS ((CONST char *s, +static unsigned int ecoff_armap_hash PARAMS ((const char *s, unsigned int *rehash, unsigned int size, unsigned int hlog)); @@ -78,7 +78,7 @@ static asection bfd_debug_section = "*DEBUG*", 0, 0, NULL, 0, 0, 0, /* linker_mark, linker_has_input, gc_mark, segment_mark, */ 0, 0, 0, 0, - /* vma, lma, _cooked_size, _raw_size, */ + /* vma, lma, _cooked_size, _raw_size, */ 0, 0, 0, 0, /* output_offset, output_section, alignment_power, */ 0, NULL, 0, @@ -86,8 +86,8 @@ static asection bfd_debug_section = NULL, NULL, 0, 0, 0, /* line_filepos, userdata, contents, lineno, lineno_count, */ 0, NULL, NULL, NULL, 0, - /* entsize, comdat, kept_section, moving_line_filepos, */ - 0, NULL, NULL, 0, + /* entsize, comdat, moving_line_filepos, */ + 0, NULL, 0, /* target_index, used_by_bfd, constructor_chain, owner, */ 0, NULL, NULL, NULL, /* symbol, */ @@ -104,8 +104,8 @@ boolean _bfd_ecoff_mkobject (abfd) bfd *abfd; { - abfd->tdata.ecoff_obj_data = ((struct ecoff_tdata *) - bfd_zalloc (abfd, sizeof (ecoff_data_type))); + bfd_size_type amt = sizeof (ecoff_data_type); + abfd->tdata.ecoff_obj_data = (struct ecoff_tdata *) bfd_zalloc (abfd, amt); if (abfd->tdata.ecoff_obj_data == NULL) return false; @@ -474,13 +474,12 @@ ecoff_slurp_symbolic_header (abfd) } /* Read the symbolic information header. */ - raw = (PTR) bfd_malloc ((size_t) external_hdr_size); + raw = (PTR) bfd_malloc (external_hdr_size); if (raw == NULL) goto error_return; - if (bfd_seek (abfd, ecoff_data (abfd)->sym_filepos, SEEK_SET) == -1 - || (bfd_read (raw, external_hdr_size, 1, abfd) - != external_hdr_size)) + if (bfd_seek (abfd, ecoff_data (abfd)->sym_filepos, SEEK_SET) != 0 + || bfd_bread (raw, external_hdr_size, abfd) != external_hdr_size) goto error_return; internal_symhdr = &ecoff_data (abfd)->debug_info.symbolic_header; (*backend->debug_swap.swap_hdr_in) (abfd, raw, internal_symhdr); @@ -525,6 +524,8 @@ _bfd_ecoff_slurp_symbolic_info (abfd, ig struct fdr *fdr_ptr; bfd_size_type raw_end; bfd_size_type cb_end; + bfd_size_type amt; + file_ptr pos; BFD_ASSERT (debug == &ecoff_data (abfd)->debug_info); @@ -583,11 +584,11 @@ _bfd_ecoff_slurp_symbolic_info (abfd, ig raw = (PTR) bfd_alloc (abfd, raw_size); if (raw == NULL) return false; - if (bfd_seek (abfd, - (ecoff_data (abfd)->sym_filepos - + backend->debug_swap.external_hdr_size), - SEEK_SET) != 0 - || bfd_read (raw, raw_size, 1, abfd) != raw_size) + + pos = ecoff_data (abfd)->sym_filepos; + pos += backend->debug_swap.external_hdr_size; + if (bfd_seek (abfd, pos, SEEK_SET) != 0 + || bfd_bread (raw, raw_size, abfd) != raw_size) { bfd_release (abfd, raw); return false; @@ -624,9 +625,9 @@ _bfd_ecoff_slurp_symbolic_info (abfd, ig We need to look at the fdr to deal with a lot of information in the symbols, so we swap them here. */ - debug->fdr = (struct fdr *) bfd_alloc (abfd, - (internal_symhdr->ifdMax * - sizeof (struct fdr))); + amt = internal_symhdr->ifdMax; + amt *= sizeof (struct fdr); + debug->fdr = (struct fdr *) bfd_alloc (abfd, amt); if (debug->fdr == NULL) return false; external_fdr_size = backend->debug_swap.external_fdr_size; @@ -658,8 +659,9 @@ _bfd_ecoff_make_empty_symbol (abfd) bfd *abfd; { ecoff_symbol_type *new; + bfd_size_type amt = sizeof (ecoff_symbol_type); - new = (ecoff_symbol_type *) bfd_alloc (abfd, sizeof (ecoff_symbol_type)); + new = (ecoff_symbol_type *) bfd_alloc (abfd, amt); if (new == (ecoff_symbol_type *) NULL) return (asymbol *) NULL; memset ((PTR) new, 0, sizeof *new); @@ -858,6 +860,7 @@ ecoff_set_symbol_info (abfd, ecoff_sym, 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 @@ -877,7 +880,8 @@ ecoff_set_symbol_info (abfd, ecoff_sym, { char *copy; - copy = (char *) bfd_alloc (abfd, strlen (name) + 1); + amt = strlen (name) + 1; + copy = (char *) bfd_alloc (abfd, amt); if (!copy) return false; strcpy (copy, name); @@ -885,8 +889,8 @@ ecoff_set_symbol_info (abfd, ecoff_sym, } /* Build a reloc pointing to this constructor. */ - reloc_chain = - (arelent_chain *) bfd_alloc (abfd, sizeof (arelent_chain)); + amt = sizeof (arelent_chain); + reloc_chain = (arelent_chain *) bfd_alloc (abfd, amt); if (!reloc_chain) return false; reloc_chain->relent.sym_ptr_ptr = @@ -958,7 +962,8 @@ _bfd_ecoff_slurp_symbol_table (abfd) if (bfd_get_symcount (abfd) == 0) return true; - internal_size = bfd_get_symcount (abfd) * sizeof (ecoff_symbol_type); + internal_size = bfd_get_symcount (abfd); + internal_size *= sizeof (ecoff_symbol_type); internal = (ecoff_symbol_type *) bfd_alloc (abfd, internal_size); if (internal == NULL) return false; @@ -1663,7 +1668,7 @@ ecoff_slurp_reloc_table (abfd, section, const struct ecoff_backend_data * const backend = ecoff_backend (abfd); arelent *internal_relocs; bfd_size_type external_reloc_size; - bfd_size_type external_relocs_size; + bfd_size_type amt; char *external_relocs; arelent *rptr; unsigned int i; @@ -1676,19 +1681,19 @@ ecoff_slurp_reloc_table (abfd, section, if (_bfd_ecoff_slurp_symbol_table (abfd) == false) return false; - internal_relocs = (arelent *) bfd_alloc (abfd, - (sizeof (arelent) - * section->reloc_count)); + amt = section->reloc_count; + amt *= sizeof (arelent); + internal_relocs = (arelent *) bfd_alloc (abfd, amt); + external_reloc_size = backend->external_reloc_size; - external_relocs_size = external_reloc_size * section->reloc_count; - external_relocs = (char *) bfd_alloc (abfd, external_relocs_size); + amt = external_reloc_size * section->reloc_count; + external_relocs = (char *) bfd_alloc (abfd, amt); if (internal_relocs == (arelent *) NULL || external_relocs == (char *) NULL) return false; if (bfd_seek (abfd, section->rel_filepos, SEEK_SET) != 0) return false; - if (bfd_read (external_relocs, 1, external_relocs_size, abfd) - != external_relocs_size) + if (bfd_bread (external_relocs, amt, abfd) != amt) return false; for (i = 0, rptr = internal_relocs; i < section->reloc_count; i++, rptr++) @@ -1717,7 +1722,7 @@ ecoff_slurp_reloc_table (abfd, section, } else { - CONST char *sec_name; + const char *sec_name; asection *sec; /* r_symndx is a section key. */ @@ -1814,8 +1819,8 @@ _bfd_ecoff_find_nearest_line (abfd, sect asection *section; asymbol **ignore_symbols ATTRIBUTE_UNUSED; bfd_vma offset; - CONST char **filename_ptr; - CONST char **functionname_ptr; + const char **filename_ptr; + const char **functionname_ptr; unsigned int *retline_ptr; { const struct ecoff_debug_swap * const debug_swap @@ -1830,9 +1835,9 @@ _bfd_ecoff_find_nearest_line (abfd, sect if (ecoff_data (abfd)->find_line_info == NULL) { - ecoff_data (abfd)->find_line_info = - ((struct ecoff_find_line *) - bfd_zalloc (abfd, sizeof (struct ecoff_find_line))); + bfd_size_type amt = sizeof (struct ecoff_find_line); + ecoff_data (abfd)->find_line_info + = (struct ecoff_find_line *) bfd_zalloc (abfd, amt); if (ecoff_data (abfd)->find_line_info == NULL) return false; } @@ -2057,13 +2062,15 @@ ecoff_compute_section_file_positions (ab boolean rdata_in_text; boolean first_data, first_nonalloc; const bfd_vma round = ecoff_backend (abfd)->round; + bfd_size_type amt; sofar = _bfd_ecoff_sizeof_headers (abfd, false); file_sofar = sofar; /* Sort the sections by VMA. */ - sorted_hdrs = (asection **) bfd_malloc (abfd->section_count - * sizeof (asection *)); + amt = abfd->section_count; + amt *= sizeof (asection *); + sorted_hdrs = (asection **) bfd_malloc (amt); if (sorted_hdrs == NULL) return false; for (current = abfd->sections, i = 0; @@ -2257,6 +2264,8 @@ _bfd_ecoff_set_section_contents (abfd, s file_ptr offset; bfd_size_type count; { + file_ptr pos; + /* This must be done first, because bfd_set_section_contents is going to set output_has_begun to true. */ if (abfd->output_has_begun == false) @@ -2285,8 +2294,9 @@ _bfd_ecoff_set_section_contents (abfd, s if (count == 0) return true; - if (bfd_seek (abfd, (file_ptr) (section->filepos + offset), SEEK_SET) != 0 - || bfd_write (location, 1, count, abfd) != count) + pos = section->filepos + offset; + if (bfd_seek (abfd, pos, SEEK_SET) != 0 + || bfd_bwrite (location, count, abfd) != count) return false; return true; @@ -2513,7 +2523,7 @@ _bfd_ecoff_write_object_contents (abfd) siz = filhsz; if (siz < aoutsz) siz = aoutsz; - buff = (PTR) bfd_malloc ((size_t) siz); + buff = (PTR) bfd_malloc (siz); if (buff == NULL) goto error_return; } @@ -2573,7 +2583,7 @@ _bfd_ecoff_write_object_contents (abfd) current->flags); if (bfd_coff_swap_scnhdr_out (abfd, (PTR) §ion, buff) == 0 - || bfd_write (buff, 1, scnhsz, abfd) != scnhsz) + || bfd_bwrite (buff, scnhsz, abfd) != scnhsz) goto error_return; if ((section.s_flags & STYP_TEXT) != 0 @@ -2724,11 +2734,11 @@ _bfd_ecoff_write_object_contents (abfd) goto error_return; bfd_coff_swap_filehdr_out (abfd, (PTR) &internal_f, buff); - if (bfd_write (buff, 1, filhsz, abfd) != filhsz) + if (bfd_bwrite (buff, filhsz, abfd) != filhsz) goto error_return; bfd_coff_swap_aouthdr_out (abfd, (PTR) &internal_a, buff); - if (bfd_write (buff, 1, aoutsz, abfd) != aoutsz) + if (bfd_bwrite (buff, aoutsz, abfd) != aoutsz) goto error_return; /* Build the external symbol information. This must be done before @@ -2756,12 +2766,13 @@ _bfd_ecoff_write_object_contents (abfd) arelent **reloc_ptr_ptr; arelent **reloc_end; char *out_ptr; + bfd_size_type amt; if (current->reloc_count == 0) continue; - reloc_buff = - bfd_alloc (abfd, current->reloc_count * external_reloc_size); + amt = current->reloc_count * external_reloc_size; + reloc_buff = bfd_alloc (abfd, amt); if (reloc_buff == NULL) goto error_return; @@ -2792,7 +2803,7 @@ _bfd_ecoff_write_object_contents (abfd) } else { - CONST char *name; + const char *name; name = bfd_get_section_name (abfd, bfd_get_section (sym)); if (strcmp (name, ".text") == 0) @@ -2837,9 +2848,8 @@ _bfd_ecoff_write_object_contents (abfd) if (bfd_seek (abfd, current->rel_filepos, SEEK_SET) != 0) goto error_return; - if (bfd_write (reloc_buff, - external_reloc_size, current->reloc_count, abfd) - != external_reloc_size * current->reloc_count) + amt = current->reloc_count * external_reloc_size; + if (bfd_bwrite (reloc_buff, amt, abfd) != amt) goto error_return; bfd_release (abfd, reloc_buff); reloc_buff = NULL; @@ -2869,12 +2879,12 @@ _bfd_ecoff_write_object_contents (abfd) if (bfd_seek (abfd, (file_ptr) ecoff_data (abfd)->sym_filepos - 1, SEEK_SET) != 0) goto error_return; - if (bfd_read (&c, 1, 1, abfd) == 0) + if (bfd_bread (&c, (bfd_size_type) 1, abfd) == 0) c = 0; if (bfd_seek (abfd, (file_ptr) ecoff_data (abfd)->sym_filepos - 1, SEEK_SET) != 0) goto error_return; - if (bfd_write (&c, 1, 1, abfd) != 1) + if (bfd_bwrite (&c, (bfd_size_type) 1, abfd) != 1) goto error_return; } @@ -2942,7 +2952,7 @@ _bfd_ecoff_write_object_contents (abfd) static unsigned int ecoff_armap_hash (s, rehash, size, hlog) - CONST char *s; + const char *s; unsigned int *rehash; unsigned int size; unsigned int hlog; @@ -2975,9 +2985,10 @@ _bfd_ecoff_slurp_armap (abfd) char *raw_ptr; struct symdef *symdef_ptr; char *stringbase; + bfd_size_type amt; /* Get the name of the first element. */ - i = bfd_read ((PTR) nextname, 1, 16, abfd); + i = bfd_bread ((PTR) nextname, (bfd_size_type) 16, abfd); if (i == 0) return true; if (i != 16) @@ -3032,7 +3043,7 @@ _bfd_ecoff_slurp_armap (abfd) if (raw_armap == (char *) NULL) return false; - if (bfd_read ((PTR) raw_armap, 1, parsed_size, abfd) != parsed_size) + if (bfd_bread ((PTR) raw_armap, parsed_size, abfd) != parsed_size) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_malformed_archive); @@ -3042,7 +3053,7 @@ _bfd_ecoff_slurp_armap (abfd) ardata->tdata = (PTR) raw_armap; - count = bfd_h_get_32 (abfd, (PTR) raw_armap); + count = H_GET_32 (abfd, raw_armap); ardata->symdef_count = 0; ardata->cache = (struct ar_cache *) NULL; @@ -3069,8 +3080,8 @@ _bfd_ecoff_slurp_armap (abfd) unsigned int name_offset, file_offset; unsigned int hash, rehash, srch; - name_offset = bfd_h_get_32 (abfd, (PTR) raw_ptr); - file_offset = bfd_h_get_32 (abfd, (PTR) (raw_ptr + 4)); + name_offset = H_GET_32 (abfd, raw_ptr); + file_offset = H_GET_32 (abfd, (raw_ptr + 4)); if (file_offset == 0) continue; hash = ecoff_armap_hash (stringbase + name_offset, &rehash, count, @@ -3082,8 +3093,7 @@ _bfd_ecoff_slurp_armap (abfd) for (srch = (hash + rehash) & (count - 1); srch != hash && srch != i; srch = (srch + rehash) & (count - 1)) - BFD_ASSERT (bfd_h_get_32 (abfd, (PTR) (raw_armap + 8 + srch * 8)) - != 0); + BFD_ASSERT (H_GET_32 (abfd, (raw_armap + 8 + srch * 8)) != 0); BFD_ASSERT (srch == i); } } @@ -3092,12 +3102,12 @@ _bfd_ecoff_slurp_armap (abfd) raw_ptr = raw_armap + 4; for (i = 0; i < count; i++, raw_ptr += 8) - if (bfd_h_get_32 (abfd, (PTR) (raw_ptr + 4)) != 0) + if (H_GET_32 (abfd, (raw_ptr + 4)) != 0) ++ardata->symdef_count; - symdef_ptr = ((struct symdef *) - bfd_alloc (abfd, - ardata->symdef_count * sizeof (struct symdef))); + amt = ardata->symdef_count; + amt *= sizeof (struct symdef); + symdef_ptr = (struct symdef *) bfd_alloc (abfd, amt); if (!symdef_ptr) return false; @@ -3108,10 +3118,10 @@ _bfd_ecoff_slurp_armap (abfd) { unsigned int name_offset, file_offset; - file_offset = bfd_h_get_32 (abfd, (PTR) (raw_ptr + 4)); + file_offset = H_GET_32 (abfd, (raw_ptr + 4)); if (file_offset == 0) continue; - name_offset = bfd_h_get_32 (abfd, (PTR) raw_ptr); + name_offset = H_GET_32 (abfd, raw_ptr); symdef_ptr->s.name = stringbase + name_offset; symdef_ptr->file_offset = file_offset; ++symdef_ptr; @@ -3137,7 +3147,7 @@ _bfd_ecoff_write_armap (abfd, elength, m int stridx; { unsigned int hashsize, hashlog; - unsigned int symdefsize; + bfd_size_type symdefsize; int padit; unsigned int stringsize; unsigned int mapsize; @@ -3210,12 +3220,12 @@ _bfd_ecoff_write_armap (abfd, elength, m if (((char *) (&hdr))[i] == '\0') (((char *) (&hdr))[i]) = ' '; - if (bfd_write ((PTR) &hdr, 1, sizeof (struct ar_hdr), abfd) + if (bfd_bwrite ((PTR) &hdr, (bfd_size_type) sizeof (struct ar_hdr), abfd) != sizeof (struct ar_hdr)) return false; - bfd_h_put_32 (abfd, (bfd_vma) hashsize, temp); - if (bfd_write ((PTR) temp, 1, 4, abfd) != 4) + H_PUT_32 (abfd, hashsize, temp); + if (bfd_bwrite ((PTR) temp, (bfd_size_type) 4, abfd) != 4) return false; hashtable = (bfd_byte *) bfd_zalloc (abfd, symdefsize); @@ -3230,7 +3240,7 @@ _bfd_ecoff_write_armap (abfd, elength, m /* Advance firstreal to the file position of this archive element. */ - if (((bfd *) map[i].pos) != last_elt) + if (map[i].u.abfd != last_elt) { do { @@ -3238,13 +3248,13 @@ _bfd_ecoff_write_armap (abfd, elength, m firstreal += firstreal % 2; current = current->next; } - while (current != (bfd *) map[i].pos); + while (current != map[i].u.abfd); } last_elt = current; hash = ecoff_armap_hash (*map[i].name, &rehash, hashsize, hashlog); - if (bfd_h_get_32 (abfd, (PTR) (hashtable + (hash * 8) + 4)) != 0) + if (H_GET_32 (abfd, (hashtable + (hash * 8) + 4)) != 0) { unsigned int srch; @@ -3252,7 +3262,7 @@ _bfd_ecoff_write_armap (abfd, elength, m for (srch = (hash + rehash) & (hashsize - 1); srch != hash; srch = (srch + rehash) & (hashsize - 1)) - if (bfd_h_get_32 (abfd, (PTR) (hashtable + (srch * 8) + 4)) == 0) + if (H_GET_32 (abfd, (hashtable + (srch * 8) + 4)) == 0) break; BFD_ASSERT (srch != hash); @@ -3260,27 +3270,25 @@ _bfd_ecoff_write_armap (abfd, elength, m hash = srch; } - bfd_h_put_32 (abfd, (bfd_vma) map[i].namidx, - (PTR) (hashtable + hash * 8)); - bfd_h_put_32 (abfd, (bfd_vma) firstreal, - (PTR) (hashtable + hash * 8 + 4)); + H_PUT_32 (abfd, map[i].namidx, (hashtable + hash * 8)); + H_PUT_32 (abfd, firstreal, (hashtable + hash * 8 + 4)); } - if (bfd_write ((PTR) hashtable, 1, symdefsize, abfd) != symdefsize) + if (bfd_bwrite ((PTR) hashtable, symdefsize, abfd) != symdefsize) return false; bfd_release (abfd, hashtable); /* Now write the strings. */ - bfd_h_put_32 (abfd, (bfd_vma) stringsize, temp); - if (bfd_write ((PTR) temp, 1, 4, abfd) != 4) + H_PUT_32 (abfd, stringsize, temp); + if (bfd_bwrite ((PTR) temp, (bfd_size_type) 4, abfd) != 4) return false; for (i = 0; i < orl_count; i++) { bfd_size_type len; len = strlen (*map[i].name) + 1; - if (bfd_write ((PTR) (*map[i].name), 1, len, abfd) != len) + if (bfd_bwrite ((PTR) (*map[i].name), len, abfd) != len) return false; } @@ -3288,7 +3296,7 @@ _bfd_ecoff_write_armap (abfd, elength, m bug-compatible for DECstation ar we use a null. */ if (padit) { - if (bfd_write ("", 1, 1, abfd) != 1) + if (bfd_bwrite ("", (bfd_size_type) 1, abfd) != 1) return false; } @@ -3304,10 +3312,11 @@ _bfd_ecoff_archive_p (abfd) { struct artdata *tdata_hold; char armag[SARMAG + 1]; + bfd_size_type amt; tdata_hold = abfd->tdata.aout_ar_data; - if (bfd_read ((PTR) armag, 1, SARMAG, abfd) != SARMAG) + if (bfd_bread ((PTR) armag, (bfd_size_type) SARMAG, abfd) != SARMAG) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -3323,8 +3332,8 @@ _bfd_ecoff_archive_p (abfd) /* We are setting bfd_ardata(abfd) here, but since bfd_ardata involves a cast, we can't do it as the left operand of assignment. */ - abfd->tdata.aout_ar_data = - (struct artdata *) bfd_zalloc (abfd, sizeof (struct artdata)); + amt = sizeof (struct artdata); + abfd->tdata.aout_ar_data = (struct artdata *) bfd_zalloc (abfd, amt); if (bfd_ardata (abfd) == (struct artdata *) NULL) { @@ -3441,9 +3450,9 @@ _bfd_ecoff_bfd_link_hash_table_create (a bfd *abfd; { struct ecoff_link_hash_table *ret; + bfd_size_type amt = sizeof (struct ecoff_link_hash_table); - ret = ((struct ecoff_link_hash_table *) - bfd_alloc (abfd, sizeof (struct ecoff_link_hash_table))); + ret = (struct ecoff_link_hash_table *) bfd_alloc (abfd, amt); if (ret == NULL) return NULL; if (! _bfd_link_hash_table_init (&ret->root, abfd, @@ -3533,7 +3542,7 @@ ecoff_link_add_archive_symbols (abfd, in return (_bfd_generic_link_add_archive_symbols (abfd, info, ecoff_link_check_archive_element)); - armap_count = bfd_h_get_32 (abfd, raw_armap); + armap_count = H_GET_32 (abfd, raw_armap); armap_log = 0; for (i = 1; i < armap_count; i <<= 1) @@ -3586,7 +3595,7 @@ ecoff_link_add_archive_symbols (abfd, in hash = ecoff_armap_hash (h->root.string, &rehash, armap_count, armap_log); - file_offset = bfd_h_get_32 (abfd, hashtable + (hash * 8) + 4); + file_offset = H_GET_32 (abfd, hashtable + (hash * 8) + 4); if (file_offset == 0) { /* Nothing in this slot. */ @@ -3594,7 +3603,7 @@ ecoff_link_add_archive_symbols (abfd, in continue; } - name = stringbase + bfd_h_get_32 (abfd, hashtable + (hash * 8)); + name = stringbase + H_GET_32 (abfd, hashtable + (hash * 8)); if (name[0] != h->root.string[0] || strcmp (name, h->root.string) != 0) { @@ -3607,10 +3616,10 @@ ecoff_link_add_archive_symbols (abfd, in srch != hash; srch = (srch + rehash) & (armap_count - 1)) { - file_offset = bfd_h_get_32 (abfd, hashtable + (srch * 8) + 4); + file_offset = H_GET_32 (abfd, hashtable + (srch * 8) + 4); if (file_offset == 0) break; - name = stringbase + bfd_h_get_32 (abfd, hashtable + (srch * 8)); + name = stringbase + H_GET_32 (abfd, hashtable + (srch * 8)); if (name[0] == h->root.string[0] && strcmp (name, h->root.string) == 0) { @@ -3628,7 +3637,7 @@ ecoff_link_add_archive_symbols (abfd, in hash = srch; } - element = (*backend->get_elt_at_filepos) (abfd, file_offset); + element = (*backend->get_elt_at_filepos) (abfd, (file_ptr) file_offset); if (element == (bfd *) NULL) return false; @@ -3664,7 +3673,7 @@ ecoff_link_check_archive_element (abfd, HDRR *symhdr; bfd_size_type external_ext_size; PTR external_ext = NULL; - size_t esize; + bfd_size_type esize; char *ssext = NULL; char *ext_ptr; char *ext_end; @@ -3687,17 +3696,17 @@ ecoff_link_check_archive_element (abfd, if (external_ext == NULL && esize != 0) goto error_return; - if (bfd_seek (abfd, symhdr->cbExtOffset, SEEK_SET) != 0 - || bfd_read (external_ext, 1, esize, abfd) != esize) + if (bfd_seek (abfd, (file_ptr) symhdr->cbExtOffset, SEEK_SET) != 0 + || bfd_bread (external_ext, esize, abfd) != esize) goto error_return; - ssext = (char *) bfd_malloc (symhdr->issExtMax); + ssext = (char *) bfd_malloc ((bfd_size_type) symhdr->issExtMax); if (ssext == NULL && symhdr->issExtMax != 0) goto error_return; - if (bfd_seek (abfd, symhdr->cbSsExtOffset, SEEK_SET) != 0 - || (bfd_read (ssext, 1, symhdr->issExtMax, abfd) != - (bfd_size_type) symhdr->issExtMax)) + if (bfd_seek (abfd, (file_ptr) symhdr->cbSsExtOffset, SEEK_SET) != 0 + || (bfd_bread (ssext, (bfd_size_type) symhdr->issExtMax, abfd) + != (bfd_size_type) symhdr->issExtMax)) goto error_return; /* Look through the external symbols to see if they define some @@ -3787,7 +3796,7 @@ ecoff_link_add_object_symbols (abfd, inf HDRR *symhdr; bfd_size_type external_ext_size; PTR external_ext = NULL; - size_t esize; + bfd_size_type esize; char *ssext = NULL; boolean result; @@ -3807,16 +3816,16 @@ ecoff_link_add_object_symbols (abfd, inf if (external_ext == NULL && esize != 0) goto error_return; - if (bfd_seek (abfd, symhdr->cbExtOffset, SEEK_SET) != 0 - || bfd_read (external_ext, 1, esize, abfd) != esize) + if (bfd_seek (abfd, (file_ptr) symhdr->cbExtOffset, SEEK_SET) != 0 + || bfd_bread (external_ext, esize, abfd) != esize) goto error_return; - ssext = (char *) bfd_malloc (symhdr->issExtMax); + ssext = (char *) bfd_malloc ((bfd_size_type) symhdr->issExtMax); if (ssext == NULL && symhdr->issExtMax != 0) goto error_return; - if (bfd_seek (abfd, symhdr->cbSsExtOffset, SEEK_SET) != 0 - || (bfd_read (ssext, 1, symhdr->issExtMax, abfd) + if (bfd_seek (abfd, (file_ptr) symhdr->cbSsExtOffset, SEEK_SET) != 0 + || (bfd_bread (ssext, (bfd_size_type) symhdr->issExtMax, abfd) != (bfd_size_type) symhdr->issExtMax)) goto error_return; @@ -3857,12 +3866,13 @@ ecoff_link_add_externals (abfd, info, ex struct ecoff_link_hash_entry **sym_hash; char *ext_ptr; char *ext_end; + bfd_size_type amt; ext_count = ecoff_data (abfd)->debug_info.symbolic_header.iextMax; - sym_hash = ((struct ecoff_link_hash_entry **) - bfd_alloc (abfd, - ext_count * sizeof (struct bfd_link_hash_entry *))); + amt = ext_count; + amt *= sizeof (struct bfd_link_hash_entry *); + sym_hash = (struct ecoff_link_hash_entry **) bfd_alloc (abfd, amt); if (!sym_hash) return false; ecoff_data (abfd)->sym_hashes = sym_hash; @@ -3999,7 +4009,7 @@ ecoff_link_add_externals (abfd, info, ex h = NULL; if (! (_bfd_generic_link_add_one_symbol (info, abfd, name, - esym.weakext ? BSF_WEAK : BSF_GLOBAL, + (flagword) (esym.weakext ? BSF_WEAK : BSF_GLOBAL), section, value, (const char *) NULL, true, true, (struct bfd_link_hash_entry **) &h))) return false; @@ -4288,25 +4298,24 @@ ecoff_final_link_debug_accumulate (outpu HDRR *symhdr = &debug->symbolic_header; boolean ret; -#define READ(ptr, offset, count, size, type) \ - if (symhdr->count == 0) \ - debug->ptr = NULL; \ - else \ - { \ - debug->ptr = (type) bfd_malloc ((size_t) (size * symhdr->count)); \ - if (debug->ptr == NULL) \ - { \ - ret = false; \ - goto return_something; \ - } \ - if ((bfd_seek (input_bfd, (file_ptr) symhdr->offset, SEEK_SET) \ - != 0) \ - || (bfd_read (debug->ptr, size, symhdr->count, \ - input_bfd) != size * symhdr->count)) \ - { \ - ret = false; \ - goto return_something; \ - } \ +#define READ(ptr, offset, count, size, type) \ + if (symhdr->count == 0) \ + debug->ptr = NULL; \ + else \ + { \ + bfd_size_type amt = (bfd_size_type) size * symhdr->count; \ + debug->ptr = (type) bfd_malloc (amt); \ + if (debug->ptr == NULL) \ + { \ + ret = false; \ + goto return_something; \ + } \ + if (bfd_seek (input_bfd, (file_ptr) symhdr->offset, SEEK_SET) != 0 \ + || bfd_bread (debug->ptr, amt, input_bfd) != amt) \ + { \ + ret = false; \ + goto return_something; \ + } \ } /* If raw_syments is not NULL, then the data was already by read by @@ -4528,6 +4537,7 @@ ecoff_indirect_link_order (output_bfd, i bfd_size_type external_reloc_size; bfd_size_type external_relocs_size; PTR external_relocs = NULL; + bfd_size_type amt; BFD_ASSERT ((output_section->flags & SEC_HAS_CONTENTS) != 0); @@ -4549,10 +4559,9 @@ ecoff_indirect_link_order (output_bfd, i /* Get the section contents. We allocate memory for the larger of the size before relocating and the size after relocating. */ - contents = (bfd_byte *) bfd_malloc (raw_size >= cooked_size - ? (size_t) raw_size - : (size_t) cooked_size); - if (contents == NULL && raw_size != 0) + amt = raw_size >= cooked_size ? raw_size : cooked_size; + contents = (bfd_byte *) bfd_malloc (amt); + if (contents == NULL && amt != 0) goto error_return; /* If we are relaxing, the contents may have already been read into @@ -4579,12 +4588,12 @@ ecoff_indirect_link_order (output_bfd, i external_relocs = section_tdata->external_relocs; else { - external_relocs = (PTR) bfd_malloc ((size_t) external_relocs_size); + external_relocs = (PTR) bfd_malloc (external_relocs_size); if (external_relocs == NULL && external_relocs_size != 0) goto error_return; if (bfd_seek (input_bfd, input_section->rel_filepos, SEEK_SET) != 0 - || (bfd_read (external_relocs, 1, external_relocs_size, input_bfd) + || (bfd_bread (external_relocs, external_relocs_size, input_bfd) != external_relocs_size)) goto error_return; } @@ -4599,7 +4608,7 @@ ecoff_indirect_link_order (output_bfd, i if (! bfd_set_section_contents (output_bfd, output_section, (PTR) contents, - input_section->output_offset, + (file_ptr) input_section->output_offset, cooked_size)) goto error_return; @@ -4609,11 +4618,10 @@ ecoff_indirect_link_order (output_bfd, i have output so far. */ if (info->relocateable) { - if (bfd_seek (output_bfd, - (output_section->rel_filepos + - output_section->reloc_count * external_reloc_size), - SEEK_SET) != 0 - || (bfd_write (external_relocs, 1, external_relocs_size, output_bfd) + file_ptr pos = (output_section->rel_filepos + + output_section->reloc_count * external_reloc_size); + if (bfd_seek (output_bfd, pos, SEEK_SET) != 0 + || (bfd_bwrite (external_relocs, external_relocs_size, output_bfd) != external_relocs_size)) goto error_return; output_section->reloc_count += input_section->reloc_count; @@ -4653,6 +4661,7 @@ ecoff_reloc_link_order (output_bfd, info bfd_size_type external_reloc_size; bfd_byte *rbuf; boolean ok; + file_ptr pos; type = link_order->type; section = NULL; @@ -4712,13 +4721,13 @@ ecoff_reloc_link_order (output_bfd, info bfd_size_type size; bfd_reloc_status_type rstat; bfd_byte *buf; - boolean ok; size = bfd_get_reloc_size (rel.howto); buf = (bfd_byte *) bfd_zmalloc (size); if (buf == (bfd_byte *) NULL) return false; - rstat = _bfd_relocate_contents (rel.howto, output_bfd, addend, buf); + rstat = _bfd_relocate_contents (rel.howto, output_bfd, + (bfd_vma) addend, buf); switch (rstat) { case bfd_reloc_ok: @@ -4777,7 +4786,7 @@ ecoff_reloc_link_order (output_bfd, info } else { - CONST char *name; + const char *name; name = bfd_get_section_name (output_bfd, section); if (strcmp (name, ".text") == 0) @@ -4820,17 +4829,16 @@ ecoff_reloc_link_order (output_bfd, info /* Get some memory and swap out the reloc. */ external_reloc_size = ecoff_backend (output_bfd)->external_reloc_size; - rbuf = (bfd_byte *) bfd_malloc ((size_t) external_reloc_size); + rbuf = (bfd_byte *) bfd_malloc (external_reloc_size); if (rbuf == (bfd_byte *) NULL) return false; (*ecoff_backend (output_bfd)->swap_reloc_out) (output_bfd, &in, (PTR) rbuf); - ok = (bfd_seek (output_bfd, - (output_section->rel_filepos + - output_section->reloc_count * external_reloc_size), - SEEK_SET) == 0 - && (bfd_write ((PTR) rbuf, 1, external_reloc_size, output_bfd) + pos = (output_section->rel_filepos + + output_section->reloc_count * external_reloc_size); + ok = (bfd_seek (output_bfd, pos, SEEK_SET) == 0 + && (bfd_bwrite ((PTR) rbuf, external_reloc_size, output_bfd) == external_reloc_size)); if (ok) diff -uprN binutils-2.11.90.0.31/bfd/ecofflink.c binutils-2.11.92.0.5/bfd/ecofflink.c --- binutils-2.11.90.0.31/bfd/ecofflink.c Fri Mar 9 11:15:45 2001 +++ binutils-2.11.92.0.5/bfd/ecofflink.c Mon Oct 1 15:25:21 2001 @@ -1,5 +1,5 @@ /* Routines to link ECOFF debugging information. - Copyright 1993, 1994, 1995, 1996, 1997, 2000 + Copyright 1993, 1994, 1995, 1996, 1997, 2000, 2001 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support, . @@ -272,7 +272,7 @@ ecoff_add_bytes (buf, bufend, need) if (want < ALLOC_SIZE) want = ALLOC_SIZE; } - newbuf = (char *) bfd_realloc (*buf, have + want); + newbuf = (char *) bfd_realloc (*buf, (bfd_size_type) have + want); if (newbuf == NULL) return false; *buf = newbuf; @@ -497,8 +497,9 @@ bfd_ecoff_debug_init (output_bfd, output struct bfd_link_info *info; { struct accumulate *ainfo; + bfd_size_type amt = sizeof (struct accumulate); - ainfo = (struct accumulate *) bfd_malloc (sizeof (struct accumulate)); + ainfo = (struct accumulate *) bfd_malloc (amt); if (!ainfo) return NULL; if (! bfd_hash_table_init_n (&ainfo->fdr_hash.table, string_hash_newfunc, @@ -621,6 +622,7 @@ bfd_ecoff_debug_accumulate (handle, outp long newrfdbase = 0; long oldrfdbase = 0; bfd_byte *fdr_out; + bfd_size_type amt; /* Use section_adjust to hold the value to add to a symbol in a particular section. */ @@ -661,9 +663,9 @@ bfd_ecoff_debug_accumulate (handle, outp } fdr_end = fdr_start + input_symhdr->ifdMax * fdr_add; - input_debug->ifdmap = (RFDT *) bfd_alloc (input_bfd, - (input_symhdr->ifdMax - * sizeof (RFDT))); + amt = input_symhdr->ifdMax; + amt *= sizeof (RFDT); + input_debug->ifdmap = (RFDT *) bfd_alloc (input_bfd, amt); sz = (input_symhdr->crfd + input_symhdr->ifdMax) * external_rfd_size; rfd_out = (bfd_byte *) objalloc_alloc (ainfo->memory, sz); @@ -712,7 +714,7 @@ bfd_ecoff_debug_accumulate (handle, outp merged. */ name = input_debug->ss + fdr.issBase + fdr.rss; - lookup = (char *) bfd_malloc (strlen (name) + 20); + lookup = (char *) bfd_malloc ((bfd_size_type) strlen (name) + 20); if (lookup == NULL) return false; sprintf (lookup, "%s %lx %lx", name, fdr.csym, fdr.caux); @@ -937,10 +939,9 @@ bfd_ecoff_debug_accumulate (handle, outp stabs are adjusted correctly. */ if (fdr.cbLine > 0) { + file_ptr pos = input_symhdr->cbLineOffset + fdr.cbLineOffset; if (!add_file_shuffle (ainfo, &ainfo->line, &ainfo->line_end, - input_bfd, - input_symhdr->cbLineOffset + fdr.cbLineOffset, - fdr.cbLine)) + input_bfd, pos, (unsigned long) fdr.cbLine)) return false; fdr.ilineBase = output_symhdr->ilineMax; fdr.cbLineOffset = output_symhdr->cbLine; @@ -949,10 +950,10 @@ bfd_ecoff_debug_accumulate (handle, outp } if (fdr.caux > 0) { + file_ptr pos = (input_symhdr->cbAuxOffset + + fdr.iauxBase * sizeof (union aux_ext)); if (!add_file_shuffle (ainfo, &ainfo->aux, &ainfo->aux_end, - input_bfd, - (input_symhdr->cbAuxOffset - + fdr.iauxBase * sizeof (union aux_ext)), + input_bfd, pos, fdr.caux * sizeof (union aux_ext))) return false; fdr.iauxBase = output_symhdr->iauxMax; @@ -970,10 +971,9 @@ bfd_ecoff_debug_accumulate (handle, outp } else if (fdr.cbSs > 0) { + file_ptr pos = input_symhdr->cbSsOffset + fdr.issBase; if (!add_file_shuffle (ainfo, &ainfo->ss, &ainfo->ss_end, - input_bfd, - input_symhdr->cbSsOffset + fdr.issBase, - fdr.cbSs)) + input_bfd, pos, (unsigned long) fdr.cbSs)) return false; fdr.issBase = output_symhdr->issMax; output_symhdr->issMax += fdr.cbSs; @@ -989,21 +989,21 @@ bfd_ecoff_debug_accumulate (handle, outp BFD_ASSERT (external_pdr_size == input_swap->external_pdr_size); if (fdr.cpd > 0) { + file_ptr pos = (input_symhdr->cbPdOffset + + fdr.ipdFirst * external_pdr_size); + unsigned long size = fdr.cpd * external_pdr_size; if (!add_file_shuffle (ainfo, &ainfo->pdr, &ainfo->pdr_end, - input_bfd, - (input_symhdr->cbPdOffset - + fdr.ipdFirst * external_pdr_size), - fdr.cpd * external_pdr_size)) + input_bfd, pos, size)) return false; } BFD_ASSERT (external_opt_size == input_swap->external_opt_size); if (fdr.copt > 0) { + file_ptr pos = (input_symhdr->cbOptOffset + + fdr.ioptBase * external_opt_size); + unsigned long size = fdr.copt * external_opt_size; if (!add_file_shuffle (ainfo, &ainfo->opt, &ainfo->opt_end, - input_bfd, - (input_symhdr->cbOptOffset - + fdr.ioptBase * external_opt_size), - fdr.copt * external_opt_size)) + input_bfd, pos, size)) return false; } } @@ -1201,7 +1201,7 @@ bfd_ecoff_debug_accumulate_other (handle fdr.issBase = output_symhdr->issMax; fdr.cbSs = 0; fdr.rss = ecoff_add_string (ainfo, info, output_debug, &fdr, - bfd_get_filename (input_bfd)); + bfd_archive_filename (input_bfd)); if (fdr.rss == -1) return false; fdr.isymBase = output_symhdr->isymMax; @@ -1210,7 +1210,7 @@ bfd_ecoff_debug_accumulate_other (handle symsize = bfd_get_symtab_upper_bound (input_bfd); if (symsize < 0) return false; - symbols = (asymbol **) bfd_alloc (output_bfd, symsize); + symbols = (asymbol **) bfd_alloc (output_bfd, (bfd_size_type) symsize); if (symbols == (asymbol **) NULL) return false; symcount = bfd_canonicalize_symtab (input_bfd, symbols); @@ -1254,7 +1254,8 @@ bfd_ecoff_debug_accumulate_other (handle } (*swap_sym_out) (output_bfd, &internal_sym, external_sym); add_memory_shuffle (ainfo, &ainfo->sym, &ainfo->sym_end, - external_sym, output_swap->external_sym_size); + external_sym, + (unsigned long) output_swap->external_sym_size); ++fdr.csym; ++output_symhdr->isymMax; } @@ -1274,7 +1275,8 @@ bfd_ecoff_debug_accumulate_other (handle } (*output_swap->swap_fdr_out) (output_bfd, &fdr, external_fdr); add_memory_shuffle (ainfo, &ainfo->fdr, &ainfo->fdr_end, - external_fdr, output_swap->external_fdr_size); + external_fdr, + (unsigned long) output_swap->external_fdr_size); ++output_symhdr->ifdMax; @@ -1386,7 +1388,7 @@ bfd_ecoff_debug_one_external (abfd, debu { if (ecoff_add_bytes ((char **) &debug->external_ext, (char **) &debug->external_ext_end, - (symhdr->iextMax + 1) * external_ext_size) + (symhdr->iextMax + 1) * (size_t) external_ext_size) == false) return false; } @@ -1546,12 +1548,12 @@ ecoff_write_symhdr (abfd, debug, swap, w SET (cbExtOffset, iextMax, swap->external_ext_size); #undef SET - buff = (PTR) bfd_malloc ((size_t) swap->external_hdr_size); + buff = (PTR) bfd_malloc (swap->external_hdr_size); if (buff == NULL && swap->external_hdr_size != 0) goto error_return; (*swap->swap_hdr_out) (abfd, symhdr, buff); - if (bfd_write (buff, 1, swap->external_hdr_size, abfd) + if (bfd_bwrite (buff, swap->external_hdr_size, abfd) != swap->external_hdr_size) goto error_return; @@ -1585,7 +1587,7 @@ bfd_ecoff_write_debug (abfd, debug, swap #define WRITE(ptr, count, size, offset) \ BFD_ASSERT (symhdr->offset == 0 \ || (bfd_vma) bfd_tell (abfd) == symhdr->offset); \ - if (bfd_write ((PTR) debug->ptr, size, symhdr->count, abfd) \ + if (bfd_bwrite ((PTR) debug->ptr, (bfd_size_type) size * symhdr->count, abfd)\ != size * symhdr->count) \ return false; @@ -1594,7 +1596,8 @@ bfd_ecoff_write_debug (abfd, debug, swap WRITE (external_pdr, ipdMax, swap->external_pdr_size, cbPdOffset); WRITE (external_sym, isymMax, swap->external_sym_size, cbSymOffset); WRITE (external_opt, ioptMax, swap->external_opt_size, cbOptOffset); - WRITE (external_aux, iauxMax, sizeof (union aux_ext), cbAuxOffset); + WRITE (external_aux, iauxMax, (bfd_size_type) sizeof (union aux_ext), + cbAuxOffset); WRITE (ss, issMax, sizeof (char), cbSsOffset); WRITE (ssext, issExtMax, sizeof (char), cbSsExtOffset); WRITE (external_fdr, ifdMax, swap->external_fdr_size, cbFdOffset); @@ -1626,14 +1629,16 @@ ecoff_write_shuffle (abfd, swap, shuffle { if (! l->filep) { - if (bfd_write (l->u.memory, 1, l->size, abfd) != l->size) + if (bfd_bwrite (l->u.memory, (bfd_size_type) l->size, abfd) + != l->size) return false; } else { if (bfd_seek (l->u.file.input_bfd, l->u.file.offset, SEEK_SET) != 0 - || bfd_read (space, 1, l->size, l->u.file.input_bfd) != l->size - || bfd_write (space, 1, l->size, abfd) != l->size) + || bfd_bread (space, (bfd_size_type) l->size, + l->u.file.input_bfd) != l->size + || bfd_bwrite (space, (bfd_size_type) l->size, abfd) != l->size) return false; } total += l->size; @@ -1645,12 +1650,12 @@ ecoff_write_shuffle (abfd, swap, shuffle bfd_byte *s; i = swap->debug_align - (total & (swap->debug_align - 1)); - s = (bfd_byte *) bfd_malloc (i); + s = (bfd_byte *) bfd_malloc ((bfd_size_type) i); if (s == NULL && i != 0) return false; memset ((PTR) s, 0, i); - if (bfd_write ((PTR) s, 1, i, abfd) != i) + if (bfd_bwrite ((PTR) s, (bfd_size_type) i, abfd) != i) { free (s); return false; @@ -1675,11 +1680,13 @@ bfd_ecoff_write_accumulated_debug (handl { struct accumulate *ainfo = (struct accumulate *) handle; PTR space = NULL; + bfd_size_type amt; if (! ecoff_write_symhdr (abfd, debug, swap, where)) goto error_return; - space = (PTR) bfd_malloc (ainfo->largest_file_shuffle); + amt = ainfo->largest_file_shuffle; + space = (PTR) bfd_malloc (amt); if (space == NULL && ainfo->largest_file_shuffle != 0) goto error_return; @@ -1706,7 +1713,7 @@ bfd_ecoff_write_accumulated_debug (handl BFD_ASSERT (ainfo->ss == (struct shuffle *) NULL); null = 0; - if (bfd_write ((PTR) &null, 1, 1, abfd) != 1) + if (bfd_bwrite ((PTR) &null, (bfd_size_type) 1, abfd) != 1) goto error_return; total = 1; BFD_ASSERT (ainfo->ss_hash == NULL || ainfo->ss_hash->val == 1); @@ -1717,7 +1724,8 @@ bfd_ecoff_write_accumulated_debug (handl size_t len; len = strlen (sh->root.string); - if (bfd_write ((PTR) sh->root.string, 1, len + 1, abfd) != len + 1) + amt = len + 1; + if (bfd_bwrite ((PTR) sh->root.string, amt, abfd) != amt) goto error_return; total += len + 1; } @@ -1728,11 +1736,11 @@ bfd_ecoff_write_accumulated_debug (handl bfd_byte *s; i = swap->debug_align - (total & (swap->debug_align - 1)); - s = (bfd_byte *) bfd_malloc (i); + s = (bfd_byte *) bfd_malloc ((bfd_size_type) i); if (s == NULL && i != 0) goto error_return; memset ((PTR) s, 0, i); - if (bfd_write ((PTR) s, 1, i, abfd) != i) + if (bfd_bwrite ((PTR) s, (bfd_size_type) i, abfd) != i) { free (s); goto error_return; @@ -1743,8 +1751,8 @@ bfd_ecoff_write_accumulated_debug (handl /* The external strings and symbol are not converted over to using shuffles. FIXME: They probably should be. */ - if (bfd_write (debug->ssext, 1, debug->symbolic_header.issExtMax, abfd) - != (bfd_size_type) debug->symbolic_header.issExtMax) + amt = debug->symbolic_header.issExtMax; + if (bfd_bwrite (debug->ssext, amt, abfd) != amt) goto error_return; if ((debug->symbolic_header.issExtMax & (swap->debug_align - 1)) != 0) { @@ -1753,11 +1761,11 @@ bfd_ecoff_write_accumulated_debug (handl i = (swap->debug_align - (debug->symbolic_header.issExtMax & (swap->debug_align - 1))); - s = (bfd_byte *) bfd_malloc (i); + s = (bfd_byte *) bfd_malloc ((bfd_size_type) i); if (s == NULL && i != 0) goto error_return; memset ((PTR) s, 0, i); - if (bfd_write ((PTR) s, 1, i, abfd) != i) + if (bfd_bwrite ((PTR) s, (bfd_size_type) i, abfd) != i) { free (s); goto error_return; @@ -1773,9 +1781,8 @@ bfd_ecoff_write_accumulated_debug (handl || (debug->symbolic_header.cbExtOffset == (bfd_vma) bfd_tell (abfd))); - if (bfd_write (debug->external_ext, swap->external_ext_size, - debug->symbolic_header.iextMax, abfd) - != debug->symbolic_header.iextMax * swap->external_ext_size) + amt = debug->symbolic_header.iextMax * swap->external_ext_size; + if (bfd_bwrite (debug->external_ext, amt, abfd) != amt) goto error_return; if (space != NULL) @@ -1829,6 +1836,7 @@ mk_fdrtab (abfd, debug_info, debug_swap, FDR *fdr_end; boolean stabs; long len; + bfd_size_type amt; fdr_start = debug_info->fdr; fdr_end = fdr_start + debug_info->symbolic_header.ifdMax; @@ -1843,9 +1851,8 @@ mk_fdrtab (abfd, debug_info, debug_swap, /* Now, create and fill in the table: */ - line_info->fdrtab = ((struct ecoff_fdrtab_entry*) - bfd_zalloc (abfd, - len * sizeof (struct ecoff_fdrtab_entry))); + amt = (bfd_size_type) len * sizeof (struct ecoff_fdrtab_entry); + line_info->fdrtab = (struct ecoff_fdrtab_entry*) bfd_zalloc (abfd, amt); if (line_info->fdrtab == NULL) return false; line_info->fdrtab_len = len; @@ -1902,7 +1909,7 @@ mk_fdrtab (abfd, debug_info, debug_swap, The table is mostly sorted already, but there are cases (e.g., static functions in include files), where this does not hold. Use "odump -PFv" to verify... */ - qsort ((PTR) line_info->fdrtab, len, + qsort ((PTR) line_info->fdrtab, (size_t) len, sizeof (struct ecoff_fdrtab_entry), cmp_fdrtab_entry); return true; @@ -2004,7 +2011,7 @@ lookup_line (abfd, debug_info, debug_swa char *pdr_ptr; char *best_pdr = NULL; FDR *best_fdr; - bfd_vma best_dist = ~0; + bfd_vma best_dist = ~(bfd_vma) 0; PDR pdr; unsigned char *line_ptr; unsigned char *line_end; @@ -2330,7 +2337,7 @@ lookup_line (abfd, debug_info, debug_swa { if (line_info->find_buffer != NULL) free (line_info->find_buffer); - buffer = (char *) bfd_malloc (len); + buffer = (char *) bfd_malloc ((bfd_size_type) len); if (buffer == NULL) return false; line_info->find_buffer = buffer; @@ -2429,7 +2436,8 @@ ecoff_collect_shuffle (l, buff) else { if (bfd_seek (l->u.file.input_bfd, l->u.file.offset, SEEK_SET) != 0 - || bfd_read (buff, 1, l->size, l->u.file.input_bfd) != l->size) + || (bfd_bread (buff, (bfd_size_type) l->size, l->u.file.input_bfd) + != l->size)) return false; } total += l->size; diff -uprN binutils-2.11.90.0.31/bfd/ecoffswap.h binutils-2.11.92.0.5/bfd/ecoffswap.h --- binutils-2.11.90.0.31/bfd/ecoffswap.h Sat May 12 00:05:18 2001 +++ binutils-2.11.92.0.5/bfd/ecoffswap.h Mon Oct 1 15:25:21 2001 @@ -45,20 +45,20 @@ Foundation, Inc., 59 Temple Place - Suit with the proper byte sex and such. */ #ifdef ECOFF_32 -#define ecoff_get_off bfd_h_get_32 -#define ecoff_put_off bfd_h_put_32 +#define ECOFF_GET_OFF H_GET_32 +#define ECOFF_PUT_OFF H_PUT_32 #endif #ifdef ECOFF_64 -#define ecoff_get_off bfd_h_get_64 -#define ecoff_put_off bfd_h_put_64 +#define ECOFF_GET_OFF H_GET_64 +#define ECOFF_PUT_OFF H_PUT_64 #endif #ifdef ECOFF_SIGNED_32 -#define ecoff_get_off bfd_h_get_signed_32 -#define ecoff_put_off bfd_h_put_signed_32 +#define ECOFF_GET_OFF H_GET_S32 +#define ECOFF_PUT_OFF H_PUT_S32 #endif #ifdef ECOFF_SIGNED_64 -#define ecoff_get_off bfd_h_get_signed_64 -#define ecoff_put_off bfd_h_put_signed_64 +#define ECOFF_GET_OFF H_GET_S64 +#define ECOFF_PUT_OFF H_PUT_S64 #endif /* ECOFF auxiliary information swapping routines. These are the same @@ -104,31 +104,31 @@ ecoff_swap_hdr_in (abfd, ext_copy, inter *ext = *(struct hdr_ext *) ext_copy; - intern->magic = bfd_h_get_signed_16 (abfd, (bfd_byte *)ext->h_magic); - intern->vstamp = bfd_h_get_signed_16 (abfd, (bfd_byte *)ext->h_vstamp); - intern->ilineMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_ilineMax); - intern->cbLine = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbLine); - intern->cbLineOffset = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbLineOffset); - intern->idnMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_idnMax); - intern->cbDnOffset = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbDnOffset); - intern->ipdMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_ipdMax); - intern->cbPdOffset = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbPdOffset); - intern->isymMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_isymMax); - intern->cbSymOffset = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbSymOffset); - intern->ioptMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_ioptMax); - intern->cbOptOffset = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbOptOffset); - intern->iauxMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_iauxMax); - intern->cbAuxOffset = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbAuxOffset); - intern->issMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_issMax); - intern->cbSsOffset = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbSsOffset); - intern->issExtMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_issExtMax); - intern->cbSsExtOffset = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbSsExtOffset); - intern->ifdMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_ifdMax); - intern->cbFdOffset = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbFdOffset); - intern->crfd = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_crfd); - intern->cbRfdOffset = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbRfdOffset); - intern->iextMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_iextMax); - intern->cbExtOffset = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbExtOffset); + intern->magic = H_GET_S16 (abfd, ext->h_magic); + intern->vstamp = H_GET_S16 (abfd, ext->h_vstamp); + intern->ilineMax = H_GET_32 (abfd, ext->h_ilineMax); + intern->cbLine = ECOFF_GET_OFF (abfd, ext->h_cbLine); + intern->cbLineOffset = ECOFF_GET_OFF (abfd, ext->h_cbLineOffset); + intern->idnMax = H_GET_32 (abfd, ext->h_idnMax); + intern->cbDnOffset = ECOFF_GET_OFF (abfd, ext->h_cbDnOffset); + intern->ipdMax = H_GET_32 (abfd, ext->h_ipdMax); + intern->cbPdOffset = ECOFF_GET_OFF (abfd, ext->h_cbPdOffset); + intern->isymMax = H_GET_32 (abfd, ext->h_isymMax); + intern->cbSymOffset = ECOFF_GET_OFF (abfd, ext->h_cbSymOffset); + intern->ioptMax = H_GET_32 (abfd, ext->h_ioptMax); + intern->cbOptOffset = ECOFF_GET_OFF (abfd, ext->h_cbOptOffset); + intern->iauxMax = H_GET_32 (abfd, ext->h_iauxMax); + intern->cbAuxOffset = ECOFF_GET_OFF (abfd, ext->h_cbAuxOffset); + intern->issMax = H_GET_32 (abfd, ext->h_issMax); + intern->cbSsOffset = ECOFF_GET_OFF (abfd, ext->h_cbSsOffset); + intern->issExtMax = H_GET_32 (abfd, ext->h_issExtMax); + intern->cbSsExtOffset = ECOFF_GET_OFF (abfd, ext->h_cbSsExtOffset); + intern->ifdMax = H_GET_32 (abfd, ext->h_ifdMax); + intern->cbFdOffset = ECOFF_GET_OFF (abfd, ext->h_cbFdOffset); + intern->crfd = H_GET_32 (abfd, ext->h_crfd); + intern->cbRfdOffset = ECOFF_GET_OFF (abfd, ext->h_cbRfdOffset); + intern->iextMax = H_GET_32 (abfd, ext->h_iextMax); + intern->cbExtOffset = ECOFF_GET_OFF (abfd, ext->h_cbExtOffset); #ifdef TEST if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) @@ -149,34 +149,34 @@ ecoff_swap_hdr_out (abfd, intern_copy, e *intern = *intern_copy; - bfd_h_put_signed_16 (abfd, intern->magic, (bfd_byte *)ext->h_magic); - bfd_h_put_signed_16 (abfd, intern->vstamp, (bfd_byte *)ext->h_vstamp); - bfd_h_put_32 (abfd, intern->ilineMax, (bfd_byte *)ext->h_ilineMax); - ecoff_put_off (abfd, intern->cbLine, (bfd_byte *)ext->h_cbLine); - ecoff_put_off (abfd, intern->cbLineOffset, (bfd_byte *)ext->h_cbLineOffset); - bfd_h_put_32 (abfd, intern->idnMax, (bfd_byte *)ext->h_idnMax); - ecoff_put_off (abfd, intern->cbDnOffset, (bfd_byte *)ext->h_cbDnOffset); - bfd_h_put_32 (abfd, intern->ipdMax, (bfd_byte *)ext->h_ipdMax); - ecoff_put_off (abfd, intern->cbPdOffset, (bfd_byte *)ext->h_cbPdOffset); - bfd_h_put_32 (abfd, intern->isymMax, (bfd_byte *)ext->h_isymMax); - ecoff_put_off (abfd, intern->cbSymOffset, (bfd_byte *)ext->h_cbSymOffset); - bfd_h_put_32 (abfd, intern->ioptMax, (bfd_byte *)ext->h_ioptMax); - ecoff_put_off (abfd, intern->cbOptOffset, (bfd_byte *)ext->h_cbOptOffset); - bfd_h_put_32 (abfd, intern->iauxMax, (bfd_byte *)ext->h_iauxMax); - ecoff_put_off (abfd, intern->cbAuxOffset, (bfd_byte *)ext->h_cbAuxOffset); - bfd_h_put_32 (abfd, intern->issMax, (bfd_byte *)ext->h_issMax); - ecoff_put_off (abfd, intern->cbSsOffset, (bfd_byte *)ext->h_cbSsOffset); - bfd_h_put_32 (abfd, intern->issExtMax, (bfd_byte *)ext->h_issExtMax); - ecoff_put_off (abfd, intern->cbSsExtOffset, (bfd_byte *)ext->h_cbSsExtOffset); - bfd_h_put_32 (abfd, intern->ifdMax, (bfd_byte *)ext->h_ifdMax); - ecoff_put_off (abfd, intern->cbFdOffset, (bfd_byte *)ext->h_cbFdOffset); - bfd_h_put_32 (abfd, intern->crfd, (bfd_byte *)ext->h_crfd); - ecoff_put_off (abfd, intern->cbRfdOffset, (bfd_byte *)ext->h_cbRfdOffset); - bfd_h_put_32 (abfd, intern->iextMax, (bfd_byte *)ext->h_iextMax); - ecoff_put_off (abfd, intern->cbExtOffset, (bfd_byte *)ext->h_cbExtOffset); + H_PUT_S16 (abfd, intern->magic, ext->h_magic); + H_PUT_S16 (abfd, intern->vstamp, ext->h_vstamp); + H_PUT_32 (abfd, intern->ilineMax, ext->h_ilineMax); + ECOFF_PUT_OFF (abfd, intern->cbLine, ext->h_cbLine); + ECOFF_PUT_OFF (abfd, intern->cbLineOffset, ext->h_cbLineOffset); + H_PUT_32 (abfd, intern->idnMax, ext->h_idnMax); + ECOFF_PUT_OFF (abfd, intern->cbDnOffset, ext->h_cbDnOffset); + H_PUT_32 (abfd, intern->ipdMax, ext->h_ipdMax); + ECOFF_PUT_OFF (abfd, intern->cbPdOffset, ext->h_cbPdOffset); + H_PUT_32 (abfd, intern->isymMax, ext->h_isymMax); + ECOFF_PUT_OFF (abfd, intern->cbSymOffset, ext->h_cbSymOffset); + H_PUT_32 (abfd, intern->ioptMax, ext->h_ioptMax); + ECOFF_PUT_OFF (abfd, intern->cbOptOffset, ext->h_cbOptOffset); + H_PUT_32 (abfd, intern->iauxMax, ext->h_iauxMax); + ECOFF_PUT_OFF (abfd, intern->cbAuxOffset, ext->h_cbAuxOffset); + H_PUT_32 (abfd, intern->issMax, ext->h_issMax); + ECOFF_PUT_OFF (abfd, intern->cbSsOffset, ext->h_cbSsOffset); + H_PUT_32 (abfd, intern->issExtMax, ext->h_issExtMax); + ECOFF_PUT_OFF (abfd, intern->cbSsExtOffset, ext->h_cbSsExtOffset); + H_PUT_32 (abfd, intern->ifdMax, ext->h_ifdMax); + ECOFF_PUT_OFF (abfd, intern->cbFdOffset, ext->h_cbFdOffset); + H_PUT_32 (abfd, intern->crfd, ext->h_crfd); + ECOFF_PUT_OFF (abfd, intern->cbRfdOffset, ext->h_cbRfdOffset); + H_PUT_32 (abfd, intern->iextMax, ext->h_iextMax); + ECOFF_PUT_OFF (abfd, intern->cbExtOffset, ext->h_cbExtOffset); #ifdef TEST - if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) + if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0) abort (); #endif } @@ -193,55 +193,58 @@ ecoff_swap_fdr_in (abfd, ext_copy, inter *ext = *(struct fdr_ext *) ext_copy; - intern->adr = ecoff_get_off (abfd, (bfd_byte *)ext->f_adr); - intern->rss = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_rss); + intern->adr = ECOFF_GET_OFF (abfd, ext->f_adr); + intern->rss = H_GET_32 (abfd, ext->f_rss); #if defined (ECOFF_64) || defined (ECOFF_SIGNED_64) if (intern->rss == (signed long) 0xffffffff) intern->rss = -1; #endif - intern->issBase = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_issBase); - intern->cbSs = ecoff_get_off (abfd, (bfd_byte *)ext->f_cbSs); - intern->isymBase = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_isymBase); - intern->csym = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_csym); - intern->ilineBase = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_ilineBase); - intern->cline = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_cline); - intern->ioptBase = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_ioptBase); - intern->copt = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_copt); + intern->issBase = H_GET_32 (abfd, ext->f_issBase); + intern->cbSs = ECOFF_GET_OFF (abfd, ext->f_cbSs); + intern->isymBase = H_GET_32 (abfd, ext->f_isymBase); + intern->csym = H_GET_32 (abfd, ext->f_csym); + intern->ilineBase = H_GET_32 (abfd, ext->f_ilineBase); + intern->cline = H_GET_32 (abfd, ext->f_cline); + intern->ioptBase = H_GET_32 (abfd, ext->f_ioptBase); + intern->copt = H_GET_32 (abfd, ext->f_copt); #if defined (ECOFF_32) || defined (ECOFF_SIGNED_32) - intern->ipdFirst = bfd_h_get_16 (abfd, (bfd_byte *)ext->f_ipdFirst); - intern->cpd = bfd_h_get_16 (abfd, (bfd_byte *)ext->f_cpd); + intern->ipdFirst = H_GET_16 (abfd, ext->f_ipdFirst); + intern->cpd = H_GET_16 (abfd, ext->f_cpd); #endif #if defined (ECOFF_64) || defined (ECOFF_SIGNED_64) - intern->ipdFirst = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_ipdFirst); - intern->cpd = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_cpd); + intern->ipdFirst = H_GET_32 (abfd, ext->f_ipdFirst); + intern->cpd = H_GET_32 (abfd, ext->f_cpd); #endif - intern->iauxBase = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_iauxBase); - intern->caux = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_caux); - intern->rfdBase = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_rfdBase); - intern->crfd = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_crfd); + intern->iauxBase = H_GET_32 (abfd, ext->f_iauxBase); + intern->caux = H_GET_32 (abfd, ext->f_caux); + intern->rfdBase = H_GET_32 (abfd, ext->f_rfdBase); + intern->crfd = H_GET_32 (abfd, ext->f_crfd); /* now the fun stuff... */ - if (bfd_header_big_endian (abfd)) { - intern->lang = (ext->f_bits1[0] & FDR_BITS1_LANG_BIG) - >> FDR_BITS1_LANG_SH_BIG; - intern->fMerge = 0 != (ext->f_bits1[0] & FDR_BITS1_FMERGE_BIG); - intern->fReadin = 0 != (ext->f_bits1[0] & FDR_BITS1_FREADIN_BIG); - intern->fBigendian = 0 != (ext->f_bits1[0] & FDR_BITS1_FBIGENDIAN_BIG); - intern->glevel = (ext->f_bits2[0] & FDR_BITS2_GLEVEL_BIG) - >> FDR_BITS2_GLEVEL_SH_BIG; - } else { - intern->lang = (ext->f_bits1[0] & FDR_BITS1_LANG_LITTLE) - >> FDR_BITS1_LANG_SH_LITTLE; - intern->fMerge = 0 != (ext->f_bits1[0] & FDR_BITS1_FMERGE_LITTLE); - intern->fReadin = 0 != (ext->f_bits1[0] & FDR_BITS1_FREADIN_LITTLE); - intern->fBigendian = 0 != (ext->f_bits1[0] & FDR_BITS1_FBIGENDIAN_LITTLE); - intern->glevel = (ext->f_bits2[0] & FDR_BITS2_GLEVEL_LITTLE) - >> FDR_BITS2_GLEVEL_SH_LITTLE; - } + if (bfd_header_big_endian (abfd)) + { + intern->lang = ((ext->f_bits1[0] & FDR_BITS1_LANG_BIG) + >> FDR_BITS1_LANG_SH_BIG); + intern->fMerge = 0 != (ext->f_bits1[0] & FDR_BITS1_FMERGE_BIG); + intern->fReadin = 0 != (ext->f_bits1[0] & FDR_BITS1_FREADIN_BIG); + intern->fBigendian = 0 != (ext->f_bits1[0] & FDR_BITS1_FBIGENDIAN_BIG); + intern->glevel = ((ext->f_bits2[0] & FDR_BITS2_GLEVEL_BIG) + >> FDR_BITS2_GLEVEL_SH_BIG); + } + else + { + intern->lang = ((ext->f_bits1[0] & FDR_BITS1_LANG_LITTLE) + >> FDR_BITS1_LANG_SH_LITTLE); + intern->fMerge = 0 != (ext->f_bits1[0] & FDR_BITS1_FMERGE_LITTLE); + intern->fReadin = 0 != (ext->f_bits1[0] & FDR_BITS1_FREADIN_LITTLE); + intern->fBigendian = 0 != (ext->f_bits1[0] & FDR_BITS1_FBIGENDIAN_LITTLE); + intern->glevel = ((ext->f_bits2[0] & FDR_BITS2_GLEVEL_LITTLE) + >> FDR_BITS2_GLEVEL_SH_LITTLE); + } intern->reserved = 0; - intern->cbLineOffset = ecoff_get_off (abfd, (bfd_byte *)ext->f_cbLineOffset); - intern->cbLine = ecoff_get_off (abfd, (bfd_byte *)ext->f_cbLine); + intern->cbLineOffset = ECOFF_GET_OFF (abfd, ext->f_cbLineOffset); + intern->cbLine = ECOFF_GET_OFF (abfd, ext->f_cbLine); #ifdef TEST if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) @@ -262,54 +265,57 @@ ecoff_swap_fdr_out (abfd, intern_copy, e *intern = *intern_copy; /* Make it reasonable to do in-place. */ - ecoff_put_off (abfd, intern->adr, (bfd_byte *)ext->f_adr); - bfd_h_put_32 (abfd, intern->rss, (bfd_byte *)ext->f_rss); - bfd_h_put_32 (abfd, intern->issBase, (bfd_byte *)ext->f_issBase); - ecoff_put_off (abfd, intern->cbSs, (bfd_byte *)ext->f_cbSs); - bfd_h_put_32 (abfd, intern->isymBase, (bfd_byte *)ext->f_isymBase); - bfd_h_put_32 (abfd, intern->csym, (bfd_byte *)ext->f_csym); - bfd_h_put_32 (abfd, intern->ilineBase, (bfd_byte *)ext->f_ilineBase); - bfd_h_put_32 (abfd, intern->cline, (bfd_byte *)ext->f_cline); - bfd_h_put_32 (abfd, intern->ioptBase, (bfd_byte *)ext->f_ioptBase); - bfd_h_put_32 (abfd, intern->copt, (bfd_byte *)ext->f_copt); + ECOFF_PUT_OFF (abfd, intern->adr, ext->f_adr); + H_PUT_32 (abfd, intern->rss, ext->f_rss); + H_PUT_32 (abfd, intern->issBase, ext->f_issBase); + ECOFF_PUT_OFF (abfd, intern->cbSs, ext->f_cbSs); + H_PUT_32 (abfd, intern->isymBase, ext->f_isymBase); + H_PUT_32 (abfd, intern->csym, ext->f_csym); + H_PUT_32 (abfd, intern->ilineBase, ext->f_ilineBase); + H_PUT_32 (abfd, intern->cline, ext->f_cline); + H_PUT_32 (abfd, intern->ioptBase, ext->f_ioptBase); + H_PUT_32 (abfd, intern->copt, ext->f_copt); #if defined (ECOFF_32) || defined (ECOFF_SIGNED_32) - bfd_h_put_16 (abfd, intern->ipdFirst, (bfd_byte *)ext->f_ipdFirst); - bfd_h_put_16 (abfd, intern->cpd, (bfd_byte *)ext->f_cpd); + H_PUT_16 (abfd, intern->ipdFirst, ext->f_ipdFirst); + H_PUT_16 (abfd, intern->cpd, ext->f_cpd); #endif #if defined (ECOFF_64) || defined (ECOFF_SIGNED_64) - bfd_h_put_32 (abfd, intern->ipdFirst, (bfd_byte *)ext->f_ipdFirst); - bfd_h_put_32 (abfd, intern->cpd, (bfd_byte *)ext->f_cpd); + H_PUT_32 (abfd, intern->ipdFirst, ext->f_ipdFirst); + H_PUT_32 (abfd, intern->cpd, ext->f_cpd); #endif - bfd_h_put_32 (abfd, intern->iauxBase, (bfd_byte *)ext->f_iauxBase); - bfd_h_put_32 (abfd, intern->caux, (bfd_byte *)ext->f_caux); - bfd_h_put_32 (abfd, intern->rfdBase, (bfd_byte *)ext->f_rfdBase); - bfd_h_put_32 (abfd, intern->crfd, (bfd_byte *)ext->f_crfd); + H_PUT_32 (abfd, intern->iauxBase, ext->f_iauxBase); + H_PUT_32 (abfd, intern->caux, ext->f_caux); + H_PUT_32 (abfd, intern->rfdBase, ext->f_rfdBase); + H_PUT_32 (abfd, intern->crfd, ext->f_crfd); /* now the fun stuff... */ - if (bfd_header_big_endian (abfd)) { - ext->f_bits1[0] = (((intern->lang << FDR_BITS1_LANG_SH_BIG) - & FDR_BITS1_LANG_BIG) - | (intern->fMerge ? FDR_BITS1_FMERGE_BIG : 0) - | (intern->fReadin ? FDR_BITS1_FREADIN_BIG : 0) - | (intern->fBigendian ? FDR_BITS1_FBIGENDIAN_BIG : 0)); - ext->f_bits2[0] = ((intern->glevel << FDR_BITS2_GLEVEL_SH_BIG) - & FDR_BITS2_GLEVEL_BIG); - ext->f_bits2[1] = 0; - ext->f_bits2[2] = 0; - } else { - ext->f_bits1[0] = (((intern->lang << FDR_BITS1_LANG_SH_LITTLE) - & FDR_BITS1_LANG_LITTLE) - | (intern->fMerge ? FDR_BITS1_FMERGE_LITTLE : 0) - | (intern->fReadin ? FDR_BITS1_FREADIN_LITTLE : 0) - | (intern->fBigendian ? FDR_BITS1_FBIGENDIAN_LITTLE : 0)); - ext->f_bits2[0] = ((intern->glevel << FDR_BITS2_GLEVEL_SH_LITTLE) - & FDR_BITS2_GLEVEL_LITTLE); - ext->f_bits2[1] = 0; - ext->f_bits2[2] = 0; - } + if (bfd_header_big_endian (abfd)) + { + ext->f_bits1[0] = (((intern->lang << FDR_BITS1_LANG_SH_BIG) + & FDR_BITS1_LANG_BIG) + | (intern->fMerge ? FDR_BITS1_FMERGE_BIG : 0) + | (intern->fReadin ? FDR_BITS1_FREADIN_BIG : 0) + | (intern->fBigendian ? FDR_BITS1_FBIGENDIAN_BIG : 0)); + ext->f_bits2[0] = ((intern->glevel << FDR_BITS2_GLEVEL_SH_BIG) + & FDR_BITS2_GLEVEL_BIG); + ext->f_bits2[1] = 0; + ext->f_bits2[2] = 0; + } + else + { + ext->f_bits1[0] = (((intern->lang << FDR_BITS1_LANG_SH_LITTLE) + & FDR_BITS1_LANG_LITTLE) + | (intern->fMerge ? FDR_BITS1_FMERGE_LITTLE : 0) + | (intern->fReadin ? FDR_BITS1_FREADIN_LITTLE : 0) + | (intern->fBigendian ? FDR_BITS1_FBIGENDIAN_LITTLE : 0)); + ext->f_bits2[0] = ((intern->glevel << FDR_BITS2_GLEVEL_SH_LITTLE) + & FDR_BITS2_GLEVEL_LITTLE); + ext->f_bits2[1] = 0; + ext->f_bits2[2] = 0; + } - ecoff_put_off (abfd, intern->cbLineOffset, (bfd_byte *)ext->f_cbLineOffset); - ecoff_put_off (abfd, intern->cbLine, (bfd_byte *)ext->f_cbLine); + ECOFF_PUT_OFF (abfd, intern->cbLineOffset, ext->f_cbLineOffset); + ECOFF_PUT_OFF (abfd, intern->cbLine, ext->f_cbLine); #ifdef TEST if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) @@ -333,26 +339,23 @@ ecoff_swap_pdr_in (abfd, ext_copy, inter memset ((PTR) intern, 0, sizeof (*intern)); - intern->adr = ecoff_get_off (abfd, (bfd_byte *)ext->p_adr); - intern->isym = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_isym); - intern->iline = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_iline); - intern->regmask = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_regmask); - intern->regoffset = bfd_h_get_signed_32 (abfd, - (bfd_byte *)ext->p_regoffset); - intern->iopt = bfd_h_get_signed_32 (abfd, (bfd_byte *)ext->p_iopt); - intern->fregmask = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_fregmask); - intern->fregoffset = bfd_h_get_signed_32 (abfd, - (bfd_byte *)ext->p_fregoffset); - intern->frameoffset = bfd_h_get_signed_32 (abfd, - (bfd_byte *)ext->p_frameoffset); - intern->framereg = bfd_h_get_16 (abfd, (bfd_byte *)ext->p_framereg); - intern->pcreg = bfd_h_get_16 (abfd, (bfd_byte *)ext->p_pcreg); - intern->lnLow = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_lnLow); - intern->lnHigh = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_lnHigh); - intern->cbLineOffset = ecoff_get_off (abfd, (bfd_byte *)ext->p_cbLineOffset); + intern->adr = ECOFF_GET_OFF (abfd, ext->p_adr); + intern->isym = H_GET_32 (abfd, ext->p_isym); + intern->iline = H_GET_32 (abfd, ext->p_iline); + intern->regmask = H_GET_32 (abfd, ext->p_regmask); + intern->regoffset = H_GET_S32 (abfd, ext->p_regoffset); + intern->iopt = H_GET_S32 (abfd, ext->p_iopt); + intern->fregmask = H_GET_32 (abfd, ext->p_fregmask); + intern->fregoffset = H_GET_S32 (abfd, ext->p_fregoffset); + intern->frameoffset = H_GET_S32 (abfd, ext->p_frameoffset); + intern->framereg = H_GET_16 (abfd, ext->p_framereg); + intern->pcreg = H_GET_16 (abfd, ext->p_pcreg); + intern->lnLow = H_GET_32 (abfd, ext->p_lnLow); + intern->lnHigh = H_GET_32 (abfd, ext->p_lnHigh); + intern->cbLineOffset = ECOFF_GET_OFF (abfd, ext->p_cbLineOffset); #if defined (ECOFF_64) || defined (ECOFF_SIGNED_64) - intern->gp_prologue = bfd_h_get_8 (abfd, (bfd_byte *) ext->p_gp_prologue); + intern->gp_prologue = H_GET_8 (abfd, ext->p_gp_prologue); if (bfd_header_big_endian (abfd)) { intern->gp_used = 0 != (ext->p_bits1[0] & PDR_BITS1_GP_USED_BIG); @@ -373,7 +376,7 @@ ecoff_swap_pdr_in (abfd, ext_copy, inter | ((ext->p_bits2[0] & PDR_BITS2_RESERVED_LITTLE) << PDR_BITS2_RESERVED_SH_LEFT_LITTLE)); } - intern->localoff = bfd_h_get_8 (abfd, (bfd_byte *) ext->p_localoff); + intern->localoff = H_GET_8 (abfd, ext->p_localoff); #endif #ifdef TEST @@ -395,23 +398,24 @@ ecoff_swap_pdr_out (abfd, intern_copy, e *intern = *intern_copy; /* Make it reasonable to do in-place. */ - ecoff_put_off (abfd, intern->adr, (bfd_byte *)ext->p_adr); - bfd_h_put_32 (abfd, intern->isym, (bfd_byte *)ext->p_isym); - bfd_h_put_32 (abfd, intern->iline, (bfd_byte *)ext->p_iline); - bfd_h_put_32 (abfd, intern->regmask, (bfd_byte *)ext->p_regmask); - bfd_h_put_32 (abfd, intern->regoffset, (bfd_byte *)ext->p_regoffset); - bfd_h_put_32 (abfd, intern->iopt, (bfd_byte *)ext->p_iopt); - bfd_h_put_32 (abfd, intern->fregmask, (bfd_byte *)ext->p_fregmask); - bfd_h_put_32 (abfd, intern->fregoffset, (bfd_byte *)ext->p_fregoffset); - bfd_h_put_32 (abfd, intern->frameoffset, (bfd_byte *)ext->p_frameoffset); - bfd_h_put_16 (abfd, intern->framereg, (bfd_byte *)ext->p_framereg); - bfd_h_put_16 (abfd, intern->pcreg, (bfd_byte *)ext->p_pcreg); - bfd_h_put_32 (abfd, intern->lnLow, (bfd_byte *)ext->p_lnLow); - bfd_h_put_32 (abfd, intern->lnHigh, (bfd_byte *)ext->p_lnHigh); - ecoff_put_off (abfd, intern->cbLineOffset, (bfd_byte *)ext->p_cbLineOffset); + ECOFF_PUT_OFF (abfd, intern->adr, ext->p_adr); + H_PUT_32 (abfd, intern->isym, ext->p_isym); + H_PUT_32 (abfd, intern->iline, ext->p_iline); + H_PUT_32 (abfd, intern->regmask, ext->p_regmask); + H_PUT_32 (abfd, intern->regoffset, ext->p_regoffset); + H_PUT_32 (abfd, intern->iopt, ext->p_iopt); + H_PUT_32 (abfd, intern->fregmask, ext->p_fregmask); + H_PUT_32 (abfd, intern->fregoffset, ext->p_fregoffset); + H_PUT_32 (abfd, intern->frameoffset, ext->p_frameoffset); + H_PUT_16 (abfd, intern->framereg, ext->p_framereg); + H_PUT_16 (abfd, intern->pcreg, ext->p_pcreg); + H_PUT_32 (abfd, intern->lnLow, ext->p_lnLow); + H_PUT_32 (abfd, intern->lnHigh, ext->p_lnHigh); + ECOFF_PUT_OFF (abfd, intern->cbLineOffset, ext->p_cbLineOffset); #if defined (ECOFF_64) || defined (ECOFF_SIGNED_64) - bfd_h_put_8 (abfd, intern->gp_prologue, (bfd_byte *) ext->p_gp_prologue); + H_PUT_8 (abfd, intern->gp_prologue, ext->p_gp_prologue); + if (bfd_header_big_endian (abfd)) { ext->p_bits1[0] = ((intern->gp_used ? PDR_BITS1_GP_USED_BIG : 0) @@ -434,7 +438,7 @@ ecoff_swap_pdr_out (abfd, intern_copy, e PDR_BITS2_RESERVED_SH_LEFT_LITTLE) & PDR_BITS2_RESERVED_LITTLE); } - bfd_h_put_8 (abfd, intern->localoff, (bfd_byte *) ext->p_localoff); + H_PUT_8 (abfd, intern->localoff, ext->p_localoff); #endif #ifdef TEST @@ -458,23 +462,20 @@ ecoff_swap_pdr_in (abfd, ext_copy, inter *ext = *(struct pdr_ext *) ext_copy; - intern->adr = ecoff_get_off (abfd, (bfd_byte *)ext->p_adr); - intern->isym = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_isym); - intern->iline = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_iline); - intern->regmask = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_regmask); - intern->regoffset = bfd_h_get_signed_32 (abfd, - (bfd_byte *)ext->p_regoffset); - intern->iopt = bfd_h_get_signed_32 (abfd, (bfd_byte *)ext->p_iopt); - intern->fregmask = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_fregmask); - intern->fregoffset = bfd_h_get_signed_32 (abfd, - (bfd_byte *)ext->p_fregoffset); - intern->frameoffset = bfd_h_get_signed_32 (abfd, - (bfd_byte *)ext->p_frameoffset); - intern->framereg = bfd_h_get_16 (abfd, (bfd_byte *)ext->p_framereg); - intern->pcreg = bfd_h_get_16 (abfd, (bfd_byte *)ext->p_pcreg); - intern->lnLow = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_lnLow); - intern->lnHigh = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_lnHigh); - intern->cbLineOffset = ecoff_get_off (abfd, (bfd_byte *)ext->p_cbLineOffset); + intern->adr = ECOFF_GET_OFF (abfd, ext->p_adr); + intern->isym = H_GET_32 (abfd, ext->p_isym); + intern->iline = H_GET_32 (abfd, ext->p_iline); + intern->regmask = H_GET_32 (abfd, ext->p_regmask); + intern->regoffset = H_GET_S32 (abfd, ext->p_regoffset); + intern->iopt = H_GET_S32 (abfd, ext->p_iopt); + intern->fregmask = H_GET_32 (abfd, ext->p_fregmask); + intern->fregoffset = H_GET_S32 (abfd, ext->p_fregoffset); + intern->frameoffset = H_GET_S32 (abfd, ext->p_frameoffset); + intern->framereg = H_GET_16 (abfd, ext->p_framereg); + intern->pcreg = H_GET_16 (abfd, ext->p_pcreg); + intern->lnLow = H_GET_32 (abfd, ext->p_lnLow); + intern->lnHigh = H_GET_32 (abfd, ext->p_lnHigh); + intern->cbLineOffset = ECOFF_GET_OFF (abfd, ext->p_cbLineOffset); #ifdef TEST if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) @@ -495,20 +496,20 @@ ecoff_swap_pdr_out (abfd, intern_copy, e *intern = *intern_copy; /* Make it reasonable to do in-place. */ - ecoff_put_off (abfd, intern->adr, (bfd_byte *)ext->p_adr); - bfd_h_put_32 (abfd, intern->isym, (bfd_byte *)ext->p_isym); - bfd_h_put_32 (abfd, intern->iline, (bfd_byte *)ext->p_iline); - bfd_h_put_32 (abfd, intern->regmask, (bfd_byte *)ext->p_regmask); - bfd_h_put_32 (abfd, intern->regoffset, (bfd_byte *)ext->p_regoffset); - bfd_h_put_32 (abfd, intern->iopt, (bfd_byte *)ext->p_iopt); - bfd_h_put_32 (abfd, intern->fregmask, (bfd_byte *)ext->p_fregmask); - bfd_h_put_32 (abfd, intern->fregoffset, (bfd_byte *)ext->p_fregoffset); - bfd_h_put_32 (abfd, intern->frameoffset, (bfd_byte *)ext->p_frameoffset); - bfd_h_put_16 (abfd, intern->framereg, (bfd_byte *)ext->p_framereg); - bfd_h_put_16 (abfd, intern->pcreg, (bfd_byte *)ext->p_pcreg); - bfd_h_put_32 (abfd, intern->lnLow, (bfd_byte *)ext->p_lnLow); - bfd_h_put_32 (abfd, intern->lnHigh, (bfd_byte *)ext->p_lnHigh); - ecoff_put_off (abfd, intern->cbLineOffset, (bfd_byte *)ext->p_cbLineOffset); + ECOFF_PUT_OFF (abfd, intern->adr, ext->p_adr); + H_PUT_32 (abfd, intern->isym, ext->p_isym); + H_PUT_32 (abfd, intern->iline, ext->p_iline); + H_PUT_32 (abfd, intern->regmask, ext->p_regmask); + H_PUT_32 (abfd, intern->regoffset, ext->p_regoffset); + H_PUT_32 (abfd, intern->iopt, ext->p_iopt); + H_PUT_32 (abfd, intern->fregmask, ext->p_fregmask); + H_PUT_32 (abfd, intern->fregoffset, ext->p_fregoffset); + H_PUT_32 (abfd, intern->frameoffset, ext->p_frameoffset); + H_PUT_16 (abfd, intern->framereg, ext->p_framereg); + H_PUT_16 (abfd, intern->pcreg, ext->p_pcreg); + H_PUT_32 (abfd, intern->lnLow, ext->p_lnLow); + H_PUT_32 (abfd, intern->lnHigh, ext->p_lnHigh); + ECOFF_PUT_OFF (abfd, intern->cbLineOffset, ext->p_cbLineOffset); #ifdef TEST if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) @@ -529,8 +530,8 @@ ecoff_swap_sym_in (abfd, ext_copy, inter *ext = *(struct sym_ext *) ext_copy; - intern->iss = bfd_h_get_32 (abfd, (bfd_byte *)ext->s_iss); - intern->value = ecoff_get_off (abfd, (bfd_byte *)ext->s_value); + intern->iss = H_GET_32 (abfd, ext->s_iss); + intern->value = ECOFF_GET_OFF (abfd, ext->s_value); /* now the fun stuff... */ if (bfd_header_big_endian (abfd)) { @@ -579,8 +580,8 @@ ecoff_swap_sym_out (abfd, intern_copy, e *intern = *intern_copy; /* Make it reasonable to do in-place. */ - bfd_h_put_32 (abfd, intern->iss, (bfd_byte *)ext->s_iss); - ecoff_put_off (abfd, intern->value, (bfd_byte *)ext->s_value); + H_PUT_32 (abfd, intern->iss, ext->s_iss); + ECOFF_PUT_OFF (abfd, intern->value, ext->s_value); /* now the fun stuff... */ if (bfd_header_big_endian (abfd)) { @@ -640,10 +641,10 @@ ecoff_swap_ext_in (abfd, ext_copy, inter intern->reserved = 0; #if defined (ECOFF_32) || defined (ECOFF_SIGNED_32) - intern->ifd = bfd_h_get_signed_16 (abfd, (bfd_byte *)ext->es_ifd); + intern->ifd = H_GET_S16 (abfd, ext->es_ifd); #endif #if defined (ECOFF_64) || defined (ECOFF_SIGNED_64) - intern->ifd = bfd_h_get_signed_32 (abfd, (bfd_byte *)ext->es_ifd); + intern->ifd = H_GET_S32 (abfd, ext->es_ifd); #endif ecoff_swap_sym_in (abfd, &ext->es_asym, &intern->asym); @@ -689,10 +690,10 @@ ecoff_swap_ext_out (abfd, intern_copy, e } #if defined (ECOFF_32) || defined (ECOFF_SIGNED_32) - bfd_h_put_signed_16 (abfd, intern->ifd, (bfd_byte *)ext->es_ifd); + H_PUT_S16 (abfd, intern->ifd, ext->es_ifd); #endif #if defined (ECOFF_64) || defined (ECOFF_SIGNED_64) - bfd_h_put_signed_32 (abfd, intern->ifd, (bfd_byte *)ext->es_ifd); + H_PUT_S32 (abfd, intern->ifd, ext->es_ifd); #endif ecoff_swap_sym_out (abfd, &intern->asym, &ext->es_asym); @@ -713,7 +714,7 @@ ecoff_swap_rfd_in (abfd, ext_ptr, intern { struct rfd_ext *ext = (struct rfd_ext *) ext_ptr; - *intern = bfd_h_get_32 (abfd, (bfd_byte *)ext->rfd); + *intern = H_GET_32 (abfd, ext->rfd); #ifdef TEST if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) @@ -731,7 +732,7 @@ ecoff_swap_rfd_out (abfd, intern, ext_pt { struct rfd_ext *ext = (struct rfd_ext *) ext_ptr; - bfd_h_put_32 (abfd, *intern, (bfd_byte *)ext->rfd); + H_PUT_32 (abfd, *intern, ext->rfd); #ifdef TEST if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) @@ -772,7 +773,7 @@ ecoff_swap_opt_in (abfd, ext_copy, inter _bfd_ecoff_swap_rndx_in (bfd_header_big_endian (abfd), &ext->o_rndx, &intern->rndx); - intern->offset = bfd_h_get_32 (abfd, (bfd_byte *) ext->o_offset); + intern->offset = H_GET_32 (abfd, ext->o_offset); #ifdef TEST if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) @@ -811,7 +812,7 @@ ecoff_swap_opt_out (abfd, intern_copy, e _bfd_ecoff_swap_rndx_out (bfd_header_big_endian (abfd), &intern->rndx, &ext->o_rndx); - bfd_h_put_32 (abfd, intern->value, (bfd_byte *) ext->o_offset); + H_PUT_32 (abfd, intern->value, ext->o_offset); #ifdef TEST if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) @@ -831,8 +832,8 @@ ecoff_swap_dnr_in (abfd, ext_copy, inter *ext = *(struct dnr_ext *) ext_copy; - intern->rfd = bfd_h_get_32 (abfd, (bfd_byte *) ext->d_rfd); - intern->index = bfd_h_get_32 (abfd, (bfd_byte *) ext->d_index); + intern->rfd = H_GET_32 (abfd, ext->d_rfd); + intern->index = H_GET_32 (abfd, ext->d_index); #ifdef TEST if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) @@ -853,8 +854,8 @@ ecoff_swap_dnr_out (abfd, intern_copy, e *intern = *intern_copy; /* Make it reasonable to do in-place. */ - bfd_h_put_32 (abfd, intern->rfd, (bfd_byte *) ext->d_rfd); - bfd_h_put_32 (abfd, intern->index, (bfd_byte *) ext->d_index); + H_PUT_32 (abfd, intern->rfd, ext->d_rfd); + H_PUT_32 (abfd, intern->index, ext->d_index); #ifdef TEST if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) diff -uprN binutils-2.11.90.0.31/bfd/elf-bfd.h binutils-2.11.92.0.5/bfd/elf-bfd.h --- binutils-2.11.90.0.31/bfd/elf-bfd.h Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/elf-bfd.h Thu Oct 4 14:35:43 2001 @@ -28,22 +28,25 @@ Foundation, Inc., 59 Temple Place - Suit #include "bfdlink.h" /* The number of entries in a section is its size divided by the size - of a single entry. This is normally only applicaable to reloc and + of a single entry. This is normally only applicable to reloc and symbol table sections. */ #define NUM_SHDR_ENTRIES(shdr) ((shdr)->sh_size / (shdr)->sh_entsize) /* If size isn't specified as 64 or 32, NAME macro should fail. */ +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ #ifndef NAME #if ARCH_SIZE==64 -#define NAME(x,y) CAT4(x,64,_,y) +#define NAME(x,y) CONCAT4 (x,64,_,y) #endif #if ARCH_SIZE==32 -#define NAME(x,y) CAT4(x,32,_,y) +#define NAME(x,y) CONCAT4 (x,32,_,y) #endif #endif #ifndef NAME -#define NAME(x,y) CAT4(x,NOSIZE,_,y) +#define NAME(x,y) CONCAT4 (x,NOSIZE,_,y) #endif #define ElfNAME(X) NAME(Elf,X) @@ -86,9 +89,6 @@ struct elf_link_hash_entry set to -2 if the symbol is used by a reloc. */ long indx; - /* Symbol size. */ - bfd_size_type size; - /* Symbol index as a dynamic symbol. Initialized to -1, and remains -1 if this is not a dynamic symbol. */ /* ??? Note that this is consistently used as a synonym for tests @@ -106,31 +106,14 @@ struct elf_link_hash_entry /* String table index in .dynstr if this is a dynamic symbol. */ unsigned long dynstr_index; + /* Hash value of the name computed using the ELF hash function. */ + unsigned long elf_hash_value; + /* If this is a weak defined symbol from a dynamic object, this field points to a defined symbol with the same value, if there is one. Otherwise it is NULL. */ struct elf_link_hash_entry *weakdef; - /* If this symbol requires an entry in the global offset table, the - processor specific backend uses this field to track usage and - final offset. We use a union and two names primarily to document - the intent of any particular piece of code. The field should be - used as a count until size_dynamic_sections, at which point the - contents of the .got is fixed. Afterward, if this field is -1, - then the symbol does not require a global offset table entry. */ - union - { - bfd_signed_vma refcount; - bfd_vma offset; - } got; - - /* Same, but tracks a procedure linkage table entry. */ - union - { - bfd_signed_vma refcount; - bfd_vma offset; - } plt; - /* If this symbol is used in the linker created sections, the processor specific backend uses this field to map the field into the offset from the beginning of the section. */ @@ -159,15 +142,35 @@ struct elf_link_hash_entry /* Virtual table derivation info. */ struct elf_link_hash_entry *vtable_parent; + /* If this symbol requires an entry in the global offset table, the + processor specific backend uses this field to track usage and + final offset. We use a union and two names primarily to document + the intent of any particular piece of code. The field should be + used as a count until size_dynamic_sections, at which point the + contents of the .got is fixed. Afterward, if this field is -1, + then the symbol does not require a global offset table entry. */ + union + { + bfd_signed_vma refcount; + bfd_vma offset; + } got; + + /* Same, but tracks a procedure linkage table entry. */ + union + { + bfd_signed_vma refcount; + bfd_vma offset; + } plt; + + /* Symbol size. */ + bfd_size_type size; + /* Symbol type (STT_NOTYPE, STT_OBJECT, etc.). */ char type; /* Symbol st_other value, symbol visibility. */ unsigned char other; - /* Hash value of the name computed using the ELF hash function. */ - unsigned long elf_hash_value; - /* Some flags; legal values follow. */ unsigned short elf_link_hash_flags; /* Symbol is referenced by a non-shared object. */ @@ -229,33 +232,50 @@ struct elf_link_loaded_list struct elf_link_hash_table { struct bfd_link_hash_table root; + /* Whether we have created the special dynamic sections required when linking against or generating a shared object. */ boolean dynamic_sections_created; + /* The BFD used to hold special sections created by the linker. This will be the first BFD found which requires these sections to be created. */ bfd *dynobj; + + /* The value to use when initialising got.refcount/offset and + plt.refcount/offset in an elf_link_hash_entry. Set to zero when + the values are refcounts. Set to -1 in size_dynamic_sections + when the values may be offsets. */ + bfd_signed_vma init_refcount; + /* The number of symbols found in the link which must be put into the .dynsym section. */ bfd_size_type dynsymcount; + /* The string table of dynamic symbols, which becomes the .dynstr section. */ struct bfd_strtab_hash *dynstr; + /* The number of buckets in the hash table in the .hash section. This is based on the number of dynamic symbols. */ bfd_size_type bucketcount; + /* A linked list of DT_NEEDED names found in dynamic objects included in the link. */ struct bfd_link_needed_list *needed; + /* The _GLOBAL_OFFSET_TABLE_ symbol. */ struct elf_link_hash_entry *hgot; + /* A pointer to information used to link stabs in sections. */ PTR stab_info; + /* A pointer to information used to merge SEC_MERGE sections. */ PTR merge_info; + /* A linked list of local symbols to be added to .dynsym. */ struct elf_link_local_dynamic_entry *dynlocal; + /* A linked list of DT_RPATH/DT_RUNPATH names found in dynamic objects included in the link. */ struct bfd_link_needed_list *runpath; @@ -301,15 +321,22 @@ struct elf_size_info { unsigned char arch_size, file_align; unsigned char elfclass, ev_current; - int (*write_out_phdrs) PARAMS ((bfd *, const Elf_Internal_Phdr *, int)); - boolean (*write_shdrs_and_ehdr) PARAMS ((bfd *)); - void (*write_relocs) PARAMS ((bfd *, asection *, PTR)); - void (*swap_symbol_out) PARAMS ((bfd *, const Elf_Internal_Sym *, PTR)); + int (*write_out_phdrs) + PARAMS ((bfd *, const Elf_Internal_Phdr *, unsigned int)); + boolean (*write_shdrs_and_ehdr) + PARAMS ((bfd *)); + void (*write_relocs) + PARAMS ((bfd *, asection *, PTR)); + void (*swap_symbol_out) + PARAMS ((bfd *, const Elf_Internal_Sym *, PTR)); boolean (*slurp_reloc_table) PARAMS ((bfd *, asection *, asymbol **, boolean)); - long (*slurp_symbol_table) PARAMS ((bfd *, asymbol **, boolean)); - void (*swap_dyn_in) PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *)); - void (*swap_dyn_out) PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR)); + long (*slurp_symbol_table) + PARAMS ((bfd *, asymbol **, boolean)); + void (*swap_dyn_in) + PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *)); + void (*swap_dyn_out) + PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR)); /* This function, if defined, is called to swap in a REL relocation. If an external relocation corresponds to more than @@ -363,20 +390,21 @@ struct elf_backend_data /* A function to translate an ELF RELA relocation to a BFD arelent structure. */ - void (*elf_info_to_howto) PARAMS ((bfd *, arelent *, - Elf_Internal_Rela *)); + void (*elf_info_to_howto) + PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); /* A function to translate an ELF REL relocation to a BFD arelent structure. */ - void (*elf_info_to_howto_rel) PARAMS ((bfd *, arelent *, - Elf_Internal_Rel *)); + void (*elf_info_to_howto_rel) + PARAMS ((bfd *, arelent *, Elf_Internal_Rel *)); /* A function to determine whether a symbol is global when partitioning the symbol table into local and global symbols. This should be NULL for most targets, in which case the correct thing will be done. MIPS ELF, at least on the Irix 5, has special requirements. */ - boolean (*elf_backend_sym_is_global) PARAMS ((bfd *, asymbol *)); + boolean (*elf_backend_sym_is_global) + PARAMS ((bfd *, asymbol *)); /* The remaining functions are hooks which are called only if they are not NULL. */ @@ -387,52 +415,52 @@ struct elf_backend_data this is called elf_elfheader is set, but anything else should be used with caution. If this returns false, the check_format routine will return a bfd_error_wrong_format error. */ - boolean (*elf_backend_object_p) PARAMS ((bfd *)); + boolean (*elf_backend_object_p) + PARAMS ((bfd *)); /* A function to do additional symbol processing when reading the ELF symbol table. This is where any processor-specific special section indices are handled. */ - void (*elf_backend_symbol_processing) PARAMS ((bfd *, asymbol *)); + void (*elf_backend_symbol_processing) + PARAMS ((bfd *, asymbol *)); /* A function to do additional symbol processing after reading the entire ELF symbol table. */ - boolean (*elf_backend_symbol_table_processing) PARAMS ((bfd *, - elf_symbol_type *, - unsigned int)); + boolean (*elf_backend_symbol_table_processing) + PARAMS ((bfd *, elf_symbol_type *, unsigned int)); /* A function to set the type of the info field. Processor-specific types should be handled here. */ - int (*elf_backend_get_symbol_type) PARAMS (( Elf_Internal_Sym *, int)); + int (*elf_backend_get_symbol_type) + PARAMS (( Elf_Internal_Sym *, int)); /* A function to do additional processing on the ELF section header just before writing it out. This is used to set the flags and type fields for some sections, or to actually write out data for unusual sections. */ - boolean (*elf_backend_section_processing) PARAMS ((bfd *, - Elf32_Internal_Shdr *)); + boolean (*elf_backend_section_processing) + PARAMS ((bfd *, Elf32_Internal_Shdr *)); /* A function to handle unusual section types when creating BFD sections from ELF sections. */ - boolean (*elf_backend_section_from_shdr) PARAMS ((bfd *, - Elf32_Internal_Shdr *, - char *)); + boolean (*elf_backend_section_from_shdr) + PARAMS ((bfd *, Elf32_Internal_Shdr *, char *)); /* A function to convert machine dependent section header flags to BFD internal section header flags. */ - boolean (*elf_backend_section_flags) PARAMS ((flagword *, - Elf32_Internal_Shdr *)); + boolean (*elf_backend_section_flags) + PARAMS ((flagword *, Elf32_Internal_Shdr *)); /* A function to handle unusual program segment types when creating BFD sections from ELF program segments. */ - boolean (*elf_backend_section_from_phdr) PARAMS ((bfd *, - Elf32_Internal_Phdr *, - int)); + boolean (*elf_backend_section_from_phdr) + PARAMS ((bfd *, Elf32_Internal_Phdr *, int)); /* A function to set up the ELF section header for a BFD section in preparation for writing it out. This is where the flags and type fields are set for unusual sections. */ - boolean (*elf_backend_fake_sections) PARAMS ((bfd *, Elf32_Internal_Shdr *, - asection *)); + boolean (*elf_backend_fake_sections) + PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *)); /* A function to get the ELF section index for a BFD section. If this returns true, the section was found. If it is a normal ELF @@ -586,11 +614,13 @@ struct elf_backend_data /* This function is called by get_program_header_size. It should return the number of additional program segments which this BFD will need. It should return -1 on error. */ - int (*elf_backend_additional_program_headers) PARAMS ((bfd *)); + int (*elf_backend_additional_program_headers) + PARAMS ((bfd *)); /* This function is called to modify an existing segment map in a backend specific fashion. */ - boolean (*elf_backend_modify_segment_map) PARAMS ((bfd *)); + boolean (*elf_backend_modify_segment_map) + PARAMS ((bfd *)); /* This function is called during section gc to discover the section a particular relocation refers to. It need not be defined for hosts @@ -624,11 +654,13 @@ struct elf_backend_data not handled in the hash table. */ boolean (*elf_backend_output_arch_syms) PARAMS ((bfd *, struct bfd_link_info *, PTR, - boolean (*) PARAMS ((PTR, const char *, - Elf_Internal_Sym *, asection *)))); + boolean (*) (PTR, const char *, Elf_Internal_Sym *, asection *))); - /* Copy any information related to dynamic linking from a pre-existing - symbol IND to a newly created symbol DIR. */ + /* Copy any information related to dynamic linking from a pre-existing + symbol to a newly created symbol. Also called to copy flags and + other back-end info to a weakdef, in which case the symbol is not + newly created and plt/got refcounts and dynamic indices should not + be copied. */ void (*elf_backend_copy_indirect_symbol) PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *)); @@ -649,18 +681,23 @@ struct elf_backend_data /* This function, if defined, is called when an NT_PRSTATUS note is found in a core file. */ - boolean (*elf_backend_grok_prstatus) PARAMS ((bfd *, Elf_Internal_Note *)); + boolean (*elf_backend_grok_prstatus) + PARAMS ((bfd *, Elf_Internal_Note *)); /* This function, if defined, is called when an NT_PSINFO or NT_PRPSINFO note is found in a core file. */ - boolean (*elf_backend_grok_psinfo) PARAMS ((bfd *, Elf_Internal_Note *)); + boolean (*elf_backend_grok_psinfo) + PARAMS ((bfd *, Elf_Internal_Note *)); /* Functions to print VMAs. Special code to handle 64 bit ELF files. */ - void (* elf_backend_sprintf_vma) PARAMS ((bfd *, char *, bfd_vma)); - void (* elf_backend_fprintf_vma) PARAMS ((bfd *, PTR, bfd_vma)); + void (* elf_backend_sprintf_vma) + PARAMS ((bfd *, char *, bfd_vma)); + void (* elf_backend_fprintf_vma) + PARAMS ((bfd *, PTR, bfd_vma)); /* This function returns class of a reloc type. */ - enum elf_reloc_type_class (* elf_backend_reloc_type_class) PARAMS ((int)); + enum elf_reloc_type_class (*elf_backend_reloc_type_class) + PARAMS ((const Elf_Internal_Rela *)); /* The swapping table to use when dealing with ECOFF information. Used for the MIPS ELF .mdebug section. */ @@ -720,6 +757,7 @@ struct elf_backend_data unsigned plt_not_loaded : 1; unsigned plt_alignment : 4; unsigned can_gc_sections : 1; + unsigned can_refcount : 1; unsigned want_got_sym : 1; unsigned want_dynbss : 1; }; @@ -731,43 +769,63 @@ struct bfd_elf_section_data { /* The ELF header for this section. */ Elf_Internal_Shdr this_hdr; + /* The ELF header for the reloc section associated with this section, if any. */ Elf_Internal_Shdr rel_hdr; + /* If there is a second reloc section associated with this section, as can happen on Irix 6, this field points to the header. */ Elf_Internal_Shdr *rel_hdr2; + /* The number of relocations currently assigned to REL_HDR. */ unsigned int rel_count; + /* The number of relocations currently assigned to REL_HDR2. */ unsigned int rel_count2; + + /* The number of dynamic relocs copied for local symbols. */ + unsigned int local_dynrel; + + /* A pointer to the bfd section used for dynamic relocs. */ + asection *sreloc; + /* The ELF section number of this section. Only used for an output file. */ int this_idx; + /* The ELF section number of the reloc section indicated by REL_HDR if any. Only used for an output file. */ int rel_idx; + /* The ELF section number of the reloc section indicated by REL_HDR2 if any. Only used for an output file. */ int rel_idx2; + /* Used by the backend linker to store the symbol hash table entries associated with relocs against global symbols. */ struct elf_link_hash_entry **rel_hashes; + /* A pointer to the swapped relocs. If the section uses REL relocs, rather than RELA, all the r_addend fields will be zero. This pointer may be NULL. It is used by the backend linker. */ Elf_Internal_Rela *relocs; + /* Used by the backend linker when generating a shared library to record the dynamic symbol index for a section symbol corresponding to this section. A value of 0 means that there is no dynamic symbol for this section. */ long dynindx; + /* A pointer used for .stab linking optimizations. */ PTR stab_info; + /* A pointer used for SEC_MERGE optimizations. */ PTR merge_info; + /* A pointer available for the processor specific ELF backend. */ PTR tdata; + /* Nonzero if this section uses RELA relocations, rather than REL. */ unsigned int use_rela_p:1; }; @@ -818,7 +876,7 @@ typedef struct elf_linker_section_pointe { struct elf_linker_section_pointers *next; /* next allocated pointer for this symbol */ bfd_vma offset; /* offset of pointer from beginning of section */ - bfd_signed_vma addend; /* addend used */ + bfd_vma addend; /* addend used */ elf_linker_section_enum_t which; /* which linker section this is */ boolean written_address_p; /* whether address was written yet */ } elf_linker_section_pointers_t; @@ -1013,41 +1071,48 @@ extern void _bfd_elf_swap_versym_in extern void _bfd_elf_swap_versym_out PARAMS ((bfd *, const Elf_Internal_Versym *, Elf_External_Versym *)); -extern int _bfd_elf_section_from_bfd_section PARAMS ((bfd *, asection *)); +extern int _bfd_elf_section_from_bfd_section + PARAMS ((bfd *, asection *)); extern char *bfd_elf_string_from_elf_section PARAMS ((bfd *, unsigned, unsigned)); -extern char *bfd_elf_get_str_section PARAMS ((bfd *, unsigned)); +extern char *bfd_elf_get_str_section + PARAMS ((bfd *, unsigned)); + +extern boolean _bfd_elf_print_private_bfd_data + PARAMS ((bfd *, PTR)); +extern void bfd_elf_print_symbol + PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type)); -extern boolean _bfd_elf_print_private_bfd_data PARAMS ((bfd *, PTR)); -extern void bfd_elf_print_symbol PARAMS ((bfd *, PTR, asymbol *, - bfd_print_symbol_type)); -#define elf_string_from_elf_strtab(abfd,strindex) \ - bfd_elf_string_from_elf_section(abfd,elf_elfheader(abfd)->e_shstrndx,strindex) +#define elf_string_from_elf_strtab(abfd, strindex) \ + bfd_elf_string_from_elf_section(abfd, elf_elfheader(abfd)->e_shstrndx, \ + strindex) #define bfd_elf32_print_symbol bfd_elf_print_symbol #define bfd_elf64_print_symbol bfd_elf_print_symbol -extern void _bfd_elf_sprintf_vma PARAMS ((bfd *, char *, bfd_vma)); -extern void _bfd_elf_fprintf_vma PARAMS ((bfd *, PTR, bfd_vma)); +extern void _bfd_elf_sprintf_vma + PARAMS ((bfd *, char *, bfd_vma)); +extern void _bfd_elf_fprintf_vma + PARAMS ((bfd *, PTR, bfd_vma)); -extern enum elf_reloc_type_class _bfd_elf_reloc_type_class PARAMS ((int)); +extern enum elf_reloc_type_class _bfd_elf_reloc_type_class + PARAMS ((const Elf_Internal_Rela *)); -extern unsigned long bfd_elf_hash PARAMS ((const char *)); +extern unsigned long bfd_elf_hash + PARAMS ((const char *)); -extern bfd_reloc_status_type bfd_elf_generic_reloc PARAMS ((bfd *, - arelent *, - asymbol *, - PTR, - asection *, - bfd *, - char **)); -extern boolean bfd_elf_mkobject PARAMS ((bfd *)); -extern boolean bfd_elf_mkcorefile PARAMS ((bfd *)); -extern Elf_Internal_Shdr *bfd_elf_find_section PARAMS ((bfd *, char *)); +extern bfd_reloc_status_type bfd_elf_generic_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +extern boolean bfd_elf_mkobject + PARAMS ((bfd *)); +extern boolean bfd_elf_mkcorefile + PARAMS ((bfd *)); +extern Elf_Internal_Shdr *bfd_elf_find_section + PARAMS ((bfd *, char *)); extern boolean _bfd_elf_make_section_from_shdr - PARAMS ((bfd *abfd, Elf_Internal_Shdr *hdr, const char *name)); + PARAMS ((bfd *, Elf_Internal_Shdr *, const char *)); extern boolean _bfd_elf_make_section_from_phdr - PARAMS ((bfd *abfd, Elf_Internal_Phdr *hdr, int index, const char *typename)); + PARAMS ((bfd *, Elf_Internal_Phdr *, int, const char *)); extern struct bfd_hash_entry *_bfd_elf_link_hash_newfunc PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create @@ -1061,7 +1126,8 @@ extern boolean _bfd_elf_link_hash_table_ struct bfd_hash_entry *(*) (struct bfd_hash_entry *, struct bfd_hash_table *, const char *))); -extern boolean _bfd_elf_slurp_version_tables PARAMS ((bfd *)); +extern boolean _bfd_elf_slurp_version_tables + PARAMS ((bfd *)); extern boolean _bfd_elf_merge_sections PARAMS ((bfd *, struct bfd_link_info *)); @@ -1070,135 +1136,133 @@ extern boolean _bfd_elf_copy_private_sym PARAMS ((bfd *, asymbol *, bfd *, asymbol *)); extern boolean _bfd_elf_copy_private_section_data PARAMS ((bfd *, asection *, bfd *, asection *)); -extern boolean _bfd_elf_write_object_contents PARAMS ((bfd *)); -extern boolean _bfd_elf_write_corefile_contents PARAMS ((bfd *)); -extern boolean _bfd_elf_set_section_contents PARAMS ((bfd *, sec_ptr, PTR, - file_ptr, - bfd_size_type)); -extern long _bfd_elf_get_symtab_upper_bound PARAMS ((bfd *)); -extern long _bfd_elf_get_symtab PARAMS ((bfd *, asymbol **)); -extern long _bfd_elf_get_dynamic_symtab_upper_bound PARAMS ((bfd *)); -extern long _bfd_elf_canonicalize_dynamic_symtab PARAMS ((bfd *, asymbol **)); -extern long _bfd_elf_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr)); -extern long _bfd_elf_canonicalize_reloc PARAMS ((bfd *, sec_ptr, - arelent **, asymbol **)); -extern long _bfd_elf_get_dynamic_reloc_upper_bound PARAMS ((bfd *)); -extern long _bfd_elf_canonicalize_dynamic_reloc PARAMS ((bfd *, arelent **, - asymbol **)); -extern asymbol *_bfd_elf_make_empty_symbol PARAMS ((bfd *)); -extern void _bfd_elf_get_symbol_info PARAMS ((bfd *, asymbol *, - symbol_info *)); -extern boolean _bfd_elf_is_local_label_name PARAMS ((bfd *, const char *)); -extern alent *_bfd_elf_get_lineno PARAMS ((bfd *, asymbol *)); -extern boolean _bfd_elf_set_arch_mach PARAMS ((bfd *, enum bfd_architecture, - unsigned long)); -extern boolean _bfd_elf_find_nearest_line PARAMS ((bfd *, asection *, - asymbol **, - bfd_vma, const char **, - const char **, - unsigned int *)); +extern boolean _bfd_elf_write_object_contents + PARAMS ((bfd *)); +extern boolean _bfd_elf_write_corefile_contents + PARAMS ((bfd *)); +extern boolean _bfd_elf_set_section_contents + PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type)); +extern long _bfd_elf_get_symtab_upper_bound + PARAMS ((bfd *)); +extern long _bfd_elf_get_symtab + PARAMS ((bfd *, asymbol **)); +extern long _bfd_elf_get_dynamic_symtab_upper_bound + PARAMS ((bfd *)); +extern long _bfd_elf_canonicalize_dynamic_symtab + PARAMS ((bfd *, asymbol **)); +extern long _bfd_elf_get_reloc_upper_bound + PARAMS ((bfd *, sec_ptr)); +extern long _bfd_elf_canonicalize_reloc + PARAMS ((bfd *, sec_ptr, arelent **, asymbol **)); +extern long _bfd_elf_get_dynamic_reloc_upper_bound + PARAMS ((bfd *)); +extern long _bfd_elf_canonicalize_dynamic_reloc + PARAMS ((bfd *, arelent **, asymbol **)); +extern asymbol *_bfd_elf_make_empty_symbol + PARAMS ((bfd *)); +extern void _bfd_elf_get_symbol_info + PARAMS ((bfd *, asymbol *, symbol_info *)); +extern boolean _bfd_elf_is_local_label_name + PARAMS ((bfd *, const char *)); +extern alent *_bfd_elf_get_lineno + PARAMS ((bfd *, asymbol *)); +extern boolean _bfd_elf_set_arch_mach + PARAMS ((bfd *, enum bfd_architecture, unsigned long)); +extern boolean _bfd_elf_find_nearest_line + PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, + const char **, unsigned int *)); #define _bfd_elf_read_minisymbols _bfd_generic_read_minisymbols #define _bfd_elf_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol -extern int _bfd_elf_sizeof_headers PARAMS ((bfd *, boolean)); -extern boolean _bfd_elf_new_section_hook PARAMS ((bfd *, asection *)); +extern int _bfd_elf_sizeof_headers + PARAMS ((bfd *, boolean)); +extern boolean _bfd_elf_new_section_hook + PARAMS ((bfd *, asection *)); extern boolean _bfd_elf_init_reloc_shdr PARAMS ((bfd *, Elf_Internal_Shdr *, asection *, boolean)); /* If the target doesn't have reloc handling written yet: */ -extern void _bfd_elf_no_info_to_howto PARAMS ((bfd *, arelent *, - Elf_Internal_Rela *)); +extern void _bfd_elf_no_info_to_howto + PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); + +extern boolean bfd_section_from_shdr + PARAMS ((bfd *, unsigned int shindex)); +extern boolean bfd_section_from_phdr + PARAMS ((bfd *, Elf_Internal_Phdr *, int)); + +extern int _bfd_elf_symbol_from_bfd_symbol + PARAMS ((bfd *, asymbol **)); + +extern asection *bfd_section_from_elf_index + PARAMS ((bfd *, unsigned int)); +extern boolean _bfd_elf_create_dynamic_sections + PARAMS ((bfd *, struct bfd_link_info *)); +extern struct bfd_strtab_hash *_bfd_elf_stringtab_init + PARAMS ((void)); +extern boolean _bfd_elf_link_record_dynamic_symbol + PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); +extern long _bfd_elf_link_lookup_local_dynindx + PARAMS ((struct bfd_link_info *, bfd *, long)); +extern boolean _bfd_elf_compute_section_file_positions + PARAMS ((bfd *, struct bfd_link_info *)); +extern void _bfd_elf_assign_file_positions_for_relocs + PARAMS ((bfd *)); +extern file_ptr _bfd_elf_assign_file_position_for_section + PARAMS ((Elf_Internal_Shdr *, file_ptr, boolean)); + +extern boolean _bfd_elf_validate_reloc + PARAMS ((bfd *, arelent *)); -extern boolean bfd_section_from_shdr PARAMS ((bfd *, unsigned int shindex)); -extern boolean bfd_section_from_phdr PARAMS ((bfd *, Elf_Internal_Phdr *, int)); +extern boolean _bfd_elf_create_dynamic_sections + PARAMS ((bfd *, struct bfd_link_info *)); +extern boolean _bfd_elf_create_got_section + PARAMS ((bfd *, struct bfd_link_info *)); +extern unsigned long _bfd_elf_link_renumber_dynsyms + PARAMS ((bfd *, struct bfd_link_info *)); + +extern boolean _bfd_elfcore_make_pseudosection + PARAMS ((bfd *, char *, size_t, ufile_ptr)); +extern char *_bfd_elfcore_strndup + PARAMS ((bfd *, char *, size_t)); + +extern elf_linker_section_t *_bfd_elf_create_linker_section + PARAMS ((bfd *, struct bfd_link_info *, enum elf_linker_section_enum, + elf_linker_section_t *)); + +extern elf_linker_section_pointers_t *_bfd_elf_find_pointer_linker_section + PARAMS ((elf_linker_section_pointers_t *, bfd_vma, + elf_linker_section_enum_t)); + +extern boolean bfd_elf32_create_pointer_linker_section + PARAMS ((bfd *, struct bfd_link_info *, elf_linker_section_t *, + struct elf_link_hash_entry *, const Elf32_Internal_Rela *)); + +extern bfd_vma bfd_elf32_finish_pointer_linker_section + PARAMS ((bfd *, bfd *, struct bfd_link_info *, elf_linker_section_t *, + struct elf_link_hash_entry *, bfd_vma, + const Elf32_Internal_Rela *, int)); + +extern boolean bfd_elf64_create_pointer_linker_section + PARAMS ((bfd *, struct bfd_link_info *, elf_linker_section_t *, + struct elf_link_hash_entry *, const Elf64_Internal_Rela *)); + +extern bfd_vma bfd_elf64_finish_pointer_linker_section + PARAMS ((bfd *, bfd *, struct bfd_link_info *, elf_linker_section_t *, + struct elf_link_hash_entry *, bfd_vma, + const Elf64_Internal_Rela *, int)); -extern int _bfd_elf_symbol_from_bfd_symbol PARAMS ((bfd *, asymbol **)); +extern boolean _bfd_elf_make_linker_section_rela + PARAMS ((bfd *, elf_linker_section_t *, int)); -asection *bfd_section_from_elf_index PARAMS ((bfd *, unsigned int)); -boolean _bfd_elf_create_dynamic_sections PARAMS ((bfd *, - struct bfd_link_info *)); -struct bfd_strtab_hash *_bfd_elf_stringtab_init PARAMS ((void)); -boolean -_bfd_elf_link_record_dynamic_symbol PARAMS ((struct bfd_link_info *, - struct elf_link_hash_entry *)); -long -_bfd_elf_link_lookup_local_dynindx PARAMS ((struct bfd_link_info *, - bfd *, long)); -boolean -_bfd_elf_compute_section_file_positions PARAMS ((bfd *, - struct bfd_link_info *)); -void _bfd_elf_assign_file_positions_for_relocs PARAMS ((bfd *)); -file_ptr _bfd_elf_assign_file_position_for_section PARAMS ((Elf_Internal_Shdr *, - file_ptr, - boolean)); - -extern boolean _bfd_elf_validate_reloc PARAMS ((bfd *, arelent *)); - -boolean _bfd_elf_create_dynamic_sections PARAMS ((bfd *, - struct bfd_link_info *)); -boolean _bfd_elf_create_got_section PARAMS ((bfd *, - struct bfd_link_info *)); -unsigned long _bfd_elf_link_renumber_dynsyms PARAMS ((bfd *, - struct bfd_link_info *)); - -boolean _bfd_elfcore_make_pseudosection PARAMS ((bfd *, char *, int, int)); -char *_bfd_elfcore_strndup PARAMS ((bfd *, char *, int)); - -elf_linker_section_t *_bfd_elf_create_linker_section - PARAMS ((bfd *abfd, - struct bfd_link_info *info, - enum elf_linker_section_enum, - elf_linker_section_t *defaults)); - -elf_linker_section_pointers_t *_bfd_elf_find_pointer_linker_section - PARAMS ((elf_linker_section_pointers_t *linker_pointers, - bfd_signed_vma addend, - elf_linker_section_enum_t which)); - -boolean bfd_elf32_create_pointer_linker_section - PARAMS ((bfd *abfd, - struct bfd_link_info *info, - elf_linker_section_t *lsect, - struct elf_link_hash_entry *h, - const Elf32_Internal_Rela *rel)); - -bfd_vma bfd_elf32_finish_pointer_linker_section - PARAMS ((bfd *output_abfd, - bfd *input_bfd, - struct bfd_link_info *info, - elf_linker_section_t *lsect, - struct elf_link_hash_entry *h, - bfd_vma relocation, - const Elf32_Internal_Rela *rel, - int relative_reloc)); - -boolean bfd_elf64_create_pointer_linker_section - PARAMS ((bfd *abfd, - struct bfd_link_info *info, - elf_linker_section_t *lsect, - struct elf_link_hash_entry *h, - const Elf64_Internal_Rela *rel)); - -bfd_vma bfd_elf64_finish_pointer_linker_section - PARAMS ((bfd *output_abfd, - bfd *input_bfd, - struct bfd_link_info *info, - elf_linker_section_t *lsect, - struct elf_link_hash_entry *h, - bfd_vma relocation, - const Elf64_Internal_Rela *rel, - int relative_reloc)); - -boolean _bfd_elf_make_linker_section_rela - PARAMS ((bfd *dynobj, - elf_linker_section_t *lsect, - int alignment)); - -extern const bfd_target *bfd_elf32_object_p PARAMS ((bfd *)); -extern const bfd_target *bfd_elf32_core_file_p PARAMS ((bfd *)); -extern char *bfd_elf32_core_file_failing_command PARAMS ((bfd *)); -extern int bfd_elf32_core_file_failing_signal PARAMS ((bfd *)); -extern boolean bfd_elf32_core_file_matches_executable_p PARAMS ((bfd *, - bfd *)); +extern const bfd_target *bfd_elf32_object_p + PARAMS ((bfd *)); +extern const bfd_target *bfd_elf32_core_file_p + PARAMS ((bfd *)); +extern char *bfd_elf32_core_file_failing_command + PARAMS ((bfd *)); +extern int bfd_elf32_core_file_failing_signal + PARAMS ((bfd *)); +extern boolean bfd_elf32_core_file_matches_executable_p + PARAMS ((bfd *, bfd *)); extern boolean bfd_elf32_bfd_link_add_symbols PARAMS ((bfd *, struct bfd_link_info *)); @@ -1227,9 +1291,10 @@ extern void bfd_elf32_swap_dyn_out PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR)); extern long bfd_elf32_slurp_symbol_table PARAMS ((bfd *, asymbol **, boolean)); -extern boolean bfd_elf32_write_shdrs_and_ehdr PARAMS ((bfd *)); +extern boolean bfd_elf32_write_shdrs_and_ehdr + PARAMS ((bfd *)); extern int bfd_elf32_write_out_phdrs - PARAMS ((bfd *, const Elf_Internal_Phdr *, int)); + PARAMS ((bfd *, const Elf_Internal_Phdr *, unsigned int)); extern void bfd_elf32_write_relocs PARAMS ((bfd *, asection *, PTR)); extern boolean bfd_elf32_slurp_reloc_table @@ -1241,12 +1306,16 @@ extern boolean bfd_elf32_link_create_dyn extern Elf_Internal_Rela *_bfd_elf32_link_read_relocs PARAMS ((bfd *, asection *, PTR, Elf_Internal_Rela *, boolean)); -extern const bfd_target *bfd_elf64_object_p PARAMS ((bfd *)); -extern const bfd_target *bfd_elf64_core_file_p PARAMS ((bfd *)); -extern char *bfd_elf64_core_file_failing_command PARAMS ((bfd *)); -extern int bfd_elf64_core_file_failing_signal PARAMS ((bfd *)); -extern boolean bfd_elf64_core_file_matches_executable_p PARAMS ((bfd *, - bfd *)); +extern const bfd_target *bfd_elf64_object_p + PARAMS ((bfd *)); +extern const bfd_target *bfd_elf64_core_file_p + PARAMS ((bfd *)); +extern char *bfd_elf64_core_file_failing_command + PARAMS ((bfd *)); +extern int bfd_elf64_core_file_failing_signal + PARAMS ((bfd *)); +extern boolean bfd_elf64_core_file_matches_executable_p + PARAMS ((bfd *, bfd *)); extern boolean bfd_elf64_bfd_link_add_symbols PARAMS ((bfd *, struct bfd_link_info *)); extern boolean bfd_elf64_bfd_final_link @@ -1274,9 +1343,10 @@ extern void bfd_elf64_swap_dyn_out PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR)); extern long bfd_elf64_slurp_symbol_table PARAMS ((bfd *, asymbol **, boolean)); -extern boolean bfd_elf64_write_shdrs_and_ehdr PARAMS ((bfd *)); +extern boolean bfd_elf64_write_shdrs_and_ehdr + PARAMS ((bfd *)); extern int bfd_elf64_write_out_phdrs - PARAMS ((bfd *, const Elf_Internal_Phdr *, int)); + PARAMS ((bfd *, const Elf_Internal_Phdr *, unsigned int)); extern void bfd_elf64_write_relocs PARAMS ((bfd *, asection *, PTR)); extern boolean bfd_elf64_slurp_reloc_table @@ -1293,41 +1363,43 @@ extern Elf_Internal_Rela *_bfd_elf64_lin #define bfd_elf64_link_record_dynamic_symbol \ _bfd_elf_link_record_dynamic_symbol -boolean _bfd_elf32_link_record_local_dynamic_symbol +extern boolean _bfd_elf32_link_record_local_dynamic_symbol PARAMS ((struct bfd_link_info *, bfd *, long)); -boolean _bfd_elf64_link_record_local_dynamic_symbol +extern boolean _bfd_elf64_link_record_local_dynamic_symbol PARAMS ((struct bfd_link_info *, bfd *, long)); -extern boolean _bfd_elf_close_and_cleanup PARAMS ((bfd *)); +extern boolean _bfd_elf_close_and_cleanup + PARAMS ((bfd *)); extern bfd_reloc_status_type _bfd_elf_rel_vtable_reloc_fn PARAMS ((bfd *, arelent *, struct symbol_cache_entry *, PTR, asection *, bfd *, char **)); -boolean _bfd_elf32_gc_sections - PARAMS ((bfd *abfd, struct bfd_link_info *info)); -boolean _bfd_elf32_gc_common_finalize_got_offsets - PARAMS ((bfd *abfd, struct bfd_link_info *info)); -boolean _bfd_elf32_gc_common_final_link +extern boolean _bfd_elf32_gc_sections + PARAMS ((bfd *, struct bfd_link_info *)); +extern boolean _bfd_elf32_gc_common_finalize_got_offsets PARAMS ((bfd *, struct bfd_link_info *)); -boolean _bfd_elf32_gc_record_vtinherit +extern boolean _bfd_elf32_gc_common_final_link + PARAMS ((bfd *, struct bfd_link_info *)); +extern boolean _bfd_elf32_gc_record_vtinherit PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma)); -boolean _bfd_elf32_gc_record_vtentry +extern boolean _bfd_elf32_gc_record_vtentry PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma)); -boolean _bfd_elf64_gc_sections - PARAMS ((bfd *abfd, struct bfd_link_info *info)); -boolean _bfd_elf64_gc_common_finalize_got_offsets - PARAMS ((bfd *abfd, struct bfd_link_info *info)); -boolean _bfd_elf64_gc_common_final_link +extern boolean _bfd_elf64_gc_sections + PARAMS ((bfd *, struct bfd_link_info *)); +extern boolean _bfd_elf64_gc_common_finalize_got_offsets PARAMS ((bfd *, struct bfd_link_info *)); -boolean _bfd_elf64_gc_record_vtinherit +extern boolean _bfd_elf64_gc_common_final_link + PARAMS ((bfd *, struct bfd_link_info *)); +extern boolean _bfd_elf64_gc_record_vtinherit PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma)); -boolean _bfd_elf64_gc_record_vtentry +extern boolean _bfd_elf64_gc_record_vtentry PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma)); /* MIPS ELF specific routines. */ -extern boolean _bfd_mips_elf_object_p PARAMS ((bfd *)); +extern boolean _bfd_mips_elf_object_p + PARAMS ((bfd *)); extern boolean _bfd_mips_elf_section_from_shdr PARAMS ((bfd *, Elf_Internal_Shdr *, char *)); extern boolean _bfd_mips_elf_fake_sections @@ -1336,10 +1408,12 @@ extern boolean _bfd_mips_elf_section_fro PARAMS ((bfd *, Elf_Internal_Shdr *, asection *, int *)); extern boolean _bfd_mips_elf_section_processing PARAMS ((bfd *, Elf_Internal_Shdr *)); -extern void _bfd_mips_elf_symbol_processing PARAMS ((bfd *, asymbol *)); +extern void _bfd_mips_elf_symbol_processing + PARAMS ((bfd *, asymbol *)); extern boolean _bfd_mips_elf_read_ecoff_info PARAMS ((bfd *, asection *, struct ecoff_debug_info *)); -extern void _bfd_mips_elf_final_write_processing PARAMS ((bfd *, boolean)); +extern void _bfd_mips_elf_final_write_processing + PARAMS ((bfd *, boolean)); extern bfd_reloc_status_type _bfd_mips_elf_hi16_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); extern bfd_reloc_status_type _bfd_mips_elf_lo16_reloc @@ -1350,9 +1424,12 @@ extern bfd_reloc_status_type _bfd_mips_e PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); extern bfd_reloc_status_type _bfd_mips_elf_gprel32_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -extern boolean _bfd_mips_elf_set_private_flags PARAMS ((bfd *, flagword)); -extern boolean _bfd_mips_elf_copy_private_bfd_data PARAMS ((bfd *, bfd *)); -extern boolean _bfd_mips_elf_merge_private_bfd_data PARAMS ((bfd *, bfd *)); +extern boolean _bfd_mips_elf_set_private_flags + PARAMS ((bfd *, flagword)); +extern boolean _bfd_mips_elf_copy_private_bfd_data + PARAMS ((bfd *, bfd *)); +extern boolean _bfd_mips_elf_merge_private_bfd_data + PARAMS ((bfd *, bfd *)); extern boolean _bfd_mips_elf_find_nearest_line PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, const char **, unsigned int *)); @@ -1392,14 +1469,17 @@ extern boolean _bfd_mips_elf_link_output asection *)); extern boolean _bfd_mips_elf_final_link PARAMS ((bfd *, struct bfd_link_info *)); -extern int _bfd_mips_elf_additional_program_headers PARAMS ((bfd *)); -extern boolean _bfd_mips_elf_modify_segment_map PARAMS ((bfd *)); +extern int _bfd_mips_elf_additional_program_headers + PARAMS ((bfd *)); +extern boolean _bfd_mips_elf_modify_segment_map + PARAMS ((bfd *)); extern boolean _bfd_mips_elf_relocate_section PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); /* SH ELF specific routine. */ -extern boolean _sh_elf_set_mach_from_flags PARAMS ((bfd *)); +extern boolean _sh_elf_set_mach_from_flags + PARAMS ((bfd *)); #endif /* _LIBELF_H_ */ diff -uprN binutils-2.11.90.0.31/bfd/elf-hppa.h binutils-2.11.92.0.5/bfd/elf-hppa.h --- binutils-2.11.90.0.31/bfd/elf-hppa.h Tue Jan 23 12:11:11 2001 +++ binutils-2.11.92.0.5/bfd/elf-hppa.h Mon Oct 1 15:25:21 2001 @@ -92,8 +92,8 @@ static bfd_reloc_status_type elf_hppa_fi asection *, struct elf_link_hash_entry *, struct elf64_hppa_dyn_hash_entry *)); -static unsigned int elf_hppa_relocate_insn - PARAMS ((unsigned int, unsigned int, unsigned int)); +static int elf_hppa_relocate_insn + PARAMS ((int, int, unsigned int)); #endif /* ELF/PA relocation howto entries. */ @@ -619,16 +619,16 @@ _bfd_elf_hppa_gen_reloc_type (abfd, base { elf_hppa_reloc_type *finaltype; elf_hppa_reloc_type **final_types; + bfd_size_type amt = sizeof (elf_hppa_reloc_type *) * 2; /* Allocate slots for the BFD relocation. */ - final_types = ((elf_hppa_reloc_type **) - bfd_alloc (abfd, sizeof (elf_hppa_reloc_type *) * 2)); + final_types = (elf_hppa_reloc_type **) bfd_alloc (abfd, amt); if (final_types == NULL) return NULL; /* Allocate space for the relocation itself. */ - finaltype = ((elf_hppa_reloc_type *) - bfd_alloc (abfd, sizeof (elf_hppa_reloc_type))); + amt = sizeof (elf_hppa_reloc_type); + finaltype = (elf_hppa_reloc_type *) bfd_alloc (abfd, amt); if (finaltype == NULL) return NULL; @@ -1367,7 +1367,7 @@ elf_hppa_relocate_section (output_bfd, i { (*_bfd_error_handler) (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"), - bfd_get_filename (input_bfd), h->root.root.string, + bfd_archive_filename (input_bfd), h->root.root.string, bfd_get_section_name (input_bfd, input_section)); relocation = 0; } @@ -1400,7 +1400,7 @@ elf_hppa_relocate_section (output_bfd, i { (*_bfd_error_handler) (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"), - bfd_get_filename (input_bfd), h->root.root.string, + bfd_archive_filename (input_bfd), h->root.root.string, bfd_get_section_name (input_bfd, input_section)); relocation = 0; } @@ -1484,9 +1484,9 @@ elf_hppa_final_link_relocate (rel, input struct elf_link_hash_entry *h ATTRIBUTE_UNUSED; struct elf64_hppa_dyn_hash_entry *dyn_h; { - unsigned int insn; + int insn; bfd_vma offset = rel->r_offset; - bfd_vma addend = rel->r_addend; + bfd_signed_vma addend = rel->r_addend; reloc_howto_type *howto = elf_hppa_howto_table + ELF_R_TYPE (rel->r_info); unsigned int r_type = howto->type; bfd_byte *hit_data = contents + offset; @@ -1538,7 +1538,7 @@ elf_hppa_final_link_relocate (rel, input value = hppa_field_adjust (value, -8 + addend, e_rsel); /* Apply the relocation to the given instruction. */ - insn = elf_hppa_relocate_insn (insn, value, r_type); + insn = elf_hppa_relocate_insn (insn, (int) value, r_type); break; } @@ -1570,7 +1570,7 @@ elf_hppa_final_link_relocate (rel, input value >>= 2; /* Apply the relocation to the given instruction. */ - insn = elf_hppa_relocate_insn (insn, value, r_type); + insn = elf_hppa_relocate_insn (insn, (int) value, r_type); break; } @@ -1672,7 +1672,7 @@ elf_hppa_final_link_relocate (rel, input else value = hppa_field_adjust (value, addend, e_rrsel); - insn = elf_hppa_relocate_insn (insn, value, r_type); + insn = elf_hppa_relocate_insn (insn, (int) value, r_type); break; } @@ -1709,7 +1709,7 @@ elf_hppa_final_link_relocate (rel, input else value = hppa_field_adjust (value, addend, e_rrsel); - insn = elf_hppa_relocate_insn (insn, value, r_type); + insn = elf_hppa_relocate_insn (insn, (int) value, r_type); break; } @@ -1746,7 +1746,7 @@ elf_hppa_final_link_relocate (rel, input value >>= 2; } - insn = elf_hppa_relocate_insn (insn, value, r_type); + insn = elf_hppa_relocate_insn (insn, (int) value, r_type); break; } @@ -1781,7 +1781,7 @@ elf_hppa_final_link_relocate (rel, input else value = hppa_field_adjust (value, addend, e_rrsel); - insn = elf_hppa_relocate_insn (insn, value, r_type); + insn = elf_hppa_relocate_insn (insn, (int) value, r_type); break; } @@ -1991,7 +1991,7 @@ elf_hppa_final_link_relocate (rel, input } /* Update the instruction word. */ - bfd_put_32 (input_bfd, insn, hit_data); + bfd_put_32 (input_bfd, (bfd_vma) insn, hit_data); return bfd_reloc_ok; } @@ -2001,10 +2001,10 @@ elf_hppa_final_link_relocate (rel, input Instead this routine is meant to handle the bit manipulations needed to insert the relocation into the given instruction. */ -static unsigned int +static int elf_hppa_relocate_insn (insn, sym_value, r_type) - unsigned int insn; - unsigned int sym_value; + int insn; + int sym_value; unsigned int r_type; { switch (r_type) @@ -2013,11 +2013,11 @@ elf_hppa_relocate_insn (insn, sym_value, the "B" instruction. */ case R_PARISC_PCREL22F: case R_PARISC_PCREL22C: - return (insn & ~ 0x3ff1ffd) | re_assemble_22 (sym_value); + return (insn & ~0x3ff1ffd) | re_assemble_22 (sym_value); /* This is any 12 bit branch. */ case R_PARISC_PCREL12F: - return (insn & ~ 0x1ffd) | re_assemble_12 (sym_value); + return (insn & ~0x1ffd) | re_assemble_12 (sym_value); /* This is any 17 bit branch. In PA2.0 syntax it also corresponds to the "B" instruction as well as BE. */ @@ -2026,7 +2026,7 @@ elf_hppa_relocate_insn (insn, sym_value, case R_PARISC_DIR17R: case R_PARISC_PCREL17C: case R_PARISC_PCREL17R: - return (insn & ~ 0x1f1ffd) | re_assemble_17 (sym_value); + return (insn & ~0x1f1ffd) | re_assemble_17 (sym_value); /* ADDIL or LDIL instructions. */ case R_PARISC_DLTREL21L: @@ -2037,7 +2037,7 @@ elf_hppa_relocate_insn (insn, sym_value, case R_PARISC_DPREL21L: case R_PARISC_PLTOFF21L: case R_PARISC_DIR21L: - return (insn & ~ 0x1fffff) | re_assemble_21 (sym_value); + return (insn & ~0x1fffff) | re_assemble_21 (sym_value); /* LDO and integer loads/stores with 14 bit displacements. */ case R_PARISC_DLTREL14R: @@ -2062,7 +2062,7 @@ elf_hppa_relocate_insn (insn, sym_value, case R_PARISC_DIR14F: case R_PARISC_DIR16F: case R_PARISC_LTOFF16F: - return (insn & ~ 0x3fff) | low_sign_unext (sym_value, 14); + return (insn & ~0x3fff) | low_sign_unext (sym_value, 14); /* Doubleword loads and stores with a 14 bit displacement. */ case R_PARISC_DLTREL14DR: @@ -2080,8 +2080,8 @@ elf_hppa_relocate_insn (insn, sym_value, case R_PARISC_DIR14DR: case R_PARISC_DIR16DF: case R_PARISC_LTOFF16DF: - return (insn & ~ 0x3ff1) | (((sym_value & 0x2000) >> 13) - | ((sym_value & 0x1ff8) << 1)); + return (insn & ~0x3ff1) | (((sym_value & 0x2000) >> 13) + | ((sym_value & 0x1ff8) << 1)); /* Floating point single word load/store instructions. */ case R_PARISC_DLTREL14WR: @@ -2099,8 +2099,8 @@ elf_hppa_relocate_insn (insn, sym_value, case R_PARISC_DIR16WF: case R_PARISC_DIR14WR: case R_PARISC_LTOFF16WF: - return (insn & ~ 0x3ff9) | (((sym_value & 0x2000) >> 13) - | ((sym_value & 0x1ffc) << 1)); + return (insn & ~0x3ff9) | (((sym_value & 0x2000) >> 13) + | ((sym_value & 0x1ffc) << 1)); default: return insn; diff -uprN binutils-2.11.90.0.31/bfd/elf-m10200.c binutils-2.11.92.0.5/bfd/elf-m10200.c --- binutils-2.11.90.0.31/bfd/elf-m10200.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/elf-m10200.c Mon Oct 1 15:25:21 2001 @@ -605,14 +605,13 @@ mn10200_elf_relax_section (abfd, sec, li else { /* Go get them off disk. */ - extsyms = ((Elf32_External_Sym *) - bfd_malloc (symtab_hdr->sh_size)); + bfd_size_type amt = symtab_hdr->sh_size; + extsyms = (Elf32_External_Sym *) bfd_malloc (amt); if (extsyms == NULL) goto error_return; free_extsyms = extsyms; if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0 - || (bfd_read (extsyms, 1, symtab_hdr->sh_size, abfd) - != symtab_hdr->sh_size)) + || bfd_bread (extsyms, amt, abfd) != amt) goto error_return; } } @@ -1279,7 +1278,8 @@ mn10200_elf_relax_delete_bytes (abfd, se irelend = irel + sec->reloc_count; /* Actually delete the bytes. */ - memmove (contents + addr, contents + addr + count, toaddr - addr - count); + memmove (contents + addr, contents + addr + count, + (size_t) (toaddr - addr - count)); sec->_cooked_size -= count; /* Adjust all the relocs. */ @@ -1411,7 +1411,7 @@ mn10200_elf_get_relocated_section_conten symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; memcpy (data, elf_section_data (input_section)->this_hdr.contents, - input_section->_raw_size); + (size_t) input_section->_raw_size); if ((input_section->flags & SEC_RELOC) != 0 && input_section->reloc_count > 0) @@ -1419,20 +1419,19 @@ mn10200_elf_get_relocated_section_conten Elf_Internal_Sym *isymp; asection **secpp; Elf32_External_Sym *esym, *esymend; + bfd_size_type size; if (symtab_hdr->contents != NULL) external_syms = (Elf32_External_Sym *) symtab_hdr->contents; else { - external_syms = ((Elf32_External_Sym *) - bfd_malloc (symtab_hdr->sh_info - * sizeof (Elf32_External_Sym))); - if (external_syms == NULL && symtab_hdr->sh_info > 0) + size = symtab_hdr->sh_info; + size *= sizeof (Elf32_External_Sym); + external_syms = (Elf32_External_Sym *) bfd_malloc (size); + if (external_syms == NULL && size != 0) goto error_return; if (bfd_seek (input_bfd, symtab_hdr->sh_offset, SEEK_SET) != 0 - || (bfd_read (external_syms, sizeof (Elf32_External_Sym), - symtab_hdr->sh_info, input_bfd) - != (symtab_hdr->sh_info * sizeof (Elf32_External_Sym)))) + || bfd_bread (external_syms, size, input_bfd) != size) goto error_return; } @@ -1442,15 +1441,16 @@ mn10200_elf_get_relocated_section_conten if (internal_relocs == NULL) goto error_return; - internal_syms = ((Elf_Internal_Sym *) - bfd_malloc (symtab_hdr->sh_info - * sizeof (Elf_Internal_Sym))); - if (internal_syms == NULL && symtab_hdr->sh_info > 0) + size = symtab_hdr->sh_info; + size *= sizeof (Elf_Internal_Sym); + internal_syms = (Elf_Internal_Sym *) bfd_malloc (size); + if (internal_syms == NULL && size != 0) goto error_return; - sections = (asection **) bfd_malloc (symtab_hdr->sh_info - * sizeof (asection *)); - if (sections == NULL && symtab_hdr->sh_info > 0) + size = symtab_hdr->sh_info; + size *= sizeof (asection *); + sections = (asection **) bfd_malloc (size); + if (sections == NULL && size != 0) goto error_return; isymp = internal_syms; @@ -1517,7 +1517,8 @@ mn10200_elf_get_relocated_section_conten #define TARGET_LITTLE_SYM bfd_elf32_mn10200_vec #define TARGET_LITTLE_NAME "elf32-mn10200" #define ELF_ARCH bfd_arch_mn10200 -#define ELF_MACHINE_CODE EM_CYGNUS_MN10200 +#define ELF_MACHINE_CODE EM_MN10200 +#define ELF_MACHINE_ALT1 EM_CYGNUS_MN10200 #define ELF_MAXPAGESIZE 0x1000 #define elf_info_to_howto mn10200_info_to_howto diff -uprN binutils-2.11.90.0.31/bfd/elf-m10300.c binutils-2.11.92.0.5/bfd/elf-m10300.c --- binutils-2.11.90.0.31/bfd/elf-m10300.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/elf-m10300.c Mon Oct 1 15:25:21 2001 @@ -36,7 +36,7 @@ static boolean mn10300_elf_relax_section static bfd_byte * mn10300_elf_get_relocated_section_contents PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *, boolean, asymbol **)); -static int elf_mn10300_mach PARAMS ((flagword)); +static unsigned long elf_mn10300_mach PARAMS ((flagword)); void _bfd_mn10300_elf_final_write_processing PARAMS ((bfd *, boolean)); boolean _bfd_mn10300_elf_object_p PARAMS ((bfd *)); @@ -840,15 +840,14 @@ mn10300_elf_relax_section (abfd, sec, li extsyms = (Elf32_External_Sym *) symtab_hdr->contents; else { + bfd_size_type amt = symtab_hdr->sh_size; /* Go get them off disk. */ - extsyms = ((Elf32_External_Sym *) - bfd_malloc (symtab_hdr->sh_size)); + extsyms = (Elf32_External_Sym *) bfd_malloc (amt); if (extsyms == NULL) goto error_return; free_extsyms = extsyms; if (bfd_seek (input_bfd, symtab_hdr->sh_offset, SEEK_SET) != 0 - || (bfd_read (extsyms, 1, symtab_hdr->sh_size, input_bfd) - != symtab_hdr->sh_size)) + || bfd_bread (extsyms, amt, input_bfd) != amt) goto error_return; } @@ -925,6 +924,8 @@ mn10300_elf_relax_section (abfd, sec, li { /* A local symbol. */ Elf_Internal_Sym isym; + struct elf_link_hash_table *elftab; + bfd_size_type amt; bfd_elf32_swap_symbol_in (input_bfd, extsyms + r_index, &isym); @@ -953,7 +954,8 @@ mn10300_elf_relax_section (abfd, sec, li /* Tack on an ID so we can uniquely identify this local symbol in the global hash table. */ - new_name = bfd_malloc (strlen (sym_name) + 10); + amt = strlen (sym_name) + 10; + new_name = bfd_malloc (amt); if (new_name == 0) goto error_return; @@ -961,10 +963,10 @@ mn10300_elf_relax_section (abfd, sec, li sym_name, (int) sym_sec); sym_name = new_name; - hash = (struct elf32_mn10300_link_hash_entry *) - elf_link_hash_lookup (&hash_table->static_hash_table->root, - sym_name, true, - true, false); + elftab = &hash_table->static_hash_table->root; + hash = ((struct elf32_mn10300_link_hash_entry *) + elf_link_hash_lookup (elftab, sym_name, + true, true, false)); free (new_name); } else @@ -1016,6 +1018,9 @@ mn10300_elf_relax_section (abfd, sec, li if (isym.st_shndx == shndx && ELF_ST_TYPE (isym.st_info) == STT_FUNC) { + struct elf_link_hash_table *elftab; + bfd_size_type amt; + if (isym.st_shndx == SHN_UNDEF) sym_sec = bfd_und_section_ptr; else if (isym.st_shndx > 0 @@ -1028,13 +1033,14 @@ mn10300_elf_relax_section (abfd, sec, li else if (isym.st_shndx == SHN_COMMON) sym_sec = bfd_com_section_ptr; - sym_name = bfd_elf_string_from_elf_section (input_bfd, - symtab_hdr->sh_link, - isym.st_name); + sym_name = (bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, + isym.st_name)); /* Tack on an ID so we can uniquely identify this local symbol in the global hash table. */ - new_name = bfd_malloc (strlen (sym_name) + 10); + amt = strlen (sym_name) + 10; + new_name = bfd_malloc (amt); if (new_name == 0) goto error_return; @@ -1042,10 +1048,10 @@ mn10300_elf_relax_section (abfd, sec, li sym_name, (int) sym_sec); sym_name = new_name; - hash = (struct elf32_mn10300_link_hash_entry *) - elf_link_hash_lookup (&hash_table->static_hash_table->root, - sym_name, true, - true, false); + elftab = &hash_table->static_hash_table->root; + hash = ((struct elf32_mn10300_link_hash_entry *) + elf_link_hash_lookup (elftab, sym_name, + true, true, false)); free (new_name); compute_function_info (input_bfd, hash, isym.st_value, contents); @@ -1138,15 +1144,14 @@ mn10300_elf_relax_section (abfd, sec, li extsyms = (Elf32_External_Sym *) symtab_hdr->contents; else { + bfd_size_type amt = symtab_hdr->sh_size; /* Go get them off disk. */ - extsyms = ((Elf32_External_Sym *) - bfd_malloc (symtab_hdr->sh_size)); + extsyms = (Elf32_External_Sym *) bfd_malloc (amt); if (extsyms == NULL) goto error_return; free_extsyms = extsyms; if (bfd_seek (input_bfd, symtab_hdr->sh_offset, SEEK_SET) != 0 - || (bfd_read (extsyms, 1, symtab_hdr->sh_size, input_bfd) - != symtab_hdr->sh_size)) + || bfd_bread (extsyms, amt, input_bfd) != amt) goto error_return; } @@ -1206,6 +1211,8 @@ mn10300_elf_relax_section (abfd, sec, li asection *sym_sec = NULL; const char *sym_name; char *new_name; + struct elf_link_hash_table *elftab; + bfd_size_type amt; bfd_elf32_swap_symbol_in (input_bfd, esym, &isym); @@ -1230,16 +1237,17 @@ mn10300_elf_relax_section (abfd, sec, li /* Tack on an ID so we can uniquely identify this local symbol in the global hash table. */ - new_name = bfd_malloc (strlen (sym_name) + 10); + amt = strlen (sym_name) + 10; + new_name = bfd_malloc (amt); if (new_name == 0) goto error_return; sprintf (new_name, "%s_%08x", sym_name, (int) sym_sec); sym_name = new_name; - sym_hash = (struct elf32_mn10300_link_hash_entry *) - elf_link_hash_lookup (&hash_table->static_hash_table->root, - sym_name, false, - false, false); + elftab = &hash_table->static_hash_table->root; + sym_hash = ((struct elf32_mn10300_link_hash_entry *) + elf_link_hash_lookup (elftab, sym_name, + false, false, false)); free (new_name); if (sym_hash == NULL) @@ -1455,15 +1463,14 @@ mn10300_elf_relax_section (abfd, sec, li extsyms = (Elf32_External_Sym *) symtab_hdr->contents; else { + bfd_size_type amt = symtab_hdr->sh_size; /* Go get them off disk. */ - extsyms = ((Elf32_External_Sym *) - bfd_malloc (symtab_hdr->sh_size)); + extsyms = (Elf32_External_Sym *) bfd_malloc (amt); if (extsyms == NULL) goto error_return; free_extsyms = extsyms; if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0 - || (bfd_read (extsyms, 1, symtab_hdr->sh_size, abfd) - != symtab_hdr->sh_size)) + || bfd_bread (extsyms, amt, abfd) != amt) goto error_return; } } @@ -1501,7 +1508,7 @@ mn10300_elf_relax_section (abfd, sec, li /* Tack on an ID so we can uniquely identify this local symbol in the global hash table. */ - new_name = bfd_malloc (strlen (sym_name) + 10); + new_name = bfd_malloc ((bfd_size_type) strlen (sym_name) + 10); if (new_name == 0) goto error_return; sprintf (new_name, "%s_%08x", sym_name, (int) sym_sec); @@ -2583,7 +2590,8 @@ mn10300_elf_relax_delete_bytes (abfd, se irelend = irel + sec->reloc_count; /* Actually delete the bytes. */ - memmove (contents + addr, contents + addr + count, toaddr - addr - count); + memmove (contents + addr, contents + addr + count, + (size_t) (toaddr - addr - count)); sec->_cooked_size -= count; /* Adjust all the relocs. */ @@ -2716,7 +2724,7 @@ mn10300_elf_get_relocated_section_conten symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; memcpy (data, elf_section_data (input_section)->this_hdr.contents, - input_section->_raw_size); + (size_t) input_section->_raw_size); if ((input_section->flags & SEC_RELOC) != 0 && input_section->reloc_count > 0) @@ -2724,20 +2732,19 @@ mn10300_elf_get_relocated_section_conten Elf_Internal_Sym *isymp; asection **secpp; Elf32_External_Sym *esym, *esymend; + bfd_size_type size; if (symtab_hdr->contents != NULL) external_syms = (Elf32_External_Sym *) symtab_hdr->contents; else { - external_syms = ((Elf32_External_Sym *) - bfd_malloc (symtab_hdr->sh_info - * sizeof (Elf32_External_Sym))); - if (external_syms == NULL && symtab_hdr->sh_info > 0) + size = symtab_hdr->sh_info; + size *= sizeof (Elf32_External_Sym); + external_syms = (Elf32_External_Sym *) bfd_malloc (size); + if (external_syms == NULL && size != 0) goto error_return; if (bfd_seek (input_bfd, symtab_hdr->sh_offset, SEEK_SET) != 0 - || (bfd_read (external_syms, sizeof (Elf32_External_Sym), - symtab_hdr->sh_info, input_bfd) - != (symtab_hdr->sh_info * sizeof (Elf32_External_Sym)))) + || bfd_bread (external_syms, size, input_bfd) != size) goto error_return; } @@ -2747,15 +2754,16 @@ mn10300_elf_get_relocated_section_conten if (internal_relocs == NULL) goto error_return; - internal_syms = ((Elf_Internal_Sym *) - bfd_malloc (symtab_hdr->sh_info - * sizeof (Elf_Internal_Sym))); - if (internal_syms == NULL && symtab_hdr->sh_info > 0) + size = symtab_hdr->sh_info; + size *= sizeof (Elf_Internal_Sym); + internal_syms = (Elf_Internal_Sym *) bfd_malloc (size); + if (internal_syms == NULL && size != 0) goto error_return; - sections = (asection **) bfd_malloc (symtab_hdr->sh_info - * sizeof (asection *)); - if (sections == NULL && symtab_hdr->sh_info > 0) + size = symtab_hdr->sh_info; + size *= sizeof (asection *); + sections = (asection **) bfd_malloc (size); + if (sections == NULL && size != 0) goto error_return; isymp = internal_syms; @@ -2866,9 +2874,9 @@ elf32_mn10300_link_hash_table_create (ab bfd *abfd; { struct elf32_mn10300_link_hash_table *ret; + bfd_size_type amt = sizeof (struct elf32_mn10300_link_hash_table); - ret = ((struct elf32_mn10300_link_hash_table *) - bfd_alloc (abfd, sizeof (struct elf32_mn10300_link_hash_table))); + ret = (struct elf32_mn10300_link_hash_table *) bfd_alloc (abfd, amt); if (ret == (struct elf32_mn10300_link_hash_table *) NULL) return NULL; @@ -2880,9 +2888,9 @@ elf32_mn10300_link_hash_table_create (ab } ret->flags = 0; + amt = sizeof (struct elf_link_hash_table); ret->static_hash_table - = ((struct elf32_mn10300_link_hash_table *) - bfd_alloc (abfd, sizeof (struct elf_link_hash_table))); + = (struct elf32_mn10300_link_hash_table *) bfd_alloc (abfd, amt); if (ret->static_hash_table == NULL) { bfd_release (abfd, ret); @@ -2899,7 +2907,7 @@ elf32_mn10300_link_hash_table_create (ab return &ret->root.root; } -static int +static unsigned long elf_mn10300_mach (flags) flagword flags; { @@ -2976,7 +2984,8 @@ _bfd_mn10300_elf_merge_private_bfd_data #define TARGET_LITTLE_SYM bfd_elf32_mn10300_vec #define TARGET_LITTLE_NAME "elf32-mn10300" #define ELF_ARCH bfd_arch_mn10300 -#define ELF_MACHINE_CODE EM_CYGNUS_MN10300 +#define ELF_MACHINE_CODE EM_MN10300 +#define ELF_MACHINE_ALT1 EM_CYGNUS_MN10300 #define ELF_MAXPAGESIZE 0x1000 #define elf_info_to_howto mn10300_info_to_howto diff -uprN binutils-2.11.90.0.31/bfd/elf.c binutils-2.11.92.0.5/bfd/elf.c --- binutils-2.11.90.0.31/bfd/elf.c Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/bfd/elf.c Thu Oct 4 14:35:43 2001 @@ -50,13 +50,13 @@ static boolean assign_file_positions_exc static boolean prep_headers PARAMS ((bfd *)); static boolean swap_out_syms PARAMS ((bfd *, struct bfd_strtab_hash **, int)); static boolean copy_private_bfd_data PARAMS ((bfd *, bfd *)); -static char *elf_read PARAMS ((bfd *, long, unsigned int)); +static char *elf_read PARAMS ((bfd *, file_ptr, bfd_size_type)); static void elf_fake_sections PARAMS ((bfd *, asection *, PTR)); static boolean assign_section_numbers PARAMS ((bfd *)); static INLINE int sym_is_global PARAMS ((bfd *, asymbol *)); static boolean elf_map_symbols PARAMS ((bfd *)); static bfd_size_type get_program_header_size PARAMS ((bfd *)); -static boolean elfcore_read_notes PARAMS ((bfd *, bfd_vma, bfd_vma)); +static boolean elfcore_read_notes PARAMS ((bfd *, file_ptr, bfd_size_type)); static boolean elf_find_function PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, const char **)); @@ -80,13 +80,13 @@ _bfd_elf_swap_verdef_in (abfd, src, dst) const Elf_External_Verdef *src; Elf_Internal_Verdef *dst; { - dst->vd_version = bfd_h_get_16 (abfd, src->vd_version); - dst->vd_flags = bfd_h_get_16 (abfd, src->vd_flags); - dst->vd_ndx = bfd_h_get_16 (abfd, src->vd_ndx); - dst->vd_cnt = bfd_h_get_16 (abfd, src->vd_cnt); - dst->vd_hash = bfd_h_get_32 (abfd, src->vd_hash); - dst->vd_aux = bfd_h_get_32 (abfd, src->vd_aux); - dst->vd_next = bfd_h_get_32 (abfd, src->vd_next); + dst->vd_version = H_GET_16 (abfd, src->vd_version); + dst->vd_flags = H_GET_16 (abfd, src->vd_flags); + dst->vd_ndx = H_GET_16 (abfd, src->vd_ndx); + dst->vd_cnt = H_GET_16 (abfd, src->vd_cnt); + dst->vd_hash = H_GET_32 (abfd, src->vd_hash); + dst->vd_aux = H_GET_32 (abfd, src->vd_aux); + dst->vd_next = H_GET_32 (abfd, src->vd_next); } /* Swap out a Verdef structure. */ @@ -97,13 +97,13 @@ _bfd_elf_swap_verdef_out (abfd, src, dst const Elf_Internal_Verdef *src; Elf_External_Verdef *dst; { - bfd_h_put_16 (abfd, src->vd_version, dst->vd_version); - bfd_h_put_16 (abfd, src->vd_flags, dst->vd_flags); - bfd_h_put_16 (abfd, src->vd_ndx, dst->vd_ndx); - bfd_h_put_16 (abfd, src->vd_cnt, dst->vd_cnt); - bfd_h_put_32 (abfd, src->vd_hash, dst->vd_hash); - bfd_h_put_32 (abfd, src->vd_aux, dst->vd_aux); - bfd_h_put_32 (abfd, src->vd_next, dst->vd_next); + H_PUT_16 (abfd, src->vd_version, dst->vd_version); + H_PUT_16 (abfd, src->vd_flags, dst->vd_flags); + H_PUT_16 (abfd, src->vd_ndx, dst->vd_ndx); + H_PUT_16 (abfd, src->vd_cnt, dst->vd_cnt); + H_PUT_32 (abfd, src->vd_hash, dst->vd_hash); + H_PUT_32 (abfd, src->vd_aux, dst->vd_aux); + H_PUT_32 (abfd, src->vd_next, dst->vd_next); } /* Swap in a Verdaux structure. */ @@ -114,8 +114,8 @@ _bfd_elf_swap_verdaux_in (abfd, src, dst const Elf_External_Verdaux *src; Elf_Internal_Verdaux *dst; { - dst->vda_name = bfd_h_get_32 (abfd, src->vda_name); - dst->vda_next = bfd_h_get_32 (abfd, src->vda_next); + dst->vda_name = H_GET_32 (abfd, src->vda_name); + dst->vda_next = H_GET_32 (abfd, src->vda_next); } /* Swap out a Verdaux structure. */ @@ -126,8 +126,8 @@ _bfd_elf_swap_verdaux_out (abfd, src, ds const Elf_Internal_Verdaux *src; Elf_External_Verdaux *dst; { - bfd_h_put_32 (abfd, src->vda_name, dst->vda_name); - bfd_h_put_32 (abfd, src->vda_next, dst->vda_next); + H_PUT_32 (abfd, src->vda_name, dst->vda_name); + H_PUT_32 (abfd, src->vda_next, dst->vda_next); } /* Swap in a Verneed structure. */ @@ -138,11 +138,11 @@ _bfd_elf_swap_verneed_in (abfd, src, dst const Elf_External_Verneed *src; Elf_Internal_Verneed *dst; { - dst->vn_version = bfd_h_get_16 (abfd, src->vn_version); - dst->vn_cnt = bfd_h_get_16 (abfd, src->vn_cnt); - dst->vn_file = bfd_h_get_32 (abfd, src->vn_file); - dst->vn_aux = bfd_h_get_32 (abfd, src->vn_aux); - dst->vn_next = bfd_h_get_32 (abfd, src->vn_next); + dst->vn_version = H_GET_16 (abfd, src->vn_version); + dst->vn_cnt = H_GET_16 (abfd, src->vn_cnt); + dst->vn_file = H_GET_32 (abfd, src->vn_file); + dst->vn_aux = H_GET_32 (abfd, src->vn_aux); + dst->vn_next = H_GET_32 (abfd, src->vn_next); } /* Swap out a Verneed structure. */ @@ -153,11 +153,11 @@ _bfd_elf_swap_verneed_out (abfd, src, ds const Elf_Internal_Verneed *src; Elf_External_Verneed *dst; { - bfd_h_put_16 (abfd, src->vn_version, dst->vn_version); - bfd_h_put_16 (abfd, src->vn_cnt, dst->vn_cnt); - bfd_h_put_32 (abfd, src->vn_file, dst->vn_file); - bfd_h_put_32 (abfd, src->vn_aux, dst->vn_aux); - bfd_h_put_32 (abfd, src->vn_next, dst->vn_next); + H_PUT_16 (abfd, src->vn_version, dst->vn_version); + H_PUT_16 (abfd, src->vn_cnt, dst->vn_cnt); + H_PUT_32 (abfd, src->vn_file, dst->vn_file); + H_PUT_32 (abfd, src->vn_aux, dst->vn_aux); + H_PUT_32 (abfd, src->vn_next, dst->vn_next); } /* Swap in a Vernaux structure. */ @@ -168,11 +168,11 @@ _bfd_elf_swap_vernaux_in (abfd, src, dst const Elf_External_Vernaux *src; Elf_Internal_Vernaux *dst; { - dst->vna_hash = bfd_h_get_32 (abfd, src->vna_hash); - dst->vna_flags = bfd_h_get_16 (abfd, src->vna_flags); - dst->vna_other = bfd_h_get_16 (abfd, src->vna_other); - dst->vna_name = bfd_h_get_32 (abfd, src->vna_name); - dst->vna_next = bfd_h_get_32 (abfd, src->vna_next); + dst->vna_hash = H_GET_32 (abfd, src->vna_hash); + dst->vna_flags = H_GET_16 (abfd, src->vna_flags); + dst->vna_other = H_GET_16 (abfd, src->vna_other); + dst->vna_name = H_GET_32 (abfd, src->vna_name); + dst->vna_next = H_GET_32 (abfd, src->vna_next); } /* Swap out a Vernaux structure. */ @@ -183,11 +183,11 @@ _bfd_elf_swap_vernaux_out (abfd, src, ds const Elf_Internal_Vernaux *src; Elf_External_Vernaux *dst; { - bfd_h_put_32 (abfd, src->vna_hash, dst->vna_hash); - bfd_h_put_16 (abfd, src->vna_flags, dst->vna_flags); - bfd_h_put_16 (abfd, src->vna_other, dst->vna_other); - bfd_h_put_32 (abfd, src->vna_name, dst->vna_name); - bfd_h_put_32 (abfd, src->vna_next, dst->vna_next); + H_PUT_32 (abfd, src->vna_hash, dst->vna_hash); + H_PUT_16 (abfd, src->vna_flags, dst->vna_flags); + H_PUT_16 (abfd, src->vna_other, dst->vna_other); + H_PUT_32 (abfd, src->vna_name, dst->vna_name); + H_PUT_32 (abfd, src->vna_next, dst->vna_next); } /* Swap in a Versym structure. */ @@ -198,7 +198,7 @@ _bfd_elf_swap_versym_in (abfd, src, dst) const Elf_External_Versym *src; Elf_Internal_Versym *dst; { - dst->vs_vers = bfd_h_get_16 (abfd, src->vs_vers); + dst->vs_vers = H_GET_16 (abfd, src->vs_vers); } /* Swap out a Versym structure. */ @@ -209,7 +209,7 @@ _bfd_elf_swap_versym_out (abfd, src, dst const Elf_Internal_Versym *src; Elf_External_Versym *dst; { - bfd_h_put_16 (abfd, src->vs_vers, dst->vs_vers); + H_PUT_16 (abfd, src->vs_vers, dst->vs_vers); } /* Standard ELF hash function. Do not change this function; you will @@ -245,16 +245,16 @@ bfd_elf_hash (namearg) static char * elf_read (abfd, offset, size) bfd *abfd; - long offset; - unsigned int size; + file_ptr offset; + bfd_size_type size; { char *buf; if ((buf = bfd_alloc (abfd, size)) == NULL) return NULL; - if (bfd_seek (abfd, offset, SEEK_SET) == -1) + if (bfd_seek (abfd, offset, SEEK_SET) != 0) return NULL; - if (bfd_read ((PTR) buf, size, 1, abfd) != size) + if (bfd_bread ((PTR) buf, size, abfd) != size) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_file_truncated); @@ -269,8 +269,8 @@ bfd_elf_mkobject (abfd) { /* This just does initialization. */ /* coff_mkobject zalloc's space for tdata.coff_obj_data ... */ - elf_tdata (abfd) = (struct elf_obj_tdata *) - bfd_zalloc (abfd, sizeof (struct elf_obj_tdata)); + bfd_size_type amt = sizeof (struct elf_obj_tdata); + elf_tdata (abfd) = (struct elf_obj_tdata *) bfd_zalloc (abfd, amt); if (elf_tdata (abfd) == 0) return false; /* Since everything is done at close time, do we need any @@ -294,8 +294,8 @@ bfd_elf_get_str_section (abfd, shindex) { Elf_Internal_Shdr **i_shdrp; char *shstrtab = NULL; - unsigned int offset; - unsigned int shstrtabsize; + file_ptr offset; + bfd_size_type shstrtabsize; i_shdrp = elf_elfsections (abfd); if (i_shdrp == 0 || i_shdrp[shindex] == 0) @@ -334,7 +334,7 @@ bfd_elf_string_from_elf_section (abfd, s { (*_bfd_error_handler) (_("%s: invalid string offset %u >= %lu for section `%s'"), - bfd_get_filename (abfd), strindex, (unsigned long) hdr->sh_size, + bfd_archive_filename (abfd), strindex, (unsigned long) hdr->sh_size, ((shindex == elf_elfheader(abfd)->e_shstrndx && strindex == hdr->sh_name) ? ".shstrtab" @@ -374,7 +374,7 @@ _bfd_elf_make_section_from_shdr (abfd, h if (! bfd_set_section_vma (abfd, newsect, hdr->sh_addr) || ! bfd_set_section_size (abfd, newsect, hdr->sh_size) || ! bfd_set_section_alignment (abfd, newsect, - bfd_log2 (hdr->sh_addralign))) + bfd_log2 ((bfd_vma) hdr->sh_addralign))) return false; flags = SEC_NO_FLAGS; @@ -599,21 +599,21 @@ _bfd_elf_print_private_bfd_data (abfd, f c = elf_elfheader (abfd)->e_phnum; for (i = 0; i < c; i++, p++) { - const char *s; + const char *pt; char buf[20]; switch (p->p_type) { - case PT_NULL: s = "NULL"; break; - case PT_LOAD: s = "LOAD"; break; - case PT_DYNAMIC: s = "DYNAMIC"; break; - case PT_INTERP: s = "INTERP"; break; - case PT_NOTE: s = "NOTE"; break; - case PT_SHLIB: s = "SHLIB"; break; - case PT_PHDR: s = "PHDR"; break; - default: sprintf (buf, "0x%lx", p->p_type); s = buf; break; + case PT_NULL: pt = "NULL"; break; + case PT_LOAD: pt = "LOAD"; break; + case PT_DYNAMIC: pt = "DYNAMIC"; break; + case PT_INTERP: pt = "INTERP"; break; + case PT_NOTE: pt = "NOTE"; break; + case PT_SHLIB: pt = "SHLIB"; break; + case PT_PHDR: pt = "PHDR"; break; + default: sprintf (buf, "0x%lx", p->p_type); pt = buf; break; } - fprintf (f, "%8s off 0x", s); + fprintf (f, "%8s off 0x", pt); bfd_fprintf_vma (abfd, f, p->p_offset); fprintf (f, " vaddr 0x"); bfd_fprintf_vma (abfd, f, p->p_vaddr); @@ -628,8 +628,8 @@ _bfd_elf_print_private_bfd_data (abfd, f (p->p_flags & PF_R) != 0 ? 'r' : '-', (p->p_flags & PF_W) != 0 ? 'w' : '-', (p->p_flags & PF_X) != 0 ? 'x' : '-'); - if ((p->p_flags &~ (PF_R | PF_W | PF_X)) != 0) - fprintf (f, " %lx", p->p_flags &~ (PF_R | PF_W | PF_X)); + if ((p->p_flags &~ (unsigned) (PF_R | PF_W | PF_X)) != 0) + fprintf (f, " %lx", p->p_flags &~ (unsigned) (PF_R | PF_W | PF_X)); fprintf (f, "\n"); } } @@ -638,7 +638,7 @@ _bfd_elf_print_private_bfd_data (abfd, f if (s != NULL) { int elfsec; - unsigned long link; + unsigned long shlink; bfd_byte *extdyn, *extdynend; size_t extdynsize; void (*swap_dyn_in) PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *)); @@ -655,7 +655,7 @@ _bfd_elf_print_private_bfd_data (abfd, f elfsec = _bfd_elf_section_from_bfd_section (abfd, s); if (elfsec == -1) goto error_return; - link = elf_elfsections (abfd)[elfsec]->sh_link; + shlink = elf_elfsections (abfd)[elfsec]->sh_link; extdynsize = get_elf_backend_data (abfd)->s->sizeof_dyn; swap_dyn_in = get_elf_backend_data (abfd)->s->swap_dyn_in; @@ -747,9 +747,9 @@ _bfd_elf_print_private_bfd_data (abfd, f else { const char *string; + unsigned int tagv = dyn.d_un.d_val; - string = bfd_elf_string_from_elf_section (abfd, link, - dyn.d_un.d_val); + string = bfd_elf_string_from_elf_section (abfd, shlink, tagv); if (string == NULL) goto error_return; fprintf (f, "%s", string); @@ -944,31 +944,31 @@ _bfd_elf_link_hash_newfunc (entry, table struct bfd_hash_table *table; const char *string; { - struct elf_link_hash_entry *ret = (struct elf_link_hash_entry *) entry; - /* Allocate the structure if it has not already been allocated by a subclass. */ - if (ret == (struct elf_link_hash_entry *) NULL) - ret = ((struct elf_link_hash_entry *) - bfd_hash_allocate (table, sizeof (struct elf_link_hash_entry))); - if (ret == (struct elf_link_hash_entry *) NULL) - return (struct bfd_hash_entry *) ret; + if (entry == NULL) + { + entry = bfd_hash_allocate (table, sizeof (struct elf_link_hash_entry)); + if (entry == NULL) + return entry; + } /* Call the allocation method of the superclass. */ - ret = ((struct elf_link_hash_entry *) - _bfd_link_hash_newfunc ((struct bfd_hash_entry *) ret, - table, string)); - if (ret != (struct elf_link_hash_entry *) NULL) + entry = _bfd_link_hash_newfunc (entry, table, string); + if (entry != NULL) { + struct elf_link_hash_entry *ret = (struct elf_link_hash_entry *) entry; + struct elf_link_hash_table *htab = (struct elf_link_hash_table *) table; + /* Set local fields. */ ret->indx = -1; ret->size = 0; ret->dynindx = -1; ret->dynstr_index = 0; ret->weakdef = NULL; - ret->got.offset = (bfd_vma) -1; - ret->plt.offset = (bfd_vma) -1; - ret->linker_section_pointer = (elf_linker_section_pointers_t *)0; + ret->got.refcount = htab->init_refcount; + ret->plt.refcount = htab->init_refcount; + ret->linker_section_pointer = NULL; ret->verinfo.verdef = NULL; ret->vtable_entries_used = NULL; ret->vtable_entries_size = 0; @@ -982,16 +982,18 @@ _bfd_elf_link_hash_newfunc (entry, table ret->elf_link_hash_flags = ELF_LINK_NON_ELF; } - return (struct bfd_hash_entry *) ret; + return entry; } /* Copy data from an indirect symbol to its direct symbol, hiding the - old indirect symbol. */ + old indirect symbol. Also used for copying flags to a weakdef. */ void _bfd_elf_link_hash_copy_indirect (dir, ind) struct elf_link_hash_entry *dir, *ind; { + bfd_signed_vma tmp; + /* Copy down any references that we may have already seen to the symbol which just became indirect. */ @@ -1002,21 +1004,28 @@ _bfd_elf_link_hash_copy_indirect (dir, i | ELF_LINK_HASH_REF_REGULAR_NONWEAK | ELF_LINK_NON_GOT_REF)); - /* Copy over the global and procedure linkage table offset entries. + if (dir == ind->weakdef) + return; + + /* Copy over the global and procedure linkage table refcount entries. These may have been already set up by a check_relocs routine. */ - if (dir->got.offset == (bfd_vma) -1) + tmp = dir->got.refcount; + if (tmp <= 0) { - dir->got.offset = ind->got.offset; - ind->got.offset = (bfd_vma) -1; + dir->got.refcount = ind->got.refcount; + ind->got.refcount = tmp; } - BFD_ASSERT (ind->got.offset == (bfd_vma) -1); + else + BFD_ASSERT (ind->got.refcount <= 0); - if (dir->plt.offset == (bfd_vma) -1) + tmp = dir->plt.refcount; + if (tmp <= 0) { - dir->plt.offset = ind->plt.offset; - ind->plt.offset = (bfd_vma) -1; + dir->plt.refcount = ind->plt.refcount; + ind->plt.refcount = tmp; } - BFD_ASSERT (ind->plt.offset == (bfd_vma) -1); + else + BFD_ASSERT (ind->plt.refcount <= 0); if (dir->dynindx == -1) { @@ -1025,7 +1034,8 @@ _bfd_elf_link_hash_copy_indirect (dir, i ind->dynindx = -1; ind->dynstr_index = 0; } - BFD_ASSERT (ind->dynindx == -1); + else + BFD_ASSERT (ind->dynindx == -1); } void @@ -1053,6 +1063,7 @@ _bfd_elf_link_hash_table_init (table, ab table->dynamic_sections_created = false; table->dynobj = NULL; + table->init_refcount = get_elf_backend_data (abfd)->can_refcount - 1; /* The first dynamic symbol is a dummy. */ table->dynsymcount = 1; table->dynstr = NULL; @@ -1077,9 +1088,9 @@ _bfd_elf_link_hash_table_create (abfd) bfd *abfd; { struct elf_link_hash_table *ret; + bfd_size_type amt = sizeof (struct elf_link_hash_table); - ret = ((struct elf_link_hash_table *) - bfd_alloc (abfd, sizeof (struct elf_link_hash_table))); + ret = (struct elf_link_hash_table *) bfd_alloc (abfd, amt); if (ret == (struct elf_link_hash_table *) NULL) return NULL; @@ -1168,7 +1179,7 @@ bfd_elf_get_bfd_needed_list (abfd, pneed asection *s; bfd_byte *dynbuf = NULL; int elfsec; - unsigned long link; + unsigned long shlink; bfd_byte *extdyn, *extdynend; size_t extdynsize; void (*swap_dyn_in) PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *)); @@ -1195,7 +1206,7 @@ bfd_elf_get_bfd_needed_list (abfd, pneed if (elfsec == -1) goto error_return; - link = elf_elfsections (abfd)[elfsec]->sh_link; + shlink = elf_elfsections (abfd)[elfsec]->sh_link; extdynsize = get_elf_backend_data (abfd)->s->sizeof_dyn; swap_dyn_in = get_elf_backend_data (abfd)->s->swap_dyn_in; @@ -1215,13 +1226,15 @@ bfd_elf_get_bfd_needed_list (abfd, pneed { const char *string; struct bfd_link_needed_list *l; + unsigned int tagv = dyn.d_un.d_val; + bfd_size_type amt; - string = bfd_elf_string_from_elf_section (abfd, link, - dyn.d_un.d_val); + string = bfd_elf_string_from_elf_section (abfd, shlink, tagv); if (string == NULL) goto error_return; - l = (struct bfd_link_needed_list *) bfd_alloc (abfd, sizeof *l); + amt = sizeof *l; + l = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt); if (l == NULL) goto error_return; @@ -1397,7 +1410,7 @@ bfd_section_from_shdr (abfd, shindex) { ((*_bfd_error_handler) (_("%s: invalid link %lu for reloc section %s (index %u)"), - bfd_get_filename (abfd), hdr->sh_link, name, shindex)); + bfd_archive_filename (abfd), hdr->sh_link, name, shindex)); return _bfd_elf_make_section_from_shdr (abfd, hdr, name); } @@ -1457,8 +1470,10 @@ bfd_section_from_shdr (abfd, shindex) hdr2 = &elf_section_data (target_sect)->rel_hdr; else { + bfd_size_type amt; BFD_ASSERT (elf_section_data (target_sect)->rel_hdr2 == NULL); - hdr2 = (Elf_Internal_Shdr *) bfd_alloc (abfd, sizeof (*hdr2)); + amt = sizeof (*hdr2); + hdr2 = (Elf_Internal_Shdr *) bfd_alloc (abfd, amt); elf_section_data (target_sect)->rel_hdr2 = hdr2; } *hdr2 = *hdr; @@ -1530,8 +1545,9 @@ _bfd_elf_new_section_hook (abfd, sec) asection *sec; { struct bfd_elf_section_data *sdata; + bfd_size_type amt = sizeof (*sdata); - sdata = (struct bfd_elf_section_data *) bfd_zalloc (abfd, sizeof (*sdata)); + sdata = (struct bfd_elf_section_data *) bfd_zalloc (abfd, amt); if (!sdata) return false; sec->used_by_bfd = (PTR) sdata; @@ -1581,7 +1597,7 @@ _bfd_elf_make_section_from_phdr (abfd, h && (hdr->p_filesz > 0) && (hdr->p_memsz > hdr->p_filesz)); sprintf (namebuf, "%s%d%s", typename, index, split ? "a" : ""); - name = bfd_alloc (abfd, strlen (namebuf) + 1); + name = bfd_alloc (abfd, (bfd_size_type) strlen (namebuf) + 1); if (!name) return false; strcpy (name, namebuf); @@ -1612,7 +1628,7 @@ _bfd_elf_make_section_from_phdr (abfd, h if (split) { sprintf (namebuf, "%s%db", typename, index); - name = bfd_alloc (abfd, strlen (namebuf) + 1); + name = bfd_alloc (abfd, (bfd_size_type) strlen (namebuf) + 1); if (!name) return false; strcpy (name, namebuf); @@ -1660,7 +1676,7 @@ bfd_section_from_phdr (abfd, hdr, index) case PT_NOTE: if (! _bfd_elf_make_section_from_phdr (abfd, hdr, index, "note")) return false; - if (! elfcore_read_notes (abfd, hdr->p_offset, hdr->p_filesz)) + if (! elfcore_read_notes (abfd, (file_ptr) hdr->p_offset, hdr->p_filesz)) return false; return true; @@ -1693,10 +1709,10 @@ _bfd_elf_init_reloc_shdr (abfd, rel_hdr, boolean use_rela_p; { char *name; - struct elf_backend_data *bed; + struct elf_backend_data *bed = get_elf_backend_data (abfd); + bfd_size_type amt = sizeof ".rela" + strlen (asect->name); - bed = get_elf_backend_data (abfd); - name = bfd_alloc (abfd, sizeof ".rela" + strlen (asect->name)); + name = bfd_alloc (abfd, amt); if (name == NULL) return false; sprintf (name, "%s%s", use_rela_p ? ".rela" : ".rel", asect->name); @@ -1880,6 +1896,7 @@ assign_section_numbers (abfd) asection *sec; unsigned int section_number; Elf_Internal_Shdr **i_shdrp; + bfd_size_type amt; section_number = 1; @@ -1913,13 +1930,13 @@ assign_section_numbers (abfd) /* Set up the list of section header pointers, in agreement with the indices. */ - i_shdrp = ((Elf_Internal_Shdr **) - bfd_alloc (abfd, section_number * sizeof (Elf_Internal_Shdr *))); + amt = section_number * sizeof (Elf_Internal_Shdr *); + i_shdrp = (Elf_Internal_Shdr **) bfd_alloc (abfd, amt); if (i_shdrp == NULL) return false; - i_shdrp[0] = ((Elf_Internal_Shdr *) - bfd_alloc (abfd, sizeof (Elf_Internal_Shdr))); + amt = sizeof (Elf_Internal_Shdr); + i_shdrp[0] = (Elf_Internal_Shdr *) bfd_alloc (abfd, amt); if (i_shdrp[0] == NULL) { bfd_release (abfd, i_shdrp); @@ -2001,7 +2018,7 @@ assign_section_numbers (abfd) char *alc; len = strlen (sec->name); - alc = (char *) bfd_malloc (len - 2); + alc = (char *) bfd_malloc ((bfd_size_type) len - 2); if (alc == NULL) return false; strncpy (alc, sec->name, len - 3); @@ -2067,19 +2084,19 @@ static boolean elf_map_symbols (abfd) bfd *abfd; { - int symcount = bfd_get_symcount (abfd); + unsigned int symcount = bfd_get_symcount (abfd); asymbol **syms = bfd_get_outsymbols (abfd); asymbol **sect_syms; - int num_locals = 0; - int num_globals = 0; - int num_locals2 = 0; - int num_globals2 = 0; + unsigned int num_locals = 0; + unsigned int num_globals = 0; + unsigned int num_locals2 = 0; + unsigned int num_globals2 = 0; int max_index = 0; - int num_sections = 0; - int idx; + unsigned int num_sections = 0; + unsigned int idx; asection *asect; asymbol **new_syms; - asymbol *sym; + bfd_size_type amt; #ifdef DEBUG fprintf (stderr, "elf_map_symbols\n"); @@ -2095,7 +2112,8 @@ elf_map_symbols (abfd) } max_index++; - sect_syms = (asymbol **) bfd_zalloc (abfd, max_index * sizeof (asymbol *)); + amt = max_index * sizeof (asymbol *); + sect_syms = (asymbol **) bfd_zalloc (abfd, amt); if (sect_syms == NULL) return false; elf_section_syms (abfd) = sect_syms; @@ -2103,7 +2121,7 @@ elf_map_symbols (abfd) for (idx = 0; idx < symcount; idx++) { - sym = syms[idx]; + asymbol *sym = syms[idx]; if ((sym->flags & BSF_SECTION_SYM) != 0 && sym->value == 0) @@ -2142,6 +2160,8 @@ elf_map_symbols (abfd) for (asect = abfd->sections; asect; asect = asect->next) { + asymbol *sym; + if (sect_syms[asect->index] != NULL) continue; @@ -2186,16 +2206,16 @@ elf_map_symbols (abfd) } /* Now sort the symbols so the local symbols are first. */ - new_syms = ((asymbol **) - bfd_alloc (abfd, - (num_locals + num_globals) * sizeof (asymbol *))); + amt = (num_locals + num_globals) * sizeof (asymbol *); + new_syms = (asymbol **) bfd_alloc (abfd, amt); + if (new_syms == NULL) return false; for (idx = 0; idx < symcount; idx++) { asymbol *sym = syms[idx]; - int i; + unsigned int i; if (!sym_is_global (abfd, sym)) i = num_locals2++; @@ -2210,7 +2230,7 @@ elf_map_symbols (abfd) && sect_syms[asect->index]->flags == 0) { asymbol *sym = sect_syms[asect->index]; - int i; + unsigned int i; sym->flags = BSF_SECTION_SYM; if (!sym_is_global (abfd, sym)) @@ -2368,11 +2388,11 @@ make_mapping (abfd, sections, from, to, struct elf_segment_map *m; unsigned int i; asection **hdrpp; + bfd_size_type amt; - m = ((struct elf_segment_map *) - bfd_zalloc (abfd, - (sizeof (struct elf_segment_map) - + (to - from - 1) * sizeof (asection *)))); + amt = sizeof (struct elf_segment_map); + amt += (to - from - 1) * sizeof (asection *); + m = (struct elf_segment_map *) bfd_zalloc (abfd, amt); if (m == NULL) return NULL; m->next = NULL; @@ -2411,6 +2431,7 @@ map_sections_to_segments (abfd) boolean phdr_in_segment = true; boolean writable; asection *dynsec; + bfd_size_type amt; if (elf_tdata (abfd)->segment_map != NULL) return true; @@ -2420,8 +2441,8 @@ map_sections_to_segments (abfd) /* Select the allocated sections, and sort them. */ - sections = (asection **) bfd_malloc (bfd_count_sections (abfd) - * sizeof (asection *)); + amt = bfd_count_sections (abfd) * sizeof (asection *); + sections = (asection **) bfd_malloc (amt); if (sections == NULL) goto error_return; @@ -2450,8 +2471,8 @@ map_sections_to_segments (abfd) s = bfd_get_section_by_name (abfd, ".interp"); if (s != NULL && (s->flags & SEC_LOAD) != 0) { - m = ((struct elf_segment_map *) - bfd_zalloc (abfd, sizeof (struct elf_segment_map))); + amt = sizeof (struct elf_segment_map); + m = (struct elf_segment_map *) bfd_zalloc (abfd, amt); if (m == NULL) goto error_return; m->next = NULL; @@ -2464,8 +2485,8 @@ map_sections_to_segments (abfd) *pm = m; pm = &m->next; - m = ((struct elf_segment_map *) - bfd_zalloc (abfd, sizeof (struct elf_segment_map))); + amt = sizeof (struct elf_segment_map); + m = (struct elf_segment_map *) bfd_zalloc (abfd, amt); if (m == NULL) goto error_return; m->next = NULL; @@ -2612,8 +2633,8 @@ map_sections_to_segments (abfd) /* If there is a .dynamic section, throw in a PT_DYNAMIC segment. */ if (dynsec != NULL) { - m = ((struct elf_segment_map *) - bfd_zalloc (abfd, sizeof (struct elf_segment_map))); + amt = sizeof (struct elf_segment_map); + m = (struct elf_segment_map *) bfd_zalloc (abfd, amt); if (m == NULL) goto error_return; m->next = NULL; @@ -2635,8 +2656,8 @@ map_sections_to_segments (abfd) if ((s->flags & SEC_LOAD) != 0 && strncmp (s->name, ".note", 5) == 0) { - m = ((struct elf_segment_map *) - bfd_zalloc (abfd, sizeof (struct elf_segment_map))); + amt = sizeof (struct elf_segment_map); + m = (struct elf_segment_map *) bfd_zalloc (abfd, amt); if (m == NULL) goto error_return; m->next = NULL; @@ -2734,6 +2755,7 @@ assign_file_positions_for_segments (abfd bfd_vma filehdr_vaddr, filehdr_paddr; bfd_vma phdrs_vaddr, phdrs_paddr; Elf_Internal_Phdr *p; + bfd_size_type amt; if (elf_tdata (abfd)->segment_map == NULL) { @@ -2774,8 +2796,8 @@ assign_file_positions_for_segments (abfd if (alloc == 0) alloc = count; - phdrs = ((Elf_Internal_Phdr *) - bfd_alloc (abfd, alloc * sizeof (Elf_Internal_Phdr))); + amt = alloc * sizeof (Elf_Internal_Phdr); + phdrs = (Elf_Internal_Phdr *) bfd_alloc (abfd, amt); if (phdrs == NULL) return false; @@ -3103,7 +3125,7 @@ assign_file_positions_for_segments (abfd elf_tdata (abfd)->next_file_pos = off; /* Write out the program headers. */ - if (bfd_seek (abfd, bed->s->sizeof_ehdr, SEEK_SET) != 0 + if (bfd_seek (abfd, (bfd_signed_vma) bed->s->sizeof_ehdr, SEEK_SET) != 0 || bed->s->write_out_phdrs (abfd, phdrs, alloc) != 0) return false; @@ -3348,119 +3370,22 @@ prep_headers (abfd) case bfd_arch_unknown: i_ehdrp->e_machine = EM_NONE; break; - case bfd_arch_sparc: - if (bfd_get_arch_size (abfd) == 64) - i_ehdrp->e_machine = EM_SPARCV9; - else - i_ehdrp->e_machine = EM_SPARC; - break; - case bfd_arch_i370: - i_ehdrp->e_machine = EM_S370; - break; - case bfd_arch_i386: - if (bfd_get_arch_size (abfd) == 64) - i_ehdrp->e_machine = EM_X86_64; - else - i_ehdrp->e_machine = EM_386; - break; - case bfd_arch_ia64: - i_ehdrp->e_machine = EM_IA_64; - break; - case bfd_arch_m68hc11: - i_ehdrp->e_machine = EM_68HC11; - break; - case bfd_arch_m68hc12: - i_ehdrp->e_machine = EM_68HC12; - break; - case bfd_arch_s390: - i_ehdrp->e_machine = EM_S390; - break; - case bfd_arch_m68k: - i_ehdrp->e_machine = EM_68K; - break; - case bfd_arch_m88k: - i_ehdrp->e_machine = EM_88K; - break; - case bfd_arch_i860: - i_ehdrp->e_machine = EM_860; - break; - case bfd_arch_i960: - i_ehdrp->e_machine = EM_960; - break; - case bfd_arch_mips: /* MIPS Rxxxx */ - i_ehdrp->e_machine = EM_MIPS; /* only MIPS R3000 */ - break; - case bfd_arch_hppa: - i_ehdrp->e_machine = EM_PARISC; - break; - case bfd_arch_powerpc: - if (bed->s->arch_size == 64) - i_ehdrp->e_machine = EM_PPC64; - else - i_ehdrp->e_machine = EM_PPC; - break; - case bfd_arch_alpha: - i_ehdrp->e_machine = EM_ALPHA; - break; - case bfd_arch_sh: - i_ehdrp->e_machine = EM_SH; - break; - case bfd_arch_d10v: - i_ehdrp->e_machine = EM_CYGNUS_D10V; - break; - case bfd_arch_d30v: - i_ehdrp->e_machine = EM_CYGNUS_D30V; - break; - case bfd_arch_fr30: - i_ehdrp->e_machine = EM_CYGNUS_FR30; - break; - case bfd_arch_mcore: - i_ehdrp->e_machine = EM_MCORE; - break; - case bfd_arch_avr: - i_ehdrp->e_machine = EM_AVR; - break; - case bfd_arch_v850: - switch (bfd_get_mach (abfd)) - { - default: - case 0: i_ehdrp->e_machine = EM_CYGNUS_V850; break; - } - break; - case bfd_arch_arc: - i_ehdrp->e_machine = EM_CYGNUS_ARC; - break; - case bfd_arch_arm: - i_ehdrp->e_machine = EM_ARM; - break; - case bfd_arch_m32r: - i_ehdrp->e_machine = EM_CYGNUS_M32R; - break; - case bfd_arch_mn10200: - i_ehdrp->e_machine = EM_CYGNUS_MN10200; - break; - case bfd_arch_mn10300: - i_ehdrp->e_machine = EM_CYGNUS_MN10300; - break; - case bfd_arch_pj: - i_ehdrp->e_machine = EM_PJ; - break; - case bfd_arch_cris: - i_ehdrp->e_machine = EM_CRIS; - break; - case bfd_arch_openrisc: - i_ehdrp->e_machine = EM_OPENRISC; - break; - /* Also note that EM_M32, AT&T WE32100 is unknown to bfd. */ - case bfd_arch_h8300: - i_ehdrp->e_machine = EM_H8_300; - break; - case bfd_arch_h8500: - i_ehdrp->e_machine = EM_H8_500; - break; + + /* There used to be a long list of cases here, each one setting + e_machine to the same EM_* macro #defined as ELF_MACHINE_CODE + in the corresponding bfd definition. To avoid duplication, + the switch was removed. Machines that need special handling + can generally do it in elf_backend_final_write_processing(), + unless they need the information earlier than the final write. + Such need can generally be supplied by replacing the tests for + e_machine with the conditions used to determine it. */ default: - i_ehdrp->e_machine = EM_NONE; - } + if (get_elf_backend_data (abfd) != NULL) + i_ehdrp->e_machine = get_elf_backend_data (abfd)->elf_machine_code; + else + i_ehdrp->e_machine = EM_NONE; + } + i_ehdrp->e_version = bed->s->ev_current; i_ehdrp->e_ehsize = bed->s->sizeof_ehdr; @@ -3568,10 +3493,10 @@ _bfd_elf_write_object_contents (abfd) (*bed->elf_backend_section_processing) (abfd, i_shdrp[count]); if (i_shdrp[count]->contents) { + bfd_size_type amt = i_shdrp[count]->sh_size; + if (bfd_seek (abfd, i_shdrp[count]->sh_offset, SEEK_SET) != 0 - || (bfd_write (i_shdrp[count]->contents, i_shdrp[count]->sh_size, - 1, abfd) - != i_shdrp[count]->sh_size)) + || bfd_bwrite (i_shdrp[count]->contents, amt, abfd) != amt) return false; } } @@ -3682,7 +3607,7 @@ _bfd_elf_symbol_from_bfd_symbol (abfd, a which is used in a relocation entry. */ (*_bfd_error_handler) (_("%s: symbol `%s' required but not present"), - bfd_get_filename (abfd), bfd_asymbol_name (asym_ptr)); + bfd_archive_filename (abfd), bfd_asymbol_name (asym_ptr)); bfd_set_error (bfd_error_no_symbols); return -1; } @@ -3877,6 +3802,7 @@ copy_private_bfd_data (ibfd, obfd) bfd_vma matching_lma; bfd_vma suggested_lma; unsigned int j; + bfd_size_type amt; if (segment->p_type == PT_NULL) continue; @@ -3889,10 +3815,9 @@ copy_private_bfd_data (ibfd, obfd) /* Allocate a segment map big enough to contain all of the sections we have selected. */ - map = ((struct elf_segment_map *) - bfd_alloc (obfd, - (sizeof (struct elf_segment_map) - + ((size_t) section_count - 1) * sizeof (asection *)))); + amt = sizeof (struct elf_segment_map); + amt += ((bfd_size_type) section_count - 1) * sizeof (asection *); + map = (struct elf_segment_map *) bfd_alloc (obfd, amt); if (map == NULL) return false; @@ -3932,7 +3857,7 @@ copy_private_bfd_data (ibfd, obfd) if (segment->p_type == PT_LOAD) _bfd_error_handler (_("%s: warning: Empty loadable segment detected\n"), - bfd_get_filename (ibfd)); + bfd_archive_filename (ibfd)); map->count = 0; *pointer_to_map = map; @@ -3969,8 +3894,8 @@ copy_private_bfd_data (ibfd, obfd) pointers that we are interested in. As these sections get assigned to a segment, they are removed from this array. */ - sections = (asection **) bfd_malloc - (sizeof (asection *) * section_count); + amt = (bfd_size_type) section_count * sizeof (asection *); + sections = (asection **) bfd_malloc (amt); if (sections == NULL) return false; @@ -4162,11 +4087,9 @@ copy_private_bfd_data (ibfd, obfd) /* We still have not allocated all of the sections to segments. Create a new segment here, initialise it and carry on looping. */ - map = ((struct elf_segment_map *) - bfd_alloc (obfd, - (sizeof (struct elf_segment_map) - + ((size_t) section_count - 1) - * sizeof (asection *)))); + amt = sizeof (struct elf_segment_map); + amt += ((bfd_size_type) section_count - 1) * sizeof (asection *); + map = (struct elf_segment_map *) bfd_alloc (obfd, amt); if (map == NULL) return false; @@ -4381,6 +4304,7 @@ swap_out_syms (abfd, sttp, relocatable_p Elf_Internal_Shdr *symstrtab_hdr; char *outbound_syms; int idx; + bfd_size_type amt; stt = _bfd_elf_stringtab_init (); if (stt == NULL) @@ -4396,8 +4320,8 @@ swap_out_syms (abfd, sttp, relocatable_p symstrtab_hdr = &elf_tdata (abfd)->strtab_hdr; symstrtab_hdr->sh_type = SHT_STRTAB; - outbound_syms = bfd_alloc (abfd, - (1 + symcount) * bed->s->sizeof_sym); + amt = (bfd_size_type) (1 + symcount) * bed->s->sizeof_sym; + outbound_syms = bfd_alloc (abfd, amt); if (outbound_syms == NULL) return false; symtab_hdr->contents = (PTR) outbound_syms; @@ -4771,6 +4695,7 @@ _bfd_elf_slurp_version_tables (abfd) bfd *abfd; { bfd_byte *contents = NULL; + bfd_size_type amt; if (elf_dynverdef (abfd) != 0) { @@ -4788,7 +4713,7 @@ _bfd_elf_slurp_version_tables (abfd) if (contents == NULL) goto error_return; if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0 - || bfd_read ((PTR) contents, 1, hdr->sh_size, abfd) != hdr->sh_size) + || bfd_bread ((PTR) contents, hdr->sh_size, abfd) != hdr->sh_size) goto error_return; /* We know the number of entries in the section but not the maximum @@ -4807,9 +4732,8 @@ _bfd_elf_slurp_version_tables (abfd) ((bfd_byte *) everdef + iverdefmem.vd_next)); } - elf_tdata (abfd)->verdef = - ((Elf_Internal_Verdef *) - bfd_zalloc (abfd, maxidx * sizeof (Elf_Internal_Verdef))); + amt = (bfd_size_type) maxidx * sizeof (Elf_Internal_Verdef); + elf_tdata (abfd)->verdef = (Elf_Internal_Verdef *) bfd_zalloc (abfd, amt); if (elf_tdata (abfd)->verdef == NULL) goto error_return; @@ -4830,10 +4754,8 @@ _bfd_elf_slurp_version_tables (abfd) iverdef->vd_bfd = abfd; - iverdef->vd_auxptr = ((Elf_Internal_Verdaux *) - bfd_alloc (abfd, - (iverdef->vd_cnt - * sizeof (Elf_Internal_Verdaux)))); + amt = (bfd_size_type) iverdef->vd_cnt * sizeof (Elf_Internal_Verdaux); + iverdef->vd_auxptr = (Elf_Internal_Verdaux *) bfd_alloc (abfd, amt); if (iverdef->vd_auxptr == NULL) goto error_return; @@ -4883,9 +4805,9 @@ _bfd_elf_slurp_version_tables (abfd) hdr = &elf_tdata (abfd)->dynverref_hdr; + amt = (bfd_size_type) hdr->sh_info * sizeof (Elf_Internal_Verneed); elf_tdata (abfd)->verref = - ((Elf_Internal_Verneed *) - bfd_zalloc (abfd, hdr->sh_info * sizeof (Elf_Internal_Verneed))); + (Elf_Internal_Verneed *) bfd_zalloc (abfd, amt); if (elf_tdata (abfd)->verref == NULL) goto error_return; @@ -4895,7 +4817,7 @@ _bfd_elf_slurp_version_tables (abfd) if (contents == NULL) goto error_return; if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0 - || bfd_read ((PTR) contents, 1, hdr->sh_size, abfd) != hdr->sh_size) + || bfd_bread ((PTR) contents, hdr->sh_size, abfd) != hdr->sh_size) goto error_return; everneed = (Elf_External_Verneed *) contents; @@ -4916,10 +4838,9 @@ _bfd_elf_slurp_version_tables (abfd) if (iverneed->vn_filename == NULL) goto error_return; - iverneed->vn_auxptr = - ((Elf_Internal_Vernaux *) - bfd_alloc (abfd, - iverneed->vn_cnt * sizeof (Elf_Internal_Vernaux))); + amt = iverneed->vn_cnt; + amt *= sizeof (Elf_Internal_Vernaux); + iverneed->vn_auxptr = (Elf_Internal_Vernaux *) bfd_alloc (abfd, amt); evernaux = ((Elf_External_Vernaux *) ((bfd_byte *) everneed + iverneed->vn_aux)); @@ -4969,8 +4890,9 @@ _bfd_elf_make_empty_symbol (abfd) bfd *abfd; { elf_symbol_type *newsym; + bfd_size_type amt = sizeof (elf_symbol_type); - newsym = (elf_symbol_type *) bfd_zalloc (abfd, sizeof (elf_symbol_type)); + newsym = (elf_symbol_type *) bfd_zalloc (abfd, amt); if (!newsym) return NULL; else @@ -5188,6 +5110,7 @@ _bfd_elf_set_section_contents (abfd, sec bfd_size_type count; { Elf_Internal_Shdr *hdr; + bfd_signed_vma pos; if (! abfd->output_has_begun && ! _bfd_elf_compute_section_file_positions @@ -5195,10 +5118,9 @@ _bfd_elf_set_section_contents (abfd, sec return false; hdr = &elf_section_data (section)->this_hdr; - - if (bfd_seek (abfd, hdr->sh_offset + offset, SEEK_SET) == -1) - return false; - if (bfd_write (location, 1, count, abfd) != count) + pos = hdr->sh_offset + offset; + if (bfd_seek (abfd, pos, SEEK_SET) != 0 + || bfd_bwrite (location, count, abfd) != count) return false; return true; @@ -5317,7 +5239,7 @@ _bfd_elf_validate_reloc (abfd, areloc) fail: (*_bfd_error_handler) (_("%s: unsupported relocation type %s"), - bfd_get_filename (abfd), areloc->howto->name); + bfd_archive_filename (abfd), areloc->howto->name); bfd_set_error (bfd_error_bad_value); return false; } @@ -5410,8 +5332,8 @@ boolean _bfd_elfcore_make_pseudosection (abfd, name, size, filepos) bfd *abfd; char *name; - int size; - int filepos; + size_t size; + ufile_ptr filepos; { char buf[100]; char *threaded_name; @@ -5420,7 +5342,7 @@ _bfd_elfcore_make_pseudosection (abfd, n /* Build the section name. */ sprintf (buf, "%s/%d", name, elfcore_make_pid (abfd)); - threaded_name = bfd_alloc (abfd, strlen (buf) + 1); + threaded_name = bfd_alloc (abfd, (bfd_size_type) strlen (buf) + 1); if (threaded_name == NULL) return false; strcpy (threaded_name, buf); @@ -5450,7 +5372,7 @@ elfcore_grok_prstatus (abfd, note) bfd *abfd; Elf_Internal_Note *note; { - int raw_size; + size_t raw_size; int offset; if (note->descsz == sizeof (prstatus_t)) @@ -5568,25 +5490,25 @@ char * _bfd_elfcore_strndup (abfd, start, max) bfd *abfd; char *start; - int max; + size_t max; { - char *dup; + char *dups; char *end = memchr (start, '\0', max); - int len; + size_t len; if (end == NULL) len = max; else len = end - start; - dup = bfd_alloc (abfd, len + 1); - if (dup == NULL) + dups = bfd_alloc (abfd, (bfd_size_type) len + 1); + if (dups == NULL) return NULL; - memcpy (dup, start, len); - dup[len] = '\0'; + memcpy (dups, start, len); + dups[len] = '\0'; - return dup; + return dups; } #if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T) @@ -5715,7 +5637,7 @@ elfcore_grok_lwpstatus (abfd, note) /* Make a ".reg/999" section. */ sprintf (buf, ".reg/%d", elfcore_make_pid (abfd)); - name = bfd_alloc (abfd, strlen (buf) + 1); + name = bfd_alloc (abfd, (bfd_size_type) strlen (buf) + 1); if (name == NULL) return false; strcpy (name, buf); @@ -5744,7 +5666,7 @@ elfcore_grok_lwpstatus (abfd, note) /* Make a ".reg2/999" section */ sprintf (buf, ".reg2/%d", elfcore_make_pid (abfd)); - name = bfd_alloc (abfd, strlen (buf) + 1); + name = bfd_alloc (abfd, (bfd_size_type) strlen (buf) + 1); if (name == NULL) return false; strcpy (name, buf); @@ -5799,7 +5721,7 @@ elfcore_grok_win32pstatus (abfd, note) /* Make a ".reg/999" section. */ sprintf (buf, ".reg/%d", pstatus.data.thread_info.tid); - name = bfd_alloc (abfd, strlen (buf) + 1); + name = bfd_alloc (abfd, (bfd_size_type) strlen (buf) + 1); if (name == NULL) return false; @@ -5824,7 +5746,7 @@ elfcore_grok_win32pstatus (abfd, note) /* Make a ".module/xxxxxxxx" section. */ sprintf (buf, ".module/%08x", pstatus.data.module_info.base_address); - name = bfd_alloc (abfd, strlen (buf) + 1); + name = bfd_alloc (abfd, (bfd_size_type) strlen (buf) + 1); if (name == NULL) return false; @@ -5912,8 +5834,8 @@ elfcore_grok_note (abfd, note) static boolean elfcore_read_notes (abfd, offset, size) bfd *abfd; - bfd_vma offset; - bfd_vma size; + file_ptr offset; + bfd_size_type size; { char *buf; char *p; @@ -5921,14 +5843,14 @@ elfcore_read_notes (abfd, offset, size) if (size <= 0) return true; - if (bfd_seek (abfd, offset, SEEK_SET) == -1) + if (bfd_seek (abfd, offset, SEEK_SET) != 0) return false; - buf = bfd_malloc ((size_t) size); + buf = bfd_malloc (size); if (buf == NULL) return false; - if (bfd_read (buf, size, 1, abfd) != size) + if (bfd_bread (buf, size, abfd) != size) { error: free (buf); @@ -5942,12 +5864,12 @@ elfcore_read_notes (abfd, offset, size) Elf_External_Note *xnp = (Elf_External_Note *) p; Elf_Internal_Note in; - in.type = bfd_h_get_32 (abfd, (bfd_byte *) xnp->type); + in.type = H_GET_32 (abfd, xnp->type); - in.namesz = bfd_h_get_32 (abfd, (bfd_byte *) xnp->namesz); + in.namesz = H_GET_32 (abfd, xnp->namesz); in.namedata = xnp->name; - in.descsz = bfd_h_get_32 (abfd, (bfd_byte *) xnp->descsz); + in.descsz = H_GET_32 (abfd, xnp->descsz); in.descdata = in.namedata + BFD_ALIGN (in.namesz, 4); in.descpos = offset + (in.descdata - buf); @@ -6072,8 +5994,8 @@ _bfd_elf_fprintf_vma (abfd, stream, valu } enum elf_reloc_type_class -_bfd_elf_reloc_type_class (type) - int type ATTRIBUTE_UNUSED; +_bfd_elf_reloc_type_class (rela) + const Elf_Internal_Rela *rela ATTRIBUTE_UNUSED; { return reloc_class_normal; } diff -uprN binutils-2.11.90.0.31/bfd/elf32-arc.c binutils-2.11.92.0.5/bfd/elf32-arc.c --- binutils-2.11.90.0.31/bfd/elf32-arc.c Fri Aug 10 14:08:01 2001 +++ binutils-2.11.92.0.5/bfd/elf32-arc.c Thu Oct 4 14:35:43 2001 @@ -23,6 +23,7 @@ #include "libbfd.h" #include "elf-bfd.h" #include "elf/arc.h" +#include "libiberty.h" static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); @@ -32,6 +33,8 @@ static boolean arc_elf_object_p PARAMS ((bfd *)); static void arc_elf_final_write_processing PARAMS ((bfd *, boolean)); +static bfd_reloc_status_type arc_elf_b22_pcrel + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); /* Try to minimize the amount of space occupied by relocation tables on the ROM (not that the ROM won't be swamped by other ELF overhead). */ @@ -93,13 +96,12 @@ static reloc_howto_type elf_arc_howto_ta true, /* pc_relative */ 7, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + arc_elf_b22_pcrel, /* special_function */ "R_ARC_B22_PCREL", /* name */ true, /* partial_inplace */ 0x07ffff80, /* src_mask */ 0x07ffff80, /* dst_mask */ false), /* pcrel_offset */ - }; /* Map BFD reloc types to ARC ELF reloc types. */ @@ -126,11 +128,10 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, c { unsigned int i; - for (i = 0; i < sizeof (arc_reloc_map) / sizeof (struct arc_reloc_map); i++) - { - if (arc_reloc_map[i].bfd_reloc_val == code) - return &elf_arc_howto_table[arc_reloc_map[i].elf_reloc_val]; - } + for (i = ARRAY_SIZE (arc_reloc_map); i--;) + if (arc_reloc_map[i].bfd_reloc_val == code) + return elf_arc_howto_table + arc_reloc_map[i].elf_reloc_val; + return NULL; } @@ -155,7 +156,7 @@ static boolean arc_elf_object_p (abfd) bfd *abfd; { - int mach = bfd_mach_arc_6; + unsigned int mach = bfd_mach_arc_6; if (elf_elfheader(abfd)->e_machine == EM_ARC) { @@ -207,11 +208,34 @@ arc_elf_final_write_processing (abfd, li val = E_ARC_MACH_ARC8; break; } - elf_elfheader (abfd)->e_machine = EM_ARC; elf_elfheader (abfd)->e_flags &=~ EF_ARC_MACH; elf_elfheader (abfd)->e_flags |= val; } +bfd_reloc_status_type +arc_elf_b22_pcrel (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; +{ + /* If linking, back up the final symbol address by the address of the + reloc. This cannot be accomplished by setting the pcrel_offset + field to true, as bfd_install_relocation will detect this and refuse + to install the offset in the first place, but bfd_perform_relocation + will still insist on removing it. */ + if (output_bfd == (bfd *) NULL) + reloc_entry->addend -= reloc_entry->address; + + /* Fall through to the default elf reloc handler. */ + return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message); +} + #define TARGET_LITTLE_SYM bfd_elf32_littlearc_vec #define TARGET_LITTLE_NAME "elf32-littlearc" #define TARGET_BIG_SYM bfd_elf32_bigarc_vec diff -uprN binutils-2.11.90.0.31/bfd/elf32-arm.h binutils-2.11.92.0.5/bfd/elf32-arm.h --- binutils-2.11.90.0.31/bfd/elf32-arm.h Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/elf32-arm.h Mon Oct 1 15:25:21 2001 @@ -35,7 +35,7 @@ static struct bfd_link_hash_table *elf32 static bfd_reloc_status_type elf32_arm_final_link_relocate PARAMS ((reloc_howto_type *, bfd *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, bfd_vma, struct bfd_link_info *, asection *, - const char *, unsigned char, struct elf_link_hash_entry *)); + const char *, int, struct elf_link_hash_entry *)); static insn32 insert_thumb_branch PARAMS ((insn32, int)); static struct elf_link_hash_entry *find_thumb_glue @@ -92,7 +92,7 @@ boolean bfd_elf32_arm_get_bfd_for_interw boolean bfd_elf32_arm_process_before_allocation PARAMS ((bfd *, struct bfd_link_info *, int)); static enum elf_reloc_type_class elf32_arm_reloc_type_class - PARAMS ((int)); + PARAMS ((const Elf_Internal_Rela *)); #define INTERWORK_FLAG(abfd) (elf_elfheader (abfd)->e_flags & EF_ARM_INTERWORK) @@ -117,7 +117,7 @@ static enum elf_reloc_type_class elf32_a this. It is set up so that any shared library function that is called before the relocation has been set up calls the dynamic linker first. */ -static const unsigned long elf32_arm_plt0_entry [PLT_ENTRY_SIZE / 4] = +static const bfd_vma elf32_arm_plt0_entry [PLT_ENTRY_SIZE / 4] = { 0xe52de004, /* str lr, [sp, #-4]! */ 0xe59fe010, /* ldr lr, [pc, #16] */ @@ -127,7 +127,7 @@ static const unsigned long elf32_arm_plt /* Subsequent entries in a procedure linkage table look like this. */ -static const unsigned long elf32_arm_plt_entry [PLT_ENTRY_SIZE / 4] = +static const bfd_vma elf32_arm_plt_entry [PLT_ENTRY_SIZE / 4] = { 0xe59fc004, /* ldr ip, [pc, #4] */ 0xe08fc00c, /* add ip, pc, ip */ @@ -184,10 +184,10 @@ struct elf32_arm_link_hash_table struct elf_link_hash_table root; /* The size in bytes of the section containg the Thumb-to-ARM glue. */ - long int thumb_glue_size; + bfd_size_type thumb_glue_size; /* The size in bytes of the section containg the ARM-to-Thumb glue. */ - long int arm_glue_size; + bfd_size_type arm_glue_size; /* An arbitary input BFD chosen to hold the glue sections. */ bfd * bfd_of_glue_owner; @@ -234,9 +234,9 @@ elf32_arm_link_hash_table_create (abfd) bfd *abfd; { struct elf32_arm_link_hash_table *ret; + bfd_size_type amt = sizeof (struct elf32_arm_link_hash_table); - ret = ((struct elf32_arm_link_hash_table *) - bfd_alloc (abfd, sizeof (struct elf32_arm_link_hash_table))); + ret = (struct elf32_arm_link_hash_table *) bfd_alloc (abfd, amt); if (ret == (struct elf32_arm_link_hash_table *) NULL) return NULL; @@ -270,8 +270,8 @@ find_thumb_glue (link_info, name, input_ /* We need a pointer to the armelf specific hash table. */ hash_table = elf32_arm_hash_table (link_info); - tmp_name = ((char *) - bfd_malloc (strlen (name) + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1)); + tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name) + + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1); BFD_ASSERT (tmp_name); @@ -282,8 +282,8 @@ find_thumb_glue (link_info, name, input_ if (hash == NULL) /* xgettext:c-format */ - _bfd_error_handler (_("%s: unable to find THUMB glue '%s' for `%s'"), - bfd_get_filename (input_bfd), tmp_name, name); + (*_bfd_error_handler) (_("%s: unable to find THUMB glue '%s' for `%s'"), + bfd_archive_filename (input_bfd), tmp_name, name); free (tmp_name); @@ -305,8 +305,8 @@ find_arm_glue (link_info, name, input_bf /* We need a pointer to the elfarm specific hash table. */ hash_table = elf32_arm_hash_table (link_info); - tmp_name = ((char *) - bfd_malloc (strlen (name) + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1)); + tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name) + + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1); BFD_ASSERT (tmp_name); @@ -317,8 +317,8 @@ find_arm_glue (link_info, name, input_bf if (myh == NULL) /* xgettext:c-format */ - _bfd_error_handler (_("%s: unable to find ARM glue '%s' for `%s'"), - bfd_get_filename (input_bfd), tmp_name, name); + (*_bfd_error_handler) (_("%s: unable to find ARM glue '%s' for `%s'"), + bfd_archive_filename (input_bfd), tmp_name, name); free (tmp_name); @@ -383,13 +383,13 @@ bfd_elf32_arm_allocate_interworking_sect { BFD_ASSERT (globals->bfd_of_glue_owner != NULL); - s = bfd_get_section_by_name - (globals->bfd_of_glue_owner, ARM2THUMB_GLUE_SECTION_NAME); + s = bfd_get_section_by_name (globals->bfd_of_glue_owner, + ARM2THUMB_GLUE_SECTION_NAME); BFD_ASSERT (s != NULL); - foo = (bfd_byte *) bfd_alloc - (globals->bfd_of_glue_owner, globals->arm_glue_size); + foo = (bfd_byte *) bfd_alloc (globals->bfd_of_glue_owner, + globals->arm_glue_size); s->_raw_size = s->_cooked_size = globals->arm_glue_size; s->contents = foo; @@ -404,8 +404,8 @@ bfd_elf32_arm_allocate_interworking_sect BFD_ASSERT (s != NULL); - foo = (bfd_byte *) bfd_alloc - (globals->bfd_of_glue_owner, globals->thumb_glue_size); + foo = (bfd_byte *) bfd_alloc (globals->bfd_of_glue_owner, + globals->thumb_glue_size); s->_raw_size = s->_cooked_size = globals->thumb_glue_size; s->contents = foo; @@ -420,10 +420,11 @@ record_arm_to_thumb_glue (link_info, h) struct elf_link_hash_entry * h; { const char * name = h->root.root.string; - register asection * s; + asection * s; char * tmp_name; struct elf_link_hash_entry * myh; struct elf32_arm_link_hash_table * globals; + bfd_vma val; globals = elf32_arm_hash_table (link_info); @@ -435,8 +436,8 @@ record_arm_to_thumb_glue (link_info, h) BFD_ASSERT (s != NULL); - tmp_name = ((char *) - bfd_malloc (strlen (name) + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1)); + tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name) + + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1); BFD_ASSERT (tmp_name); @@ -455,9 +456,9 @@ record_arm_to_thumb_glue (link_info, h) /* The only trick here is using hash_table->arm_glue_size as the value. Even though the section isn't allocated yet, this is where we will be putting it. */ - _bfd_generic_link_add_one_symbol (link_info, globals->bfd_of_glue_owner, tmp_name, - BSF_GLOBAL, - s, globals->arm_glue_size + 1, + val = globals->arm_glue_size + 1; + _bfd_generic_link_add_one_symbol (link_info, globals->bfd_of_glue_owner, + tmp_name, BSF_GLOBAL, s, val, NULL, true, false, (struct bfd_link_hash_entry **) &myh); @@ -474,11 +475,12 @@ record_thumb_to_arm_glue (link_info, h) struct elf_link_hash_entry *h; { const char *name = h->root.root.string; - register asection *s; + asection *s; char *tmp_name; struct elf_link_hash_entry *myh; struct elf32_arm_link_hash_table *hash_table; char bind; + bfd_vma val; hash_table = elf32_arm_hash_table (link_info); @@ -490,7 +492,8 @@ record_thumb_to_arm_glue (link_info, h) BFD_ASSERT (s != NULL); - tmp_name = (char *) bfd_malloc (strlen (name) + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1); + tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name) + + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1); BFD_ASSERT (tmp_name); @@ -506,8 +509,9 @@ record_thumb_to_arm_glue (link_info, h) return; } - _bfd_generic_link_add_one_symbol (link_info, hash_table->bfd_of_glue_owner, tmp_name, - BSF_GLOBAL, s, hash_table->thumb_glue_size + 1, + val = hash_table->thumb_glue_size + 1; + _bfd_generic_link_add_one_symbol (link_info, hash_table->bfd_of_glue_owner, + tmp_name, BSF_GLOBAL, s, val, NULL, true, false, (struct bfd_link_hash_entry **) &myh); @@ -521,7 +525,8 @@ record_thumb_to_arm_glue (link_info, h) #define BACK_FROM_ARM "__%s_back_from_arm" /* Allocate another symbol to mark where we switch to Arm mode. */ - tmp_name = (char *) bfd_malloc (strlen (name) + strlen (CHANGE_TO_ARM) + 1); + tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name) + + strlen (CHANGE_TO_ARM) + 1); BFD_ASSERT (tmp_name); @@ -529,8 +534,9 @@ record_thumb_to_arm_glue (link_info, h) myh = NULL; - _bfd_generic_link_add_one_symbol (link_info, hash_table->bfd_of_glue_owner, tmp_name, - BSF_LOCAL, s, hash_table->thumb_glue_size + 4, + val = hash_table->thumb_glue_size + 4, + _bfd_generic_link_add_one_symbol (link_info, hash_table->bfd_of_glue_owner, + tmp_name, BSF_LOCAL, s, val, NULL, true, false, (struct bfd_link_hash_entry **) &myh); @@ -655,7 +661,7 @@ bfd_elf32_arm_process_before_allocation /* Load the relocs. */ irel = (_bfd_elf32_link_read_relocs (abfd, sec, (PTR) NULL, - (Elf_Internal_Rela *) NULL, false)); + (Elf_Internal_Rela *) NULL, false)); BFD_ASSERT (irel != 0); @@ -691,7 +697,7 @@ bfd_elf32_arm_process_before_allocation free_contents = contents; if (!bfd_get_section_contents (abfd, sec, contents, - (file_ptr) 0, sec->_raw_size)) + (file_ptr) 0, sec->_raw_size)) goto error_return; } } @@ -713,7 +719,7 @@ bfd_elf32_arm_process_before_allocation free_extsyms = extsyms; if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0 - || (bfd_read (extsyms, 1, symtab_hdr->sh_size, abfd) + || (bfd_bread (extsyms, symtab_hdr->sh_size, abfd) != symtab_hdr->sh_size)) goto error_return; } @@ -846,7 +852,7 @@ elf32_thumb_to_arm_stub (info, name, inp bfd_vma val; { asection * s = 0; - long int my_offset; + bfd_vma my_offset; unsigned long int tmp; long int ret_offset; struct elf_link_hash_entry * myh; @@ -876,12 +882,12 @@ elf32_thumb_to_arm_stub (info, name, inp && sym_sec->owner != NULL && !INTERWORK_FLAG (sym_sec->owner)) { - _bfd_error_handler + (*_bfd_error_handler) (_("%s(%s): warning: interworking not enabled."), - bfd_get_filename (sym_sec->owner), name); - _bfd_error_handler + bfd_archive_filename (sym_sec->owner), name); + (*_bfd_error_handler) (_(" first occurrence: %s: thumb call to arm"), - bfd_get_filename (input_bfd)); + bfd_archive_filename (input_bfd)); return false; } @@ -889,10 +895,10 @@ elf32_thumb_to_arm_stub (info, name, inp --my_offset; myh->root.u.def.value = my_offset; - bfd_put_16 (output_bfd, t2a1_bx_pc_insn, + bfd_put_16 (output_bfd, (bfd_vma) t2a1_bx_pc_insn, s->contents + my_offset); - bfd_put_16 (output_bfd, t2a2_noop_insn, + bfd_put_16 (output_bfd, (bfd_vma) t2a2_noop_insn, s->contents + my_offset + 2); ret_offset = @@ -911,7 +917,7 @@ elf32_thumb_to_arm_stub (info, name, inp + 8); bfd_put_32 (output_bfd, - t2a3_b_insn | ((ret_offset >> 2) & 0x00FFFFFF), + (bfd_vma) t2a3_b_insn | ((ret_offset >> 2) & 0x00FFFFFF), s->contents + my_offset + 4); } @@ -919,18 +925,17 @@ elf32_thumb_to_arm_stub (info, name, inp /* Now go back and fix up the original BL insn to point to here. */ - ret_offset = - s->output_offset - + my_offset - - (input_section->output_offset - + offset + addend) - - 8; + ret_offset = (s->output_offset + + my_offset + - (input_section->output_offset + + offset + addend) + - 8); tmp = bfd_get_32 (input_bfd, hit_data - input_section->vma); bfd_put_32 (output_bfd, - insert_thumb_branch (tmp, ret_offset), + (bfd_vma) insert_thumb_branch (tmp, ret_offset), hit_data - input_section->vma); return true; @@ -953,7 +958,7 @@ elf32_arm_to_thumb_stub (info, name, inp bfd_vma val; { unsigned long int tmp; - long int my_offset; + bfd_vma my_offset; asection * s; long int ret_offset; struct elf_link_hash_entry * myh; @@ -981,21 +986,21 @@ elf32_arm_to_thumb_stub (info, name, inp && sym_sec->owner != NULL && !INTERWORK_FLAG (sym_sec->owner)) { - _bfd_error_handler + (*_bfd_error_handler) (_("%s(%s): warning: interworking not enabled."), - bfd_get_filename (sym_sec->owner), name); - _bfd_error_handler + bfd_archive_filename (sym_sec->owner), name); + (*_bfd_error_handler) (_(" first occurrence: %s: arm call to thumb"), - bfd_get_filename (input_bfd)); + bfd_archive_filename (input_bfd)); } --my_offset; myh->root.u.def.value = my_offset; - bfd_put_32 (output_bfd, a2t1_ldr_insn, + bfd_put_32 (output_bfd, (bfd_vma) a2t1_ldr_insn, s->contents + my_offset); - bfd_put_32 (output_bfd, a2t2_bx_r12_insn, + bfd_put_32 (output_bfd, (bfd_vma) a2t2_bx_r12_insn, s->contents + my_offset + 4); /* It's a thumb address. Add the low order bit. */ @@ -1009,18 +1014,17 @@ elf32_arm_to_thumb_stub (info, name, inp tmp = tmp & 0xFF000000; /* Somehow these are both 4 too far, so subtract 8. */ - ret_offset = s->output_offset - + my_offset - + s->output_section->vma - - (input_section->output_offset - + input_section->output_section->vma - + offset + addend) - - 8; + ret_offset = (s->output_offset + + my_offset + + s->output_section->vma + - (input_section->output_offset + + input_section->output_section->vma + + offset + addend) + - 8); tmp = tmp | ((ret_offset >> 2) & 0x00FFFFFF); - bfd_put_32 (output_bfd, tmp, hit_data - - input_section->vma); + bfd_put_32 (output_bfd, (bfd_vma) tmp, hit_data - input_section->vma); return true; } @@ -1041,7 +1045,7 @@ elf32_arm_final_link_relocate (howto, in struct bfd_link_info * info; asection * sym_sec; const char * sym_name; - unsigned char sym_flags; + int sym_flags; struct elf_link_hash_entry * h; { unsigned long r_type = howto->type; @@ -1227,10 +1231,10 @@ elf32_arm_final_link_relocate (howto, in /* FIXME: Should we translate the instruction into a BL instruction instead ? */ if (sym_flags != STT_ARM_TFUNC) - _bfd_error_handler (_("\ + (*_bfd_error_handler) (_("\ %s: Warning: Arm BLX instruction targets Arm function '%s'."), - bfd_get_filename (input_bfd), - h ? h->root.root.string : "(local)"); + bfd_archive_filename (input_bfd), + h ? h->root.root.string : "(local)"); } else #endif @@ -1423,10 +1427,10 @@ elf32_arm_final_link_relocate (howto, in /* FIXME: Should we translate the instruction into a BL instruction instead ? */ if (sym_flags == STT_ARM_TFUNC) - _bfd_error_handler (_("\ + (*_bfd_error_handler) (_("\ %s: Warning: Thumb BLX instruction targets thumb function '%s'."), - bfd_get_filename (input_bfd), - h ? h->root.root.string : "(local)"); + bfd_archive_filename (input_bfd), + h ? h->root.root.string : "(local)"); } else #endif @@ -1722,8 +1726,8 @@ arm_add_to_rel (abfd, address, howto, in upper_insn = (upper_insn & 0xf800) | ((addend >> 11) & 0x7ff); lower_insn = (lower_insn & 0xf800) | (addend & 0x7ff); - bfd_put_16 (abfd, upper_insn, address); - bfd_put_16 (abfd, lower_insn, address + 2); + bfd_put_16 (abfd, (bfd_vma) upper_insn, address); + bfd_put_16 (abfd, (bfd_vma) lower_insn, address + 2); } else { @@ -1751,7 +1755,7 @@ arm_add_to_rel (abfd, address, howto, in case R_ARM_PC24: addend <<= howto->size; - addend += increment; + addend += increment; /* Should we check for overflow here ? */ @@ -1810,7 +1814,12 @@ elf32_arm_relocate_section (output_bfd, || r_type == R_ARM_GNU_VTINHERIT) continue; +#ifdef USE_REL + elf32_arm_info_to_howto (input_bfd, & bfd_reloc, + (Elf_Internal_Rel *) rel); +#else elf32_arm_info_to_howto (input_bfd, & bfd_reloc, rel); +#endif howto = bfd_reloc.howto; if (info->relocateable) @@ -1827,10 +1836,11 @@ elf32_arm_relocate_section (output_bfd, sec = local_sections[r_symndx]; #ifdef USE_REL arm_add_to_rel (input_bfd, contents + rel->r_offset, - howto, sec->output_offset + sym->st_value); + howto, + (bfd_signed_vma) (sec->output_offset + + sym->st_value)); #else - rel->r_addend += (sec->output_offset + sym->st_value) - >> howto->rightshift; + rel->r_addend += (sec->output_offset + sym->st_value); #endif } } @@ -1914,7 +1924,7 @@ elf32_arm_relocate_section (output_bfd, { (*_bfd_error_handler) (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"), - bfd_get_filename (input_bfd), h->root.root.string, + bfd_archive_filename (input_bfd), h->root.root.string, bfd_get_section_name (input_bfd, input_section)); relocation_needed = 0; } @@ -2027,13 +2037,13 @@ elf32_arm_set_private_flags (abfd, flags if (EF_ARM_EABI_VERSION (flags) == EF_ARM_EABI_UNKNOWN) { if (flags & EF_ARM_INTERWORK) - _bfd_error_handler (_("\ + (*_bfd_error_handler) (_("\ Warning: Not setting interwork flag of %s since it has already been specified as non-interworking"), - bfd_get_filename (abfd)); + bfd_archive_filename (abfd)); else _bfd_error_handler (_("\ Warning: Clearing the interwork flag of %s due to outside request"), - bfd_get_filename (abfd)); + bfd_archive_filename (abfd)); } } else @@ -2081,7 +2091,8 @@ elf32_arm_copy_private_bfd_data (ibfd, o if (out_flags & EF_ARM_INTERWORK) _bfd_error_handler (_("\ Warning: Clearing the interwork flag in %s because non-interworking code in %s has been linked with it"), - bfd_get_filename (obfd), bfd_get_filename (ibfd)); + bfd_get_filename (obfd), + bfd_archive_filename (ibfd)); in_flags &= ~EF_ARM_INTERWORK; } @@ -2175,10 +2186,10 @@ elf32_arm_merge_private_bfd_data (ibfd, { _bfd_error_handler (_("\ Error: %s compiled for EABI version %d, whereas %s is compiled for version %d"), - bfd_get_filename (ibfd), - (in_flags & EF_ARM_EABIMASK) >> 24, - bfd_get_filename (obfd), - (out_flags & EF_ARM_EABIMASK) >> 24); + bfd_archive_filename (ibfd), + (in_flags & EF_ARM_EABIMASK) >> 24, + bfd_get_filename (obfd), + (out_flags & EF_ARM_EABIMASK) >> 24); return false; } @@ -2189,45 +2200,51 @@ Error: %s compiled for EABI version %d, { _bfd_error_handler (_("\ Error: %s compiled for APCS-%d, whereas %s is compiled for APCS-%d"), - bfd_get_filename (ibfd), - in_flags & EF_ARM_APCS_26 ? 26 : 32, - bfd_get_filename (obfd), - out_flags & EF_ARM_APCS_26 ? 26 : 32); + bfd_archive_filename (ibfd), + in_flags & EF_ARM_APCS_26 ? 26 : 32, + bfd_get_filename (obfd), + out_flags & EF_ARM_APCS_26 ? 26 : 32); flags_compatible = false; } if ((in_flags & EF_ARM_APCS_FLOAT) != (out_flags & EF_ARM_APCS_FLOAT)) { + char *s1 = in_flags & EF_ARM_APCS_FLOAT ? _("float") : _("integer"); + char *s2 = out_flags & EF_ARM_APCS_FLOAT ? _("float") : _("integer"); + _bfd_error_handler (_("\ Error: %s passes floats in %s registers, whereas %s passes them in %s registers"), - bfd_get_filename (ibfd), - in_flags & EF_ARM_APCS_FLOAT ? _("float") : _("integer"), - bfd_get_filename (obfd), - out_flags & EF_ARM_APCS_26 ? _("float") : _("integer")); + bfd_archive_filename (ibfd), s1, + bfd_get_filename (obfd), s2); flags_compatible = false; } #ifdef EF_ARM_SOFT_FLOAT if ((in_flags & EF_ARM_SOFT_FLOAT) != (out_flags & EF_ARM_SOFT_FLOAT)) { + char *s1 = in_flags & EF_ARM_SOFT_FLOAT ? _("soft") : _("hard"); + char *s2 = out_flags & EF_ARM_SOFT_FLOAT ? _("soft") : _("hard"); + _bfd_error_handler (_ ("\ Error: %s uses %s floating point, whereas %s uses %s floating point"), - bfd_get_filename (ibfd), - in_flags & EF_ARM_SOFT_FLOAT ? _("soft") : _("hard"), - bfd_get_filename (obfd), - out_flags & EF_ARM_SOFT_FLOAT ? _("soft") : _("hard")); + bfd_archive_filename (ibfd), s1, + bfd_get_filename (obfd), s2); flags_compatible = false; } #endif /* Interworking mismatch is only a warning. */ if ((in_flags & EF_ARM_INTERWORK) != (out_flags & EF_ARM_INTERWORK)) - _bfd_error_handler (_("\ + { + char *s1 = (in_flags & EF_ARM_INTERWORK + ? _("supports") : _("does not support")); + char *s2 = out_flags & EF_ARM_INTERWORK ? _("does") : _("does not"); + + _bfd_error_handler (_("\ Warning: %s %s interworking, whereas %s %s"), - bfd_get_filename (ibfd), - in_flags & EF_ARM_INTERWORK ? _("supports") : _("does not support"), - bfd_get_filename (obfd), - out_flags & EF_ARM_INTERWORK ? _("does") : _("does not")); + bfd_archive_filename (ibfd), s1, + bfd_get_filename (obfd), s2); + } } return flags_compatible; @@ -2541,10 +2558,11 @@ elf32_arm_check_relocs (abfd, info, sec, symbol. */ if (local_got_offsets == NULL) { - size_t size; - register unsigned int i; + bfd_size_type size; + unsigned int i; - size = symtab_hdr->sh_info * sizeof (bfd_vma); + size = symtab_hdr->sh_info; + size *= sizeof (bfd_vma); local_got_offsets = (bfd_vma *) bfd_alloc (abfd, size); if (local_got_offsets == NULL) return false; @@ -2668,8 +2686,7 @@ elf32_arm_check_relocs (abfd, info, sec, if (p == NULL) { p = ((struct elf32_arm_pcrel_relocs_copied *) - bfd_alloc (dynobj, sizeof * p)); - + bfd_alloc (dynobj, (bfd_size_type) sizeof * p)); if (p == NULL) return false; p->next = eh->pcrel_relocs_copied; @@ -3092,37 +3109,40 @@ elf32_arm_size_dynamic_sections (output_ must add the entries now so that we get the correct size for the .dynamic section. The DT_DEBUG entry is filled in by the dynamic linker and used by the debugger. */ - if (! info->shared) +#define add_dynamic_entry(TAG, VAL) \ + bfd_elf32_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL)) + + if (!info->shared) { - if (! bfd_elf32_add_dynamic_entry (info, DT_DEBUG, 0)) + if (!add_dynamic_entry (DT_DEBUG, 0)) return false; } if (plt) { - if ( ! bfd_elf32_add_dynamic_entry (info, DT_PLTGOT, 0) - || ! bfd_elf32_add_dynamic_entry (info, DT_PLTRELSZ, 0) - || ! bfd_elf32_add_dynamic_entry (info, DT_PLTREL, DT_REL) - || ! bfd_elf32_add_dynamic_entry (info, DT_JMPREL, 0)) + if ( !add_dynamic_entry (DT_PLTGOT, 0) + || !add_dynamic_entry (DT_PLTRELSZ, 0) + || !add_dynamic_entry (DT_PLTREL, DT_REL) + || !add_dynamic_entry (DT_JMPREL, 0)) return false; } if (relocs) { - if ( ! bfd_elf32_add_dynamic_entry (info, DT_REL, 0) - || ! bfd_elf32_add_dynamic_entry (info, DT_RELSZ, 0) - || ! bfd_elf32_add_dynamic_entry (info, DT_RELENT, - sizeof (Elf32_External_Rel))) + if ( !add_dynamic_entry (DT_REL, 0) + || !add_dynamic_entry (DT_RELSZ, 0) + || !add_dynamic_entry (DT_RELENT, sizeof (Elf32_External_Rel))) return false; } if ((info->flags & DF_TEXTREL) != 0) { - if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0)) + if (!add_dynamic_entry (DT_TEXTREL, 0)) return false; info->flags |= DF_TEXTREL; } } +#undef add_synamic_entry return true; } @@ -3255,7 +3275,7 @@ elf32_arm_finish_dynamic_symbol (output_ rel.r_offset = (sgot->output_section->vma + sgot->output_offset - + (h->got.offset &~ 1)); + + (h->got.offset &~ (bfd_vma) 1)); /* If this is a -Bsymbolic link, and the symbol is defined locally, we just want to emit a RELATIVE reloc. The entry in @@ -3441,10 +3461,10 @@ elf32_arm_post_process_headers (abfd, li } static enum elf_reloc_type_class -elf32_arm_reloc_type_class (type) - int type; +elf32_arm_reloc_type_class (rela) + const Elf_Internal_Rela *rela; { - switch (type) + switch ((int) ELF32_R_TYPE (rela->r_info)) { case R_ARM_RELATIVE: return reloc_class_relative; @@ -3467,14 +3487,14 @@ elf32_arm_reloc_type_class (type) #define bfd_elf32_bfd_set_private_flags elf32_arm_set_private_flags #define bfd_elf32_bfd_print_private_bfd_data elf32_arm_print_private_bfd_data #define bfd_elf32_bfd_link_hash_table_create elf32_arm_link_hash_table_create -#define bfd_elf32_bfd_reloc_type_lookup elf32_arm_reloc_type_lookup +#define bfd_elf32_bfd_reloc_type_lookup elf32_arm_reloc_type_lookup #define bfd_elf32_find_nearest_line elf32_arm_find_nearest_line #define elf_backend_get_symbol_type elf32_arm_get_symbol_type #define elf_backend_gc_mark_hook elf32_arm_gc_mark_hook #define elf_backend_gc_sweep_hook elf32_arm_gc_sweep_hook #define elf_backend_check_relocs elf32_arm_check_relocs -#define elf_backend_relocate_section elf32_arm_relocate_section +#define elf_backend_relocate_section elf32_arm_relocate_section #define elf_backend_adjust_dynamic_symbol elf32_arm_adjust_dynamic_symbol #define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections #define elf_backend_finish_dynamic_symbol elf32_arm_finish_dynamic_symbol diff -uprN binutils-2.11.90.0.31/bfd/elf32-avr.c binutils-2.11.92.0.5/bfd/elf32-avr.c --- binutils-2.11.90.0.31/bfd/elf32-avr.c Fri Mar 9 11:15:48 2001 +++ binutils-2.11.92.0.5/bfd/elf32-avr.c Mon Oct 1 15:25:21 2001 @@ -1,5 +1,5 @@ /* AVR-specific support for 32-bit ELF - Copyright 1999, 2000 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001 Free Software Foundation, Inc. Contributed by Denis Chertykov This file is part of BFD, the Binary File Descriptor library. @@ -699,7 +699,7 @@ avr_final_link_relocate (howto, input_bf x = bfd_get_16 (input_bfd, contents); x |= ((srel & 0x10000) | ((srel << 3) & 0x1f00000)) >> 16; bfd_put_16 (input_bfd, x, contents); - bfd_put_16 (input_bfd, srel & 0xffff, contents+2); + bfd_put_16 (input_bfd, (bfd_vma) srel & 0xffff, contents+2); break; default: @@ -913,8 +913,9 @@ static boolean elf32_avr_object_p (abfd) bfd *abfd; { - int e_set = bfd_mach_avr2; - if (elf_elfheader (abfd)->e_machine == EM_AVR) + unsigned int e_set = bfd_mach_avr2; + if (elf_elfheader (abfd)->e_machine == EM_AVR + || elf_elfheader (abfd)->e_machine == EM_AVR_OLD) { int e_mach = elf_elfheader (abfd)->e_flags & EF_AVR_MACH; switch (e_mach) @@ -947,6 +948,7 @@ elf32_avr_object_p (abfd) #define ELF_ARCH bfd_arch_avr #define ELF_MACHINE_CODE EM_AVR +#define ELF_MACHINE_ALT1 EM_AVR_OLD #define ELF_MAXPAGESIZE 1 #define TARGET_LITTLE_SYM bfd_elf32_avr_vec diff -uprN binutils-2.11.90.0.31/bfd/elf32-cris.c binutils-2.11.92.0.5/bfd/elf32-cris.c --- binutils-2.11.90.0.31/bfd/elf32-cris.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/elf32-cris.c Mon Oct 1 15:25:21 2001 @@ -86,7 +86,7 @@ static boolean elf_cris_finish_dynamic_s static void elf_cris_hide_symbol PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); static enum elf_reloc_type_class elf_cris_reloc_type_class - PARAMS ((int)); + PARAMS ((const Elf_Internal_Rela *)); static reloc_howto_type cris_elf_howto_table [] = { @@ -637,9 +637,9 @@ elf_cris_link_hash_table_create (abfd) bfd *abfd; { struct elf_cris_link_hash_table *ret; + bfd_size_type amt = sizeof (struct elf_cris_link_hash_table); - ret = ((struct elf_cris_link_hash_table *) - bfd_alloc (abfd, sizeof (struct elf_cris_link_hash_table))); + ret = ((struct elf_cris_link_hash_table *) bfd_alloc (abfd, amt)); if (ret == (struct elf_cris_link_hash_table *) NULL) return NULL; @@ -758,7 +758,7 @@ cris_elf_relocate_section (output_bfd, i struct elf_link_hash_entry * h; bfd_vma relocation; bfd_reloc_status_type r; - const char * name = NULL; + const char * symname = NULL; int r_type; r_type = ELF32_R_TYPE (rel->r_info); @@ -803,9 +803,10 @@ cris_elf_relocate_section (output_bfd, i + sec->output_offset + sym->st_value); - 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; + symname = (bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name)); + if (symname == NULL) + symname = bfd_section_name (input_bfd, sec); } else { @@ -815,7 +816,7 @@ cris_elf_relocate_section (output_bfd, i || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; - name = h->root.root.string; + symname = h->root.root.string; if (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) @@ -875,21 +876,12 @@ cris_elf_relocate_section (output_bfd, i + sec->output_offset); else { - if (input_bfd->my_archive) - (*_bfd_error_handler) - (_("%s(%s): unresolvable relocation %s against symbol `%s' from %s section"), - bfd_get_filename (bfd_my_archive (input_bfd)), - bfd_get_filename (input_bfd), - cris_elf_howto_table[r_type].name, - name, - bfd_get_section_name (input_bfd, input_section)); - else - (*_bfd_error_handler) - (_("%s: unresolvable relocation %s against symbol `%s' from %s section"), - bfd_get_filename (input_bfd), - cris_elf_howto_table[r_type].name, - name, - bfd_get_section_name (input_bfd, input_section)); + (*_bfd_error_handler) + (_("%s: unresolvable relocation %s against symbol `%s' from %s section"), + bfd_archive_filename (input_bfd), + cris_elf_howto_table[r_type].name, + symname, + bfd_get_section_name (input_bfd, input_section)); bfd_set_error (bfd_error_bad_value); return false; } @@ -897,14 +889,14 @@ cris_elf_relocate_section (output_bfd, i else if (h->root.type == bfd_link_hash_undefweak) relocation = 0; else if (info->shared - && !info->symbolic + && (!info->symbolic || info->allow_shlib_undefined) && !info->no_undefined && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) relocation = 0; else { if (!(info->callbacks->undefined_symbol - (info, name, input_bfd, + (info, symname, input_bfd, input_section, rel->r_offset, (!info->shared || info->no_undefined || ELF_ST_VISIBILITY (h->other))))) @@ -949,9 +941,9 @@ cris_elf_relocate_section (output_bfd, i { (*_bfd_error_handler) (_("%s: No PLT nor GOT for relocation %s against symbol `%s' from %s section"), - bfd_get_filename (input_bfd), + bfd_archive_filename (input_bfd), cris_elf_howto_table[r_type].name, - name[0] != '\0' ? name : _("[whose name is lost]"), + symname[0] != '\0' ? symname : _("[whose name is lost]"), bfd_get_section_name (input_bfd, input_section)); /* FIXME: Perhaps blaming input is not the right thing to @@ -1068,17 +1060,17 @@ cris_elf_relocate_section (output_bfd, i if (h == NULL) (*_bfd_error_handler) (_("%s: relocation %s with non-zero addend %d against local symbol from %s section"), - bfd_get_filename (input_bfd), + bfd_archive_filename (input_bfd), cris_elf_howto_table[r_type].name, rel->r_addend, bfd_get_section_name (input_bfd, input_section)); else (*_bfd_error_handler) (_("%s: relocation %s with non-zero addend %d against symbol `%s' from %s section"), - bfd_get_filename (input_bfd), + bfd_archive_filename (input_bfd), cris_elf_howto_table[r_type].name, rel->r_addend, - name[0] != '\0' ? name : _("[whose name is lost]"), + symname[0] != '\0' ? symname : _("[whose name is lost]"), bfd_get_section_name (input_bfd, input_section)); bfd_set_error (bfd_error_bad_value); @@ -1093,9 +1085,9 @@ cris_elf_relocate_section (output_bfd, i { (*_bfd_error_handler) (_("%s: relocation %s is not allowed for global symbol: `%s' from %s section"), - bfd_get_filename (input_bfd), + bfd_archive_filename (input_bfd), cris_elf_howto_table[r_type].name, - name, + symname, bfd_get_section_name (input_bfd, input_section)); bfd_set_error (bfd_error_bad_value); return false; @@ -1211,7 +1203,7 @@ cris_elf_relocate_section (output_bfd, i { (*_bfd_error_handler) (_("%s: Internal inconsistency; no relocation section %s"), - bfd_get_filename (input_bfd), + bfd_archive_filename (input_bfd), name); bfd_set_error (bfd_error_bad_value); @@ -1327,13 +1319,13 @@ cris_elf_relocate_section (output_bfd, i { case bfd_reloc_overflow: r = info->callbacks->reloc_overflow - (info, name, howto->name, (bfd_vma) 0, + (info, symname, howto->name, (bfd_vma) 0, input_bfd, input_section, rel->r_offset); break; case bfd_reloc_undefined: r = info->callbacks->undefined_symbol - (info, name, input_bfd, input_section, rel->r_offset, + (info, symname, input_bfd, input_section, rel->r_offset, true); break; @@ -1356,7 +1348,7 @@ cris_elf_relocate_section (output_bfd, i if (msg) r = info->callbacks->warning - (info, msg, name, input_bfd, input_section, rel->r_offset); + (info, msg, symname, input_bfd, input_section, rel->r_offset); if (! r) return false; @@ -1505,6 +1497,7 @@ elf_cris_finish_dynamic_symbol (output_b asection *sgot; asection *srela; Elf_Internal_Rela rela; + bfd_byte *where; /* This symbol has an entry in the global offset table. Set it up. */ @@ -1514,27 +1507,25 @@ elf_cris_finish_dynamic_symbol (output_b rela.r_offset = (sgot->output_section->vma + sgot->output_offset - + (h->got.offset &~ 1)); + + (h->got.offset &~ (bfd_vma) 1)); /* If this is a static link, or it is a -Bsymbolic link and the symbol is defined locally or was forced to be local because of a version file, we just want to emit a RELATIVE reloc. The entry in the global offset table will already have been initialized in the relocate_section function. */ + where = sgot->contents + (h->got.offset &~ (bfd_vma) 1); if (! elf_hash_table (info)->dynamic_sections_created || (info->shared && (info->symbolic || h->dynindx == -1) && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) { rela.r_info = ELF32_R_INFO (0, R_CRIS_RELATIVE); - rela.r_addend = bfd_get_signed_32 (output_bfd, - (sgot->contents - + (h->got.offset & ~1))); + rela.r_addend = bfd_get_signed_32 (output_bfd, where); } else { - bfd_put_32 (output_bfd, (bfd_vma) 0, - sgot->contents + (h->got.offset & ~1)); + bfd_put_32 (output_bfd, (bfd_vma) 0, where); rela.r_info = ELF32_R_INFO (h->dynindx, R_CRIS_GLOB_DAT); rela.r_addend = 0; } @@ -2317,17 +2308,16 @@ cris_elf_check_relocs (abfd, info, sec, if (local_got_refcounts == NULL) { - size_t size; + bfd_size_type amt; /* We use index local_got_refcounts[-1] to count all GOT-relative relocations that do not have explicit GOT entries. */ - size = (symtab_hdr->sh_info + 1) * sizeof (bfd_signed_vma); - local_got_refcounts = ((bfd_signed_vma *) - bfd_alloc (abfd, size)); + amt = symtab_hdr->sh_info + 1; + amt *= sizeof (bfd_signed_vma); + local_got_refcounts = ((bfd_signed_vma *) bfd_zalloc (abfd, amt)); if (local_got_refcounts == NULL) return false; - memset (local_got_refcounts, -1, size); local_got_refcounts++; elf_local_got_refcounts (abfd) = local_got_refcounts; @@ -2380,10 +2370,8 @@ cris_elf_check_relocs (abfd, info, sec, if (h != NULL) { - if (h->got.refcount == -1) + if (h->got.refcount == 0) { - h->got.refcount = 1; - /* Make sure this symbol is output as a dynamic symbol. */ if (h->dynindx == -1) { @@ -2396,16 +2384,13 @@ cris_elf_check_relocs (abfd, info, sec, /* Allocate relocation space. */ srelgot->_raw_size += sizeof (Elf32_External_Rela); } - else - h->got.refcount++; + h->got.refcount++; } else { /* This is a global offset table entry for a local symbol. */ - if (local_got_refcounts[r_symndx] == -1) + if (local_got_refcounts[r_symndx] == 0) { - local_got_refcounts[r_symndx] = 1; - sgot->_raw_size += 4; if (info->shared) { @@ -2415,8 +2400,7 @@ cris_elf_check_relocs (abfd, info, sec, srelgot->_raw_size += sizeof (Elf32_External_Rela); } } - else - local_got_refcounts[r_symndx]++; + local_got_refcounts[r_symndx]++; } break; @@ -2449,10 +2433,7 @@ cris_elf_check_relocs (abfd, info, sec, continue; h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; - if (h->plt.refcount == -1) - h->plt.refcount = 1; - else - h->plt.refcount++; + h->plt.refcount++; break; case R_CRIS_8: @@ -2470,19 +2451,11 @@ cris_elf_check_relocs (abfd, info, sec, && (sec->flags & SEC_READONLY) != 0) { /* FIXME: How do we make this optionally a warning only? */ - if (abfd->my_archive) - (*_bfd_error_handler) - (_("%s(%s), section %s:\n relocation %s should not be used in a shared object; recompile with -fPIC"), - bfd_get_filename (bfd_my_archive (abfd)), - bfd_get_filename (abfd), - sec->name, - cris_elf_howto_table[r_type].name); - else - (*_bfd_error_handler) - (_("%s, section %s:\n relocation %s should not be used in a shared object; recompile with -fPIC"), - bfd_get_filename (abfd), - sec->name, - cris_elf_howto_table[r_type].name); + (*_bfd_error_handler) + (_("%s, section %s:\n relocation %s should not be used in a shared object; recompile with -fPIC"), + bfd_archive_filename (abfd), + sec->name, + cris_elf_howto_table[r_type].name); } /* Fall through. */ @@ -2495,10 +2468,7 @@ cris_elf_check_relocs (abfd, info, sec, /* Make sure a plt entry is created for this symbol if it turns out to be a function defined by a dynamic object. */ - if (h->plt.refcount == -1) - h->plt.refcount = 1; - else - h->plt.refcount++; + h->plt.refcount++; } /* If we are creating a shared library and this is not a local @@ -2605,7 +2575,7 @@ cris_elf_check_relocs (abfd, info, sec, if (p == NULL) { p = ((struct elf_cris_pcrel_relocs_copied *) - bfd_alloc (dynobj, sizeof *p)); + bfd_alloc (dynobj, (bfd_size_type) sizeof *p)); if (p == NULL) return false; p->next = eh->pcrel_relocs_copied; @@ -2790,37 +2760,40 @@ elf_cris_size_dynamic_sections (output_b must add the entries now so that we get the correct size for the .dynamic section. The DT_DEBUG entry is filled in by the dynamic linker and used by the debugger. */ +#define add_dynamic_entry(TAG, VAL) \ + bfd_elf32_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL)) + if (!info->shared) { - if (!bfd_elf32_add_dynamic_entry (info, DT_DEBUG, 0)) + if (!add_dynamic_entry (DT_DEBUG, 0)) return false; } if (plt) { - if (!bfd_elf32_add_dynamic_entry (info, DT_PLTGOT, 0) - || !bfd_elf32_add_dynamic_entry (info, DT_PLTRELSZ, 0) - || !bfd_elf32_add_dynamic_entry (info, DT_PLTREL, DT_RELA) - || !bfd_elf32_add_dynamic_entry (info, DT_JMPREL, 0)) + if (!add_dynamic_entry (DT_PLTGOT, 0) + || !add_dynamic_entry (DT_PLTRELSZ, 0) + || !add_dynamic_entry (DT_PLTREL, DT_RELA) + || !add_dynamic_entry (DT_JMPREL, 0)) return false; } if (relocs) { - if (!bfd_elf32_add_dynamic_entry (info, DT_RELA, 0) - || !bfd_elf32_add_dynamic_entry (info, DT_RELASZ, 0) - || !bfd_elf32_add_dynamic_entry (info, DT_RELAENT, - sizeof (Elf32_External_Rela))) + if (!add_dynamic_entry (DT_RELA, 0) + || !add_dynamic_entry (DT_RELASZ, 0) + || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela))) return false; } if ((info->flags & DF_TEXTREL) != 0) { - if (!bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0)) + if (!add_dynamic_entry (DT_TEXTREL, 0)) return false; info->flags |= DF_TEXTREL; } } +#undef add_dynamic_entry return true; } @@ -2985,7 +2958,7 @@ cris_elf_merge_private_bfd_data (ibfd, o ((new_flags & EF_CRIS_UNDERSCORE) ? _("%s: uses _-prefixed symbols, but writing file with non-prefixed symbols") : _("%s: uses non-prefixed symbols, but writing file with _-prefixed symbols"), - bfd_get_filename (ibfd)); + bfd_archive_filename (ibfd)); bfd_set_error (bfd_error_bad_value); return false; } @@ -2995,10 +2968,10 @@ cris_elf_merge_private_bfd_data (ibfd, o static enum elf_reloc_type_class -elf_cris_reloc_type_class (type) - int type; +elf_cris_reloc_type_class (rela) + const Elf_Internal_Rela *rela; { - switch (type) + switch ((int) ELF32_R_TYPE (rela->r_info)) { case R_CRIS_RELATIVE: return reloc_class_relative; @@ -3027,6 +3000,7 @@ elf_cris_reloc_type_class (type) #define elf_backend_check_relocs cris_elf_check_relocs #define elf_backend_can_gc_sections 1 +#define elf_backend_can_refcount 1 #define elf_backend_object_p cris_elf_object_p #define elf_backend_final_write_processing \ diff -uprN binutils-2.11.90.0.31/bfd/elf32-d10v.c binutils-2.11.92.0.5/bfd/elf32-d10v.c --- binutils-2.11.90.0.31/bfd/elf32-d10v.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/elf32-d10v.c Mon Oct 1 15:25:21 2001 @@ -515,7 +515,8 @@ elf32_d10v_relocate_section (output_bfd, return true; } #define ELF_ARCH bfd_arch_d10v -#define ELF_MACHINE_CODE EM_CYGNUS_D10V +#define ELF_MACHINE_CODE EM_D10V +#define ELF_MACHINE_ALT1 EM_CYGNUS_D10V #define ELF_MAXPAGESIZE 0x1000 #define TARGET_BIG_SYM bfd_elf32_d10v_vec diff -uprN binutils-2.11.90.0.31/bfd/elf32-d30v.c binutils-2.11.92.0.5/bfd/elf32-d30v.c --- binutils-2.11.90.0.31/bfd/elf32-d30v.c Fri Mar 9 11:15:49 2001 +++ binutils-2.11.92.0.5/bfd/elf32-d30v.c Mon Oct 1 15:25:21 2001 @@ -546,7 +546,8 @@ d30v_info_to_howto_rela (abfd, cache_ptr } #define ELF_ARCH bfd_arch_d30v -#define ELF_MACHINE_CODE EM_CYGNUS_D30V +#define ELF_MACHINE_CODE EM_D30V +#define ELF_MACHINE_ALT1 EM_CYGNUS_D30V #define ELF_MAXPAGESIZE 0x1000 #define TARGET_BIG_SYM bfd_elf32_d30v_vec diff -uprN binutils-2.11.90.0.31/bfd/elf32-fr30.c binutils-2.11.92.0.5/bfd/elf32-fr30.c --- binutils-2.11.90.0.31/bfd/elf32-fr30.c Fri Mar 9 11:37:57 2001 +++ binutils-2.11.92.0.5/bfd/elf32-fr30.c Mon Oct 1 15:25:21 2001 @@ -33,13 +33,20 @@ static reloc_howto_type * fr30_reloc_typ static void fr30_info_to_howto_rela PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *)); static boolean fr30_elf_relocate_section - PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); static bfd_reloc_status_type fr30_final_link_relocate - PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, bfd_vma)); + PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, bfd_vma)); static boolean fr30_elf_gc_sweep_hook - PARAMS ((bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *)); + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); static asection * fr30_elf_gc_mark_hook - PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *, struct elf_link_hash_entry *, Elf_Internal_Sym *)); + PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *, + struct elf_link_hash_entry *, Elf_Internal_Sym *)); +static boolean fr30_elf_check_relocs + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); static reloc_howto_type fr30_elf_howto_table [] = { @@ -279,7 +286,7 @@ fr30_elf_i20_reloc (abfd, reloc_entry, s x = bfd_get_32 (abfd, (char *) data + reloc_entry->address); x = (x & 0xff0f0000) | (relocation & 0x0000ffff) | ((relocation & 0x000f0000) << 4); - bfd_put_32 (abfd, x, (char *) data + reloc_entry->address); + bfd_put_32 (abfd, (bfd_vma) x, (char *) data + reloc_entry->address); return bfd_reloc_ok; } @@ -792,7 +799,8 @@ fr30_elf_check_relocs (abfd, info, sec, } #define ELF_ARCH bfd_arch_fr30 -#define ELF_MACHINE_CODE EM_CYGNUS_FR30 +#define ELF_MACHINE_CODE EM_FR30 +#define ELF_MACHINE_ALT1 EM_CYGNUS_FR30 #define ELF_MAXPAGESIZE 0x1000 #define TARGET_BIG_SYM bfd_elf32_fr30_vec diff -uprN binutils-2.11.90.0.31/bfd/elf32-gen.c binutils-2.11.92.0.5/bfd/elf32-gen.c --- binutils-2.11.90.0.31/bfd/elf32-gen.c Fri Aug 10 14:08:01 2001 +++ binutils-2.11.92.0.5/bfd/elf32-gen.c Mon Oct 1 15:25:21 2001 @@ -65,7 +65,7 @@ elf_generic_info_to_howto_rel (abfd, bfd bfd_reloc->howto = &dummy; } -static boolean +static boolean elf32_generic_link_add_symbols (abfd, info) bfd *abfd; struct bfd_link_info *info; @@ -79,15 +79,9 @@ elf32_generic_link_add_symbols (abfd, in Elf_Internal_Ehdr *ehdrp; ehdrp = elf_elfheader (abfd); - if (abfd->my_archive) - (*_bfd_error_handler) (_("%s(%s): Relocations in generic ELF (EM: %d)"), - bfd_get_filename (abfd->my_archive), - bfd_get_filename (abfd), - ehdrp->e_machine); - else - (*_bfd_error_handler) (_("%s: Relocations in generic ELF (EM: %d)"), - bfd_get_filename (abfd), - ehdrp->e_machine); + (*_bfd_error_handler) (_("%s: Relocations in generic ELF (EM: %d)"), + bfd_archive_filename (abfd), + ehdrp->e_machine); bfd_set_error (bfd_error_wrong_format); return false; diff -uprN binutils-2.11.90.0.31/bfd/elf32-h8300.c binutils-2.11.92.0.5/bfd/elf32-h8300.c --- binutils-2.11.90.0.31/bfd/elf32-h8300.c Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/bfd/elf32-h8300.c Mon Oct 1 15:25:21 2001 @@ -1,5 +1,5 @@ /* Generic support for 32-bit ELF - Copyright 1993, 1995, 1998, 1999 Free Software Foundation, Inc. + Copyright 1993, 1995, 1998, 1999, 2001 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -29,8 +29,23 @@ static void elf32_h8_info_to_howto PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); static void elf32_h8_info_to_howto_rel PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *)); -static int elf32_h8_mach +static unsigned long elf32_h8_mach PARAMS ((flagword)); +static void elf32_h8_final_write_processing + PARAMS ((bfd *, boolean)); +static boolean elf32_h8_object_p + PARAMS ((bfd *)); +static boolean elf32_h8_merge_private_bfd_data + PARAMS ((bfd *, bfd *)); +static boolean elf32_h8_relax_section + PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *)); +static boolean elf32_h8_relax_delete_bytes + PARAMS ((bfd *, asection *, bfd_vma, int)); +static boolean elf32_h8_symbol_address_p + PARAMS ((bfd *, asection *, Elf32_External_Sym *, bfd_vma)); +static bfd_byte *elf32_h8_get_relocated_section_contents + PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, + bfd_byte *, boolean, asymbol **)); static bfd_reloc_status_type elf32_h8_final_link_relocate PARAMS ((unsigned long, bfd *, bfd *, asection *, bfd_byte *, bfd_vma, bfd_vma, bfd_vma, @@ -39,6 +54,8 @@ static boolean elf32_h8_relocate_section PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); +static bfd_reloc_status_type special + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); /* This does not include any relocation information, but should be good enough for GDB or objdump to read the file. */ @@ -53,7 +70,7 @@ static reloc_howto_type h8_elf_howto_tab false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - NULL, /* special_function */ + special, /* special_function */ "R_H8_NONE", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -67,7 +84,7 @@ static reloc_howto_type h8_elf_howto_tab false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - NULL, /* special_function */ + special, /* special_function */ "R_H8_DIR32", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -81,7 +98,7 @@ static reloc_howto_type h8_elf_howto_tab false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - NULL, /* special_function */ + special, /* special_function */ "R_H8_DIR16", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -95,7 +112,7 @@ static reloc_howto_type h8_elf_howto_tab false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - NULL, /* special_function */ + special, /* special_function */ "R_H8_DIR16", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -109,7 +126,7 @@ static reloc_howto_type h8_elf_howto_tab false, /* pc_relative */ 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - NULL, /* special_function */ + special, /* special_function */ "R_H8_DIR16A8", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -123,7 +140,7 @@ static reloc_howto_type h8_elf_howto_tab false, /* pc_relative */ 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - NULL, /* special_function */ + special, /* special_function */ "R_H8_DIR16R8", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -137,7 +154,7 @@ static reloc_howto_type h8_elf_howto_tab false, /* pc_relative */ 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - NULL, /* special_function */ + special, /* special_function */ "R_H8_DIR24A8", /* name */ true, /* partial_inplace */ 0xff000000, /* src_mask */ @@ -151,7 +168,7 @@ static reloc_howto_type h8_elf_howto_tab false, /* pc_relative */ 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - NULL, /* special_function */ + special, /* special_function */ "R_H8_DIR24R8", /* name */ true, /* partial_inplace */ 0xff000000, /* src_mask */ @@ -165,7 +182,7 @@ static reloc_howto_type h8_elf_howto_tab false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - NULL, /* special_function */ + special, /* special_function */ "R_H8_DIR32", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -179,7 +196,7 @@ static reloc_howto_type h8_elf_howto_tab true, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - NULL, /* special_function */ + special, /* special_function */ "R_H8_PCREL16", /* name */ false, /* partial_inplace */ 0xffff, /* src_mask */ @@ -193,7 +210,7 @@ static reloc_howto_type h8_elf_howto_tab true, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - NULL, /* special_function */ + special, /* special_function */ "R_H8_PCREL8", /* name */ false, /* partial_inplace */ 0xff, /* src_mask */ @@ -274,6 +291,28 @@ elf32_h8_info_to_howto_rel (abfd, bfd_re bfd_reloc->howto = &h8_elf_howto_table[r]; } +/* Special handling for H8/300 relocs. + We only come here for pcrel stuff and return normally if not an -r link. + When doing -r, we can't do any arithmetic for the pcrel stuff, because + we support relaxing on the H8/300 series chips. */ +static bfd_reloc_status_type +special (abfd, reloc_entry, symbol, data, input_section, output_bfd, + error_message) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *reloc_entry ATTRIBUTE_UNUSED; + asymbol *symbol ATTRIBUTE_UNUSED; + PTR data ATTRIBUTE_UNUSED; + asection *input_section ATTRIBUTE_UNUSED; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; +{ + if (output_bfd == (bfd *) NULL) + return bfd_reloc_continue; + + /* Adjust the reloc address to that in the output section. */ + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; +} /* Perform a relocation as part of a final link. */ static bfd_reloc_status_type @@ -302,6 +341,7 @@ elf32_h8_final_link_relocate (r_type, in case R_H8_DIR32: case R_H8_DIR32A16: + case R_H8_DIR24A8: value += addend; bfd_put_32 (input_bfd, value, hit_data); return bfd_reloc_ok; @@ -320,12 +360,21 @@ elf32_h8_final_link_relocate (r_type, in bfd_put_8 (input_bfd, value, hit_data); return bfd_reloc_ok; - case R_H8_DIR24A8: case R_H8_DIR24R8: value += addend; + /* HIT_DATA is the address for the first byte for the relocated + value. Subtract 1 so that we can manipulate the data in 32bit + hunks. */ + hit_data--; + + /* Clear out the top byte in value. */ value &= 0xffffff; + + /* Retrieve the type byte for value from the section contents. */ value |= (bfd_get_32 (input_bfd, hit_data) & 0xff000000); + + /* Now scribble it out in one 32bit hunk. */ bfd_put_32 (input_bfd, value, hit_data); return bfd_reloc_ok; @@ -335,6 +384,11 @@ elf32_h8_final_link_relocate (r_type, in value -= offset; value += addend; + /* The value is relative to the start of the instruction, + not the relocation offset. Subtract 2 to account for + this minor issue. */ + value -= 2; + bfd_put_16 (input_bfd, value, hit_data); return bfd_reloc_ok; @@ -344,6 +398,11 @@ elf32_h8_final_link_relocate (r_type, in value -= offset; value += addend; + /* The value is relative to the start of the instruction, + not the relocation offset. Subtract 1 to account for + this minor issue. */ + value -= 1; + bfd_put_8 (input_bfd, value, hit_data); return bfd_reloc_ok; @@ -376,7 +435,7 @@ elf32_h8_relocate_section (output_bfd, i relend = relocs + input_section->reloc_count; for (; rel < relend; rel++) { - int r_type; + unsigned int r_type; unsigned long r_symndx; Elf_Internal_Sym *sym; asection *sec; @@ -459,7 +518,7 @@ elf32_h8_relocate_section (output_bfd, i elf32_h8_info_to_howto (input_bfd, &bfd_reloc, rel); howto = bfd_reloc.howto; - + if (h != NULL) name = h->root.root.string; else @@ -520,7 +579,7 @@ elf32_h8_relocate_section (output_bfd, i Examine that field and return the proper BFD machine type for the object file. */ -static int +static unsigned long elf32_h8_mach (flags) flagword flags; { @@ -542,7 +601,7 @@ elf32_h8_mach (flags) file. We use this opportunity to encode the BFD machine type into the flags field in the object file. */ -void +static void elf32_h8_final_write_processing (abfd, linker) bfd *abfd; boolean linker ATTRIBUTE_UNUSED; @@ -572,7 +631,7 @@ elf32_h8_final_write_processing (abfd, l /* Return nonzero if ABFD represents a valid H8 ELF object file; also record the encoded machine type found in the ELF flags. */ -boolean +static boolean elf32_h8_object_p (abfd) bfd *abfd; { @@ -585,7 +644,7 @@ elf32_h8_object_p (abfd) object file when linking. The only data we need to copy at this time is the architecture/machine information. */ -boolean +static boolean elf32_h8_merge_private_bfd_data (ibfd, obfd) bfd *ibfd; bfd *obfd; @@ -605,6 +664,861 @@ elf32_h8_merge_private_bfd_data (ibfd, o return true; } +/* This function handles relaxing for the H8.. + + There's a few relaxing opportunites available on the H8: + + jmp/jsr:24 -> bra/bsr:8 2 bytes + The jmp may be completely eliminated if the previous insn is a + conditional branch to the insn after the jump. In that case + we invert the branch and delete the jump and save 4 bytes. + + bCC:16 -> bCC:8 2 bytes + bsr:16 -> bsr:8 2 bytes + + mov.b:16 -> mov.b:8 2 bytes + mov.b:24/32 -> mov.b:8 4 bytes + + mov.[bwl]:24/32 -> mov.[bwl]:16 2 bytes + + +*/ + +static boolean +elf32_h8_relax_section (abfd, sec, link_info, again) + bfd *abfd; + asection *sec; + struct bfd_link_info *link_info; + boolean *again; +{ + Elf_Internal_Shdr *symtab_hdr; + Elf_Internal_Rela *internal_relocs; + Elf_Internal_Rela *free_relocs = NULL; + Elf_Internal_Rela *irel, *irelend; + bfd_byte *contents = NULL; + bfd_byte *free_contents = NULL; + Elf32_External_Sym *extsyms = NULL; + Elf32_External_Sym *free_extsyms = NULL; + static asection *last_input_section = NULL; + static Elf_Internal_Rela *last_reloc = NULL; + + /* Assume nothing changes. */ + *again = false; + + /* We don't have to do anything for a relocateable link, if + this section does not have relocs, or if this is not a + code section. */ + if (link_info->relocateable + || (sec->flags & SEC_RELOC) == 0 + || sec->reloc_count == 0 + || (sec->flags & SEC_CODE) == 0) + return true; + + /* If this is the first time we have been called for this section, + initialize the cooked size. */ + if (sec->_cooked_size == 0) + sec->_cooked_size = sec->_raw_size; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + + /* Get a copy of the native relocations. */ + internal_relocs = (_bfd_elf32_link_read_relocs + (abfd, sec, (PTR) NULL, (Elf_Internal_Rela *) NULL, + link_info->keep_memory)); + if (internal_relocs == NULL) + goto error_return; + if (! link_info->keep_memory) + free_relocs = internal_relocs; + + if (sec != last_input_section) + last_reloc = NULL; + + last_input_section = sec; + + /* Walk through the relocs looking for relaxing opportunities. */ + irelend = internal_relocs + sec->reloc_count; + for (irel = internal_relocs; irel < irelend; irel++) + { + bfd_vma symval; + + /* Keep track of the previous reloc so that we can delete + some long jumps created by the compiler. */ + if (irel != internal_relocs) + last_reloc = irel - 1; + + /* 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. */ + contents = (bfd_byte *) bfd_malloc (sec->_raw_size); + if (contents == NULL) + goto error_return; + free_contents = contents; + + if (! bfd_get_section_contents (abfd, sec, contents, + (file_ptr) 0, sec->_raw_size)) + goto error_return; + } + } + + /* Read this BFD's symbols if we haven't done so already. */ + if (extsyms == NULL) + { + /* Get cached copy if it exists. */ + if (symtab_hdr->contents != NULL) + extsyms = (Elf32_External_Sym *) symtab_hdr->contents; + else + { + /* Go get them off disk. */ + extsyms = ((Elf32_External_Sym *) + bfd_malloc (symtab_hdr->sh_size)); + if (extsyms == NULL) + goto error_return; + free_extsyms = extsyms; + if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0 + || (bfd_bread (extsyms, symtab_hdr->sh_size, abfd) + != symtab_hdr->sh_size)) + 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) + { + Elf_Internal_Sym isym; + asection *sym_sec; + + /* A local symbol. */ + bfd_elf32_swap_symbol_in (abfd, + extsyms + ELF32_R_SYM (irel->r_info), + &isym); + + 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. */ + switch (ELF32_R_TYPE (irel->r_info)) + { + /* Try to turn a 24 bit absolute branch/call into an 8 bit + pc-relative branch/call. */ + case R_H8_DIR24R8: + { + bfd_vma value = symval + irel->r_addend; + bfd_vma dot, gap; + + /* Get the address of this instruction. */ + dot = (sec->output_section->vma + + sec->output_offset + irel->r_offset - 1); + + /* Compute the distance from this insn to the branch target. */ + gap = value - dot; + + /* If the distance is within -126..+130 inclusive, then we can + relax this jump. +130 is valid since the target will move + two bytes closer if we do relax this branch. */ + if ((int) gap >= -126 && (int) gap <= 130) + { + unsigned char code; + + /* Note that we've changed the relocs, section contents, + etc. */ + elf_section_data (sec)->relocs = internal_relocs; + free_relocs = NULL; + + elf_section_data (sec)->this_hdr.contents = contents; + free_contents = NULL; + + symtab_hdr->contents = (bfd_byte *) extsyms; + free_extsyms = NULL; + + /* If the previous instruction conditionally jumped around + this instruction, we may be able to reverse the condition + and redirect the previous instruction to the target of + this instruction. + + Such sequences are used by the compiler to deal with + long conditional branches. */ + if ((int) gap <= 130 + && (int) gap >= -128 + && last_reloc + && ELF32_R_TYPE (last_reloc->r_info) == R_H8_PCREL8 + && ELF32_R_SYM (last_reloc->r_info) < symtab_hdr->sh_info) + { + bfd_vma last_value; + asection *last_sym_sec; + Elf_Internal_Sym last_symbol; + + /* We will need to examine the symbol used by the + previous relocation. */ + + bfd_elf32_swap_symbol_in (abfd, + (extsyms + ELF32_R_SYM (last_reloc->r_info)), + &last_symbol); + + last_sym_sec + = bfd_section_from_elf_index (abfd, last_symbol.st_shndx); + last_value = (last_symbol.st_value + + last_sym_sec->output_section->vma + + last_sym_sec->output_offset); + + /* Verify that the previous relocation was for a + branch around this instruction and that no symbol + exists at the current location. */ + if (last_value == dot + 4 + && last_reloc->r_offset + 2 == irel->r_offset + && ! elf32_h8_symbol_address_p (abfd, sec, + extsyms, dot)) + { + /* We can eliminate this jump. Twiddle the + previous relocation as necessary. */ + irel->r_info + = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + ELF32_R_TYPE (R_H8_NONE)); + + last_reloc->r_info + = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + ELF32_R_TYPE (R_H8_PCREL8)); + last_reloc->r_addend = irel->r_addend; + + + code = bfd_get_8 (abfd, + contents + last_reloc->r_offset - 1); + code ^= 1; + bfd_put_8 (abfd, + code, + contents + last_reloc->r_offset - 1); + + /* Delete four bytes of data. */ + if (!elf32_h8_relax_delete_bytes (abfd, sec, + irel->r_offset - 1, + 4)) + goto error_return; + + *again = true; + break; + } + } + + /* We could not eliminate this jump, so just shorten it. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 1); + + if (code == 0x5e) + bfd_put_8 (abfd, 0x55, contents + irel->r_offset - 1); + else if (code == 0x5a) + bfd_put_8 (abfd, 0x40, contents + irel->r_offset - 1); + else + abort (); + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_H8_PCREL8); + + /* Delete two bytes of data. */ + if (!elf32_h8_relax_delete_bytes (abfd, sec, + irel->r_offset + 1, 2)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = true; + } + break; + } + + /* Try to turn a 16bit pc-relative branch into a 8bit pc-relative + branch. */ + case R_H8_PCREL16: + { + bfd_vma value = symval + irel->r_addend; + bfd_vma dot; + bfd_vma gap; + + /* Get the address of this instruction. */ + dot = (sec->output_section->vma + + sec->output_offset + + irel->r_offset - 2); + + gap = value - dot; + + /* If the distance is within -126..+130 inclusive, then we can + relax this jump. +130 is valid since the target will move + two bytes closer if we do relax this branch. */ + if ((int)gap >= -126 && (int)gap <= 130) + { + unsigned char code; + + /* Note that we've changed the relocs, section contents, + etc. */ + elf_section_data (sec)->relocs = internal_relocs; + free_relocs = NULL; + + elf_section_data (sec)->this_hdr.contents = contents; + free_contents = NULL; + + symtab_hdr->contents = (bfd_byte *) extsyms; + free_extsyms = NULL; + + /* Get the opcode. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 2); + + if (code == 0x58) + { + /* bCC:16 -> bCC:8 */ + /* Get the condition code from the original insn. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 1); + code &= 0xf0; + code >>= 4; + code |= 0x40; + bfd_put_8 (abfd, code, contents + irel->r_offset - 2); + } + else if (code == 0x5c) + bfd_put_8 (abfd, 0x55, contents + irel->r_offset - 2); + else + abort (); + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_H8_PCREL8); + irel->r_offset--; + + /* Delete two bytes of data. */ + if (!elf32_h8_relax_delete_bytes (abfd, sec, + irel->r_offset + 1, 2)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = true; + } + break; + } + + /* This is a 16 bit absolute address in a "mov.b" insn, which may + become an 8 bit absolute address if its in the right range. */ + case R_H8_DIR16A8: + { + bfd_vma value = symval + irel->r_addend; + + if ((bfd_get_mach (abfd) == bfd_mach_h8300 + && value >= 0xff00 + && value <= 0xffff) + || ((bfd_get_mach (abfd) == bfd_mach_h8300h + || bfd_get_mach (abfd) == bfd_mach_h8300s) + && value >= 0xffff00 + && value <= 0xffffff)) + { + unsigned char code; + + /* Note that we've changed the relocs, section contents, + etc. */ + elf_section_data (sec)->relocs = internal_relocs; + free_relocs = NULL; + + elf_section_data (sec)->this_hdr.contents = contents; + free_contents = NULL; + + symtab_hdr->contents = (bfd_byte *) extsyms; + free_extsyms = NULL; + + /* Get the opcode. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 2); + + /* Sanity check. */ + if (code != 0x6a) + abort (); + + code = bfd_get_8 (abfd, contents + irel->r_offset - 1); + + if ((code & 0xf0) == 0x00) + bfd_put_8 (abfd, + (code & 0xf) | 0x20, + contents + irel->r_offset - 2); + else if ((code & 0xf0) == 0x80) + bfd_put_8 (abfd, + (code & 0xf) | 0x30, + contents + irel->r_offset - 2); + else + abort (); + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_H8_DIR8); + + /* Delete two bytes of data. */ + if (!elf32_h8_relax_delete_bytes (abfd, sec, + irel->r_offset + 1, 2)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = true; + } + break; + } + + /* This is a 24 bit absolute address in a "mov.b" insn, which may + become an 8 bit absolute address if its in the right range. */ + case R_H8_DIR24A8: + { + bfd_vma value = symval + irel->r_addend; + + if ((bfd_get_mach (abfd) == bfd_mach_h8300 + && value >= 0xff00 + && value <= 0xffff) + || ((bfd_get_mach (abfd) == bfd_mach_h8300h + || bfd_get_mach (abfd) == bfd_mach_h8300s) + && value >= 0xffff00 + && value <= 0xffffff)) + { + unsigned char code; + + /* Note that we've changed the relocs, section contents, + etc. */ + elf_section_data (sec)->relocs = internal_relocs; + free_relocs = NULL; + + elf_section_data (sec)->this_hdr.contents = contents; + free_contents = NULL; + + symtab_hdr->contents = (bfd_byte *) extsyms; + free_extsyms = NULL; + + /* Get the opcode. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 2); + + /* Sanity check. */ + if (code != 0x6a) + abort (); + + code = bfd_get_8 (abfd, contents + irel->r_offset - 1); + + if ((code & 0xf0) == 0x00) + bfd_put_8 (abfd, + (code & 0xf) | 0x20, + contents + irel->r_offset - 2); + else if ((code & 0xf0) == 0x80) + bfd_put_8 (abfd, + (code & 0xf) | 0x30, + contents + irel->r_offset - 2); + else + abort (); + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_H8_DIR8); + + /* Delete two bytes of data. */ + if (!elf32_h8_relax_delete_bytes (abfd, sec, irel->r_offset, 2)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = true; + } + } + + /* FALLTHRU */ + + /* This is a 24/32bit absolute address in a "mov" insn, which may + become a 16bit absoulte address if it is in the right range. */ + case R_H8_DIR32A16: + { + bfd_vma value = symval + irel->r_addend; + + if (value <= 0x7fff || value >= 0xff8000) + { + unsigned char code; + + /* Note that we've changed the relocs, section contents, + etc. */ + elf_section_data (sec)->relocs = internal_relocs; + free_relocs = NULL; + + elf_section_data (sec)->this_hdr.contents = contents; + free_contents = NULL; + + symtab_hdr->contents = (bfd_byte *) extsyms; + free_extsyms = NULL; + + /* Get the opcode. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 1); + + /* We just need to turn off bit 0x20. */ + code &= ~0x20; + + bfd_put_8 (abfd, code, contents + irel->r_offset - 1); + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_H8_DIR16A8); + + /* Delete two bytes of data. */ + if (!elf32_h8_relax_delete_bytes (abfd, sec, + irel->r_offset + 1, 2)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = true; + } + break; + } + + default: + break; + } + } + + if (free_relocs != NULL) + { + free (free_relocs); + free_relocs = NULL; + } + + if (free_contents != NULL) + { + if (! link_info->keep_memory) + free (free_contents); + else + { + /* Cache the section contents for elf_link_input_bfd. */ + elf_section_data (sec)->this_hdr.contents = contents; + } + free_contents = NULL; + } + + if (free_extsyms != NULL) + { + if (! link_info->keep_memory) + free (free_extsyms); + else + { + /* Cache the symbols for elf_link_input_bfd. */ + symtab_hdr->contents = extsyms; + } + free_extsyms = NULL; + } + + return true; + + error_return: + if (free_relocs != NULL) + free (free_relocs); + if (free_contents != NULL) + free (free_contents); + if (free_extsyms != NULL) + free (free_extsyms); + return false; +} + +/* Delete some bytes from a section while relaxing. */ + +static boolean +elf32_h8_relax_delete_bytes (abfd, sec, addr, count) + bfd *abfd; + asection *sec; + bfd_vma addr; + int count; +{ + Elf_Internal_Shdr *symtab_hdr; + Elf32_External_Sym *extsyms; + int shndx, index; + bfd_byte *contents; + Elf_Internal_Rela *irel, *irelend; + Elf_Internal_Rela *irelalign; + bfd_vma toaddr; + Elf32_External_Sym *esym, *esymend; + struct elf_link_hash_entry *sym_hash; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + extsyms = (Elf32_External_Sym *) symtab_hdr->contents; + + 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->_cooked_size; + + irel = elf_section_data (sec)->relocs; + irelend = irel + sec->reloc_count; + + /* Actually delete the bytes. */ + memmove (contents + addr, contents + addr + count, + (size_t) (toaddr - addr - count)); + sec->_cooked_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. */ + esym = extsyms; + esymend = esym + symtab_hdr->sh_info; + for (; esym < esymend; esym++) + { + Elf_Internal_Sym isym; + + bfd_elf32_swap_symbol_in (abfd, esym, &isym); + + if (isym.st_shndx == shndx + && isym.st_value > addr + && isym.st_value < toaddr) + { + isym.st_value -= count; + bfd_elf32_swap_symbol_out (abfd, &isym, esym); + } + } + + /* Now adjust the global symbols defined in this section. */ + esym = extsyms + symtab_hdr->sh_info; + esymend = extsyms + (symtab_hdr->sh_size / sizeof (Elf32_External_Sym)); + for (index = 0; esym < esymend; esym++, index++) + { + Elf_Internal_Sym isym; + + bfd_elf32_swap_symbol_in (abfd, esym, &isym); + sym_hash = elf_sym_hashes (abfd)[index]; + if (isym.st_shndx == shndx + && ((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; +} + +/* Return true if a symbol exists at the given address, else return + false. */ +static boolean +elf32_h8_symbol_address_p (abfd, sec, extsyms, addr) + bfd *abfd; + asection *sec; + Elf32_External_Sym *extsyms; + bfd_vma addr; +{ + Elf_Internal_Shdr *symtab_hdr; + int shndx; + Elf32_External_Sym *esym, *esymend; + struct elf_link_hash_entry **sym_hash, **sym_hash_end; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + shndx = _bfd_elf_section_from_bfd_section (abfd, sec); + + /* Examine all the symbols. */ + esym = extsyms; + esymend = esym + symtab_hdr->sh_info; + for (; esym < esymend; esym++) + { + Elf_Internal_Sym isym; + + bfd_elf32_swap_symbol_in (abfd, esym, &isym); + + if (isym.st_shndx == shndx + && isym.st_value == addr) + return true; + } + + sym_hash = elf_sym_hashes (abfd); + sym_hash_end = (sym_hash + + (symtab_hdr->sh_size / sizeof (Elf32_External_Sym) + - symtab_hdr->sh_info)); + for (; sym_hash < sym_hash_end; sym_hash++) + { + 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) + return true; + } + return false; +} + +/* This is a version of bfd_generic_get_relocated_section_contents + which uses elf32_h8_relocate_section. */ + +static bfd_byte * +elf32_h8_get_relocated_section_contents (output_bfd, link_info, link_order, + data, relocateable, symbols) + bfd *output_bfd; + struct bfd_link_info *link_info; + struct bfd_link_order *link_order; + bfd_byte *data; + boolean relocateable; + 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; + Elf32_External_Sym *external_syms = NULL; + Elf_Internal_Sym *internal_syms = NULL; + + /* We only need to handle the case of relaxing, or of having a + particular set of section contents, specially. */ + if (relocateable + || elf_section_data (input_section)->this_hdr.contents == NULL) + return bfd_generic_get_relocated_section_contents (output_bfd, link_info, + link_order, data, + relocateable, + symbols); + + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + + memcpy (data, elf_section_data (input_section)->this_hdr.contents, + (size_t) input_section->_raw_size); + + if ((input_section->flags & SEC_RELOC) != 0 + && input_section->reloc_count > 0) + { + Elf_Internal_Sym *isymp; + asection **secpp; + Elf32_External_Sym *esym, *esymend; + + if (symtab_hdr->contents != NULL) + external_syms = (Elf32_External_Sym *) symtab_hdr->contents; + else + { + bfd_size_type amt; + + amt = symtab_hdr->sh_info; + amt *= sizeof (Elf32_External_Sym); + external_syms = (Elf32_External_Sym *) bfd_malloc (amt); + if (external_syms == NULL && symtab_hdr->sh_info > 0) + goto error_return; + if (bfd_seek (input_bfd, symtab_hdr->sh_offset, SEEK_SET) != 0 + || bfd_bread (external_syms, amt, input_bfd) != amt) + goto error_return; + } + + internal_relocs = (_bfd_elf32_link_read_relocs + (input_bfd, input_section, (PTR) NULL, + (Elf_Internal_Rela *) NULL, false)); + if (internal_relocs == NULL) + goto error_return; + + internal_syms = ((Elf_Internal_Sym *) + bfd_malloc ((bfd_size_type) symtab_hdr->sh_info + * sizeof (Elf_Internal_Sym))); + if (internal_syms == NULL && symtab_hdr->sh_info > 0) + goto error_return; + + sections = (asection **) bfd_malloc ((bfd_size_type) symtab_hdr->sh_info + * sizeof (asection *)); + if (sections == NULL && symtab_hdr->sh_info > 0) + goto error_return; + + isymp = internal_syms; + secpp = sections; + esym = external_syms; + esymend = esym + symtab_hdr->sh_info; + for (; esym < esymend; ++esym, ++isymp, ++secpp) + { + asection *isec; + + bfd_elf32_swap_symbol_in (input_bfd, esym, isymp); + + if (isymp->st_shndx == SHN_UNDEF) + isec = bfd_und_section_ptr; + else if (isymp->st_shndx > 0 && isymp->st_shndx < SHN_LORESERVE) + isec = bfd_section_from_elf_index (input_bfd, isymp->st_shndx); + else if (isymp->st_shndx == SHN_ABS) + isec = bfd_abs_section_ptr; + else if (isymp->st_shndx == SHN_COMMON) + isec = bfd_com_section_ptr; + else + { + /* Who knows? */ + isec = NULL; + } + + *secpp = isec; + } + + if (! elf32_h8_relocate_section (output_bfd, link_info, input_bfd, + input_section, data, internal_relocs, + internal_syms, sections)) + goto error_return; + + if (sections != NULL) + free (sections); + sections = NULL; + if (internal_syms != NULL) + free (internal_syms); + internal_syms = NULL; + if (external_syms != NULL && symtab_hdr->contents == NULL) + free (external_syms); + external_syms = NULL; + if (internal_relocs != elf_section_data (input_section)->relocs) + free (internal_relocs); + internal_relocs = NULL; + } + + return data; + + error_return: + if (internal_relocs != NULL + && internal_relocs != elf_section_data (input_section)->relocs) + free (internal_relocs); + if (external_syms != NULL && symtab_hdr->contents == NULL) + free (external_syms); + if (internal_syms != NULL) + free (internal_syms); + if (sections != NULL) + free (sections); + return NULL; +} + #define TARGET_BIG_SYM bfd_elf32_h8300_vec #define TARGET_BIG_NAME "elf32-h8300" @@ -634,4 +1548,10 @@ elf32_h8_merge_private_bfd_data (ibfd, o /* Use an H8 specific linker, not the ELF generic linker. */ #define elf_backend_relocate_section elf32_h8_relocate_section +/* And relaxing stuff. */ +#define bfd_elf32_bfd_relax_section elf32_h8_relax_section +#define bfd_elf32_bfd_get_relocated_section_contents \ + elf32_h8_get_relocated_section_contents + + #include "elf32-target.h" diff -uprN binutils-2.11.90.0.31/bfd/elf32-hppa.c binutils-2.11.92.0.5/bfd/elf32-hppa.c --- binutils-2.11.90.0.31/bfd/elf32-hppa.c Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/bfd/elf32-hppa.c Thu Oct 4 14:35:43 2001 @@ -134,24 +134,11 @@ static const bfd_byte plt_stub[] = string. */ #define STUB_SUFFIX ".stub" -/* Setting the following non-zero makes all long branch stubs - generated during a shared link of the PIC variety. This saves on - relocs, but costs one extra instruction per stub. */ -#ifndef LONG_BRANCH_PIC_IN_SHLIB -#define LONG_BRANCH_PIC_IN_SHLIB 1 -#endif - -/* Set this non-zero to use import stubs instead of long branch stubs - where a .plt entry exists for the symbol. This is a fairly useless - option as import stubs are bigger than PIC long branch stubs. */ -#ifndef LONG_BRANCH_VIA_PLT -#define LONG_BRANCH_VIA_PLT 0 -#endif - -/* We don't need to copy any PC- or GP-relative dynamic relocs into a - shared object's dynamic section. All the relocs of the limited - class we are interested in, are absolute. See check_relocs. */ -#ifndef IS_ABSOLUTE_RELOC +/* We don't need to copy certain PC- or GP-relative dynamic relocs + into a shared object's dynamic section. All the relocs of the + limited class we are interested in, are absolute. */ +#ifndef RELATIVE_DYNRELOCS +#define RELATIVE_DYNRELOCS 0 #define IS_ABSOLUTE_RELOC(r_type) 1 #endif @@ -172,11 +159,6 @@ struct elf32_hppa_stub_hash_entry { /* The stub section. */ asection *stub_sec; -#if ! LONG_BRANCH_PIC_IN_SHLIB - /* It's associated reloc section. */ - asection *reloc_sec; -#endif - /* Offset within stub_sec of the beginning of this stub. */ bfd_vma stub_offset; @@ -203,12 +185,6 @@ struct elf32_hppa_link_hash_entry { symbol. */ struct elf32_hppa_stub_hash_entry *stub_cache; -#if ! LONG_BRANCH_PIC_IN_SHLIB - /* Used to track whether we have allocated space for a long branch - stub relocation for this symbol in the given section. */ - asection *stub_reloc_sec; -#endif - /* Used to count relocations for delayed sizing of relocation sections. */ struct elf32_hppa_dyn_reloc_entry { @@ -216,12 +192,17 @@ struct elf32_hppa_link_hash_entry { /* Next relocation in the chain. */ struct elf32_hppa_dyn_reloc_entry *next; - /* The section in dynobj. */ - asection *section; + /* The input section of the reloc. */ + asection *sec; /* Number of relocs copied in this section. */ bfd_size_type count; - } *reloc_entries; + +#if RELATIVE_DYNRELOCS + /* Number of relative relocs copied for the input section. */ + bfd_size_type relative_count; +#endif + } *dyn_relocs; /* Set during a static link if we detect a function is PIC. */ unsigned int maybe_pic_call:1; @@ -241,7 +222,7 @@ struct elf32_hppa_link_hash_entry { struct elf32_hppa_link_hash_table { /* The main hash table. */ - struct elf_link_hash_table root; + struct elf_link_hash_table elf; /* The stub hash table. */ struct bfd_hash_table stub_hash_table; @@ -261,10 +242,6 @@ struct elf32_hppa_link_hash_table { asection *link_sec; /* The stub section. */ asection *stub_sec; -#if ! LONG_BRANCH_PIC_IN_SHLIB - /* The stub section's reloc section. */ - asection *reloc_sec; -#endif } *stub_group; /* Short-cuts to get to dynamic linker sections. */ @@ -344,6 +321,9 @@ static boolean elf32_hppa_add_symbol_hoo static boolean elf32_hppa_create_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *)); +static void elf32_hppa_copy_indirect_symbol + PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *)); + static boolean elf32_hppa_check_relocs PARAMS ((bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *)); @@ -365,7 +345,10 @@ static boolean elf32_hppa_adjust_dynamic static boolean hppa_handle_PIC_calls PARAMS ((struct elf_link_hash_entry *, PTR)); -static boolean allocate_plt_and_got_and_discard_relocs +static boolean allocate_dynrelocs + PARAMS ((struct elf_link_hash_entry *, PTR)); + +static boolean readonly_dynrelocs PARAMS ((struct elf_link_hash_entry *, PTR)); static boolean clobber_millicode_symbols @@ -396,6 +379,9 @@ static boolean elf32_hppa_finish_dynamic PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, Elf_Internal_Sym *)); +static enum elf_reloc_type_class elf32_hppa_reloc_type_class + PARAMS ((const Elf_Internal_Rela *)); + static boolean elf32_hppa_finish_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *)); @@ -415,41 +401,34 @@ stub_hash_newfunc (entry, table, string) struct bfd_hash_table *table; const char *string; { - struct elf32_hppa_stub_hash_entry *ret; - - ret = (struct elf32_hppa_stub_hash_entry *) entry; - /* Allocate the structure if it has not already been allocated by a subclass. */ - if (ret == NULL) + if (entry == NULL) { - ret = ((struct elf32_hppa_stub_hash_entry *) - bfd_hash_allocate (table, - sizeof (struct elf32_hppa_stub_hash_entry))); - if (ret == NULL) - return NULL; + entry = bfd_hash_allocate (table, + sizeof (struct elf32_hppa_stub_hash_entry)); + if (entry == NULL) + return entry; } /* Call the allocation method of the superclass. */ - ret = ((struct elf32_hppa_stub_hash_entry *) - bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string)); - - if (ret) + entry = bfd_hash_newfunc (entry, table, string); + if (entry != NULL) { + struct elf32_hppa_stub_hash_entry *eh; + /* Initialize the local fields. */ - ret->stub_sec = NULL; -#if ! LONG_BRANCH_PIC_IN_SHLIB - ret->reloc_sec = NULL; -#endif - ret->stub_offset = 0; - ret->target_value = 0; - ret->target_section = NULL; - ret->stub_type = hppa_stub_long_branch; - ret->h = NULL; - ret->id_sec = NULL; + eh = (struct elf32_hppa_stub_hash_entry *) entry; + eh->stub_sec = NULL; + eh->stub_offset = 0; + eh->target_value = 0; + eh->target_section = NULL; + eh->stub_type = hppa_stub_long_branch; + eh->h = NULL; + eh->id_sec = NULL; } - return (struct bfd_hash_entry *) ret; + return entry; } /* Initialize an entry in the link hash table. */ @@ -460,41 +439,33 @@ hppa_link_hash_newfunc (entry, table, st struct bfd_hash_table *table; const char *string; { - struct elf32_hppa_link_hash_entry *ret; - - ret = (struct elf32_hppa_link_hash_entry *) entry; - /* Allocate the structure if it has not already been allocated by a subclass. */ - if (ret == NULL) + if (entry == NULL) { - ret = ((struct elf32_hppa_link_hash_entry *) - bfd_hash_allocate (table, - sizeof (struct elf32_hppa_link_hash_entry))); - if (ret == NULL) - return NULL; + entry = bfd_hash_allocate (table, + sizeof (struct elf32_hppa_link_hash_entry)); + if (entry == NULL) + return entry; } /* Call the allocation method of the superclass. */ - ret = ((struct elf32_hppa_link_hash_entry *) - _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, - table, string)); - - if (ret) + entry = _bfd_elf_link_hash_newfunc (entry, table, string); + if (entry != NULL) { + struct elf32_hppa_link_hash_entry *eh; + /* Initialize the local fields. */ -#if ! LONG_BRANCH_PIC_IN_SHLIB - ret->stub_reloc_sec = NULL; -#endif - ret->stub_cache = NULL; - ret->reloc_entries = NULL; - ret->maybe_pic_call = 0; - ret->pic_call = 0; - ret->plabel = 0; - ret->plt_abs = 0; + eh = (struct elf32_hppa_link_hash_entry *) entry; + eh->stub_cache = NULL; + eh->dyn_relocs = NULL; + eh->maybe_pic_call = 0; + eh->pic_call = 0; + eh->plabel = 0; + eh->plt_abs = 0; } - return (struct bfd_hash_entry *) ret; + return entry; } /* Create the derived linker hash table. The PA ELF port uses the derived @@ -506,12 +477,13 @@ elf32_hppa_link_hash_table_create (abfd) bfd *abfd; { struct elf32_hppa_link_hash_table *ret; + bfd_size_type amt = sizeof (*ret); - ret = ((struct elf32_hppa_link_hash_table *) bfd_alloc (abfd, sizeof (*ret))); + ret = (struct elf32_hppa_link_hash_table *) bfd_alloc (abfd, amt); if (ret == NULL) return NULL; - if (!_bfd_elf_link_hash_table_init (&ret->root, abfd, hppa_link_hash_newfunc)) + if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd, hppa_link_hash_newfunc)) { bfd_release (abfd, ret); return NULL; @@ -538,7 +510,7 @@ elf32_hppa_link_hash_table_create (abfd) ret->has_17bit_branch = 0; ret->need_plt_stub = 0; - return &ret->root.root; + return &ret->elf.root; } /* Build a name for an entry in the stub hash table. */ @@ -551,7 +523,7 @@ hppa_stub_name (input_section, sym_sec, const Elf_Internal_Rela *rel; { char *stub_name; - size_t len; + bfd_size_type len; if (hash) { @@ -585,12 +557,12 @@ hppa_stub_name (input_section, sym_sec, creating the stub name takes a bit of time. */ static struct elf32_hppa_stub_hash_entry * -hppa_get_stub_entry (input_section, sym_sec, hash, rel, hplink) +hppa_get_stub_entry (input_section, sym_sec, hash, rel, htab) const asection *input_section; const asection *sym_sec; struct elf32_hppa_link_hash_entry *hash; const Elf_Internal_Rela *rel; - struct elf32_hppa_link_hash_table *hplink; + struct elf32_hppa_link_hash_table *htab; { struct elf32_hppa_stub_hash_entry *stub_entry; const asection *id_sec; @@ -600,7 +572,7 @@ hppa_get_stub_entry (input_section, sym_ Stub names need to include a section id, as there may well be more than one stub used to reach say, printf, and we need to distinguish between them. */ - id_sec = hplink->stub_group[input_section->id].link_sec; + id_sec = htab->stub_group[input_section->id].link_sec; if (hash != NULL && hash->stub_cache != NULL && hash->stub_cache->h == hash @@ -616,13 +588,13 @@ hppa_get_stub_entry (input_section, sym_ if (stub_name == NULL) return NULL; - stub_entry = hppa_stub_hash_lookup (&hplink->stub_hash_table, + stub_entry = hppa_stub_hash_lookup (&htab->stub_hash_table, stub_name, false, false); if (stub_entry == NULL) { if (hash == NULL || hash->elf.root.type != bfd_link_hash_undefweak) (*_bfd_error_handler) (_("%s(%s+0x%lx): cannot find stub entry %s"), - bfd_get_filename (input_section->owner), + bfd_archive_filename (input_section->owner), input_section->name, (long) rel->r_offset, stub_name); @@ -643,55 +615,52 @@ hppa_get_stub_entry (input_section, sym_ stub entry are initialised. */ static struct elf32_hppa_stub_hash_entry * -hppa_add_stub (stub_name, section, hplink) +hppa_add_stub (stub_name, section, htab) const char *stub_name; asection *section; - struct elf32_hppa_link_hash_table *hplink; + struct elf32_hppa_link_hash_table *htab; { asection *link_sec; asection *stub_sec; struct elf32_hppa_stub_hash_entry *stub_entry; - link_sec = hplink->stub_group[section->id].link_sec; - stub_sec = hplink->stub_group[section->id].stub_sec; + link_sec = htab->stub_group[section->id].link_sec; + stub_sec = htab->stub_group[section->id].stub_sec; if (stub_sec == NULL) { - stub_sec = hplink->stub_group[link_sec->id].stub_sec; + stub_sec = htab->stub_group[link_sec->id].stub_sec; if (stub_sec == NULL) { - size_t len; + bfd_size_type len; char *s_name; len = strlen (link_sec->name) + sizeof (STUB_SUFFIX); - s_name = bfd_alloc (hplink->stub_bfd, len); + s_name = bfd_alloc (htab->stub_bfd, len); if (s_name == NULL) return NULL; strcpy (s_name, link_sec->name); strcpy (s_name + len - sizeof (STUB_SUFFIX), STUB_SUFFIX); - stub_sec = (*hplink->add_stub_section) (s_name, link_sec); + stub_sec = (*htab->add_stub_section) (s_name, link_sec); if (stub_sec == NULL) return NULL; - hplink->stub_group[link_sec->id].stub_sec = stub_sec; + htab->stub_group[link_sec->id].stub_sec = stub_sec; } - hplink->stub_group[section->id].stub_sec = stub_sec; + htab->stub_group[section->id].stub_sec = stub_sec; } /* Enter this entry into the linker stub hash table. */ - stub_entry = hppa_stub_hash_lookup (&hplink->stub_hash_table, stub_name, + stub_entry = hppa_stub_hash_lookup (&htab->stub_hash_table, stub_name, true, false); if (stub_entry == NULL) { (*_bfd_error_handler) (_("%s: cannot create stub entry %s"), - bfd_get_filename (section->owner), + bfd_archive_filename (section->owner), stub_name); return NULL; } stub_entry->stub_sec = stub_sec; -#if ! LONG_BRANCH_PIC_IN_SHLIB - stub_entry->reloc_sec = hplink->stub_group[section->id].reloc_sec; -#endif stub_entry->stub_offset = 0; stub_entry->id_sec = link_sec; return stub_entry; @@ -756,21 +725,8 @@ hppa_type_of_stub (input_sec, rel, hash, } if (branch_offset + max_branch_offset >= 2*max_branch_offset) - { -#if LONG_BRANCH_VIA_PLT - if (hash != NULL - && hash->elf.dynindx != -1 - && hash->elf.plt.offset != (bfd_vma) -1 - && hash->elf.type != STT_PARISC_MILLI) - { - /* If we are doing a shared link and find we need a long - branch stub, then go via the .plt if possible. */ - return hppa_stub_import; - } - else -#endif - return hppa_stub_long_branch; - } + return hppa_stub_long_branch; + return hppa_stub_none; } @@ -820,7 +776,7 @@ hppa_build_one_stub (gen_entry, in_arg) { struct elf32_hppa_stub_hash_entry *stub_entry; struct bfd_link_info *info; - struct elf32_hppa_link_hash_table *hplink; + struct elf32_hppa_link_hash_table *htab; asection *stub_sec; bfd *stub_bfd; bfd_byte *loc; @@ -834,7 +790,7 @@ hppa_build_one_stub (gen_entry, in_arg) stub_entry = (struct elf32_hppa_stub_hash_entry *) gen_entry; info = (struct bfd_link_info *) in_arg; - hplink = hppa_link_hash_table (info); + htab = hppa_link_hash_table (info); stub_sec = stub_entry->stub_sec; /* Make a note of the offset within the stubs for this entry. */ @@ -862,51 +818,6 @@ hppa_build_one_stub (gen_entry, in_arg) insn = hppa_rebuild_insn ((int) BE_SR4_R1, val, 17); bfd_put_32 (stub_bfd, insn, loc + 4); -#if ! LONG_BRANCH_PIC_IN_SHLIB - if (info->shared) - { - /* Output a dynamic relocation for this stub. We only - output one PCREL21L reloc per stub, trusting that the - dynamic linker will also fix the implied PCREL17R for the - second instruction. PCREL21L dynamic relocs had better - never be emitted for some other purpose... */ - asection *srel; - Elf_Internal_Rela outrel; - - if (stub_entry->h == NULL) - { - (*_bfd_error_handler) - (_("%s(%s+0x%lx): cannot relocate %s, recompile with -ffunction-sections"), - bfd_get_filename (stub_entry->target_section->owner), - stub_sec->name, - (long) stub_entry->stub_offset, - stub_entry->root.string); - bfd_set_error (bfd_error_bad_value); - return false; - } - - srel = stub_entry->reloc_sec; - if (srel == NULL) - { - (*_bfd_error_handler) - (_("Could not find relocation section for %s"), - stub_sec->name); - bfd_set_error (bfd_error_bad_value); - return false; - } - - outrel.r_offset = (stub_entry->stub_offset - + stub_sec->output_offset - + stub_sec->output_section->vma); - outrel.r_info = ELF32_R_INFO (0, R_PARISC_PCREL21L); - outrel.r_addend = sym_value; - bfd_elf32_swap_reloca_out (stub_sec->output_section->owner, - &outrel, - ((Elf32_External_Rela *) - srel->contents + srel->reloc_count)); - ++srel->reloc_count; - } -#endif size = 8; break; @@ -940,9 +851,9 @@ hppa_build_one_stub (gen_entry, in_arg) off &= ~ (bfd_vma) 1; sym_value = (off - + hplink->splt->output_offset - + hplink->splt->output_section->vma - - elf_gp (hplink->splt->output_section->owner)); + + htab->splt->output_offset + + htab->splt->output_section->vma + - elf_gp (htab->splt->output_section->owner)); insn = ADDIL_DP; #if R19_STUBS @@ -962,7 +873,7 @@ hppa_build_one_stub (gen_entry, in_arg) insn = hppa_rebuild_insn ((int) LDW_R1_R21, val, 14); bfd_put_32 (stub_bfd, insn, loc + 4); - if (hplink->multi_subspace) + if (htab->multi_subspace) { val = hppa_field_adjust (sym_value, (bfd_signed_vma) 4, e_rrsel); insn = hppa_rebuild_insn ((int) LDW_R1_DLT, val, 14); @@ -995,7 +906,7 @@ hppa_build_one_stub (gen_entry, in_arg) struct elf32_hppa_link_hash_entry *eh; bfd_vma value; - dynobj = hplink->root.dynobj; + dynobj = htab->elf.dynobj; eh = (struct elf32_hppa_link_hash_entry *) stub_entry->h; if (eh->elf.root.type != bfd_link_hash_defined @@ -1012,11 +923,11 @@ hppa_build_one_stub (gen_entry, in_arg) <__gp>. */ - bfd_put_32 (hplink->splt->owner, value, - hplink->splt->contents + off); - value = elf_gp (hplink->splt->output_section->owner); - bfd_put_32 (hplink->splt->owner, value, - hplink->splt->contents + off + 4); + bfd_put_32 (htab->splt->owner, value, + htab->splt->contents + off); + value = elf_gp (htab->splt->output_section->owner); + bfd_put_32 (htab->splt->owner, value, + htab->splt->contents + off + 4); } break; @@ -1035,7 +946,7 @@ hppa_build_one_stub (gen_entry, in_arg) { (*_bfd_error_handler) (_("%s(%s+0x%lx): cannot reach %s, recompile with -ffunction-sections"), - bfd_get_filename (stub_entry->target_section->owner), + bfd_archive_filename (stub_entry->target_section->owner), stub_sec->name, (long) stub_entry->stub_offset, stub_entry->root.string); @@ -1100,28 +1011,22 @@ hppa_size_one_stub (gen_entry, in_arg) PTR in_arg; { struct elf32_hppa_stub_hash_entry *stub_entry; - struct elf32_hppa_link_hash_table *hplink; + struct elf32_hppa_link_hash_table *htab; int size; /* Massage our args to the form they really have. */ stub_entry = (struct elf32_hppa_stub_hash_entry *) gen_entry; - hplink = (struct elf32_hppa_link_hash_table *) in_arg; + htab = (struct elf32_hppa_link_hash_table *) in_arg; if (stub_entry->stub_type == hppa_stub_long_branch) - { -#if ! LONG_BRANCH_PIC_IN_SHLIB - if (stub_entry->reloc_sec != NULL) - stub_entry->reloc_sec->_raw_size += sizeof (Elf32_External_Rela); -#endif - size = 8; - } + size = 8; else if (stub_entry->stub_type == hppa_stub_long_branch_shared) size = 12; else if (stub_entry->stub_type == hppa_stub_export) size = 24; else /* hppa_stub_import or hppa_stub_import_shared. */ { - if (hplink->multi_subspace) + if (htab->multi_subspace) size = 28; else size = 16; @@ -1193,43 +1098,65 @@ elf32_hppa_create_dynamic_sections (abfd bfd *abfd; struct bfd_link_info *info; { - struct elf32_hppa_link_hash_table *hplink; + struct elf32_hppa_link_hash_table *htab; /* Don't try to create the .plt and .got twice. */ - hplink = hppa_link_hash_table (info); - if (hplink->splt != NULL) + htab = hppa_link_hash_table (info); + if (htab->splt != NULL) return true; /* Call the generic code to do most of the work. */ if (! _bfd_elf_create_dynamic_sections (abfd, info)) return false; - hplink->splt = bfd_get_section_by_name (abfd, ".plt"); - hplink->srelplt = bfd_get_section_by_name (abfd, ".rela.plt"); + htab->splt = bfd_get_section_by_name (abfd, ".plt"); + htab->srelplt = bfd_get_section_by_name (abfd, ".rela.plt"); - hplink->sgot = bfd_get_section_by_name (abfd, ".got"); - hplink->srelgot = bfd_make_section (abfd, ".rela.got"); - if (hplink->srelgot == NULL - || ! bfd_set_section_flags (abfd, hplink->srelgot, + htab->sgot = bfd_get_section_by_name (abfd, ".got"); + htab->srelgot = bfd_make_section (abfd, ".rela.got"); + if (htab->srelgot == NULL + || ! bfd_set_section_flags (abfd, htab->srelgot, (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED | SEC_READONLY)) - || ! bfd_set_section_alignment (abfd, hplink->srelgot, 2)) + || ! bfd_set_section_alignment (abfd, htab->srelgot, 2)) return false; - hplink->sdynbss = bfd_get_section_by_name (abfd, ".dynbss"); - hplink->srelbss = bfd_get_section_by_name (abfd, ".rela.bss"); + htab->sdynbss = bfd_get_section_by_name (abfd, ".dynbss"); + htab->srelbss = bfd_get_section_by_name (abfd, ".rela.bss"); return true; } +/* Copy the extra info we tack onto an elf_link_hash_entry. */ + +static void +elf32_hppa_copy_indirect_symbol (dir, ind) + struct elf_link_hash_entry *dir, *ind; +{ + struct elf32_hppa_link_hash_entry *edir, *eind; + + edir = (struct elf32_hppa_link_hash_entry *) dir; + eind = (struct elf32_hppa_link_hash_entry *) ind; + + if (edir->dyn_relocs == NULL) + { + edir->dyn_relocs = eind->dyn_relocs; + eind->dyn_relocs = NULL; + } + else if (eind->dyn_relocs != NULL) + abort (); + + _bfd_elf_link_hash_copy_indirect (dir, ind); +} + /* Look through the relocs for a section during the first phase, and - allocate space in the global offset table or procedure linkage - table. At this point we haven't necessarily read all the input - files. */ + calculate needed space in the global offset table, procedure linkage + table, and dynamic reloc sections. At this point we haven't + necessarily read all the input files. */ static boolean elf32_hppa_check_relocs (abfd, info, sec, relocs) @@ -1238,24 +1165,20 @@ elf32_hppa_check_relocs (abfd, info, sec asection *sec; const Elf_Internal_Rela *relocs; { - bfd *dynobj; Elf_Internal_Shdr *symtab_hdr; struct elf_link_hash_entry **sym_hashes; - bfd_signed_vma *local_got_refcounts; const Elf_Internal_Rela *rel; const Elf_Internal_Rela *rel_end; - struct elf32_hppa_link_hash_table *hplink; + struct elf32_hppa_link_hash_table *htab; asection *sreloc; asection *stubreloc; if (info->relocateable) return true; - hplink = hppa_link_hash_table (info); - dynobj = hplink->root.dynobj; + htab = hppa_link_hash_table (info); symtab_hdr = &elf_tdata (abfd)->symtab_hdr; sym_hashes = elf_sym_hashes (abfd); - local_got_refcounts = elf_local_got_refcounts (abfd); sreloc = NULL; stubreloc = NULL; @@ -1266,12 +1189,7 @@ elf32_hppa_check_relocs (abfd, info, sec NEED_GOT = 1, NEED_PLT = 2, NEED_DYNREL = 4, -#if LONG_BRANCH_PIC_IN_SHLIB - NEED_STUBREL = 0, /* We won't be needing them in this case. */ -#else - NEED_STUBREL = 8, -#endif - PLT_PLABEL = 16 + PLT_PLABEL = 8 }; unsigned int r_symndx, r_type; @@ -1327,11 +1245,11 @@ elf32_hppa_check_relocs (abfd, info, sec break; case R_PARISC_PCREL12F: - hplink->has_12bit_branch = 1; + htab->has_12bit_branch = 1; /* Fall thru. */ case R_PARISC_PCREL17C: case R_PARISC_PCREL17F: - hplink->has_17bit_branch = 1; + htab->has_17bit_branch = 1; /* Fall thru. */ case R_PARISC_PCREL22F: /* Function calls might need to go through the .plt, and @@ -1352,9 +1270,9 @@ elf32_hppa_check_relocs (abfd, info, sec stub. Unfortunately, we have to cater for the case where a symbol is forced local by versioning, or due to symbolic linking, and we lose the .plt entry. */ - need_entry = NEED_PLT | NEED_STUBREL; + need_entry = NEED_PLT; if (h->elf.type == STT_PARISC_MILLI) - need_entry = NEED_STUBREL; + need_entry = 0; } break; @@ -1375,7 +1293,7 @@ elf32_hppa_check_relocs (abfd, info, sec { (*_bfd_error_handler) (_("%s: relocation %s can not be used when making a shared object; recompile with -fPIC"), - bfd_get_filename (abfd), + bfd_archive_filename (abfd), elf_hppa_howto_table[r_type].name); bfd_set_error (bfd_error_bad_value); return false; @@ -1395,7 +1313,7 @@ elf32_hppa_check_relocs (abfd, info, sec { (*_bfd_error_handler) (_("%s: relocation %s should not be used when making a shared object; recompile with -fPIC"), - bfd_get_filename (abfd), + bfd_archive_filename (abfd), elf_hppa_howto_table[r_type].name); } /* Fall through. */ @@ -1431,45 +1349,41 @@ elf32_hppa_check_relocs (abfd, info, sec { /* Allocate space for a GOT entry, as well as a dynamic relocation for this entry. */ - if (dynobj == NULL) - hplink->root.dynobj = dynobj = abfd; - - if (hplink->sgot == NULL) + if (htab->sgot == NULL) { - if (! elf32_hppa_create_dynamic_sections (dynobj, info)) + if (htab->elf.dynobj == NULL) + htab->elf.dynobj = abfd; + if (!elf32_hppa_create_dynamic_sections (htab->elf.dynobj, info)) return false; } if (h != NULL) { - if (h->elf.got.refcount == -1) - h->elf.got.refcount = 1; - else - h->elf.got.refcount += 1; + h->elf.got.refcount += 1; } else { + bfd_signed_vma *local_got_refcounts; + /* This is a global offset table entry for a local symbol. */ + local_got_refcounts = elf_local_got_refcounts (abfd); if (local_got_refcounts == NULL) { - size_t size; + bfd_size_type size; /* Allocate space for local got offsets and local plt offsets. Done this way to save polluting elf_obj_tdata with another target specific pointer. */ - size = symtab_hdr->sh_info * 2 * sizeof (bfd_signed_vma); + size = symtab_hdr->sh_info; + size *= 2 * sizeof (bfd_signed_vma); local_got_refcounts = ((bfd_signed_vma *) - bfd_alloc (abfd, size)); + bfd_zalloc (abfd, size)); if (local_got_refcounts == NULL) return false; elf_local_got_refcounts (abfd) = local_got_refcounts; - memset (local_got_refcounts, -1, size); } - if (local_got_refcounts[r_symndx] == -1) - local_got_refcounts[r_symndx] = 1; - else - local_got_refcounts[r_symndx] += 1; + local_got_refcounts[r_symndx] += 1; } } @@ -1487,13 +1401,8 @@ elf32_hppa_check_relocs (abfd, info, sec { if (h != NULL) { - if (h->elf.plt.refcount == -1) - { - h->elf.plt.refcount = 1; - h->elf.elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; - } - else - h->elf.plt.refcount += 1; + h->elf.elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + h->elf.plt.refcount += 1; /* If this .plt entry is for a plabel, mark it so that adjust_dynamic_symbol will keep the entry @@ -1503,41 +1412,37 @@ elf32_hppa_check_relocs (abfd, info, sec } else if (need_entry & PLT_PLABEL) { + bfd_signed_vma *local_got_refcounts; bfd_signed_vma *local_plt_refcounts; + local_got_refcounts = elf_local_got_refcounts (abfd); if (local_got_refcounts == NULL) { - size_t size; + bfd_size_type size; /* Allocate space for local got offsets and local plt offsets. */ - size = symtab_hdr->sh_info * 2 * sizeof (bfd_signed_vma); + size = symtab_hdr->sh_info; + size *= 2 * sizeof (bfd_signed_vma); local_got_refcounts = ((bfd_signed_vma *) - bfd_alloc (abfd, size)); + bfd_zalloc (abfd, size)); if (local_got_refcounts == NULL) return false; elf_local_got_refcounts (abfd) = local_got_refcounts; - memset (local_got_refcounts, -1, size); } local_plt_refcounts = (local_got_refcounts + symtab_hdr->sh_info); - if (local_plt_refcounts[r_symndx] == -1) - local_plt_refcounts[r_symndx] = 1; - else - local_plt_refcounts[r_symndx] += 1; + local_plt_refcounts[r_symndx] += 1; } } } - if (need_entry & (NEED_DYNREL | NEED_STUBREL)) + if (need_entry & NEED_DYNREL) { /* Flag this symbol as having a non-got, non-plt reference so that we generate copy relocs if it turns out to be dynamic. */ - if (need_entry == NEED_DYNREL - && h != NULL - && !info->shared - && (sec->flags & SEC_READONLY) != 0) + if (h != NULL && !info->shared) h->elf.elf_link_hash_flags |= ELF_LINK_NON_GOT_REF; /* If we are creating a shared library then we need to copy @@ -1550,7 +1455,7 @@ elf32_hppa_check_relocs (abfd, info, sec have not seen all the input files, so it is possible that DEF_REGULAR is not set now but will be set later (it is never cleared). We account for that possibility below by - storing information in the reloc_entries field of the + storing information in the dyn_relocs field of the hash table entry. A similar situation to the -Bsymbolic case occurs when @@ -1562,7 +1467,12 @@ elf32_hppa_check_relocs (abfd, info, sec links or visibility changes anyway. A STUB_REL reloc is absolute too, as in that case it is the reloc in the stub we will be creating, rather than copying the PCREL - reloc in the branch. */ + reloc in the branch. + + If on the other hand, we are creating an executable, we + may need to keep relocations for symbols satisfied by a + dynamic library if we manage to avoid copy relocs for the + symbol. */ if ((info->shared && (sec->flags & SEC_ALLOC) != 0 && (IS_ABSOLUTE_RELOC (r_type) @@ -1574,31 +1484,21 @@ elf32_hppa_check_relocs (abfd, info, sec || (!info->shared && (sec->flags & SEC_ALLOC) != 0 && h != NULL - && (h->elf.elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 && (h->elf.root.type == bfd_link_hash_defweak || (h->elf.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0))) { - boolean doit; - asection *srel; - - srel = sreloc; - if ((need_entry & NEED_STUBREL)) - srel = stubreloc; - /* Create a reloc section in dynobj and make room for this reloc. */ - if (srel == NULL) + if (sreloc == NULL) { char *name; + bfd *dynobj; - if (dynobj == NULL) - hplink->root.dynobj = dynobj = abfd; - - name = bfd_elf_string_from_elf_section - (abfd, - elf_elfheader (abfd)->e_shstrndx, - elf_section_data (sec)->rel_hdr.sh_name); + name = (bfd_elf_string_from_elf_section + (abfd, + elf_elfheader (abfd)->e_shstrndx, + elf_section_data (sec)->rel_hdr.sh_name)); if (name == NULL) { (*_bfd_error_handler) @@ -1608,97 +1508,62 @@ elf32_hppa_check_relocs (abfd, info, sec return false; } - if ((need_entry & NEED_STUBREL)) - { - size_t len = strlen (name) + sizeof (STUB_SUFFIX); - char *newname = bfd_malloc (len); + if (htab->elf.dynobj == NULL) + htab->elf.dynobj = abfd; - if (newname == NULL) - return false; - strcpy (newname, name); - strcpy (newname + len - sizeof (STUB_SUFFIX), - STUB_SUFFIX); - name = newname; - } - - srel = bfd_get_section_by_name (dynobj, name); - if (srel == NULL) + dynobj = htab->elf.dynobj; + sreloc = bfd_get_section_by_name (dynobj, name); + if (sreloc == NULL) { flagword flags; - srel = bfd_make_section (dynobj, name); + sreloc = bfd_make_section (dynobj, name); flags = (SEC_HAS_CONTENTS | SEC_READONLY | SEC_IN_MEMORY | SEC_LINKER_CREATED); if ((sec->flags & SEC_ALLOC) != 0) flags |= SEC_ALLOC | SEC_LOAD; - if (srel == NULL - || !bfd_set_section_flags (dynobj, srel, flags) - || !bfd_set_section_alignment (dynobj, srel, 2)) + if (sreloc == NULL + || !bfd_set_section_flags (dynobj, sreloc, flags) + || !bfd_set_section_alignment (dynobj, sreloc, 2)) return false; } - else if ((need_entry & NEED_STUBREL)) - free (name); - if ((need_entry & NEED_STUBREL)) - stubreloc = srel; - else - sreloc = srel; + elf_section_data (sec)->sreloc = sreloc; } -#if ! LONG_BRANCH_PIC_IN_SHLIB - /* If this is a function call, we only need one dynamic - reloc for the stub as all calls to a particular - function will go through the same stub. Actually, a - long branch stub needs two relocations, but we count - on some intelligence on the part of the dynamic - linker. */ - if ((need_entry & NEED_STUBREL)) - { - doit = h->stub_reloc_sec != stubreloc; - h->stub_reloc_sec = stubreloc; - } - else -#endif - doit = 1; - - if (doit) + /* If this is a global symbol, we count the number of + relocations we need for this symbol. */ + if (h != NULL) { - srel->_raw_size += sizeof (Elf32_External_Rela); + struct elf32_hppa_dyn_reloc_entry *p; - /* Keep track of relocations we have entered for - this global symbol, so that we can discard them - later if necessary. */ - if (!info->shared - || (h != NULL - && (! IS_ABSOLUTE_RELOC (rtype) - || (need_entry & NEED_STUBREL)))) + p = h->dyn_relocs; + if (p == NULL || p->sec != sec) { - struct elf32_hppa_dyn_reloc_entry *p; - - for (p = h->reloc_entries; p != NULL; p = p->next) - if (p->section == srel) - break; - + p = ((struct elf32_hppa_dyn_reloc_entry *) + bfd_alloc (htab->elf.dynobj, + (bfd_size_type) sizeof *p)); if (p == NULL) - { - p = ((struct elf32_hppa_dyn_reloc_entry *) - bfd_alloc (dynobj, sizeof *p)); - if (p == NULL) - return false; - p->next = h->reloc_entries; - h->reloc_entries = p; - p->section = srel; - p->count = 0; - } - - /* NEED_STUBREL and NEED_DYNREL are never both - set. Leave the count at zero for the - NEED_STUBREL case as we only ever have one - stub reloc per section per symbol, and this - simplifies code to discard unneeded relocs. */ - if (! (need_entry & NEED_STUBREL)) - ++p->count; + return false; + p->next = h->dyn_relocs; + h->dyn_relocs = p; + p->sec = sec; + p->count = 0; +#if RELATIVE_DYNRELOCS + p->relative_count = 0; +#endif } + + p->count += 1; +#if RELATIVE_DYNRELOCS + if (!IS_ABSOLUTE_RELOC (rtype)) + p->relative_count += 1; +#endif + } + else + { + /* Track dynamic relocs needed for local syms too. */ + elf_section_data (sec)->local_dynrel += 1; } } } @@ -1772,17 +1637,19 @@ elf32_hppa_gc_sweep_hook (abfd, info, se const Elf_Internal_Rela *rel, *relend; unsigned long r_symndx; struct elf_link_hash_entry *h; - struct elf32_hppa_link_hash_table *hplink; + struct elf32_hppa_link_hash_table *htab; bfd *dynobj; + elf_section_data (sec)->local_dynrel = 0; + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; sym_hashes = elf_sym_hashes (abfd); local_got_refcounts = elf_local_got_refcounts (abfd); local_plt_refcounts = local_got_refcounts; if (local_plt_refcounts != NULL) local_plt_refcounts += symtab_hdr->sh_info; - hplink = hppa_link_hash_table (info); - dynobj = hplink->root.dynobj; + htab = hppa_link_hash_table (info); + dynobj = htab->elf.dynobj; if (dynobj == NULL) return true; @@ -1826,9 +1693,29 @@ elf32_hppa_gc_sweep_hook (abfd, info, se r_symndx = ELF32_R_SYM (rel->r_info); if (r_symndx >= symtab_hdr->sh_info) { + struct elf32_hppa_link_hash_entry *eh; + struct elf32_hppa_dyn_reloc_entry **pp; + struct elf32_hppa_dyn_reloc_entry *p; + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + if (h->plt.refcount > 0) h->plt.refcount -= 1; + + eh = (struct elf32_hppa_link_hash_entry *) h; + + for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next) + if (p->sec == sec) + { +#if RELATIVE_DYNRELOCS + if (!IS_ABSOLUTE_RELOC (rtype)) + p->relative_count -= 1; +#endif + p->count -= 1; + if (p->count == 0) + *pp = p->next; + break; + } } else if (local_plt_refcounts != NULL) { @@ -1837,6 +1724,33 @@ elf32_hppa_gc_sweep_hook (abfd, info, se } break; + case R_PARISC_DIR32: + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx >= symtab_hdr->sh_info) + { + struct elf32_hppa_link_hash_entry *eh; + struct elf32_hppa_dyn_reloc_entry **pp; + struct elf32_hppa_dyn_reloc_entry *p; + + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + + eh = (struct elf32_hppa_link_hash_entry *) h; + + for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next) + if (p->sec == sec) + { +#if RELATIVE_DYNRELOCS + if (!IS_ABSOLUTE_RELOC (R_PARISC_DIR32)) + p->relative_count -= 1; +#endif + p->count -= 1; + if (p->count == 0) + *pp = p->next; + break; + } + } + break; + default: break; } @@ -1883,12 +1797,11 @@ elf32_hppa_adjust_dynamic_symbol (info, struct bfd_link_info *info; struct elf_link_hash_entry *h; { - bfd *dynobj; - struct elf32_hppa_link_hash_table *hplink; + struct elf32_hppa_link_hash_table *htab; + struct elf32_hppa_link_hash_entry *eh; + struct elf32_hppa_dyn_reloc_entry *p; asection *s; - - hplink = hppa_link_hash_table (info); - dynobj = hplink->root.dynobj; + unsigned int power_of_two; /* If this is a function, put it in the procedure linkage table. We will fill in the contents of the procedure linkage table later, @@ -1960,6 +1873,22 @@ elf32_hppa_adjust_dynamic_symbol (info, if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0) return true; + eh = (struct elf32_hppa_link_hash_entry *) h; + for (p = eh->dyn_relocs; p != NULL; p = p->next) + { + s = p->sec->output_section; + if (s != NULL && (s->flags & SEC_READONLY) != 0) + break; + } + + /* If we didn't find any dynamic relocs in read-only sections, then + we'll be keeping the dynamic relocs and avoiding the copy reloc. */ + if (p == NULL) + { + h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF; + return true; + } + /* We must allocate the symbol in our .dynbss section, which will become part of the .bss section of the executable. There will be an entry for this symbol in the .dynsym section. The dynamic @@ -1970,39 +1899,34 @@ elf32_hppa_adjust_dynamic_symbol (info, both the dynamic object and the regular object will refer to the same memory location for the variable. */ - s = hplink->sdynbss; + htab = hppa_link_hash_table (info); /* We must generate a COPY reloc to tell the dynamic linker to copy the initial value out of the dynamic object and into the - runtime process image. We need to remember the offset into the - .rela.bss section we are going to use. */ + runtime process image. */ if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) { - asection *srel; - - srel = hplink->srelbss; - srel->_raw_size += sizeof (Elf32_External_Rela); + htab->srelbss->_raw_size += sizeof (Elf32_External_Rela); h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY; } - { - /* We need to figure out the alignment required for this symbol. I - have no idea how other ELF linkers handle this. */ - unsigned int power_of_two; - - power_of_two = bfd_log2 (h->size); - if (power_of_two > 3) - power_of_two = 3; - - /* Apply the required alignment. */ - s->_raw_size = BFD_ALIGN (s->_raw_size, - (bfd_size_type) (1 << power_of_two)); - if (power_of_two > bfd_get_section_alignment (dynobj, s)) - { - if (! bfd_set_section_alignment (dynobj, s, power_of_two)) - return false; - } - } + /* We need to figure out the alignment required for this symbol. I + have no idea how other ELF linkers handle this. */ + + power_of_two = bfd_log2 (h->size); + if (power_of_two > 3) + power_of_two = 3; + + /* Apply the required alignment. */ + s = htab->sdynbss; + s->_raw_size = BFD_ALIGN (s->_raw_size, + (bfd_size_type) (1 << power_of_two)); + if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s)) + { + if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two)) + return false; + } + /* Define the symbol as being at this point in the section. */ h->root.u.def.section = s; h->root.u.def.value = s->_raw_size; @@ -2043,22 +1967,23 @@ hppa_handle_PIC_calls (h, inf) global syms. */ static boolean -allocate_plt_and_got_and_discard_relocs (h, inf) +allocate_dynrelocs (h, inf) struct elf_link_hash_entry *h; PTR inf; { struct bfd_link_info *info; - struct elf32_hppa_link_hash_table *hplink; + struct elf32_hppa_link_hash_table *htab; asection *s; struct elf32_hppa_link_hash_entry *eh; + struct elf32_hppa_dyn_reloc_entry *p; if (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) return true; info = (struct bfd_link_info *) inf; - hplink = hppa_link_hash_table (info); - if ((hplink->root.dynamic_sections_created + htab = hppa_link_hash_table (info); + if ((htab->elf.dynamic_sections_created && h->plt.refcount > 0) || ((struct elf32_hppa_link_hash_entry *) h)->pic_call) { @@ -2073,25 +1998,33 @@ allocate_plt_and_got_and_discard_relocs return false; } - /* Make an entry in the .plt section. */ - s = hplink->splt; - h->plt.offset = s->_raw_size; - if (PLABEL_PLT_ENTRY_SIZE != PLT_ENTRY_SIZE - && ((struct elf32_hppa_link_hash_entry *) h)->plabel - && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + if (((struct elf32_hppa_link_hash_entry *) h)->pic_call + || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h)) { - /* Add some extra space for the dynamic linker to use. */ - s->_raw_size += PLABEL_PLT_ENTRY_SIZE; + /* Make an entry in the .plt section. */ + s = htab->splt; + h->plt.offset = s->_raw_size; + if (PLABEL_PLT_ENTRY_SIZE != PLT_ENTRY_SIZE + && ((struct elf32_hppa_link_hash_entry *) h)->plabel + && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + { + /* Add some extra space for the dynamic linker to use. */ + s->_raw_size += PLABEL_PLT_ENTRY_SIZE; + } + else + s->_raw_size += PLT_ENTRY_SIZE; + + if (! ((struct elf32_hppa_link_hash_entry *) h)->pic_call) + { + /* We also need to make an entry in the .rela.plt section. */ + htab->srelplt->_raw_size += sizeof (Elf32_External_Rela); + htab->need_plt_stub = 1; + } } else - s->_raw_size += PLT_ENTRY_SIZE; - - if (! ((struct elf32_hppa_link_hash_entry *) h)->pic_call - && WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h)) { - /* We also need to make an entry in the .rela.plt section. */ - hplink->srelplt->_raw_size += sizeof (Elf32_External_Rela); - hplink->need_plt_stub = 1; + h->plt.offset = (bfd_vma) -1; + h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; } } else @@ -2114,82 +2047,85 @@ allocate_plt_and_got_and_discard_relocs return false; } - s = hplink->sgot; + s = htab->sgot; h->got.offset = s->_raw_size; s->_raw_size += GOT_ENTRY_SIZE; - dyn = hplink->root.dynamic_sections_created; + dyn = htab->elf.dynamic_sections_created; if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h)) - hplink->srelgot->_raw_size += sizeof (Elf32_External_Rela); + htab->srelgot->_raw_size += sizeof (Elf32_External_Rela); } else h->got.offset = (bfd_vma) -1; - /* If this is a -Bsymbolic shared link, then we need to discard all - space allocated for dynamic relocs against symbols defined in a - regular object. For the normal shared case, discard space for - relocs that have become local due to symbol visibility changes. - For the non-shared case, discard space for symbols which turn out - to need copy relocs or are not dynamic. We also need to lose - relocs we've allocated for long branch stubs if we know we won't - be generating a stub. */ - eh = (struct elf32_hppa_link_hash_entry *) h; - if (eh->reloc_entries == NULL) + if (eh->dyn_relocs == NULL) return true; - /* First handle the non-shared case. */ - if (!info->shared - && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 - && ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - || (hplink->root.dynamic_sections_created - && (h->root.type == bfd_link_hash_undefweak - || h->root.type == bfd_link_hash_undefined)))) + /* If this is a -Bsymbolic shared link, then we need to discard all + space allocated for dynamic pc-relative relocs against symbols + defined in a regular object. For the normal shared case, discard + space for relocs that have become local due to symbol visibility + changes. */ + if (info->shared) { - /* Make sure this symbol is output as a dynamic symbol. - Undefined weak syms won't yet be marked as dynamic. */ - if (h->dynindx == -1 - && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0 - && h->type != STT_PARISC_MILLI) +#if RELATIVE_DYNRELOCS + if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0 + && ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0 + || info->symbolic)) { - if (! bfd_elf32_link_record_dynamic_symbol (info, h)) - return false; + struct elf32_hppa_dyn_reloc_entry **pp; + + for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + { + p->count -= p->relative_count; + p->relative_count = 0; + if (p->count == 0) + *pp = p->next; + else + pp = &p->next; + } } +#endif + } + else + { + /* For the non-shared case, discard space for relocs against + symbols which turn out to need copy relocs or are not + dynamic. */ + if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 + && (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + || (htab->elf.dynamic_sections_created + && (h->root.type == bfd_link_hash_undefweak + || h->root.type == bfd_link_hash_undefined)))) + { + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 + && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0 + && h->type != STT_PARISC_MILLI) + { + if (! bfd_elf32_link_record_dynamic_symbol (info, h)) + return false; + } + + /* If that succeeded, we know we'll be keeping all the + relocs. */ + if (h->dynindx != -1) + goto keep; + } + + eh->dyn_relocs = NULL; + return true; - /* If that succeeded, we know we'll be keeping all the relocs. */ - if (h->dynindx != -1) - return true; - } - -#if ! LONG_BRANCH_PIC_IN_SHLIB && LONG_BRANCH_VIA_PLT - /* Handle the stub reloc case. If we have a plt entry for the - function, we won't be needing long branch stubs. c->count will - only be zero for stub relocs, which provides a handy way of - flagging these relocs, and means we need do nothing special for - the forced local and symbolic link case. */ - if (eh->stub_reloc_sec != NULL - && eh->elf.plt.offset != (bfd_vma) -1) - { - struct elf32_hppa_dyn_reloc_entry *c; - - for (c = eh->reloc_entries; c != NULL; c = c->next) - if (c->count == 0) - c->section->_raw_size -= sizeof (Elf32_External_Rela); + keep: } -#endif - /* Discard any relocs in the non-shared case. For the shared case, - if a symbol has been forced local or we have found a regular - definition for the symbolic link case, then we won't be needing - any relocs. */ - if (!info->shared - || ((eh->elf.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0 - && ((eh->elf.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0 - || info->symbolic))) + /* Finally, allocate space. */ + for (p = eh->dyn_relocs; p != NULL; p = p->next) { - struct elf32_hppa_dyn_reloc_entry *c; - - for (c = eh->reloc_entries; c != NULL; c = c->next) - c->section->_raw_size -= c->count * sizeof (Elf32_External_Rela); + asection *sreloc = elf_section_data (p->sec)->sreloc; + sreloc->_raw_size += p->count * sizeof (Elf32_External_Rela); } return true; @@ -2220,26 +2156,53 @@ clobber_millicode_symbols (h, info) return true; } +/* Find any dynamic relocs that apply to read-only sections. */ + +static boolean +readonly_dynrelocs (h, inf) + struct elf_link_hash_entry *h; + PTR inf; +{ + struct elf32_hppa_link_hash_entry *eh; + struct elf32_hppa_dyn_reloc_entry *p; + + eh = (struct elf32_hppa_link_hash_entry *) h; + for (p = eh->dyn_relocs; p != NULL; p = p->next) + { + asection *s = p->sec->output_section; + + if (s != NULL && (s->flags & SEC_READONLY) != 0) + { + struct bfd_link_info *info = (struct bfd_link_info *) inf; + + info->flags |= DF_TEXTREL; + + /* Not an error, just cut short the traversal. */ + return false; + } + } + return true; +} + /* Set the sizes of the dynamic sections. */ static boolean elf32_hppa_size_dynamic_sections (output_bfd, info) - bfd *output_bfd; + bfd *output_bfd ATTRIBUTE_UNUSED; struct bfd_link_info *info; { - struct elf32_hppa_link_hash_table *hplink; + struct elf32_hppa_link_hash_table *htab; bfd *dynobj; - bfd *i; + bfd *ibfd; asection *s; boolean relocs; - boolean reltext; - hplink = hppa_link_hash_table (info); - dynobj = hplink->root.dynobj; + htab = hppa_link_hash_table (info); + dynobj = htab->elf.dynobj; if (dynobj == NULL) abort (); - if (hplink->root.dynamic_sections_created) + if (htab->elf.dynamic_sections_created) { /* Set the contents of the .interp section to the interpreter. */ if (! info->shared) @@ -2252,7 +2215,7 @@ elf32_hppa_size_dynamic_sections (output } /* Force millicode symbols local. */ - elf_link_hash_traverse (&hplink->root, + elf_link_hash_traverse (&htab->elf, clobber_millicode_symbols, info); } @@ -2262,13 +2225,14 @@ elf32_hppa_size_dynamic_sections (output PIC, and allocate space for the necessary .plt entries so that %r19 will be set up. */ if (! info->shared) - elf_link_hash_traverse (&hplink->root, + elf_link_hash_traverse (&htab->elf, hppa_handle_PIC_calls, info); } - /* Set up .got and .plt offsets for local syms. */ - for (i = info->input_bfds; i; i = i->link_next) + /* Set up .got and .plt offsets for local syms, and space for local + dynamic relocs. */ + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) { bfd_signed_vma *local_got; bfd_signed_vma *end_local_got; @@ -2278,18 +2242,29 @@ elf32_hppa_size_dynamic_sections (output Elf_Internal_Shdr *symtab_hdr; asection *srel; - if (bfd_get_flavour (i) != bfd_target_elf_flavour) + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour) continue; - local_got = elf_local_got_refcounts (i); + for (s = ibfd->sections; s != NULL; s = s->next) + { + bfd_size_type count = elf_section_data (s)->local_dynrel; + + if (count != 0) + { + srel = elf_section_data (s)->sreloc; + srel->_raw_size += count * sizeof (Elf32_External_Rela); + } + } + + local_got = elf_local_got_refcounts (ibfd); if (!local_got) continue; - symtab_hdr = &elf_tdata (i)->symtab_hdr; + symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; locsymcount = symtab_hdr->sh_info; end_local_got = local_got + locsymcount; - s = hplink->sgot; - srel = hplink->srelgot; + s = htab->sgot; + srel = htab->srelgot; for (; local_got < end_local_got; ++local_got) { if (*local_got > 0) @@ -2305,7 +2280,7 @@ elf32_hppa_size_dynamic_sections (output local_plt = end_local_got; end_local_plt = local_plt + locsymcount; - if (! hplink->root.dynamic_sections_created) + if (! htab->elf.dynamic_sections_created) { /* Won't be used, but be safe. */ for (; local_plt < end_local_plt; ++local_plt) @@ -2313,8 +2288,8 @@ elf32_hppa_size_dynamic_sections (output } else { - s = hplink->splt; - srel = hplink->srelplt; + s = htab->splt; + srel = htab->srelplt; for (; local_plt < end_local_plt; ++local_plt) { if (*local_plt > 0) @@ -2330,30 +2305,27 @@ elf32_hppa_size_dynamic_sections (output } } - /* Allocate global sym .plt and .got entries. Also discard all - unneeded relocs. */ - elf_link_hash_traverse (&hplink->root, - allocate_plt_and_got_and_discard_relocs, - (PTR) info); + /* Allocate global sym .plt and .got entries, and space for global + sym dynamic relocs. */ + elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info); /* The check_relocs and adjust_dynamic_symbol entry points have determined the sizes of the various dynamic sections. Allocate memory for them. */ relocs = false; - reltext = false; for (s = dynobj->sections; s != NULL; s = s->next) { if ((s->flags & SEC_LINKER_CREATED) == 0) continue; - if (s == hplink->splt) + if (s == htab->splt) { - if (hplink->need_plt_stub) + if (htab->need_plt_stub) { /* Make space for the plt stub at the end of the .plt section. We want this stub right at the end, up against the .got section. */ - int gotalign = bfd_section_alignment (dynobj, hplink->sgot); + int gotalign = bfd_section_alignment (dynobj, htab->sgot); int pltalign = bfd_section_alignment (dynobj, s); bfd_size_type mask; @@ -2363,30 +2335,17 @@ elf32_hppa_size_dynamic_sections (output s->_raw_size = (s->_raw_size + sizeof (plt_stub) + mask) & ~mask; } } - else if (s == hplink->sgot) + else if (s == htab->sgot) ; else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0) { if (s->_raw_size != 0) { - asection *target; - const char *outname; - /* Remember whether there are any reloc sections other than .rela.plt. */ - if (s != hplink->srelplt) + if (s != htab->srelplt) relocs = true; - /* If this relocation section applies to a read only - section, then we probably need a DT_TEXTREL entry. */ - outname = bfd_get_section_name (output_bfd, - s->output_section); - target = bfd_get_section_by_name (output_bfd, outname + 5); - if (target != NULL - && (target->flags & SEC_READONLY) != 0 - && (target->flags & SEC_ALLOC) != 0) - reltext = true; - /* We use the reloc_count field as a counter if we need to copy relocs into the output file. */ s->reloc_count = 0; @@ -2420,13 +2379,16 @@ elf32_hppa_size_dynamic_sections (output return false; } - if (hplink->root.dynamic_sections_created) + if (htab->elf.dynamic_sections_created) { /* Like IA-64 and HPPA64, always create a DT_PLTGOT. It actually has nothing to do with the PLT, it is how we communicate the LTP value of a load module to the dynamic linker. */ - if (! bfd_elf32_add_dynamic_entry (info, DT_PLTGOT, 0)) +#define add_dynamic_entry(TAG, VAL) \ + bfd_elf32_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL)) + + if (!add_dynamic_entry (DT_PLTGOT, 0)) return false; /* Add some entries to the .dynamic section. We fill in the @@ -2434,36 +2396,39 @@ elf32_hppa_size_dynamic_sections (output must add the entries now so that we get the correct size for the .dynamic section. The DT_DEBUG entry is filled in by the dynamic linker and used by the debugger. */ - if (! info->shared) + if (!info->shared) { - if (! bfd_elf32_add_dynamic_entry (info, DT_DEBUG, 0)) + if (!add_dynamic_entry (DT_DEBUG, 0)) return false; } - if (hplink->srelplt->_raw_size != 0) + if (htab->srelplt->_raw_size != 0) { - if (! bfd_elf32_add_dynamic_entry (info, DT_PLTRELSZ, 0) - || ! bfd_elf32_add_dynamic_entry (info, DT_PLTREL, DT_RELA) - || ! bfd_elf32_add_dynamic_entry (info, DT_JMPREL, 0)) + if (!add_dynamic_entry (DT_PLTRELSZ, 0) + || !add_dynamic_entry (DT_PLTREL, DT_RELA) + || !add_dynamic_entry (DT_JMPREL, 0)) return false; } if (relocs) { - if (! bfd_elf32_add_dynamic_entry (info, DT_RELA, 0) - || ! bfd_elf32_add_dynamic_entry (info, DT_RELASZ, 0) - || ! bfd_elf32_add_dynamic_entry (info, DT_RELAENT, - sizeof (Elf32_External_Rela))) + if (!add_dynamic_entry (DT_RELA, 0) + || !add_dynamic_entry (DT_RELASZ, 0) + || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela))) return false; - } - if (reltext) - { - if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0)) - return false; - info->flags |= DF_TEXTREL; + /* If any dynamic relocs apply to a read-only section, + then we need a DT_TEXTREL entry. */ + elf_link_hash_traverse (&htab->elf, readonly_dynrelocs, (PTR) info); + + if ((info->flags & DF_TEXTREL) != 0) + { + if (!add_dynamic_entry (DT_TEXTREL, 0)) + return false; + } } } +#undef add_dynamic_entry return true; } @@ -2493,19 +2458,20 @@ elf32_hppa_size_stubs (output_bfd, stub_ Elf_Internal_Sym *local_syms, **all_local_syms; unsigned int bfd_indx, bfd_count; int top_id, top_index; - struct elf32_hppa_link_hash_table *hplink; + struct elf32_hppa_link_hash_table *htab; bfd_size_type stub_group_size; boolean stubs_always_before_branch; boolean stub_changed = 0; boolean ret = 0; + bfd_size_type amt; - hplink = hppa_link_hash_table (info); + htab = hppa_link_hash_table (info); /* Stash our params away. */ - hplink->stub_bfd = stub_bfd; - hplink->multi_subspace = multi_subspace; - hplink->add_stub_section = add_stub_section; - hplink->layout_sections_again = layout_sections_again; + htab->stub_bfd = stub_bfd; + htab->multi_subspace = multi_subspace; + htab->add_stub_section = add_stub_section; + htab->layout_sections_again = layout_sections_again; stubs_always_before_branch = group_size < 0; if (group_size < 0) stub_group_size = -group_size; @@ -2515,9 +2481,9 @@ elf32_hppa_size_stubs (output_bfd, stub_ { /* Default values. */ stub_group_size = 8000000; - if (hplink->has_17bit_branch || hplink->multi_subspace) + if (htab->has_17bit_branch || htab->multi_subspace) stub_group_size = 250000; - if (hplink->has_12bit_branch) + if (htab->has_12bit_branch) stub_group_size = 7812; } @@ -2536,9 +2502,9 @@ elf32_hppa_size_stubs (output_bfd, stub_ } } - hplink->stub_group - = (struct map_stub *) bfd_zmalloc (sizeof (struct map_stub) * (top_id + 1)); - if (hplink->stub_group == NULL) + amt = sizeof (struct map_stub) * (top_id + 1); + htab->stub_group = (struct map_stub *) bfd_zmalloc (amt); + if (htab->stub_group == NULL) return false; /* Make a list of input sections for each output section included in @@ -2555,8 +2521,8 @@ elf32_hppa_size_stubs (output_bfd, stub_ top_index = section->index; } - input_list - = (asection **) bfd_malloc (sizeof (asection *) * (top_index + 1)); + amt = sizeof (asection *) * (top_index + 1); + input_list = (asection **) bfd_malloc (amt); if (input_list == NULL) return false; @@ -2592,7 +2558,7 @@ elf32_hppa_size_stubs (output_bfd, stub_ if (*list != bfd_abs_section_ptr) { /* Steal the link_sec pointer for our list. */ -#define PREV_SEC(sec) (hplink->stub_group[(sec)->id].link_sec) +#define PREV_SEC(sec) (htab->stub_group[(sec)->id].link_sec) /* This happens to make the list in reverse order, which is what we want. */ PREV_SEC (section) = *list; @@ -2645,7 +2611,7 @@ elf32_hppa_size_stubs (output_bfd, stub_ { prev = PREV_SEC (tail); /* Set up this stub group. */ - hplink->stub_group[tail->id].link_sec = curr; + htab->stub_group[tail->id].link_sec = curr; } while (tail != curr && (tail = prev) != NULL); @@ -2660,7 +2626,7 @@ elf32_hppa_size_stubs (output_bfd, stub_ { tail = prev; prev = PREV_SEC (tail); - hplink->stub_group[tail->id].link_sec = curr; + htab->stub_group[tail->id].link_sec = curr; } } tail = prev; @@ -2673,9 +2639,8 @@ elf32_hppa_size_stubs (output_bfd, stub_ /* We want to read in symbol extension records only once. To do this we need to read in the local symbols in parallel and save them for later use; so hold pointers to the local symbols in an array. */ - all_local_syms - = (Elf_Internal_Sym **) bfd_zmalloc (sizeof (Elf_Internal_Sym *) - * bfd_count); + amt = sizeof (Elf_Internal_Sym *) * bfd_count; + all_local_syms = (Elf_Internal_Sym **) bfd_zmalloc (amt); if (all_local_syms == NULL) return false; @@ -2689,6 +2654,7 @@ elf32_hppa_size_stubs (output_bfd, stub_ Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Sym *isym; Elf32_External_Sym *ext_syms, *esym, *end_sy; + bfd_size_type sec_size; /* We'll need the symbol table in a second. */ symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; @@ -2697,25 +2663,24 @@ elf32_hppa_size_stubs (output_bfd, stub_ /* We need an array of the local symbols attached to the input bfd. Unfortunately, we're going to have to read & swap them in. */ - local_syms = (Elf_Internal_Sym *) - bfd_malloc (symtab_hdr->sh_info * sizeof (Elf_Internal_Sym)); + sec_size = symtab_hdr->sh_info; + sec_size *= sizeof (Elf_Internal_Sym); + local_syms = (Elf_Internal_Sym *) bfd_malloc (sec_size); if (local_syms == NULL) { goto error_ret_free_local; } all_local_syms[bfd_indx] = local_syms; - ext_syms = (Elf32_External_Sym *) - bfd_malloc (symtab_hdr->sh_info * sizeof (Elf32_External_Sym)); + sec_size = symtab_hdr->sh_info; + sec_size *= sizeof (Elf32_External_Sym); + ext_syms = (Elf32_External_Sym *) bfd_malloc (sec_size); if (ext_syms == NULL) { goto error_ret_free_local; } if (bfd_seek (input_bfd, symtab_hdr->sh_offset, SEEK_SET) != 0 - || (bfd_read (ext_syms, 1, - (symtab_hdr->sh_info * sizeof (Elf32_External_Sym)), - input_bfd) - != (symtab_hdr->sh_info * sizeof (Elf32_External_Sym)))) + || (bfd_bread (ext_syms, sec_size, input_bfd) != sec_size)) { free (ext_syms); goto error_ret_free_local; @@ -2730,29 +2695,7 @@ elf32_hppa_size_stubs (output_bfd, stub_ /* Now we can free the external symbols. */ free (ext_syms); -#if ! LONG_BRANCH_PIC_IN_SHLIB - /* If this is a shared link, find all the stub reloc sections. */ - if (info->shared) - for (section = input_bfd->sections; - section != NULL; - section = section->next) - { - char *name; - asection *reloc_sec; - - name = bfd_malloc (strlen (section->name) - + sizeof STUB_SUFFIX - + 5); - if (name == NULL) - return false; - sprintf (name, ".rela%s%s", section->name, STUB_SUFFIX); - reloc_sec = bfd_get_section_by_name (hplink->root.dynobj, name); - hplink->stub_group[section->id].reloc_sec = reloc_sec; - free (name); - } -#endif - - if (info->shared && hplink->multi_subspace) + if (info->shared && htab->multi_subspace) { struct elf_link_hash_entry **sym_hashes; struct elf_link_hash_entry **end_hashes; @@ -2796,12 +2739,12 @@ elf32_hppa_size_stubs (output_bfd, stub_ sec = hash->elf.root.u.def.section; stub_name = hash->elf.root.root.string; - stub_entry = hppa_stub_hash_lookup (&hplink->stub_hash_table, + stub_entry = hppa_stub_hash_lookup (&htab->stub_hash_table, stub_name, false, false); if (stub_entry == NULL) { - stub_entry = hppa_add_stub (stub_name, sec, hplink); + stub_entry = hppa_add_stub (stub_name, sec, htab); if (!stub_entry) goto error_ret_free_local; @@ -2814,8 +2757,8 @@ elf32_hppa_size_stubs (output_bfd, stub_ else { (*_bfd_error_handler) (_("%s: duplicate export stub %s"), - bfd_get_filename (input_bfd), - stub_name); + bfd_archive_filename (input_bfd), + stub_name); } } } @@ -2861,19 +2804,18 @@ elf32_hppa_size_stubs (output_bfd, stub_ continue; /* Allocate space for the external relocations. */ - external_relocs - = ((Elf32_External_Rela *) - bfd_malloc (section->reloc_count - * sizeof (Elf32_External_Rela))); + amt = section->reloc_count; + amt *= sizeof (Elf32_External_Rela); + external_relocs = (Elf32_External_Rela *) bfd_malloc (amt); if (external_relocs == NULL) { goto error_ret_free_local; } /* Likewise for the internal relocations. */ - internal_relocs = ((Elf_Internal_Rela *) - bfd_malloc (section->reloc_count - * sizeof (Elf_Internal_Rela))); + amt = section->reloc_count; + amt *= sizeof (Elf_Internal_Rela); + internal_relocs = (Elf_Internal_Rela *) bfd_malloc (amt); if (internal_relocs == NULL) { free (external_relocs); @@ -2883,7 +2825,7 @@ elf32_hppa_size_stubs (output_bfd, stub_ /* Read in the external relocs. */ input_rel_hdr = &elf_section_data (section)->rel_hdr; if (bfd_seek (input_bfd, input_rel_hdr->sh_offset, SEEK_SET) != 0 - || bfd_read (external_relocs, 1, + || bfd_bread (external_relocs, input_rel_hdr->sh_size, input_bfd) != input_rel_hdr->sh_size) { @@ -3005,14 +2947,14 @@ elf32_hppa_size_stubs (output_bfd, stub_ continue; /* Support for grouping stub sections. */ - id_sec = hplink->stub_group[section->id].link_sec; + id_sec = htab->stub_group[section->id].link_sec; /* Get the name of this stub. */ stub_name = hppa_stub_name (id_sec, sym_sec, hash, irela); if (!stub_name) goto error_ret_free_internal; - stub_entry = hppa_stub_hash_lookup (&hplink->stub_hash_table, + stub_entry = hppa_stub_hash_lookup (&htab->stub_hash_table, stub_name, false, false); if (stub_entry != NULL) @@ -3022,7 +2964,7 @@ elf32_hppa_size_stubs (output_bfd, stub_ continue; } - stub_entry = hppa_add_stub (stub_name, section, hplink); + stub_entry = hppa_add_stub (stub_name, section, htab); if (stub_entry == NULL) { free (stub_name); @@ -3036,8 +2978,7 @@ elf32_hppa_size_stubs (output_bfd, stub_ { if (stub_type == hppa_stub_import) stub_entry->stub_type = hppa_stub_import_shared; - else if (stub_type == hppa_stub_long_branch - && (LONG_BRANCH_PIC_IN_SHLIB || hash == NULL)) + else if (stub_type == hppa_stub_long_branch) stub_entry->stub_type = hppa_stub_long_branch_shared; } stub_entry->h = hash; @@ -3054,36 +2995,18 @@ elf32_hppa_size_stubs (output_bfd, stub_ /* OK, we've added some stubs. Find out the new size of the stub sections. */ - for (stub_sec = hplink->stub_bfd->sections; + for (stub_sec = htab->stub_bfd->sections; stub_sec != NULL; stub_sec = stub_sec->next) { stub_sec->_raw_size = 0; stub_sec->_cooked_size = 0; } -#if ! LONG_BRANCH_PIC_IN_SHLIB - { - int i; - for (i = top_id; i >= 0; --i) - { - /* This will probably hit the same section many times.. */ - stub_sec = hplink->stub_group[i].reloc_sec; - if (stub_sec != NULL) - { - stub_sec->_raw_size = 0; - stub_sec->_cooked_size = 0; - } - } - } -#endif - - bfd_hash_traverse (&hplink->stub_hash_table, - hppa_size_one_stub, - hplink); + bfd_hash_traverse (&htab->stub_hash_table, hppa_size_one_stub, htab); /* Ask the linker to do its stuff. */ - (*hplink->layout_sections_again) (); + (*htab->layout_sections_again) (); stub_changed = 0; } @@ -3106,14 +3029,13 @@ elf32_hppa_set_gp (abfd, info) bfd *abfd; struct bfd_link_info *info; { - struct elf32_hppa_link_hash_table *hplink; + struct elf32_hppa_link_hash_table *htab; struct elf_link_hash_entry *h; asection *sec; bfd_vma gp_val; - hplink = hppa_link_hash_table (info); - h = elf_link_hash_lookup (&hplink->root, "$global$", - false, false, false); + htab = hppa_link_hash_table (info); + h = elf_link_hash_lookup (&htab->elf, "$global$", false, false, false); if (h != NULL && (h->root.type == bfd_link_hash_defined @@ -3133,12 +3055,12 @@ elf32_hppa_set_gp (abfd, info) the .plt and .got are smaller than 0x2000, choose the end of the .plt section. */ - sec = hplink->splt; + sec = htab->splt; if (sec != NULL) { gp_val = sec->_raw_size; if (gp_val > 0x2000 - || (hplink->sgot && hplink->sgot->_raw_size > 0x2000)) + || (htab->sgot && htab->sgot->_raw_size > 0x2000)) { gp_val = 0x2000; } @@ -3146,7 +3068,7 @@ elf32_hppa_set_gp (abfd, info) else { gp_val = 0; - sec = hplink->sgot; + sec = htab->sgot; if (sec != NULL) { /* We know we don't have a .plt. If .got is large, @@ -3191,27 +3113,26 @@ elf32_hppa_build_stubs (info) { asection *stub_sec; struct bfd_hash_table *table; - struct elf32_hppa_link_hash_table *hplink; + struct elf32_hppa_link_hash_table *htab; - hplink = hppa_link_hash_table (info); + htab = hppa_link_hash_table (info); - for (stub_sec = hplink->stub_bfd->sections; + for (stub_sec = htab->stub_bfd->sections; stub_sec != NULL; stub_sec = stub_sec->next) { - size_t size; + bfd_size_type size; /* Allocate memory to hold the linker stubs. */ size = stub_sec->_raw_size; - stub_sec->contents = (unsigned char *) bfd_zalloc (hplink->stub_bfd, - size); + stub_sec->contents = (unsigned char *) bfd_zalloc (htab->stub_bfd, size); if (stub_sec->contents == NULL && size != 0) return false; stub_sec->_raw_size = 0; } /* Build the stubs as directed by the stub hash table. */ - table = &hplink->stub_hash_table; + table = &htab->stub_hash_table; bfd_hash_traverse (table, hppa_build_one_stub, info); return true; @@ -3249,7 +3170,7 @@ elf32_hppa_final_link (abfd, info) if (! bfd_get_section_contents (abfd, s, contents, (file_ptr) 0, size)) return false; - qsort (contents, size / 16, 16, hppa_unwind_entry_compare); + qsort (contents, (size_t) (size / 16), 16, hppa_unwind_entry_compare); if (! bfd_set_section_contents (abfd, s, contents, (file_ptr) 0, size)) return false; @@ -3265,9 +3186,9 @@ hppa_record_segment_addr (abfd, section, asection *section; PTR data; { - struct elf32_hppa_link_hash_table *hplink; + struct elf32_hppa_link_hash_table *htab; - hplink = (struct elf32_hppa_link_hash_table *) data; + htab = (struct elf32_hppa_link_hash_table *) data; if ((section->flags & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) { @@ -3275,13 +3196,13 @@ hppa_record_segment_addr (abfd, section, if ((section->flags & SEC_READONLY) != 0) { - if (value < hplink->text_segment_base) - hplink->text_segment_base = value; + if (value < htab->text_segment_base) + htab->text_segment_base = value; } else { - if (value < hplink->data_segment_base) - hplink->data_segment_base = value; + if (value < htab->data_segment_base) + htab->data_segment_base = value; } } } @@ -3289,12 +3210,12 @@ hppa_record_segment_addr (abfd, section, /* Perform a relocation as part of a final link. */ static bfd_reloc_status_type -final_link_relocate (input_section, contents, rel, value, hplink, sym_sec, h) +final_link_relocate (input_section, contents, rel, value, htab, sym_sec, h) asection *input_section; bfd_byte *contents; const Elf_Internal_Rela *rel; bfd_vma value; - struct elf32_hppa_link_hash_table *hplink; + struct elf32_hppa_link_hash_table *htab; asection *sym_sec; struct elf32_hppa_link_hash_entry *h; { @@ -3342,7 +3263,7 @@ final_link_relocate (input_section, cont && h->elf.plt.offset != (bfd_vma) -1)))) { stub_entry = hppa_get_stub_entry (input_section, sym_sec, - h, rel, hplink); + h, rel, htab); if (stub_entry != NULL) { value = (stub_entry->stub_offset @@ -3397,7 +3318,7 @@ final_link_relocate (input_section, cont #if 1 /* debug them. */ (*_bfd_error_handler) (_("%s(%s+0x%lx): fixing %s"), - bfd_get_filename (input_bfd), + bfd_archive_filename (input_bfd), input_section->name, (long) rel->r_offset, howto->name); @@ -3417,9 +3338,9 @@ final_link_relocate (input_section, cont case R_PARISC_SEGREL32: if ((sym_sec->flags & SEC_CODE) != 0) - value -= hplink->text_segment_base; + value -= htab->text_segment_base; else - value -= hplink->data_segment_base; + value -= htab->data_segment_base; break; default: @@ -3488,7 +3409,7 @@ final_link_relocate (input_section, cont if (value + addend + max_branch_offset >= 2*max_branch_offset) { stub_entry = hppa_get_stub_entry (input_section, sym_sec, - h, rel, hplink); + h, rel, htab); if (stub_entry == NULL) return bfd_reloc_notsupported; @@ -3513,7 +3434,7 @@ final_link_relocate (input_section, cont { (*_bfd_error_handler) (_("%s(%s+0x%lx): cannot reach %s, recompile with -ffunction-sections"), - bfd_get_filename (input_bfd), + bfd_archive_filename (input_bfd), input_section->name, (long) rel->r_offset, stub_entry->root.string); @@ -3563,20 +3484,16 @@ elf32_hppa_relocate_section (output_bfd, Elf_Internal_Sym *local_syms; asection **local_sections; { - bfd *dynobj; bfd_vma *local_got_offsets; - struct elf32_hppa_link_hash_table *hplink; + struct elf32_hppa_link_hash_table *htab; Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; - asection *sreloc; symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; - hplink = hppa_link_hash_table (info); - dynobj = hplink->root.dynobj; + htab = hppa_link_hash_table (info); local_got_offsets = elf_local_got_offsets (input_bfd); - sreloc = NULL; rel = relocs; relend = relocs + input_section->reloc_count; @@ -3608,7 +3525,7 @@ elf32_hppa_relocate_section (output_bfd, if (info->relocateable) { - /* This is a relocateable link. We don't have to change + /* This is a relocatable link. We don't have to change anything, unless the reloc is against a section symbol, in which case we have to adjust according to where the section symbol winds up in the output section. */ @@ -3668,7 +3585,7 @@ elf32_hppa_relocate_section (output_bfd, && ELF_ST_VISIBILITY (h->elf.other) == STV_DEFAULT && h->elf.type != STT_PARISC_MILLI) { - if (info->symbolic) + if (info->symbolic && !info->allow_shlib_undefined) if (!((*info->callbacks->undefined_symbol) (info, h->elf.root.root.string, input_bfd, input_section, rel->r_offset, false))) @@ -3699,7 +3616,7 @@ elf32_hppa_relocate_section (output_bfd, boolean dyn; off = h->elf.got.offset; - dyn = hplink->root.dynamic_sections_created; + dyn = htab->elf.dynamic_sections_created; if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, &h->elf)) { /* This is actually a static link, or it is a @@ -3719,7 +3636,7 @@ elf32_hppa_relocate_section (output_bfd, else { bfd_put_32 (output_bfd, relocation, - hplink->sgot->contents + off); + htab->sgot->contents + off); h->elf.got.offset |= 1; } } @@ -3740,7 +3657,7 @@ elf32_hppa_relocate_section (output_bfd, else { bfd_put_32 (output_bfd, relocation, - hplink->sgot->contents + off); + htab->sgot->contents + off); if (info->shared) { @@ -3749,18 +3666,17 @@ elf32_hppa_relocate_section (output_bfd, base of the object because the symbol index is zero. */ Elf_Internal_Rela outrel; - asection *srelgot = hplink->srelgot; + asection *srelgot = htab->srelgot; + Elf32_External_Rela *loc; outrel.r_offset = (off - + hplink->sgot->output_offset - + hplink->sgot->output_section->vma); + + htab->sgot->output_offset + + htab->sgot->output_section->vma); outrel.r_info = ELF32_R_INFO (0, R_PARISC_DIR32); outrel.r_addend = relocation; - bfd_elf32_swap_reloca_out (output_bfd, &outrel, - ((Elf32_External_Rela *) - srelgot->contents - + srelgot->reloc_count)); - ++srelgot->reloc_count; + loc = (Elf32_External_Rela *) srelgot->contents; + loc += srelgot->reloc_count++; + bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); } local_got_offsets[r_symndx] |= 1; @@ -3772,23 +3688,21 @@ elf32_hppa_relocate_section (output_bfd, /* Add the base of the GOT to the relocation value. */ relocation = (off - + hplink->sgot->output_offset - + hplink->sgot->output_section->vma); + + htab->sgot->output_offset + + htab->sgot->output_section->vma); break; case R_PARISC_SEGREL32: /* If this is the first SEGREL relocation, then initialize the segment base values. */ - if (hplink->text_segment_base == (bfd_vma) -1) - bfd_map_over_sections (output_bfd, - hppa_record_segment_addr, - hplink); + if (htab->text_segment_base == (bfd_vma) -1) + bfd_map_over_sections (output_bfd, hppa_record_segment_addr, htab); break; case R_PARISC_PLABEL14R: case R_PARISC_PLABEL21L: case R_PARISC_PLABEL32: - if (hplink->root.dynamic_sections_created) + if (htab->elf.dynamic_sections_created) { /* If we have a global symbol with a PLT slot, then redirect this relocation to it. */ @@ -3799,17 +3713,17 @@ elf32_hppa_relocate_section (output_bfd, { /* In a non-shared link, adjust_dynamic_symbols isn't called for symbols forced local. We - need to write out the plt entry here. */ + need to write out the plt entry here. */ if ((off & 1) != 0) off &= ~1; else { bfd_put_32 (output_bfd, relocation, - hplink->splt->contents + off); + htab->splt->contents + off); bfd_put_32 (output_bfd, - elf_gp (hplink->splt->output_section->owner), - hplink->splt->contents + off + 4); + elf_gp (htab->splt->output_section->owner), + htab->splt->contents + off + 4); h->elf.plt.offset |= 1; } } @@ -3833,28 +3747,27 @@ elf32_hppa_relocate_section (output_bfd, { bfd_put_32 (output_bfd, relocation, - hplink->splt->contents + off); + htab->splt->contents + off); bfd_put_32 (output_bfd, - elf_gp (hplink->splt->output_section->owner), - hplink->splt->contents + off + 4); + elf_gp (htab->splt->output_section->owner), + htab->splt->contents + off + 4); if (info->shared) { /* Output a dynamic IPLT relocation for this PLT entry. */ Elf_Internal_Rela outrel; - asection *srelplt = hplink->srelplt; + asection *srelplt = htab->srelplt; + Elf32_External_Rela *loc; outrel.r_offset = (off - + hplink->splt->output_offset - + hplink->splt->output_section->vma); + + htab->splt->output_offset + + htab->splt->output_section->vma); outrel.r_info = ELF32_R_INFO (0, R_PARISC_IPLT); outrel.r_addend = relocation; - bfd_elf32_swap_reloca_out (output_bfd, &outrel, - ((Elf32_External_Rela *) - srelplt->contents - + srelplt->reloc_count)); - ++srelplt->reloc_count; + loc = (Elf32_External_Rela *) srelplt->contents; + loc += srelplt->reloc_count++; + bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); } local_plt_offsets[r_symndx] |= 1; @@ -3875,8 +3788,8 @@ elf32_hppa_relocate_section (output_bfd, && h->elf.root.type != bfd_link_hash_undefined)) { relocation = (off - + hplink->splt->output_offset - + hplink->splt->output_section->vma + + htab->splt->output_offset + + htab->splt->output_section->vma + 2); } plabel = 1; @@ -3893,17 +3806,17 @@ elf32_hppa_relocate_section (output_bfd, case R_PARISC_DPREL21L: case R_PARISC_DIR32: /* The reloc types handled here and this conditional - expression must match the code in check_relocs and - hppa_discard_copies. ie. We need exactly the same - condition as in check_relocs, with some extra conditions - (dynindx test in this case) to cater for relocs removed - by hppa_discard_copies. If you squint, the non-shared - test here does indeed match the one in check_relocs, the - difference being that here we test DEF_DYNAMIC rather - than a maybe-DEF_DYNAMIC via !DEF_REGULAR. Common syms - end up with !DEF_REGULAR, which is why we can't use that - here. Conversely, DEF_DYNAMIC can't be used in - check_relocs as there all files have not been loaded. */ + expression must match the code in ..check_relocs and + ..discard_relocs. ie. We need exactly the same condition + as in ..check_relocs, with some extra conditions (dynindx + test in this case) to cater for relocs removed by + ..discard_relocs. If you squint, the non-shared test + here does indeed match the one in ..check_relocs, the + difference being that here we test DEF_DYNAMIC as well as + !DEF_REGULAR. All common syms end up with !DEF_REGULAR, + which is why we can't use just that test here. + Conversely, DEF_DYNAMIC can't be used in check_relocs as + there all files have not been loaded. */ if ((info->shared && (input_section->flags & SEC_ALLOC) != 0 && (IS_ABSOLUTE_RELOC (r_type) @@ -3917,42 +3830,29 @@ elf32_hppa_relocate_section (output_bfd, && h != NULL && h->elf.dynindx != -1 && (h->elf.elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 - && ((h->elf.elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) != 0 + && (((h->elf.elf_link_hash_flags + & ELF_LINK_HASH_DEF_DYNAMIC) != 0 + && (h->elf.elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0) || h->elf.root.type == bfd_link_hash_undefweak || h->elf.root.type == bfd_link_hash_undefined))) { Elf_Internal_Rela outrel; boolean skip; + asection *sreloc; + Elf32_External_Rela *loc; /* When generating a shared object, these relocations are copied into the output file to be resolved at run time. */ - if (sreloc == NULL) - { - const char *name; - - name = (bfd_elf_string_from_elf_section - (input_bfd, - elf_elfheader (input_bfd)->e_shstrndx, - elf_section_data (input_section)->rel_hdr.sh_name)); - if (name == NULL) - return false; - sreloc = bfd_get_section_by_name (dynobj, name); - if (sreloc == NULL) - abort (); - } - outrel.r_offset = rel->r_offset; outrel.r_addend = rel->r_addend; skip = false; if (elf_section_data (input_section)->stab_info != NULL) { - bfd_vma off; - off = (_bfd_stab_section_offset - (output_bfd, &hplink->root.stab_info, + (output_bfd, &htab->elf.stab_info, input_section, &elf_section_data (input_section)->stab_info, rel->r_offset)); @@ -4014,11 +3914,13 @@ elf32_hppa_relocate_section (output_bfd, outrel.r_info = ELF32_R_INFO (ELF32_R_SYM (outrel.r_info), R_PARISC_DIR32U); #endif - bfd_elf32_swap_reloca_out (output_bfd, &outrel, - ((Elf32_External_Rela *) - sreloc->contents - + sreloc->reloc_count)); - ++sreloc->reloc_count; + sreloc = elf_section_data (input_section)->sreloc; + if (sreloc == NULL) + abort (); + + loc = (Elf32_External_Rela *) sreloc->contents; + loc += sreloc->reloc_count++; + bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); } break; @@ -4027,7 +3929,7 @@ elf32_hppa_relocate_section (output_bfd, } r = final_link_relocate (input_section, contents, rel, relocation, - hplink, sym_sec, h); + htab, sym_sec, h); if (r == bfd_reloc_ok) continue; @@ -4051,11 +3953,13 @@ elf32_hppa_relocate_section (output_bfd, { (*_bfd_error_handler) (_("%s(%s+0x%lx): cannot handle %s for %s"), - bfd_get_filename (input_bfd), + bfd_archive_filename (input_bfd), input_section->name, (long) rel->r_offset, howto->name, sym_name); + bfd_set_error (bfd_error_bad_value); + return false; } else { @@ -4105,11 +4009,9 @@ elf32_hppa_finish_dynamic_symbol (output struct elf_link_hash_entry *h; Elf_Internal_Sym *sym; { - struct elf32_hppa_link_hash_table *hplink; - bfd *dynobj; + struct elf32_hppa_link_hash_table *htab; - hplink = hppa_link_hash_table (info); - dynobj = hplink->root.dynobj; + htab = hppa_link_hash_table (info); if (h->plt.offset != (bfd_vma) -1) { @@ -4138,11 +4040,12 @@ elf32_hppa_finish_dynamic_symbol (output if (! ((struct elf32_hppa_link_hash_entry *) h)->pic_call) { Elf_Internal_Rela rel; + Elf32_External_Rela *loc; /* Create a dynamic IPLT relocation for this entry. */ rel.r_offset = (h->plt.offset - + hplink->splt->output_offset - + hplink->splt->output_section->vma); + + htab->splt->output_offset + + htab->splt->output_section->vma); if (! ((struct elf32_hppa_link_hash_entry *) h)->plt_abs && h->dynindx != -1) { @@ -4150,9 +4053,9 @@ elf32_hppa_finish_dynamic_symbol (output initialised to point to a special stub stored at the end of the .plt. This is not done for plt entries with a base-relative dynamic relocation. */ - value = (hplink->splt->output_offset - + hplink->splt->output_section->vma - + hplink->splt->_raw_size + value = (htab->splt->output_offset + + htab->splt->output_section->vma + + htab->splt->_raw_size - sizeof (plt_stub) + PLT_STUB_ENTRY); rel.r_info = ELF32_R_INFO (h->dynindx, R_PARISC_IPLT); @@ -4166,25 +4069,23 @@ elf32_hppa_finish_dynamic_symbol (output rel.r_addend = value; } - bfd_elf32_swap_reloca_out (hplink->splt->output_section->owner, - &rel, - ((Elf32_External_Rela *) - hplink->srelplt->contents - + hplink->srelplt->reloc_count)); - hplink->srelplt->reloc_count++; + loc = (Elf32_External_Rela *) htab->srelplt->contents; + loc += htab->srelplt->reloc_count++; + bfd_elf32_swap_reloca_out (htab->splt->output_section->owner, + &rel, loc); } - bfd_put_32 (hplink->splt->owner, + bfd_put_32 (htab->splt->owner, value, - hplink->splt->contents + h->plt.offset); - bfd_put_32 (hplink->splt->owner, - elf_gp (hplink->splt->output_section->owner), - hplink->splt->contents + h->plt.offset + 4); + htab->splt->contents + h->plt.offset); + bfd_put_32 (htab->splt->owner, + elf_gp (htab->splt->output_section->owner), + htab->splt->contents + h->plt.offset + 4); if (PLABEL_PLT_ENTRY_SIZE != PLT_ENTRY_SIZE && ((struct elf32_hppa_link_hash_entry *) h)->plabel && h->dynindx != -1) { - memset (hplink->splt->contents + h->plt.offset + 8, + memset (htab->splt->contents + h->plt.offset + 8, 0, PLABEL_PLT_ENTRY_SIZE - PLT_ENTRY_SIZE); } @@ -4199,13 +4100,14 @@ elf32_hppa_finish_dynamic_symbol (output if (h->got.offset != (bfd_vma) -1) { Elf_Internal_Rela rel; + Elf32_External_Rela *loc; /* This symbol has an entry in the global offset table. Set it up. */ rel.r_offset = ((h->got.offset &~ (bfd_vma) 1) - + hplink->sgot->output_offset - + hplink->sgot->output_section->vma); + + htab->sgot->output_offset + + htab->sgot->output_section->vma); /* If this is a -Bsymbolic link and the symbol is defined locally or was forced to be local because of a version file, @@ -4226,22 +4128,21 @@ elf32_hppa_finish_dynamic_symbol (output if ((h->got.offset & 1) != 0) abort (); bfd_put_32 (output_bfd, (bfd_vma) 0, - hplink->sgot->contents + h->got.offset); + htab->sgot->contents + h->got.offset); rel.r_info = ELF32_R_INFO (h->dynindx, R_PARISC_DIR32); rel.r_addend = 0; } - bfd_elf32_swap_reloca_out (output_bfd, &rel, - ((Elf32_External_Rela *) - hplink->srelgot->contents - + hplink->srelgot->reloc_count)); - ++hplink->srelgot->reloc_count; + loc = (Elf32_External_Rela *) htab->srelgot->contents; + loc += htab->srelgot->reloc_count++; + bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); } if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0) { asection *s; Elf_Internal_Rela rel; + Elf32_External_Rela *loc; /* This symbol needs a copy reloc. Set it up. */ @@ -4250,17 +4151,15 @@ elf32_hppa_finish_dynamic_symbol (output || h->root.type == bfd_link_hash_defweak))) abort (); - s = hplink->srelbss; + s = htab->srelbss; rel.r_offset = (h->root.u.def.value + h->root.u.def.section->output_offset + h->root.u.def.section->output_section->vma); rel.r_addend = 0; rel.r_info = ELF32_R_INFO (h->dynindx, R_PARISC_COPY); - bfd_elf32_swap_reloca_out (output_bfd, &rel, - ((Elf32_External_Rela *) s->contents - + s->reloc_count)); - ++s->reloc_count; + loc = (Elf32_External_Rela *) s->contents + s->reloc_count++; + bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); } /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */ @@ -4274,6 +4173,27 @@ elf32_hppa_finish_dynamic_symbol (output return true; } +/* Used to decide how to sort relocs in an optimal manner for the + dynamic linker, before writing them out. */ + +static enum elf_reloc_type_class +elf32_hppa_reloc_type_class (rela) + const Elf_Internal_Rela *rela; +{ + if (ELF32_R_SYM (rela->r_info) == 0) + return reloc_class_relative; + + switch ((int) ELF32_R_TYPE (rela->r_info)) + { + case R_PARISC_IPLT: + return reloc_class_plt; + case R_PARISC_COPY: + return reloc_class_copy; + default: + return reloc_class_normal; + } +} + /* Finish up the dynamic sections. */ static boolean @@ -4282,15 +4202,15 @@ elf32_hppa_finish_dynamic_sections (outp struct bfd_link_info *info; { bfd *dynobj; - struct elf32_hppa_link_hash_table *hplink; + struct elf32_hppa_link_hash_table *htab; asection *sdyn; - hplink = hppa_link_hash_table (info); - dynobj = hplink->root.dynobj; + htab = hppa_link_hash_table (info); + dynobj = htab->elf.dynobj; sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); - if (hplink->root.dynamic_sections_created) + if (htab->elf.dynamic_sections_created) { Elf32_External_Dyn *dyncon, *dynconend; @@ -4309,33 +4229,32 @@ elf32_hppa_finish_dynamic_sections (outp switch (dyn.d_tag) { default: - break; + continue; case DT_PLTGOT: /* Use PLTGOT to set the GOT register. */ dyn.d_un.d_ptr = elf_gp (output_bfd); - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); break; case DT_JMPREL: - s = hplink->srelplt; + s = htab->srelplt; dyn.d_un.d_ptr = s->output_section->vma + s->output_offset; - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); break; case DT_PLTRELSZ: - s = hplink->srelplt; + s = htab->srelplt; if (s->_cooked_size != 0) dyn.d_un.d_val = s->_cooked_size; else dyn.d_un.d_val = s->_raw_size; - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); break; } + + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); } } - if (hplink->sgot != NULL && hplink->sgot->_raw_size != 0) + if (htab->sgot != NULL && htab->sgot->_raw_size != 0) { /* Fill in the first entry in the global offset table. We use it to point to our dynamic section, if we have one. */ @@ -4343,34 +4262,34 @@ elf32_hppa_finish_dynamic_sections (outp (sdyn != NULL ? sdyn->output_section->vma + sdyn->output_offset : (bfd_vma) 0), - hplink->sgot->contents); + htab->sgot->contents); /* The second entry is reserved for use by the dynamic linker. */ - memset (hplink->sgot->contents + GOT_ENTRY_SIZE, 0, GOT_ENTRY_SIZE); + memset (htab->sgot->contents + GOT_ENTRY_SIZE, 0, GOT_ENTRY_SIZE); /* Set .got entry size. */ - elf_section_data (hplink->sgot->output_section) + elf_section_data (htab->sgot->output_section) ->this_hdr.sh_entsize = GOT_ENTRY_SIZE; } - if (hplink->splt != NULL && hplink->splt->_raw_size != 0) + if (htab->splt != NULL && htab->splt->_raw_size != 0) { /* Set plt entry size. */ - elf_section_data (hplink->splt->output_section) + elf_section_data (htab->splt->output_section) ->this_hdr.sh_entsize = PLT_ENTRY_SIZE; - if (hplink->need_plt_stub) + if (htab->need_plt_stub) { /* Set up the .plt stub. */ - memcpy (hplink->splt->contents - + hplink->splt->_raw_size - sizeof (plt_stub), + memcpy (htab->splt->contents + + htab->splt->_raw_size - sizeof (plt_stub), plt_stub, sizeof (plt_stub)); - if ((hplink->splt->output_offset - + hplink->splt->output_section->vma - + hplink->splt->_raw_size) - != (hplink->sgot->output_offset - + hplink->sgot->output_section->vma)) + if ((htab->splt->output_offset + + htab->splt->output_section->vma + + htab->splt->_raw_size) + != (htab->sgot->output_offset + + htab->sgot->output_section->vma)) { (*_bfd_error_handler) (_(".got section not immediately after .plt section")); @@ -4427,6 +4346,7 @@ elf32_hppa_elf_get_symbol_type (elf_sym, #define bfd_elf32_bfd_link_hash_table_create elf32_hppa_link_hash_table_create #define elf_backend_add_symbol_hook elf32_hppa_add_symbol_hook #define elf_backend_adjust_dynamic_symbol elf32_hppa_adjust_dynamic_symbol +#define elf_backend_copy_indirect_symbol elf32_hppa_copy_indirect_symbol #define elf_backend_check_relocs elf32_hppa_check_relocs #define elf_backend_create_dynamic_sections elf32_hppa_create_dynamic_sections #define elf_backend_fake_sections elf_hppa_fake_sections @@ -4441,8 +4361,10 @@ elf32_hppa_elf_get_symbol_type (elf_sym, #define elf_backend_final_write_processing elf_hppa_final_write_processing #define elf_backend_post_process_headers elf32_hppa_post_process_headers #define elf_backend_get_symbol_type elf32_hppa_elf_get_symbol_type +#define elf_backend_reloc_type_class elf32_hppa_reloc_type_class #define elf_backend_can_gc_sections 1 +#define elf_backend_can_refcount 1 #define elf_backend_plt_alignment 2 #define elf_backend_want_got_plt 0 #define elf_backend_plt_readonly 0 diff -uprN binutils-2.11.90.0.31/bfd/elf32-i370.c binutils-2.11.92.0.5/bfd/elf32-i370.c --- binutils-2.11.90.0.31/bfd/elf32-i370.c Wed Aug 22 08:52:09 2001 +++ binutils-2.11.92.0.5/bfd/elf32-i370.c Mon Oct 1 15:25:21 2001 @@ -428,7 +428,7 @@ i370_elf_merge_private_bfd_data (ibfd, o { (*_bfd_error_handler) ("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)", - bfd_get_filename (ibfd), (long)new_flags, (long)old_flags); + bfd_archive_filename (ibfd), (long) new_flags, (long) old_flags); bfd_set_error (bfd_error_bad_value); return false; @@ -536,8 +536,8 @@ i370_elf_create_linker_section (abfd, in { default: (*_bfd_error_handler) ("%s: Unknown special linker type %d", - bfd_get_filename (abfd), - (int)which); + bfd_archive_filename (abfd), + (int) which); bfd_set_error (bfd_error_bad_value); return (elf_linker_section_t *)0; @@ -921,37 +921,40 @@ i370_elf_size_dynamic_sections (output_b must add the entries now so that we get the correct size for the .dynamic section. The DT_DEBUG entry is filled in by the dynamic linker and used by the debugger. */ - if (! info->shared) +#define add_dynamic_entry(TAG, VAL) \ + bfd_elf32_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL)) + + if (!info->shared) { - if (! bfd_elf32_add_dynamic_entry (info, DT_DEBUG, 0)) + if (!add_dynamic_entry (DT_DEBUG, 0)) return false; } if (plt) { - if (! bfd_elf32_add_dynamic_entry (info, DT_PLTGOT, 0) - || ! bfd_elf32_add_dynamic_entry (info, DT_PLTRELSZ, 0) - || ! bfd_elf32_add_dynamic_entry (info, DT_PLTREL, DT_RELA) - || ! bfd_elf32_add_dynamic_entry (info, DT_JMPREL, 0)) + if (!add_dynamic_entry (DT_PLTGOT, 0) + || !add_dynamic_entry (DT_PLTRELSZ, 0) + || !add_dynamic_entry (DT_PLTREL, DT_RELA) + || !add_dynamic_entry (DT_JMPREL, 0)) return false; } if (relocs) { - if (! bfd_elf32_add_dynamic_entry (info, DT_RELA, 0) - || ! bfd_elf32_add_dynamic_entry (info, DT_RELASZ, 0) - || ! bfd_elf32_add_dynamic_entry (info, DT_RELAENT, - sizeof (Elf32_External_Rela))) + if (!add_dynamic_entry (DT_RELA, 0) + || !add_dynamic_entry (DT_RELASZ, 0) + || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela))) return false; } if (reltext) { - if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0)) + if (!add_dynamic_entry (DT_TEXTREL, 0)) return false; info->flags |= DF_TEXTREL; } } +#undef add_dynamic_entry /* If we are generating a shared library, we generate a section symbol for each output section. These are local symbols, which @@ -1022,7 +1025,7 @@ i370_elf_check_relocs (abfd, info, sec, #ifdef DEBUG fprintf (stderr, "i370_elf_check_relocs called for section %s in %s\n", bfd_get_section_name (abfd, sec), - bfd_get_filename (abfd)); + bfd_archive_filename (abfd)); #endif dynobj = elf_hash_table (info)->dynobj; @@ -1174,7 +1177,7 @@ i370_elf_finish_dynamic_sections (output if (sgot) { unsigned char *contents = sgot->contents; - bfd_put_32 (output_bfd, 0x4e800021 /* blrl */, contents); + bfd_put_32 (output_bfd, (bfd_vma) 0x4e800021 /* blrl */, contents); if (sdyn == NULL) bfd_put_32 (output_bfd, (bfd_vma) 0, contents+4); @@ -1289,9 +1292,9 @@ i370_elf_relocate_section (output_bfd, i #ifdef DEBUG fprintf (stderr, "i370_elf_relocate_section called for %s section %s, %ld relocations%s\n", - bfd_get_filename (input_bfd), + bfd_archive_filename (input_bfd), bfd_section_name(input_bfd, input_section), - (long)input_section->reloc_count, + (long) input_section->reloc_count, (info->relocateable) ? " (relocatable)" : ""); #endif @@ -1319,8 +1322,8 @@ i370_elf_relocate_section (output_bfd, i || !i370_elf_howto_table[(int)r_type]) { (*_bfd_error_handler) ("%s: unknown relocation type %d", - bfd_get_filename (input_bfd), - (int)r_type); + bfd_archive_filename (input_bfd), + (int) r_type); bfd_set_error (bfd_error_bad_value); ret = false; @@ -1417,12 +1420,13 @@ i370_elf_relocate_section (output_bfd, i } } - switch ((int)r_type) + switch ((int) r_type) { default: - (*_bfd_error_handler) ("%s: unknown relocation type %d for symbol %s", - bfd_get_filename (input_bfd), - (int)r_type, sym_name); + (*_bfd_error_handler) + ("%s: unknown relocation type %d for symbol %s", + bfd_archive_filename (input_bfd), + (int) r_type, sym_name); bfd_set_error (bfd_error_bad_value); ret = false; @@ -1579,10 +1583,11 @@ i370_elf_relocate_section (output_bfd, i case (int)R_I370_COPY: case (int)R_I370_RELATIVE: - (*_bfd_error_handler) ("%s: Relocation %s is not yet supported for symbol %s.", - bfd_get_filename (input_bfd), - i370_elf_howto_table[ (int)r_type ]->name, - sym_name); + (*_bfd_error_handler) + ("%s: Relocation %s is not yet supported for symbol %s.", + bfd_archive_filename (input_bfd), + i370_elf_howto_table[(int) r_type]->name, + sym_name); bfd_set_error (bfd_error_invalid_operation); ret = false; @@ -1704,7 +1709,9 @@ i370_elf_post_process_headers (abfd, lin #define elf_backend_post_process_headers i370_elf_post_process_headers -int i370_noop() +static int i370_noop PARAMS ((void)); + +static int i370_noop () { return 1; } diff -uprN binutils-2.11.90.0.31/bfd/elf32-i386.c binutils-2.11.92.0.5/bfd/elf32-i386.c --- binutils-2.11.90.0.31/bfd/elf32-i386.c Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/bfd/elf32-i386.c Thu Oct 4 14:35:43 2001 @@ -30,14 +30,22 @@ static void elf_i386_info_to_howto PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *)); static void elf_i386_info_to_howto_rel PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *)); -static boolean elf_i386_is_local_label_name PARAMS ((bfd *, const char *)); -static struct bfd_hash_entry *elf_i386_link_hash_newfunc +static boolean elf_i386_is_local_label_name + PARAMS ((bfd *, const char *)); +static boolean elf_i386_grok_prstatus + PARAMS ((bfd *abfd, Elf_Internal_Note *note)); +static boolean elf_i386_grok_psinfo + PARAMS ((bfd *abfd, Elf_Internal_Note *note)); +static struct bfd_hash_entry *link_hash_newfunc PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); static struct bfd_link_hash_table *elf_i386_link_hash_table_create PARAMS ((bfd *)); -static boolean create_got_section PARAMS((bfd *, struct bfd_link_info *)); +static boolean create_got_section + PARAMS((bfd *, struct bfd_link_info *)); static boolean elf_i386_create_dynamic_sections PARAMS((bfd *, struct bfd_link_info *)); +static void elf_i386_copy_indirect_symbol + PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *)); static boolean elf_i386_check_relocs PARAMS ((bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *)); @@ -49,8 +57,12 @@ static boolean elf_i386_gc_sweep_hook const Elf_Internal_Rela *)); static boolean elf_i386_adjust_dynamic_symbol PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); -static boolean allocate_plt_and_got_and_discard_relocs +static boolean allocate_dynrelocs + PARAMS ((struct elf_link_hash_entry *, PTR)); +static boolean readonly_dynrelocs PARAMS ((struct elf_link_hash_entry *, PTR)); +static boolean elf_i386_fake_sections + PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *)); static boolean elf_i386_size_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *)); static boolean elf_i386_relocate_section @@ -59,15 +71,10 @@ static boolean elf_i386_relocate_section static boolean elf_i386_finish_dynamic_symbol PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, Elf_Internal_Sym *)); +static enum elf_reloc_type_class elf_i386_reloc_type_class + PARAMS ((const Elf_Internal_Rela *)); static boolean elf_i386_finish_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *)); -static boolean elf_i386_fake_sections - PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *)); -static enum elf_reloc_type_class elf_i386_reloc_type_class PARAMS ((int)); -static boolean elf_i386_grok_prstatus - PARAMS ((bfd *abfd, Elf_Internal_Note *note)); -static boolean elf_i386_grok_psinfo - PARAMS ((bfd *abfd, Elf_Internal_Note *note)); #define USE_REL 1 /* 386 uses REL relocations instead of RELA */ @@ -289,7 +296,7 @@ elf_i386_info_to_howto_rel (abfd, cache_ >= R_386_vt - R_386_ext)) { (*_bfd_error_handler) (_("%s: invalid relocation type %d"), - bfd_get_filename (abfd), (int) r_type); + bfd_archive_filename (abfd), (int) r_type); indx = (unsigned int) R_386_NONE; } cache_ptr->howto = &elf_howto_table[indx]; @@ -312,7 +319,84 @@ elf_i386_is_local_label_name (abfd, name return _bfd_elf_is_local_label_name (abfd, name); } -/* Functions for the i386 ELF linker. */ +/* Support for core dump NOTE sections. */ +static boolean +elf_i386_grok_prstatus (abfd, note) + bfd *abfd; + Elf_Internal_Note *note; +{ + int offset; + size_t raw_size; + + switch (note->descsz) + { + default: + return false; + + case 144: /* Linux/i386 */ + /* pr_cursig */ + elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); + + /* pr_pid */ + elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24); + + /* pr_reg */ + offset = 72; + raw_size = 68; + + break; + } + + /* Make a ".reg/999" section. */ + return _bfd_elfcore_make_pseudosection (abfd, ".reg", + raw_size, note->descpos + offset); +} + +static boolean +elf_i386_grok_psinfo (abfd, note) + bfd *abfd; + Elf_Internal_Note *note; +{ + switch (note->descsz) + { + default: + return false; + + case 128: /* Linux/MIPS elf_prpsinfo */ + elf_tdata (abfd)->core_program + = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16); + elf_tdata (abfd)->core_command + = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80); + } + + /* Note that for some reason, a spurious space is tacked + onto the end of the args in some (at least one anyway) + implementations, so strip it off if it exists. */ + + { + char *command = elf_tdata (abfd)->core_command; + int n = strlen (command); + + if (0 < n && command[n - 1] == ' ') + command[n - 1] = '\0'; + } + + return true; +} + +/* Functions for the i386 ELF linker. + + In order to gain some understanding of code in this file without + knowing all the intricate details of the linker, note the + following: + + Functions named elf_i386_* are called by external routines, other + functions are only called locally. elf_i386_* functions appear + in this file more or less in the order in which they are called + from external routines. eg. elf_i386_check_relocs is called + early in the link process, elf_i386_finish_dynamic_sections is + one of the last functions. */ + /* The name of the dynamic interpreter. This is put in the .interp section. */ @@ -377,21 +461,25 @@ static const bfd_byte elf_i386_pic_plt_e struct elf_i386_dyn_relocs { - /* Next section. */ struct elf_i386_dyn_relocs *next; - /* A section in dynobj. */ - asection *section; - /* Number of relocs copied in this section. */ + + /* The input section of the reloc. */ + asection *sec; + + /* Total number of relocs copied for the input section. */ bfd_size_type count; + + /* Number of pc-relative relocs copied for the input section. */ + bfd_size_type pc_count; }; /* i386 ELF linker hash entry. */ struct elf_i386_link_hash_entry { - struct elf_link_hash_entry root; + struct elf_link_hash_entry elf; - /* Number of PC relative relocs copied for this symbol. */ + /* Track dynamic relocs copied for this symbol. */ struct elf_i386_dyn_relocs *dyn_relocs; }; @@ -399,7 +487,7 @@ struct elf_i386_link_hash_entry struct elf_i386_link_hash_table { - struct elf_link_hash_table root; + struct elf_link_hash_table elf; /* Short-cuts to get to dynamic linker sections. */ asection *sgot; @@ -419,33 +507,32 @@ struct elf_i386_link_hash_table /* Create an entry in an i386 ELF linker hash table. */ static struct bfd_hash_entry * -elf_i386_link_hash_newfunc (entry, table, string) +link_hash_newfunc (entry, table, string) struct bfd_hash_entry *entry; struct bfd_hash_table *table; const char *string; { - struct elf_i386_link_hash_entry *ret = - (struct elf_i386_link_hash_entry *) entry; - /* Allocate the structure if it has not already been allocated by a subclass. */ - if (ret == (struct elf_i386_link_hash_entry *) NULL) - ret = ((struct elf_i386_link_hash_entry *) - bfd_hash_allocate (table, - sizeof (struct elf_i386_link_hash_entry))); - if (ret == (struct elf_i386_link_hash_entry *) NULL) - return (struct bfd_hash_entry *) ret; + if (entry == NULL) + { + entry = bfd_hash_allocate (table, + sizeof (struct elf_i386_link_hash_entry)); + if (entry == NULL) + return entry; + } /* Call the allocation method of the superclass. */ - ret = ((struct elf_i386_link_hash_entry *) - _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, - table, string)); - if (ret != (struct elf_i386_link_hash_entry *) NULL) + entry = _bfd_elf_link_hash_newfunc (entry, table, string); + if (entry != NULL) { - ret->dyn_relocs = NULL; + struct elf_i386_link_hash_entry *eh; + + eh = (struct elf_i386_link_hash_entry *) entry; + eh->dyn_relocs = NULL; } - return (struct bfd_hash_entry *) ret; + return entry; } /* Create an i386 ELF linker hash table. */ @@ -455,14 +542,13 @@ elf_i386_link_hash_table_create (abfd) bfd *abfd; { struct elf_i386_link_hash_table *ret; + bfd_size_type amt = sizeof (struct elf_i386_link_hash_table); - ret = ((struct elf_i386_link_hash_table *) - bfd_alloc (abfd, sizeof (struct elf_i386_link_hash_table))); - if (ret == (struct elf_i386_link_hash_table *) NULL) + ret = (struct elf_i386_link_hash_table *) bfd_alloc (abfd, amt); + if (ret == NULL) return NULL; - if (! _bfd_elf_link_hash_table_init (&ret->root, abfd, - elf_i386_link_hash_newfunc)) + if (! _bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc)) { bfd_release (abfd, ret); return NULL; @@ -476,7 +562,7 @@ elf_i386_link_hash_table_create (abfd) ret->sdynbss = NULL; ret->srelbss = NULL; - return &ret->root.root; + return &ret->elf.root; } /* Create .got, .gotplt, and .rel.got sections in DYNOBJ, and set up @@ -540,9 +626,31 @@ elf_i386_create_dynamic_sections (dynobj return true; } +/* Copy the extra info we tack onto an elf_link_hash_entry. */ + +static void +elf_i386_copy_indirect_symbol (dir, ind) + struct elf_link_hash_entry *dir, *ind; +{ + struct elf_i386_link_hash_entry *edir, *eind; + + edir = (struct elf_i386_link_hash_entry *) dir; + eind = (struct elf_i386_link_hash_entry *) ind; + + if (edir->dyn_relocs == NULL) + { + edir->dyn_relocs = eind->dyn_relocs; + eind->dyn_relocs = NULL; + } + else if (eind->dyn_relocs != NULL) + abort (); + + _bfd_elf_link_hash_copy_indirect (dir, ind); +} + /* Look through the relocs for a section during the first phase, and - allocate space in the global offset table or procedure linkage - table. */ + calculate needed space in the global offset table, procedure linkage + table, and dynamic reloc sections. */ static boolean elf_i386_check_relocs (abfd, info, sec, relocs) @@ -552,10 +660,8 @@ elf_i386_check_relocs (abfd, info, sec, const Elf_Internal_Rela *relocs; { struct elf_i386_link_hash_table *htab; - bfd *dynobj; Elf_Internal_Shdr *symtab_hdr; struct elf_link_hash_entry **sym_hashes; - bfd_signed_vma *local_got_refcounts; const Elf_Internal_Rela *rel; const Elf_Internal_Rela *rel_end; asection *sreloc; @@ -564,10 +670,8 @@ elf_i386_check_relocs (abfd, info, sec, return true; htab = elf_i386_hash_table (info); - dynobj = htab->root.dynobj; symtab_hdr = &elf_tdata (abfd)->symtab_hdr; sym_hashes = elf_sym_hashes (abfd); - local_got_refcounts = elf_local_got_refcounts (abfd); sreloc = NULL; @@ -581,15 +685,9 @@ elf_i386_check_relocs (abfd, info, sec, if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr)) { - if (abfd->my_archive) - (*_bfd_error_handler) (_("%s(%s): bad symbol index: %d"), - bfd_get_filename (abfd->my_archive), - bfd_get_filename (abfd), - r_symndx); - else - (*_bfd_error_handler) (_("%s: bad symbol index: %d"), - bfd_get_filename (abfd), - r_symndx); + (*_bfd_error_handler) (_("%s: bad symbol index: %d"), + bfd_archive_filename (abfd), + r_symndx); return false; } @@ -598,55 +696,44 @@ elf_i386_check_relocs (abfd, info, sec, else h = sym_hashes[r_symndx - symtab_hdr->sh_info]; - /* Some relocs require a global offset table. */ - if (htab->sgot == NULL) - { - switch (ELF32_R_TYPE (rel->r_info)) - { - case R_386_GOT32: - case R_386_GOTOFF: - case R_386_GOTPC: - if (dynobj == NULL) - htab->root.dynobj = dynobj = abfd; - if (!create_got_section (dynobj, info)) - return false; - break; - - default: - break; - } - } - switch (ELF32_R_TYPE (rel->r_info)) { case R_386_GOT32: /* This symbol requires a global offset table entry. */ if (h != NULL) { - if (h->got.refcount == -1) - h->got.refcount = 1; - else - h->got.refcount += 1; + h->got.refcount += 1; } else { + bfd_signed_vma *local_got_refcounts; + /* This is a global offset table entry for a local symbol. */ + local_got_refcounts = elf_local_got_refcounts (abfd); if (local_got_refcounts == NULL) { - size_t size; + bfd_size_type size; - size = symtab_hdr->sh_info * sizeof (bfd_signed_vma); + size = symtab_hdr->sh_info; + size *= sizeof (bfd_signed_vma); local_got_refcounts = ((bfd_signed_vma *) - bfd_alloc (abfd, size)); + bfd_zalloc (abfd, size)); if (local_got_refcounts == NULL) return false; elf_local_got_refcounts (abfd) = local_got_refcounts; - memset (local_got_refcounts, -1, size); } - if (local_got_refcounts[r_symndx] == -1) - local_got_refcounts[r_symndx] = 1; - else - local_got_refcounts[r_symndx] += 1; + local_got_refcounts[r_symndx] += 1; + } + /* Fall through */ + + case R_386_GOTOFF: + case R_386_GOTPC: + if (htab->sgot == NULL) + { + if (htab->elf.dynobj == NULL) + htab->elf.dynobj = abfd; + if (!create_got_section (htab->elf.dynobj, info)) + return false; } break; @@ -663,13 +750,8 @@ elf_i386_check_relocs (abfd, info, sec, if (h == NULL) continue; - if (h->plt.refcount == -1) - { - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; - h->plt.refcount = 1; - } - else - h->plt.refcount += 1; + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + h->plt.refcount += 1; break; case R_386_32: @@ -677,16 +759,16 @@ elf_i386_check_relocs (abfd, info, sec, if (h != NULL && !info->shared) { /* If this reloc is in a read-only section, we might - need a copy reloc. */ - if ((sec->flags & SEC_READONLY) != 0) - h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF; + need a copy reloc. We can't check reliably at this + stage whether the section is read-only, as input + sections have not yet been mapped to output sections. + Tentatively set the flag for now, and correct in + adjust_dynamic_symbol. */ + h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF; /* We may need a .plt entry if the function this reloc refers to is in a shared lib. */ - if (h->plt.refcount == -1) - h->plt.refcount = 1; - else - h->plt.refcount += 1; + h->plt.refcount += 1; } /* If we are creating a shared library, and this is a reloc @@ -700,11 +782,12 @@ elf_i386_check_relocs (abfd, info, sec, possible that DEF_REGULAR is not set now but will be set later (it is never cleared). In case of a weak definition, DEF_REGULAR may be cleared later by a strong definition in - a shared library. We account for that possibility below by + a shared library. We account for that possibility below by storing information in the relocs_copied field of the hash table entry. A similar situation occurs when creating shared libraries and symbol visibility changes render the symbol local. + If on the other hand, we are creating an executable, we may need to keep relocations for symbols satisfied by a dynamic library if we manage to avoid copy relocs for the @@ -720,7 +803,6 @@ elf_i386_check_relocs (abfd, info, sec, || (!info->shared && (sec->flags & SEC_ALLOC) != 0 && h != NULL - && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 && (h->root.type == bfd_link_hash_defweak || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0))) @@ -728,12 +810,10 @@ elf_i386_check_relocs (abfd, info, sec, /* We must copy these reloc types into the output file. Create a reloc section in dynobj and make room for this reloc. */ - if (dynobj == NULL) - htab->root.dynobj = dynobj = abfd; - if (sreloc == NULL) { const char *name; + bfd *dynobj; name = (bfd_elf_string_from_elf_section (abfd, @@ -746,17 +826,15 @@ elf_i386_check_relocs (abfd, info, sec, || strcmp (bfd_get_section_name (abfd, sec), name + 4) != 0) { - if (abfd->my_archive) - (*_bfd_error_handler) (_("%s(%s): bad relocation section name `%s\'"), - bfd_get_filename (abfd->my_archive), - bfd_get_filename (abfd), - name); - else - (*_bfd_error_handler) (_("%s: bad relocation section name `%s\'"), - bfd_get_filename (abfd), - name); + (*_bfd_error_handler) + (_("%s: bad relocation section name `%s\'"), + bfd_archive_filename (abfd), name); } + if (htab->elf.dynobj == NULL) + htab->elf.dynobj = abfd; + + dynobj = htab->elf.dynobj; sreloc = bfd_get_section_by_name (dynobj, name); if (sreloc == NULL) { @@ -772,47 +850,43 @@ elf_i386_check_relocs (abfd, info, sec, || ! bfd_set_section_alignment (dynobj, sreloc, 2)) return false; } - if (sec->flags & SEC_READONLY) - info->flags |= DF_TEXTREL; + elf_section_data (sec)->sreloc = sreloc; } - sreloc->_raw_size += sizeof (Elf32_External_Rel); - - /* If this is a global symbol, we count the number of PC - relative relocations we have entered for this symbol, - so that we can discard them later as necessary. Note - that this function is only called if we are using an - elf_i386 linker hash table, which means that h is - really a pointer to an elf_i386_link_hash_entry. */ - if (!info->shared - || (h != NULL - && ELF32_R_TYPE (rel->r_info) == R_386_PC32)) + /* If this is a global symbol, we count the number of + relocations we need for this symbol. */ + if (h != NULL) { struct elf_i386_link_hash_entry *eh; struct elf_i386_dyn_relocs *p; eh = (struct elf_i386_link_hash_entry *) h; + p = eh->dyn_relocs; - for (p = eh->dyn_relocs; p != NULL; p = p->next) - if (p->section == sreloc) - break; - - if (p == NULL) + if (p == NULL || p->sec != sec) { + bfd_size_type amt = sizeof *p; p = ((struct elf_i386_dyn_relocs *) - bfd_alloc (dynobj, sizeof *p)); + bfd_alloc (htab->elf.dynobj, amt)); if (p == NULL) return false; p->next = eh->dyn_relocs; eh->dyn_relocs = p; - p->section = sreloc; + p->sec = sec; p->count = 0; + p->pc_count = 0; } - ++p->count; + p->count += 1; + if (ELF32_R_TYPE (rel->r_info) == R_386_PC32) + p->pc_count += 1; + } + else + { + /* Track dynamic relocs needed for local syms too. */ + elf_section_data (sec)->local_dynrel += 1; } } - break; /* This relocation describes the C++ object vtable hierarchy. @@ -902,6 +976,8 @@ elf_i386_gc_sweep_hook (abfd, info, sec, struct elf_link_hash_entry *h; bfd *dynobj; + elf_section_data (sec)->local_dynrel = 0; + dynobj = elf_hash_table (info)->dynobj; if (dynobj == NULL) return true; @@ -933,9 +1009,32 @@ elf_i386_gc_sweep_hook (abfd, info, sec, case R_386_32: case R_386_PC32: - if (info->shared) - break; - /* Fall through. */ + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx >= symtab_hdr->sh_info) + { + struct elf_i386_link_hash_entry *eh; + struct elf_i386_dyn_relocs **pp; + struct elf_i386_dyn_relocs *p; + + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + + if (!info->shared && h->plt.refcount > 0) + h->plt.refcount -= 1; + + eh = (struct elf_i386_link_hash_entry *) h; + + for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next) + if (p->sec == sec) + { + if (ELF32_R_TYPE (rel->r_info) == R_386_PC32) + p->pc_count -= 1; + p->count -= 1; + if (p->count == 0) + *pp = p->next; + break; + } + } + break; case R_386_PLT32: r_symndx = ELF32_R_SYM (rel->r_info); @@ -966,13 +1065,11 @@ elf_i386_adjust_dynamic_symbol (info, h) struct elf_link_hash_entry *h; { struct elf_i386_link_hash_table *htab; - bfd *dynobj; + struct elf_i386_link_hash_entry * eh; + struct elf_i386_dyn_relocs *p; asection *s; unsigned int power_of_two; - htab = elf_i386_hash_table (info); - dynobj = htab->root.dynobj; - /* If this is a function, put it in the procedure linkage table. We will fill in the contents of the procedure linkage table later, when we know the address of the .got section. */ @@ -989,7 +1086,7 @@ elf_i386_adjust_dynamic_symbol (info, h) object, or if all references were garbage collected. In such a case, we don't actually need to build a procedure linkage table, and we can just do a PC32 reloc instead. */ - h->plt.refcount = (bfd_vma) -1; + h->plt.refcount = -1; h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; } @@ -1001,7 +1098,7 @@ elf_i386_adjust_dynamic_symbol (info, h) check_relocs. We can't decide accurately between function and non-function syms in check-relocs; Objects loaded later in the link may change h->type. So fix it now. */ - h->plt.refcount = (bfd_vma) -1; + h->plt.refcount = -1; /* If this is a weak symbol, and there is a real definition, the processor independent code will have arranged for us to see the @@ -1030,6 +1127,29 @@ elf_i386_adjust_dynamic_symbol (info, h) if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0) return true; + /* If -z nocopyreloc was given, we won't generate them either. */ + if (info->nocopyreloc) + { + h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF; + return true; + } + + eh = (struct elf_i386_link_hash_entry *) h; + for (p = eh->dyn_relocs; p != NULL; p = p->next) + { + s = p->sec->output_section; + if (s != NULL && (s->flags & SEC_READONLY) != 0) + break; + } + + /* If we didn't find any dynamic relocs in read-only sections, then + we'll be keeping the dynamic relocs and avoiding the copy reloc. */ + if (p == NULL) + { + h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF; + return true; + } + /* We must allocate the symbol in our .dynbss section, which will become part of the .bss section of the executable. There will be an entry for this symbol in the .dynsym section. The dynamic @@ -1040,22 +1160,14 @@ elf_i386_adjust_dynamic_symbol (info, h) both the dynamic object and the regular object will refer to the same memory location for the variable. */ - s = htab->sdynbss; - if (s == NULL) - abort (); + htab = elf_i386_hash_table (info); /* We must generate a R_386_COPY reloc to tell the dynamic linker to copy the initial value out of the dynamic object and into the - runtime process image. We need to remember the offset into the - .rel.bss section we are going to use. */ + runtime process image. */ if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) { - asection *srel; - - srel = htab->srelbss; - if (srel == NULL) - abort (); - srel->_raw_size += sizeof (Elf32_External_Rel); + htab->srelbss->_raw_size += sizeof (Elf32_External_Rel); h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY; } @@ -1066,11 +1178,11 @@ elf_i386_adjust_dynamic_symbol (info, h) power_of_two = 3; /* Apply the required alignment. */ - s->_raw_size = BFD_ALIGN (s->_raw_size, - (bfd_size_type) (1 << power_of_two)); - if (power_of_two > bfd_get_section_alignment (dynobj, s)) + s = htab->sdynbss; + s->_raw_size = BFD_ALIGN (s->_raw_size, (bfd_size_type) (1 << power_of_two)); + if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s)) { - if (! bfd_set_section_alignment (dynobj, s, power_of_two)) + if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two)) return false; } @@ -1096,19 +1208,17 @@ elf_i386_adjust_dynamic_symbol (info, h) || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)) /* Allocate space in .plt, .got and associated reloc sections for - global syms. Also discards space allocated for relocs in the - check_relocs function that we subsequently have found to be - unneeded. */ + dynamic relocs. */ static boolean -allocate_plt_and_got_and_discard_relocs (h, inf) +allocate_dynrelocs (h, inf) struct elf_link_hash_entry *h; PTR inf; { struct bfd_link_info *info; struct elf_i386_link_hash_table *htab; - asection *s; struct elf_i386_link_hash_entry *eh; + struct elf_i386_dyn_relocs *p; if (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) @@ -1117,7 +1227,7 @@ allocate_plt_and_got_and_discard_relocs info = (struct bfd_link_info *) inf; htab = elf_i386_hash_table (info); - if (htab->root.dynamic_sections_created + if (htab->elf.dynamic_sections_created && h->plt.refcount > 0) { /* Make sure this symbol is output as a dynamic symbol. @@ -1129,46 +1239,43 @@ allocate_plt_and_got_and_discard_relocs return false; } - s = htab->splt; - if (s == NULL) - abort (); + if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h)) + { + asection *s = htab->splt; - /* If this is the first .plt entry, make room for the special - first entry. */ - if (s->_raw_size == 0) - s->_raw_size += PLT_ENTRY_SIZE; + /* If this is the first .plt entry, make room for the special + first entry. */ + if (s->_raw_size == 0) + s->_raw_size += PLT_ENTRY_SIZE; - h->plt.offset = s->_raw_size; + h->plt.offset = s->_raw_size; - /* If this symbol is not defined in a regular file, and we are - not generating a shared library, then set the symbol to this - location in the .plt. This is required to make function - pointers compare as equal between the normal executable and - the shared library. */ - if (! info->shared - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - { - h->root.u.def.section = s; - h->root.u.def.value = h->plt.offset; - } + /* If this symbol is not defined in a regular file, and we are + not generating a shared library, then set the symbol to this + location in the .plt. This is required to make function + pointers compare as equal between the normal executable and + the shared library. */ + if (! info->shared + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + { + h->root.u.def.section = s; + h->root.u.def.value = h->plt.offset; + } - /* Make room for this entry. */ - s->_raw_size += PLT_ENTRY_SIZE; + /* Make room for this entry. */ + s->_raw_size += PLT_ENTRY_SIZE; - /* We also need to make an entry in the .got.plt section, which - will be placed in the .got section by the linker script. */ - s = htab->sgotplt; - if (s == NULL) - abort (); - s->_raw_size += 4; + /* We also need to make an entry in the .got.plt section, which + will be placed in the .got section by the linker script. */ + htab->sgotplt->_raw_size += 4; - if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h)) - { /* We also need to make an entry in the .rel.plt section. */ - s = htab->srelplt; - if (s == NULL) - abort (); - s->_raw_size += sizeof (Elf32_External_Rel); + htab->srelplt->_raw_size += sizeof (Elf32_External_Rel); + } + else + { + h->plt.offset = (bfd_vma) -1; + h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; } } else @@ -1179,6 +1286,7 @@ allocate_plt_and_got_and_discard_relocs if (h->got.refcount > 0) { + asection *s; boolean dyn; /* Make sure this symbol is output as a dynamic symbol. @@ -1193,59 +1301,113 @@ allocate_plt_and_got_and_discard_relocs s = htab->sgot; h->got.offset = s->_raw_size; s->_raw_size += 4; - dyn = htab->root.dynamic_sections_created; + dyn = htab->elf.dynamic_sections_created; if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h)) htab->srelgot->_raw_size += sizeof (Elf32_External_Rel); } else h->got.offset = (bfd_vma) -1; - /* In the shared -Bsymbolic case, discard space allocated for - dynamic relocs against symbols which turn out to be defined - in regular objects. For the normal shared case, discard space - for relocs that have become local due to symbol visibility - changes. For the non-shared case, discard space for symbols - which turn out to need copy relocs or are not dynamic. */ - eh = (struct elf_i386_link_hash_entry *) h; if (eh->dyn_relocs == NULL) return true; - if (!info->shared - && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 - && ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - || (htab->root.dynamic_sections_created - && (h->root.type == bfd_link_hash_undefweak - || h->root.type == bfd_link_hash_undefined)))) + /* In the shared -Bsymbolic case, discard space allocated for + dynamic pc-relative relocs against symbols which turn out to be + defined in regular objects. For the normal shared case, discard + space for pc-relative relocs that have become local due to symbol + visibility changes. */ + + if (info->shared) { - /* Make sure this symbol is output as a dynamic symbol. - Undefined weak syms won't yet be marked as dynamic. */ - if (h->dynindx == -1 - && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0 + && ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0 + || info->symbolic)) { - if (! bfd_elf32_link_record_dynamic_symbol (info, h)) - return false; + struct elf_i386_dyn_relocs **pp; + + for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + { + p->count -= p->pc_count; + p->pc_count = 0; + if (p->count == 0) + *pp = p->next; + else + pp = &p->next; + } + } + } + else + { + /* For the non-shared case, discard space for relocs against + symbols which turn out to need copy relocs or are not + dynamic. */ + + if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 + && (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + || (htab->elf.dynamic_sections_created + && (h->root.type == bfd_link_hash_undefweak + || h->root.type == bfd_link_hash_undefined)))) + { + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 + && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + { + if (! bfd_elf32_link_record_dynamic_symbol (info, h)) + return false; + } + + /* If that succeeded, we know we'll be keeping all the + relocs. */ + if (h->dynindx != -1) + goto keep; } - /* If that succeeded, we know we'll be keeping all the relocs. */ - if (h->dynindx != -1) - return true; + eh->dyn_relocs = NULL; + + keep: } - if (!info->shared - || ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0 - && ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0 - || info->symbolic))) + /* Finally, allocate space. */ + for (p = eh->dyn_relocs; p != NULL; p = p->next) { - struct elf_i386_dyn_relocs *c; - - for (c = eh->dyn_relocs; c != NULL; c = c->next) - c->section->_raw_size -= c->count * sizeof (Elf32_External_Rel); + asection *sreloc = elf_section_data (p->sec)->sreloc; + sreloc->_raw_size += p->count * sizeof (Elf32_External_Rel); } return true; } +/* Find any dynamic relocs that apply to read-only sections. */ + +static boolean +readonly_dynrelocs (h, inf) + struct elf_link_hash_entry *h; + PTR inf; +{ + struct elf_i386_link_hash_entry *eh; + struct elf_i386_dyn_relocs *p; + + eh = (struct elf_i386_link_hash_entry *) h; + for (p = eh->dyn_relocs; p != NULL; p = p->next) + { + asection *s = p->sec->output_section; + + if (s != NULL && (s->flags & SEC_READONLY) != 0) + { + struct bfd_link_info *info = (struct bfd_link_info *) inf; + + info->flags |= DF_TEXTREL; + + /* Not an error, just cut short the traversal. */ + return false; + } + } + return true; +} + /* Set the sizes of the dynamic sections. */ static boolean @@ -1257,14 +1419,14 @@ elf_i386_size_dynamic_sections (output_b bfd *dynobj; asection *s; boolean relocs; - bfd *i; + bfd *ibfd; htab = elf_i386_hash_table (info); - dynobj = htab->root.dynobj; + dynobj = htab->elf.dynobj; if (dynobj == NULL) abort (); - if (htab->root.dynamic_sections_created) + if (htab->elf.dynamic_sections_created) { /* Set the contents of the .interp section to the interpreter. */ if (! info->shared) @@ -1277,8 +1439,9 @@ elf_i386_size_dynamic_sections (output_b } } - /* Set up .got offsets for local syms. */ - for (i = info->input_bfds; i; i = i->link_next) + /* Set up .got offsets for local syms, and space for local dynamic + relocs. */ + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) { bfd_signed_vma *local_got; bfd_signed_vma *end_local_got; @@ -1286,14 +1449,25 @@ elf_i386_size_dynamic_sections (output_b Elf_Internal_Shdr *symtab_hdr; asection *srel; - if (bfd_get_flavour (i) != bfd_target_elf_flavour) + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour) continue; - local_got = elf_local_got_refcounts (i); + for (s = ibfd->sections; s != NULL; s = s->next) + { + bfd_size_type count = elf_section_data (s)->local_dynrel; + + if (count != 0) + { + srel = elf_section_data (s)->sreloc; + srel->_raw_size += count * sizeof (Elf32_External_Rel); + } + } + + local_got = elf_local_got_refcounts (ibfd); if (!local_got) continue; - symtab_hdr = &elf_tdata (i)->symtab_hdr; + symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; locsymcount = symtab_hdr->sh_info; end_local_got = local_got + locsymcount; s = htab->sgot; @@ -1312,11 +1486,9 @@ elf_i386_size_dynamic_sections (output_b } } - /* Allocate global sym .plt and .got entries. Also discard all - unneeded relocs. */ - elf_link_hash_traverse (&htab->root, - allocate_plt_and_got_and_discard_relocs, - (PTR) info); + /* Allocate global sym .plt and .got entries, and space for global + sym dynamic relocs. */ + elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info); /* We now have determined the sizes of the various dynamic sections. Allocate memory for them. */ @@ -1335,27 +1507,12 @@ elf_i386_size_dynamic_sections (output_b } else if (strncmp (bfd_get_section_name (dynobj, s), ".rel", 4) == 0) { - if (s->_raw_size == 0) - { - /* If we don't need this section, strip it from the - output file. This is mostly to handle .rel.bss and - .rel.plt. We must create both sections in - create_dynamic_sections, because they must be created - before the linker maps input sections to output - sections. The linker does that before - adjust_dynamic_symbol is called, and it is that - function which decides whether anything needs to go - into these sections. */ - } - else - { - if (s != htab->srelplt) - relocs = true; + if (s->_raw_size != 0 && s != htab->srelplt) + relocs = true; - /* We use the reloc_count field as a counter if we need - to copy relocs into the output file. */ - s->reloc_count = 0; - } + /* We use the reloc_count field as a counter if we need + to copy relocs into the output file. */ + s->reloc_count = 0; } else { @@ -1365,6 +1522,16 @@ elf_i386_size_dynamic_sections (output_b if (s->_raw_size == 0) { + /* If we don't need this section, strip it from the + output file. This is mostly to handle .rel.bss and + .rel.plt. We must create both sections in + create_dynamic_sections, because they must be created + before the linker maps input sections to output + sections. The linker does that before + adjust_dynamic_symbol is called, and it is that + function which decides whether anything needs to go + into these sections. */ + _bfd_strip_section_from_output (info, s); continue; } @@ -1379,43 +1546,85 @@ elf_i386_size_dynamic_sections (output_b return false; } - if (htab->root.dynamic_sections_created) + if (htab->elf.dynamic_sections_created) { /* Add some entries to the .dynamic section. We fill in the values later, in elf_i386_finish_dynamic_sections, but we must add the entries now so that we get the correct size for the .dynamic section. The DT_DEBUG entry is filled in by the dynamic linker and used by the debugger. */ +#define add_dynamic_entry(TAG, VAL) \ + bfd_elf32_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL)) + if (! info->shared) { - if (! bfd_elf32_add_dynamic_entry (info, DT_DEBUG, 0)) + if (!add_dynamic_entry (DT_DEBUG, 0)) return false; } if (htab->splt->_raw_size != 0) { - if (! bfd_elf32_add_dynamic_entry (info, DT_PLTGOT, 0) - || ! bfd_elf32_add_dynamic_entry (info, DT_PLTRELSZ, 0) - || ! bfd_elf32_add_dynamic_entry (info, DT_PLTREL, DT_REL) - || ! bfd_elf32_add_dynamic_entry (info, DT_JMPREL, 0)) + if (!add_dynamic_entry (DT_PLTGOT, 0) + || !add_dynamic_entry (DT_PLTRELSZ, 0) + || !add_dynamic_entry (DT_PLTREL, DT_REL) + || !add_dynamic_entry (DT_JMPREL, 0)) return false; } if (relocs) { - if (! bfd_elf32_add_dynamic_entry (info, DT_REL, 0) - || ! bfd_elf32_add_dynamic_entry (info, DT_RELSZ, 0) - || ! bfd_elf32_add_dynamic_entry (info, DT_RELENT, - sizeof (Elf32_External_Rel))) + if (!add_dynamic_entry (DT_REL, 0) + || !add_dynamic_entry (DT_RELSZ, 0) + || !add_dynamic_entry (DT_RELENT, sizeof (Elf32_External_Rel))) return false; - } - if ((info->flags & DF_TEXTREL) != 0) - { - if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0)) - return false; + /* If any dynamic relocs apply to a read-only section, + then we need a DT_TEXTREL entry. */ + elf_link_hash_traverse (&htab->elf, readonly_dynrelocs, (PTR) info); + + if ((info->flags & DF_TEXTREL) != 0) + { + if (!add_dynamic_entry (DT_TEXTREL, 0)) + return false; + } } } +#undef add_dynamic_entry + + return true; +} + +/* Set the correct type for an x86 ELF section. We do this by the + section name, which is a hack, but ought to work. */ + +static boolean +elf_i386_fake_sections (abfd, hdr, sec) + bfd *abfd ATTRIBUTE_UNUSED; + Elf32_Internal_Shdr *hdr; + asection *sec; +{ + register const char *name; + + name = bfd_get_section_name (abfd, sec); + + /* This is an ugly, but unfortunately necessary hack that is + needed when producing EFI binaries on x86. It tells + elf.c:elf_fake_sections() not to consider ".reloc" as a section + containing ELF relocation info. We need this hack in order to + be able to generate ELF binaries that can be translated into + EFI applications (which are essentially COFF objects). Those + files contain a COFF ".reloc" section inside an ELFNN object, + which would normally cause BFD to segfault because it would + attempt to interpret this section as containing relocation + entries for section "oc". With this hack enabled, ".reloc" + will be treated as a normal data section, which will avoid the + segfault. However, you won't be able to create an ELFNN binary + with a section named "oc" that needs relocations, but that's + the kind of ugly side-effects you get when detecting section + types based on their names... In practice, this limitation is + unlikely to bite. */ + if (strcmp (name, ".reloc") == 0) + hdr->sh_type = SHT_PROGBITS; return true; } @@ -1435,21 +1644,17 @@ elf_i386_relocate_section (output_bfd, i asection **local_sections; { struct elf_i386_link_hash_table *htab; - bfd *dynobj; Elf_Internal_Shdr *symtab_hdr; struct elf_link_hash_entry **sym_hashes; bfd_vma *local_got_offsets; - asection *sreloc; Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; htab = elf_i386_hash_table (info); - dynobj = htab->root.dynobj; symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); local_got_offsets = elf_local_got_offsets (input_bfd); - sreloc = NULL; rel = relocs; relend = relocs + input_section->reloc_count; for (; rel < relend; rel++) @@ -1484,7 +1689,7 @@ elf_i386_relocate_section (output_bfd, i if (info->relocateable) { - /* This is a relocateable link. We don't have to change + /* This is a relocatable link. We don't have to change anything, unless the reloc is against a section symbol, in which case we have to adjust according to where the section symbol winds up in the output section. */ @@ -1501,7 +1706,6 @@ elf_i386_relocate_section (output_bfd, i bfd_put_32 (input_bfd, val, contents + rel->r_offset); } } - continue; } @@ -1543,7 +1747,8 @@ elf_i386_relocate_section (output_bfd, i } else if (h->root.type == bfd_link_hash_undefweak) ; - else if (info->shared && !info->symbolic + else if (info->shared + && (!info->symbolic || info->allow_shlib_undefined) && !info->no_undefined && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) ; @@ -1571,7 +1776,7 @@ elf_i386_relocate_section (output_bfd, i boolean dyn; off = h->got.offset; - dyn = htab->root.dynamic_sections_created; + dyn = htab->elf.dynamic_sections_created; if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h) || (info->shared && (info->symbolic @@ -1624,6 +1829,7 @@ elf_i386_relocate_section (output_bfd, i { asection *srelgot; Elf_Internal_Rel outrel; + Elf32_External_Rel *loc; srelgot = htab->srelgot; if (srelgot == NULL) @@ -1633,11 +1839,9 @@ elf_i386_relocate_section (output_bfd, i + htab->sgot->output_offset + off); outrel.r_info = ELF32_R_INFO (0, R_386_RELATIVE); - bfd_elf32_swap_reloc_out (output_bfd, &outrel, - (((Elf32_External_Rel *) - srelgot->contents) - + srelgot->reloc_count)); - ++srelgot->reloc_count; + loc = (Elf32_External_Rel *) srelgot->contents; + loc += srelgot->reloc_count++; + bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc); } local_got_offsets[r_symndx] |= 1; @@ -1707,63 +1911,30 @@ elf_i386_relocate_section (output_bfd, i && h != NULL && h->dynindx != -1 && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 - && ((h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) != 0 + && (((h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_DYNAMIC) != 0 + && (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0) || h->root.type == bfd_link_hash_undefweak || h->root.type == bfd_link_hash_undefined))) { Elf_Internal_Rel outrel; boolean skip, relocate; + asection *sreloc; + Elf32_External_Rel *loc; /* When generating a shared object, these relocations are copied into the output file to be resolved at run time. */ - if (sreloc == NULL) - { - const char *name; - - name = (bfd_elf_string_from_elf_section - (input_bfd, - elf_elfheader (input_bfd)->e_shstrndx, - elf_section_data (input_section)->rel_hdr.sh_name)); - if (name == NULL) - return false; - - if (strncmp (name, ".rel", 4) != 0 - || strcmp (bfd_get_section_name (input_bfd, - input_section), - name + 4) != 0) - { - if (input_bfd->my_archive) - (*_bfd_error_handler)\ - (_("%s(%s): bad relocation section name `%s\'"), - bfd_get_filename (input_bfd->my_archive), - bfd_get_filename (input_bfd), - name); - else - (*_bfd_error_handler) - (_("%s: bad relocation section name `%s\'"), - bfd_get_filename (input_bfd), - name); - return false; - } - - sreloc = bfd_get_section_by_name (dynobj, name); - if (sreloc == NULL) - abort (); - } - skip = false; if (elf_section_data (input_section)->stab_info == NULL) outrel.r_offset = rel->r_offset; else { - bfd_vma off; - off = (_bfd_stab_section_offset - (output_bfd, htab->root.stab_info, input_section, + (output_bfd, htab->elf.stab_info, input_section, &elf_section_data (input_section)->stab_info, rel->r_offset)); if (off == (bfd_vma) -1) @@ -1798,11 +1969,13 @@ elf_i386_relocate_section (output_bfd, i outrel.r_info = ELF32_R_INFO (0, R_386_RELATIVE); } - bfd_elf32_swap_reloc_out (output_bfd, &outrel, - (((Elf32_External_Rel *) - sreloc->contents) - + sreloc->reloc_count)); - ++sreloc->reloc_count; + sreloc = elf_section_data (input_section)->sreloc; + if (sreloc == NULL) + abort (); + + loc = (Elf32_External_Rel *) sreloc->contents; + loc += sreloc->reloc_count++; + bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc); /* If this reloc is against an external symbol, we do not want to fiddle with the addend. Otherwise, we @@ -1829,7 +2002,7 @@ elf_i386_relocate_section (output_bfd, i && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) (*_bfd_error_handler) (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"), - bfd_get_filename (input_bfd), + bfd_archive_filename (input_bfd), bfd_get_section_name (input_bfd, input_section), (long) rel->r_offset, h->root.root.string); @@ -1887,16 +2060,15 @@ elf_i386_finish_dynamic_symbol (output_b Elf_Internal_Sym *sym; { struct elf_i386_link_hash_table *htab; - bfd *dynobj; htab = elf_i386_hash_table (info); - dynobj = htab->root.dynobj; if (h->plt.offset != (bfd_vma) -1) { bfd_vma plt_index; bfd_vma got_offset; Elf_Internal_Rel rel; + Elf32_External_Rel *loc; /* This symbol has an entry in the procedure linkage table. Set it up. */ @@ -1955,14 +2127,16 @@ elf_i386_finish_dynamic_symbol (output_b + htab->sgotplt->output_offset + got_offset); rel.r_info = ELF32_R_INFO (h->dynindx, R_386_JUMP_SLOT); - bfd_elf32_swap_reloc_out (output_bfd, &rel, - ((Elf32_External_Rel *) htab->srelplt->contents - + plt_index)); + loc = (Elf32_External_Rel *) htab->srelplt->contents + plt_index; + bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) { /* Mark the symbol as undefined, rather than as defined in - the .plt section. Leave the value alone. */ + the .plt section. Leave the value alone. This is a clue + for the dynamic linker, to make function pointer + comparisons work between an application and shared + library. */ sym->st_shndx = SHN_UNDEF; } } @@ -1970,6 +2144,7 @@ elf_i386_finish_dynamic_symbol (output_b if (h->got.offset != (bfd_vma) -1) { Elf_Internal_Rel rel; + Elf32_External_Rel *loc; /* This symbol has an entry in the global offset table. Set it up. */ @@ -1979,7 +2154,7 @@ elf_i386_finish_dynamic_symbol (output_b rel.r_offset = (htab->sgot->output_section->vma + htab->sgot->output_offset - + (h->got.offset &~ 1)); + + (h->got.offset & ~(bfd_vma) 1)); /* If this is a static link, or it is a -Bsymbolic link and the symbol is defined locally or was forced to be local because @@ -2003,15 +2178,15 @@ elf_i386_finish_dynamic_symbol (output_b rel.r_info = ELF32_R_INFO (h->dynindx, R_386_GLOB_DAT); } - bfd_elf32_swap_reloc_out (output_bfd, &rel, - ((Elf32_External_Rel *) htab->srelgot->contents - + htab->srelgot->reloc_count)); - ++htab->srelgot->reloc_count; + loc = (Elf32_External_Rel *) htab->srelgot->contents; + loc += htab->srelgot->reloc_count++; + bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); } if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0) { Elf_Internal_Rel rel; + Elf32_External_Rel *loc; /* This symbol needs a copy reloc. Set it up. */ @@ -2025,10 +2200,9 @@ elf_i386_finish_dynamic_symbol (output_b + h->root.u.def.section->output_section->vma + h->root.u.def.section->output_offset); rel.r_info = ELF32_R_INFO (h->dynindx, R_386_COPY); - bfd_elf32_swap_reloc_out (output_bfd, &rel, - ((Elf32_External_Rel *) htab->srelbss->contents - + htab->srelbss->reloc_count)); - ++htab->srelbss->reloc_count; + loc = (Elf32_External_Rel *) htab->srelbss->contents; + loc += htab->srelbss->reloc_count++; + bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); } /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */ @@ -2039,6 +2213,26 @@ elf_i386_finish_dynamic_symbol (output_b return true; } +/* Used to decide how to sort relocs in an optimal manner for the + dynamic linker, before writing them out. */ + +static enum elf_reloc_type_class +elf_i386_reloc_type_class (rela) + const Elf_Internal_Rela *rela; +{ + switch ((int) ELF32_R_TYPE (rela->r_info)) + { + case R_386_RELATIVE: + return reloc_class_relative; + case R_386_JUMP_SLOT: + return reloc_class_plt; + case R_386_COPY: + return reloc_class_copy; + default: + return reloc_class_normal; + } +} + /* Finish up the dynamic sections. */ static boolean @@ -2051,10 +2245,10 @@ elf_i386_finish_dynamic_sections (output asection *sdyn; htab = elf_i386_hash_table (info); - dynobj = htab->root.dynobj; + dynobj = htab->elf.dynobj; sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); - if (htab->root.dynamic_sections_created) + if (htab->elf.dynamic_sections_created) { Elf32_External_Dyn *dyncon, *dynconend; @@ -2066,30 +2260,29 @@ elf_i386_finish_dynamic_sections (output for (; dyncon < dynconend; dyncon++) { Elf_Internal_Dyn dyn; + asection *s; bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn); switch (dyn.d_tag) { default: - break; + continue; case DT_PLTGOT: dyn.d_un.d_ptr = htab->sgot->output_section->vma; - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); break; case DT_JMPREL: dyn.d_un.d_ptr = htab->srelplt->output_section->vma; - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); break; case DT_PLTRELSZ: - if (htab->srelplt->output_section->_cooked_size != 0) - dyn.d_un.d_val = htab->srelplt->output_section->_cooked_size; + s = htab->srelplt->output_section; + if (s->_cooked_size != 0) + dyn.d_un.d_val = s->_cooked_size; else - dyn.d_un.d_val = htab->srelplt->output_section->_raw_size; - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + dyn.d_un.d_val = s->_raw_size; break; case DT_RELSZ: @@ -2104,14 +2297,16 @@ elf_i386_finish_dynamic_sections (output about changing the DT_REL entry. */ if (htab->srelplt != NULL) { - if (htab->srelplt->output_section->_cooked_size != 0) - dyn.d_un.d_val -= htab->srelplt->output_section->_cooked_size; + s = htab->srelplt->output_section; + if (s->_cooked_size != 0) + dyn.d_un.d_val -= s->_cooked_size; else - dyn.d_un.d_val -= htab->srelplt->output_section->_raw_size; + dyn.d_un.d_val -= s->_raw_size; } - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); break; } + + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); } /* Fill in the first entry in the procedure linkage table. */ @@ -2161,125 +2356,6 @@ elf_i386_finish_dynamic_sections (output return true; } -/* Set the correct type for an x86 ELF section. We do this by the - section name, which is a hack, but ought to work. */ - -static boolean -elf_i386_fake_sections (abfd, hdr, sec) - bfd *abfd ATTRIBUTE_UNUSED; - Elf32_Internal_Shdr *hdr; - asection *sec; -{ - register const char *name; - - name = bfd_get_section_name (abfd, sec); - - if (strcmp (name, ".reloc") == 0) - /* - * This is an ugly, but unfortunately necessary hack that is - * needed when producing EFI binaries on x86. It tells - * elf.c:elf_fake_sections() not to consider ".reloc" as a section - * containing ELF relocation info. We need this hack in order to - * be able to generate ELF binaries that can be translated into - * EFI applications (which are essentially COFF objects). Those - * files contain a COFF ".reloc" section inside an ELFNN object, - * which would normally cause BFD to segfault because it would - * attempt to interpret this section as containing relocation - * entries for section "oc". With this hack enabled, ".reloc" - * will be treated as a normal data section, which will avoid the - * segfault. However, you won't be able to create an ELFNN binary - * with a section named "oc" that needs relocations, but that's - * the kind of ugly side-effects you get when detecting section - * types based on their names... In practice, this limitation is - * unlikely to bite. - */ - hdr->sh_type = SHT_PROGBITS; - - return true; -} - -static enum elf_reloc_type_class -elf_i386_reloc_type_class (type) - int type; -{ - switch (type) - { - case R_386_RELATIVE: - return reloc_class_relative; - case R_386_JUMP_SLOT: - return reloc_class_plt; - case R_386_COPY: - return reloc_class_copy; - default: - return reloc_class_normal; - } -} - -/* Support for core dump NOTE sections */ -static boolean -elf_i386_grok_prstatus (abfd, note) - bfd *abfd; - Elf_Internal_Note *note; -{ - int offset; - int raw_size; - - switch (note->descsz) - { - default: - return false; - - case 144: /* Linux/i386 */ - /* pr_cursig */ - elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); - - /* pr_pid */ - elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24); - - /* pr_reg */ - offset = 72; - raw_size = 68; - - break; - } - - /* Make a ".reg/999" section. */ - return _bfd_elfcore_make_pseudosection (abfd, ".reg", - raw_size, note->descpos + offset); -} - -static boolean -elf_i386_grok_psinfo (abfd, note) - bfd *abfd; - Elf_Internal_Note *note; -{ - switch (note->descsz) - { - default: - return false; - - case 128: /* Linux/MIPS elf_prpsinfo */ - elf_tdata (abfd)->core_program - = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16); - elf_tdata (abfd)->core_command - = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80); - } - - /* Note that for some reason, a spurious space is tacked - onto the end of the args in some (at least one anyway) - implementations, so strip it off if it exists. */ - - { - char *command = elf_tdata (abfd)->core_command; - int n = strlen (command); - - if (0 < n && command[n - 1] == ' ') - command[n - 1] = '\0'; - } - - return true; -} - #define TARGET_LITTLE_SYM bfd_elf32_i386_vec #define TARGET_LITTLE_NAME "elf32-i386" #define ELF_ARCH bfd_arch_i386 @@ -2287,6 +2363,7 @@ elf_i386_grok_psinfo (abfd, note) #define ELF_MAXPAGESIZE 0x1000 #define elf_backend_can_gc_sections 1 +#define elf_backend_can_refcount 1 #define elf_backend_want_got_plt 1 #define elf_backend_plt_readonly 1 #define elf_backend_want_plt_sym 0 @@ -2302,16 +2379,17 @@ elf_i386_grok_psinfo (abfd, note) #define elf_backend_adjust_dynamic_symbol elf_i386_adjust_dynamic_symbol #define elf_backend_check_relocs elf_i386_check_relocs +#define elf_backend_copy_indirect_symbol elf_i386_copy_indirect_symbol #define elf_backend_create_dynamic_sections elf_i386_create_dynamic_sections +#define elf_backend_fake_sections elf_i386_fake_sections #define elf_backend_finish_dynamic_sections elf_i386_finish_dynamic_sections #define elf_backend_finish_dynamic_symbol elf_i386_finish_dynamic_symbol #define elf_backend_gc_mark_hook elf_i386_gc_mark_hook #define elf_backend_gc_sweep_hook elf_i386_gc_sweep_hook -#define elf_backend_relocate_section elf_i386_relocate_section -#define elf_backend_size_dynamic_sections elf_i386_size_dynamic_sections -#define elf_backend_fake_sections elf_i386_fake_sections #define elf_backend_grok_prstatus elf_i386_grok_prstatus #define elf_backend_grok_psinfo elf_i386_grok_psinfo #define elf_backend_reloc_type_class elf_i386_reloc_type_class +#define elf_backend_relocate_section elf_i386_relocate_section +#define elf_backend_size_dynamic_sections elf_i386_size_dynamic_sections #include "elf32-target.h" diff -uprN binutils-2.11.90.0.31/bfd/elf32-i860.c binutils-2.11.92.0.5/bfd/elf32-i860.c --- binutils-2.11.90.0.31/bfd/elf32-i860.c Fri Mar 9 11:15:51 2001 +++ binutils-2.11.92.0.5/bfd/elf32-i860.c Mon Oct 1 15:25:21 2001 @@ -695,7 +695,8 @@ elf32_i860_info_to_howto_rela (abfd, bfd arelent *bfd_reloc; Elf64_Internal_Rela *elf_reloc; { - bfd_reloc->howto = lookup_howto (ELF32_R_TYPE (elf_reloc->r_info)); + bfd_reloc->howto + = lookup_howto ((unsigned) ELF32_R_TYPE (elf_reloc->r_info)); } /* Specialized relocation handler for R_860_SPLITn. These relocations @@ -709,7 +710,7 @@ elf32_i860_relocate_splitn (input_bfd, r { bfd_vma insn; reloc_howto_type *howto; - howto = lookup_howto (ELF32_R_TYPE (rello->r_info)); + howto = lookup_howto ((unsigned) ELF32_R_TYPE (rello->r_info)); insn = bfd_get_32 (input_bfd, contents + rello->r_offset); /* Relocate. */ @@ -736,7 +737,7 @@ elf32_i860_relocate_pc16 (input_bfd, inp { bfd_vma insn; reloc_howto_type *howto; - howto = lookup_howto (ELF32_R_TYPE (rello->r_info)); + howto = lookup_howto ((unsigned) ELF32_R_TYPE (rello->r_info)); insn = bfd_get_32 (input_bfd, contents + rello->r_offset); /* Adjust for PC-relative relocation. */ @@ -768,7 +769,7 @@ elf32_i860_relocate_pc26 (input_bfd, inp { bfd_vma insn; reloc_howto_type *howto; - howto = lookup_howto (ELF32_R_TYPE (rello->r_info)); + howto = lookup_howto ((unsigned) ELF32_R_TYPE (rello->r_info)); insn = bfd_get_32 (input_bfd, contents + rello->r_offset); /* Adjust for PC-relative relocation. */ @@ -924,10 +925,10 @@ elf32_i860_relocate_section (output_bfd, } /* This is a final link. */ - howto = lookup_howto (ELF32_R_TYPE (rel->r_info)); - h = NULL; - sym = NULL; - sec = NULL; + howto = lookup_howto ((unsigned) ELF32_R_TYPE (rel->r_info)); + h = NULL; + sym = NULL; + sec = NULL; if (r_symndx < symtab_hdr->sh_info) { diff -uprN binutils-2.11.90.0.31/bfd/elf32-m32r.c binutils-2.11.92.0.5/bfd/elf32-m32r.c --- binutils-2.11.90.0.31/bfd/elf32-m32r.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/elf32-m32r.c Mon Oct 1 15:25:21 2001 @@ -369,7 +369,7 @@ m32r_elf_do_10_pcrel_reloc (abfd, howto, + input_section->output_offset); /* These jumps mask off the lower two bits of the current address before doing pcrel calculations. */ - relocation -= (offset & -4L); + relocation -= (offset & -(bfd_vma) 4); if (relocation < -0x200 || relocation > 0x1ff) status = bfd_reloc_overflow; @@ -380,7 +380,7 @@ m32r_elf_do_10_pcrel_reloc (abfd, howto, relocation >>= howto->rightshift; relocation <<= howto->bitpos; x = (x & ~howto->dst_mask) | (((x & howto->src_mask) + relocation) & howto->dst_mask); - bfd_put_16 (abfd, x, data + offset); + bfd_put_16 (abfd, (bfd_vma) x, data + offset); return status; } @@ -457,7 +457,7 @@ m32r_elf_hi16_reloc (abfd, reloc_entry, relocation += reloc_entry->addend; /* Save the information, and let LO16 do the actual relocation. */ - n = (struct m32r_hi16 *) bfd_malloc (sizeof *n); + n = (struct m32r_hi16 *) bfd_malloc ((bfd_size_type) sizeof *n); if (n == NULL) return bfd_reloc_outofrange; n->addr = (bfd_byte *) data + reloc_entry->address; @@ -556,8 +556,8 @@ m32r_elf_lo16_reloc (input_bfd, reloc_en if ((val & 0x8000) != 0) val += 0x10000; - insn = (insn &~ 0xffff) | ((val >> 16) & 0xffff); - bfd_put_32 (input_bfd, insn, l->addr); + insn = (insn &~ (bfd_vma) 0xffff) | ((val >> 16) & 0xffff); + bfd_put_32 (input_bfd, (bfd_vma) insn, l->addr); next = l->next; free (l); @@ -647,14 +647,14 @@ m32r_elf_generic_reloc (input_bfd, reloc { short x = bfd_get_16 (input_bfd, inplace_address); DOIT (x); - bfd_put_16 (input_bfd, x, inplace_address); + bfd_put_16 (input_bfd, (bfd_vma) x, inplace_address); } break; case 2: { unsigned long x = bfd_get_32 (input_bfd, inplace_address); DOIT (x); - bfd_put_32 (input_bfd, x, inplace_address); + bfd_put_32 (input_bfd, (bfd_vma)x , inplace_address); } break; default: @@ -855,8 +855,8 @@ m32r_elf_add_symbol_hook (abfd, info, sy if (s == NULL) { - int flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS - | SEC_IN_MEMORY | SEC_LINKER_CREATED); + flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS + | SEC_IN_MEMORY | SEC_LINKER_CREATED); s = bfd_make_section_anyway (abfd, ".sdata"); if (s == NULL) @@ -874,7 +874,7 @@ m32r_elf_add_symbol_hook (abfd, info, sy "_SDA_BASE_", BSF_GLOBAL, s, - 32768, + (bfd_vma) 32768, (const char *) NULL, false, get_elf_backend_data (abfd)->collect, @@ -1008,7 +1008,7 @@ m32r_elf_relocate_section (output_bfd, i if (r_type < 0 || r_type >= (int) R_M32R_max) { (*_bfd_error_handler) (_("%s: unknown relocation type %d"), - bfd_get_filename (input_bfd), + bfd_archive_filename (input_bfd), (int) r_type); bfd_set_error (bfd_error_bad_value); ret = false; @@ -1215,11 +1215,12 @@ m32r_elf_relocate_section (output_bfd, i } else { - (*_bfd_error_handler) (_("%s: The target (%s) of an %s relocation is in the wrong section (%s)"), - bfd_get_filename (input_bfd), - sym_name, - m32r_elf_howto_table[(int) r_type].name, - bfd_get_section_name (abfd, sec)); + (*_bfd_error_handler) + (_("%s: The target (%s) of an %s relocation is in the wrong section (%s)"), + bfd_archive_filename (input_bfd), + sym_name, + m32r_elf_howto_table[(int) r_type].name, + bfd_get_section_name (abfd, sec)); /*bfd_set_error (bfd_error_bad_value); ??? why? */ ret = false; continue; @@ -1410,15 +1411,14 @@ m32r_elf_relax_section (abfd, sec, link_ extsyms = (Elf32_External_Sym *) symtab_hdr->contents; else { + bfd_size_type amt = symtab_hdr->sh_size; /* Go get them off disk. */ - extsyms = ((Elf32_External_Sym *) - bfd_malloc (symtab_hdr->sh_size)); + extsyms = (Elf32_External_Sym *) bfd_malloc (amt); if (extsyms == NULL) goto error_return; free_extsyms = extsyms; if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0 - || (bfd_read (extsyms, 1, symtab_hdr->sh_size, abfd) - != symtab_hdr->sh_size)) + || bfd_bread (extsyms, amt, abfd) != amt) goto error_return; } } @@ -1782,6 +1782,7 @@ m32r_elf_get_relocated_section_contents Elf_Internal_Rela *internal_relocs = NULL; Elf32_External_Sym *external_syms = NULL; Elf_Internal_Sym *internal_syms = NULL; + bfd_size_type amt; /* We only need to handle the case of relaxing, or of having a particular set of section contents, specially. */ @@ -1808,15 +1809,13 @@ m32r_elf_get_relocated_section_contents external_syms = (Elf32_External_Sym *) symtab_hdr->contents; else { - external_syms = ((Elf32_External_Sym *) - bfd_malloc (symtab_hdr->sh_info - * sizeof (Elf32_External_Sym))); + amt = symtab_hdr->sh_info; + amt *= sizeof (Elf32_External_Sym); + external_syms = (Elf32_External_Sym *) bfd_malloc (amt); if (external_syms == NULL && symtab_hdr->sh_info > 0) goto error_return; if (bfd_seek (input_bfd, symtab_hdr->sh_offset, SEEK_SET) != 0 - || (bfd_read (external_syms, sizeof (Elf32_External_Sym), - symtab_hdr->sh_info, input_bfd) - != (symtab_hdr->sh_info * sizeof (Elf32_External_Sym)))) + || bfd_bread (external_syms, amt, input_bfd) != amt) goto error_return; } @@ -1826,14 +1825,15 @@ m32r_elf_get_relocated_section_contents if (internal_relocs == NULL) goto error_return; - internal_syms = ((Elf_Internal_Sym *) - bfd_malloc (symtab_hdr->sh_info - * sizeof (Elf_Internal_Sym))); + amt = symtab_hdr->sh_info; + amt *= sizeof (Elf_Internal_Sym); + internal_syms = (Elf_Internal_Sym *) bfd_malloc (amt); if (internal_syms == NULL && symtab_hdr->sh_info > 0) goto error_return; - sections = (asection **) bfd_malloc (symtab_hdr->sh_info - * sizeof (asection *)); + amt = symtab_hdr->sh_info; + amt *= sizeof (asection *); + sections = (asection **) bfd_malloc (amt); if (sections == NULL && symtab_hdr->sh_info > 0) goto error_return; @@ -2017,8 +2017,9 @@ m32r_elf_merge_private_bfd_data (ibfd, o { if ((in_flags & EF_M32R_ARCH) != E_M32R_ARCH) { - _bfd_error_handler (_("%s: Instruction set mismatch with previous modules"), - bfd_get_filename (ibfd)); + (*_bfd_error_handler) + (_("%s: Instruction set mismatch with previous modules"), + bfd_archive_filename (ibfd)); bfd_set_error (bfd_error_bad_value); return false; @@ -2168,7 +2169,8 @@ m32r_elf_check_relocs (abfd, info, sec, } #define ELF_ARCH bfd_arch_m32r -#define ELF_MACHINE_CODE EM_CYGNUS_M32R +#define ELF_MACHINE_CODE EM_M32R +#define ELF_MACHINE_ALT1 EM_CYGNUS_M32R #define ELF_MAXPAGESIZE 0x1 /* Explicitly requested by Mitsubishi. */ #define TARGET_BIG_SYM bfd_elf32_m32r_vec diff -uprN binutils-2.11.90.0.31/bfd/elf32-m68k.c binutils-2.11.92.0.5/bfd/elf32-m68k.c --- binutils-2.11.90.0.31/bfd/elf32-m68k.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/elf32-m68k.c Mon Oct 1 15:25:21 2001 @@ -64,7 +64,7 @@ static boolean elf32_m68k_merge_private_ static boolean elf32_m68k_print_private_bfd_data PARAMS ((bfd *, PTR)); static enum elf_reloc_type_class elf32_m68k_reloc_type_class - PARAMS ((int)); + PARAMS ((const Elf_Internal_Rela *)); static reloc_howto_type howto_table[] = { HOWTO(R_68K_NONE, 0, 0, 0, false,0, complain_overflow_dont, bfd_elf_generic_reloc, "R_68K_NONE", false, 0, 0x00000000,false), @@ -340,9 +340,9 @@ elf_m68k_link_hash_table_create (abfd) bfd *abfd; { struct elf_m68k_link_hash_table *ret; + bfd_size_type amt = sizeof (struct elf_m68k_link_hash_table); - ret = ((struct elf_m68k_link_hash_table *) - bfd_alloc (abfd, sizeof (struct elf_m68k_link_hash_table))); + ret = (struct elf_m68k_link_hash_table *) bfd_alloc (abfd, amt); if (ret == (struct elf_m68k_link_hash_table *) NULL) return NULL; @@ -534,10 +534,8 @@ elf_m68k_check_relocs (abfd, info, sec, if (h != NULL) { - if (h->got.refcount == -1) + if (h->got.refcount == 0) { - h->got.refcount = 1; - /* Make sure this symbol is output as a dynamic symbol. */ if (h->dynindx == -1) { @@ -550,28 +548,25 @@ elf_m68k_check_relocs (abfd, info, sec, /* Allocate relocation space. */ srelgot->_raw_size += sizeof (Elf32_External_Rela); } - else - h->got.refcount++; + h->got.refcount++; } else { /* This is a global offset table entry for a local symbol. */ if (local_got_refcounts == NULL) { - size_t size; + bfd_size_type size; - size = symtab_hdr->sh_info * sizeof (bfd_signed_vma); + size = symtab_hdr->sh_info; + size *= sizeof (bfd_signed_vma); local_got_refcounts = ((bfd_signed_vma *) - bfd_alloc (abfd, size)); + bfd_zalloc (abfd, size)); if (local_got_refcounts == NULL) return false; elf_local_got_refcounts (abfd) = local_got_refcounts; - memset (local_got_refcounts, -1, size); } - if (local_got_refcounts[r_symndx] == -1) + if (local_got_refcounts[r_symndx] == 0) { - local_got_refcounts[r_symndx] = 1; - sgot->_raw_size += 4; if (info->shared) { @@ -581,8 +576,7 @@ elf_m68k_check_relocs (abfd, info, sec, srelgot->_raw_size += sizeof (Elf32_External_Rela); } } - else - local_got_refcounts[r_symndx]++; + local_got_refcounts[r_symndx]++; } break; @@ -602,10 +596,7 @@ elf_m68k_check_relocs (abfd, info, sec, continue; h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; - if (h->plt.refcount == -1) - h->plt.refcount = 1; - else - h->plt.refcount++; + h->plt.refcount++; break; case R_68K_PLT8O: @@ -630,10 +621,7 @@ elf_m68k_check_relocs (abfd, info, sec, } h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; - if (h->plt.refcount == -1) - h->plt.refcount = 1; - else - h->plt.refcount++; + h->plt.refcount++; break; case R_68K_PC8: @@ -661,10 +649,7 @@ elf_m68k_check_relocs (abfd, info, sec, /* Make sure a plt entry is created for this symbol if it turns out to be a function defined by a dynamic object. */ - if (h->plt.refcount == -1) - h->plt.refcount = 1; - else - h->plt.refcount++; + h->plt.refcount++; } break; } @@ -676,10 +661,7 @@ elf_m68k_check_relocs (abfd, info, sec, { /* Make sure a plt entry is created for this symbol if it turns out to be a function defined by a dynamic object. */ - if (h->plt.refcount == -1) - h->plt.refcount = 1; - else - h->plt.refcount++; + h->plt.refcount++; } /* If we are creating a shared library, we need to copy the @@ -750,7 +732,7 @@ elf_m68k_check_relocs (abfd, info, sec, if (p == NULL) { p = ((struct elf_m68k_pcrel_relocs_copied *) - bfd_alloc (dynobj, sizeof *p)); + bfd_alloc (dynobj, (bfd_size_type) sizeof *p)); if (p == NULL) return false; p->next = eh->pcrel_relocs_copied; @@ -1264,36 +1246,39 @@ elf_m68k_size_dynamic_sections (output_b must add the entries now so that we get the correct size for the .dynamic section. The DT_DEBUG entry is filled in by the dynamic linker and used by the debugger. */ +#define add_dynamic_entry(TAG, VAL) \ + bfd_elf32_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL)) + if (!info->shared) { - if (!bfd_elf32_add_dynamic_entry (info, DT_DEBUG, 0)) + if (!add_dynamic_entry (DT_DEBUG, 0)) return false; } if (plt) { - if (!bfd_elf32_add_dynamic_entry (info, DT_PLTGOT, 0) - || !bfd_elf32_add_dynamic_entry (info, DT_PLTRELSZ, 0) - || !bfd_elf32_add_dynamic_entry (info, DT_PLTREL, DT_RELA) - || !bfd_elf32_add_dynamic_entry (info, DT_JMPREL, 0)) + if (!add_dynamic_entry (DT_PLTGOT, 0) + || !add_dynamic_entry (DT_PLTRELSZ, 0) + || !add_dynamic_entry (DT_PLTREL, DT_RELA) + || !add_dynamic_entry (DT_JMPREL, 0)) return false; } if (relocs) { - if (!bfd_elf32_add_dynamic_entry (info, DT_RELA, 0) - || !bfd_elf32_add_dynamic_entry (info, DT_RELASZ, 0) - || !bfd_elf32_add_dynamic_entry (info, DT_RELAENT, - sizeof (Elf32_External_Rela))) + if (!add_dynamic_entry (DT_RELA, 0) + || !add_dynamic_entry (DT_RELASZ, 0) + || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela))) return false; } if ((info->flags & DF_TEXTREL) != 0) { - if (!bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0)) + if (!add_dynamic_entry (DT_TEXTREL, 0)) return false; } } +#undef add_dynamic_entry return true; } @@ -1470,7 +1455,8 @@ elf_m68k_relocate_section (output_bfd, i } else if (h->root.type == bfd_link_hash_undefweak) relocation = 0; - else if (info->shared && !info->symbolic + else if (info->shared + && (!info->symbolic || info->allow_shlib_undefined) && !info->no_undefined && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) relocation = 0; @@ -1961,7 +1947,7 @@ elf_m68k_finish_dynamic_symbol (output_b rela.r_offset = (sgot->output_section->vma + sgot->output_offset - + (h->got.offset &~ 1)); + + (h->got.offset &~ (bfd_vma) 1)); /* If this is a -Bsymbolic link, and the symbol is defined locally, we just want to emit a RELATIVE reloc. Likewise if @@ -1975,12 +1961,12 @@ elf_m68k_finish_dynamic_symbol (output_b rela.r_info = ELF32_R_INFO (0, R_68K_RELATIVE); rela.r_addend = bfd_get_signed_32 (output_bfd, (sgot->contents - + (h->got.offset & ~1))); + + (h->got.offset &~ (bfd_vma) 1))); } else { bfd_put_32 (output_bfd, (bfd_vma) 0, - sgot->contents + (h->got.offset & ~1)); + sgot->contents + (h->got.offset &~ (bfd_vma) 1)); rela.r_info = ELF32_R_INFO (h->dynindx, R_68K_GLOB_DAT); rela.r_addend = 0; } @@ -2186,6 +2172,7 @@ bfd_m68k_elf32_create_embedded_relocs (a Elf_Internal_Rela *free_relocs = NULL; Elf_Internal_Rela *irel, *irelend; bfd_byte *p; + bfd_size_type amt; BFD_ASSERT (! info->relocateable); @@ -2203,17 +2190,15 @@ bfd_m68k_elf32_create_embedded_relocs (a { /* Go get them off disk. */ if (info->keep_memory) - extsyms = ((Elf32_External_Sym *) - bfd_alloc (abfd, symtab_hdr->sh_size)); + extsyms = (Elf32_External_Sym *) bfd_alloc (abfd, symtab_hdr->sh_size); else - extsyms = ((Elf32_External_Sym *) - bfd_malloc (symtab_hdr->sh_size)); + extsyms = (Elf32_External_Sym *) bfd_malloc (symtab_hdr->sh_size); if (extsyms == NULL) goto error_return; if (! info->keep_memory) free_extsyms = extsyms; if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0 - || (bfd_read (extsyms, 1, symtab_hdr->sh_size, abfd) + || (bfd_bread (extsyms, symtab_hdr->sh_size, abfd) != symtab_hdr->sh_size)) goto error_return; if (info->keep_memory) @@ -2229,7 +2214,8 @@ bfd_m68k_elf32_create_embedded_relocs (a if (! info->keep_memory) free_relocs = internal_relocs; - relsec->contents = (bfd_byte *) bfd_alloc (abfd, datasec->reloc_count * 12); + amt = (bfd_size_type) datasec->reloc_count * 12; + relsec->contents = (bfd_byte *) bfd_alloc (abfd, amt); if (relsec->contents == NULL) goto error_return; @@ -2303,10 +2289,10 @@ error_return: } static enum elf_reloc_type_class -elf32_m68k_reloc_type_class (type) - int type; +elf32_m68k_reloc_type_class (rela) + const Elf_Internal_Rela *rela; { - switch (type) + switch ((int) ELF32_R_TYPE (rela->r_info)) { case R_68K_RELATIVE: return reloc_class_relative; @@ -2352,6 +2338,7 @@ elf32_m68k_reloc_type_class (type) #define elf_backend_reloc_type_class elf32_m68k_reloc_type_class #define elf_backend_can_gc_sections 1 +#define elf_backend_can_refcount 1 #define elf_backend_want_got_plt 1 #define elf_backend_plt_readonly 1 #define elf_backend_want_plt_sym 0 diff -uprN binutils-2.11.90.0.31/bfd/elf32-mcore.c binutils-2.11.92.0.5/bfd/elf32-mcore.c --- binutils-2.11.90.0.31/bfd/elf32-mcore.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/elf32-mcore.c Mon Oct 1 15:25:21 2001 @@ -371,7 +371,7 @@ mcore_elf_unsupported_reloc (abfd, reloc BFD_ASSERT (reloc_entry->howto != (reloc_howto_type *)0); _bfd_error_handler (_("%s: Relocation %s (%d) is not currently supported.\n"), - bfd_get_filename (abfd), + bfd_archive_filename (abfd), reloc_entry->howto->name, reloc_entry->howto->type); @@ -428,7 +428,7 @@ mcore_elf_relocate_section (output_bfd, #ifdef DEBUG fprintf (stderr, "mcore_elf_relocate_section called for %s section %s, %ld relocations%s\n", - bfd_get_filename (input_bfd), + bfd_archive_filename (input_bfd), bfd_section_name(input_bfd, input_section), (long) input_section->reloc_count, (info->relocateable) ? " (relocatable)" : ""); @@ -456,7 +456,7 @@ mcore_elf_relocate_section (output_bfd, || ! mcore_elf_howto_table [(int)r_type]) { _bfd_error_handler (_("%s: Unknown relocation type %d\n"), - bfd_get_filename (input_bfd), + bfd_archive_filename (input_bfd), (int) r_type); bfd_set_error (bfd_error_bad_value); @@ -497,7 +497,7 @@ mcore_elf_relocate_section (output_bfd, if (howto->special_function == mcore_elf_unsupported_reloc) { _bfd_error_handler (_("%s: Relocation %s (%d) is not currently supported.\n"), - bfd_get_filename (input_bfd), + bfd_archive_filename (input_bfd), howto->name, (int)r_type); @@ -550,7 +550,7 @@ mcore_elf_relocate_section (output_bfd, case R_MCORE_PCRELJSR_IMM11BY2: oldinst = bfd_get_16 (input_bfd, contents + offset); #define MCORE_INST_BSR 0xF800 - bfd_put_16 (input_bfd, MCORE_INST_BSR, contents + offset); + bfd_put_16 (input_bfd, (bfd_vma) MCORE_INST_BSR, contents + offset); break; } @@ -565,7 +565,7 @@ mcore_elf_relocate_section (output_bfd, if (r != bfd_reloc_ok && r_type == R_MCORE_PCRELJSR_IMM11BY2) { /* Wasn't ok, back it out and give up. */ - bfd_put_16 (input_bfd, oldinst, contents + offset); + bfd_put_16 (input_bfd, (bfd_vma) oldinst, contents + offset); r = bfd_reloc_ok; } diff -uprN binutils-2.11.90.0.31/bfd/elf32-mips.c binutils-2.11.92.0.5/bfd/elf32-mips.c --- binutils-2.11.90.0.31/bfd/elf32-mips.c Thu Aug 30 14:58:40 2001 +++ binutils-2.11.92.0.5/bfd/elf32-mips.c Fri Oct 5 14:11:21 2001 @@ -132,7 +132,7 @@ static boolean mips_elf_create_procedure PARAMS ((PTR, bfd *, struct bfd_link_info *, asection *, struct ecoff_debug_info *)); static INLINE int elf_mips_isa PARAMS ((flagword)); -static INLINE int elf_mips_mach PARAMS ((flagword)); +static INLINE unsigned long elf_mips_mach PARAMS ((flagword)); static INLINE char* elf_mips_abi_name PARAMS ((bfd *)); static boolean mips_elf_is_local_label_name PARAMS ((bfd *, const char *)); @@ -316,15 +316,15 @@ static bfd *reldyn_sorting_bfd; /* Add a dynamic symbol table-entry. */ #ifdef BFD64 -#define MIPS_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \ - (ABI_64_P (elf_hash_table (info)->dynobj) \ - ? bfd_elf64_add_dynamic_entry (info, tag, val) \ - : bfd_elf32_add_dynamic_entry (info, tag, val)) +#define MIPS_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \ + (ABI_64_P (elf_hash_table (info)->dynobj) \ + ? bfd_elf64_add_dynamic_entry (info, (bfd_vma) tag, (bfd_vma) val) \ + : bfd_elf32_add_dynamic_entry (info, (bfd_vma) tag, (bfd_vma) val)) #else -#define MIPS_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \ - (ABI_64_P (elf_hash_table (info)->dynobj) \ - ? (abort (), false) \ - : bfd_elf32_add_dynamic_entry (info, tag, val)) +#define MIPS_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \ + (ABI_64_P (elf_hash_table (info)->dynobj) \ + ? (boolean) (abort (), false) \ + : bfd_elf32_add_dynamic_entry (info, (bfd_vma) tag, (bfd_vma) val)) #endif /* The number of local .got entries we reserve. */ @@ -529,7 +529,7 @@ static reloc_howto_type elf_mips_howto_t 32, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ + complain_overflow_dont, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_32", /* name */ true, /* partial_inplace */ @@ -544,7 +544,7 @@ static reloc_howto_type elf_mips_howto_t 32, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ + complain_overflow_dont, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_REL32", /* name */ true, /* partial_inplace */ @@ -682,7 +682,7 @@ static reloc_howto_type elf_mips_howto_t 32, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ + complain_overflow_dont, /* complain_on_overflow */ _bfd_mips_elf_gprel32_reloc, /* special_function */ "R_MIPS_GPREL32", /* name */ true, /* partial_inplace */ @@ -735,7 +735,7 @@ static reloc_howto_type elf_mips_howto_t 64, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ + complain_overflow_dont, /* complain_on_overflow */ mips32_64bit_reloc, /* special_function */ "R_MIPS_64", /* name */ true, /* partial_inplace */ @@ -750,7 +750,7 @@ static reloc_howto_type elf_mips_howto_t 16, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ + complain_overflow_signed, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_DISP", /* name */ true, /* partial_inplace */ @@ -765,7 +765,7 @@ static reloc_howto_type elf_mips_howto_t 16, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ + complain_overflow_signed, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_PAGE", /* name */ true, /* partial_inplace */ @@ -780,7 +780,7 @@ static reloc_howto_type elf_mips_howto_t 16, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ + complain_overflow_signed, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_OFST", /* name */ true, /* partial_inplace */ @@ -825,7 +825,7 @@ static reloc_howto_type elf_mips_howto_t 64, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ + complain_overflow_dont, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_SUB", /* name */ true, /* partial_inplace */ @@ -849,7 +849,7 @@ static reloc_howto_type elf_mips_howto_t bfd_elf_generic_reloc, /* special_function */ "R_MIPS_HIGHER", /* name */ true, /* partial_inplace */ - 0, /* src_mask */ + 0xffff, /* src_mask */ 0xffff, /* dst_mask */ false), /* pcrel_offset */ @@ -864,7 +864,7 @@ static reloc_howto_type elf_mips_howto_t bfd_elf_generic_reloc, /* special_function */ "R_MIPS_HIGHEST", /* name */ true, /* partial_inplace */ - 0, /* src_mask */ + 0xffff, /* src_mask */ 0xffff, /* dst_mask */ false), /* pcrel_offset */ @@ -908,7 +908,7 @@ static reloc_howto_type elf_mips_howto_t complain_overflow_dont, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_SCN_DISP", /* name */ - false, /* partial_inplace */ + true, /* partial_inplace */ 0xffffffff, /* src_mask */ 0xffffffff, /* dst_mask */ false), /* pcrel_offset */ @@ -1195,7 +1195,7 @@ _bfd_mips_elf_hi16_reloc (abfd, return bfd_reloc_outofrange; /* Save the information, and let LO16 do the actual relocation. */ - n = (struct mips_hi16 *) bfd_malloc (sizeof *n); + n = (struct mips_hi16 *) bfd_malloc ((bfd_size_type) sizeof *n); if (n == NULL) return bfd_reloc_outofrange; n->addr = (bfd_byte *) data + reloc_entry->address; @@ -1263,8 +1263,8 @@ _bfd_mips_elf_lo16_reloc (abfd, if ((val & 0x8000) != 0) val += 0x10000; - insn = (insn & ~0xffff) | ((val >> 16) & 0xffff); - bfd_put_32 (abfd, insn, l->addr); + insn = (insn &~ (bfd_vma) 0xffff) | ((val >> 16) & 0xffff); + bfd_put_32 (abfd, (bfd_vma) insn, l->addr); if (strcmp (bfd_asymbol_name (symbol), "_gp_disp") == 0) { @@ -1387,7 +1387,7 @@ mips_elf_assign_gp (output_bfd, pgp) { for (i = 0; i < count; i++, sym++) { - register CONST char *name; + register const char *name; name = bfd_asymbol_name (*sym); if (*name == '_' && strcmp (name, "_gp") == 0) @@ -1555,8 +1555,8 @@ gprel16_with_gp (abfd, symbol, reloc_ent || (symbol->flags & BSF_SECTION_SYM) != 0) val += relocation - gp; - insn = (insn & ~0xffff) | (val & 0xffff); - bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address); + insn = (insn &~ (bfd_vma) 0xffff) | (val & 0xffff); + bfd_put_32 (abfd, (bfd_vma) insn, (bfd_byte *) data + reloc_entry->address); if (relocateable) reloc_entry->address += input_section->output_offset; @@ -1671,7 +1671,7 @@ gprel32_with_gp (abfd, symbol, reloc_ent || (symbol->flags & BSF_SECTION_SYM) != 0) val += relocation - gp; - bfd_put_32 (abfd, val, (bfd_byte *) data + reloc_entry->address); + bfd_put_32 (abfd, (bfd_vma) val, (bfd_byte *) data + reloc_entry->address); if (relocateable) reloc_entry->address += input_section->output_offset; @@ -1721,7 +1721,7 @@ mips32_64bit_reloc (abfd, reloc_entry, s addr = reloc_entry->address; if (bfd_little_endian (abfd)) addr += 4; - bfd_put_32 (abfd, val, (bfd_byte *) data + addr); + bfd_put_32 (abfd, (bfd_vma) val, (bfd_byte *) data + addr); return r; } @@ -1815,9 +1815,9 @@ mips16_gprel_reloc (abfd, reloc_entry, s /* Stuff the current addend back as a 32 bit value, do the usual relocation, and then clean up. */ bfd_put_32 (abfd, - (((extend & 0x1f) << 11) - | (extend & 0x7e0) - | (insn & 0x1f)), + (bfd_vma) (((extend & 0x1f) << 11) + | (extend & 0x7e0) + | (insn & 0x1f)), (bfd_byte *) data + reloc_entry->address); ret = gprel16_with_gp (abfd, symbol, reloc_entry, input_section, @@ -1825,13 +1825,13 @@ mips16_gprel_reloc (abfd, reloc_entry, s final = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); bfd_put_16 (abfd, - ((extend & 0xf800) - | ((final >> 11) & 0x1f) - | (final & 0x7e0)), + (bfd_vma) ((extend & 0xf800) + | ((final >> 11) & 0x1f) + | (final & 0x7e0)), (bfd_byte *) data + reloc_entry->address); bfd_put_16 (abfd, - ((insn & 0xffe0) - | (final & 0x1f)), + (bfd_vma) ((insn & 0xffe0) + | (final & 0x1f)), (bfd_byte *) data + reloc_entry->address + 2); return ret; @@ -1865,7 +1865,7 @@ elf_mips_isa (flags) /* Return the MACH for a MIPS e_flags value. */ -static INLINE int +static INLINE unsigned long elf_mips_mach (flags) flagword flags; { @@ -1886,9 +1886,6 @@ elf_mips_mach (flags) case E_MIPS_MACH_4650: return bfd_mach_mips4650; - case E_MIPS_MACH_MIPS32_4K: - return bfd_mach_mips32_4k; - case E_MIPS_MACH_SB1: return bfd_mach_mips_sb1; @@ -1917,11 +1914,11 @@ elf_mips_mach (flags) break; case E_MIPS_ARCH_32: - return bfd_mach_mips32; + return bfd_mach_mipsisa32; break; case E_MIPS_ARCH_64: - return bfd_mach_mips64; + return bfd_mach_mipsisa64; break; } } @@ -1967,7 +1964,7 @@ struct elf_reloc_map { enum elf_mips_reloc_type elf_reloc_val; }; -static CONST struct elf_reloc_map mips_reloc_map[] = +static const struct elf_reloc_map mips_reloc_map[] = { { BFD_RELOC_NONE, R_MIPS_NONE, }, { BFD_RELOC_16, R_MIPS_16 }, @@ -2136,12 +2133,12 @@ bfd_mips_elf32_swap_reginfo_in (abfd, ex const Elf32_External_RegInfo *ex; Elf32_RegInfo *in; { - in->ri_gprmask = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_gprmask); - in->ri_cprmask[0] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[0]); - in->ri_cprmask[1] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[1]); - in->ri_cprmask[2] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[2]); - in->ri_cprmask[3] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[3]); - in->ri_gp_value = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_gp_value); + in->ri_gprmask = H_GET_32 (abfd, ex->ri_gprmask); + in->ri_cprmask[0] = H_GET_32 (abfd, ex->ri_cprmask[0]); + in->ri_cprmask[1] = H_GET_32 (abfd, ex->ri_cprmask[1]); + in->ri_cprmask[2] = H_GET_32 (abfd, ex->ri_cprmask[2]); + in->ri_cprmask[3] = H_GET_32 (abfd, ex->ri_cprmask[3]); + in->ri_gp_value = H_GET_32 (abfd, ex->ri_gp_value); } void @@ -2150,18 +2147,12 @@ bfd_mips_elf32_swap_reginfo_out (abfd, i const Elf32_RegInfo *in; Elf32_External_RegInfo *ex; { - bfd_h_put_32 (abfd, (bfd_vma) in->ri_gprmask, - (bfd_byte *) ex->ri_gprmask); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[0], - (bfd_byte *) ex->ri_cprmask[0]); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[1], - (bfd_byte *) ex->ri_cprmask[1]); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[2], - (bfd_byte *) ex->ri_cprmask[2]); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[3], - (bfd_byte *) ex->ri_cprmask[3]); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_gp_value, - (bfd_byte *) ex->ri_gp_value); + H_PUT_32 (abfd, in->ri_gprmask, ex->ri_gprmask); + H_PUT_32 (abfd, in->ri_cprmask[0], ex->ri_cprmask[0]); + H_PUT_32 (abfd, in->ri_cprmask[1], ex->ri_cprmask[1]); + H_PUT_32 (abfd, in->ri_cprmask[2], ex->ri_cprmask[2]); + H_PUT_32 (abfd, in->ri_cprmask[3], ex->ri_cprmask[3]); + H_PUT_32 (abfd, in->ri_gp_value, ex->ri_gp_value); } /* In the 64 bit ABI, the .MIPS.options section holds register @@ -2176,13 +2167,13 @@ bfd_mips_elf64_swap_reginfo_in (abfd, ex const Elf64_External_RegInfo *ex; Elf64_Internal_RegInfo *in; { - in->ri_gprmask = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_gprmask); - in->ri_pad = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_pad); - in->ri_cprmask[0] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[0]); - in->ri_cprmask[1] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[1]); - in->ri_cprmask[2] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[2]); - in->ri_cprmask[3] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[3]); - in->ri_gp_value = bfd_h_get_64 (abfd, (bfd_byte *) ex->ri_gp_value); + in->ri_gprmask = H_GET_32 (abfd, ex->ri_gprmask); + in->ri_pad = H_GET_32 (abfd, ex->ri_pad); + in->ri_cprmask[0] = H_GET_32 (abfd, ex->ri_cprmask[0]); + in->ri_cprmask[1] = H_GET_32 (abfd, ex->ri_cprmask[1]); + in->ri_cprmask[2] = H_GET_32 (abfd, ex->ri_cprmask[2]); + in->ri_cprmask[3] = H_GET_32 (abfd, ex->ri_cprmask[3]); + in->ri_gp_value = H_GET_64 (abfd, ex->ri_gp_value); } void @@ -2191,20 +2182,13 @@ bfd_mips_elf64_swap_reginfo_out (abfd, i const Elf64_Internal_RegInfo *in; Elf64_External_RegInfo *ex; { - bfd_h_put_32 (abfd, (bfd_vma) in->ri_gprmask, - (bfd_byte *) ex->ri_gprmask); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_pad, - (bfd_byte *) ex->ri_pad); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[0], - (bfd_byte *) ex->ri_cprmask[0]); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[1], - (bfd_byte *) ex->ri_cprmask[1]); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[2], - (bfd_byte *) ex->ri_cprmask[2]); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[3], - (bfd_byte *) ex->ri_cprmask[3]); - bfd_h_put_64 (abfd, (bfd_vma) in->ri_gp_value, - (bfd_byte *) ex->ri_gp_value); + H_PUT_32 (abfd, in->ri_gprmask, ex->ri_gprmask); + H_PUT_32 (abfd, in->ri_pad, ex->ri_pad); + H_PUT_32 (abfd, in->ri_cprmask[0], ex->ri_cprmask[0]); + H_PUT_32 (abfd, in->ri_cprmask[1], ex->ri_cprmask[1]); + H_PUT_32 (abfd, in->ri_cprmask[2], ex->ri_cprmask[2]); + H_PUT_32 (abfd, in->ri_cprmask[3], ex->ri_cprmask[3]); + H_PUT_64 (abfd, in->ri_gp_value, ex->ri_gp_value); } /* Swap an entry in a .gptab section. Note that these routines rely @@ -2216,8 +2200,8 @@ bfd_mips_elf32_swap_gptab_in (abfd, ex, const Elf32_External_gptab *ex; Elf32_gptab *in; { - in->gt_entry.gt_g_value = bfd_h_get_32 (abfd, ex->gt_entry.gt_g_value); - in->gt_entry.gt_bytes = bfd_h_get_32 (abfd, ex->gt_entry.gt_bytes); + in->gt_entry.gt_g_value = H_GET_32 (abfd, ex->gt_entry.gt_g_value); + in->gt_entry.gt_bytes = H_GET_32 (abfd, ex->gt_entry.gt_bytes); } static void @@ -2226,10 +2210,8 @@ bfd_mips_elf32_swap_gptab_out (abfd, in, const Elf32_gptab *in; Elf32_External_gptab *ex; { - bfd_h_put_32 (abfd, (bfd_vma) in->gt_entry.gt_g_value, - ex->gt_entry.gt_g_value); - bfd_h_put_32 (abfd, (bfd_vma) in->gt_entry.gt_bytes, - ex->gt_entry.gt_bytes); + H_PUT_32 (abfd, in->gt_entry.gt_g_value, ex->gt_entry.gt_g_value); + H_PUT_32 (abfd, in->gt_entry.gt_bytes, ex->gt_entry.gt_bytes); } static void @@ -2238,12 +2220,12 @@ bfd_elf32_swap_compact_rel_out (abfd, in const Elf32_compact_rel *in; Elf32_External_compact_rel *ex; { - bfd_h_put_32 (abfd, (bfd_vma) in->id1, ex->id1); - bfd_h_put_32 (abfd, (bfd_vma) in->num, ex->num); - bfd_h_put_32 (abfd, (bfd_vma) in->id2, ex->id2); - bfd_h_put_32 (abfd, (bfd_vma) in->offset, ex->offset); - bfd_h_put_32 (abfd, (bfd_vma) in->reserved0, ex->reserved0); - bfd_h_put_32 (abfd, (bfd_vma) in->reserved1, ex->reserved1); + H_PUT_32 (abfd, in->id1, ex->id1); + H_PUT_32 (abfd, in->num, ex->num); + H_PUT_32 (abfd, in->id2, ex->id2); + H_PUT_32 (abfd, in->offset, ex->offset); + H_PUT_32 (abfd, in->reserved0, ex->reserved0); + H_PUT_32 (abfd, in->reserved1, ex->reserved1); } static void @@ -2258,9 +2240,9 @@ bfd_elf32_swap_crinfo_out (abfd, in, ex) | ((in->rtype & CRINFO_RTYPE) << CRINFO_RTYPE_SH) | ((in->dist2to & CRINFO_DIST2TO) << CRINFO_DIST2TO_SH) | ((in->relvaddr & CRINFO_RELVADDR) << CRINFO_RELVADDR_SH)); - bfd_h_put_32 (abfd, (bfd_vma) l, ex->info); - bfd_h_put_32 (abfd, (bfd_vma) in->konst, ex->konst); - bfd_h_put_32 (abfd, (bfd_vma) in->vaddr, ex->vaddr); + H_PUT_32 (abfd, l, ex->info); + H_PUT_32 (abfd, in->konst, ex->konst); + H_PUT_32 (abfd, in->vaddr, ex->vaddr); } /* Swap in an options header. */ @@ -2271,10 +2253,10 @@ bfd_mips_elf_swap_options_in (abfd, ex, const Elf_External_Options *ex; Elf_Internal_Options *in; { - in->kind = bfd_h_get_8 (abfd, ex->kind); - in->size = bfd_h_get_8 (abfd, ex->size); - in->section = bfd_h_get_16 (abfd, ex->section); - in->info = bfd_h_get_32 (abfd, ex->info); + in->kind = H_GET_8 (abfd, ex->kind); + in->size = H_GET_8 (abfd, ex->size); + in->section = H_GET_16 (abfd, ex->section); + in->info = H_GET_32 (abfd, ex->info); } /* Swap out an options header. */ @@ -2285,10 +2267,10 @@ bfd_mips_elf_swap_options_out (abfd, in, const Elf_Internal_Options *in; Elf_External_Options *ex; { - bfd_h_put_8 (abfd, in->kind, ex->kind); - bfd_h_put_8 (abfd, in->size, ex->size); - bfd_h_put_16 (abfd, in->section, ex->section); - bfd_h_put_32 (abfd, in->info, ex->info); + H_PUT_8 (abfd, in->kind, ex->kind); + H_PUT_8 (abfd, in->size, ex->size); + H_PUT_16 (abfd, in->section, ex->section); + H_PUT_32 (abfd, in->info, ex->info); } #if 0 /* Swap in an MSYM entry. */ @@ -2299,8 +2281,8 @@ bfd_mips_elf_swap_msym_in (abfd, ex, in) const Elf32_External_Msym *ex; Elf32_Internal_Msym *in; { - in->ms_hash_value = bfd_h_get_32 (abfd, ex->ms_hash_value); - in->ms_info = bfd_h_get_32 (abfd, ex->ms_info); + in->ms_hash_value = H_GET_32 (abfd, ex->ms_hash_value); + in->ms_info = H_GET_32 (abfd, ex->ms_info); } #endif /* Swap out an MSYM entry. */ @@ -2311,8 +2293,8 @@ bfd_mips_elf_swap_msym_out (abfd, in, ex const Elf32_Internal_Msym *in; Elf32_External_Msym *ex; { - bfd_h_put_32 (abfd, in->ms_hash_value, ex->ms_hash_value); - bfd_h_put_32 (abfd, in->ms_info, ex->ms_info); + H_PUT_32 (abfd, in->ms_hash_value, ex->ms_hash_value); + H_PUT_32 (abfd, in->ms_info, ex->ms_info); } /* Determine whether a symbol is global for the purposes of splitting @@ -2412,25 +2394,20 @@ _bfd_mips_elf_final_write_processing (ab val = E_MIPS_ARCH_4; break; - case bfd_mach_mips32: - val = E_MIPS_ARCH_32; - break; - - case bfd_mach_mips32_4k: - val = E_MIPS_ARCH_32 | E_MIPS_MACH_MIPS32_4K; - break; - case bfd_mach_mips5: val = E_MIPS_ARCH_5; break; - case bfd_mach_mips64: - val = E_MIPS_ARCH_64; - break; - case bfd_mach_mips_sb1: val = E_MIPS_ARCH_64 | E_MIPS_MACH_SB1; break; + + case bfd_mach_mipsisa32: + val = E_MIPS_ARCH_32; + break; + + case bfd_mach_mipsisa64: + val = E_MIPS_ARCH_64; } elf_elfheader (abfd)->e_flags &= ~(EF_MIPS_ARCH | EF_MIPS_MACH); @@ -2622,7 +2599,7 @@ _bfd_mips_elf_merge_private_bfd_data (ib old_flags &= ~EF_MIPS_PIC; (*_bfd_error_handler) (_("%s: linking PIC files with non-PIC files"), - bfd_get_filename (ibfd)); + bfd_archive_filename (ibfd)); ok = false; } @@ -2632,7 +2609,7 @@ _bfd_mips_elf_merge_private_bfd_data (ib old_flags &= ~EF_MIPS_CPIC; (*_bfd_error_handler) (_("%s: linking abicalls files with non-abicalls files"), - bfd_get_filename (ibfd)); + bfd_archive_filename (ibfd)); ok = false; } @@ -2661,7 +2638,7 @@ _bfd_mips_elf_merge_private_bfd_data (ib { (*_bfd_error_handler) (_("%s: ISA mismatch (-mips%d) with previous modules (-mips%d)"), - bfd_get_filename (ibfd), new_isa, old_isa); + bfd_archive_filename (ibfd), new_isa, old_isa); ok = false; } } @@ -2670,7 +2647,7 @@ _bfd_mips_elf_merge_private_bfd_data (ib { (*_bfd_error_handler) (_("%s: ISA mismatch (%d) with previous modules (%d)"), - bfd_get_filename (ibfd), + bfd_archive_filename (ibfd), elf_mips_mach (new_flags), elf_mips_mach (old_flags)); ok = false; @@ -2693,7 +2670,7 @@ _bfd_mips_elf_merge_private_bfd_data (ib { (*_bfd_error_handler) (_("%s: ABI mismatch: linking %s module with previous %s modules"), - bfd_get_filename (ibfd), + bfd_archive_filename (ibfd), elf_mips_abi_name (ibfd), elf_mips_abi_name (obfd)); ok = false; @@ -2707,7 +2684,7 @@ _bfd_mips_elf_merge_private_bfd_data (ib { (*_bfd_error_handler) (_("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"), - bfd_get_filename (ibfd), (unsigned long) new_flags, + bfd_archive_filename (ibfd), (unsigned long) new_flags, (unsigned long) old_flags); ok = false; } @@ -2887,7 +2864,8 @@ _bfd_mips_elf_section_from_shdr (abfd, h Elf32_RegInfo s; if (! bfd_get_section_contents (abfd, hdr->bfd_section, (PTR) &ext, - (file_ptr) 0, sizeof ext)) + (file_ptr) 0, + (bfd_size_type) sizeof ext)) return false; bfd_mips_elf32_swap_reginfo_in (abfd, &ext, &s); elf_gp (abfd) = s.ri_gp_value; @@ -3068,11 +3046,11 @@ _bfd_mips_elf_fake_sections (abfd, hdr, if ((sec->flags & SEC_RELOC) != 0) { struct bfd_elf_section_data *esd; + bfd_size_type amt = sizeof (Elf_Internal_Shdr); esd = elf_section_data (sec); BFD_ASSERT (esd->rel_hdr2 == NULL); - esd->rel_hdr2 - = (Elf_Internal_Shdr *) bfd_zalloc (abfd, sizeof (Elf_Internal_Shdr)); + esd->rel_hdr2 = (Elf_Internal_Shdr *) bfd_zalloc (abfd, amt); if (!esd->rel_hdr2) return false; _bfd_elf_init_reloc_shdr (abfd, esd->rel_hdr2, sec, @@ -3126,8 +3104,8 @@ _bfd_mips_elf_set_section_contents (abfd if (elf_section_data (section) == NULL) { - section->used_by_bfd = - (PTR) bfd_zalloc (abfd, sizeof (struct bfd_elf_section_data)); + bfd_size_type amt = sizeof (struct bfd_elf_section_data); + section->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); if (elf_section_data (section) == NULL) return false; } @@ -3146,7 +3124,7 @@ _bfd_mips_elf_set_section_contents (abfd elf_section_data (section)->tdata = (PTR) c; } - memcpy (c + offset, location, count); + memcpy (c + offset, location, (size_t) count); } return _bfd_elf_set_section_contents (abfd, section, location, offset, @@ -3173,10 +3151,10 @@ _bfd_mips_elf_section_processing (abfd, if (bfd_seek (abfd, hdr->sh_offset + sizeof (Elf32_External_RegInfo) - 4, - SEEK_SET) == -1) + SEEK_SET) != 0) return false; - bfd_h_put_32 (abfd, (bfd_vma) elf_gp (abfd), buf); - if (bfd_write (buf, (bfd_size_type) 1, (bfd_size_type) 4, abfd) != 4) + H_PUT_32 (abfd, elf_gp (abfd), buf); + if (bfd_bwrite (buf, (bfd_size_type) 4, abfd) != 4) return false; } @@ -3212,10 +3190,10 @@ _bfd_mips_elf_section_processing (abfd, + (l - contents) + sizeof (Elf_External_Options) + (sizeof (Elf64_External_RegInfo) - 8)), - SEEK_SET) == -1) + SEEK_SET) != 0) return false; - bfd_h_put_64 (abfd, elf_gp (abfd), buf); - if (bfd_write (buf, 1, 8, abfd) != 8) + H_PUT_64 (abfd, elf_gp (abfd), buf); + if (bfd_bwrite (buf, (bfd_size_type) 8, abfd) != 8) return false; } else if (intopt.kind == ODK_REGINFO) @@ -3227,10 +3205,10 @@ _bfd_mips_elf_section_processing (abfd, + (l - contents) + sizeof (Elf_External_Options) + (sizeof (Elf32_External_RegInfo) - 4)), - SEEK_SET) == -1) + SEEK_SET) != 0) return false; - bfd_h_put_32 (abfd, elf_gp (abfd), buf); - if (bfd_write (buf, 1, 4, abfd) != 4) + H_PUT_32 (abfd, elf_gp (abfd), buf); + if (bfd_bwrite (buf, (bfd_size_type) 4, abfd) != 4) return false; } l += intopt.size; @@ -3409,6 +3387,7 @@ _bfd_mips_elf_modify_segment_map (abfd) { asection *s; struct elf_segment_map *m, **pm; + bfd_size_type amt; /* If there is a .reginfo section, we need a PT_MIPS_REGINFO segment. */ @@ -3420,7 +3399,8 @@ _bfd_mips_elf_modify_segment_map (abfd) break; if (m == NULL) { - m = (struct elf_segment_map *) bfd_zalloc (abfd, sizeof *m); + amt = sizeof *m; + m = (struct elf_segment_map *) bfd_zalloc (abfd, amt); if (m == NULL) return false; @@ -3446,8 +3426,6 @@ _bfd_mips_elf_modify_segment_map (abfd) table. */ if (IRIX_COMPAT (abfd) == ict_irix6) { - asection *s; - for (s = abfd->sections; s; s = s->next) if (elf_section_data (s)->this_hdr.sh_type == SHT_MIPS_OPTIONS) break; @@ -3466,8 +3444,8 @@ _bfd_mips_elf_modify_segment_map (abfd) if ((*pm)->p_type == PT_PHDR) break; - options_segment = bfd_zalloc (abfd, - sizeof (struct elf_segment_map)); + amt = sizeof (struct elf_segment_map); + options_segment = bfd_zalloc (abfd, amt); options_segment->next = *pm; options_segment->p_type = PT_MIPS_OPTIONS; options_segment->p_flags = PF_R; @@ -3492,7 +3470,8 @@ _bfd_mips_elf_modify_segment_map (abfd) break; if (m == NULL) { - m = (struct elf_segment_map *) bfd_zalloc (abfd, sizeof *m); + amt = sizeof *m; + m = (struct elf_segment_map *) bfd_zalloc (abfd, amt); if (m == NULL) return false; @@ -3582,8 +3561,8 @@ _bfd_mips_elf_modify_segment_map (abfd) 0 ? s->_cooked_size : s->_raw_size)) <= high)) ++c; - n = ((struct elf_segment_map *) - bfd_zalloc (abfd, sizeof *n + (c - 1) * sizeof (asection *))); + amt = sizeof *n + (bfd_size_type) (c - 1) * sizeof (asection *); + n = (struct elf_segment_map *) bfd_zalloc (abfd, amt); if (n == NULL) return false; *n = *m; @@ -3640,20 +3619,20 @@ ecoff_swap_rpdr_out (abfd, in, ex) const RPDR *in; struct rpdr_ext *ex; { - /* ecoff_put_off was defined in ecoffswap.h. */ - ecoff_put_off (abfd, in->adr, (bfd_byte *) ex->p_adr); - bfd_h_put_32 (abfd, in->regmask, (bfd_byte *) ex->p_regmask); - bfd_h_put_32 (abfd, in->regoffset, (bfd_byte *) ex->p_regoffset); - bfd_h_put_32 (abfd, in->fregmask, (bfd_byte *) ex->p_fregmask); - bfd_h_put_32 (abfd, in->fregoffset, (bfd_byte *) ex->p_fregoffset); - bfd_h_put_32 (abfd, in->frameoffset, (bfd_byte *) ex->p_frameoffset); + /* ECOFF_PUT_OFF was defined in ecoffswap.h. */ + ECOFF_PUT_OFF (abfd, in->adr, ex->p_adr); + H_PUT_32 (abfd, in->regmask, ex->p_regmask); + H_PUT_32 (abfd, in->regoffset, ex->p_regoffset); + H_PUT_32 (abfd, in->fregmask, ex->p_fregmask); + H_PUT_32 (abfd, in->fregoffset, ex->p_fregoffset); + H_PUT_32 (abfd, in->frameoffset, ex->p_frameoffset); - bfd_h_put_16 (abfd, in->framereg, (bfd_byte *) ex->p_framereg); - bfd_h_put_16 (abfd, in->pcreg, (bfd_byte *) ex->p_pcreg); + H_PUT_16 (abfd, in->framereg, ex->p_framereg); + H_PUT_16 (abfd, in->pcreg, ex->p_pcreg); - bfd_h_put_32 (abfd, in->irpss, (bfd_byte *) ex->p_irpss); + H_PUT_32 (abfd, in->irpss, ex->p_irpss); #if 0 /* FIXME */ - ecoff_put_off (abfd, in->exception_info, (bfd_byte *) ex->p_exception_info); + ECOFF_PUT_OFF (abfd, in->exception_info, ex->p_exception_info); #endif } @@ -3673,7 +3652,7 @@ _bfd_mips_elf_read_ecoff_info (abfd, sec swap = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap; memset (debug, 0, sizeof (*debug)); - ext_hdr = (char *) bfd_malloc ((size_t) swap->external_hdr_size); + ext_hdr = (char *) bfd_malloc (swap->external_hdr_size); if (ext_hdr == NULL && swap->external_hdr_size != 0) goto error_return; @@ -3692,12 +3671,12 @@ _bfd_mips_elf_read_ecoff_info (abfd, sec debug->ptr = NULL; \ else \ { \ - debug->ptr = (type) bfd_malloc ((size_t) (size * symhdr->count)); \ + bfd_size_type amt = (bfd_size_type) size * symhdr->count; \ + debug->ptr = (type) bfd_malloc (amt); \ if (debug->ptr == NULL) \ goto error_return; \ if (bfd_seek (abfd, (file_ptr) symhdr->offset, SEEK_SET) != 0 \ - || (bfd_read (debug->ptr, size, symhdr->count, \ - abfd) != size * symhdr->count)) \ + || bfd_bread (debug->ptr, amt, abfd) != amt) \ goto error_return; \ } @@ -3793,7 +3772,7 @@ _bfd_mips_elf_find_nearest_line (abfd, s if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset, filename_ptr, functionname_ptr, line_ptr, - ABI_64_P (abfd) ? 8 : 0, + (unsigned) (ABI_64_P (abfd) ? 8 : 0), &elf_tdata (abfd)->dwarf2_find_line_info)) return true; @@ -3819,9 +3798,9 @@ _bfd_mips_elf_find_nearest_line (abfd, s char *fraw_src; char *fraw_end; struct fdr *fdr_ptr; + bfd_size_type amt = sizeof (struct mips_elf_find_line); - fi = ((struct mips_elf_find_line *) - bfd_zalloc (abfd, sizeof (struct mips_elf_find_line))); + fi = (struct mips_elf_find_line *) bfd_zalloc (abfd, amt); if (fi == NULL) { msec->flags = origflags; @@ -3835,10 +3814,8 @@ _bfd_mips_elf_find_nearest_line (abfd, s } /* Swap in the FDR information. */ - fi->d.fdr = ((struct fdr *) - bfd_alloc (abfd, - (fi->d.symbolic_header.ifdMax * - sizeof (struct fdr)))); + amt = fi->d.symbolic_header.ifdMax * sizeof (struct fdr); + fi->d.fdr = (struct fdr *) bfd_alloc (abfd, amt); if (fi->d.fdr == NULL) { msec->flags = origflags; @@ -4039,9 +4016,9 @@ _bfd_mips_elf_link_hash_table_create (ab bfd *abfd; { struct mips_elf_link_hash_table *ret; + bfd_size_type amt = sizeof (struct mips_elf_link_hash_table); - ret = ((struct mips_elf_link_hash_table *) - bfd_alloc (abfd, sizeof (struct mips_elf_link_hash_table))); + ret = (struct mips_elf_link_hash_table *) bfd_alloc (abfd, amt); if (ret == (struct mips_elf_link_hash_table *) NULL) return NULL; @@ -4109,12 +4086,14 @@ _bfd_mips_elf_add_symbol_hook (abfd, inf { asymbol *elf_text_symbol; asection *elf_text_section; + bfd_size_type amt = sizeof (asection); - elf_text_section = bfd_zalloc (abfd, sizeof (asection)); + elf_text_section = bfd_zalloc (abfd, amt); if (elf_text_section == NULL) return false; - elf_text_symbol = bfd_zalloc (abfd, sizeof (asymbol)); + amt = sizeof (asymbol); + elf_text_symbol = bfd_zalloc (abfd, amt); if (elf_text_symbol == NULL) return false; @@ -4148,12 +4127,14 @@ _bfd_mips_elf_add_symbol_hook (abfd, inf { asymbol *elf_data_symbol; asection *elf_data_section; + bfd_size_type amt = sizeof (asection); - elf_data_section = bfd_zalloc (abfd, sizeof (asection)); + elf_data_section = bfd_zalloc (abfd, amt); if (elf_data_section == NULL) return false; - elf_data_symbol = bfd_zalloc (abfd, sizeof (asymbol)); + amt = sizeof (asymbol); + elf_data_symbol = bfd_zalloc (abfd, amt); if (elf_data_symbol == NULL) return false; @@ -4439,7 +4420,8 @@ mips_elf_create_procedure_table (handle, struct sym_ext *esym; char *ss, **sv; char *str; - unsigned long size, count; + bfd_size_type size; + bfd_size_type count; unsigned long sindex; unsigned long i; PDR pdr; @@ -4472,7 +4454,8 @@ mips_elf_create_procedure_table (handle, if (rpdr == NULL) goto error_return; - sv = (char **) bfd_malloc (sizeof (char *) * count); + size = sizeof (char *); + sv = (char **) bfd_malloc (size * count); if (sv == NULL) goto error_return; @@ -4493,7 +4476,7 @@ mips_elf_create_procedure_table (handle, goto error_return; count = hdr->ipdMax; - for (i = 0; i < count; i++, rp++) + for (i = 0; i < (unsigned long) count; i++, rp++) { (*swap->swap_pdr_in) (abfd, (PTR) (epdr + i), &pdr); (*swap->swap_sym_in) (abfd, (PTR) &esym[pdr.isym], &sym); @@ -4534,7 +4517,7 @@ mips_elf_create_procedure_table (handle, strcpy (str, sv[i]); str += strlen (sv[i]) + 1; } - ecoff_put_off (abfd, (bfd_vma) -1, (bfd_byte *) (erp + count)->p_adr); + ECOFF_PUT_OFF (abfd, -1, (erp + count)->p_adr); /* Set the size and contents of .rtproc section. */ s->_raw_size = size; @@ -4606,9 +4589,10 @@ _bfd_mips_elf_final_link (abfd, info) PTR mdebug_handle = NULL; asection *s; EXTR esym; - bfd_vma last; unsigned int i; - static const char * const name[] = + bfd_size_type amt; + + static const char * const secname[] = { ".text", ".init", ".fini", ".data", ".rodata", ".sdata", ".sbss", ".bss" @@ -4757,7 +4741,7 @@ _bfd_mips_elf_final_link (abfd, info) if (! bfd_get_section_contents (input_bfd, input_section, (PTR) &ext, (file_ptr) 0, - sizeof ext)) + (bfd_size_type) sizeof ext)) return false; bfd_mips_elf32_swap_reginfo_in (input_bfd, &ext, &sub); @@ -4790,6 +4774,7 @@ _bfd_mips_elf_final_link (abfd, info) if (strcmp (o->name, ".mdebug") == 0) { struct extsym_info einfo; + bfd_vma last; /* We have found the .mdebug section in the output file. Look through all the link_orders comprising it and merge @@ -4838,10 +4823,10 @@ _bfd_mips_elf_final_link (abfd, info) esym.asym.reserved = 0; esym.asym.index = indexNil; last = 0; - for (i = 0; i < 8; i++) + for (i = 0; i < sizeof (secname) / sizeof (secname[0]); i++) { esym.asym.sc = sc[i]; - s = bfd_get_section_by_name (abfd, name[i]); + s = bfd_get_section_by_name (abfd, secname[i]); if (s != NULL) { esym.asym.value = s->vma; @@ -4850,7 +4835,7 @@ _bfd_mips_elf_final_link (abfd, info) else esym.asym.value = last; if (!bfd_ecoff_debug_one_external (abfd, &debug, swap, - name[i], &esym)) + secname[i], &esym)) return false; } @@ -5007,7 +4992,7 @@ _bfd_mips_elf_final_link (abfd, info) unsigned int c; Elf32_gptab *tab; Elf32_External_gptab *ext_tab; - unsigned int i; + unsigned int j; /* The .gptab.sdata and .gptab.sbss sections hold information describing how the small data area would @@ -5015,8 +5000,6 @@ _bfd_mips_elf_final_link (abfd, info) not used in executables files. */ if (! info->relocateable) { - asection **secpp; - for (p = o->link_order_head; p != (struct bfd_link_order *) NULL; p = p->next) @@ -5085,7 +5068,8 @@ _bfd_mips_elf_final_link (abfd, info) /* Set up the first entry. */ c = 1; - tab = (Elf32_gptab *) bfd_malloc (c * sizeof (Elf32_gptab)); + amt = c * sizeof (Elf32_gptab); + tab = (Elf32_gptab *) bfd_malloc (amt); if (tab == NULL) return false; tab[0].gt_header.gt_current_g_value = elf_gp_size (abfd); @@ -5130,7 +5114,8 @@ _bfd_mips_elf_final_link (abfd, info) if (! (bfd_get_section_contents (input_bfd, input_section, (PTR) &ext_gptab, - gpentry, sizeof (Elf32_External_gptab)))) + (file_ptr) gpentry, + (bfd_size_type) sizeof (Elf32_External_gptab)))) { free (tab); return false; @@ -5157,9 +5142,8 @@ _bfd_mips_elf_final_link (abfd, info) unsigned int max; /* We need a new table entry. */ - new_tab = ((Elf32_gptab *) - bfd_realloc ((PTR) tab, - (c + 1) * sizeof (Elf32_gptab))); + amt = (bfd_size_type) (c + 1) * sizeof (Elf32_gptab); + new_tab = (Elf32_gptab *) bfd_realloc ((PTR) tab, amt); if (new_tab == NULL) { free (tab); @@ -5201,16 +5185,16 @@ _bfd_mips_elf_final_link (abfd, info) qsort (tab + 1, c - 1, sizeof (tab[0]), gptab_compare); /* Swap out the table. */ - ext_tab = ((Elf32_External_gptab *) - bfd_alloc (abfd, c * sizeof (Elf32_External_gptab))); + amt = (bfd_size_type) c * sizeof (Elf32_External_gptab); + ext_tab = (Elf32_External_gptab *) bfd_alloc (abfd, amt); if (ext_tab == NULL) { free (tab); return false; } - for (i = 0; i < c; i++) - bfd_mips_elf32_swap_gptab_out (abfd, tab + i, ext_tab + i); + for (j = 0; j < c; j++) + bfd_mips_elf32_swap_gptab_out (abfd, tab + j, ext_tab + j); free (tab); o->_raw_size = c * sizeof (Elf32_External_gptab); @@ -5244,7 +5228,7 @@ _bfd_mips_elf_final_link (abfd, info) bfd_mips_elf32_swap_reginfo_out (abfd, ®info, &ext); if (! bfd_set_section_contents (abfd, reginfo_sec, (PTR) &ext, - (file_ptr) 0, sizeof ext)) + (file_ptr) 0, (bfd_size_type) sizeof ext)) return false; } @@ -5518,14 +5502,15 @@ mips_elf_record_global_got_symbol (h, in && !bfd_elf32_link_record_dynamic_symbol (info, h)) return false; - /* If we've already marked this entry as need GOT space, we don't + /* If we've already marked this entry as needing GOT space, we don't need to do it again. */ - if (h->got.offset != (bfd_vma) - 1) + if (h->got.offset != (bfd_vma) -1) return true; /* By setting this to a value other than -1, we are indicating that - there needs to be a GOT entry for H. */ - h->got.offset = 0; + there needs to be a GOT entry for H. Avoid using zero, as the + generic ELF copy_indirect_symbol tests for <= 0. */ + h->got.offset = 1; return true; } @@ -5563,7 +5548,7 @@ mips_elf_sort_hash_table_f (h, data) if (h->root.dynindx == -1) return true; - if (h->root.got.offset != 0) + if (h->root.got.offset != 1) h->root.dynindx = hsd->max_non_got_dynindx++; else { @@ -5600,7 +5585,7 @@ mips_elf_sort_hash_table (info, max_loca mips_elf_sort_hash_table_f, &hsd); - /* There shoud have been enough room in the symbol table to + /* There should have been enough room in the symbol table to accomodate both the GOT and non-GOT symbols. */ BFD_ASSERT (hsd.max_non_got_dynindx <= hsd.min_got_dynindx); @@ -6158,7 +6143,9 @@ mips_elf_calculate_relocation (abfd, and check to see if they exist by looking at their addresses. */ symbol = 0; - else if (info->shared && !info->symbolic && !info->no_undefined + else if (info->shared + && (!info->symbolic || info->allow_shlib_undefined) + && !info->no_undefined && ELF_ST_VISIBILITY (h->root.other) == STV_DEFAULT) symbol = 0; else if (strcmp (h->root.root.root.string, "_DYNAMIC_LINK") == 0 || @@ -6488,8 +6475,8 @@ mips_elf_calculate_relocation (abfd, case R_MIPS_PC16: value = mips_elf_sign_extend (addend, 16) + symbol - p; - value = (bfd_vma) ((bfd_signed_vma) value / 4); overflowed_p = mips_elf_overflow_p (value, 16); + value = (bfd_vma) ((bfd_signed_vma) value / 4); break; case R_MIPS_GOT_HI16: @@ -6576,7 +6563,7 @@ mips_elf_obtain_contents (howto, relocat bfd_byte *location = contents + relocation->r_offset; /* Obtain the bytes. */ - x = bfd_get (8 * bfd_get_reloc_size (howto), input_bfd, location); + x = bfd_get (((bfd_vma)(8 * bfd_get_reloc_size (howto))), input_bfd, location); if ((ELF32_R_TYPE (relocation->r_info) == R_MIPS16_26 || ELF32_R_TYPE (relocation->r_info) == R_MIPS16_GPREL) @@ -6745,7 +6732,7 @@ mips_elf_perform_relocation (info, howto { (*_bfd_error_handler) (_("%s: %s+0x%lx: jump to stub routine which is not jal"), - bfd_get_filename (input_bfd), + bfd_archive_filename (input_bfd), input_section->name, (unsigned long) relocation->r_offset); bfd_set_error (bfd_error_bad_value); @@ -6812,7 +6799,7 @@ _bfd_mips_elf_relocate_section (output_b /* True if the relocation is a RELA relocation, rather than a REL relocation. */ boolean rela_relocation_p = true; - int r_type = ELF32_R_TYPE (rel->r_info); + unsigned int r_type = ELF32_R_TYPE (rel->r_info); const char * msg = (const char *) NULL; /* Find the relocation howto for this relocation. */ @@ -6872,7 +6859,7 @@ _bfd_mips_elf_relocate_section (output_b bfd_vma l; const Elf_Internal_Rela *lo16_relocation; reloc_howto_type *lo16_howto; - int lo; + unsigned int lo; /* The combined value is the sum of the HI16 addend, left-shifted by sixteen bits, and the LO16 @@ -6995,7 +6982,11 @@ _bfd_mips_elf_relocate_section (output_b bfd_vma high_bits; if (addend & ((bfd_vma) 1 << 31)) +#ifdef BFD64 sign_bits = ((bfd_vma) 1 << 32) - 1; +#else + sign_bits = -1; +#endif else sign_bits = 0; @@ -7117,7 +7108,11 @@ _bfd_mips_elf_relocate_section (output_b bfd_vma high_bits; if (value & ((bfd_vma) 1 << 31)) +#ifdef BFD64 sign_bits = ((bfd_vma) 1 << 32) - 1; +#else + sign_bits = -1; +#endif else sign_bits = 0; @@ -7242,7 +7237,7 @@ _bfd_mips_elf_create_dynamic_sections (a { s = bfd_make_section (abfd, ".rld_map"); if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags & ~SEC_READONLY) + || ! bfd_set_section_flags (abfd, s, flags &~ (flagword) SEC_READONLY) || ! bfd_set_section_alignment (abfd, s, MIPS_ELF_LOG_FILE_ALIGN (abfd))) return false; @@ -7405,6 +7400,7 @@ mips_elf_create_got_section (abfd, info) register asection *s; struct elf_link_hash_entry *h; struct mips_got_info *g; + bfd_size_type amt; /* This function may be called more than once. */ if (mips_elf_got_section (abfd)) @@ -7440,8 +7436,8 @@ mips_elf_create_got_section (abfd, info) /* The first several global offset table entries are reserved. */ s->_raw_size = MIPS_RESERVED_GOTNO * MIPS_ELF_GOT_SIZE (abfd); - g = (struct mips_got_info *) bfd_alloc (abfd, - sizeof (struct mips_got_info)); + amt = sizeof (struct mips_got_info); + g = (struct mips_got_info *) bfd_alloc (abfd, amt); if (g == NULL) return false; g->global_gotsym = NULL; @@ -7449,8 +7445,8 @@ mips_elf_create_got_section (abfd, info) g->assigned_gotno = MIPS_RESERVED_GOTNO; if (elf_section_data (s) == NULL) { - s->used_by_bfd = - (PTR) bfd_zalloc (abfd, sizeof (struct bfd_elf_section_data)); + amt = sizeof (struct bfd_elf_section_data); + s->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); if (elf_section_data (s) == NULL) return false; } @@ -7613,13 +7609,14 @@ _bfd_mips_elf_check_relocs (abfd, info, { unsigned long symcount; asection **n; + bfd_size_type amt; if (elf_bad_symtab (abfd)) symcount = NUM_SHDR_ENTRIES (symtab_hdr); else symcount = symtab_hdr->sh_info; - n = (asection **) bfd_zalloc (abfd, - symcount * sizeof (asection *)); + amt = symcount * sizeof (asection *); + n = (asection **) bfd_zalloc (abfd, amt); if (n == NULL) return false; elf_tdata (abfd)->local_stubs = n; @@ -7722,7 +7719,7 @@ _bfd_mips_elf_check_relocs (abfd, info, for (rel = relocs; rel < rel_end; ++rel) { unsigned long r_symndx; - int r_type; + unsigned int r_type; struct elf_link_hash_entry *h; r_symndx = ELF32_R_SYM (rel->r_info); @@ -7733,7 +7730,8 @@ _bfd_mips_elf_check_relocs (abfd, info, else if (r_symndx >= extsymoff + NUM_SHDR_ENTRIES (symtab_hdr)) { (*_bfd_error_handler) - (_("Malformed reloc detected for section %s"), name); + (_("%s: Malformed reloc detected for section %s"), + bfd_archive_filename (abfd), name); bfd_set_error (bfd_error_bad_value); return false; } @@ -7811,7 +7809,7 @@ _bfd_mips_elf_check_relocs (abfd, info, { (*_bfd_error_handler) (_("%s: CALL16 reloc at 0x%lx not against global symbol"), - bfd_get_filename (abfd), (unsigned long) rel->r_offset); + bfd_archive_filename (abfd), (unsigned long) rel->r_offset); bfd_set_error (bfd_error_bad_value); return false; } @@ -7850,12 +7848,12 @@ _bfd_mips_elf_check_relocs (abfd, info, { if (sreloc == NULL) { - const char *name = MIPS_ELF_REL_DYN_SECTION_NAME (dynobj); + const char *dname = MIPS_ELF_REL_DYN_SECTION_NAME (dynobj); - sreloc = bfd_get_section_by_name (dynobj, name); + sreloc = bfd_get_section_by_name (dynobj, dname); if (sreloc == NULL) { - sreloc = bfd_make_section (dynobj, name); + sreloc = bfd_make_section (dynobj, dname); if (sreloc == NULL || ! bfd_set_section_flags (dynobj, sreloc, (SEC_ALLOC @@ -8076,7 +8074,8 @@ _bfd_mips_elf_gc_sweep_hook (abfd, info, /* Copy data from a MIPS ELF indirect symbol to its direct symbol, hiding the old indirect symbol. Process additional relocation - information. */ + information. Also called for weakdefs, in which case we just let + _bfd_elf_link_hash_copy_indirect copy the flags for us. */ static void _bfd_mips_elf_copy_indirect_symbol (dir, ind) @@ -8086,6 +8085,9 @@ _bfd_mips_elf_copy_indirect_symbol (dir, _bfd_elf_link_hash_copy_indirect (dir, ind); + if (dir == ind->weakdef) + return; + dirmips = (struct mips_elf_link_hash_entry *) dir; indmips = (struct mips_elf_link_hash_entry *) ind; dirmips->possibly_dynamic_relocs += indmips->possibly_dynamic_relocs; @@ -8134,7 +8136,7 @@ _bfd_mips_elf_adjust_dynamic_symbol (inf if (! info->relocateable && hmips->possibly_dynamic_relocs != 0 && (h->root.type == bfd_link_hash_defweak - || (h->elf_link_hash_flags + || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)) { mips_elf_allocate_dynamic_relocations (dynobj, @@ -8221,7 +8223,8 @@ _bfd_mips_elf_always_size_sections (outp /* The .reginfo section has a fixed size. */ ri = bfd_get_section_by_name (output_bfd, ".reginfo"); if (ri != NULL) - bfd_set_section_size (output_bfd, ri, sizeof (Elf32_External_RegInfo)); + bfd_set_section_size (output_bfd, ri, + (bfd_size_type) sizeof (Elf32_External_RegInfo)); if (info->relocateable || ! mips_elf_hash_table (info)->mips16_stubs_seen) @@ -8398,7 +8401,8 @@ _bfd_mips_elf_size_dynamic_sections (out { if ((subsection->flags & SEC_ALLOC) == 0) continue; - loadable_size += (subsection->_raw_size + 0xf) & ~0xf; + loadable_size += ((subsection->_raw_size + 0xf) + &~ (bfd_size_type) 0xf); } } loadable_size += MIPS_FUNCTION_STUB_SIZE; @@ -8698,18 +8702,18 @@ _bfd_mips_elf_finish_dynamic_symbol (out /* Fill the stub. */ p = stub; - bfd_put_32 (output_bfd, STUB_LW (output_bfd), p); + bfd_put_32 (output_bfd, (bfd_vma) STUB_LW (output_bfd), p); p += 4; - bfd_put_32 (output_bfd, STUB_MOVE (output_bfd), p); + bfd_put_32 (output_bfd, (bfd_vma) STUB_MOVE (output_bfd), p); p += 4; /* FIXME: Can h->dynindex be more than 64K? */ if (h->dynindx & 0xffff0000) return false; - bfd_put_32 (output_bfd, STUB_JALR, p); + bfd_put_32 (output_bfd, (bfd_vma) STUB_JALR, p); p += 4; - bfd_put_32 (output_bfd, STUB_LI16 (output_bfd) + h->dynindx, p); + bfd_put_32 (output_bfd, (bfd_vma) STUB_LI16 (output_bfd) + h->dynindx, p); BFD_ASSERT (h->plt.offset <= s->_raw_size); memcpy (s->contents + h->plt.offset, stub, MIPS_FUNCTION_STUB_SIZE); @@ -8983,7 +8987,7 @@ _bfd_mips_elf_finish_dynamic_sections (o case DT_MIPS_BASE_ADDRESS: s = output_bfd->sections; BFD_ASSERT (s != NULL); - dyn.d_un.d_ptr = s->vma & ~(0xffff); + dyn.d_un.d_ptr = s->vma & ~(bfd_vma) 0xffff; break; case DT_MIPS_LOCAL_GOTNO: @@ -9159,7 +9163,7 @@ _bfd_elf32_mips_grok_prstatus (abfd, not Elf_Internal_Note *note; { int offset; - int raw_size; + unsigned int raw_size; switch (note->descsz) { @@ -9241,7 +9245,7 @@ elf32_mips_get_relocated_section_content if (reloc_size < 0) goto error_return; - reloc_vector = (arelent **) bfd_malloc (reloc_size); + reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size); if (reloc_vector == NULL && reloc_size != 0) goto error_return; @@ -9249,7 +9253,7 @@ elf32_mips_get_relocated_section_content if (!bfd_get_section_contents (input_bfd, input_section, (PTR) data, - 0, + (file_ptr) 0, input_section->_raw_size)) goto error_return; diff -uprN binutils-2.11.90.0.31/bfd/elf32-mips.c.weak binutils-2.11.92.0.5/bfd/elf32-mips.c.weak --- binutils-2.11.90.0.31/bfd/elf32-mips.c.weak Wed Oct 3 10:25:10 2001 +++ binutils-2.11.92.0.5/bfd/elf32-mips.c.weak Wed Dec 31 16:00:00 1969 @@ -1,9541 +0,0 @@ -/* MIPS-specific support for 32-bit ELF - Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 - Free Software Foundation, Inc. - - Most of the information added by Ian Lance Taylor, Cygnus Support, - . - N32/64 ABI support added by Mark Mitchell, CodeSourcery, LLC. - - Traditional MIPS targets support added by Koundinya.K, Dansk Data - Elektronik & Operations Research Group. - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -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. */ - -/* This file handles MIPS ELF targets. SGI Irix 5 uses a slightly - different MIPS ELF from other targets. This matters when linking. - This file supports both, switching at runtime. */ - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" -#include "bfdlink.h" -#include "genlink.h" -#include "elf-bfd.h" -#include "elf/mips.h" - -/* Get the ECOFF swapping routines. */ -#include "coff/sym.h" -#include "coff/symconst.h" -#include "coff/internal.h" -#include "coff/ecoff.h" -#include "coff/mips.h" -#define ECOFF_SIGNED_32 -#include "ecoffswap.h" - -/* This structure is used to hold .got information when linking. It - is stored in the tdata field of the bfd_elf_section_data structure. */ - -struct mips_got_info -{ - /* The global symbol in the GOT with the lowest index in the dynamic - symbol table. */ - struct elf_link_hash_entry *global_gotsym; - /* The number of global .got entries. */ - unsigned int global_gotno; - /* The number of local .got entries. */ - unsigned int local_gotno; - /* The number of local .got entries we have used. */ - unsigned int assigned_gotno; -}; - -/* The MIPS ELF linker needs additional information for each symbol in - the global hash table. */ - -struct mips_elf_link_hash_entry -{ - struct elf_link_hash_entry root; - - /* External symbol information. */ - EXTR esym; - - /* Number of R_MIPS_32, R_MIPS_REL32, or R_MIPS_64 relocs against - this symbol. */ - unsigned int possibly_dynamic_relocs; - - /* If the R_MIPS_32, R_MIPS_REL32, or R_MIPS_64 reloc is against - a readonly section. */ - boolean readonly_reloc; - - /* The index of the first dynamic relocation (in the .rel.dyn - section) against this symbol. */ - unsigned int min_dyn_reloc_index; - - /* We must not create a stub for a symbol that has relocations - related to taking the function's address, i.e. any but - R_MIPS_CALL*16 ones -- see "MIPS ABI Supplement, 3rd Edition", - p. 4-20. */ - boolean no_fn_stub; - - /* If there is a stub that 32 bit functions should use to call this - 16 bit function, this points to the section containing the stub. */ - asection *fn_stub; - - /* Whether we need the fn_stub; this is set if this symbol appears - in any relocs other than a 16 bit call. */ - boolean need_fn_stub; - - /* If there is a stub that 16 bit functions should use to call this - 32 bit function, this points to the section containing the stub. */ - asection *call_stub; - - /* This is like the call_stub field, but it is used if the function - being called returns a floating point value. */ - asection *call_fp_stub; -}; - -static bfd_reloc_status_type mips32_64bit_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup - PARAMS ((bfd *, bfd_reloc_code_real_type)); -static reloc_howto_type *mips_rtype_to_howto - PARAMS ((unsigned int)); -static void mips_info_to_howto_rel - PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *)); -static void mips_info_to_howto_rela - PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *)); -static void bfd_mips_elf32_swap_gptab_in - PARAMS ((bfd *, const Elf32_External_gptab *, Elf32_gptab *)); -static void bfd_mips_elf32_swap_gptab_out - PARAMS ((bfd *, const Elf32_gptab *, Elf32_External_gptab *)); -#if 0 -static void bfd_mips_elf_swap_msym_in - PARAMS ((bfd *, const Elf32_External_Msym *, Elf32_Internal_Msym *)); -#endif -static void bfd_mips_elf_swap_msym_out - PARAMS ((bfd *, const Elf32_Internal_Msym *, Elf32_External_Msym *)); -static boolean mips_elf_sym_is_global PARAMS ((bfd *, asymbol *)); -static boolean mips_elf_create_procedure_table - PARAMS ((PTR, bfd *, struct bfd_link_info *, asection *, - struct ecoff_debug_info *)); -static INLINE int elf_mips_isa PARAMS ((flagword)); -static INLINE int elf_mips_mach PARAMS ((flagword)); -static INLINE char* elf_mips_abi_name PARAMS ((bfd *)); -static boolean mips_elf_is_local_label_name - PARAMS ((bfd *, const char *)); -static struct bfd_hash_entry *mips_elf_link_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); -static int gptab_compare PARAMS ((const void *, const void *)); -static bfd_reloc_status_type mips16_jump_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static bfd_reloc_status_type mips16_gprel_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static boolean mips_elf_create_compact_rel_section - PARAMS ((bfd *, struct bfd_link_info *)); -static boolean mips_elf_create_got_section - PARAMS ((bfd *, struct bfd_link_info *)); -static bfd_reloc_status_type mips_elf_final_gp - PARAMS ((bfd *, asymbol *, boolean, char **, bfd_vma *)); -static bfd_byte *elf32_mips_get_relocated_section_contents - PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, - bfd_byte *, boolean, asymbol **)); -static asection *mips_elf_create_msym_section - PARAMS ((bfd *)); -static void mips_elf_irix6_finish_dynamic_symbol - PARAMS ((bfd *, const char *, Elf_Internal_Sym *)); -static bfd_vma mips_elf_sign_extend PARAMS ((bfd_vma, int)); -static boolean mips_elf_overflow_p PARAMS ((bfd_vma, int)); -static bfd_vma mips_elf_high PARAMS ((bfd_vma)); -static bfd_vma mips_elf_higher PARAMS ((bfd_vma)); -static bfd_vma mips_elf_highest PARAMS ((bfd_vma)); -static bfd_vma mips_elf_global_got_index - PARAMS ((bfd *, struct elf_link_hash_entry *)); -static bfd_vma mips_elf_local_got_index - PARAMS ((bfd *, struct bfd_link_info *, bfd_vma)); -static bfd_vma mips_elf_got_offset_from_index - PARAMS ((bfd *, bfd *, bfd_vma)); -static boolean mips_elf_record_global_got_symbol - PARAMS ((struct elf_link_hash_entry *, struct bfd_link_info *, - struct mips_got_info *)); -static bfd_vma mips_elf_got_page - PARAMS ((bfd *, struct bfd_link_info *, bfd_vma, bfd_vma *)); -static const Elf_Internal_Rela *mips_elf_next_relocation - PARAMS ((unsigned int, const Elf_Internal_Rela *, - const Elf_Internal_Rela *)); -static bfd_reloc_status_type mips_elf_calculate_relocation - PARAMS ((bfd *, bfd *, asection *, struct bfd_link_info *, - const Elf_Internal_Rela *, bfd_vma, reloc_howto_type *, - Elf_Internal_Sym *, asection **, bfd_vma *, const char **, - boolean *)); -static bfd_vma mips_elf_obtain_contents - PARAMS ((reloc_howto_type *, const Elf_Internal_Rela *, bfd *, bfd_byte *)); -static boolean mips_elf_perform_relocation - PARAMS ((struct bfd_link_info *, reloc_howto_type *, - const Elf_Internal_Rela *, bfd_vma, - bfd *, asection *, bfd_byte *, boolean)); -static boolean mips_elf_assign_gp PARAMS ((bfd *, bfd_vma *)); -static boolean mips_elf_sort_hash_table_f - PARAMS ((struct mips_elf_link_hash_entry *, PTR)); -static boolean mips_elf_sort_hash_table - PARAMS ((struct bfd_link_info *, unsigned long)); -static asection * mips_elf_got_section PARAMS ((bfd *)); -static struct mips_got_info *mips_elf_got_info - PARAMS ((bfd *, asection **)); -static boolean mips_elf_local_relocation_p - PARAMS ((bfd *, const Elf_Internal_Rela *, asection **, boolean)); -static bfd_vma mips_elf_create_local_got_entry - PARAMS ((bfd *, struct mips_got_info *, asection *, bfd_vma)); -static bfd_vma mips_elf_got16_entry - PARAMS ((bfd *, struct bfd_link_info *, bfd_vma, boolean)); -static boolean mips_elf_create_dynamic_relocation - PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Rela *, - struct mips_elf_link_hash_entry *, asection *, - bfd_vma, bfd_vma *, asection *)); -static void mips_elf_allocate_dynamic_relocations - PARAMS ((bfd *, unsigned int)); -static boolean mips_elf_stub_section_p - PARAMS ((bfd *, asection *)); -static int sort_dynamic_relocs - PARAMS ((const void *, const void *)); -static void _bfd_mips_elf_hide_symbol - PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); -static void _bfd_mips_elf_copy_indirect_symbol - PARAMS ((struct elf_link_hash_entry *, - struct elf_link_hash_entry *)); -static boolean _bfd_elf32_mips_grok_prstatus - PARAMS ((bfd *, Elf_Internal_Note *)); -static boolean _bfd_elf32_mips_grok_psinfo - PARAMS ((bfd *, Elf_Internal_Note *)); - -extern const bfd_target bfd_elf32_tradbigmips_vec; -extern const bfd_target bfd_elf32_tradlittlemips_vec; -#ifdef BFD64 -extern const bfd_target bfd_elf64_tradbigmips_vec; -extern const bfd_target bfd_elf64_tradlittlemips_vec; -#endif - -/* The level of IRIX compatibility we're striving for. */ - -typedef enum { - ict_none, - ict_irix5, - ict_irix6 -} irix_compat_t; - -/* This will be used when we sort the dynamic relocation records. */ -static bfd *reldyn_sorting_bfd; - -/* Nonzero if ABFD is using the N32 ABI. */ - -#define ABI_N32_P(abfd) \ - ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI2) != 0) - -/* Nonzero if ABFD is using the 64-bit ABI. */ -#define ABI_64_P(abfd) \ - ((elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS64) != 0) - -/* Depending on the target vector we generate some version of Irix - executables or "normal" MIPS ELF ABI executables. */ -#ifdef BFD64 -#define IRIX_COMPAT(abfd) \ - (((abfd->xvec == &bfd_elf64_tradbigmips_vec) || \ - (abfd->xvec == &bfd_elf64_tradlittlemips_vec) || \ - (abfd->xvec == &bfd_elf32_tradbigmips_vec) || \ - (abfd->xvec == &bfd_elf32_tradlittlemips_vec)) ? ict_none : \ - ((ABI_N32_P (abfd) || ABI_64_P (abfd)) ? ict_irix6 : ict_irix5)) -#else -#define IRIX_COMPAT(abfd) \ - (((abfd->xvec == &bfd_elf32_tradbigmips_vec) || \ - (abfd->xvec == &bfd_elf32_tradlittlemips_vec)) ? ict_none : \ - ((ABI_N32_P (abfd) || ABI_64_P (abfd)) ? ict_irix6 : ict_irix5)) -#endif - -/* Whether we are trying to be compatible with IRIX at all. */ -#define SGI_COMPAT(abfd) \ - (IRIX_COMPAT (abfd) != ict_none) - -/* The name of the msym section. */ -#define MIPS_ELF_MSYM_SECTION_NAME(abfd) ".msym" - -/* The name of the srdata section. */ -#define MIPS_ELF_SRDATA_SECTION_NAME(abfd) ".srdata" - -/* The name of the options section. */ -#define MIPS_ELF_OPTIONS_SECTION_NAME(abfd) \ - (IRIX_COMPAT (abfd) == ict_irix6 ? ".MIPS.options" : ".options") - -/* The name of the stub section. */ -#define MIPS_ELF_STUB_SECTION_NAME(abfd) \ - (IRIX_COMPAT (abfd) == ict_irix6 ? ".MIPS.stubs" : ".stub") - -/* The name of the dynamic relocation section. */ -#define MIPS_ELF_REL_DYN_SECTION_NAME(abfd) ".rel.dyn" - -/* The size of an external REL relocation. */ -#define MIPS_ELF_REL_SIZE(abfd) \ - (get_elf_backend_data (abfd)->s->sizeof_rel) - -/* The size of an external dynamic table entry. */ -#define MIPS_ELF_DYN_SIZE(abfd) \ - (get_elf_backend_data (abfd)->s->sizeof_dyn) - -/* The size of a GOT entry. */ -#define MIPS_ELF_GOT_SIZE(abfd) \ - (get_elf_backend_data (abfd)->s->arch_size / 8) - -/* The size of a symbol-table entry. */ -#define MIPS_ELF_SYM_SIZE(abfd) \ - (get_elf_backend_data (abfd)->s->sizeof_sym) - -/* The default alignment for sections, as a power of two. */ -#define MIPS_ELF_LOG_FILE_ALIGN(abfd) \ - (get_elf_backend_data (abfd)->s->file_align == 8 ? 3 : 2) - -/* Get word-sized data. */ -#define MIPS_ELF_GET_WORD(abfd, ptr) \ - (ABI_64_P (abfd) ? bfd_get_64 (abfd, ptr) : bfd_get_32 (abfd, ptr)) - -/* Put out word-sized data. */ -#define MIPS_ELF_PUT_WORD(abfd, val, ptr) \ - (ABI_64_P (abfd) \ - ? bfd_put_64 (abfd, val, ptr) \ - : bfd_put_32 (abfd, val, ptr)) - -/* Add a dynamic symbol table-entry. */ -#ifdef BFD64 -#define MIPS_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \ - (ABI_64_P (elf_hash_table (info)->dynobj) \ - ? bfd_elf64_add_dynamic_entry (info, tag, val) \ - : bfd_elf32_add_dynamic_entry (info, tag, val)) -#else -#define MIPS_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \ - (ABI_64_P (elf_hash_table (info)->dynobj) \ - ? (abort (), false) \ - : bfd_elf32_add_dynamic_entry (info, tag, val)) -#endif - -/* The number of local .got entries we reserve. */ -#define MIPS_RESERVED_GOTNO (2) - -/* Instructions which appear in a stub. For some reason the stub is - slightly different on an SGI system. */ -#define ELF_MIPS_GP_OFFSET(abfd) (SGI_COMPAT (abfd) ? 0x7ff0 : 0x8000) -#define STUB_LW(abfd) \ - (SGI_COMPAT (abfd) \ - ? (ABI_64_P (abfd) \ - ? 0xdf998010 /* ld t9,0x8010(gp) */ \ - : 0x8f998010) /* lw t9,0x8010(gp) */ \ - : 0x8f998010) /* lw t9,0x8000(gp) */ -#define STUB_MOVE(abfd) \ - (SGI_COMPAT (abfd) ? 0x03e07825 : 0x03e07821) /* move t7,ra */ -#define STUB_JALR 0x0320f809 /* jal t9 */ -#define STUB_LI16(abfd) \ - (SGI_COMPAT (abfd) ? 0x34180000 : 0x24180000) /* ori t8,zero,0 */ -#define MIPS_FUNCTION_STUB_SIZE (16) - -#if 0 -/* We no longer try to identify particular sections for the .dynsym - section. When we do, we wind up crashing if there are other random - sections with relocations. */ - -/* Names of sections which appear in the .dynsym section in an Irix 5 - executable. */ - -static const char * const mips_elf_dynsym_sec_names[] = -{ - ".text", - ".init", - ".fini", - ".data", - ".rodata", - ".sdata", - ".sbss", - ".bss", - NULL -}; - -#define SIZEOF_MIPS_DYNSYM_SECNAMES \ - (sizeof mips_elf_dynsym_sec_names / sizeof mips_elf_dynsym_sec_names[0]) - -/* The number of entries in mips_elf_dynsym_sec_names which go in the - text segment. */ - -#define MIPS_TEXT_DYNSYM_SECNO (3) - -#endif /* 0 */ - -/* The names of the runtime procedure table symbols used on Irix 5. */ - -static const char * const mips_elf_dynsym_rtproc_names[] = -{ - "_procedure_table", - "_procedure_string_table", - "_procedure_table_size", - NULL -}; - -/* These structures are used to generate the .compact_rel section on - Irix 5. */ - -typedef struct -{ - unsigned long id1; /* Always one? */ - unsigned long num; /* Number of compact relocation entries. */ - unsigned long id2; /* Always two? */ - unsigned long offset; /* The file offset of the first relocation. */ - unsigned long reserved0; /* Zero? */ - unsigned long reserved1; /* Zero? */ -} Elf32_compact_rel; - -typedef struct -{ - bfd_byte id1[4]; - bfd_byte num[4]; - bfd_byte id2[4]; - bfd_byte offset[4]; - bfd_byte reserved0[4]; - bfd_byte reserved1[4]; -} Elf32_External_compact_rel; - -typedef struct -{ - unsigned int ctype : 1; /* 1: long 0: short format. See below. */ - unsigned int rtype : 4; /* Relocation types. See below. */ - unsigned int dist2to : 8; - unsigned int relvaddr : 19; /* (VADDR - vaddr of the previous entry)/ 4 */ - unsigned long konst; /* KONST field. See below. */ - unsigned long vaddr; /* VADDR to be relocated. */ -} Elf32_crinfo; - -typedef struct -{ - unsigned int ctype : 1; /* 1: long 0: short format. See below. */ - unsigned int rtype : 4; /* Relocation types. See below. */ - unsigned int dist2to : 8; - unsigned int relvaddr : 19; /* (VADDR - vaddr of the previous entry)/ 4 */ - unsigned long konst; /* KONST field. See below. */ -} Elf32_crinfo2; - -typedef struct -{ - bfd_byte info[4]; - bfd_byte konst[4]; - bfd_byte vaddr[4]; -} Elf32_External_crinfo; - -typedef struct -{ - bfd_byte info[4]; - bfd_byte konst[4]; -} Elf32_External_crinfo2; - -/* These are the constants used to swap the bitfields in a crinfo. */ - -#define CRINFO_CTYPE (0x1) -#define CRINFO_CTYPE_SH (31) -#define CRINFO_RTYPE (0xf) -#define CRINFO_RTYPE_SH (27) -#define CRINFO_DIST2TO (0xff) -#define CRINFO_DIST2TO_SH (19) -#define CRINFO_RELVADDR (0x7ffff) -#define CRINFO_RELVADDR_SH (0) - -/* A compact relocation info has long (3 words) or short (2 words) - formats. A short format doesn't have VADDR field and relvaddr - fields contains ((VADDR - vaddr of the previous entry) >> 2). */ -#define CRF_MIPS_LONG 1 -#define CRF_MIPS_SHORT 0 - -/* There are 4 types of compact relocation at least. The value KONST - has different meaning for each type: - - (type) (konst) - CT_MIPS_REL32 Address in data - CT_MIPS_WORD Address in word (XXX) - CT_MIPS_GPHI_LO GP - vaddr - CT_MIPS_JMPAD Address to jump - */ - -#define CRT_MIPS_REL32 0xa -#define CRT_MIPS_WORD 0xb -#define CRT_MIPS_GPHI_LO 0xc -#define CRT_MIPS_JMPAD 0xd - -#define mips_elf_set_cr_format(x,format) ((x).ctype = (format)) -#define mips_elf_set_cr_type(x,type) ((x).rtype = (type)) -#define mips_elf_set_cr_dist2to(x,v) ((x).dist2to = (v)) -#define mips_elf_set_cr_relvaddr(x,d) ((x).relvaddr = (d)<<2) - -static void bfd_elf32_swap_compact_rel_out - PARAMS ((bfd *, const Elf32_compact_rel *, Elf32_External_compact_rel *)); -static void bfd_elf32_swap_crinfo_out - PARAMS ((bfd *, const Elf32_crinfo *, Elf32_External_crinfo *)); - -#define USE_REL 1 /* MIPS uses REL relocations instead of RELA */ - -/* In case we're on a 32-bit machine, construct a 64-bit "-1" value - from smaller values. Start with zero, widen, *then* decrement. */ -#define MINUS_ONE (((bfd_vma)0) - 1) - -static reloc_howto_type elf_mips_howto_table[] = -{ - /* No relocation. */ - HOWTO (R_MIPS_NONE, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_NONE", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* 16 bit relocation. */ - HOWTO (R_MIPS_16, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 32 bit relocation. */ - HOWTO (R_MIPS_32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_32", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 32 bit symbol relative relocation. */ - HOWTO (R_MIPS_REL32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_REL32", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 26 bit jump address. */ - HOWTO (R_MIPS_26, /* type */ - 2, /* 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_MIPS_26", /* name */ - true, /* partial_inplace */ - 0x3ffffff, /* src_mask */ - 0x3ffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* High 16 bits of symbol value. */ - HOWTO (R_MIPS_HI16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - _bfd_mips_elf_hi16_reloc, /* special_function */ - "R_MIPS_HI16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Low 16 bits of symbol value. */ - HOWTO (R_MIPS_LO16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - _bfd_mips_elf_lo16_reloc, /* special_function */ - "R_MIPS_LO16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* GP relative reference. */ - HOWTO (R_MIPS_GPREL16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - _bfd_mips_elf_gprel16_reloc, /* special_function */ - "R_MIPS_GPREL16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Reference to literal section. */ - HOWTO (R_MIPS_LITERAL, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - _bfd_mips_elf_gprel16_reloc, /* special_function */ - "R_MIPS_LITERAL", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Reference to global offset table. */ - HOWTO (R_MIPS_GOT16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - _bfd_mips_elf_got16_reloc, /* special_function */ - "R_MIPS_GOT16", /* name */ - false, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 16 bit PC relative reference. */ - HOWTO (R_MIPS_PC16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_PC16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - true), /* pcrel_offset */ - - /* 16 bit call through global offset table. */ - HOWTO (R_MIPS_CALL16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_CALL16", /* name */ - false, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 32 bit GP relative reference. */ - HOWTO (R_MIPS_GPREL32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - _bfd_mips_elf_gprel32_reloc, /* special_function */ - "R_MIPS_GPREL32", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* The remaining relocs are defined on Irix 5, although they are - not defined by the ABI. */ - EMPTY_HOWTO (13), - EMPTY_HOWTO (14), - EMPTY_HOWTO (15), - - /* A 5 bit shift field. */ - HOWTO (R_MIPS_SHIFT5, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 5, /* bitsize */ - false, /* pc_relative */ - 6, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_SHIFT5", /* name */ - true, /* partial_inplace */ - 0x000007c0, /* src_mask */ - 0x000007c0, /* dst_mask */ - false), /* pcrel_offset */ - - /* A 6 bit shift field. */ - /* FIXME: This is not handled correctly; a special function is - needed to put the most significant bit in the right place. */ - HOWTO (R_MIPS_SHIFT6, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 6, /* bitsize */ - false, /* pc_relative */ - 6, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_SHIFT6", /* name */ - true, /* partial_inplace */ - 0x000007c4, /* src_mask */ - 0x000007c4, /* dst_mask */ - false), /* pcrel_offset */ - - /* A 64 bit relocation. */ - HOWTO (R_MIPS_64, /* type */ - 0, /* rightshift */ - 4, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - mips32_64bit_reloc, /* special_function */ - "R_MIPS_64", /* name */ - true, /* partial_inplace */ - MINUS_ONE, /* src_mask */ - MINUS_ONE, /* dst_mask */ - false), /* pcrel_offset */ - - /* Displacement in the global offset table. */ - HOWTO (R_MIPS_GOT_DISP, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_DISP", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Displacement to page pointer in the global offset table. */ - HOWTO (R_MIPS_GOT_PAGE, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_PAGE", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Offset from page pointer in the global offset table. */ - HOWTO (R_MIPS_GOT_OFST, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_OFST", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* High 16 bits of displacement in global offset table. */ - HOWTO (R_MIPS_GOT_HI16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_HI16", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Low 16 bits of displacement in global offset table. */ - HOWTO (R_MIPS_GOT_LO16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_LO16", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 64 bit subtraction. Used in the N32 ABI. */ - HOWTO (R_MIPS_SUB, /* type */ - 0, /* rightshift */ - 4, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_SUB", /* name */ - true, /* partial_inplace */ - MINUS_ONE, /* src_mask */ - MINUS_ONE, /* dst_mask */ - false), /* pcrel_offset */ - - /* Used to cause the linker to insert and delete instructions? */ - EMPTY_HOWTO (R_MIPS_INSERT_A), - EMPTY_HOWTO (R_MIPS_INSERT_B), - EMPTY_HOWTO (R_MIPS_DELETE), - - /* Get the higher value of a 64 bit addend. */ - HOWTO (R_MIPS_HIGHER, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_HIGHER", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Get the highest value of a 64 bit addend. */ - HOWTO (R_MIPS_HIGHEST, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_HIGHEST", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* High 16 bits of displacement in global offset table. */ - HOWTO (R_MIPS_CALL_HI16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_CALL_HI16", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Low 16 bits of displacement in global offset table. */ - HOWTO (R_MIPS_CALL_LO16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_CALL_LO16", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Section displacement. */ - HOWTO (R_MIPS_SCN_DISP, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_SCN_DISP", /* name */ - false, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - EMPTY_HOWTO (R_MIPS_REL16), - EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE), - EMPTY_HOWTO (R_MIPS_PJUMP), - EMPTY_HOWTO (R_MIPS_RELGOT), - - /* Protected jump conversion. This is an optimization hint. No - relocation is required for correctness. */ - HOWTO (R_MIPS_JALR, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_JALR", /* name */ - false, /* partial_inplace */ - 0x00000000, /* src_mask */ - 0x00000000, /* dst_mask */ - false), /* pcrel_offset */ -}; - -/* The reloc used for BFD_RELOC_CTOR when doing a 64 bit link. This - is a hack to make the linker think that we need 64 bit values. */ -static reloc_howto_type elf_mips_ctor64_howto = - HOWTO (R_MIPS_64, /* type */ - 0, /* rightshift */ - 4, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - mips32_64bit_reloc, /* special_function */ - "R_MIPS_64", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false); /* pcrel_offset */ - -/* The reloc used for the mips16 jump instruction. */ -static reloc_howto_type elf_mips16_jump_howto = - HOWTO (R_MIPS16_26, /* type */ - 2, /* 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. */ - mips16_jump_reloc, /* special_function */ - "R_MIPS16_26", /* name */ - true, /* partial_inplace */ - 0x3ffffff, /* src_mask */ - 0x3ffffff, /* dst_mask */ - false); /* pcrel_offset */ - -/* The reloc used for the mips16 gprel instruction. */ -static reloc_howto_type elf_mips16_gprel_howto = - HOWTO (R_MIPS16_GPREL, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - mips16_gprel_reloc, /* special_function */ - "R_MIPS16_GPREL", /* name */ - true, /* partial_inplace */ - 0x07ff001f, /* src_mask */ - 0x07ff001f, /* dst_mask */ - false); /* pcrel_offset */ - -/* GNU extensions for embedded-pic. */ -/* High 16 bits of symbol value, pc-relative. */ -static reloc_howto_type elf_mips_gnu_rel_hi16 = - HOWTO (R_MIPS_GNU_REL_HI16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - _bfd_mips_elf_hi16_reloc, /* special_function */ - "R_MIPS_GNU_REL_HI16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - true); /* pcrel_offset */ - -/* Low 16 bits of symbol value, pc-relative. */ -static reloc_howto_type elf_mips_gnu_rel_lo16 = - HOWTO (R_MIPS_GNU_REL_LO16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - _bfd_mips_elf_lo16_reloc, /* special_function */ - "R_MIPS_GNU_REL_LO16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - true); /* pcrel_offset */ - -/* 16 bit offset for pc-relative branches. */ -static reloc_howto_type elf_mips_gnu_rel16_s2 = - HOWTO (R_MIPS_GNU_REL16_S2, /* type */ - 2, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GNU_REL16_S2", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - true); /* pcrel_offset */ - -/* 64 bit pc-relative. */ -static reloc_howto_type elf_mips_gnu_pcrel64 = - HOWTO (R_MIPS_PC64, /* type */ - 0, /* rightshift */ - 4, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_PC64", /* name */ - true, /* partial_inplace */ - MINUS_ONE, /* src_mask */ - MINUS_ONE, /* dst_mask */ - true); /* pcrel_offset */ - -/* 32 bit pc-relative. */ -static reloc_howto_type elf_mips_gnu_pcrel32 = - HOWTO (R_MIPS_PC32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_PC32", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - true); /* pcrel_offset */ - -/* GNU extension to record C++ vtable hierarchy */ -static reloc_howto_type elf_mips_gnu_vtinherit_howto = - HOWTO (R_MIPS_GNU_VTINHERIT, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - NULL, /* special_function */ - "R_MIPS_GNU_VTINHERIT", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false); /* pcrel_offset */ - -/* GNU extension to record C++ vtable member usage */ -static reloc_howto_type elf_mips_gnu_vtentry_howto = - HOWTO (R_MIPS_GNU_VTENTRY, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - _bfd_elf_rel_vtable_reloc_fn, /* special_function */ - "R_MIPS_GNU_VTENTRY", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false); /* pcrel_offset */ - -/* Do a R_MIPS_HI16 relocation. This has to be done in combination - with a R_MIPS_LO16 reloc, because there is a carry from the LO16 to - the HI16. Here we just save the information we need; we do the - actual relocation when we see the LO16. MIPS ELF requires that the - LO16 immediately follow the HI16. As a GNU extension, we permit an - arbitrary number of HI16 relocs to be associated with a single LO16 - reloc. This extension permits gcc to output the HI and LO relocs - itself. */ - -struct mips_hi16 -{ - struct mips_hi16 *next; - bfd_byte *addr; - bfd_vma addend; -}; - -/* FIXME: This should not be a static variable. */ - -static struct mips_hi16 *mips_hi16_list; - -bfd_reloc_status_type -_bfd_mips_elf_hi16_reloc (abfd, - reloc_entry, - symbol, - data, - input_section, - output_bfd, - error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; -{ - bfd_reloc_status_type ret; - bfd_vma relocation; - struct mips_hi16 *n; - - /* If we're relocating, and this an external symbol, we don't want - to change anything. */ - if (output_bfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && reloc_entry->addend == 0) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - ret = bfd_reloc_ok; - - if (strcmp (bfd_asymbol_name (symbol), "_gp_disp") == 0) - { - boolean relocateable; - bfd_vma gp; - - if (ret == bfd_reloc_undefined) - abort (); - - if (output_bfd != NULL) - relocateable = true; - else - { - relocateable = false; - output_bfd = symbol->section->output_section->owner; - } - - ret = mips_elf_final_gp (output_bfd, symbol, relocateable, - error_message, &gp); - if (ret != bfd_reloc_ok) - return ret; - - relocation = gp - reloc_entry->address; - } - else - { - if (bfd_is_und_section (symbol->section) - && output_bfd == (bfd *) NULL) - ret = bfd_reloc_undefined; - - if (bfd_is_com_section (symbol->section)) - relocation = 0; - else - relocation = symbol->value; - } - - relocation += symbol->section->output_section->vma; - relocation += symbol->section->output_offset; - relocation += reloc_entry->addend; - - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; - - /* Save the information, and let LO16 do the actual relocation. */ - n = (struct mips_hi16 *) bfd_malloc (sizeof *n); - if (n == NULL) - return bfd_reloc_outofrange; - n->addr = (bfd_byte *) data + reloc_entry->address; - n->addend = relocation; - n->next = mips_hi16_list; - mips_hi16_list = n; - - if (output_bfd != (bfd *) NULL) - reloc_entry->address += input_section->output_offset; - - return ret; -} - -/* Do a R_MIPS_LO16 relocation. This is a straightforward 16 bit - inplace relocation; this function exists in order to do the - R_MIPS_HI16 relocation described above. */ - -bfd_reloc_status_type -_bfd_mips_elf_lo16_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; -{ - arelent gp_disp_relent; - - if (mips_hi16_list != NULL) - { - struct mips_hi16 *l; - - l = mips_hi16_list; - while (l != NULL) - { - unsigned long insn; - unsigned long val; - unsigned long vallo; - struct mips_hi16 *next; - - /* Do the HI16 relocation. Note that we actually don't need - to know anything about the LO16 itself, except where to - find the low 16 bits of the addend needed by the LO16. */ - insn = bfd_get_32 (abfd, l->addr); - vallo = (bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address) - & 0xffff); - val = ((insn & 0xffff) << 16) + vallo; - val += l->addend; - - /* The low order 16 bits are always treated as a signed - value. Therefore, a negative value in the low order bits - requires an adjustment in the high order bits. We need - to make this adjustment in two ways: once for the bits we - took from the data, and once for the bits we are putting - back in to the data. */ - if ((vallo & 0x8000) != 0) - val -= 0x10000; - if ((val & 0x8000) != 0) - val += 0x10000; - - insn = (insn & ~0xffff) | ((val >> 16) & 0xffff); - bfd_put_32 (abfd, insn, l->addr); - - if (strcmp (bfd_asymbol_name (symbol), "_gp_disp") == 0) - { - gp_disp_relent = *reloc_entry; - reloc_entry = &gp_disp_relent; - reloc_entry->addend = l->addend; - } - - next = l->next; - free (l); - l = next; - } - - mips_hi16_list = NULL; - } - else if (strcmp (bfd_asymbol_name (symbol), "_gp_disp") == 0) - { - bfd_reloc_status_type ret; - bfd_vma gp, relocation; - - /* FIXME: Does this case ever occur? */ - - ret = mips_elf_final_gp (output_bfd, symbol, true, error_message, &gp); - if (ret != bfd_reloc_ok) - return ret; - - relocation = gp - reloc_entry->address; - relocation += symbol->section->output_section->vma; - relocation += symbol->section->output_offset; - relocation += reloc_entry->addend; - - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; - - gp_disp_relent = *reloc_entry; - reloc_entry = &gp_disp_relent; - reloc_entry->addend = relocation - 4; - } - - /* Now do the LO16 reloc in the usual way. */ - return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, - input_section, output_bfd, error_message); -} - -/* Do a R_MIPS_GOT16 reloc. This is a reloc against the global offset - table used for PIC code. If the symbol is an external symbol, the - instruction is modified to contain the offset of the appropriate - entry in the global offset table. If the symbol is a section - symbol, the next reloc is a R_MIPS_LO16 reloc. The two 16 bit - addends are combined to form the real addend against the section - symbol; the GOT16 is modified to contain the offset of an entry in - the global offset table, and the LO16 is modified to offset it - appropriately. Thus an offset larger than 16 bits requires a - modified value in the global offset table. - - This implementation suffices for the assembler, but the linker does - not yet know how to create global offset tables. */ - -bfd_reloc_status_type -_bfd_mips_elf_got16_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; -{ - /* If we're relocating, and this an external symbol, we don't want - to change anything. */ - if (output_bfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && reloc_entry->addend == 0) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - /* If we're relocating, and this is a local symbol, we can handle it - just like HI16. */ - if (output_bfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) != 0) - return _bfd_mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, - input_section, output_bfd, error_message); - - abort (); -} - -/* Set the GP value for OUTPUT_BFD. Returns false if this is a - dangerous relocation. */ - -static boolean -mips_elf_assign_gp (output_bfd, pgp) - bfd *output_bfd; - bfd_vma *pgp; -{ - unsigned int count; - asymbol **sym; - unsigned int i; - - /* If we've already figured out what GP will be, just return it. */ - *pgp = _bfd_get_gp_value (output_bfd); - if (*pgp) - return true; - - count = bfd_get_symcount (output_bfd); - sym = bfd_get_outsymbols (output_bfd); - - /* The linker script will have created a symbol named `_gp' with the - appropriate value. */ - if (sym == (asymbol **) NULL) - i = count; - else - { - for (i = 0; i < count; i++, sym++) - { - register CONST char *name; - - name = bfd_asymbol_name (*sym); - if (*name == '_' && strcmp (name, "_gp") == 0) - { - *pgp = bfd_asymbol_value (*sym); - _bfd_set_gp_value (output_bfd, *pgp); - break; - } - } - } - - if (i >= count) - { - /* Only get the error once. */ - *pgp = 4; - _bfd_set_gp_value (output_bfd, *pgp); - return false; - } - - return true; -} - -/* We have to figure out the gp value, so that we can adjust the - symbol value correctly. We look up the symbol _gp in the output - BFD. If we can't find it, we're stuck. We cache it in the ELF - target data. We don't need to adjust the symbol value for an - external symbol if we are producing relocateable output. */ - -static bfd_reloc_status_type -mips_elf_final_gp (output_bfd, symbol, relocateable, error_message, pgp) - bfd *output_bfd; - asymbol *symbol; - boolean relocateable; - char **error_message; - bfd_vma *pgp; -{ - if (bfd_is_und_section (symbol->section) - && ! relocateable) - { - *pgp = 0; - return bfd_reloc_undefined; - } - - *pgp = _bfd_get_gp_value (output_bfd); - if (*pgp == 0 - && (! relocateable - || (symbol->flags & BSF_SECTION_SYM) != 0)) - { - if (relocateable) - { - /* Make up a value. */ - *pgp = symbol->section->output_section->vma + 0x4000; - _bfd_set_gp_value (output_bfd, *pgp); - } - else if (!mips_elf_assign_gp (output_bfd, pgp)) - { - *error_message = - (char *) _("GP relative relocation when _gp not defined"); - return bfd_reloc_dangerous; - } - } - - return bfd_reloc_ok; -} - -/* Do a R_MIPS_GPREL16 relocation. This is a 16 bit value which must - become the offset from the gp register. This function also handles - R_MIPS_LITERAL relocations, although those can be handled more - cleverly because the entries in the .lit8 and .lit4 sections can be - merged. */ - -static bfd_reloc_status_type gprel16_with_gp PARAMS ((bfd *, asymbol *, - arelent *, asection *, - boolean, PTR, bfd_vma)); - -bfd_reloc_status_type -_bfd_mips_elf_gprel16_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; -{ - boolean relocateable; - bfd_reloc_status_type ret; - bfd_vma gp; - - /* If we're relocating, and this is an external symbol with no - addend, we don't want to change anything. We will only have an - addend if this is a newly created reloc, not read from an ELF - file. */ - if (output_bfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && reloc_entry->addend == 0) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - if (output_bfd != (bfd *) NULL) - relocateable = true; - else - { - relocateable = false; - output_bfd = symbol->section->output_section->owner; - } - - ret = mips_elf_final_gp (output_bfd, symbol, relocateable, error_message, - &gp); - if (ret != bfd_reloc_ok) - return ret; - - return gprel16_with_gp (abfd, symbol, reloc_entry, input_section, - relocateable, data, gp); -} - -static bfd_reloc_status_type -gprel16_with_gp (abfd, symbol, reloc_entry, input_section, relocateable, data, - gp) - bfd *abfd; - asymbol *symbol; - arelent *reloc_entry; - asection *input_section; - boolean relocateable; - PTR data; - bfd_vma gp; -{ - bfd_vma relocation; - unsigned long insn; - unsigned long val; - - if (bfd_is_com_section (symbol->section)) - relocation = 0; - else - relocation = symbol->value; - - relocation += symbol->section->output_section->vma; - relocation += symbol->section->output_offset; - - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; - - insn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); - - /* Set val to the offset into the section or symbol. */ - if (reloc_entry->howto->src_mask == 0) - { - /* This case occurs with the 64-bit MIPS ELF ABI. */ - val = reloc_entry->addend; - } - else - { - val = ((insn & 0xffff) + reloc_entry->addend) & 0xffff; - if (val & 0x8000) - val -= 0x10000; - } - - /* Adjust val for the final section location and GP value. If we - are producing relocateable output, we don't want to do this for - an external symbol. */ - if (! relocateable - || (symbol->flags & BSF_SECTION_SYM) != 0) - val += relocation - gp; - - insn = (insn & ~0xffff) | (val & 0xffff); - bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address); - - if (relocateable) - reloc_entry->address += input_section->output_offset; - - /* Make sure it fit in 16 bits. */ - if ((long) val >= 0x8000 || (long) val < -0x8000) - return bfd_reloc_overflow; - - return bfd_reloc_ok; -} - -/* Do a R_MIPS_GPREL32 relocation. Is this 32 bit value the offset - from the gp register? XXX */ - -static bfd_reloc_status_type gprel32_with_gp PARAMS ((bfd *, asymbol *, - arelent *, asection *, - boolean, PTR, bfd_vma)); - -bfd_reloc_status_type -_bfd_mips_elf_gprel32_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; -{ - boolean relocateable; - bfd_reloc_status_type ret; - bfd_vma gp; - - /* If we're relocating, and this is an external symbol with no - addend, we don't want to change anything. We will only have an - addend if this is a newly created reloc, not read from an ELF - file. */ - if (output_bfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && reloc_entry->addend == 0) - { - *error_message = (char *) - _("32bits gp relative relocation occurs for an external symbol"); - return bfd_reloc_outofrange; - } - - if (output_bfd != (bfd *) NULL) - { - relocateable = true; - gp = _bfd_get_gp_value (output_bfd); - } - else - { - relocateable = false; - output_bfd = symbol->section->output_section->owner; - - ret = mips_elf_final_gp (output_bfd, symbol, relocateable, - error_message, &gp); - if (ret != bfd_reloc_ok) - return ret; - } - - return gprel32_with_gp (abfd, symbol, reloc_entry, input_section, - relocateable, data, gp); -} - -static bfd_reloc_status_type -gprel32_with_gp (abfd, symbol, reloc_entry, input_section, relocateable, data, - gp) - bfd *abfd; - asymbol *symbol; - arelent *reloc_entry; - asection *input_section; - boolean relocateable; - PTR data; - bfd_vma gp; -{ - bfd_vma relocation; - unsigned long val; - - if (bfd_is_com_section (symbol->section)) - relocation = 0; - else - relocation = symbol->value; - - relocation += symbol->section->output_section->vma; - relocation += symbol->section->output_offset; - - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; - - if (reloc_entry->howto->src_mask == 0) - { - /* This case arises with the 64-bit MIPS ELF ABI. */ - val = 0; - } - else - val = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); - - /* Set val to the offset into the section or symbol. */ - val += reloc_entry->addend; - - /* Adjust val for the final section location and GP value. If we - are producing relocateable output, we don't want to do this for - an external symbol. */ - if (! relocateable - || (symbol->flags & BSF_SECTION_SYM) != 0) - val += relocation - gp; - - bfd_put_32 (abfd, val, (bfd_byte *) data + reloc_entry->address); - - if (relocateable) - reloc_entry->address += input_section->output_offset; - - return bfd_reloc_ok; -} - -/* Handle a 64 bit reloc in a 32 bit MIPS ELF file. These are - generated when addresses are 64 bits. The upper 32 bits are a simple - sign extension. */ - -static bfd_reloc_status_type -mips32_64bit_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; -{ - bfd_reloc_status_type r; - arelent reloc32; - unsigned long val; - bfd_size_type addr; - - r = bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, - input_section, output_bfd, error_message); - if (r != bfd_reloc_continue) - return r; - - /* Do a normal 32 bit relocation on the lower 32 bits. */ - reloc32 = *reloc_entry; - if (bfd_big_endian (abfd)) - reloc32.address += 4; - reloc32.howto = &elf_mips_howto_table[R_MIPS_32]; - r = bfd_perform_relocation (abfd, &reloc32, data, input_section, - output_bfd, error_message); - - /* Sign extend into the upper 32 bits. */ - val = bfd_get_32 (abfd, (bfd_byte *) data + reloc32.address); - if ((val & 0x80000000) != 0) - val = 0xffffffff; - else - val = 0; - addr = reloc_entry->address; - if (bfd_little_endian (abfd)) - addr += 4; - bfd_put_32 (abfd, val, (bfd_byte *) data + addr); - - return r; -} - -/* Handle a mips16 jump. */ - -static bfd_reloc_status_type -mips16_jump_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data ATTRIBUTE_UNUSED; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; -{ - if (output_bfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && reloc_entry->addend == 0) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - /* FIXME. */ - { - static boolean warned; - - if (! warned) - (*_bfd_error_handler) - (_("Linking mips16 objects into %s format is not supported"), - bfd_get_target (input_section->output_section->owner)); - warned = true; - } - - return bfd_reloc_undefined; -} - -/* Handle a mips16 GP relative reloc. */ - -static bfd_reloc_status_type -mips16_gprel_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; -{ - boolean relocateable; - bfd_reloc_status_type ret; - bfd_vma gp; - unsigned short extend, insn; - unsigned long final; - - /* If we're relocating, and this is an external symbol with no - addend, we don't want to change anything. We will only have an - addend if this is a newly created reloc, not read from an ELF - file. */ - if (output_bfd != NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && reloc_entry->addend == 0) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - if (output_bfd != NULL) - relocateable = true; - else - { - relocateable = false; - output_bfd = symbol->section->output_section->owner; - } - - ret = mips_elf_final_gp (output_bfd, symbol, relocateable, error_message, - &gp); - if (ret != bfd_reloc_ok) - return ret; - - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; - - /* Pick up the mips16 extend instruction and the real instruction. */ - extend = bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address); - insn = bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address + 2); - - /* Stuff the current addend back as a 32 bit value, do the usual - relocation, and then clean up. */ - bfd_put_32 (abfd, - (((extend & 0x1f) << 11) - | (extend & 0x7e0) - | (insn & 0x1f)), - (bfd_byte *) data + reloc_entry->address); - - ret = gprel16_with_gp (abfd, symbol, reloc_entry, input_section, - relocateable, data, gp); - - final = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); - bfd_put_16 (abfd, - ((extend & 0xf800) - | ((final >> 11) & 0x1f) - | (final & 0x7e0)), - (bfd_byte *) data + reloc_entry->address); - bfd_put_16 (abfd, - ((insn & 0xffe0) - | (final & 0x1f)), - (bfd_byte *) data + reloc_entry->address + 2); - - return ret; -} - -/* Return the ISA for a MIPS e_flags value. */ - -static INLINE int -elf_mips_isa (flags) - flagword flags; -{ - switch (flags & EF_MIPS_ARCH) - { - case E_MIPS_ARCH_1: - return 1; - case E_MIPS_ARCH_2: - return 2; - case E_MIPS_ARCH_3: - return 3; - case E_MIPS_ARCH_4: - return 4; - case E_MIPS_ARCH_5: - return 5; - case E_MIPS_ARCH_32: - return 32; - case E_MIPS_ARCH_64: - return 64; - } - return 4; -} - -/* Return the MACH for a MIPS e_flags value. */ - -static INLINE int -elf_mips_mach (flags) - flagword flags; -{ - switch (flags & EF_MIPS_MACH) - { - case E_MIPS_MACH_3900: - return bfd_mach_mips3900; - - case E_MIPS_MACH_4010: - return bfd_mach_mips4010; - - case E_MIPS_MACH_4100: - return bfd_mach_mips4100; - - case E_MIPS_MACH_4111: - return bfd_mach_mips4111; - - case E_MIPS_MACH_4650: - return bfd_mach_mips4650; - - case E_MIPS_MACH_MIPS32_4K: - return bfd_mach_mips32_4k; - - case E_MIPS_MACH_SB1: - return bfd_mach_mips_sb1; - - default: - switch (flags & EF_MIPS_ARCH) - { - default: - case E_MIPS_ARCH_1: - return bfd_mach_mips3000; - break; - - case E_MIPS_ARCH_2: - return bfd_mach_mips6000; - break; - - case E_MIPS_ARCH_3: - return bfd_mach_mips4000; - break; - - case E_MIPS_ARCH_4: - return bfd_mach_mips8000; - break; - - case E_MIPS_ARCH_5: - return bfd_mach_mips5; - break; - - case E_MIPS_ARCH_32: - return bfd_mach_mips32; - break; - - case E_MIPS_ARCH_64: - return bfd_mach_mips64; - break; - } - } - - return 0; -} - -/* Return printable name for ABI. */ - -static INLINE char * -elf_mips_abi_name (abfd) - bfd *abfd; -{ - flagword flags; - - flags = elf_elfheader (abfd)->e_flags; - switch (flags & EF_MIPS_ABI) - { - case 0: - if (ABI_N32_P (abfd)) - return "N32"; - else if (ABI_64_P (abfd)) - return "64"; - else - return "none"; - case E_MIPS_ABI_O32: - return "O32"; - case E_MIPS_ABI_O64: - return "O64"; - case E_MIPS_ABI_EABI32: - return "EABI32"; - case E_MIPS_ABI_EABI64: - return "EABI64"; - default: - return "unknown abi"; - } -} - -/* A mapping from BFD reloc types to MIPS ELF reloc types. */ - -struct elf_reloc_map { - bfd_reloc_code_real_type bfd_reloc_val; - enum elf_mips_reloc_type elf_reloc_val; -}; - -static CONST struct elf_reloc_map mips_reloc_map[] = -{ - { BFD_RELOC_NONE, R_MIPS_NONE, }, - { BFD_RELOC_16, R_MIPS_16 }, - { BFD_RELOC_32, R_MIPS_32 }, - { BFD_RELOC_64, R_MIPS_64 }, - { BFD_RELOC_MIPS_JMP, R_MIPS_26 }, - { BFD_RELOC_HI16_S, R_MIPS_HI16 }, - { BFD_RELOC_LO16, R_MIPS_LO16 }, - { BFD_RELOC_MIPS_GPREL, R_MIPS_GPREL16 }, - { BFD_RELOC_MIPS_LITERAL, R_MIPS_LITERAL }, - { BFD_RELOC_MIPS_GOT16, R_MIPS_GOT16 }, - { BFD_RELOC_16_PCREL, R_MIPS_PC16 }, - { BFD_RELOC_MIPS_CALL16, R_MIPS_CALL16 }, - { BFD_RELOC_MIPS_GPREL32, R_MIPS_GPREL32 }, - { BFD_RELOC_MIPS_GOT_HI16, R_MIPS_GOT_HI16 }, - { BFD_RELOC_MIPS_GOT_LO16, R_MIPS_GOT_LO16 }, - { BFD_RELOC_MIPS_CALL_HI16, R_MIPS_CALL_HI16 }, - { BFD_RELOC_MIPS_CALL_LO16, R_MIPS_CALL_LO16 }, - { BFD_RELOC_MIPS_SUB, R_MIPS_SUB }, - { BFD_RELOC_MIPS_GOT_PAGE, R_MIPS_GOT_PAGE }, - { BFD_RELOC_MIPS_GOT_OFST, R_MIPS_GOT_OFST }, - { BFD_RELOC_MIPS_GOT_DISP, R_MIPS_GOT_DISP } -}; - -/* Given a BFD reloc type, return a howto structure. */ - -static reloc_howto_type * -bfd_elf32_bfd_reloc_type_lookup (abfd, code) - bfd *abfd; - bfd_reloc_code_real_type code; -{ - unsigned int i; - - for (i = 0; i < sizeof (mips_reloc_map) / sizeof (struct elf_reloc_map); i++) - { - if (mips_reloc_map[i].bfd_reloc_val == code) - return &elf_mips_howto_table[(int) mips_reloc_map[i].elf_reloc_val]; - } - - switch (code) - { - default: - bfd_set_error (bfd_error_bad_value); - return NULL; - - case BFD_RELOC_CTOR: - /* We need to handle BFD_RELOC_CTOR specially. - Select the right relocation (R_MIPS_32 or R_MIPS_64) based on the - size of addresses on this architecture. */ - if (bfd_arch_bits_per_address (abfd) == 32) - return &elf_mips_howto_table[(int) R_MIPS_32]; - else - return &elf_mips_ctor64_howto; - - case BFD_RELOC_MIPS16_JMP: - return &elf_mips16_jump_howto; - case BFD_RELOC_MIPS16_GPREL: - return &elf_mips16_gprel_howto; - case BFD_RELOC_VTABLE_INHERIT: - return &elf_mips_gnu_vtinherit_howto; - case BFD_RELOC_VTABLE_ENTRY: - return &elf_mips_gnu_vtentry_howto; - case BFD_RELOC_PCREL_HI16_S: - return &elf_mips_gnu_rel_hi16; - case BFD_RELOC_PCREL_LO16: - return &elf_mips_gnu_rel_lo16; - case BFD_RELOC_16_PCREL_S2: - return &elf_mips_gnu_rel16_s2; - case BFD_RELOC_64_PCREL: - return &elf_mips_gnu_pcrel64; - case BFD_RELOC_32_PCREL: - return &elf_mips_gnu_pcrel32; - } -} - -/* Given a MIPS Elf32_Internal_Rel, fill in an arelent structure. */ - -static reloc_howto_type * -mips_rtype_to_howto (r_type) - unsigned int r_type; -{ - switch (r_type) - { - case R_MIPS16_26: - return &elf_mips16_jump_howto; - break; - case R_MIPS16_GPREL: - return &elf_mips16_gprel_howto; - break; - case R_MIPS_GNU_VTINHERIT: - return &elf_mips_gnu_vtinherit_howto; - break; - case R_MIPS_GNU_VTENTRY: - return &elf_mips_gnu_vtentry_howto; - break; - case R_MIPS_GNU_REL_HI16: - return &elf_mips_gnu_rel_hi16; - break; - case R_MIPS_GNU_REL_LO16: - return &elf_mips_gnu_rel_lo16; - break; - case R_MIPS_GNU_REL16_S2: - return &elf_mips_gnu_rel16_s2; - break; - case R_MIPS_PC64: - return &elf_mips_gnu_pcrel64; - break; - case R_MIPS_PC32: - return &elf_mips_gnu_pcrel32; - break; - - default: - BFD_ASSERT (r_type < (unsigned int) R_MIPS_max); - return &elf_mips_howto_table[r_type]; - break; - } -} - -/* Given a MIPS Elf32_Internal_Rel, fill in an arelent structure. */ - -static void -mips_info_to_howto_rel (abfd, cache_ptr, dst) - bfd *abfd; - arelent *cache_ptr; - Elf32_Internal_Rel *dst; -{ - unsigned int r_type; - - r_type = ELF32_R_TYPE (dst->r_info); - cache_ptr->howto = mips_rtype_to_howto (r_type); - - /* The addend for a GPREL16 or LITERAL relocation comes from the GP - value for the object file. We get the addend now, rather than - when we do the relocation, because the symbol manipulations done - by the linker may cause us to lose track of the input BFD. */ - if (((*cache_ptr->sym_ptr_ptr)->flags & BSF_SECTION_SYM) != 0 - && (r_type == (unsigned int) R_MIPS_GPREL16 - || r_type == (unsigned int) R_MIPS_LITERAL)) - cache_ptr->addend = elf_gp (abfd); -} - -/* Given a MIPS Elf32_Internal_Rela, fill in an arelent structure. */ - -static void -mips_info_to_howto_rela (abfd, cache_ptr, dst) - bfd *abfd; - arelent *cache_ptr; - Elf32_Internal_Rela *dst; -{ - /* Since an Elf32_Internal_Rel is an initial prefix of an - Elf32_Internal_Rela, we can just use mips_info_to_howto_rel - above. */ - mips_info_to_howto_rel (abfd, cache_ptr, (Elf32_Internal_Rel *) dst); - - /* If we ever need to do any extra processing with dst->r_addend - (the field omitted in an Elf32_Internal_Rel) we can do it here. */ -} - -/* A .reginfo section holds a single Elf32_RegInfo structure. These - routines swap this structure in and out. They are used outside of - BFD, so they are globally visible. */ - -void -bfd_mips_elf32_swap_reginfo_in (abfd, ex, in) - bfd *abfd; - const Elf32_External_RegInfo *ex; - Elf32_RegInfo *in; -{ - in->ri_gprmask = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_gprmask); - in->ri_cprmask[0] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[0]); - in->ri_cprmask[1] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[1]); - in->ri_cprmask[2] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[2]); - in->ri_cprmask[3] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[3]); - in->ri_gp_value = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_gp_value); -} - -void -bfd_mips_elf32_swap_reginfo_out (abfd, in, ex) - bfd *abfd; - const Elf32_RegInfo *in; - Elf32_External_RegInfo *ex; -{ - bfd_h_put_32 (abfd, (bfd_vma) in->ri_gprmask, - (bfd_byte *) ex->ri_gprmask); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[0], - (bfd_byte *) ex->ri_cprmask[0]); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[1], - (bfd_byte *) ex->ri_cprmask[1]); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[2], - (bfd_byte *) ex->ri_cprmask[2]); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[3], - (bfd_byte *) ex->ri_cprmask[3]); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_gp_value, - (bfd_byte *) ex->ri_gp_value); -} - -/* In the 64 bit ABI, the .MIPS.options section holds register - information in an Elf64_Reginfo structure. These routines swap - them in and out. They are globally visible because they are used - outside of BFD. These routines are here so that gas can call them - without worrying about whether the 64 bit ABI has been included. */ - -void -bfd_mips_elf64_swap_reginfo_in (abfd, ex, in) - bfd *abfd; - const Elf64_External_RegInfo *ex; - Elf64_Internal_RegInfo *in; -{ - in->ri_gprmask = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_gprmask); - in->ri_pad = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_pad); - in->ri_cprmask[0] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[0]); - in->ri_cprmask[1] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[1]); - in->ri_cprmask[2] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[2]); - in->ri_cprmask[3] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[3]); - in->ri_gp_value = bfd_h_get_64 (abfd, (bfd_byte *) ex->ri_gp_value); -} - -void -bfd_mips_elf64_swap_reginfo_out (abfd, in, ex) - bfd *abfd; - const Elf64_Internal_RegInfo *in; - Elf64_External_RegInfo *ex; -{ - bfd_h_put_32 (abfd, (bfd_vma) in->ri_gprmask, - (bfd_byte *) ex->ri_gprmask); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_pad, - (bfd_byte *) ex->ri_pad); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[0], - (bfd_byte *) ex->ri_cprmask[0]); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[1], - (bfd_byte *) ex->ri_cprmask[1]); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[2], - (bfd_byte *) ex->ri_cprmask[2]); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[3], - (bfd_byte *) ex->ri_cprmask[3]); - bfd_h_put_64 (abfd, (bfd_vma) in->ri_gp_value, - (bfd_byte *) ex->ri_gp_value); -} - -/* Swap an entry in a .gptab section. Note that these routines rely - on the equivalence of the two elements of the union. */ - -static void -bfd_mips_elf32_swap_gptab_in (abfd, ex, in) - bfd *abfd; - const Elf32_External_gptab *ex; - Elf32_gptab *in; -{ - in->gt_entry.gt_g_value = bfd_h_get_32 (abfd, ex->gt_entry.gt_g_value); - in->gt_entry.gt_bytes = bfd_h_get_32 (abfd, ex->gt_entry.gt_bytes); -} - -static void -bfd_mips_elf32_swap_gptab_out (abfd, in, ex) - bfd *abfd; - const Elf32_gptab *in; - Elf32_External_gptab *ex; -{ - bfd_h_put_32 (abfd, (bfd_vma) in->gt_entry.gt_g_value, - ex->gt_entry.gt_g_value); - bfd_h_put_32 (abfd, (bfd_vma) in->gt_entry.gt_bytes, - ex->gt_entry.gt_bytes); -} - -static void -bfd_elf32_swap_compact_rel_out (abfd, in, ex) - bfd *abfd; - const Elf32_compact_rel *in; - Elf32_External_compact_rel *ex; -{ - bfd_h_put_32 (abfd, (bfd_vma) in->id1, ex->id1); - bfd_h_put_32 (abfd, (bfd_vma) in->num, ex->num); - bfd_h_put_32 (abfd, (bfd_vma) in->id2, ex->id2); - bfd_h_put_32 (abfd, (bfd_vma) in->offset, ex->offset); - bfd_h_put_32 (abfd, (bfd_vma) in->reserved0, ex->reserved0); - bfd_h_put_32 (abfd, (bfd_vma) in->reserved1, ex->reserved1); -} - -static void -bfd_elf32_swap_crinfo_out (abfd, in, ex) - bfd *abfd; - const Elf32_crinfo *in; - Elf32_External_crinfo *ex; -{ - unsigned long l; - - l = (((in->ctype & CRINFO_CTYPE) << CRINFO_CTYPE_SH) - | ((in->rtype & CRINFO_RTYPE) << CRINFO_RTYPE_SH) - | ((in->dist2to & CRINFO_DIST2TO) << CRINFO_DIST2TO_SH) - | ((in->relvaddr & CRINFO_RELVADDR) << CRINFO_RELVADDR_SH)); - bfd_h_put_32 (abfd, (bfd_vma) l, ex->info); - bfd_h_put_32 (abfd, (bfd_vma) in->konst, ex->konst); - bfd_h_put_32 (abfd, (bfd_vma) in->vaddr, ex->vaddr); -} - -/* Swap in an options header. */ - -void -bfd_mips_elf_swap_options_in (abfd, ex, in) - bfd *abfd; - const Elf_External_Options *ex; - Elf_Internal_Options *in; -{ - in->kind = bfd_h_get_8 (abfd, ex->kind); - in->size = bfd_h_get_8 (abfd, ex->size); - in->section = bfd_h_get_16 (abfd, ex->section); - in->info = bfd_h_get_32 (abfd, ex->info); -} - -/* Swap out an options header. */ - -void -bfd_mips_elf_swap_options_out (abfd, in, ex) - bfd *abfd; - const Elf_Internal_Options *in; - Elf_External_Options *ex; -{ - bfd_h_put_8 (abfd, in->kind, ex->kind); - bfd_h_put_8 (abfd, in->size, ex->size); - bfd_h_put_16 (abfd, in->section, ex->section); - bfd_h_put_32 (abfd, in->info, ex->info); -} -#if 0 -/* Swap in an MSYM entry. */ - -static void -bfd_mips_elf_swap_msym_in (abfd, ex, in) - bfd *abfd; - const Elf32_External_Msym *ex; - Elf32_Internal_Msym *in; -{ - in->ms_hash_value = bfd_h_get_32 (abfd, ex->ms_hash_value); - in->ms_info = bfd_h_get_32 (abfd, ex->ms_info); -} -#endif -/* Swap out an MSYM entry. */ - -static void -bfd_mips_elf_swap_msym_out (abfd, in, ex) - bfd *abfd; - const Elf32_Internal_Msym *in; - Elf32_External_Msym *ex; -{ - bfd_h_put_32 (abfd, in->ms_hash_value, ex->ms_hash_value); - bfd_h_put_32 (abfd, in->ms_info, ex->ms_info); -} - -/* Determine whether a symbol is global for the purposes of splitting - the symbol table into global symbols and local symbols. At least - on Irix 5, this split must be between section symbols and all other - symbols. On most ELF targets the split is between static symbols - and externally visible symbols. */ - -static boolean -mips_elf_sym_is_global (abfd, sym) - bfd *abfd ATTRIBUTE_UNUSED; - asymbol *sym; -{ - if (SGI_COMPAT (abfd)) - return (sym->flags & BSF_SECTION_SYM) == 0; - else - return ((sym->flags & (BSF_GLOBAL | BSF_WEAK)) != 0 - || bfd_is_und_section (bfd_get_section (sym)) - || bfd_is_com_section (bfd_get_section (sym))); -} - -/* Set the right machine number for a MIPS ELF file. This is used for - both the 32-bit and the 64-bit ABI. */ - -boolean -_bfd_mips_elf_object_p (abfd) - bfd *abfd; -{ - /* Irix 5 and 6 is broken. Object file symbol tables are not always - sorted correctly such that local symbols precede global symbols, - and the sh_info field in the symbol table is not always right. */ - if (SGI_COMPAT(abfd)) - elf_bad_symtab (abfd) = true; - - bfd_default_set_arch_mach (abfd, bfd_arch_mips, - elf_mips_mach (elf_elfheader (abfd)->e_flags)); - return true; -} - -/* The final processing done just before writing out a MIPS ELF object - file. This gets the MIPS architecture right based on the machine - number. This is used by both the 32-bit and the 64-bit ABI. */ - -void -_bfd_mips_elf_final_write_processing (abfd, linker) - bfd *abfd; - boolean linker ATTRIBUTE_UNUSED; -{ - unsigned long val; - unsigned int i; - Elf_Internal_Shdr **hdrpp; - const char *name; - asection *sec; - - switch (bfd_get_mach (abfd)) - { - default: - case bfd_mach_mips3000: - val = E_MIPS_ARCH_1; - break; - - case bfd_mach_mips3900: - val = E_MIPS_ARCH_1 | E_MIPS_MACH_3900; - break; - - case bfd_mach_mips6000: - val = E_MIPS_ARCH_2; - break; - - case bfd_mach_mips4000: - case bfd_mach_mips4300: - case bfd_mach_mips4400: - case bfd_mach_mips4600: - val = E_MIPS_ARCH_3; - break; - - case bfd_mach_mips4010: - val = E_MIPS_ARCH_3 | E_MIPS_MACH_4010; - break; - - case bfd_mach_mips4100: - val = E_MIPS_ARCH_3 | E_MIPS_MACH_4100; - break; - - case bfd_mach_mips4111: - val = E_MIPS_ARCH_3 | E_MIPS_MACH_4111; - break; - - case bfd_mach_mips4650: - val = E_MIPS_ARCH_3 | E_MIPS_MACH_4650; - break; - - case bfd_mach_mips5000: - case bfd_mach_mips8000: - case bfd_mach_mips10000: - case bfd_mach_mips12000: - val = E_MIPS_ARCH_4; - break; - - case bfd_mach_mips32: - val = E_MIPS_ARCH_32; - break; - - case bfd_mach_mips32_4k: - val = E_MIPS_ARCH_32 | E_MIPS_MACH_MIPS32_4K; - break; - - case bfd_mach_mips5: - val = E_MIPS_ARCH_5; - break; - - case bfd_mach_mips64: - val = E_MIPS_ARCH_64; - break; - - case bfd_mach_mips_sb1: - val = E_MIPS_ARCH_64 | E_MIPS_MACH_SB1; - break; - } - - elf_elfheader (abfd)->e_flags &= ~(EF_MIPS_ARCH | EF_MIPS_MACH); - elf_elfheader (abfd)->e_flags |= val; - - /* Set the sh_info field for .gptab sections and other appropriate - info for each special section. */ - for (i = 1, hdrpp = elf_elfsections (abfd) + 1; - i < elf_elfheader (abfd)->e_shnum; - i++, hdrpp++) - { - switch ((*hdrpp)->sh_type) - { - case SHT_MIPS_MSYM: - case SHT_MIPS_LIBLIST: - sec = bfd_get_section_by_name (abfd, ".dynstr"); - if (sec != NULL) - (*hdrpp)->sh_link = elf_section_data (sec)->this_idx; - break; - - case SHT_MIPS_GPTAB: - BFD_ASSERT ((*hdrpp)->bfd_section != NULL); - name = bfd_get_section_name (abfd, (*hdrpp)->bfd_section); - BFD_ASSERT (name != NULL - && strncmp (name, ".gptab.", sizeof ".gptab." - 1) == 0); - sec = bfd_get_section_by_name (abfd, name + sizeof ".gptab" - 1); - BFD_ASSERT (sec != NULL); - (*hdrpp)->sh_info = elf_section_data (sec)->this_idx; - break; - - case SHT_MIPS_CONTENT: - BFD_ASSERT ((*hdrpp)->bfd_section != NULL); - name = bfd_get_section_name (abfd, (*hdrpp)->bfd_section); - BFD_ASSERT (name != NULL - && strncmp (name, ".MIPS.content", - sizeof ".MIPS.content" - 1) == 0); - sec = bfd_get_section_by_name (abfd, - name + sizeof ".MIPS.content" - 1); - BFD_ASSERT (sec != NULL); - (*hdrpp)->sh_link = elf_section_data (sec)->this_idx; - break; - - case SHT_MIPS_SYMBOL_LIB: - sec = bfd_get_section_by_name (abfd, ".dynsym"); - if (sec != NULL) - (*hdrpp)->sh_link = elf_section_data (sec)->this_idx; - sec = bfd_get_section_by_name (abfd, ".liblist"); - if (sec != NULL) - (*hdrpp)->sh_info = elf_section_data (sec)->this_idx; - break; - - case SHT_MIPS_EVENTS: - BFD_ASSERT ((*hdrpp)->bfd_section != NULL); - name = bfd_get_section_name (abfd, (*hdrpp)->bfd_section); - BFD_ASSERT (name != NULL); - if (strncmp (name, ".MIPS.events", sizeof ".MIPS.events" - 1) == 0) - sec = bfd_get_section_by_name (abfd, - name + sizeof ".MIPS.events" - 1); - else - { - BFD_ASSERT (strncmp (name, ".MIPS.post_rel", - sizeof ".MIPS.post_rel" - 1) == 0); - sec = bfd_get_section_by_name (abfd, - (name - + sizeof ".MIPS.post_rel" - 1)); - } - BFD_ASSERT (sec != NULL); - (*hdrpp)->sh_link = elf_section_data (sec)->this_idx; - break; - - } - } -} - -/* Function to keep MIPS specific file flags like as EF_MIPS_PIC. */ - -boolean -_bfd_mips_elf_set_private_flags (abfd, flags) - bfd *abfd; - flagword flags; -{ - BFD_ASSERT (!elf_flags_init (abfd) - || elf_elfheader (abfd)->e_flags == flags); - - elf_elfheader (abfd)->e_flags = flags; - elf_flags_init (abfd) = true; - return true; -} - -/* Copy backend specific data from one object module to another */ - -boolean -_bfd_mips_elf_copy_private_bfd_data (ibfd, obfd) - bfd *ibfd; - bfd *obfd; -{ - if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour - || bfd_get_flavour (obfd) != bfd_target_elf_flavour) - return true; - - BFD_ASSERT (!elf_flags_init (obfd) - || (elf_elfheader (obfd)->e_flags - == elf_elfheader (ibfd)->e_flags)); - - elf_gp (obfd) = elf_gp (ibfd); - elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags; - elf_flags_init (obfd) = true; - return true; -} - -/* Merge backend specific data from an object file to the output - object file when linking. */ - -boolean -_bfd_mips_elf_merge_private_bfd_data (ibfd, obfd) - bfd *ibfd; - bfd *obfd; -{ - flagword old_flags; - flagword new_flags; - boolean ok; - boolean null_input_bfd = true; - asection *sec; - - /* Check if we have the same endianess */ - if (_bfd_generic_verify_endian_match (ibfd, obfd) == false) - return false; - - if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour - || bfd_get_flavour (obfd) != bfd_target_elf_flavour) - return true; - - new_flags = elf_elfheader (ibfd)->e_flags; - elf_elfheader (obfd)->e_flags |= new_flags & EF_MIPS_NOREORDER; - old_flags = elf_elfheader (obfd)->e_flags; - - if (! elf_flags_init (obfd)) - { - elf_flags_init (obfd) = true; - elf_elfheader (obfd)->e_flags = new_flags; - elf_elfheader (obfd)->e_ident[EI_CLASS] - = elf_elfheader (ibfd)->e_ident[EI_CLASS]; - - if (bfd_get_arch (obfd) == bfd_get_arch (ibfd) - && bfd_get_arch_info (obfd)->the_default) - { - if (! bfd_set_arch_mach (obfd, bfd_get_arch (ibfd), - bfd_get_mach (ibfd))) - return false; - } - - return true; - } - - /* Check flag compatibility. */ - - new_flags &= ~EF_MIPS_NOREORDER; - old_flags &= ~EF_MIPS_NOREORDER; - - if (new_flags == old_flags) - return true; - - /* Check to see if the input BFD actually contains any sections. - If not, its flags may not have been initialised either, but it cannot - actually cause any incompatibility. */ - for (sec = ibfd->sections; sec != NULL; sec = sec->next) - { - /* Ignore synthetic sections and empty .text, .data and .bss sections - which are automatically generated by gas. */ - if (strcmp (sec->name, ".reginfo") - && strcmp (sec->name, ".mdebug") - && ((!strcmp (sec->name, ".text") - || !strcmp (sec->name, ".data") - || !strcmp (sec->name, ".bss")) - && sec->_raw_size != 0)) - { - null_input_bfd = false; - break; - } - } - if (null_input_bfd) - return true; - - ok = true; - - if ((new_flags & EF_MIPS_PIC) != (old_flags & EF_MIPS_PIC)) - { - new_flags &= ~EF_MIPS_PIC; - old_flags &= ~EF_MIPS_PIC; - (*_bfd_error_handler) - (_("%s: linking PIC files with non-PIC files"), - bfd_get_filename (ibfd)); - ok = false; - } - - if ((new_flags & EF_MIPS_CPIC) != (old_flags & EF_MIPS_CPIC)) - { - new_flags &= ~EF_MIPS_CPIC; - old_flags &= ~EF_MIPS_CPIC; - (*_bfd_error_handler) - (_("%s: linking abicalls files with non-abicalls files"), - bfd_get_filename (ibfd)); - ok = false; - } - - /* Compare the ISA's. */ - if ((new_flags & (EF_MIPS_ARCH | EF_MIPS_MACH)) - != (old_flags & (EF_MIPS_ARCH | EF_MIPS_MACH))) - { - int new_mach = new_flags & EF_MIPS_MACH; - int old_mach = old_flags & EF_MIPS_MACH; - int new_isa = elf_mips_isa (new_flags); - int old_isa = elf_mips_isa (old_flags); - - /* If either has no machine specified, just compare the general isa's. - Some combinations of machines are ok, if the isa's match. */ - if (! new_mach - || ! old_mach - || new_mach == old_mach - ) - { - /* Don't warn about mixing code using 32-bit ISAs, or mixing code - using 64-bit ISAs. They will normally use the same data sizes - and calling conventions. */ - - if (( (new_isa == 1 || new_isa == 2 || new_isa == 32) - ^ (old_isa == 1 || old_isa == 2 || old_isa == 32)) != 0) - { - (*_bfd_error_handler) - (_("%s: ISA mismatch (-mips%d) with previous modules (-mips%d)"), - bfd_get_filename (ibfd), new_isa, old_isa); - ok = false; - } - } - - else - { - (*_bfd_error_handler) - (_("%s: ISA mismatch (%d) with previous modules (%d)"), - bfd_get_filename (ibfd), - elf_mips_mach (new_flags), - elf_mips_mach (old_flags)); - ok = false; - } - - new_flags &= ~(EF_MIPS_ARCH | EF_MIPS_MACH); - old_flags &= ~(EF_MIPS_ARCH | EF_MIPS_MACH); - } - - /* Compare ABI's. The 64-bit ABI does not use EF_MIPS_ABI. But, it - does set EI_CLASS differently from any 32-bit ABI. */ - if ((new_flags & EF_MIPS_ABI) != (old_flags & EF_MIPS_ABI) - || (elf_elfheader (ibfd)->e_ident[EI_CLASS] - != elf_elfheader (obfd)->e_ident[EI_CLASS])) - { - /* Only error if both are set (to different values). */ - if (((new_flags & EF_MIPS_ABI) && (old_flags & EF_MIPS_ABI)) - || (elf_elfheader (ibfd)->e_ident[EI_CLASS] - != elf_elfheader (obfd)->e_ident[EI_CLASS])) - { - (*_bfd_error_handler) - (_("%s: ABI mismatch: linking %s module with previous %s modules"), - bfd_get_filename (ibfd), - elf_mips_abi_name (ibfd), - elf_mips_abi_name (obfd)); - ok = false; - } - new_flags &= ~EF_MIPS_ABI; - old_flags &= ~EF_MIPS_ABI; - } - - /* Warn about any other mismatches */ - if (new_flags != old_flags) - { - (*_bfd_error_handler) - (_("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"), - bfd_get_filename (ibfd), (unsigned long) new_flags, - (unsigned long) old_flags); - ok = false; - } - - if (! ok) - { - bfd_set_error (bfd_error_bad_value); - return false; - } - - return true; -} - -boolean -_bfd_mips_elf_print_private_bfd_data (abfd, ptr) - bfd *abfd; - PTR ptr; -{ - FILE *file = (FILE *) ptr; - - BFD_ASSERT (abfd != NULL && ptr != NULL); - - /* Print normal ELF private data. */ - _bfd_elf_print_private_bfd_data (abfd, ptr); - - /* xgettext:c-format */ - fprintf (file, _("private flags = %lx:"), elf_elfheader (abfd)->e_flags); - - if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_O32) - fprintf (file, _(" [abi=O32]")); - else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_O64) - fprintf (file, _(" [abi=O64]")); - else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_EABI32) - fprintf (file, _(" [abi=EABI32]")); - else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_EABI64) - fprintf (file, _(" [abi=EABI64]")); - else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI)) - fprintf (file, _(" [abi unknown]")); - else if (ABI_N32_P (abfd)) - fprintf (file, _(" [abi=N32]")); - else if (ABI_64_P (abfd)) - fprintf (file, _(" [abi=64]")); - else - fprintf (file, _(" [no abi set]")); - - if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_1) - fprintf (file, _(" [mips1]")); - else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_2) - fprintf (file, _(" [mips2]")); - else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_3) - fprintf (file, _(" [mips3]")); - else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_4) - fprintf (file, _(" [mips4]")); - else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_5) - fprintf (file, _ (" [mips5]")); - else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_32) - fprintf (file, _ (" [mips32]")); - else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_64) - fprintf (file, _ (" [mips64]")); - else - fprintf (file, _(" [unknown ISA]")); - - if (elf_elfheader (abfd)->e_flags & EF_MIPS_32BITMODE) - fprintf (file, _(" [32bitmode]")); - else - fprintf (file, _(" [not 32bitmode]")); - - fputc ('\n', file); - - return true; -} - -/* Handle a MIPS specific section when reading an object file. This - is called when elfcode.h finds a section with an unknown type. - This routine supports both the 32-bit and 64-bit ELF ABI. - - FIXME: We need to handle the SHF_MIPS_GPREL flag, but I'm not sure - how to. */ - -boolean -_bfd_mips_elf_section_from_shdr (abfd, hdr, name) - bfd *abfd; - Elf_Internal_Shdr *hdr; - char *name; -{ - flagword flags = 0; - - /* There ought to be a place to keep ELF backend specific flags, but - at the moment there isn't one. We just keep track of the - sections by their name, instead. Fortunately, the ABI gives - suggested names for all the MIPS specific sections, so we will - probably get away with this. */ - switch (hdr->sh_type) - { - case SHT_MIPS_LIBLIST: - if (strcmp (name, ".liblist") != 0) - return false; - break; - case SHT_MIPS_MSYM: - if (strcmp (name, MIPS_ELF_MSYM_SECTION_NAME (abfd)) != 0) - return false; - break; - case SHT_MIPS_CONFLICT: - if (strcmp (name, ".conflict") != 0) - return false; - break; - case SHT_MIPS_GPTAB: - if (strncmp (name, ".gptab.", sizeof ".gptab." - 1) != 0) - return false; - break; - case SHT_MIPS_UCODE: - if (strcmp (name, ".ucode") != 0) - return false; - break; - case SHT_MIPS_DEBUG: - if (strcmp (name, ".mdebug") != 0) - return false; - flags = SEC_DEBUGGING; - break; - case SHT_MIPS_REGINFO: - if (strcmp (name, ".reginfo") != 0 - || hdr->sh_size != sizeof (Elf32_External_RegInfo)) - return false; - flags = (SEC_LINK_ONCE | SEC_LINK_DUPLICATES_SAME_SIZE); - break; - case SHT_MIPS_IFACE: - if (strcmp (name, ".MIPS.interfaces") != 0) - return false; - break; - case SHT_MIPS_CONTENT: - if (strncmp (name, ".MIPS.content", sizeof ".MIPS.content" - 1) != 0) - return false; - break; - case SHT_MIPS_OPTIONS: - if (strcmp (name, MIPS_ELF_OPTIONS_SECTION_NAME (abfd)) != 0) - return false; - break; - case SHT_MIPS_DWARF: - if (strncmp (name, ".debug_", sizeof ".debug_" - 1) != 0) - return false; - break; - case SHT_MIPS_SYMBOL_LIB: - if (strcmp (name, ".MIPS.symlib") != 0) - return false; - break; - case SHT_MIPS_EVENTS: - if (strncmp (name, ".MIPS.events", sizeof ".MIPS.events" - 1) != 0 - && strncmp (name, ".MIPS.post_rel", - sizeof ".MIPS.post_rel" - 1) != 0) - return false; - break; - default: - return false; - } - - if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name)) - return false; - - if (flags) - { - if (! bfd_set_section_flags (abfd, hdr->bfd_section, - (bfd_get_section_flags (abfd, - hdr->bfd_section) - | flags))) - return false; - } - - /* FIXME: We should record sh_info for a .gptab section. */ - - /* For a .reginfo section, set the gp value in the tdata information - from the contents of this section. We need the gp value while - processing relocs, so we just get it now. The .reginfo section - is not used in the 64-bit MIPS ELF ABI. */ - if (hdr->sh_type == SHT_MIPS_REGINFO) - { - Elf32_External_RegInfo ext; - Elf32_RegInfo s; - - if (! bfd_get_section_contents (abfd, hdr->bfd_section, (PTR) &ext, - (file_ptr) 0, sizeof ext)) - return false; - bfd_mips_elf32_swap_reginfo_in (abfd, &ext, &s); - elf_gp (abfd) = s.ri_gp_value; - } - - /* For a SHT_MIPS_OPTIONS section, look for a ODK_REGINFO entry, and - set the gp value based on what we find. We may see both - SHT_MIPS_REGINFO and SHT_MIPS_OPTIONS/ODK_REGINFO; in that case, - they should agree. */ - if (hdr->sh_type == SHT_MIPS_OPTIONS) - { - bfd_byte *contents, *l, *lend; - - contents = (bfd_byte *) bfd_malloc (hdr->sh_size); - if (contents == NULL) - return false; - if (! bfd_get_section_contents (abfd, hdr->bfd_section, contents, - (file_ptr) 0, hdr->sh_size)) - { - free (contents); - return false; - } - l = contents; - lend = contents + hdr->sh_size; - while (l + sizeof (Elf_External_Options) <= lend) - { - Elf_Internal_Options intopt; - - bfd_mips_elf_swap_options_in (abfd, (Elf_External_Options *) l, - &intopt); - if (ABI_64_P (abfd) && intopt.kind == ODK_REGINFO) - { - Elf64_Internal_RegInfo intreg; - - bfd_mips_elf64_swap_reginfo_in - (abfd, - ((Elf64_External_RegInfo *) - (l + sizeof (Elf_External_Options))), - &intreg); - elf_gp (abfd) = intreg.ri_gp_value; - } - else if (intopt.kind == ODK_REGINFO) - { - Elf32_RegInfo intreg; - - bfd_mips_elf32_swap_reginfo_in - (abfd, - ((Elf32_External_RegInfo *) - (l + sizeof (Elf_External_Options))), - &intreg); - elf_gp (abfd) = intreg.ri_gp_value; - } - l += intopt.size; - } - free (contents); - } - - return true; -} - -/* Set the correct type for a MIPS ELF section. We do this by the - section name, which is a hack, but ought to work. This routine is - used by both the 32-bit and the 64-bit ABI. */ - -boolean -_bfd_mips_elf_fake_sections (abfd, hdr, sec) - bfd *abfd; - Elf32_Internal_Shdr *hdr; - asection *sec; -{ - register const char *name; - - name = bfd_get_section_name (abfd, sec); - - if (strcmp (name, ".liblist") == 0) - { - hdr->sh_type = SHT_MIPS_LIBLIST; - hdr->sh_info = sec->_raw_size / sizeof (Elf32_Lib); - /* The sh_link field is set in final_write_processing. */ - } - else if (strcmp (name, ".conflict") == 0) - hdr->sh_type = SHT_MIPS_CONFLICT; - else if (strncmp (name, ".gptab.", sizeof ".gptab." - 1) == 0) - { - hdr->sh_type = SHT_MIPS_GPTAB; - hdr->sh_entsize = sizeof (Elf32_External_gptab); - /* The sh_info field is set in final_write_processing. */ - } - else if (strcmp (name, ".ucode") == 0) - hdr->sh_type = SHT_MIPS_UCODE; - else if (strcmp (name, ".mdebug") == 0) - { - hdr->sh_type = SHT_MIPS_DEBUG; - /* In a shared object on Irix 5.3, the .mdebug section has an - entsize of 0. FIXME: Does this matter? */ - if (SGI_COMPAT (abfd) && (abfd->flags & DYNAMIC) != 0) - hdr->sh_entsize = 0; - else - hdr->sh_entsize = 1; - } - else if (strcmp (name, ".reginfo") == 0) - { - hdr->sh_type = SHT_MIPS_REGINFO; - /* In a shared object on Irix 5.3, the .reginfo section has an - entsize of 0x18. FIXME: Does this matter? */ - if (SGI_COMPAT (abfd)) - { - if ((abfd->flags & DYNAMIC) != 0) - hdr->sh_entsize = sizeof (Elf32_External_RegInfo); - else - hdr->sh_entsize = 1; - } - else - hdr->sh_entsize = sizeof (Elf32_External_RegInfo); - } - else if (SGI_COMPAT (abfd) - && (strcmp (name, ".hash") == 0 - || strcmp (name, ".dynamic") == 0 - || strcmp (name, ".dynstr") == 0)) - { - if (SGI_COMPAT (abfd)) - hdr->sh_entsize = 0; -#if 0 - /* This isn't how the Irix 6 linker behaves. */ - hdr->sh_info = SIZEOF_MIPS_DYNSYM_SECNAMES; -#endif - } - else if (strcmp (name, ".got") == 0 - || strcmp (name, MIPS_ELF_SRDATA_SECTION_NAME (abfd)) == 0 - || strcmp (name, ".sdata") == 0 - || strcmp (name, ".sbss") == 0 - || strcmp (name, ".lit4") == 0 - || strcmp (name, ".lit8") == 0) - hdr->sh_flags |= SHF_MIPS_GPREL; - else if (strcmp (name, ".MIPS.interfaces") == 0) - { - hdr->sh_type = SHT_MIPS_IFACE; - hdr->sh_flags |= SHF_MIPS_NOSTRIP; - } - else if (strncmp (name, ".MIPS.content", strlen (".MIPS.content")) == 0) - { - hdr->sh_type = SHT_MIPS_CONTENT; - hdr->sh_flags |= SHF_MIPS_NOSTRIP; - /* The sh_info field is set in final_write_processing. */ - } - else if (strcmp (name, MIPS_ELF_OPTIONS_SECTION_NAME (abfd)) == 0) - { - hdr->sh_type = SHT_MIPS_OPTIONS; - hdr->sh_entsize = 1; - hdr->sh_flags |= SHF_MIPS_NOSTRIP; - } - else if (strncmp (name, ".debug_", sizeof ".debug_" - 1) == 0) - hdr->sh_type = SHT_MIPS_DWARF; - else if (strcmp (name, ".MIPS.symlib") == 0) - { - hdr->sh_type = SHT_MIPS_SYMBOL_LIB; - /* The sh_link and sh_info fields are set in - final_write_processing. */ - } - else if (strncmp (name, ".MIPS.events", sizeof ".MIPS.events" - 1) == 0 - || strncmp (name, ".MIPS.post_rel", - sizeof ".MIPS.post_rel" - 1) == 0) - { - hdr->sh_type = SHT_MIPS_EVENTS; - hdr->sh_flags |= SHF_MIPS_NOSTRIP; - /* The sh_link field is set in final_write_processing. */ - } - else if (strcmp (name, MIPS_ELF_MSYM_SECTION_NAME (abfd)) == 0) - { - hdr->sh_type = SHT_MIPS_MSYM; - hdr->sh_flags |= SHF_ALLOC; - hdr->sh_entsize = 8; - } - - /* The generic elf_fake_sections will set up REL_HDR using the - default kind of relocations. But, we may actually need both - kinds of relocations, so we set up the second header here. */ - if ((sec->flags & SEC_RELOC) != 0) - { - struct bfd_elf_section_data *esd; - - esd = elf_section_data (sec); - BFD_ASSERT (esd->rel_hdr2 == NULL); - esd->rel_hdr2 - = (Elf_Internal_Shdr *) bfd_zalloc (abfd, sizeof (Elf_Internal_Shdr)); - if (!esd->rel_hdr2) - return false; - _bfd_elf_init_reloc_shdr (abfd, esd->rel_hdr2, sec, - !elf_section_data (sec)->use_rela_p); - } - - return true; -} - -/* Given a BFD section, try to locate the corresponding ELF section - index. This is used by both the 32-bit and the 64-bit ABI. - Actually, it's not clear to me that the 64-bit ABI supports these, - but for non-PIC objects we will certainly want support for at least - the .scommon section. */ - -boolean -_bfd_mips_elf_section_from_bfd_section (abfd, hdr, sec, retval) - bfd *abfd ATTRIBUTE_UNUSED; - Elf_Internal_Shdr *hdr ATTRIBUTE_UNUSED; - asection *sec; - int *retval; -{ - if (strcmp (bfd_get_section_name (abfd, sec), ".scommon") == 0) - { - *retval = SHN_MIPS_SCOMMON; - return true; - } - if (strcmp (bfd_get_section_name (abfd, sec), ".acommon") == 0) - { - *retval = SHN_MIPS_ACOMMON; - return true; - } - return false; -} - -/* When are writing out the .options or .MIPS.options section, - remember the bytes we are writing out, so that we can install the - GP value in the section_processing routine. */ - -boolean -_bfd_mips_elf_set_section_contents (abfd, section, location, offset, count) - bfd *abfd; - sec_ptr section; - PTR location; - file_ptr offset; - bfd_size_type count; -{ - if (strcmp (section->name, MIPS_ELF_OPTIONS_SECTION_NAME (abfd)) == 0) - { - bfd_byte *c; - - if (elf_section_data (section) == NULL) - { - section->used_by_bfd = - (PTR) bfd_zalloc (abfd, sizeof (struct bfd_elf_section_data)); - if (elf_section_data (section) == NULL) - return false; - } - c = (bfd_byte *) elf_section_data (section)->tdata; - if (c == NULL) - { - bfd_size_type size; - - if (section->_cooked_size != 0) - size = section->_cooked_size; - else - size = section->_raw_size; - c = (bfd_byte *) bfd_zalloc (abfd, size); - if (c == NULL) - return false; - elf_section_data (section)->tdata = (PTR) c; - } - - memcpy (c + offset, location, count); - } - - return _bfd_elf_set_section_contents (abfd, section, location, offset, - count); -} - -/* Work over a section just before writing it out. This routine is - used by both the 32-bit and the 64-bit ABI. FIXME: We recognize - sections that need the SHF_MIPS_GPREL flag by name; there has to be - a better way. */ - -boolean -_bfd_mips_elf_section_processing (abfd, hdr) - bfd *abfd; - Elf_Internal_Shdr *hdr; -{ - if (hdr->sh_type == SHT_MIPS_REGINFO - && hdr->sh_size > 0) - { - bfd_byte buf[4]; - - BFD_ASSERT (hdr->sh_size == sizeof (Elf32_External_RegInfo)); - BFD_ASSERT (hdr->contents == NULL); - - if (bfd_seek (abfd, - hdr->sh_offset + sizeof (Elf32_External_RegInfo) - 4, - SEEK_SET) == -1) - return false; - bfd_h_put_32 (abfd, (bfd_vma) elf_gp (abfd), buf); - if (bfd_write (buf, (bfd_size_type) 1, (bfd_size_type) 4, abfd) != 4) - return false; - } - - if (hdr->sh_type == SHT_MIPS_OPTIONS - && hdr->bfd_section != NULL - && elf_section_data (hdr->bfd_section) != NULL - && elf_section_data (hdr->bfd_section)->tdata != NULL) - { - bfd_byte *contents, *l, *lend; - - /* We stored the section contents in the elf_section_data tdata - field in the set_section_contents routine. We save the - section contents so that we don't have to read them again. - At this point we know that elf_gp is set, so we can look - through the section contents to see if there is an - ODK_REGINFO structure. */ - - contents = (bfd_byte *) elf_section_data (hdr->bfd_section)->tdata; - l = contents; - lend = contents + hdr->sh_size; - while (l + sizeof (Elf_External_Options) <= lend) - { - Elf_Internal_Options intopt; - - bfd_mips_elf_swap_options_in (abfd, (Elf_External_Options *) l, - &intopt); - if (ABI_64_P (abfd) && intopt.kind == ODK_REGINFO) - { - bfd_byte buf[8]; - - if (bfd_seek (abfd, - (hdr->sh_offset - + (l - contents) - + sizeof (Elf_External_Options) - + (sizeof (Elf64_External_RegInfo) - 8)), - SEEK_SET) == -1) - return false; - bfd_h_put_64 (abfd, elf_gp (abfd), buf); - if (bfd_write (buf, 1, 8, abfd) != 8) - return false; - } - else if (intopt.kind == ODK_REGINFO) - { - bfd_byte buf[4]; - - if (bfd_seek (abfd, - (hdr->sh_offset - + (l - contents) - + sizeof (Elf_External_Options) - + (sizeof (Elf32_External_RegInfo) - 4)), - SEEK_SET) == -1) - return false; - bfd_h_put_32 (abfd, elf_gp (abfd), buf); - if (bfd_write (buf, 1, 4, abfd) != 4) - return false; - } - l += intopt.size; - } - } - - if (hdr->bfd_section != NULL) - { - const char *name = bfd_get_section_name (abfd, hdr->bfd_section); - - if (strcmp (name, ".sdata") == 0 - || strcmp (name, ".lit8") == 0 - || strcmp (name, ".lit4") == 0) - { - hdr->sh_flags |= SHF_ALLOC | SHF_WRITE | SHF_MIPS_GPREL; - hdr->sh_type = SHT_PROGBITS; - } - else if (strcmp (name, ".sbss") == 0) - { - hdr->sh_flags |= SHF_ALLOC | SHF_WRITE | SHF_MIPS_GPREL; - hdr->sh_type = SHT_NOBITS; - } - else if (strcmp (name, MIPS_ELF_SRDATA_SECTION_NAME (abfd)) == 0) - { - hdr->sh_flags |= SHF_ALLOC | SHF_MIPS_GPREL; - hdr->sh_type = SHT_PROGBITS; - } - else if (strcmp (name, ".compact_rel") == 0) - { - hdr->sh_flags = 0; - hdr->sh_type = SHT_PROGBITS; - } - else if (strcmp (name, ".rtproc") == 0) - { - if (hdr->sh_addralign != 0 && hdr->sh_entsize == 0) - { - unsigned int adjust; - - adjust = hdr->sh_size % hdr->sh_addralign; - if (adjust != 0) - hdr->sh_size += hdr->sh_addralign - adjust; - } - } - } - - return true; -} - -/* MIPS ELF uses two common sections. One is the usual one, and the - other is for small objects. All the small objects are kept - together, and then referenced via the gp pointer, which yields - faster assembler code. This is what we use for the small common - section. This approach is copied from ecoff.c. */ -static asection mips_elf_scom_section; -static asymbol mips_elf_scom_symbol; -static asymbol *mips_elf_scom_symbol_ptr; - -/* MIPS ELF also uses an acommon section, which represents an - allocated common symbol which may be overridden by a - definition in a shared library. */ -static asection mips_elf_acom_section; -static asymbol mips_elf_acom_symbol; -static asymbol *mips_elf_acom_symbol_ptr; - -/* Handle the special MIPS section numbers that a symbol may use. - This is used for both the 32-bit and the 64-bit ABI. */ - -void -_bfd_mips_elf_symbol_processing (abfd, asym) - bfd *abfd; - asymbol *asym; -{ - elf_symbol_type *elfsym; - - elfsym = (elf_symbol_type *) asym; - switch (elfsym->internal_elf_sym.st_shndx) - { - case SHN_MIPS_ACOMMON: - /* This section is used in a dynamically linked executable file. - It is an allocated common section. The dynamic linker can - either resolve these symbols to something in a shared - library, or it can just leave them here. For our purposes, - we can consider these symbols to be in a new section. */ - if (mips_elf_acom_section.name == NULL) - { - /* Initialize the acommon section. */ - mips_elf_acom_section.name = ".acommon"; - mips_elf_acom_section.flags = SEC_ALLOC; - mips_elf_acom_section.output_section = &mips_elf_acom_section; - mips_elf_acom_section.symbol = &mips_elf_acom_symbol; - mips_elf_acom_section.symbol_ptr_ptr = &mips_elf_acom_symbol_ptr; - mips_elf_acom_symbol.name = ".acommon"; - mips_elf_acom_symbol.flags = BSF_SECTION_SYM; - mips_elf_acom_symbol.section = &mips_elf_acom_section; - mips_elf_acom_symbol_ptr = &mips_elf_acom_symbol; - } - asym->section = &mips_elf_acom_section; - break; - - case SHN_COMMON: - /* Common symbols less than the GP size are automatically - treated as SHN_MIPS_SCOMMON symbols on IRIX5. */ - if (asym->value > elf_gp_size (abfd) - || IRIX_COMPAT (abfd) == ict_irix6) - break; - /* Fall through. */ - case SHN_MIPS_SCOMMON: - if (mips_elf_scom_section.name == NULL) - { - /* Initialize the small common section. */ - mips_elf_scom_section.name = ".scommon"; - mips_elf_scom_section.flags = SEC_IS_COMMON; - mips_elf_scom_section.output_section = &mips_elf_scom_section; - mips_elf_scom_section.symbol = &mips_elf_scom_symbol; - mips_elf_scom_section.symbol_ptr_ptr = &mips_elf_scom_symbol_ptr; - mips_elf_scom_symbol.name = ".scommon"; - mips_elf_scom_symbol.flags = BSF_SECTION_SYM; - mips_elf_scom_symbol.section = &mips_elf_scom_section; - mips_elf_scom_symbol_ptr = &mips_elf_scom_symbol; - } - asym->section = &mips_elf_scom_section; - asym->value = elfsym->internal_elf_sym.st_size; - break; - - case SHN_MIPS_SUNDEFINED: - asym->section = bfd_und_section_ptr; - break; - -#if 0 /* for SGI_COMPAT */ - case SHN_MIPS_TEXT: - asym->section = mips_elf_text_section_ptr; - break; - - case SHN_MIPS_DATA: - asym->section = mips_elf_data_section_ptr; - break; -#endif - } -} - -/* When creating an Irix 5 executable, we need REGINFO and RTPROC - segments. */ - -int -_bfd_mips_elf_additional_program_headers (abfd) - bfd *abfd; -{ - asection *s; - int ret = 0; - - /* See if we need a PT_MIPS_REGINFO segment. */ - s = bfd_get_section_by_name (abfd, ".reginfo"); - if (s && (s->flags & SEC_LOAD)) - ++ret; - - /* See if we need a PT_MIPS_OPTIONS segment. */ - if (IRIX_COMPAT (abfd) == ict_irix6 - && bfd_get_section_by_name (abfd, - MIPS_ELF_OPTIONS_SECTION_NAME (abfd))) - ++ret; - - /* See if we need a PT_MIPS_RTPROC segment. */ - if (IRIX_COMPAT (abfd) == ict_irix5 - && bfd_get_section_by_name (abfd, ".dynamic") - && bfd_get_section_by_name (abfd, ".mdebug")) - ++ret; - - return ret; -} - -/* Modify the segment map for an Irix 5 executable. */ - -boolean -_bfd_mips_elf_modify_segment_map (abfd) - bfd *abfd; -{ - asection *s; - struct elf_segment_map *m, **pm; - - /* If there is a .reginfo section, we need a PT_MIPS_REGINFO - segment. */ - s = bfd_get_section_by_name (abfd, ".reginfo"); - if (s != NULL && (s->flags & SEC_LOAD) != 0) - { - for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next) - if (m->p_type == PT_MIPS_REGINFO) - break; - if (m == NULL) - { - m = (struct elf_segment_map *) bfd_zalloc (abfd, sizeof *m); - if (m == NULL) - return false; - - m->p_type = PT_MIPS_REGINFO; - m->count = 1; - m->sections[0] = s; - - /* We want to put it after the PHDR and INTERP segments. */ - pm = &elf_tdata (abfd)->segment_map; - while (*pm != NULL - && ((*pm)->p_type == PT_PHDR - || (*pm)->p_type == PT_INTERP)) - pm = &(*pm)->next; - - m->next = *pm; - *pm = m; - } - } - - /* For IRIX 6, we don't have .mdebug sections, nor does anything but - .dynamic end up in PT_DYNAMIC. However, we do have to insert a - PT_OPTIONS segement immediately following the program header - table. */ - if (IRIX_COMPAT (abfd) == ict_irix6) - { - asection *s; - - for (s = abfd->sections; s; s = s->next) - if (elf_section_data (s)->this_hdr.sh_type == SHT_MIPS_OPTIONS) - break; - - if (s) - { - struct elf_segment_map *options_segment; - - /* Usually, there's a program header table. But, sometimes - there's not (like when running the `ld' testsuite). So, - if there's no program header table, we just put the - options segement at the end. */ - for (pm = &elf_tdata (abfd)->segment_map; - *pm != NULL; - pm = &(*pm)->next) - if ((*pm)->p_type == PT_PHDR) - break; - - options_segment = bfd_zalloc (abfd, - sizeof (struct elf_segment_map)); - options_segment->next = *pm; - options_segment->p_type = PT_MIPS_OPTIONS; - options_segment->p_flags = PF_R; - options_segment->p_flags_valid = true; - options_segment->count = 1; - options_segment->sections[0] = s; - *pm = options_segment; - } - } - else - { - if (IRIX_COMPAT (abfd) == ict_irix5) - { - /* If there are .dynamic and .mdebug sections, we make a room - for the RTPROC header. FIXME: Rewrite without section names. */ - if (bfd_get_section_by_name (abfd, ".interp") == NULL - && bfd_get_section_by_name (abfd, ".dynamic") != NULL - && bfd_get_section_by_name (abfd, ".mdebug") != NULL) - { - for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next) - if (m->p_type == PT_MIPS_RTPROC) - break; - if (m == NULL) - { - m = (struct elf_segment_map *) bfd_zalloc (abfd, sizeof *m); - if (m == NULL) - return false; - - m->p_type = PT_MIPS_RTPROC; - - s = bfd_get_section_by_name (abfd, ".rtproc"); - if (s == NULL) - { - m->count = 0; - m->p_flags = 0; - m->p_flags_valid = 1; - } - else - { - m->count = 1; - m->sections[0] = s; - } - - /* We want to put it after the DYNAMIC segment. */ - pm = &elf_tdata (abfd)->segment_map; - while (*pm != NULL && (*pm)->p_type != PT_DYNAMIC) - pm = &(*pm)->next; - if (*pm != NULL) - pm = &(*pm)->next; - - m->next = *pm; - *pm = m; - } - } - } - /* On Irix 5, the PT_DYNAMIC segment includes the .dynamic, - .dynstr, .dynsym, and .hash sections, and everything in - between. */ - for (pm = &elf_tdata (abfd)->segment_map; *pm != NULL; - pm = &(*pm)->next) - if ((*pm)->p_type == PT_DYNAMIC) - break; - m = *pm; - if (IRIX_COMPAT (abfd) == ict_none) - { - /* For a normal mips executable the permissions for the PT_DYNAMIC - segment are read, write and execute. We do that here since - the code in elf.c sets only the read permission. This matters - sometimes for the dynamic linker. */ - if (bfd_get_section_by_name (abfd, ".dynamic") != NULL) - { - m->p_flags = PF_R | PF_W | PF_X; - m->p_flags_valid = 1; - } - } - if (m != NULL - && m->count == 1 && strcmp (m->sections[0]->name, ".dynamic") == 0) - { - static const char *sec_names[] = - { - ".dynamic", ".dynstr", ".dynsym", ".hash" - }; - bfd_vma low, high; - unsigned int i, c; - struct elf_segment_map *n; - - low = 0xffffffff; - high = 0; - for (i = 0; i < sizeof sec_names / sizeof sec_names[0]; i++) - { - s = bfd_get_section_by_name (abfd, sec_names[i]); - if (s != NULL && (s->flags & SEC_LOAD) != 0) - { - bfd_size_type sz; - - if (low > s->vma) - low = s->vma; - sz = s->_cooked_size; - if (sz == 0) - sz = s->_raw_size; - if (high < s->vma + sz) - high = s->vma + sz; - } - } - - c = 0; - for (s = abfd->sections; s != NULL; s = s->next) - if ((s->flags & SEC_LOAD) != 0 - && s->vma >= low - && ((s->vma - + (s->_cooked_size != - 0 ? s->_cooked_size : s->_raw_size)) <= high)) - ++c; - - n = ((struct elf_segment_map *) - bfd_zalloc (abfd, sizeof *n + (c - 1) * sizeof (asection *))); - if (n == NULL) - return false; - *n = *m; - n->count = c; - - i = 0; - for (s = abfd->sections; s != NULL; s = s->next) - { - if ((s->flags & SEC_LOAD) != 0 - && s->vma >= low - && ((s->vma - + (s->_cooked_size != 0 ? - s->_cooked_size : s->_raw_size)) <= high)) - { - n->sections[i] = s; - ++i; - } - } - - *pm = n; - } - } - - return true; -} - -/* The structure of the runtime procedure descriptor created by the - loader for use by the static exception system. */ - -typedef struct runtime_pdr { - bfd_vma adr; /* memory address of start of procedure */ - long regmask; /* save register mask */ - long regoffset; /* save register offset */ - long fregmask; /* save floating point register mask */ - long fregoffset; /* save floating point register offset */ - long frameoffset; /* frame size */ - short framereg; /* frame pointer register */ - short pcreg; /* offset or reg of return pc */ - long irpss; /* index into the runtime string table */ - long reserved; - struct exception_info *exception_info;/* pointer to exception array */ -} RPDR, *pRPDR; -#define cbRPDR sizeof (RPDR) -#define rpdNil ((pRPDR) 0) - -/* Swap RPDR (runtime procedure table entry) for output. */ - -static void ecoff_swap_rpdr_out - PARAMS ((bfd *, const RPDR *, struct rpdr_ext *)); - -static void -ecoff_swap_rpdr_out (abfd, in, ex) - bfd *abfd; - const RPDR *in; - struct rpdr_ext *ex; -{ - /* ecoff_put_off was defined in ecoffswap.h. */ - ecoff_put_off (abfd, in->adr, (bfd_byte *) ex->p_adr); - bfd_h_put_32 (abfd, in->regmask, (bfd_byte *) ex->p_regmask); - bfd_h_put_32 (abfd, in->regoffset, (bfd_byte *) ex->p_regoffset); - bfd_h_put_32 (abfd, in->fregmask, (bfd_byte *) ex->p_fregmask); - bfd_h_put_32 (abfd, in->fregoffset, (bfd_byte *) ex->p_fregoffset); - bfd_h_put_32 (abfd, in->frameoffset, (bfd_byte *) ex->p_frameoffset); - - bfd_h_put_16 (abfd, in->framereg, (bfd_byte *) ex->p_framereg); - bfd_h_put_16 (abfd, in->pcreg, (bfd_byte *) ex->p_pcreg); - - bfd_h_put_32 (abfd, in->irpss, (bfd_byte *) ex->p_irpss); -#if 0 /* FIXME */ - ecoff_put_off (abfd, in->exception_info, (bfd_byte *) ex->p_exception_info); -#endif -} - -/* Read ECOFF debugging information from a .mdebug section into a - ecoff_debug_info structure. */ - -boolean -_bfd_mips_elf_read_ecoff_info (abfd, section, debug) - bfd *abfd; - asection *section; - struct ecoff_debug_info *debug; -{ - HDRR *symhdr; - const struct ecoff_debug_swap *swap; - char *ext_hdr = NULL; - - swap = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap; - memset (debug, 0, sizeof (*debug)); - - ext_hdr = (char *) bfd_malloc ((size_t) swap->external_hdr_size); - if (ext_hdr == NULL && swap->external_hdr_size != 0) - goto error_return; - - if (bfd_get_section_contents (abfd, section, ext_hdr, (file_ptr) 0, - swap->external_hdr_size) - == false) - goto error_return; - - symhdr = &debug->symbolic_header; - (*swap->swap_hdr_in) (abfd, ext_hdr, symhdr); - - /* The symbolic header contains absolute file offsets and sizes to - read. */ -#define READ(ptr, offset, count, size, type) \ - if (symhdr->count == 0) \ - debug->ptr = NULL; \ - else \ - { \ - debug->ptr = (type) bfd_malloc ((size_t) (size * symhdr->count)); \ - if (debug->ptr == NULL) \ - goto error_return; \ - if (bfd_seek (abfd, (file_ptr) symhdr->offset, SEEK_SET) != 0 \ - || (bfd_read (debug->ptr, size, symhdr->count, \ - abfd) != size * symhdr->count)) \ - goto error_return; \ - } - - READ (line, cbLineOffset, cbLine, sizeof (unsigned char), unsigned char *); - READ (external_dnr, cbDnOffset, idnMax, swap->external_dnr_size, PTR); - READ (external_pdr, cbPdOffset, ipdMax, swap->external_pdr_size, PTR); - READ (external_sym, cbSymOffset, isymMax, swap->external_sym_size, PTR); - READ (external_opt, cbOptOffset, ioptMax, swap->external_opt_size, PTR); - READ (external_aux, cbAuxOffset, iauxMax, sizeof (union aux_ext), - union aux_ext *); - READ (ss, cbSsOffset, issMax, sizeof (char), char *); - READ (ssext, cbSsExtOffset, issExtMax, sizeof (char), char *); - READ (external_fdr, cbFdOffset, ifdMax, swap->external_fdr_size, PTR); - READ (external_rfd, cbRfdOffset, crfd, swap->external_rfd_size, PTR); - READ (external_ext, cbExtOffset, iextMax, swap->external_ext_size, PTR); -#undef READ - - debug->fdr = NULL; - debug->adjust = NULL; - - return true; - - error_return: - if (ext_hdr != NULL) - free (ext_hdr); - if (debug->line != NULL) - free (debug->line); - if (debug->external_dnr != NULL) - free (debug->external_dnr); - if (debug->external_pdr != NULL) - free (debug->external_pdr); - if (debug->external_sym != NULL) - free (debug->external_sym); - if (debug->external_opt != NULL) - free (debug->external_opt); - if (debug->external_aux != NULL) - free (debug->external_aux); - if (debug->ss != NULL) - free (debug->ss); - if (debug->ssext != NULL) - free (debug->ssext); - if (debug->external_fdr != NULL) - free (debug->external_fdr); - if (debug->external_rfd != NULL) - free (debug->external_rfd); - if (debug->external_ext != NULL) - free (debug->external_ext); - return false; -} - -/* MIPS ELF local labels start with '$', not 'L'. */ - -static boolean -mips_elf_is_local_label_name (abfd, name) - bfd *abfd; - const char *name; -{ - if (name[0] == '$') - return true; - - /* On Irix 6, the labels go back to starting with '.', so we accept - the generic ELF local label syntax as well. */ - return _bfd_elf_is_local_label_name (abfd, name); -} - -/* MIPS ELF uses a special find_nearest_line routine in order the - handle the ECOFF debugging information. */ - -struct mips_elf_find_line -{ - struct ecoff_debug_info d; - struct ecoff_find_line i; -}; - -boolean -_bfd_mips_elf_find_nearest_line (abfd, section, symbols, offset, filename_ptr, - functionname_ptr, line_ptr) - bfd *abfd; - asection *section; - asymbol **symbols; - bfd_vma offset; - const char **filename_ptr; - const char **functionname_ptr; - unsigned int *line_ptr; -{ - asection *msec; - - if (_bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset, - filename_ptr, functionname_ptr, - line_ptr)) - return true; - - if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset, - filename_ptr, functionname_ptr, - line_ptr, - ABI_64_P (abfd) ? 8 : 0, - &elf_tdata (abfd)->dwarf2_find_line_info)) - return true; - - msec = bfd_get_section_by_name (abfd, ".mdebug"); - if (msec != NULL) - { - flagword origflags; - struct mips_elf_find_line *fi; - const struct ecoff_debug_swap * const swap = - get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap; - - /* If we are called during a link, mips_elf_final_link may have - cleared the SEC_HAS_CONTENTS field. We force it back on here - if appropriate (which it normally will be). */ - origflags = msec->flags; - if (elf_section_data (msec)->this_hdr.sh_type != SHT_NOBITS) - msec->flags |= SEC_HAS_CONTENTS; - - fi = elf_tdata (abfd)->find_line_info; - if (fi == NULL) - { - bfd_size_type external_fdr_size; - char *fraw_src; - char *fraw_end; - struct fdr *fdr_ptr; - - fi = ((struct mips_elf_find_line *) - bfd_zalloc (abfd, sizeof (struct mips_elf_find_line))); - if (fi == NULL) - { - msec->flags = origflags; - return false; - } - - if (! _bfd_mips_elf_read_ecoff_info (abfd, msec, &fi->d)) - { - msec->flags = origflags; - return false; - } - - /* Swap in the FDR information. */ - fi->d.fdr = ((struct fdr *) - bfd_alloc (abfd, - (fi->d.symbolic_header.ifdMax * - sizeof (struct fdr)))); - if (fi->d.fdr == NULL) - { - msec->flags = origflags; - return false; - } - external_fdr_size = swap->external_fdr_size; - fdr_ptr = fi->d.fdr; - fraw_src = (char *) fi->d.external_fdr; - fraw_end = (fraw_src - + fi->d.symbolic_header.ifdMax * external_fdr_size); - for (; fraw_src < fraw_end; fraw_src += external_fdr_size, fdr_ptr++) - (*swap->swap_fdr_in) (abfd, (PTR) fraw_src, fdr_ptr); - - elf_tdata (abfd)->find_line_info = fi; - - /* Note that we don't bother to ever free this information. - find_nearest_line is either called all the time, as in - objdump -l, so the information should be saved, or it is - rarely called, as in ld error messages, so the memory - wasted is unimportant. Still, it would probably be a - good idea for free_cached_info to throw it away. */ - } - - if (_bfd_ecoff_locate_line (abfd, section, offset, &fi->d, swap, - &fi->i, filename_ptr, functionname_ptr, - line_ptr)) - { - msec->flags = origflags; - return true; - } - - msec->flags = origflags; - } - - /* Fall back on the generic ELF find_nearest_line routine. */ - - return _bfd_elf_find_nearest_line (abfd, section, symbols, offset, - filename_ptr, functionname_ptr, - line_ptr); -} - - /* The mips16 compiler uses a couple of special sections to handle - floating point arguments. - - Section names that look like .mips16.fn.FNNAME contain stubs that - copy floating point arguments from the fp regs to the gp regs and - then jump to FNNAME. If any 32 bit function calls FNNAME, the - call should be redirected to the stub instead. If no 32 bit - function calls FNNAME, the stub should be discarded. We need to - consider any reference to the function, not just a call, because - if the address of the function is taken we will need the stub, - since the address might be passed to a 32 bit function. - - Section names that look like .mips16.call.FNNAME contain stubs - that copy floating point arguments from the gp regs to the fp - regs and then jump to FNNAME. If FNNAME is a 32 bit function, - then any 16 bit function that calls FNNAME should be redirected - to the stub instead. If FNNAME is not a 32 bit function, the - stub should be discarded. - - .mips16.call.fp.FNNAME sections are similar, but contain stubs - which call FNNAME and then copy the return value from the fp regs - to the gp regs. These stubs store the return value in $18 while - calling FNNAME; any function which might call one of these stubs - must arrange to save $18 around the call. (This case is not - needed for 32 bit functions that call 16 bit functions, because - 16 bit functions always return floating point values in both - $f0/$f1 and $2/$3.) - - Note that in all cases FNNAME might be defined statically. - Therefore, FNNAME is not used literally. Instead, the relocation - information will indicate which symbol the section is for. - - We record any stubs that we find in the symbol table. */ - -#define FN_STUB ".mips16.fn." -#define CALL_STUB ".mips16.call." -#define CALL_FP_STUB ".mips16.call.fp." - -/* MIPS ELF linker hash table. */ - -struct mips_elf_link_hash_table -{ - struct elf_link_hash_table root; -#if 0 - /* We no longer use this. */ - /* String section indices for the dynamic section symbols. */ - bfd_size_type dynsym_sec_strindex[SIZEOF_MIPS_DYNSYM_SECNAMES]; -#endif - /* The number of .rtproc entries. */ - bfd_size_type procedure_count; - /* The size of the .compact_rel section (if SGI_COMPAT). */ - bfd_size_type compact_rel_size; - /* This flag indicates that the value of DT_MIPS_RLD_MAP dynamic - entry is set to the address of __rld_obj_head as in Irix 5. */ - boolean use_rld_obj_head; - /* This is the value of the __rld_map or __rld_obj_head symbol. */ - bfd_vma rld_value; - /* This is set if we see any mips16 stub sections. */ - boolean mips16_stubs_seen; -}; - -/* Look up an entry in a MIPS ELF linker hash table. */ - -#define mips_elf_link_hash_lookup(table, string, create, copy, follow) \ - ((struct mips_elf_link_hash_entry *) \ - elf_link_hash_lookup (&(table)->root, (string), (create), \ - (copy), (follow))) - -/* Traverse a MIPS ELF linker hash table. */ - -#define mips_elf_link_hash_traverse(table, func, info) \ - (elf_link_hash_traverse \ - (&(table)->root, \ - (boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \ - (info))) - -/* Get the MIPS ELF linker hash table from a link_info structure. */ - -#define mips_elf_hash_table(p) \ - ((struct mips_elf_link_hash_table *) ((p)->hash)) - -static boolean mips_elf_output_extsym - PARAMS ((struct mips_elf_link_hash_entry *, PTR)); - -/* Create an entry in a MIPS ELF linker hash table. */ - -static struct bfd_hash_entry * -mips_elf_link_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; -{ - struct mips_elf_link_hash_entry *ret = - (struct mips_elf_link_hash_entry *) entry; - - /* Allocate the structure if it has not already been allocated by a - subclass. */ - if (ret == (struct mips_elf_link_hash_entry *) NULL) - ret = ((struct mips_elf_link_hash_entry *) - bfd_hash_allocate (table, - sizeof (struct mips_elf_link_hash_entry))); - if (ret == (struct mips_elf_link_hash_entry *) NULL) - return (struct bfd_hash_entry *) ret; - - /* Call the allocation method of the superclass. */ - ret = ((struct mips_elf_link_hash_entry *) - _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, - table, string)); - if (ret != (struct mips_elf_link_hash_entry *) NULL) - { - /* Set local fields. */ - memset (&ret->esym, 0, sizeof (EXTR)); - /* We use -2 as a marker to indicate that the information has - not been set. -1 means there is no associated ifd. */ - ret->esym.ifd = -2; - ret->possibly_dynamic_relocs = 0; - ret->readonly_reloc = false; - ret->min_dyn_reloc_index = 0; - ret->no_fn_stub = false; - ret->fn_stub = NULL; - ret->need_fn_stub = false; - ret->call_stub = NULL; - ret->call_fp_stub = NULL; - } - - return (struct bfd_hash_entry *) ret; -} - -static void -_bfd_mips_elf_hide_symbol (info, entry) - struct bfd_link_info *info; - struct elf_link_hash_entry *entry; -{ - bfd *dynobj; - asection *got; - struct mips_got_info *g; - struct mips_elf_link_hash_entry *h; - h = (struct mips_elf_link_hash_entry *) entry; - dynobj = elf_hash_table (info)->dynobj; - got = bfd_get_section_by_name (dynobj, ".got"); - g = (struct mips_got_info *) elf_section_data (got)->tdata; - - h->root.elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; - h->root.plt.offset = (bfd_vma) -1; - if ((h->root.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) - h->root.dynindx = -1; - - /* FIXME: Do we allocate too much GOT space here? */ - g->local_gotno++; - got->_raw_size += MIPS_ELF_GOT_SIZE (dynobj); -} - -/* Create a MIPS ELF linker hash table. */ - -struct bfd_link_hash_table * -_bfd_mips_elf_link_hash_table_create (abfd) - bfd *abfd; -{ - struct mips_elf_link_hash_table *ret; - - ret = ((struct mips_elf_link_hash_table *) - bfd_alloc (abfd, sizeof (struct mips_elf_link_hash_table))); - if (ret == (struct mips_elf_link_hash_table *) NULL) - return NULL; - - if (! _bfd_elf_link_hash_table_init (&ret->root, abfd, - mips_elf_link_hash_newfunc)) - { - bfd_release (abfd, ret); - return NULL; - } - -#if 0 - /* We no longer use this. */ - for (i = 0; i < SIZEOF_MIPS_DYNSYM_SECNAMES; i++) - ret->dynsym_sec_strindex[i] = (bfd_size_type) -1; -#endif - ret->procedure_count = 0; - ret->compact_rel_size = 0; - ret->use_rld_obj_head = false; - ret->rld_value = 0; - ret->mips16_stubs_seen = false; - - return &ret->root.root; -} - -/* Hook called by the linker routine which adds symbols from an object - file. We must handle the special MIPS section numbers here. */ - -boolean -_bfd_mips_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) - bfd *abfd; - struct bfd_link_info *info; - const Elf_Internal_Sym *sym; - const char **namep; - flagword *flagsp ATTRIBUTE_UNUSED; - asection **secp; - bfd_vma *valp; -{ - if (SGI_COMPAT (abfd) - && (abfd->flags & DYNAMIC) != 0 - && strcmp (*namep, "_rld_new_interface") == 0) - { - /* Skip Irix 5 rld entry name. */ - *namep = NULL; - return true; - } - - switch (sym->st_shndx) - { - case SHN_COMMON: - /* Common symbols less than the GP size are automatically - treated as SHN_MIPS_SCOMMON symbols. */ - if (sym->st_size > elf_gp_size (abfd) - || IRIX_COMPAT (abfd) == ict_irix6) - break; - /* Fall through. */ - case SHN_MIPS_SCOMMON: - *secp = bfd_make_section_old_way (abfd, ".scommon"); - (*secp)->flags |= SEC_IS_COMMON; - *valp = sym->st_size; - break; - - case SHN_MIPS_TEXT: - /* This section is used in a shared object. */ - if (elf_tdata (abfd)->elf_text_section == NULL) - { - asymbol *elf_text_symbol; - asection *elf_text_section; - - elf_text_section = bfd_zalloc (abfd, sizeof (asection)); - if (elf_text_section == NULL) - return false; - - elf_text_symbol = bfd_zalloc (abfd, sizeof (asymbol)); - if (elf_text_symbol == NULL) - return false; - - /* Initialize the section. */ - - elf_tdata (abfd)->elf_text_section = elf_text_section; - elf_tdata (abfd)->elf_text_symbol = elf_text_symbol; - - elf_text_section->symbol = elf_text_symbol; - elf_text_section->symbol_ptr_ptr = &elf_tdata (abfd)->elf_text_symbol; - - elf_text_section->name = ".text"; - elf_text_section->flags = SEC_NO_FLAGS; - elf_text_section->output_section = NULL; - elf_text_section->owner = abfd; - elf_text_symbol->name = ".text"; - elf_text_symbol->flags = BSF_SECTION_SYM | BSF_DYNAMIC; - elf_text_symbol->section = elf_text_section; - } - /* This code used to do *secp = bfd_und_section_ptr if - info->shared. I don't know why, and that doesn't make sense, - so I took it out. */ - *secp = elf_tdata (abfd)->elf_text_section; - break; - - case SHN_MIPS_ACOMMON: - /* Fall through. XXX Can we treat this as allocated data? */ - case SHN_MIPS_DATA: - /* This section is used in a shared object. */ - if (elf_tdata (abfd)->elf_data_section == NULL) - { - asymbol *elf_data_symbol; - asection *elf_data_section; - - elf_data_section = bfd_zalloc (abfd, sizeof (asection)); - if (elf_data_section == NULL) - return false; - - elf_data_symbol = bfd_zalloc (abfd, sizeof (asymbol)); - if (elf_data_symbol == NULL) - return false; - - /* Initialize the section. */ - - elf_tdata (abfd)->elf_data_section = elf_data_section; - elf_tdata (abfd)->elf_data_symbol = elf_data_symbol; - - elf_data_section->symbol = elf_data_symbol; - elf_data_section->symbol_ptr_ptr = &elf_tdata (abfd)->elf_data_symbol; - - elf_data_section->name = ".data"; - elf_data_section->flags = SEC_NO_FLAGS; - elf_data_section->output_section = NULL; - elf_data_section->owner = abfd; - elf_data_symbol->name = ".data"; - elf_data_symbol->flags = BSF_SECTION_SYM | BSF_DYNAMIC; - elf_data_symbol->section = elf_data_section; - } - /* This code used to do *secp = bfd_und_section_ptr if - info->shared. I don't know why, and that doesn't make sense, - so I took it out. */ - *secp = elf_tdata (abfd)->elf_data_section; - break; - - case SHN_MIPS_SUNDEFINED: - *secp = bfd_und_section_ptr; - break; - } - - if (SGI_COMPAT (abfd) - && ! info->shared - && info->hash->creator == abfd->xvec - && strcmp (*namep, "__rld_obj_head") == 0) - { - struct elf_link_hash_entry *h; - - /* Mark __rld_obj_head as dynamic. */ - h = NULL; - if (! (_bfd_generic_link_add_one_symbol - (info, abfd, *namep, BSF_GLOBAL, *secp, - (bfd_vma) *valp, (const char *) NULL, false, - get_elf_backend_data (abfd)->collect, - (struct bfd_link_hash_entry **) &h))) - return false; - h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - h->type = STT_OBJECT; - - if (! bfd_elf32_link_record_dynamic_symbol (info, h)) - return false; - - mips_elf_hash_table (info)->use_rld_obj_head = true; - } - - /* If this is a mips16 text symbol, add 1 to the value to make it - odd. This will cause something like .word SYM to come up with - the right value when it is loaded into the PC. */ - if (sym->st_other == STO_MIPS16) - ++*valp; - - return true; -} - -/* Structure used to pass information to mips_elf_output_extsym. */ - -struct extsym_info -{ - bfd *abfd; - struct bfd_link_info *info; - struct ecoff_debug_info *debug; - const struct ecoff_debug_swap *swap; - boolean failed; -}; - -/* This routine is used to write out ECOFF debugging external symbol - information. It is called via mips_elf_link_hash_traverse. The - ECOFF external symbol information must match the ELF external - symbol information. Unfortunately, at this point we don't know - whether a symbol is required by reloc information, so the two - tables may wind up being different. We must sort out the external - symbol information before we can set the final size of the .mdebug - section, and we must set the size of the .mdebug section before we - can relocate any sections, and we can't know which symbols are - required by relocation until we relocate the sections. - Fortunately, it is relatively unlikely that any symbol will be - stripped but required by a reloc. In particular, it can not happen - when generating a final executable. */ - -static boolean -mips_elf_output_extsym (h, data) - struct mips_elf_link_hash_entry *h; - PTR data; -{ - struct extsym_info *einfo = (struct extsym_info *) data; - boolean strip; - asection *sec, *output_section; - - if (h->root.indx == -2) - strip = false; - else if (((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - || (h->root.elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0) - && (h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0 - && (h->root.elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0) - strip = true; - else if (einfo->info->strip == strip_all - || (einfo->info->strip == strip_some - && bfd_hash_lookup (einfo->info->keep_hash, - h->root.root.root.string, - false, false) == NULL)) - strip = true; - else - strip = false; - - if (strip) - return true; - - if (h->esym.ifd == -2) - { - h->esym.jmptbl = 0; - h->esym.cobol_main = 0; - h->esym.weakext = 0; - h->esym.reserved = 0; - h->esym.ifd = ifdNil; - h->esym.asym.value = 0; - h->esym.asym.st = stGlobal; - - if (h->root.root.type == bfd_link_hash_undefined - || h->root.root.type == bfd_link_hash_undefweak) - { - const char *name; - - /* Use undefined class. Also, set class and type for some - special symbols. */ - name = h->root.root.root.string; - if (strcmp (name, mips_elf_dynsym_rtproc_names[0]) == 0 - || strcmp (name, mips_elf_dynsym_rtproc_names[1]) == 0) - { - h->esym.asym.sc = scData; - h->esym.asym.st = stLabel; - h->esym.asym.value = 0; - } - else if (strcmp (name, mips_elf_dynsym_rtproc_names[2]) == 0) - { - h->esym.asym.sc = scAbs; - h->esym.asym.st = stLabel; - h->esym.asym.value = - mips_elf_hash_table (einfo->info)->procedure_count; - } - else if (strcmp (name, "_gp_disp") == 0) - { - h->esym.asym.sc = scAbs; - h->esym.asym.st = stLabel; - h->esym.asym.value = elf_gp (einfo->abfd); - } - else - h->esym.asym.sc = scUndefined; - } - else if (h->root.root.type != bfd_link_hash_defined - && h->root.root.type != bfd_link_hash_defweak) - h->esym.asym.sc = scAbs; - else - { - const char *name; - - sec = h->root.root.u.def.section; - output_section = sec->output_section; - - /* When making a shared library and symbol h is the one from - the another shared library, OUTPUT_SECTION may be null. */ - if (output_section == NULL) - h->esym.asym.sc = scUndefined; - else - { - name = bfd_section_name (output_section->owner, output_section); - - if (strcmp (name, ".text") == 0) - h->esym.asym.sc = scText; - else if (strcmp (name, ".data") == 0) - h->esym.asym.sc = scData; - else if (strcmp (name, ".sdata") == 0) - h->esym.asym.sc = scSData; - else if (strcmp (name, ".rodata") == 0 - || strcmp (name, ".rdata") == 0) - h->esym.asym.sc = scRData; - else if (strcmp (name, ".bss") == 0) - h->esym.asym.sc = scBss; - else if (strcmp (name, ".sbss") == 0) - h->esym.asym.sc = scSBss; - else if (strcmp (name, ".init") == 0) - h->esym.asym.sc = scInit; - else if (strcmp (name, ".fini") == 0) - h->esym.asym.sc = scFini; - else - h->esym.asym.sc = scAbs; - } - } - - h->esym.asym.reserved = 0; - h->esym.asym.index = indexNil; - } - - if (h->root.root.type == bfd_link_hash_common) - h->esym.asym.value = h->root.root.u.c.size; - else if (h->root.root.type == bfd_link_hash_defined - || h->root.root.type == bfd_link_hash_defweak) - { - if (h->esym.asym.sc == scCommon) - h->esym.asym.sc = scBss; - else if (h->esym.asym.sc == scSCommon) - h->esym.asym.sc = scSBss; - - sec = h->root.root.u.def.section; - output_section = sec->output_section; - if (output_section != NULL) - h->esym.asym.value = (h->root.root.u.def.value - + sec->output_offset - + output_section->vma); - else - h->esym.asym.value = 0; - } - else if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) - { - struct mips_elf_link_hash_entry *hd = h; - boolean no_fn_stub = h->no_fn_stub; - - while (hd->root.root.type == bfd_link_hash_indirect) - { - hd = (struct mips_elf_link_hash_entry *)h->root.root.u.i.link; - no_fn_stub = no_fn_stub || hd->no_fn_stub; - } - - if (!no_fn_stub) - { - /* Set type and value for a symbol with a function stub. */ - h->esym.asym.st = stProc; - sec = hd->root.root.u.def.section; - if (sec == NULL) - h->esym.asym.value = 0; - else - { - output_section = sec->output_section; - if (output_section != NULL) - h->esym.asym.value = (hd->root.plt.offset - + sec->output_offset - + output_section->vma); - else - h->esym.asym.value = 0; - } -#if 0 /* FIXME? */ - h->esym.ifd = 0; -#endif - } - } - - if (! bfd_ecoff_debug_one_external (einfo->abfd, einfo->debug, einfo->swap, - h->root.root.root.string, - &h->esym)) - { - einfo->failed = true; - return false; - } - - return true; -} - -/* Create a runtime procedure table from the .mdebug section. */ - -static boolean -mips_elf_create_procedure_table (handle, abfd, info, s, debug) - PTR handle; - bfd *abfd; - struct bfd_link_info *info; - asection *s; - struct ecoff_debug_info *debug; -{ - const struct ecoff_debug_swap *swap; - HDRR *hdr = &debug->symbolic_header; - RPDR *rpdr, *rp; - struct rpdr_ext *erp; - PTR rtproc; - struct pdr_ext *epdr; - struct sym_ext *esym; - char *ss, **sv; - char *str; - unsigned long size, count; - unsigned long sindex; - unsigned long i; - PDR pdr; - SYMR sym; - const char *no_name_func = _("static procedure (no name)"); - - epdr = NULL; - rpdr = NULL; - esym = NULL; - ss = NULL; - sv = NULL; - - swap = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap; - - sindex = strlen (no_name_func) + 1; - count = hdr->ipdMax; - if (count > 0) - { - size = swap->external_pdr_size; - - epdr = (struct pdr_ext *) bfd_malloc (size * count); - if (epdr == NULL) - goto error_return; - - if (! _bfd_ecoff_get_accumulated_pdr (handle, (PTR) epdr)) - goto error_return; - - size = sizeof (RPDR); - rp = rpdr = (RPDR *) bfd_malloc (size * count); - if (rpdr == NULL) - goto error_return; - - sv = (char **) bfd_malloc (sizeof (char *) * count); - if (sv == NULL) - goto error_return; - - count = hdr->isymMax; - size = swap->external_sym_size; - esym = (struct sym_ext *) bfd_malloc (size * count); - if (esym == NULL) - goto error_return; - - if (! _bfd_ecoff_get_accumulated_sym (handle, (PTR) esym)) - goto error_return; - - count = hdr->issMax; - ss = (char *) bfd_malloc (count); - if (ss == NULL) - goto error_return; - if (! _bfd_ecoff_get_accumulated_ss (handle, (PTR) ss)) - goto error_return; - - count = hdr->ipdMax; - for (i = 0; i < count; i++, rp++) - { - (*swap->swap_pdr_in) (abfd, (PTR) (epdr + i), &pdr); - (*swap->swap_sym_in) (abfd, (PTR) &esym[pdr.isym], &sym); - rp->adr = sym.value; - rp->regmask = pdr.regmask; - rp->regoffset = pdr.regoffset; - rp->fregmask = pdr.fregmask; - rp->fregoffset = pdr.fregoffset; - rp->frameoffset = pdr.frameoffset; - rp->framereg = pdr.framereg; - rp->pcreg = pdr.pcreg; - rp->irpss = sindex; - sv[i] = ss + sym.iss; - sindex += strlen (sv[i]) + 1; - } - } - - size = sizeof (struct rpdr_ext) * (count + 2) + sindex; - size = BFD_ALIGN (size, 16); - rtproc = (PTR) bfd_alloc (abfd, size); - if (rtproc == NULL) - { - mips_elf_hash_table (info)->procedure_count = 0; - goto error_return; - } - - mips_elf_hash_table (info)->procedure_count = count + 2; - - erp = (struct rpdr_ext *) rtproc; - memset (erp, 0, sizeof (struct rpdr_ext)); - erp++; - str = (char *) rtproc + sizeof (struct rpdr_ext) * (count + 2); - strcpy (str, no_name_func); - str += strlen (no_name_func) + 1; - for (i = 0; i < count; i++) - { - ecoff_swap_rpdr_out (abfd, rpdr + i, erp + i); - strcpy (str, sv[i]); - str += strlen (sv[i]) + 1; - } - ecoff_put_off (abfd, (bfd_vma) -1, (bfd_byte *) (erp + count)->p_adr); - - /* Set the size and contents of .rtproc section. */ - s->_raw_size = size; - s->contents = (bfd_byte *) rtproc; - - /* Skip this section later on (I don't think this currently - matters, but someday it might). */ - s->link_order_head = (struct bfd_link_order *) NULL; - - if (epdr != NULL) - free (epdr); - if (rpdr != NULL) - free (rpdr); - if (esym != NULL) - free (esym); - if (ss != NULL) - free (ss); - if (sv != NULL) - free (sv); - - return true; - - error_return: - if (epdr != NULL) - free (epdr); - if (rpdr != NULL) - free (rpdr); - if (esym != NULL) - free (esym); - if (ss != NULL) - free (ss); - if (sv != NULL) - free (sv); - return false; -} - -/* A comparison routine used to sort .gptab entries. */ - -static int -gptab_compare (p1, p2) - const PTR p1; - const PTR p2; -{ - const Elf32_gptab *a1 = (const Elf32_gptab *) p1; - const Elf32_gptab *a2 = (const Elf32_gptab *) p2; - - return a1->gt_entry.gt_g_value - a2->gt_entry.gt_g_value; -} - -/* We need to use a special link routine to handle the .reginfo and - the .mdebug sections. We need to merge all instances of these - sections together, not write them all out sequentially. */ - -boolean -_bfd_mips_elf_final_link (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - asection **secpp; - asection *o; - struct bfd_link_order *p; - asection *reginfo_sec, *mdebug_sec, *gptab_data_sec, *gptab_bss_sec; - asection *rtproc_sec; - Elf32_RegInfo reginfo; - struct ecoff_debug_info debug; - const struct ecoff_debug_swap *swap - = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap; - HDRR *symhdr = &debug.symbolic_header; - PTR mdebug_handle = NULL; - asection *s; - EXTR esym; - bfd_vma last; - unsigned int i; - static const char * const name[] = - { - ".text", ".init", ".fini", ".data", - ".rodata", ".sdata", ".sbss", ".bss" - }; - static const int sc[] = - { - scText, scInit, scFini, scData, - scRData, scSData, scSBss, scBss - }; - - /* If all the things we linked together were PIC, but we're - producing an executable (rather than a shared object), then the - resulting file is CPIC (i.e., it calls PIC code.) */ - if (!info->shared - && !info->relocateable - && elf_elfheader (abfd)->e_flags & EF_MIPS_PIC) - { - elf_elfheader (abfd)->e_flags &= ~EF_MIPS_PIC; - elf_elfheader (abfd)->e_flags |= EF_MIPS_CPIC; - } - - /* We'd carefully arranged the dynamic symbol indices, and then the - generic size_dynamic_sections renumbered them out from under us. - Rather than trying somehow to prevent the renumbering, just do - the sort again. */ - if (elf_hash_table (info)->dynamic_sections_created) - { - bfd *dynobj; - asection *got; - struct mips_got_info *g; - - /* When we resort, we must tell mips_elf_sort_hash_table what - the lowest index it may use is. That's the number of section - symbols we're going to add. The generic ELF linker only - adds these symbols when building a shared object. Note that - we count the sections after (possibly) removing the .options - section above. */ - if (!mips_elf_sort_hash_table (info, (info->shared - ? bfd_count_sections (abfd) + 1 - : 1))) - return false; - - /* Make sure we didn't grow the global .got region. */ - dynobj = elf_hash_table (info)->dynobj; - got = bfd_get_section_by_name (dynobj, ".got"); - g = (struct mips_got_info *) elf_section_data (got)->tdata; - - if (g->global_gotsym != NULL) - BFD_ASSERT ((elf_hash_table (info)->dynsymcount - - g->global_gotsym->dynindx) - <= g->global_gotno); - } - - /* On IRIX5, we omit the .options section. On IRIX6, however, we - include it, even though we don't process it quite right. (Some - entries are supposed to be merged.) Empirically, we seem to be - better off including it then not. */ - if (IRIX_COMPAT (abfd) == ict_irix5 || IRIX_COMPAT (abfd) == ict_none) - for (secpp = &abfd->sections; *secpp != NULL; secpp = &(*secpp)->next) - { - if (strcmp ((*secpp)->name, MIPS_ELF_OPTIONS_SECTION_NAME (abfd)) == 0) - { - for (p = (*secpp)->link_order_head; p != NULL; p = p->next) - if (p->type == bfd_indirect_link_order) - p->u.indirect.section->flags &= ~SEC_HAS_CONTENTS; - (*secpp)->link_order_head = NULL; - *secpp = (*secpp)->next; - --abfd->section_count; - - break; - } - } - - /* Get a value for the GP register. */ - if (elf_gp (abfd) == 0) - { - struct bfd_link_hash_entry *h; - - h = bfd_link_hash_lookup (info->hash, "_gp", false, false, true); - if (h != (struct bfd_link_hash_entry *) NULL - && h->type == bfd_link_hash_defined) - elf_gp (abfd) = (h->u.def.value - + h->u.def.section->output_section->vma - + h->u.def.section->output_offset); - else if (info->relocateable) - { - bfd_vma lo; - - /* Find the GP-relative section with the lowest offset. */ - lo = (bfd_vma) -1; - for (o = abfd->sections; o != (asection *) NULL; o = o->next) - if (o->vma < lo - && (elf_section_data (o)->this_hdr.sh_flags & SHF_MIPS_GPREL)) - lo = o->vma; - - /* And calculate GP relative to that. */ - elf_gp (abfd) = lo + ELF_MIPS_GP_OFFSET (abfd); - } - else - { - /* If the relocate_section function needs to do a reloc - involving the GP value, it should make a reloc_dangerous - callback to warn that GP is not defined. */ - } - } - - /* Go through the sections and collect the .reginfo and .mdebug - information. */ - reginfo_sec = NULL; - mdebug_sec = NULL; - gptab_data_sec = NULL; - gptab_bss_sec = NULL; - for (o = abfd->sections; o != (asection *) NULL; o = o->next) - { - if (strcmp (o->name, ".reginfo") == 0) - { - memset (®info, 0, sizeof reginfo); - - /* We have found the .reginfo section in the output file. - Look through all the link_orders comprising it and merge - the information together. */ - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) - { - asection *input_section; - bfd *input_bfd; - Elf32_External_RegInfo ext; - Elf32_RegInfo sub; - - if (p->type != bfd_indirect_link_order) - { - if (p->type == bfd_fill_link_order) - continue; - abort (); - } - - input_section = p->u.indirect.section; - input_bfd = input_section->owner; - - /* The linker emulation code has probably clobbered the - size to be zero bytes. */ - if (input_section->_raw_size == 0) - input_section->_raw_size = sizeof (Elf32_External_RegInfo); - - if (! bfd_get_section_contents (input_bfd, input_section, - (PTR) &ext, - (file_ptr) 0, - sizeof ext)) - return false; - - bfd_mips_elf32_swap_reginfo_in (input_bfd, &ext, &sub); - - reginfo.ri_gprmask |= sub.ri_gprmask; - reginfo.ri_cprmask[0] |= sub.ri_cprmask[0]; - reginfo.ri_cprmask[1] |= sub.ri_cprmask[1]; - reginfo.ri_cprmask[2] |= sub.ri_cprmask[2]; - reginfo.ri_cprmask[3] |= sub.ri_cprmask[3]; - - /* ri_gp_value is set by the function - mips_elf32_section_processing when the section is - finally written out. */ - - /* Hack: reset the SEC_HAS_CONTENTS flag so that - elf_link_input_bfd ignores this section. */ - input_section->flags &= ~SEC_HAS_CONTENTS; - } - - /* Size has been set in mips_elf_always_size_sections */ - BFD_ASSERT(o->_raw_size == sizeof (Elf32_External_RegInfo)); - - /* Skip this section later on (I don't think this currently - matters, but someday it might). */ - o->link_order_head = (struct bfd_link_order *) NULL; - - reginfo_sec = o; - } - - if (strcmp (o->name, ".mdebug") == 0) - { - struct extsym_info einfo; - - /* We have found the .mdebug section in the output file. - Look through all the link_orders comprising it and merge - the information together. */ - symhdr->magic = swap->sym_magic; - /* FIXME: What should the version stamp be? */ - symhdr->vstamp = 0; - symhdr->ilineMax = 0; - symhdr->cbLine = 0; - symhdr->idnMax = 0; - symhdr->ipdMax = 0; - symhdr->isymMax = 0; - symhdr->ioptMax = 0; - symhdr->iauxMax = 0; - symhdr->issMax = 0; - symhdr->issExtMax = 0; - symhdr->ifdMax = 0; - symhdr->crfd = 0; - symhdr->iextMax = 0; - - /* We accumulate the debugging information itself in the - debug_info structure. */ - debug.line = NULL; - debug.external_dnr = NULL; - debug.external_pdr = NULL; - debug.external_sym = NULL; - debug.external_opt = NULL; - debug.external_aux = NULL; - debug.ss = NULL; - debug.ssext = debug.ssext_end = NULL; - debug.external_fdr = NULL; - debug.external_rfd = NULL; - debug.external_ext = debug.external_ext_end = NULL; - - mdebug_handle = bfd_ecoff_debug_init (abfd, &debug, swap, info); - if (mdebug_handle == (PTR) NULL) - return false; - - esym.jmptbl = 0; - esym.cobol_main = 0; - esym.weakext = 0; - esym.reserved = 0; - esym.ifd = ifdNil; - esym.asym.iss = issNil; - esym.asym.st = stLocal; - esym.asym.reserved = 0; - esym.asym.index = indexNil; - last = 0; - for (i = 0; i < 8; i++) - { - esym.asym.sc = sc[i]; - s = bfd_get_section_by_name (abfd, name[i]); - if (s != NULL) - { - esym.asym.value = s->vma; - last = s->vma + s->_raw_size; - } - else - esym.asym.value = last; - if (!bfd_ecoff_debug_one_external (abfd, &debug, swap, - name[i], &esym)) - return false; - } - - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) - { - asection *input_section; - bfd *input_bfd; - const struct ecoff_debug_swap *input_swap; - struct ecoff_debug_info input_debug; - char *eraw_src; - char *eraw_end; - - if (p->type != bfd_indirect_link_order) - { - if (p->type == bfd_fill_link_order) - continue; - abort (); - } - - input_section = p->u.indirect.section; - input_bfd = input_section->owner; - - if (bfd_get_flavour (input_bfd) != bfd_target_elf_flavour - || (get_elf_backend_data (input_bfd) - ->elf_backend_ecoff_debug_swap) == NULL) - { - /* I don't know what a non MIPS ELF bfd would be - doing with a .mdebug section, but I don't really - want to deal with it. */ - continue; - } - - input_swap = (get_elf_backend_data (input_bfd) - ->elf_backend_ecoff_debug_swap); - - BFD_ASSERT (p->size == input_section->_raw_size); - - /* The ECOFF linking code expects that we have already - read in the debugging information and set up an - ecoff_debug_info structure, so we do that now. */ - if (! _bfd_mips_elf_read_ecoff_info (input_bfd, input_section, - &input_debug)) - return false; - - if (! (bfd_ecoff_debug_accumulate - (mdebug_handle, abfd, &debug, swap, input_bfd, - &input_debug, input_swap, info))) - return false; - - /* Loop through the external symbols. For each one with - interesting information, try to find the symbol in - the linker global hash table and save the information - for the output external symbols. */ - eraw_src = input_debug.external_ext; - eraw_end = (eraw_src - + (input_debug.symbolic_header.iextMax - * input_swap->external_ext_size)); - for (; - eraw_src < eraw_end; - eraw_src += input_swap->external_ext_size) - { - EXTR ext; - const char *name; - struct mips_elf_link_hash_entry *h; - - (*input_swap->swap_ext_in) (input_bfd, (PTR) eraw_src, &ext); - if (ext.asym.sc == scNil - || ext.asym.sc == scUndefined - || ext.asym.sc == scSUndefined) - continue; - - name = input_debug.ssext + ext.asym.iss; - h = mips_elf_link_hash_lookup (mips_elf_hash_table (info), - name, false, false, true); - if (h == NULL || h->esym.ifd != -2) - continue; - - if (ext.ifd != -1) - { - BFD_ASSERT (ext.ifd - < input_debug.symbolic_header.ifdMax); - ext.ifd = input_debug.ifdmap[ext.ifd]; - } - - h->esym = ext; - } - - /* Free up the information we just read. */ - free (input_debug.line); - free (input_debug.external_dnr); - free (input_debug.external_pdr); - free (input_debug.external_sym); - free (input_debug.external_opt); - free (input_debug.external_aux); - free (input_debug.ss); - free (input_debug.ssext); - free (input_debug.external_fdr); - free (input_debug.external_rfd); - free (input_debug.external_ext); - - /* Hack: reset the SEC_HAS_CONTENTS flag so that - elf_link_input_bfd ignores this section. */ - input_section->flags &= ~SEC_HAS_CONTENTS; - } - - if (SGI_COMPAT (abfd) && info->shared) - { - /* Create .rtproc section. */ - rtproc_sec = bfd_get_section_by_name (abfd, ".rtproc"); - if (rtproc_sec == NULL) - { - flagword flags = (SEC_HAS_CONTENTS | SEC_IN_MEMORY - | SEC_LINKER_CREATED | SEC_READONLY); - - rtproc_sec = bfd_make_section (abfd, ".rtproc"); - if (rtproc_sec == NULL - || ! bfd_set_section_flags (abfd, rtproc_sec, flags) - || ! bfd_set_section_alignment (abfd, rtproc_sec, 4)) - return false; - } - - if (! mips_elf_create_procedure_table (mdebug_handle, abfd, - info, rtproc_sec, &debug)) - return false; - } - - /* Build the external symbol information. */ - einfo.abfd = abfd; - einfo.info = info; - einfo.debug = &debug; - einfo.swap = swap; - einfo.failed = false; - mips_elf_link_hash_traverse (mips_elf_hash_table (info), - mips_elf_output_extsym, - (PTR) &einfo); - if (einfo.failed) - return false; - - /* Set the size of the .mdebug section. */ - o->_raw_size = bfd_ecoff_debug_size (abfd, &debug, swap); - - /* Skip this section later on (I don't think this currently - matters, but someday it might). */ - o->link_order_head = (struct bfd_link_order *) NULL; - - mdebug_sec = o; - } - - if (strncmp (o->name, ".gptab.", sizeof ".gptab." - 1) == 0) - { - const char *subname; - unsigned int c; - Elf32_gptab *tab; - Elf32_External_gptab *ext_tab; - unsigned int i; - - /* The .gptab.sdata and .gptab.sbss sections hold - information describing how the small data area would - change depending upon the -G switch. These sections - not used in executables files. */ - if (! info->relocateable) - { - asection **secpp; - - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) - { - asection *input_section; - - if (p->type != bfd_indirect_link_order) - { - if (p->type == bfd_fill_link_order) - continue; - abort (); - } - - input_section = p->u.indirect.section; - - /* Hack: reset the SEC_HAS_CONTENTS flag so that - elf_link_input_bfd ignores this section. */ - input_section->flags &= ~SEC_HAS_CONTENTS; - } - - /* Skip this section later on (I don't think this - currently matters, but someday it might). */ - o->link_order_head = (struct bfd_link_order *) NULL; - - /* Really remove the section. */ - for (secpp = &abfd->sections; - *secpp != o; - secpp = &(*secpp)->next) - ; - *secpp = (*secpp)->next; - --abfd->section_count; - - continue; - } - - /* There is one gptab for initialized data, and one for - uninitialized data. */ - if (strcmp (o->name, ".gptab.sdata") == 0) - gptab_data_sec = o; - else if (strcmp (o->name, ".gptab.sbss") == 0) - gptab_bss_sec = o; - else - { - (*_bfd_error_handler) - (_("%s: illegal section name `%s'"), - bfd_get_filename (abfd), o->name); - bfd_set_error (bfd_error_nonrepresentable_section); - return false; - } - - /* The linker script always combines .gptab.data and - .gptab.sdata into .gptab.sdata, and likewise for - .gptab.bss and .gptab.sbss. It is possible that there is - no .sdata or .sbss section in the output file, in which - case we must change the name of the output section. */ - subname = o->name + sizeof ".gptab" - 1; - if (bfd_get_section_by_name (abfd, subname) == NULL) - { - if (o == gptab_data_sec) - o->name = ".gptab.data"; - else - o->name = ".gptab.bss"; - subname = o->name + sizeof ".gptab" - 1; - BFD_ASSERT (bfd_get_section_by_name (abfd, subname) != NULL); - } - - /* Set up the first entry. */ - c = 1; - tab = (Elf32_gptab *) bfd_malloc (c * sizeof (Elf32_gptab)); - if (tab == NULL) - return false; - tab[0].gt_header.gt_current_g_value = elf_gp_size (abfd); - tab[0].gt_header.gt_unused = 0; - - /* Combine the input sections. */ - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) - { - asection *input_section; - bfd *input_bfd; - bfd_size_type size; - unsigned long last; - bfd_size_type gpentry; - - if (p->type != bfd_indirect_link_order) - { - if (p->type == bfd_fill_link_order) - continue; - abort (); - } - - input_section = p->u.indirect.section; - input_bfd = input_section->owner; - - /* Combine the gptab entries for this input section one - by one. We know that the input gptab entries are - sorted by ascending -G value. */ - size = bfd_section_size (input_bfd, input_section); - last = 0; - for (gpentry = sizeof (Elf32_External_gptab); - gpentry < size; - gpentry += sizeof (Elf32_External_gptab)) - { - Elf32_External_gptab ext_gptab; - Elf32_gptab int_gptab; - unsigned long val; - unsigned long add; - boolean exact; - unsigned int look; - - if (! (bfd_get_section_contents - (input_bfd, input_section, (PTR) &ext_gptab, - gpentry, sizeof (Elf32_External_gptab)))) - { - free (tab); - return false; - } - - bfd_mips_elf32_swap_gptab_in (input_bfd, &ext_gptab, - &int_gptab); - val = int_gptab.gt_entry.gt_g_value; - add = int_gptab.gt_entry.gt_bytes - last; - - exact = false; - for (look = 1; look < c; look++) - { - if (tab[look].gt_entry.gt_g_value >= val) - tab[look].gt_entry.gt_bytes += add; - - if (tab[look].gt_entry.gt_g_value == val) - exact = true; - } - - if (! exact) - { - Elf32_gptab *new_tab; - unsigned int max; - - /* We need a new table entry. */ - new_tab = ((Elf32_gptab *) - bfd_realloc ((PTR) tab, - (c + 1) * sizeof (Elf32_gptab))); - if (new_tab == NULL) - { - free (tab); - return false; - } - tab = new_tab; - tab[c].gt_entry.gt_g_value = val; - tab[c].gt_entry.gt_bytes = add; - - /* Merge in the size for the next smallest -G - value, since that will be implied by this new - value. */ - max = 0; - for (look = 1; look < c; look++) - { - if (tab[look].gt_entry.gt_g_value < val - && (max == 0 - || (tab[look].gt_entry.gt_g_value - > tab[max].gt_entry.gt_g_value))) - max = look; - } - if (max != 0) - tab[c].gt_entry.gt_bytes += - tab[max].gt_entry.gt_bytes; - - ++c; - } - - last = int_gptab.gt_entry.gt_bytes; - } - - /* Hack: reset the SEC_HAS_CONTENTS flag so that - elf_link_input_bfd ignores this section. */ - input_section->flags &= ~SEC_HAS_CONTENTS; - } - - /* The table must be sorted by -G value. */ - if (c > 2) - qsort (tab + 1, c - 1, sizeof (tab[0]), gptab_compare); - - /* Swap out the table. */ - ext_tab = ((Elf32_External_gptab *) - bfd_alloc (abfd, c * sizeof (Elf32_External_gptab))); - if (ext_tab == NULL) - { - free (tab); - return false; - } - - for (i = 0; i < c; i++) - bfd_mips_elf32_swap_gptab_out (abfd, tab + i, ext_tab + i); - free (tab); - - o->_raw_size = c * sizeof (Elf32_External_gptab); - o->contents = (bfd_byte *) ext_tab; - - /* Skip this section later on (I don't think this currently - matters, but someday it might). */ - o->link_order_head = (struct bfd_link_order *) NULL; - } - } - - /* Invoke the regular ELF backend linker to do all the work. */ - if (ABI_64_P (abfd)) - { -#ifdef BFD64 - if (!bfd_elf64_bfd_final_link (abfd, info)) - return false; -#else - abort (); - return false; -#endif /* BFD64 */ - } - else if (!bfd_elf32_bfd_final_link (abfd, info)) - return false; - - /* Now write out the computed sections. */ - - if (reginfo_sec != (asection *) NULL) - { - Elf32_External_RegInfo ext; - - bfd_mips_elf32_swap_reginfo_out (abfd, ®info, &ext); - if (! bfd_set_section_contents (abfd, reginfo_sec, (PTR) &ext, - (file_ptr) 0, sizeof ext)) - return false; - } - - if (mdebug_sec != (asection *) NULL) - { - BFD_ASSERT (abfd->output_has_begun); - if (! bfd_ecoff_write_accumulated_debug (mdebug_handle, abfd, &debug, - swap, info, - mdebug_sec->filepos)) - return false; - - bfd_ecoff_debug_free (mdebug_handle, abfd, &debug, swap, info); - } - - if (gptab_data_sec != (asection *) NULL) - { - if (! bfd_set_section_contents (abfd, gptab_data_sec, - gptab_data_sec->contents, - (file_ptr) 0, - gptab_data_sec->_raw_size)) - return false; - } - - if (gptab_bss_sec != (asection *) NULL) - { - if (! bfd_set_section_contents (abfd, gptab_bss_sec, - gptab_bss_sec->contents, - (file_ptr) 0, - gptab_bss_sec->_raw_size)) - return false; - } - - if (SGI_COMPAT (abfd)) - { - rtproc_sec = bfd_get_section_by_name (abfd, ".rtproc"); - if (rtproc_sec != NULL) - { - if (! bfd_set_section_contents (abfd, rtproc_sec, - rtproc_sec->contents, - (file_ptr) 0, - rtproc_sec->_raw_size)) - return false; - } - } - - return true; -} - -/* This function is called via qsort() to sort the dynamic relocation - entries by increasing r_symndx value. */ - -static int -sort_dynamic_relocs (arg1, arg2) - const PTR arg1; - const PTR arg2; -{ - const Elf32_External_Rel *ext_reloc1 = (const Elf32_External_Rel *) arg1; - const Elf32_External_Rel *ext_reloc2 = (const Elf32_External_Rel *) arg2; - - Elf_Internal_Rel int_reloc1; - Elf_Internal_Rel int_reloc2; - - bfd_elf32_swap_reloc_in (reldyn_sorting_bfd, ext_reloc1, &int_reloc1); - bfd_elf32_swap_reloc_in (reldyn_sorting_bfd, ext_reloc2, &int_reloc2); - - return (ELF32_R_SYM (int_reloc1.r_info) - ELF32_R_SYM (int_reloc2.r_info)); -} - -/* Returns the GOT section for ABFD. */ - -static asection * -mips_elf_got_section (abfd) - bfd *abfd; -{ - return bfd_get_section_by_name (abfd, ".got"); -} - -/* Returns the GOT information associated with the link indicated by - INFO. If SGOTP is non-NULL, it is filled in with the GOT - section. */ - -static struct mips_got_info * -mips_elf_got_info (abfd, sgotp) - bfd *abfd; - asection **sgotp; -{ - asection *sgot; - struct mips_got_info *g; - - sgot = mips_elf_got_section (abfd); - BFD_ASSERT (sgot != NULL); - BFD_ASSERT (elf_section_data (sgot) != NULL); - g = (struct mips_got_info *) elf_section_data (sgot)->tdata; - BFD_ASSERT (g != NULL); - - if (sgotp) - *sgotp = sgot; - return g; -} - -/* Return whether a relocation is against a local symbol. */ - -static boolean -mips_elf_local_relocation_p (input_bfd, relocation, local_sections, - check_forced) - bfd *input_bfd; - const Elf_Internal_Rela *relocation; - asection **local_sections; - boolean check_forced; -{ - unsigned long r_symndx; - Elf_Internal_Shdr *symtab_hdr; - struct mips_elf_link_hash_entry *h; - size_t extsymoff; - - r_symndx = ELF32_R_SYM (relocation->r_info); - symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; - extsymoff = (elf_bad_symtab (input_bfd)) ? 0 : symtab_hdr->sh_info; - - if (r_symndx < extsymoff) - return true; - if (elf_bad_symtab (input_bfd) && local_sections[r_symndx] != NULL) - return true; - - if (check_forced) - { - /* Look up the hash table to check whether the symbol - was forced local. */ - h = (struct mips_elf_link_hash_entry *) - elf_sym_hashes (input_bfd) [r_symndx - extsymoff]; - /* Find the real hash-table entry for this symbol. */ - while (h->root.root.type == bfd_link_hash_indirect - || h->root.root.type == bfd_link_hash_warning) - h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link; - if ((h->root.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) - return true; - } - - return false; -} - -/* Sign-extend VALUE, which has the indicated number of BITS. */ - -static bfd_vma -mips_elf_sign_extend (value, bits) - bfd_vma value; - int bits; -{ - if (value & ((bfd_vma) 1 << (bits - 1))) - /* VALUE is negative. */ - value |= ((bfd_vma) - 1) << bits; - - return value; -} - -/* Return non-zero if the indicated VALUE has overflowed the maximum - range expressable by a signed number with the indicated number of - BITS. */ - -static boolean -mips_elf_overflow_p (value, bits) - bfd_vma value; - int bits; -{ - bfd_signed_vma svalue = (bfd_signed_vma) value; - - if (svalue > (1 << (bits - 1)) - 1) - /* The value is too big. */ - return true; - else if (svalue < -(1 << (bits - 1))) - /* The value is too small. */ - return true; - - /* All is well. */ - return false; -} - -/* Calculate the %high function. */ - -static bfd_vma -mips_elf_high (value) - bfd_vma value; -{ - return ((value + (bfd_vma) 0x8000) >> 16) & 0xffff; -} - -/* Calculate the %higher function. */ - -static bfd_vma -mips_elf_higher (value) - bfd_vma value ATTRIBUTE_UNUSED; -{ -#ifdef BFD64 - return ((value + (bfd_vma) 0x80008000) >> 32) & 0xffff; -#else - abort (); - return (bfd_vma) -1; -#endif -} - -/* Calculate the %highest function. */ - -static bfd_vma -mips_elf_highest (value) - bfd_vma value ATTRIBUTE_UNUSED; -{ -#ifdef BFD64 - return ((value + (bfd_vma) 0x800080008000) >> 48) & 0xffff; -#else - abort (); - return (bfd_vma) -1; -#endif -} - -/* Returns the GOT index for the global symbol indicated by H. */ - -static bfd_vma -mips_elf_global_got_index (abfd, h) - bfd *abfd; - struct elf_link_hash_entry *h; -{ - bfd_vma index; - asection *sgot; - struct mips_got_info *g; - - g = mips_elf_got_info (abfd, &sgot); - - /* Once we determine the global GOT entry with the lowest dynamic - symbol table index, we must put all dynamic symbols with greater - indices into the GOT. That makes it easy to calculate the GOT - offset. */ - BFD_ASSERT (h->dynindx >= g->global_gotsym->dynindx); - index = ((h->dynindx - g->global_gotsym->dynindx + g->local_gotno) - * MIPS_ELF_GOT_SIZE (abfd)); - BFD_ASSERT (index < sgot->_raw_size); - - return index; -} - -/* Returns the offset for the entry at the INDEXth position - in the GOT. */ - -static bfd_vma -mips_elf_got_offset_from_index (dynobj, output_bfd, index) - bfd *dynobj; - bfd *output_bfd; - bfd_vma index; -{ - asection *sgot; - bfd_vma gp; - - sgot = mips_elf_got_section (dynobj); - gp = _bfd_get_gp_value (output_bfd); - return (sgot->output_section->vma + sgot->output_offset + index - - gp); -} - -/* If H is a symbol that needs a global GOT entry, but has a dynamic - symbol table index lower than any we've seen to date, record it for - posterity. */ - -static boolean -mips_elf_record_global_got_symbol (h, info, g) - struct elf_link_hash_entry *h; - struct bfd_link_info *info; - struct mips_got_info *g ATTRIBUTE_UNUSED; -{ - /* A global symbol in the GOT must also be in the dynamic symbol - table. */ - if (h->dynindx == -1 - && !bfd_elf32_link_record_dynamic_symbol (info, h)) - return false; - - /* If we've already marked this entry as need GOT space, we don't - need to do it again. */ - if (h->got.offset != (bfd_vma) - 1) - return true; - - /* By setting this to a value other than -1, we are indicating that - there needs to be a GOT entry for H. */ - h->got.offset = 0; - - return true; -} - -/* This structure is passed to mips_elf_sort_hash_table_f when sorting - the dynamic symbols. */ - -struct mips_elf_hash_sort_data -{ - /* The symbol in the global GOT with the lowest dynamic symbol table - index. */ - struct elf_link_hash_entry *low; - /* The least dynamic symbol table index corresponding to a symbol - with a GOT entry. */ - long min_got_dynindx; - /* The greatest dynamic symbol table index not corresponding to a - symbol without a GOT entry. */ - long max_non_got_dynindx; -}; - -/* If H needs a GOT entry, assign it the highest available dynamic - index. Otherwise, assign it the lowest available dynamic - index. */ - -static boolean -mips_elf_sort_hash_table_f (h, data) - struct mips_elf_link_hash_entry *h; - PTR data; -{ - struct mips_elf_hash_sort_data *hsd - = (struct mips_elf_hash_sort_data *) data; - - /* Symbols without dynamic symbol table entries aren't interesting - at all. */ - if (h->root.dynindx == -1) - return true; - - if (h->root.got.offset != 0) - h->root.dynindx = hsd->max_non_got_dynindx++; - else - { - h->root.dynindx = --hsd->min_got_dynindx; - hsd->low = (struct elf_link_hash_entry *) h; - } - - return true; -} - -/* Sort the dynamic symbol table so that symbols that need GOT entries - appear towards the end. This reduces the amount of GOT space - required. MAX_LOCAL is used to set the number of local symbols - known to be in the dynamic symbol table. During - mips_elf_size_dynamic_sections, this value is 1. Afterward, the - section symbols are added and the count is higher. */ - -static boolean -mips_elf_sort_hash_table (info, max_local) - struct bfd_link_info *info; - unsigned long max_local; -{ - struct mips_elf_hash_sort_data hsd; - struct mips_got_info *g; - bfd *dynobj; - - dynobj = elf_hash_table (info)->dynobj; - - hsd.low = NULL; - hsd.min_got_dynindx = elf_hash_table (info)->dynsymcount; - hsd.max_non_got_dynindx = max_local; - mips_elf_link_hash_traverse (((struct mips_elf_link_hash_table *) - elf_hash_table (info)), - mips_elf_sort_hash_table_f, - &hsd); - - /* There shoud have been enough room in the symbol table to - accomodate both the GOT and non-GOT symbols. */ - BFD_ASSERT (hsd.max_non_got_dynindx <= hsd.min_got_dynindx); - - /* Now we know which dynamic symbol has the lowest dynamic symbol - table index in the GOT. */ - g = mips_elf_got_info (dynobj, NULL); - g->global_gotsym = hsd.low; - - return true; -} - -/* Create a local GOT entry for VALUE. Return the index of the entry, - or -1 if it could not be created. */ - -static bfd_vma -mips_elf_create_local_got_entry (abfd, g, sgot, value) - bfd *abfd; - struct mips_got_info *g; - asection *sgot; - bfd_vma value; -{ - if (g->assigned_gotno >= g->local_gotno) - { - /* We didn't allocate enough space in the GOT. */ - (*_bfd_error_handler) - (_("not enough GOT space for local GOT entries")); - bfd_set_error (bfd_error_bad_value); - return (bfd_vma) -1; - } - - MIPS_ELF_PUT_WORD (abfd, value, - (sgot->contents - + MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno)); - return MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno++; -} - -/* Returns the GOT offset at which the indicated address can be found. - If there is not yet a GOT entry for this value, create one. Returns - -1 if no satisfactory GOT offset can be found. */ - -static bfd_vma -mips_elf_local_got_index (abfd, info, value) - bfd *abfd; - struct bfd_link_info *info; - bfd_vma value; -{ - asection *sgot; - struct mips_got_info *g; - bfd_byte *entry; - - g = mips_elf_got_info (elf_hash_table (info)->dynobj, &sgot); - - /* Look to see if we already have an appropriate entry. */ - for (entry = (sgot->contents - + MIPS_ELF_GOT_SIZE (abfd) * MIPS_RESERVED_GOTNO); - entry != sgot->contents + MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno; - entry += MIPS_ELF_GOT_SIZE (abfd)) - { - bfd_vma address = MIPS_ELF_GET_WORD (abfd, entry); - if (address == value) - return entry - sgot->contents; - } - - return mips_elf_create_local_got_entry (abfd, g, sgot, value); -} - -/* Find a GOT entry that is within 32KB of the VALUE. These entries - are supposed to be placed at small offsets in the GOT, i.e., - within 32KB of GP. Return the index into the GOT for this page, - and store the offset from this entry to the desired address in - OFFSETP, if it is non-NULL. */ - -static bfd_vma -mips_elf_got_page (abfd, info, value, offsetp) - bfd *abfd; - struct bfd_link_info *info; - bfd_vma value; - bfd_vma *offsetp; -{ - asection *sgot; - struct mips_got_info *g; - bfd_byte *entry; - bfd_byte *last_entry; - bfd_vma index = 0; - bfd_vma address; - - g = mips_elf_got_info (elf_hash_table (info)->dynobj, &sgot); - - /* Look to see if we aleady have an appropriate entry. */ - last_entry = sgot->contents + MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno; - for (entry = (sgot->contents - + MIPS_ELF_GOT_SIZE (abfd) * MIPS_RESERVED_GOTNO); - entry != last_entry; - entry += MIPS_ELF_GOT_SIZE (abfd)) - { - address = MIPS_ELF_GET_WORD (abfd, entry); - - if (!mips_elf_overflow_p (value - address, 16)) - { - /* This entry will serve as the page pointer. We can add a - 16-bit number to it to get the actual address. */ - index = entry - sgot->contents; - break; - } - } - - /* If we didn't have an appropriate entry, we create one now. */ - if (entry == last_entry) - index = mips_elf_create_local_got_entry (abfd, g, sgot, value); - - if (offsetp) - { - address = MIPS_ELF_GET_WORD (abfd, entry); - *offsetp = value - address; - } - - return index; -} - -/* Find a GOT entry whose higher-order 16 bits are the same as those - for value. Return the index into the GOT for this entry. */ - -static bfd_vma -mips_elf_got16_entry (abfd, info, value, external) - bfd *abfd; - struct bfd_link_info *info; - bfd_vma value; - boolean external; -{ - asection *sgot; - struct mips_got_info *g; - bfd_byte *entry; - bfd_byte *last_entry; - bfd_vma index = 0; - bfd_vma address; - - if (! external) - { - /* Although the ABI says that it is "the high-order 16 bits" that we - want, it is really the %high value. The complete value is - calculated with a `addiu' of a LO16 relocation, just as with a - HI16/LO16 pair. */ - value = mips_elf_high (value) << 16; - } - - g = mips_elf_got_info (elf_hash_table (info)->dynobj, &sgot); - - /* Look to see if we already have an appropriate entry. */ - last_entry = sgot->contents + MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno; - for (entry = (sgot->contents - + MIPS_ELF_GOT_SIZE (abfd) * MIPS_RESERVED_GOTNO); - entry != last_entry; - entry += MIPS_ELF_GOT_SIZE (abfd)) - { - address = MIPS_ELF_GET_WORD (abfd, entry); - if (address == value) - { - /* This entry has the right high-order 16 bits, and the low-order - 16 bits are set to zero. */ - index = entry - sgot->contents; - break; - } - } - - /* If we didn't have an appropriate entry, we create one now. */ - if (entry == last_entry) - index = mips_elf_create_local_got_entry (abfd, g, sgot, value); - - return index; -} - -/* Returns the first relocation of type r_type found, beginning with - RELOCATION. RELEND is one-past-the-end of the relocation table. */ - -static const Elf_Internal_Rela * -mips_elf_next_relocation (r_type, relocation, relend) - unsigned int r_type; - const Elf_Internal_Rela *relocation; - const Elf_Internal_Rela *relend; -{ - /* According to the MIPS ELF ABI, the R_MIPS_LO16 relocation must be - immediately following. However, for the IRIX6 ABI, the next - relocation may be a composed relocation consisting of several - relocations for the same address. In that case, the R_MIPS_LO16 - relocation may occur as one of these. We permit a similar - extension in general, as that is useful for GCC. */ - while (relocation < relend) - { - if (ELF32_R_TYPE (relocation->r_info) == r_type) - return relocation; - - ++relocation; - } - - /* We didn't find it. */ - bfd_set_error (bfd_error_bad_value); - return NULL; -} - -/* Create a rel.dyn relocation for the dynamic linker to resolve. REL - is the original relocation, which is now being transformed into a - dynamic relocation. The ADDENDP is adjusted if necessary; the - caller should store the result in place of the original addend. */ - -static boolean -mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec, - symbol, addendp, input_section) - bfd *output_bfd; - struct bfd_link_info *info; - const Elf_Internal_Rela *rel; - struct mips_elf_link_hash_entry *h; - asection *sec; - bfd_vma symbol; - bfd_vma *addendp; - asection *input_section; -{ - Elf_Internal_Rel outrel; - boolean skip; - asection *sreloc; - bfd *dynobj; - int r_type; - - r_type = ELF32_R_TYPE (rel->r_info); - dynobj = elf_hash_table (info)->dynobj; - sreloc - = bfd_get_section_by_name (dynobj, - MIPS_ELF_REL_DYN_SECTION_NAME (output_bfd)); - BFD_ASSERT (sreloc != NULL); - BFD_ASSERT (sreloc->contents != NULL); - BFD_ASSERT (sreloc->reloc_count * MIPS_ELF_REL_SIZE (output_bfd) - < sreloc->_raw_size); - - skip = false; - - /* We begin by assuming that the offset for the dynamic relocation - is the same as for the original relocation. We'll adjust this - later to reflect the correct output offsets. */ - if (elf_section_data (input_section)->stab_info == NULL) - outrel.r_offset = rel->r_offset; - else - { - /* Except that in a stab section things are more complex. - Because we compress stab information, the offset given in the - relocation may not be the one we want; we must let the stabs - machinery tell us the offset. */ - outrel.r_offset - = (_bfd_stab_section_offset - (output_bfd, &elf_hash_table (info)->stab_info, - input_section, - &elf_section_data (input_section)->stab_info, - rel->r_offset)); - /* If we didn't need the relocation at all, this value will be - -1. */ - if (outrel.r_offset == (bfd_vma) -1) - skip = true; - } - - /* If we've decided to skip this relocation, just output an empty - record. Note that R_MIPS_NONE == 0, so that this call to memset - is a way of setting R_TYPE to R_MIPS_NONE. */ - if (skip) - memset (&outrel, 0, sizeof (outrel)); - else - { - long indx; - bfd_vma section_offset; - - /* We must now calculate the dynamic symbol table index to use - in the relocation. */ - if (h != NULL - && (! info->symbolic || (h->root.elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)) - { - indx = h->root.dynindx; - /* h->root.dynindx may be -1 if this symbol was marked to - become local. */ - if (indx == -1) - indx = 0; - } - else - { - if (sec != NULL && bfd_is_abs_section (sec)) - indx = 0; - else if (sec == NULL || sec->owner == NULL) - { - bfd_set_error (bfd_error_bad_value); - return false; - } - else - { - indx = elf_section_data (sec->output_section)->dynindx; - if (indx == 0) - abort (); - } - - /* Figure out how far the target of the relocation is from - the beginning of its section. */ - section_offset = symbol - sec->output_section->vma; - /* The relocation we're building is section-relative. - Therefore, the original addend must be adjusted by the - section offset. */ - *addendp += section_offset; - /* Now, the relocation is just against the section. */ - symbol = sec->output_section->vma; - } - - /* If the relocation was previously an absolute relocation and - this symbol will not be referred to by the relocation, we must - adjust it by the value we give it in the dynamic symbol table. - Otherwise leave the job up to the dynamic linker. */ - if (!indx && r_type != R_MIPS_REL32) - *addendp += symbol; - - /* The relocation is always an REL32 relocation because we don't - know where the shared library will wind up at load-time. */ - outrel.r_info = ELF32_R_INFO (indx, R_MIPS_REL32); - - /* Adjust the output offset of the relocation to reference the - correct location in the output file. */ - outrel.r_offset += (input_section->output_section->vma - + input_section->output_offset); - } - - /* Put the relocation back out. We have to use the special - relocation outputter in the 64-bit case since the 64-bit - relocation format is non-standard. */ - if (ABI_64_P (output_bfd)) - { - (*get_elf_backend_data (output_bfd)->s->swap_reloc_out) - (output_bfd, &outrel, - (sreloc->contents - + sreloc->reloc_count * sizeof (Elf64_Mips_External_Rel))); - } - else - bfd_elf32_swap_reloc_out (output_bfd, &outrel, - (((Elf32_External_Rel *) - sreloc->contents) - + sreloc->reloc_count)); - - /* Record the index of the first relocation referencing H. This - information is later emitted in the .msym section. */ - if (h != NULL - && (h->min_dyn_reloc_index == 0 - || sreloc->reloc_count < h->min_dyn_reloc_index)) - h->min_dyn_reloc_index = sreloc->reloc_count; - - /* We've now added another relocation. */ - ++sreloc->reloc_count; - - /* Make sure the output section is writable. The dynamic linker - will be writing to it. */ - elf_section_data (input_section->output_section)->this_hdr.sh_flags - |= SHF_WRITE; - - /* On IRIX5, make an entry of compact relocation info. */ - if (! skip && IRIX_COMPAT (output_bfd) == ict_irix5) - { - asection *scpt = bfd_get_section_by_name (dynobj, ".compact_rel"); - bfd_byte *cr; - - if (scpt) - { - Elf32_crinfo cptrel; - - mips_elf_set_cr_format (cptrel, CRF_MIPS_LONG); - cptrel.vaddr = (rel->r_offset - + input_section->output_section->vma - + input_section->output_offset); - if (r_type == R_MIPS_REL32) - mips_elf_set_cr_type (cptrel, CRT_MIPS_REL32); - else - mips_elf_set_cr_type (cptrel, CRT_MIPS_WORD); - mips_elf_set_cr_dist2to (cptrel, 0); - cptrel.konst = *addendp; - - cr = (scpt->contents - + sizeof (Elf32_External_compact_rel)); - bfd_elf32_swap_crinfo_out (output_bfd, &cptrel, - ((Elf32_External_crinfo *) cr - + scpt->reloc_count)); - ++scpt->reloc_count; - } - } - - return true; -} - -/* Calculate the value produced by the RELOCATION (which comes from - the INPUT_BFD). The ADDEND is the addend to use for this - RELOCATION; RELOCATION->R_ADDEND is ignored. - - The result of the relocation calculation is stored in VALUEP. - REQUIRE_JALXP indicates whether or not the opcode used with this - relocation must be JALX. - - This function returns bfd_reloc_continue if the caller need take no - further action regarding this relocation, bfd_reloc_notsupported if - something goes dramatically wrong, bfd_reloc_overflow if an - overflow occurs, and bfd_reloc_ok to indicate success. */ - -static bfd_reloc_status_type -mips_elf_calculate_relocation (abfd, - input_bfd, - input_section, - info, - relocation, - addend, - howto, - local_syms, - local_sections, - valuep, - namep, - require_jalxp) - bfd *abfd; - bfd *input_bfd; - asection *input_section; - struct bfd_link_info *info; - const Elf_Internal_Rela *relocation; - bfd_vma addend; - reloc_howto_type *howto; - Elf_Internal_Sym *local_syms; - asection **local_sections; - bfd_vma *valuep; - const char **namep; - boolean *require_jalxp; -{ - /* The eventual value we will return. */ - bfd_vma value; - /* The address of the symbol against which the relocation is - occurring. */ - bfd_vma symbol = 0; - /* The final GP value to be used for the relocatable, executable, or - shared object file being produced. */ - bfd_vma gp = (bfd_vma) - 1; - /* The place (section offset or address) of the storage unit being - relocated. */ - bfd_vma p; - /* The value of GP used to create the relocatable object. */ - bfd_vma gp0 = (bfd_vma) - 1; - /* The offset into the global offset table at which the address of - the relocation entry symbol, adjusted by the addend, resides - during execution. */ - bfd_vma g = (bfd_vma) - 1; - /* The section in which the symbol referenced by the relocation is - located. */ - asection *sec = NULL; - struct mips_elf_link_hash_entry *h = NULL; - /* True if the symbol referred to by this relocation is a local - symbol. */ - boolean local_p; - /* True if the symbol referred to by this relocation is "_gp_disp". */ - boolean gp_disp_p = false; - Elf_Internal_Shdr *symtab_hdr; - size_t extsymoff; - unsigned long r_symndx; - int r_type; - /* True if overflow occurred during the calculation of the - relocation value. */ - boolean overflowed_p; - /* True if this relocation refers to a MIPS16 function. */ - boolean target_is_16_bit_code_p = false; - - /* Parse the relocation. */ - r_symndx = ELF32_R_SYM (relocation->r_info); - r_type = ELF32_R_TYPE (relocation->r_info); - p = (input_section->output_section->vma - + input_section->output_offset - + relocation->r_offset); - - /* Assume that there will be no overflow. */ - overflowed_p = false; - - /* Figure out whether or not the symbol is local, and get the offset - used in the array of hash table entries. */ - symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; - local_p = mips_elf_local_relocation_p (input_bfd, relocation, - local_sections, false); - if (! elf_bad_symtab (input_bfd)) - extsymoff = symtab_hdr->sh_info; - else - { - /* The symbol table does not follow the rule that local symbols - must come before globals. */ - extsymoff = 0; - } - - /* Figure out the value of the symbol. */ - if (local_p) - { - Elf_Internal_Sym *sym; - - sym = local_syms + r_symndx; - sec = local_sections[r_symndx]; - - symbol = sec->output_section->vma + sec->output_offset; - if (ELF_ST_TYPE (sym->st_info) != STT_SECTION) - symbol += sym->st_value; - - /* MIPS16 text labels should be treated as odd. */ - if (sym->st_other == STO_MIPS16) - ++symbol; - - /* Record the name of this symbol, for our caller. */ - *namep = bfd_elf_string_from_elf_section (input_bfd, - symtab_hdr->sh_link, - sym->st_name); - if (*namep == '\0') - *namep = bfd_section_name (input_bfd, sec); - - target_is_16_bit_code_p = (sym->st_other == STO_MIPS16); - } - else - { - /* For global symbols we look up the symbol in the hash-table. */ - h = ((struct mips_elf_link_hash_entry *) - elf_sym_hashes (input_bfd) [r_symndx - extsymoff]); - /* Find the real hash-table entry for this symbol. */ - while (h->root.root.type == bfd_link_hash_indirect - || h->root.root.type == bfd_link_hash_warning) - h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link; - - /* Record the name of this symbol, for our caller. */ - *namep = h->root.root.root.string; - - /* See if this is the special _gp_disp symbol. Note that such a - symbol must always be a global symbol. */ - if (strcmp (h->root.root.root.string, "_gp_disp") == 0) - { - /* Relocations against _gp_disp are permitted only with - R_MIPS_HI16 and R_MIPS_LO16 relocations. */ - if (r_type != R_MIPS_HI16 && r_type != R_MIPS_LO16) - return bfd_reloc_notsupported; - - gp_disp_p = true; - } - /* If this symbol is defined, calculate its address. Note that - _gp_disp is a magic symbol, always implicitly defined by the - linker, so it's inappropriate to check to see whether or not - its defined. */ - else if ((h->root.root.type == bfd_link_hash_defined - || h->root.root.type == bfd_link_hash_defweak) - && h->root.root.u.def.section) - { - sec = h->root.root.u.def.section; - if (sec->output_section) - symbol = (h->root.root.u.def.value - + sec->output_section->vma - + sec->output_offset); - else - symbol = h->root.root.u.def.value; - } - else if (h->root.root.type == bfd_link_hash_undefweak) - /* We allow relocations against undefined weak symbols, giving - it the value zero, so that you can undefined weak functions - and check to see if they exist by looking at their - addresses. */ - symbol = 0; - else if (info->shared && !info->symbolic && !info->no_undefined - && ELF_ST_VISIBILITY (h->root.other) == STV_DEFAULT) - symbol = 0; - else if (strcmp (h->root.root.root.string, "_DYNAMIC_LINK") == 0 || - strcmp (h->root.root.root.string, "_DYNAMIC_LINKING") == 0) - { - /* If this is a dynamic link, we should have created a - _DYNAMIC_LINK symbol or _DYNAMIC_LINKING(for normal mips) symbol - in in mips_elf_create_dynamic_sections. - Otherwise, we should define the symbol with a value of 0. - FIXME: It should probably get into the symbol table - somehow as well. */ - BFD_ASSERT (! info->shared); - BFD_ASSERT (bfd_get_section_by_name (abfd, ".dynamic") == NULL); - symbol = 0; - } - else - { - if (! ((*info->callbacks->undefined_symbol) - (info, h->root.root.root.string, input_bfd, - input_section, relocation->r_offset, - (!info->shared || info->no_undefined - || ELF_ST_VISIBILITY (h->root.other))))) - return bfd_reloc_undefined; - symbol = 0; - } - - target_is_16_bit_code_p = (h->root.other == STO_MIPS16); - } - - /* If this is a 32-bit call to a 16-bit function with a stub, we - need to redirect the call to the stub, unless we're already *in* - a stub. */ - if (r_type != R_MIPS16_26 && !info->relocateable - && ((h != NULL && h->fn_stub != NULL) - || (local_p && elf_tdata (input_bfd)->local_stubs != NULL - && elf_tdata (input_bfd)->local_stubs[r_symndx] != NULL)) - && !mips_elf_stub_section_p (input_bfd, input_section)) - { - /* This is a 32-bit call to a 16-bit function. We should - have already noticed that we were going to need the - stub. */ - if (local_p) - sec = elf_tdata (input_bfd)->local_stubs[r_symndx]; - else - { - BFD_ASSERT (h->need_fn_stub); - sec = h->fn_stub; - } - - symbol = sec->output_section->vma + sec->output_offset; - } - /* If this is a 16-bit call to a 32-bit function with a stub, we - need to redirect the call to the stub. */ - else if (r_type == R_MIPS16_26 && !info->relocateable - && h != NULL - && (h->call_stub != NULL || h->call_fp_stub != NULL) - && !target_is_16_bit_code_p) - { - /* If both call_stub and call_fp_stub are defined, we can figure - out which one to use by seeing which one appears in the input - file. */ - if (h->call_stub != NULL && h->call_fp_stub != NULL) - { - asection *o; - - sec = NULL; - for (o = input_bfd->sections; o != NULL; o = o->next) - { - if (strncmp (bfd_get_section_name (input_bfd, o), - CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0) - { - sec = h->call_fp_stub; - break; - } - } - if (sec == NULL) - sec = h->call_stub; - } - else if (h->call_stub != NULL) - sec = h->call_stub; - else - sec = h->call_fp_stub; - - BFD_ASSERT (sec->_raw_size > 0); - symbol = sec->output_section->vma + sec->output_offset; - } - - /* Calls from 16-bit code to 32-bit code and vice versa require the - special jalx instruction. */ - *require_jalxp = (!info->relocateable - && ((r_type == R_MIPS16_26) != target_is_16_bit_code_p)); - - local_p = mips_elf_local_relocation_p (input_bfd, relocation, - local_sections, true); - - /* If we haven't already determined the GOT offset, or the GP value, - and we're going to need it, get it now. */ - switch (r_type) - { - case R_MIPS_CALL16: - case R_MIPS_GOT16: - case R_MIPS_GOT_DISP: - case R_MIPS_GOT_HI16: - case R_MIPS_CALL_HI16: - case R_MIPS_GOT_LO16: - case R_MIPS_CALL_LO16: - /* Find the index into the GOT where this value is located. */ - if (!local_p) - { - BFD_ASSERT (addend == 0); - g = mips_elf_global_got_index - (elf_hash_table (info)->dynobj, - (struct elf_link_hash_entry *) h); - if (! elf_hash_table(info)->dynamic_sections_created - || (info->shared - && (info->symbolic || h->root.dynindx == -1) - && (h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) - { - /* This is a static link or a -Bsymbolic link. The - symbol is defined locally, or was forced to be local. - We must initialize this entry in the GOT. */ - asection *sgot = mips_elf_got_section(elf_hash_table - (info)->dynobj); - MIPS_ELF_PUT_WORD (elf_hash_table (info)->dynobj, - symbol + addend, sgot->contents + g); - } - } - else if (r_type == R_MIPS_GOT16 || r_type == R_MIPS_CALL16) - /* There's no need to create a local GOT entry here; the - calculation for a local GOT16 entry does not involve G. */ - break; - else - { - g = mips_elf_local_got_index (abfd, info, symbol + addend); - if (g == (bfd_vma) -1) - return false; - } - - /* Convert GOT indices to actual offsets. */ - g = mips_elf_got_offset_from_index (elf_hash_table (info)->dynobj, - abfd, g); - break; - - case R_MIPS_HI16: - case R_MIPS_LO16: - case R_MIPS_GPREL16: - case R_MIPS_GPREL32: - case R_MIPS_LITERAL: - gp0 = _bfd_get_gp_value (input_bfd); - gp = _bfd_get_gp_value (abfd); - break; - - default: - break; - } - - /* Figure out what kind of relocation is being performed. */ - switch (r_type) - { - case R_MIPS_NONE: - return bfd_reloc_continue; - - case R_MIPS_16: - value = symbol + mips_elf_sign_extend (addend, 16); - overflowed_p = mips_elf_overflow_p (value, 16); - break; - - case R_MIPS_32: - case R_MIPS_REL32: - case R_MIPS_64: - if ((info->shared - || (elf_hash_table (info)->dynamic_sections_created - && h != NULL - && ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) - != 0))) - && (input_section->flags & SEC_ALLOC) != 0) - { - /* If we're creating a shared library, or this relocation is - against a symbol in a shared library, then we can't know - where the symbol will end up. So, we create a relocation - record in the output, and leave the job up to the dynamic - linker. */ - value = addend; - if (!mips_elf_create_dynamic_relocation (abfd, - info, - relocation, - h, - sec, - symbol, - &value, - input_section)) - return false; - } - else - { - if (r_type != R_MIPS_REL32) - value = symbol + addend; - else - value = addend; - } - value &= howto->dst_mask; - break; - - case R_MIPS_PC32: - case R_MIPS_PC64: - case R_MIPS_GNU_REL_LO16: - value = symbol + addend - p; - value &= howto->dst_mask; - break; - - case R_MIPS_GNU_REL16_S2: - value = symbol + mips_elf_sign_extend (addend << 2, 18) - p; - overflowed_p = mips_elf_overflow_p (value, 18); - value = (value >> 2) & howto->dst_mask; - break; - - case R_MIPS_GNU_REL_HI16: - value = mips_elf_high (addend + symbol - p); - value &= howto->dst_mask; - break; - - case R_MIPS16_26: - /* The calculation for R_MIPS16_26 is just the same as for an - R_MIPS_26. It's only the storage of the relocated field into - the output file that's different. That's handled in - mips_elf_perform_relocation. So, we just fall through to the - R_MIPS_26 case here. */ - case R_MIPS_26: - if (local_p) - value = (((addend << 2) | ((p + 4) & 0xf0000000)) + symbol) >> 2; - else - value = (mips_elf_sign_extend (addend << 2, 28) + symbol) >> 2; - value &= howto->dst_mask; - break; - - case R_MIPS_HI16: - if (!gp_disp_p) - { - value = mips_elf_high (addend + symbol); - value &= howto->dst_mask; - } - else - { - value = mips_elf_high (addend + gp - p); - overflowed_p = mips_elf_overflow_p (value, 16); - } - break; - - case R_MIPS_LO16: - if (!gp_disp_p) - value = (symbol + addend) & howto->dst_mask; - else - { - value = addend + gp - p + 4; - /* The MIPS ABI requires checking the R_MIPS_LO16 relocation - for overflow. But, on, say, Irix 5, relocations against - _gp_disp are normally generated from the .cpload - pseudo-op. It generates code that normally looks like - this: - - lui $gp,%hi(_gp_disp) - addiu $gp,$gp,%lo(_gp_disp) - addu $gp,$gp,$t9 - - Here $t9 holds the address of the function being called, - as required by the MIPS ELF ABI. The R_MIPS_LO16 - relocation can easily overflow in this situation, but the - R_MIPS_HI16 relocation will handle the overflow. - Therefore, we consider this a bug in the MIPS ABI, and do - not check for overflow here. */ - } - break; - - case R_MIPS_LITERAL: - /* Because we don't merge literal sections, we can handle this - just like R_MIPS_GPREL16. In the long run, we should merge - shared literals, and then we will need to additional work - here. */ - - /* Fall through. */ - - case R_MIPS16_GPREL: - /* The R_MIPS16_GPREL performs the same calculation as - R_MIPS_GPREL16, but stores the relocated bits in a different - order. We don't need to do anything special here; the - differences are handled in mips_elf_perform_relocation. */ - case R_MIPS_GPREL16: - if (local_p) - value = mips_elf_sign_extend (addend, 16) + symbol + gp0 - gp; - else - value = mips_elf_sign_extend (addend, 16) + symbol - gp; - overflowed_p = mips_elf_overflow_p (value, 16); - break; - - case R_MIPS_GOT16: - case R_MIPS_CALL16: - if (local_p) - { - boolean forced; - - /* The special case is when the symbol is forced to be local. We - need the full address in the GOT since no R_MIPS_LO16 relocation - follows. */ - forced = ! mips_elf_local_relocation_p (input_bfd, relocation, - local_sections, false); - value = mips_elf_got16_entry (abfd, info, symbol + addend, forced); - if (value == (bfd_vma) -1) - return false; - value - = mips_elf_got_offset_from_index (elf_hash_table (info)->dynobj, - abfd, - value); - overflowed_p = mips_elf_overflow_p (value, 16); - break; - } - - /* Fall through. */ - - case R_MIPS_GOT_DISP: - value = g; - overflowed_p = mips_elf_overflow_p (value, 16); - break; - - case R_MIPS_GPREL32: - value = (addend + symbol + gp0 - gp) & howto->dst_mask; - break; - - case R_MIPS_PC16: - value = mips_elf_sign_extend (addend, 16) + symbol - p; - value = (bfd_vma) ((bfd_signed_vma) value / 4); - overflowed_p = mips_elf_overflow_p (value, 16); - break; - - case R_MIPS_GOT_HI16: - case R_MIPS_CALL_HI16: - /* We're allowed to handle these two relocations identically. - The dynamic linker is allowed to handle the CALL relocations - differently by creating a lazy evaluation stub. */ - value = g; - value = mips_elf_high (value); - value &= howto->dst_mask; - break; - - case R_MIPS_GOT_LO16: - case R_MIPS_CALL_LO16: - value = g & howto->dst_mask; - break; - - case R_MIPS_GOT_PAGE: - value = mips_elf_got_page (abfd, info, symbol + addend, NULL); - if (value == (bfd_vma) -1) - return false; - value = mips_elf_got_offset_from_index (elf_hash_table (info)->dynobj, - abfd, - value); - overflowed_p = mips_elf_overflow_p (value, 16); - break; - - case R_MIPS_GOT_OFST: - mips_elf_got_page (abfd, info, symbol + addend, &value); - overflowed_p = mips_elf_overflow_p (value, 16); - break; - - case R_MIPS_SUB: - value = symbol - addend; - value &= howto->dst_mask; - break; - - case R_MIPS_HIGHER: - value = mips_elf_higher (addend + symbol); - value &= howto->dst_mask; - break; - - case R_MIPS_HIGHEST: - value = mips_elf_highest (addend + symbol); - value &= howto->dst_mask; - break; - - case R_MIPS_SCN_DISP: - value = symbol + addend - sec->output_offset; - value &= howto->dst_mask; - break; - - case R_MIPS_PJUMP: - case R_MIPS_JALR: - /* Both of these may be ignored. R_MIPS_JALR is an optimization - hint; we could improve performance by honoring that hint. */ - return bfd_reloc_continue; - - case R_MIPS_GNU_VTINHERIT: - case R_MIPS_GNU_VTENTRY: - /* We don't do anything with these at present. */ - return bfd_reloc_continue; - - default: - /* An unrecognized relocation type. */ - return bfd_reloc_notsupported; - } - - /* Store the VALUE for our caller. */ - *valuep = value; - return overflowed_p ? bfd_reloc_overflow : bfd_reloc_ok; -} - -/* Obtain the field relocated by RELOCATION. */ - -static bfd_vma -mips_elf_obtain_contents (howto, relocation, input_bfd, contents) - reloc_howto_type *howto; - const Elf_Internal_Rela *relocation; - bfd *input_bfd; - bfd_byte *contents; -{ - bfd_vma x; - bfd_byte *location = contents + relocation->r_offset; - - /* Obtain the bytes. */ - x = bfd_get (8 * bfd_get_reloc_size (howto), input_bfd, location); - - if ((ELF32_R_TYPE (relocation->r_info) == R_MIPS16_26 - || ELF32_R_TYPE (relocation->r_info) == R_MIPS16_GPREL) - && bfd_little_endian (input_bfd)) - /* The two 16-bit words will be reversed on a little-endian - system. See mips_elf_perform_relocation for more details. */ - x = (((x & 0xffff) << 16) | ((x & 0xffff0000) >> 16)); - - return x; -} - -/* It has been determined that the result of the RELOCATION is the - VALUE. Use HOWTO to place VALUE into the output file at the - appropriate position. The SECTION is the section to which the - relocation applies. If REQUIRE_JALX is true, then the opcode used - for the relocation must be either JAL or JALX, and it is - unconditionally converted to JALX. - - Returns false if anything goes wrong. */ - -static boolean -mips_elf_perform_relocation (info, howto, relocation, value, - input_bfd, input_section, - contents, require_jalx) - struct bfd_link_info *info; - reloc_howto_type *howto; - const Elf_Internal_Rela *relocation; - bfd_vma value; - bfd *input_bfd; - asection *input_section; - bfd_byte *contents; - boolean require_jalx; -{ - bfd_vma x; - bfd_byte *location; - int r_type = ELF32_R_TYPE (relocation->r_info); - - /* Figure out where the relocation is occurring. */ - location = contents + relocation->r_offset; - - /* Obtain the current value. */ - x = mips_elf_obtain_contents (howto, relocation, input_bfd, contents); - - /* Clear the field we are setting. */ - x &= ~howto->dst_mask; - - /* If this is the R_MIPS16_26 relocation, we must store the - value in a funny way. */ - if (r_type == R_MIPS16_26) - { - /* R_MIPS16_26 is used for the mips16 jal and jalx instructions. - Most mips16 instructions are 16 bits, but these instructions - are 32 bits. - - The format of these instructions is: - - +--------------+--------------------------------+ - ! JALX ! X! Imm 20:16 ! Imm 25:21 ! - +--------------+--------------------------------+ - ! Immediate 15:0 ! - +-----------------------------------------------+ - - JALX is the 5-bit value 00011. X is 0 for jal, 1 for jalx. - Note that the immediate value in the first word is swapped. - - When producing a relocateable object file, R_MIPS16_26 is - handled mostly like R_MIPS_26. In particular, the addend is - stored as a straight 26-bit value in a 32-bit instruction. - (gas makes life simpler for itself by never adjusting a - R_MIPS16_26 reloc to be against a section, so the addend is - always zero). However, the 32 bit instruction is stored as 2 - 16-bit values, rather than a single 32-bit value. In a - big-endian file, the result is the same; in a little-endian - file, the two 16-bit halves of the 32 bit value are swapped. - This is so that a disassembler can recognize the jal - instruction. - - When doing a final link, R_MIPS16_26 is treated as a 32 bit - instruction stored as two 16-bit values. The addend A is the - contents of the targ26 field. The calculation is the same as - R_MIPS_26. When storing the calculated value, reorder the - immediate value as shown above, and don't forget to store the - value as two 16-bit values. - - To put it in MIPS ABI terms, the relocation field is T-targ26-16, - defined as - - big-endian: - +--------+----------------------+ - | | | - | | targ26-16 | - |31 26|25 0| - +--------+----------------------+ - - little-endian: - +----------+------+-------------+ - | | | | - | sub1 | | sub2 | - |0 9|10 15|16 31| - +----------+--------------------+ - where targ26-16 is sub1 followed by sub2 (i.e., the addend field A is - ((sub1 << 16) | sub2)). - - When producing a relocateable object file, the calculation is - (((A < 2) | ((P + 4) & 0xf0000000) + S) >> 2) - When producing a fully linked file, the calculation is - let R = (((A < 2) | ((P + 4) & 0xf0000000) + S) >> 2) - ((R & 0x1f0000) << 5) | ((R & 0x3e00000) >> 5) | (R & 0xffff) */ - - if (!info->relocateable) - /* Shuffle the bits according to the formula above. */ - value = (((value & 0x1f0000) << 5) - | ((value & 0x3e00000) >> 5) - | (value & 0xffff)); - } - else if (r_type == R_MIPS16_GPREL) - { - /* R_MIPS16_GPREL is used for GP-relative addressing in mips16 - mode. A typical instruction will have a format like this: - - +--------------+--------------------------------+ - ! EXTEND ! Imm 10:5 ! Imm 15:11 ! - +--------------+--------------------------------+ - ! Major ! rx ! ry ! Imm 4:0 ! - +--------------+--------------------------------+ - - EXTEND is the five bit value 11110. Major is the instruction - opcode. - - This is handled exactly like R_MIPS_GPREL16, except that the - addend is retrieved and stored as shown in this diagram; that - is, the Imm fields above replace the V-rel16 field. - - All we need to do here is shuffle the bits appropriately. As - above, the two 16-bit halves must be swapped on a - little-endian system. */ - value = (((value & 0x7e0) << 16) - | ((value & 0xf800) << 5) - | (value & 0x1f)); - } - - /* Set the field. */ - x |= (value & howto->dst_mask); - - /* If required, turn JAL into JALX. */ - if (require_jalx) - { - boolean ok; - bfd_vma opcode = x >> 26; - bfd_vma jalx_opcode; - - /* Check to see if the opcode is already JAL or JALX. */ - if (r_type == R_MIPS16_26) - { - ok = ((opcode == 0x6) || (opcode == 0x7)); - jalx_opcode = 0x7; - } - else - { - ok = ((opcode == 0x3) || (opcode == 0x1d)); - jalx_opcode = 0x1d; - } - - /* If the opcode is not JAL or JALX, there's a problem. */ - if (!ok) - { - (*_bfd_error_handler) - (_("%s: %s+0x%lx: jump to stub routine which is not jal"), - bfd_get_filename (input_bfd), - input_section->name, - (unsigned long) relocation->r_offset); - bfd_set_error (bfd_error_bad_value); - return false; - } - - /* Make this the JALX opcode. */ - x = (x & ~(0x3f << 26)) | (jalx_opcode << 26); - } - - /* Swap the high- and low-order 16 bits on little-endian systems - when doing a MIPS16 relocation. */ - if ((r_type == R_MIPS16_GPREL || r_type == R_MIPS16_26) - && bfd_little_endian (input_bfd)) - x = (((x & 0xffff) << 16) | ((x & 0xffff0000) >> 16)); - - /* Put the value into the output. */ - bfd_put (8 * bfd_get_reloc_size (howto), input_bfd, x, location); - return true; -} - -/* Returns true if SECTION is a MIPS16 stub section. */ - -static boolean -mips_elf_stub_section_p (abfd, section) - bfd *abfd ATTRIBUTE_UNUSED; - asection *section; -{ - const char *name = bfd_get_section_name (abfd, section); - - return (strncmp (name, FN_STUB, sizeof FN_STUB - 1) == 0 - || strncmp (name, CALL_STUB, sizeof CALL_STUB - 1) == 0 - || strncmp (name, CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0); -} - -/* Relocate a MIPS ELF section. */ - -boolean -_bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section, - contents, relocs, local_syms, local_sections) - bfd *output_bfd; - struct bfd_link_info *info; - bfd *input_bfd; - asection *input_section; - bfd_byte *contents; - Elf_Internal_Rela *relocs; - Elf_Internal_Sym *local_syms; - asection **local_sections; -{ - Elf_Internal_Rela *rel; - const Elf_Internal_Rela *relend; - bfd_vma addend = 0; - boolean use_saved_addend_p = false; - struct elf_backend_data *bed; - - bed = get_elf_backend_data (output_bfd); - relend = relocs + input_section->reloc_count * bed->s->int_rels_per_ext_rel; - for (rel = relocs; rel < relend; ++rel) - { - const char *name; - bfd_vma value; - reloc_howto_type *howto; - boolean require_jalx; - /* True if the relocation is a RELA relocation, rather than a - REL relocation. */ - boolean rela_relocation_p = true; - int r_type = ELF32_R_TYPE (rel->r_info); - const char * msg = (const char *) NULL; - - /* Find the relocation howto for this relocation. */ - if (r_type == R_MIPS_64 && !ABI_64_P (output_bfd)) - { - /* Some 32-bit code uses R_MIPS_64. In particular, people use - 64-bit code, but make sure all their addresses are in the - lowermost or uppermost 32-bit section of the 64-bit address - space. Thus, when they use an R_MIPS_64 they mean what is - usually meant by R_MIPS_32, with the exception that the - stored value is sign-extended to 64 bits. */ - howto = elf_mips_howto_table + R_MIPS_32; - - /* On big-endian systems, we need to lie about the position - of the reloc. */ - if (bfd_big_endian (input_bfd)) - rel->r_offset += 4; - } - else - howto = mips_rtype_to_howto (r_type); - - if (!use_saved_addend_p) - { - Elf_Internal_Shdr *rel_hdr; - - /* If these relocations were originally of the REL variety, - we must pull the addend out of the field that will be - relocated. Otherwise, we simply use the contents of the - RELA relocation. To determine which flavor or relocation - this is, we depend on the fact that the INPUT_SECTION's - REL_HDR is read before its REL_HDR2. */ - rel_hdr = &elf_section_data (input_section)->rel_hdr; - if ((size_t) (rel - relocs) - >= (NUM_SHDR_ENTRIES (rel_hdr) * bed->s->int_rels_per_ext_rel)) - rel_hdr = elf_section_data (input_section)->rel_hdr2; - if (rel_hdr->sh_entsize == MIPS_ELF_REL_SIZE (input_bfd)) - { - /* Note that this is a REL relocation. */ - rela_relocation_p = false; - - /* Get the addend, which is stored in the input file. */ - addend = mips_elf_obtain_contents (howto, - rel, - input_bfd, - contents); - addend &= howto->src_mask; - - /* For some kinds of relocations, the ADDEND is a - combination of the addend stored in two different - relocations. */ - if (r_type == R_MIPS_HI16 - || r_type == R_MIPS_GNU_REL_HI16 - || (r_type == R_MIPS_GOT16 - && mips_elf_local_relocation_p (input_bfd, rel, - local_sections, false))) - { - bfd_vma l; - const Elf_Internal_Rela *lo16_relocation; - reloc_howto_type *lo16_howto; - int lo; - - /* The combined value is the sum of the HI16 addend, - left-shifted by sixteen bits, and the LO16 - addend, sign extended. (Usually, the code does - a `lui' of the HI16 value, and then an `addiu' of - the LO16 value.) - - Scan ahead to find a matching LO16 relocation. */ - if (r_type == R_MIPS_GNU_REL_HI16) - lo = R_MIPS_GNU_REL_LO16; - else - lo = R_MIPS_LO16; - lo16_relocation - = mips_elf_next_relocation (lo, rel, relend); - if (lo16_relocation == NULL) - return false; - - /* Obtain the addend kept there. */ - lo16_howto = mips_rtype_to_howto (lo); - l = mips_elf_obtain_contents (lo16_howto, - lo16_relocation, - input_bfd, contents); - l &= lo16_howto->src_mask; - l = mips_elf_sign_extend (l, 16); - - addend <<= 16; - - /* Compute the combined addend. */ - addend += l; - } - else if (r_type == R_MIPS16_GPREL) - { - /* The addend is scrambled in the object file. See - mips_elf_perform_relocation for details on the - format. */ - addend = (((addend & 0x1f0000) >> 5) - | ((addend & 0x7e00000) >> 16) - | (addend & 0x1f)); - } - } - else - addend = rel->r_addend; - } - - if (info->relocateable) - { - Elf_Internal_Sym *sym; - unsigned long r_symndx; - - if (r_type == R_MIPS_64 && !ABI_64_P (output_bfd) - && bfd_big_endian (input_bfd)) - rel->r_offset -= 4; - - /* Since we're just relocating, all we need to do is copy - the relocations back out to the object file, unless - they're against a section symbol, in which case we need - to adjust by the section offset, or unless they're GP - relative in which case we need to adjust by the amount - that we're adjusting GP in this relocateable object. */ - - if (!mips_elf_local_relocation_p (input_bfd, rel, local_sections, - false)) - /* There's nothing to do for non-local relocations. */ - continue; - - if (r_type == R_MIPS16_GPREL - || r_type == R_MIPS_GPREL16 - || r_type == R_MIPS_GPREL32 - || r_type == R_MIPS_LITERAL) - addend -= (_bfd_get_gp_value (output_bfd) - - _bfd_get_gp_value (input_bfd)); - else if (r_type == R_MIPS_26 || r_type == R_MIPS16_26 - || r_type == R_MIPS_GNU_REL16_S2) - /* The addend is stored without its two least - significant bits (which are always zero.) In a - non-relocateable link, calculate_relocation will do - this shift; here, we must do it ourselves. */ - addend <<= 2; - - r_symndx = ELF32_R_SYM (rel->r_info); - sym = local_syms + r_symndx; - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - /* Adjust the addend appropriately. */ - addend += local_sections[r_symndx]->output_offset; - - /* If the relocation is for a R_MIPS_HI16 or R_MIPS_GOT16, - then we only want to write out the high-order 16 bits. - The subsequent R_MIPS_LO16 will handle the low-order bits. */ - if (r_type == R_MIPS_HI16 || r_type == R_MIPS_GOT16 - || r_type == R_MIPS_GNU_REL_HI16) - addend = mips_elf_high (addend); - /* If the relocation is for an R_MIPS_26 relocation, then - the two low-order bits are not stored in the object file; - they are implicitly zero. */ - else if (r_type == R_MIPS_26 || r_type == R_MIPS16_26 - || r_type == R_MIPS_GNU_REL16_S2) - addend >>= 2; - - if (rela_relocation_p) - /* If this is a RELA relocation, just update the addend. - We have to cast away constness for REL. */ - rel->r_addend = addend; - else - { - /* Otherwise, we have to write the value back out. Note - that we use the source mask, rather than the - destination mask because the place to which we are - writing will be source of the addend in the final - link. */ - addend &= howto->src_mask; - - if (r_type == R_MIPS_64 && !ABI_64_P (output_bfd)) - /* See the comment above about using R_MIPS_64 in the 32-bit - ABI. Here, we need to update the addend. It would be - possible to get away with just using the R_MIPS_32 reloc - but for endianness. */ - { - bfd_vma sign_bits; - bfd_vma low_bits; - bfd_vma high_bits; - - if (addend & ((bfd_vma) 1 << 31)) - sign_bits = ((bfd_vma) 1 << 32) - 1; - else - sign_bits = 0; - - /* If we don't know that we have a 64-bit type, - do two separate stores. */ - if (bfd_big_endian (input_bfd)) - { - /* Store the sign-bits (which are most significant) - first. */ - low_bits = sign_bits; - high_bits = addend; - } - else - { - low_bits = addend; - high_bits = sign_bits; - } - bfd_put_32 (input_bfd, low_bits, - contents + rel->r_offset); - bfd_put_32 (input_bfd, high_bits, - contents + rel->r_offset + 4); - continue; - } - - if (!mips_elf_perform_relocation (info, howto, rel, addend, - input_bfd, input_section, - contents, false)) - return false; - } - - /* Go on to the next relocation. */ - continue; - } - - /* In the N32 and 64-bit ABIs there may be multiple consecutive - relocations for the same offset. In that case we are - supposed to treat the output of each relocation as the addend - for the next. */ - if (rel + 1 < relend - && rel->r_offset == rel[1].r_offset - && ELF32_R_TYPE (rel[1].r_info) != R_MIPS_NONE) - use_saved_addend_p = true; - else - use_saved_addend_p = false; - - /* Figure out what value we are supposed to relocate. */ - switch (mips_elf_calculate_relocation (output_bfd, - input_bfd, - input_section, - info, - rel, - addend, - howto, - local_syms, - local_sections, - &value, - &name, - &require_jalx)) - { - case bfd_reloc_continue: - /* There's nothing to do. */ - continue; - - case bfd_reloc_undefined: - /* mips_elf_calculate_relocation already called the - undefined_symbol callback. There's no real point in - trying to perform the relocation at this point, so we - just skip ahead to the next relocation. */ - continue; - - case bfd_reloc_notsupported: - msg = _("internal error: unsupported relocation error"); - info->callbacks->warning - (info, msg, name, input_bfd, input_section, rel->r_offset); - return false; - - case bfd_reloc_overflow: - if (use_saved_addend_p) - /* Ignore overflow until we reach the last relocation for - a given location. */ - ; - else - { - BFD_ASSERT (name != NULL); - if (! ((*info->callbacks->reloc_overflow) - (info, name, howto->name, (bfd_vma) 0, - input_bfd, input_section, rel->r_offset))) - return false; - } - break; - - case bfd_reloc_ok: - break; - - default: - abort (); - break; - } - - /* If we've got another relocation for the address, keep going - until we reach the last one. */ - if (use_saved_addend_p) - { - addend = value; - continue; - } - - if (r_type == R_MIPS_64 && !ABI_64_P (output_bfd)) - /* See the comment above about using R_MIPS_64 in the 32-bit - ABI. Until now, we've been using the HOWTO for R_MIPS_32; - that calculated the right value. Now, however, we - sign-extend the 32-bit result to 64-bits, and store it as a - 64-bit value. We are especially generous here in that we - go to extreme lengths to support this usage on systems with - only a 32-bit VMA. */ - { - bfd_vma sign_bits; - bfd_vma low_bits; - bfd_vma high_bits; - - if (value & ((bfd_vma) 1 << 31)) - sign_bits = ((bfd_vma) 1 << 32) - 1; - else - sign_bits = 0; - - /* If we don't know that we have a 64-bit type, - do two separate stores. */ - if (bfd_big_endian (input_bfd)) - { - /* Undo what we did above. */ - rel->r_offset -= 4; - /* Store the sign-bits (which are most significant) - first. */ - low_bits = sign_bits; - high_bits = value; - } - else - { - low_bits = value; - high_bits = sign_bits; - } - bfd_put_32 (input_bfd, low_bits, - contents + rel->r_offset); - bfd_put_32 (input_bfd, high_bits, - contents + rel->r_offset + 4); - continue; - } - - /* Actually perform the relocation. */ - if (!mips_elf_perform_relocation (info, howto, rel, value, input_bfd, - input_section, contents, - require_jalx)) - return false; - } - - return true; -} - -/* This hook function is called before the linker writes out a global - symbol. We mark symbols as small common if appropriate. This is - also where we undo the increment of the value for a mips16 symbol. */ - -boolean -_bfd_mips_elf_link_output_symbol_hook (abfd, info, name, sym, input_sec) - bfd *abfd ATTRIBUTE_UNUSED; - struct bfd_link_info *info ATTRIBUTE_UNUSED; - const char *name ATTRIBUTE_UNUSED; - Elf_Internal_Sym *sym; - asection *input_sec; -{ - /* If we see a common symbol, which implies a relocatable link, then - if a symbol was small common in an input file, mark it as small - common in the output file. */ - if (sym->st_shndx == SHN_COMMON - && strcmp (input_sec->name, ".scommon") == 0) - sym->st_shndx = SHN_MIPS_SCOMMON; - - if (sym->st_other == STO_MIPS16 - && (sym->st_value & 1) != 0) - --sym->st_value; - - return true; -} - -/* Functions for the dynamic linker. */ - -/* The name of the dynamic interpreter. This is put in the .interp - section. */ - -#define ELF_DYNAMIC_INTERPRETER(abfd) \ - (ABI_N32_P (abfd) ? "/usr/lib32/libc.so.1" \ - : ABI_64_P (abfd) ? "/usr/lib64/libc.so.1" \ - : "/usr/lib/libc.so.1") - -/* Create dynamic sections when linking against a dynamic object. */ - -boolean -_bfd_mips_elf_create_dynamic_sections (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - struct elf_link_hash_entry *h; - flagword flags; - register asection *s; - const char * const *namep; - - flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY - | SEC_LINKER_CREATED | SEC_READONLY); - - /* Mips ABI requests the .dynamic section to be read only. */ - s = bfd_get_section_by_name (abfd, ".dynamic"); - if (s != NULL) - { - if (! bfd_set_section_flags (abfd, s, flags)) - return false; - } - - /* We need to create .got section. */ - if (! mips_elf_create_got_section (abfd, info)) - return false; - - /* Create the .msym section on IRIX6. It is used by the dynamic - linker to speed up dynamic relocations, and to avoid computing - the ELF hash for symbols. */ - if (IRIX_COMPAT (abfd) == ict_irix6 - && !mips_elf_create_msym_section (abfd)) - return false; - - /* Create .stub section. */ - if (bfd_get_section_by_name (abfd, - MIPS_ELF_STUB_SECTION_NAME (abfd)) == NULL) - { - s = bfd_make_section (abfd, MIPS_ELF_STUB_SECTION_NAME (abfd)); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_CODE) - || ! bfd_set_section_alignment (abfd, s, - MIPS_ELF_LOG_FILE_ALIGN (abfd))) - return false; - } - - if ((IRIX_COMPAT (abfd) == ict_irix5 || IRIX_COMPAT (abfd) == ict_none) - && !info->shared - && bfd_get_section_by_name (abfd, ".rld_map") == NULL) - { - s = bfd_make_section (abfd, ".rld_map"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags & ~SEC_READONLY) - || ! bfd_set_section_alignment (abfd, s, - MIPS_ELF_LOG_FILE_ALIGN (abfd))) - return false; - } - - /* On IRIX5, we adjust add some additional symbols and change the - alignments of several sections. There is no ABI documentation - indicating that this is necessary on IRIX6, nor any evidence that - the linker takes such action. */ - if (IRIX_COMPAT (abfd) == ict_irix5) - { - for (namep = mips_elf_dynsym_rtproc_names; *namep != NULL; namep++) - { - h = NULL; - if (! (_bfd_generic_link_add_one_symbol - (info, abfd, *namep, BSF_GLOBAL, bfd_und_section_ptr, - (bfd_vma) 0, (const char *) NULL, false, - get_elf_backend_data (abfd)->collect, - (struct bfd_link_hash_entry **) &h))) - return false; - h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - h->type = STT_SECTION; - - if (! bfd_elf32_link_record_dynamic_symbol (info, h)) - return false; - } - - /* We need to create a .compact_rel section. */ - if (SGI_COMPAT (abfd)) - { - if (!mips_elf_create_compact_rel_section (abfd, info)) - return false; - } - - /* Change aligments of some sections. */ - s = bfd_get_section_by_name (abfd, ".hash"); - if (s != NULL) - bfd_set_section_alignment (abfd, s, 4); - s = bfd_get_section_by_name (abfd, ".dynsym"); - if (s != NULL) - bfd_set_section_alignment (abfd, s, 4); - s = bfd_get_section_by_name (abfd, ".dynstr"); - if (s != NULL) - bfd_set_section_alignment (abfd, s, 4); - s = bfd_get_section_by_name (abfd, ".reginfo"); - if (s != NULL) - bfd_set_section_alignment (abfd, s, 4); - s = bfd_get_section_by_name (abfd, ".dynamic"); - if (s != NULL) - bfd_set_section_alignment (abfd, s, 4); - } - - if (!info->shared) - { - h = NULL; - if (SGI_COMPAT (abfd)) - { - if (!(_bfd_generic_link_add_one_symbol - (info, abfd, "_DYNAMIC_LINK", BSF_GLOBAL, bfd_abs_section_ptr, - (bfd_vma) 0, (const char *) NULL, false, - get_elf_backend_data (abfd)->collect, - (struct bfd_link_hash_entry **) &h))) - return false; - } - else - { - /* For normal mips it is _DYNAMIC_LINKING. */ - if (!(_bfd_generic_link_add_one_symbol - (info, abfd, "_DYNAMIC_LINKING", BSF_GLOBAL, - bfd_abs_section_ptr, (bfd_vma) 0, (const char *) NULL, false, - get_elf_backend_data (abfd)->collect, - (struct bfd_link_hash_entry **) &h))) - return false; - } - h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - h->type = STT_SECTION; - - if (! bfd_elf32_link_record_dynamic_symbol (info, h)) - return false; - - if (! mips_elf_hash_table (info)->use_rld_obj_head) - { - /* __rld_map is a four byte word located in the .data section - and is filled in by the rtld to contain a pointer to - the _r_debug structure. Its symbol value will be set in - mips_elf_finish_dynamic_symbol. */ - s = bfd_get_section_by_name (abfd, ".rld_map"); - BFD_ASSERT (s != NULL); - - h = NULL; - if (SGI_COMPAT (abfd)) - { - if (!(_bfd_generic_link_add_one_symbol - (info, abfd, "__rld_map", BSF_GLOBAL, s, - (bfd_vma) 0, (const char *) NULL, false, - get_elf_backend_data (abfd)->collect, - (struct bfd_link_hash_entry **) &h))) - return false; - } - else - { - /* For normal mips the symbol is __RLD_MAP. */ - if (!(_bfd_generic_link_add_one_symbol - (info, abfd, "__RLD_MAP", BSF_GLOBAL, s, - (bfd_vma) 0, (const char *) NULL, false, - get_elf_backend_data (abfd)->collect, - (struct bfd_link_hash_entry **) &h))) - return false; - } - h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - h->type = STT_OBJECT; - - if (! bfd_elf32_link_record_dynamic_symbol (info, h)) - return false; - } - } - - return true; -} - -/* Create the .compact_rel section. */ - -static boolean -mips_elf_create_compact_rel_section (abfd, info) - bfd *abfd; - struct bfd_link_info *info ATTRIBUTE_UNUSED; -{ - flagword flags; - register asection *s; - - if (bfd_get_section_by_name (abfd, ".compact_rel") == NULL) - { - flags = (SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED - | SEC_READONLY); - - s = bfd_make_section (abfd, ".compact_rel"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags) - || ! bfd_set_section_alignment (abfd, s, - MIPS_ELF_LOG_FILE_ALIGN (abfd))) - return false; - - s->_raw_size = sizeof (Elf32_External_compact_rel); - } - - return true; -} - -/* Create the .got section to hold the global offset table. */ - -static boolean -mips_elf_create_got_section (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - flagword flags; - register asection *s; - struct elf_link_hash_entry *h; - struct mips_got_info *g; - - /* This function may be called more than once. */ - if (mips_elf_got_section (abfd)) - return true; - - flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY - | SEC_LINKER_CREATED); - - s = bfd_make_section (abfd, ".got"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags) - || ! bfd_set_section_alignment (abfd, s, 4)) - return false; - - /* Define the symbol _GLOBAL_OFFSET_TABLE_. We don't do this in the - linker script because we don't want to define the symbol if we - are not creating a global offset table. */ - h = NULL; - if (! (_bfd_generic_link_add_one_symbol - (info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, s, - (bfd_vma) 0, (const char *) NULL, false, - get_elf_backend_data (abfd)->collect, - (struct bfd_link_hash_entry **) &h))) - return false; - h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - h->type = STT_OBJECT; - - if (info->shared - && ! bfd_elf32_link_record_dynamic_symbol (info, h)) - return false; - - /* The first several global offset table entries are reserved. */ - s->_raw_size = MIPS_RESERVED_GOTNO * MIPS_ELF_GOT_SIZE (abfd); - - g = (struct mips_got_info *) bfd_alloc (abfd, - sizeof (struct mips_got_info)); - if (g == NULL) - return false; - g->global_gotsym = NULL; - g->local_gotno = MIPS_RESERVED_GOTNO; - g->assigned_gotno = MIPS_RESERVED_GOTNO; - if (elf_section_data (s) == NULL) - { - s->used_by_bfd = - (PTR) bfd_zalloc (abfd, sizeof (struct bfd_elf_section_data)); - if (elf_section_data (s) == NULL) - return false; - } - elf_section_data (s)->tdata = (PTR) g; - elf_section_data (s)->this_hdr.sh_flags - |= SHF_ALLOC | SHF_WRITE | SHF_MIPS_GPREL; - - return true; -} - -/* Returns the .msym section for ABFD, creating it if it does not - already exist. Returns NULL to indicate error. */ - -static asection * -mips_elf_create_msym_section (abfd) - bfd *abfd; -{ - asection *s; - - s = bfd_get_section_by_name (abfd, MIPS_ELF_MSYM_SECTION_NAME (abfd)); - if (!s) - { - s = bfd_make_section (abfd, MIPS_ELF_MSYM_SECTION_NAME (abfd)); - if (!s - || !bfd_set_section_flags (abfd, s, - SEC_ALLOC - | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_LINKER_CREATED - | SEC_READONLY) - || !bfd_set_section_alignment (abfd, s, - MIPS_ELF_LOG_FILE_ALIGN (abfd))) - return NULL; - } - - return s; -} - -/* Add room for N relocations to the .rel.dyn section in ABFD. */ - -static void -mips_elf_allocate_dynamic_relocations (abfd, n) - bfd *abfd; - unsigned int n; -{ - asection *s; - - s = bfd_get_section_by_name (abfd, MIPS_ELF_REL_DYN_SECTION_NAME (abfd)); - BFD_ASSERT (s != NULL); - - if (s->_raw_size == 0) - { - /* Make room for a null element. */ - s->_raw_size += MIPS_ELF_REL_SIZE (abfd); - ++s->reloc_count; - } - s->_raw_size += n * MIPS_ELF_REL_SIZE (abfd); -} - -/* Look through the relocs for a section during the first phase, and - allocate space in the global offset table. */ - -boolean -_bfd_mips_elf_check_relocs (abfd, info, sec, relocs) - bfd *abfd; - struct bfd_link_info *info; - asection *sec; - const Elf_Internal_Rela *relocs; -{ - const char *name; - bfd *dynobj; - Elf_Internal_Shdr *symtab_hdr; - struct elf_link_hash_entry **sym_hashes; - struct mips_got_info *g; - size_t extsymoff; - const Elf_Internal_Rela *rel; - const Elf_Internal_Rela *rel_end; - asection *sgot; - asection *sreloc; - struct elf_backend_data *bed; - - if (info->relocateable) - return true; - - dynobj = elf_hash_table (info)->dynobj; - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; - sym_hashes = elf_sym_hashes (abfd); - extsymoff = (elf_bad_symtab (abfd)) ? 0 : symtab_hdr->sh_info; - - /* Check for the mips16 stub sections. */ - - name = bfd_get_section_name (abfd, sec); - if (strncmp (name, FN_STUB, sizeof FN_STUB - 1) == 0) - { - unsigned long r_symndx; - - /* Look at the relocation information to figure out which symbol - this is for. */ - - r_symndx = ELF32_R_SYM (relocs->r_info); - - if (r_symndx < extsymoff - || sym_hashes[r_symndx - extsymoff] == NULL) - { - asection *o; - - /* This stub is for a local symbol. This stub will only be - needed if there is some relocation in this BFD, other - than a 16 bit function call, which refers to this symbol. */ - for (o = abfd->sections; o != NULL; o = o->next) - { - Elf_Internal_Rela *sec_relocs; - const Elf_Internal_Rela *r, *rend; - - /* We can ignore stub sections when looking for relocs. */ - if ((o->flags & SEC_RELOC) == 0 - || o->reloc_count == 0 - || strncmp (bfd_get_section_name (abfd, o), FN_STUB, - sizeof FN_STUB - 1) == 0 - || strncmp (bfd_get_section_name (abfd, o), CALL_STUB, - sizeof CALL_STUB - 1) == 0 - || strncmp (bfd_get_section_name (abfd, o), CALL_FP_STUB, - sizeof CALL_FP_STUB - 1) == 0) - continue; - - sec_relocs = (_bfd_elf32_link_read_relocs - (abfd, o, (PTR) NULL, - (Elf_Internal_Rela *) NULL, - info->keep_memory)); - if (sec_relocs == NULL) - return false; - - rend = sec_relocs + o->reloc_count; - for (r = sec_relocs; r < rend; r++) - if (ELF32_R_SYM (r->r_info) == r_symndx - && ELF32_R_TYPE (r->r_info) != R_MIPS16_26) - break; - - if (! info->keep_memory) - free (sec_relocs); - - if (r < rend) - break; - } - - if (o == NULL) - { - /* There is no non-call reloc for this stub, so we do - not need it. Since this function is called before - the linker maps input sections to output sections, we - can easily discard it by setting the SEC_EXCLUDE - flag. */ - sec->flags |= SEC_EXCLUDE; - return true; - } - - /* Record this stub in an array of local symbol stubs for - this BFD. */ - if (elf_tdata (abfd)->local_stubs == NULL) - { - unsigned long symcount; - asection **n; - - if (elf_bad_symtab (abfd)) - symcount = NUM_SHDR_ENTRIES (symtab_hdr); - else - symcount = symtab_hdr->sh_info; - n = (asection **) bfd_zalloc (abfd, - symcount * sizeof (asection *)); - if (n == NULL) - return false; - elf_tdata (abfd)->local_stubs = n; - } - - elf_tdata (abfd)->local_stubs[r_symndx] = sec; - - /* We don't need to set mips16_stubs_seen in this case. - That flag is used to see whether we need to look through - the global symbol table for stubs. We don't need to set - it here, because we just have a local stub. */ - } - else - { - struct mips_elf_link_hash_entry *h; - - h = ((struct mips_elf_link_hash_entry *) - sym_hashes[r_symndx - extsymoff]); - - /* H is the symbol this stub is for. */ - - h->fn_stub = sec; - mips_elf_hash_table (info)->mips16_stubs_seen = true; - } - } - else if (strncmp (name, CALL_STUB, sizeof CALL_STUB - 1) == 0 - || strncmp (name, CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0) - { - unsigned long r_symndx; - struct mips_elf_link_hash_entry *h; - asection **loc; - - /* Look at the relocation information to figure out which symbol - this is for. */ - - r_symndx = ELF32_R_SYM (relocs->r_info); - - if (r_symndx < extsymoff - || sym_hashes[r_symndx - extsymoff] == NULL) - { - /* This stub was actually built for a static symbol defined - in the same file. We assume that all static symbols in - mips16 code are themselves mips16, so we can simply - discard this stub. Since this function is called before - the linker maps input sections to output sections, we can - easily discard it by setting the SEC_EXCLUDE flag. */ - sec->flags |= SEC_EXCLUDE; - return true; - } - - h = ((struct mips_elf_link_hash_entry *) - sym_hashes[r_symndx - extsymoff]); - - /* H is the symbol this stub is for. */ - - if (strncmp (name, CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0) - loc = &h->call_fp_stub; - else - loc = &h->call_stub; - - /* If we already have an appropriate stub for this function, we - don't need another one, so we can discard this one. Since - this function is called before the linker maps input sections - to output sections, we can easily discard it by setting the - SEC_EXCLUDE flag. We can also discard this section if we - happen to already know that this is a mips16 function; it is - not necessary to check this here, as it is checked later, but - it is slightly faster to check now. */ - if (*loc != NULL || h->root.other == STO_MIPS16) - { - sec->flags |= SEC_EXCLUDE; - return true; - } - - *loc = sec; - mips_elf_hash_table (info)->mips16_stubs_seen = true; - } - - if (dynobj == NULL) - { - sgot = NULL; - g = NULL; - } - else - { - sgot = mips_elf_got_section (dynobj); - if (sgot == NULL) - g = NULL; - else - { - BFD_ASSERT (elf_section_data (sgot) != NULL); - g = (struct mips_got_info *) elf_section_data (sgot)->tdata; - BFD_ASSERT (g != NULL); - } - } - - sreloc = NULL; - bed = get_elf_backend_data (abfd); - rel_end = relocs + sec->reloc_count * bed->s->int_rels_per_ext_rel; - for (rel = relocs; rel < rel_end; ++rel) - { - unsigned long r_symndx; - int r_type; - struct elf_link_hash_entry *h; - - r_symndx = ELF32_R_SYM (rel->r_info); - r_type = ELF32_R_TYPE (rel->r_info); - - if (r_symndx < extsymoff) - h = NULL; - else if (r_symndx >= extsymoff + NUM_SHDR_ENTRIES (symtab_hdr)) - { - (*_bfd_error_handler) - (_("Malformed reloc detected for section %s"), name); - bfd_set_error (bfd_error_bad_value); - return false; - } - else - { - h = sym_hashes[r_symndx - extsymoff]; - - /* This may be an indirect symbol created because of a version. */ - if (h != NULL) - { - while (h->root.type == bfd_link_hash_indirect) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - } - } - - /* Some relocs require a global offset table. */ - if (dynobj == NULL || sgot == NULL) - { - switch (r_type) - { - case R_MIPS_GOT16: - case R_MIPS_CALL16: - case R_MIPS_CALL_HI16: - case R_MIPS_CALL_LO16: - case R_MIPS_GOT_HI16: - case R_MIPS_GOT_LO16: - case R_MIPS_GOT_PAGE: - case R_MIPS_GOT_OFST: - case R_MIPS_GOT_DISP: - if (dynobj == NULL) - elf_hash_table (info)->dynobj = dynobj = abfd; - if (! mips_elf_create_got_section (dynobj, info)) - return false; - g = mips_elf_got_info (dynobj, &sgot); - break; - - case R_MIPS_32: - case R_MIPS_REL32: - case R_MIPS_64: - if (dynobj == NULL - && (info->shared || h != NULL) - && (sec->flags & SEC_ALLOC) != 0) - elf_hash_table (info)->dynobj = dynobj = abfd; - break; - - default: - break; - } - } - - if (!h && (r_type == R_MIPS_CALL_LO16 - || r_type == R_MIPS_GOT_LO16 - || r_type == R_MIPS_GOT_DISP)) - { - /* We may need a local GOT entry for this relocation. We - don't count R_MIPS_GOT_PAGE because we can estimate the - maximum number of pages needed by looking at the size of - the segment. Similar comments apply to R_MIPS_GOT16 and - R_MIPS_CALL16. We don't count R_MIPS_GOT_HI16, or - R_MIPS_CALL_HI16 because these are always followed by an - R_MIPS_GOT_LO16 or R_MIPS_CALL_LO16. - - This estimation is very conservative since we can merge - duplicate entries in the GOT. In order to be less - conservative, we could actually build the GOT here, - rather than in relocate_section. */ - g->local_gotno++; - sgot->_raw_size += MIPS_ELF_GOT_SIZE (dynobj); - } - - switch (r_type) - { - case R_MIPS_CALL16: - if (h == NULL) - { - (*_bfd_error_handler) - (_("%s: CALL16 reloc at 0x%lx not against global symbol"), - bfd_get_filename (abfd), (unsigned long) rel->r_offset); - bfd_set_error (bfd_error_bad_value); - return false; - } - /* Fall through. */ - - case R_MIPS_CALL_HI16: - case R_MIPS_CALL_LO16: - if (h != NULL) - { - /* This symbol requires a global offset table entry. */ - if (!mips_elf_record_global_got_symbol (h, info, g)) - return false; - - /* We need a stub, not a plt entry for the undefined - function. But we record it as if it needs plt. See - elf_adjust_dynamic_symbol in elflink.h. */ - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; - h->type = STT_FUNC; - } - break; - - case R_MIPS_GOT16: - case R_MIPS_GOT_HI16: - case R_MIPS_GOT_LO16: - case R_MIPS_GOT_DISP: - /* This symbol requires a global offset table entry. */ - if (h && !mips_elf_record_global_got_symbol (h, info, g)) - return false; - break; - - case R_MIPS_32: - case R_MIPS_REL32: - case R_MIPS_64: - if ((info->shared || h != NULL) - && (sec->flags & SEC_ALLOC) != 0) - { - if (sreloc == NULL) - { - const char *name = MIPS_ELF_REL_DYN_SECTION_NAME (dynobj); - - sreloc = bfd_get_section_by_name (dynobj, name); - if (sreloc == NULL) - { - sreloc = bfd_make_section (dynobj, name); - if (sreloc == NULL - || ! bfd_set_section_flags (dynobj, sreloc, - (SEC_ALLOC - | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY - | SEC_LINKER_CREATED - | SEC_READONLY)) - || ! bfd_set_section_alignment (dynobj, sreloc, - 4)) - return false; - } - } -#define MIPS_READONLY_SECTION (SEC_ALLOC | SEC_LOAD | SEC_READONLY) - if (info->shared) - { - /* When creating a shared object, we must copy these - reloc types into the output file as R_MIPS_REL32 - relocs. We make room for this reloc in the - .rel.dyn reloc section. */ - mips_elf_allocate_dynamic_relocations (dynobj, 1); - if ((sec->flags & MIPS_READONLY_SECTION) - == MIPS_READONLY_SECTION) - /* We tell the dynamic linker that there are - relocations against the text segment. */ - info->flags |= DF_TEXTREL; - } - else - { - struct mips_elf_link_hash_entry *hmips; - - /* We only need to copy this reloc if the symbol is - defined in a dynamic object. */ - hmips = (struct mips_elf_link_hash_entry *) h; - ++hmips->possibly_dynamic_relocs; - if ((sec->flags & MIPS_READONLY_SECTION) - == MIPS_READONLY_SECTION) - /* We need it to tell the dynamic linker if there - are relocations against the text segment. */ - hmips->readonly_reloc = true; - } - - /* Even though we don't directly need a GOT entry for - this symbol, a symbol must have a dynamic symbol - table index greater that DT_MIPS_GOTSYM if there are - dynamic relocations against it. */ - if (h != NULL - && !mips_elf_record_global_got_symbol (h, info, g)) - return false; - } - - if (SGI_COMPAT (abfd)) - mips_elf_hash_table (info)->compact_rel_size += - sizeof (Elf32_External_crinfo); - break; - - case R_MIPS_26: - case R_MIPS_GPREL16: - case R_MIPS_LITERAL: - case R_MIPS_GPREL32: - if (SGI_COMPAT (abfd)) - mips_elf_hash_table (info)->compact_rel_size += - sizeof (Elf32_External_crinfo); - break; - - /* This relocation describes the C++ object vtable hierarchy. - Reconstruct it for later use during GC. */ - case R_MIPS_GNU_VTINHERIT: - if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) - return false; - break; - - /* This relocation describes which C++ vtable entries are actually - used. Record for later use during GC. */ - case R_MIPS_GNU_VTENTRY: - if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_offset)) - return false; - break; - - default: - break; - } - - /* We must not create a stub for a symbol that has relocations - related to taking the function's address. */ - switch (r_type) - { - default: - if (h != NULL) - { - struct mips_elf_link_hash_entry *mh; - - mh = (struct mips_elf_link_hash_entry *) h; - mh->no_fn_stub = true; - } - break; - case R_MIPS_CALL16: - case R_MIPS_CALL_HI16: - case R_MIPS_CALL_LO16: - break; - } - - /* If this reloc is not a 16 bit call, and it has a global - symbol, then we will need the fn_stub if there is one. - References from a stub section do not count. */ - if (h != NULL - && r_type != R_MIPS16_26 - && strncmp (bfd_get_section_name (abfd, sec), FN_STUB, - sizeof FN_STUB - 1) != 0 - && strncmp (bfd_get_section_name (abfd, sec), CALL_STUB, - sizeof CALL_STUB - 1) != 0 - && strncmp (bfd_get_section_name (abfd, sec), CALL_FP_STUB, - sizeof CALL_FP_STUB - 1) != 0) - { - struct mips_elf_link_hash_entry *mh; - - mh = (struct mips_elf_link_hash_entry *) h; - mh->need_fn_stub = true; - } - } - - return true; -} - -/* Return the section that should be marked against GC for a given - relocation. */ - -asection * -_bfd_mips_elf_gc_mark_hook (abfd, info, rel, h, sym) - bfd *abfd; - struct bfd_link_info *info ATTRIBUTE_UNUSED; - Elf_Internal_Rela *rel; - struct elf_link_hash_entry *h; - Elf_Internal_Sym *sym; -{ - /* ??? Do mips16 stub sections need to be handled special? */ - - if (h != NULL) - { - switch (ELF32_R_TYPE (rel->r_info)) - { - case R_MIPS_GNU_VTINHERIT: - case R_MIPS_GNU_VTENTRY: - break; - - default: - switch (h->root.type) - { - case bfd_link_hash_defined: - case bfd_link_hash_defweak: - return h->root.u.def.section; - - case bfd_link_hash_common: - return h->root.u.c.p->section; - - default: - break; - } - } - } - else - { - if (!(elf_bad_symtab (abfd) - && ELF_ST_BIND (sym->st_info) != STB_LOCAL) - && ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE) - && sym->st_shndx != SHN_COMMON)) - { - return bfd_section_from_elf_index (abfd, sym->st_shndx); - } - } - - return NULL; -} - -/* Update the got entry reference counts for the section being removed. */ - -boolean -_bfd_mips_elf_gc_sweep_hook (abfd, info, sec, relocs) - bfd *abfd ATTRIBUTE_UNUSED; - struct bfd_link_info *info ATTRIBUTE_UNUSED; - asection *sec ATTRIBUTE_UNUSED; - const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED; -{ -#if 0 - Elf_Internal_Shdr *symtab_hdr; - struct elf_link_hash_entry **sym_hashes; - bfd_signed_vma *local_got_refcounts; - const Elf_Internal_Rela *rel, *relend; - unsigned long r_symndx; - struct elf_link_hash_entry *h; - - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; - sym_hashes = elf_sym_hashes (abfd); - local_got_refcounts = elf_local_got_refcounts (abfd); - - relend = relocs + sec->reloc_count; - for (rel = relocs; rel < relend; rel++) - switch (ELF32_R_TYPE (rel->r_info)) - { - case R_MIPS_GOT16: - case R_MIPS_CALL16: - case R_MIPS_CALL_HI16: - case R_MIPS_CALL_LO16: - case R_MIPS_GOT_HI16: - case R_MIPS_GOT_LO16: - /* ??? It would seem that the existing MIPS code does no sort - of reference counting or whatnot on its GOT and PLT entries, - so it is not possible to garbage collect them at this time. */ - break; - - default: - break; - } -#endif - - return true; -} - -/* Copy data from a MIPS ELF indirect symbol to its direct symbol, - hiding the old indirect symbol. Process additional relocation - information. */ - -static void -_bfd_mips_elf_copy_indirect_symbol (dir, ind) - struct elf_link_hash_entry *dir, *ind; -{ - struct mips_elf_link_hash_entry *dirmips, *indmips; - - _bfd_elf_link_hash_copy_indirect (dir, ind); - - dirmips = (struct mips_elf_link_hash_entry *) dir; - indmips = (struct mips_elf_link_hash_entry *) ind; - dirmips->possibly_dynamic_relocs += indmips->possibly_dynamic_relocs; - if (indmips->readonly_reloc) - dirmips->readonly_reloc = true; - if (dirmips->min_dyn_reloc_index == 0 - || (indmips->min_dyn_reloc_index != 0 - && indmips->min_dyn_reloc_index < dirmips->min_dyn_reloc_index)) - dirmips->min_dyn_reloc_index = indmips->min_dyn_reloc_index; - if (indmips->no_fn_stub) - dirmips->no_fn_stub = true; -} - -/* Adjust a symbol defined by a dynamic object and referenced by a - regular object. The current definition is in some section of the - dynamic object, but we're not including those sections. We have to - change the definition to something the rest of the link can - understand. */ - -boolean -_bfd_mips_elf_adjust_dynamic_symbol (info, h) - struct bfd_link_info *info; - struct elf_link_hash_entry *h; -{ - bfd *dynobj; - struct mips_elf_link_hash_entry *hmips; - asection *s; - - dynobj = elf_hash_table (info)->dynobj; - - /* Make sure we know what is going on here. */ - BFD_ASSERT (dynobj != NULL - && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) - || h->weakdef != NULL - || ((h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_REF_REGULAR) != 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0))); - - /* If this symbol is defined in a dynamic object, we need to copy - any R_MIPS_32 or R_MIPS_REL32 relocs against it into the output - file. */ - hmips = (struct mips_elf_link_hash_entry *) h; - if (! info->relocateable - && hmips->possibly_dynamic_relocs != 0 - && (h->root.type == bfd_link_hash_defweak - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)) - { - mips_elf_allocate_dynamic_relocations (dynobj, - hmips->possibly_dynamic_relocs); - if (hmips->readonly_reloc) - /* We tell the dynamic linker that there are relocations - against the text segment. */ - info->flags |= DF_TEXTREL; - } - - /* For a function, create a stub, if allowed. */ - if (! hmips->no_fn_stub - && (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) - { - if (! elf_hash_table (info)->dynamic_sections_created) - return true; - - /* If this symbol is not defined in a regular file, then set - the symbol to the stub location. This is required to make - function pointers compare as equal between the normal - executable and the shared library. */ - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - { - /* We need .stub section. */ - s = bfd_get_section_by_name (dynobj, - MIPS_ELF_STUB_SECTION_NAME (dynobj)); - BFD_ASSERT (s != NULL); - - h->root.u.def.section = s; - h->root.u.def.value = s->_raw_size; - - /* XXX Write this stub address somewhere. */ - h->plt.offset = s->_raw_size; - - /* Make room for this stub code. */ - s->_raw_size += MIPS_FUNCTION_STUB_SIZE; - - /* The last half word of the stub will be filled with the index - of this symbol in .dynsym section. */ - return true; - } - } - else if ((h->type == STT_FUNC) - && (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) == 0) - { - /* This will set the entry for this symbol in the GOT to 0, and - the dynamic linker will take care of this. */ - h->root.u.def.value = 0; - return true; - } - - /* If this is a weak symbol, and there is a real definition, the - processor independent code will have arranged for us to see the - real definition first, and we can just use the same value. */ - if (h->weakdef != NULL) - { - BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined - || h->weakdef->root.type == bfd_link_hash_defweak); - h->root.u.def.section = h->weakdef->root.u.def.section; - h->root.u.def.value = h->weakdef->root.u.def.value; - return true; - } - - /* This is a reference to a symbol defined by a dynamic object which - is not a function. */ - - return true; -} - -/* This function is called after all the input files have been read, - and the input sections have been assigned to output sections. We - check for any mips16 stub sections that we can discard. */ - -static boolean mips_elf_check_mips16_stubs - PARAMS ((struct mips_elf_link_hash_entry *, PTR)); - -boolean -_bfd_mips_elf_always_size_sections (output_bfd, info) - bfd *output_bfd; - struct bfd_link_info *info; -{ - asection *ri; - - /* The .reginfo section has a fixed size. */ - ri = bfd_get_section_by_name (output_bfd, ".reginfo"); - if (ri != NULL) - bfd_set_section_size (output_bfd, ri, sizeof (Elf32_External_RegInfo)); - - if (info->relocateable - || ! mips_elf_hash_table (info)->mips16_stubs_seen) - return true; - - mips_elf_link_hash_traverse (mips_elf_hash_table (info), - mips_elf_check_mips16_stubs, - (PTR) NULL); - - return true; -} - -/* Check the mips16 stubs for a particular symbol, and see if we can - discard them. */ - -static boolean -mips_elf_check_mips16_stubs (h, data) - struct mips_elf_link_hash_entry *h; - PTR data ATTRIBUTE_UNUSED; -{ - if (h->fn_stub != NULL - && ! h->need_fn_stub) - { - /* We don't need the fn_stub; the only references to this symbol - are 16 bit calls. Clobber the size to 0 to prevent it from - being included in the link. */ - h->fn_stub->_raw_size = 0; - h->fn_stub->_cooked_size = 0; - h->fn_stub->flags &= ~SEC_RELOC; - h->fn_stub->reloc_count = 0; - h->fn_stub->flags |= SEC_EXCLUDE; - } - - if (h->call_stub != NULL - && h->root.other == STO_MIPS16) - { - /* We don't need the call_stub; this is a 16 bit function, so - calls from other 16 bit functions are OK. Clobber the size - to 0 to prevent it from being included in the link. */ - h->call_stub->_raw_size = 0; - h->call_stub->_cooked_size = 0; - h->call_stub->flags &= ~SEC_RELOC; - h->call_stub->reloc_count = 0; - h->call_stub->flags |= SEC_EXCLUDE; - } - - if (h->call_fp_stub != NULL - && h->root.other == STO_MIPS16) - { - /* We don't need the call_stub; this is a 16 bit function, so - calls from other 16 bit functions are OK. Clobber the size - to 0 to prevent it from being included in the link. */ - h->call_fp_stub->_raw_size = 0; - h->call_fp_stub->_cooked_size = 0; - h->call_fp_stub->flags &= ~SEC_RELOC; - h->call_fp_stub->reloc_count = 0; - h->call_fp_stub->flags |= SEC_EXCLUDE; - } - - return true; -} - -/* Set the sizes of the dynamic sections. */ - -boolean -_bfd_mips_elf_size_dynamic_sections (output_bfd, info) - bfd *output_bfd; - struct bfd_link_info *info; -{ - bfd *dynobj; - asection *s; - boolean reltext; - struct mips_got_info *g = NULL; - - dynobj = elf_hash_table (info)->dynobj; - BFD_ASSERT (dynobj != NULL); - - if (elf_hash_table (info)->dynamic_sections_created) - { - /* Set the contents of the .interp section to the interpreter. */ - if (! info->shared) - { - s = bfd_get_section_by_name (dynobj, ".interp"); - BFD_ASSERT (s != NULL); - s->_raw_size - = strlen (ELF_DYNAMIC_INTERPRETER (output_bfd)) + 1; - s->contents - = (bfd_byte *) ELF_DYNAMIC_INTERPRETER (output_bfd); - } - } - - /* The check_relocs and adjust_dynamic_symbol entry points have - determined the sizes of the various dynamic sections. Allocate - memory for them. */ - reltext = false; - for (s = dynobj->sections; s != NULL; s = s->next) - { - const char *name; - boolean strip; - - /* It's OK to base decisions on the section name, because none - of the dynobj section names depend upon the input files. */ - name = bfd_get_section_name (dynobj, s); - - if ((s->flags & SEC_LINKER_CREATED) == 0) - continue; - - strip = false; - - if (strncmp (name, ".rel", 4) == 0) - { - if (s->_raw_size == 0) - { - /* We only strip the section if the output section name - has the same name. Otherwise, there might be several - input sections for this output section. FIXME: This - code is probably not needed these days anyhow, since - the linker now does not create empty output sections. */ - if (s->output_section != NULL - && strcmp (name, - bfd_get_section_name (s->output_section->owner, - s->output_section)) == 0) - strip = true; - } - else - { - const char *outname; - asection *target; - - /* If this relocation section applies to a read only - section, then we probably need a DT_TEXTREL entry. - If the relocation section is .rel.dyn, we always - assert a DT_TEXTREL entry rather than testing whether - there exists a relocation to a read only section or - not. */ - outname = bfd_get_section_name (output_bfd, - s->output_section); - target = bfd_get_section_by_name (output_bfd, outname + 4); - if ((target != NULL - && (target->flags & SEC_READONLY) != 0 - && (target->flags & SEC_ALLOC) != 0) - || strcmp (outname, - MIPS_ELF_REL_DYN_SECTION_NAME (output_bfd)) == 0) - reltext = true; - - /* We use the reloc_count field as a counter if we need - to copy relocs into the output file. */ - if (strcmp (name, - MIPS_ELF_REL_DYN_SECTION_NAME (output_bfd)) != 0) - s->reloc_count = 0; - } - } - else if (strncmp (name, ".got", 4) == 0) - { - int i; - bfd_size_type loadable_size = 0; - bfd_size_type local_gotno; - bfd *sub; - - BFD_ASSERT (elf_section_data (s) != NULL); - g = (struct mips_got_info *) elf_section_data (s)->tdata; - BFD_ASSERT (g != NULL); - - /* Calculate the total loadable size of the output. That - will give us the maximum number of GOT_PAGE entries - required. */ - for (sub = info->input_bfds; sub; sub = sub->link_next) - { - asection *subsection; - - for (subsection = sub->sections; - subsection; - subsection = subsection->next) - { - if ((subsection->flags & SEC_ALLOC) == 0) - continue; - loadable_size += (subsection->_raw_size + 0xf) & ~0xf; - } - } - loadable_size += MIPS_FUNCTION_STUB_SIZE; - - /* Assume there are two loadable segments consisting of - contiguous sections. Is 5 enough? */ - local_gotno = (loadable_size >> 16) + 5; - if (IRIX_COMPAT (output_bfd) == ict_irix6) - /* It's possible we will need GOT_PAGE entries as well as - GOT16 entries. Often, these will be able to share GOT - entries, but not always. */ - local_gotno *= 2; - - g->local_gotno += local_gotno; - s->_raw_size += local_gotno * MIPS_ELF_GOT_SIZE (dynobj); - - /* There has to be a global GOT entry for every symbol with - a dynamic symbol table index of DT_MIPS_GOTSYM or - higher. Therefore, it make sense to put those symbols - that need GOT entries at the end of the symbol table. We - do that here. */ - if (!mips_elf_sort_hash_table (info, 1)) - return false; - - if (g->global_gotsym != NULL) - i = elf_hash_table (info)->dynsymcount - g->global_gotsym->dynindx; - else - /* If there are no global symbols, or none requiring - relocations, then GLOBAL_GOTSYM will be NULL. */ - i = 0; - g->global_gotno = i; - s->_raw_size += i * MIPS_ELF_GOT_SIZE (dynobj); - } - else if (strcmp (name, MIPS_ELF_STUB_SECTION_NAME (output_bfd)) == 0) - { - /* Irix rld assumes that the function stub isn't at the end - of .text section. So put a dummy. XXX */ - s->_raw_size += MIPS_FUNCTION_STUB_SIZE; - } - else if (! info->shared - && ! mips_elf_hash_table (info)->use_rld_obj_head - && strncmp (name, ".rld_map", 8) == 0) - { - /* We add a room for __rld_map. It will be filled in by the - rtld to contain a pointer to the _r_debug structure. */ - s->_raw_size += 4; - } - else if (SGI_COMPAT (output_bfd) - && strncmp (name, ".compact_rel", 12) == 0) - s->_raw_size += mips_elf_hash_table (info)->compact_rel_size; - else if (strcmp (name, MIPS_ELF_MSYM_SECTION_NAME (output_bfd)) - == 0) - s->_raw_size = (sizeof (Elf32_External_Msym) - * (elf_hash_table (info)->dynsymcount - + bfd_count_sections (output_bfd))); - else if (strncmp (name, ".init", 5) != 0) - { - /* It's not one of our sections, so don't allocate space. */ - continue; - } - - if (strip) - { - _bfd_strip_section_from_output (info, s); - continue; - } - - /* Allocate memory for the section contents. */ - s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); - if (s->contents == NULL && s->_raw_size != 0) - { - bfd_set_error (bfd_error_no_memory); - return false; - } - } - - if (elf_hash_table (info)->dynamic_sections_created) - { - /* Add some entries to the .dynamic section. We fill in the - values later, in elf_mips_finish_dynamic_sections, but we - must add the entries now so that we get the correct size for - the .dynamic section. The DT_DEBUG entry is filled in by the - dynamic linker and used by the debugger. */ - if (! info->shared) - { - /* SGI object has the equivalence of DT_DEBUG in the - DT_MIPS_RLD_MAP entry. */ - if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_MAP, 0)) - return false; - if (!SGI_COMPAT (output_bfd)) - { - if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0)) - return false; - } - } - else - { - /* Shared libraries on traditional mips have DT_DEBUG. */ - if (!SGI_COMPAT (output_bfd)) - { - if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0)) - return false; - } - } - - if (reltext && SGI_COMPAT (output_bfd)) - info->flags |= DF_TEXTREL; - - if ((info->flags & DF_TEXTREL) != 0) - { - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_TEXTREL, 0)) - return false; - } - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_PLTGOT, 0)) - return false; - - if (bfd_get_section_by_name (dynobj, - MIPS_ELF_REL_DYN_SECTION_NAME (dynobj))) - { - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_REL, 0)) - return false; - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_RELSZ, 0)) - return false; - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_RELENT, 0)) - return false; - } - - if (SGI_COMPAT (output_bfd)) - { - if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_CONFLICTNO, 0)) - return false; - } - - if (SGI_COMPAT (output_bfd)) - { - if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_LIBLISTNO, 0)) - return false; - } - - if (bfd_get_section_by_name (dynobj, ".conflict") != NULL) - { - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_CONFLICT, 0)) - return false; - - s = bfd_get_section_by_name (dynobj, ".liblist"); - BFD_ASSERT (s != NULL); - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_LIBLIST, 0)) - return false; - } - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_VERSION, 0)) - return false; - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_FLAGS, 0)) - return false; - -#if 0 - /* Time stamps in executable files are a bad idea. */ - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_TIME_STAMP, 0)) - return false; -#endif - -#if 0 /* FIXME */ - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_ICHECKSUM, 0)) - return false; -#endif - -#if 0 /* FIXME */ - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_IVERSION, 0)) - return false; -#endif - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_BASE_ADDRESS, 0)) - return false; - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_LOCAL_GOTNO, 0)) - return false; - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_SYMTABNO, 0)) - return false; - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_UNREFEXTNO, 0)) - return false; - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_GOTSYM, 0)) - return false; - - if (IRIX_COMPAT (dynobj) == ict_irix5 - && ! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_HIPAGENO, 0)) - return false; - - if (IRIX_COMPAT (dynobj) == ict_irix6 - && (bfd_get_section_by_name - (dynobj, MIPS_ELF_OPTIONS_SECTION_NAME (dynobj))) - && !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_OPTIONS, 0)) - return false; - - if (bfd_get_section_by_name (dynobj, - MIPS_ELF_MSYM_SECTION_NAME (dynobj)) - && !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_MSYM, 0)) - return false; - } - - return true; -} - -/* If NAME is one of the special IRIX6 symbols defined by the linker, - adjust it appropriately now. */ - -static void -mips_elf_irix6_finish_dynamic_symbol (abfd, name, sym) - bfd *abfd ATTRIBUTE_UNUSED; - const char *name; - Elf_Internal_Sym *sym; -{ - /* The linker script takes care of providing names and values for - these, but we must place them into the right sections. */ - static const char* const text_section_symbols[] = { - "_ftext", - "_etext", - "__dso_displacement", - "__elf_header", - "__program_header_table", - NULL - }; - - static const char* const data_section_symbols[] = { - "_fdata", - "_edata", - "_end", - "_fbss", - NULL - }; - - const char* const *p; - int i; - - for (i = 0; i < 2; ++i) - for (p = (i == 0) ? text_section_symbols : data_section_symbols; - *p; - ++p) - if (strcmp (*p, name) == 0) - { - /* All of these symbols are given type STT_SECTION by the - IRIX6 linker. */ - sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION); - - /* The IRIX linker puts these symbols in special sections. */ - if (i == 0) - sym->st_shndx = SHN_MIPS_TEXT; - else - sym->st_shndx = SHN_MIPS_DATA; - - break; - } -} - -/* Finish up dynamic symbol handling. We set the contents of various - dynamic sections here. */ - -boolean -_bfd_mips_elf_finish_dynamic_symbol (output_bfd, info, h, sym) - bfd *output_bfd; - struct bfd_link_info *info; - struct elf_link_hash_entry *h; - Elf_Internal_Sym *sym; -{ - bfd *dynobj; - bfd_vma gval; - asection *sgot; - asection *smsym; - struct mips_got_info *g; - const char *name; - struct mips_elf_link_hash_entry *mh; - - dynobj = elf_hash_table (info)->dynobj; - gval = sym->st_value; - mh = (struct mips_elf_link_hash_entry *) h; - - if (h->plt.offset != (bfd_vma) -1) - { - asection *s; - bfd_byte *p; - bfd_byte stub[MIPS_FUNCTION_STUB_SIZE]; - - /* This symbol has a stub. Set it up. */ - - BFD_ASSERT (h->dynindx != -1); - - s = bfd_get_section_by_name (dynobj, - MIPS_ELF_STUB_SECTION_NAME (dynobj)); - BFD_ASSERT (s != NULL); - - /* Fill the stub. */ - p = stub; - bfd_put_32 (output_bfd, STUB_LW (output_bfd), p); - p += 4; - bfd_put_32 (output_bfd, STUB_MOVE (output_bfd), p); - p += 4; - - /* FIXME: Can h->dynindex be more than 64K? */ - if (h->dynindx & 0xffff0000) - return false; - - bfd_put_32 (output_bfd, STUB_JALR, p); - p += 4; - bfd_put_32 (output_bfd, STUB_LI16 (output_bfd) + h->dynindx, p); - - BFD_ASSERT (h->plt.offset <= s->_raw_size); - memcpy (s->contents + h->plt.offset, stub, MIPS_FUNCTION_STUB_SIZE); - - /* Mark the symbol as undefined. plt.offset != -1 occurs - only for the referenced symbol. */ - sym->st_shndx = SHN_UNDEF; - - /* The run-time linker uses the st_value field of the symbol - to reset the global offset table entry for this external - to its stub address when unlinking a shared object. */ - gval = s->output_section->vma + s->output_offset + h->plt.offset; - sym->st_value = gval; - } - - BFD_ASSERT (h->dynindx != -1 - || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0); - - sgot = mips_elf_got_section (dynobj); - BFD_ASSERT (sgot != NULL); - BFD_ASSERT (elf_section_data (sgot) != NULL); - g = (struct mips_got_info *) elf_section_data (sgot)->tdata; - BFD_ASSERT (g != NULL); - - /* Run through the global symbol table, creating GOT entries for all - the symbols that need them. */ - if (g->global_gotsym != NULL - && h->dynindx >= g->global_gotsym->dynindx) - { - bfd_vma offset; - bfd_vma value; - - if (sym->st_value) - value = sym->st_value; - else - { - /* For an entity defined in a shared object, this will be - NULL. (For functions in shared objects for - which we have created stubs, ST_VALUE will be non-NULL. - That's because such the functions are now no longer defined - in a shared object.) */ - - if (info->shared && h->root.type == bfd_link_hash_undefined) - value = 0; - else - value = h->root.u.def.value; - } - offset = mips_elf_global_got_index (dynobj, h); - MIPS_ELF_PUT_WORD (output_bfd, value, sgot->contents + offset); - } - - /* Create a .msym entry, if appropriate. */ - smsym = bfd_get_section_by_name (dynobj, - MIPS_ELF_MSYM_SECTION_NAME (dynobj)); - if (smsym) - { - Elf32_Internal_Msym msym; - - msym.ms_hash_value = bfd_elf_hash (h->root.root.string); - /* It is undocumented what the `1' indicates, but IRIX6 uses - this value. */ - msym.ms_info = ELF32_MS_INFO (mh->min_dyn_reloc_index, 1); - bfd_mips_elf_swap_msym_out - (dynobj, &msym, - ((Elf32_External_Msym *) smsym->contents) + h->dynindx); - } - - /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */ - name = h->root.root.string; - if (strcmp (name, "_DYNAMIC") == 0 - || strcmp (name, "_GLOBAL_OFFSET_TABLE_") == 0) - sym->st_shndx = SHN_ABS; - else if (strcmp (name, "_DYNAMIC_LINK") == 0 - || strcmp (name, "_DYNAMIC_LINKING") == 0) - { - sym->st_shndx = SHN_ABS; - sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION); - sym->st_value = 1; - } - else if (strcmp (name, "_gp_disp") == 0) - { - sym->st_shndx = SHN_ABS; - sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION); - sym->st_value = elf_gp (output_bfd); - } - else if (SGI_COMPAT (output_bfd)) - { - if (strcmp (name, mips_elf_dynsym_rtproc_names[0]) == 0 - || strcmp (name, mips_elf_dynsym_rtproc_names[1]) == 0) - { - sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION); - sym->st_other = STO_PROTECTED; - sym->st_value = 0; - sym->st_shndx = SHN_MIPS_DATA; - } - else if (strcmp (name, mips_elf_dynsym_rtproc_names[2]) == 0) - { - sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION); - sym->st_other = STO_PROTECTED; - sym->st_value = mips_elf_hash_table (info)->procedure_count; - sym->st_shndx = SHN_ABS; - } - else if (sym->st_shndx != SHN_UNDEF && sym->st_shndx != SHN_ABS) - { - if (h->type == STT_FUNC) - sym->st_shndx = SHN_MIPS_TEXT; - else if (h->type == STT_OBJECT) - sym->st_shndx = SHN_MIPS_DATA; - } - } - - /* Handle the IRIX6-specific symbols. */ - if (IRIX_COMPAT (output_bfd) == ict_irix6) - mips_elf_irix6_finish_dynamic_symbol (output_bfd, name, sym); - - if (! info->shared) - { - if (! mips_elf_hash_table (info)->use_rld_obj_head - && (strcmp (name, "__rld_map") == 0 - || strcmp (name, "__RLD_MAP") == 0)) - { - asection *s = bfd_get_section_by_name (dynobj, ".rld_map"); - BFD_ASSERT (s != NULL); - sym->st_value = s->output_section->vma + s->output_offset; - bfd_put_32 (output_bfd, (bfd_vma) 0, s->contents); - if (mips_elf_hash_table (info)->rld_value == 0) - mips_elf_hash_table (info)->rld_value = sym->st_value; - } - else if (mips_elf_hash_table (info)->use_rld_obj_head - && strcmp (name, "__rld_obj_head") == 0) - { - /* IRIX6 does not use a .rld_map section. */ - if (IRIX_COMPAT (output_bfd) == ict_irix5 - || IRIX_COMPAT (output_bfd) == ict_none) - BFD_ASSERT (bfd_get_section_by_name (dynobj, ".rld_map") - != NULL); - mips_elf_hash_table (info)->rld_value = sym->st_value; - } - } - - /* If this is a mips16 symbol, force the value to be even. */ - if (sym->st_other == STO_MIPS16 - && (sym->st_value & 1) != 0) - --sym->st_value; - - return true; -} - -/* Finish up the dynamic sections. */ - -boolean -_bfd_mips_elf_finish_dynamic_sections (output_bfd, info) - bfd *output_bfd; - struct bfd_link_info *info; -{ - bfd *dynobj; - asection *sdyn; - asection *sgot; - struct mips_got_info *g; - - dynobj = elf_hash_table (info)->dynobj; - - sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); - - sgot = mips_elf_got_section (dynobj); - if (sgot == NULL) - g = NULL; - else - { - BFD_ASSERT (elf_section_data (sgot) != NULL); - g = (struct mips_got_info *) elf_section_data (sgot)->tdata; - BFD_ASSERT (g != NULL); - } - - if (elf_hash_table (info)->dynamic_sections_created) - { - bfd_byte *b; - - BFD_ASSERT (sdyn != NULL); - BFD_ASSERT (g != NULL); - - for (b = sdyn->contents; - b < sdyn->contents + sdyn->_raw_size; - b += MIPS_ELF_DYN_SIZE (dynobj)) - { - Elf_Internal_Dyn dyn; - const char *name; - size_t elemsize; - asection *s; - boolean swap_out_p; - - /* Read in the current dynamic entry. */ - (*get_elf_backend_data (dynobj)->s->swap_dyn_in) (dynobj, b, &dyn); - - /* Assume that we're going to modify it and write it out. */ - swap_out_p = true; - - switch (dyn.d_tag) - { - case DT_RELENT: - s = (bfd_get_section_by_name - (dynobj, - MIPS_ELF_REL_DYN_SECTION_NAME (dynobj))); - BFD_ASSERT (s != NULL); - dyn.d_un.d_val = MIPS_ELF_REL_SIZE (dynobj); - break; - - case DT_STRSZ: - /* Rewrite DT_STRSZ. */ - dyn.d_un.d_val = - _bfd_stringtab_size (elf_hash_table (info)->dynstr); - break; - - case DT_PLTGOT: - name = ".got"; - goto get_vma; - case DT_MIPS_CONFLICT: - name = ".conflict"; - goto get_vma; - case DT_MIPS_LIBLIST: - name = ".liblist"; - get_vma: - s = bfd_get_section_by_name (output_bfd, name); - BFD_ASSERT (s != NULL); - dyn.d_un.d_ptr = s->vma; - break; - - case DT_MIPS_RLD_VERSION: - dyn.d_un.d_val = 1; /* XXX */ - break; - - case DT_MIPS_FLAGS: - dyn.d_un.d_val = RHF_NOTPOT; /* XXX */ - break; - - case DT_MIPS_CONFLICTNO: - name = ".conflict"; - elemsize = sizeof (Elf32_Conflict); - goto set_elemno; - - case DT_MIPS_LIBLISTNO: - name = ".liblist"; - elemsize = sizeof (Elf32_Lib); - set_elemno: - s = bfd_get_section_by_name (output_bfd, name); - if (s != NULL) - { - if (s->_cooked_size != 0) - dyn.d_un.d_val = s->_cooked_size / elemsize; - else - dyn.d_un.d_val = s->_raw_size / elemsize; - } - else - dyn.d_un.d_val = 0; - break; - - case DT_MIPS_TIME_STAMP: - time ((time_t *) &dyn.d_un.d_val); - break; - - case DT_MIPS_ICHECKSUM: - /* XXX FIXME: */ - swap_out_p = false; - break; - - case DT_MIPS_IVERSION: - /* XXX FIXME: */ - swap_out_p = false; - break; - - case DT_MIPS_BASE_ADDRESS: - s = output_bfd->sections; - BFD_ASSERT (s != NULL); - dyn.d_un.d_ptr = s->vma & ~(0xffff); - break; - - case DT_MIPS_LOCAL_GOTNO: - dyn.d_un.d_val = g->local_gotno; - break; - - case DT_MIPS_UNREFEXTNO: - /* The index into the dynamic symbol table which is the - entry of the first external symbol that is not - referenced within the same object. */ - dyn.d_un.d_val = bfd_count_sections (output_bfd) + 1; - break; - - case DT_MIPS_GOTSYM: - if (g->global_gotsym) - { - dyn.d_un.d_val = g->global_gotsym->dynindx; - break; - } - /* In case if we don't have global got symbols we default - to setting DT_MIPS_GOTSYM to the same value as - DT_MIPS_SYMTABNO, so we just fall through. */ - - case DT_MIPS_SYMTABNO: - name = ".dynsym"; - elemsize = MIPS_ELF_SYM_SIZE (output_bfd); - s = bfd_get_section_by_name (output_bfd, name); - BFD_ASSERT (s != NULL); - - if (s->_cooked_size != 0) - dyn.d_un.d_val = s->_cooked_size / elemsize; - else - dyn.d_un.d_val = s->_raw_size / elemsize; - break; - - case DT_MIPS_HIPAGENO: - dyn.d_un.d_val = g->local_gotno - MIPS_RESERVED_GOTNO; - break; - - case DT_MIPS_RLD_MAP: - dyn.d_un.d_ptr = mips_elf_hash_table (info)->rld_value; - break; - - case DT_MIPS_OPTIONS: - s = (bfd_get_section_by_name - (output_bfd, MIPS_ELF_OPTIONS_SECTION_NAME (output_bfd))); - dyn.d_un.d_ptr = s->vma; - break; - - case DT_MIPS_MSYM: - s = (bfd_get_section_by_name - (output_bfd, MIPS_ELF_MSYM_SECTION_NAME (output_bfd))); - dyn.d_un.d_ptr = s->vma; - break; - - default: - swap_out_p = false; - break; - } - - if (swap_out_p) - (*get_elf_backend_data (dynobj)->s->swap_dyn_out) - (dynobj, &dyn, b); - } - } - - /* The first entry of the global offset table will be filled at - runtime. The second entry will be used by some runtime loaders. - This isn't the case of Irix rld. */ - if (sgot != NULL && sgot->_raw_size > 0) - { - MIPS_ELF_PUT_WORD (output_bfd, (bfd_vma) 0, sgot->contents); - MIPS_ELF_PUT_WORD (output_bfd, (bfd_vma) 0x80000000, - sgot->contents + MIPS_ELF_GOT_SIZE (output_bfd)); - } - - if (sgot != NULL) - elf_section_data (sgot->output_section)->this_hdr.sh_entsize - = MIPS_ELF_GOT_SIZE (output_bfd); - - { - asection *smsym; - asection *s; - Elf32_compact_rel cpt; - - /* ??? The section symbols for the output sections were set up in - _bfd_elf_final_link. SGI sets the STT_NOTYPE attribute for these - symbols. Should we do so? */ - - smsym = bfd_get_section_by_name (dynobj, - MIPS_ELF_MSYM_SECTION_NAME (dynobj)); - if (smsym != NULL) - { - Elf32_Internal_Msym msym; - - msym.ms_hash_value = 0; - msym.ms_info = ELF32_MS_INFO (0, 1); - - for (s = output_bfd->sections; s != NULL; s = s->next) - { - long dynindx = elf_section_data (s)->dynindx; - - bfd_mips_elf_swap_msym_out - (output_bfd, &msym, - (((Elf32_External_Msym *) smsym->contents) - + dynindx)); - } - } - - if (SGI_COMPAT (output_bfd)) - { - /* Write .compact_rel section out. */ - s = bfd_get_section_by_name (dynobj, ".compact_rel"); - if (s != NULL) - { - cpt.id1 = 1; - cpt.num = s->reloc_count; - cpt.id2 = 2; - cpt.offset = (s->output_section->filepos - + sizeof (Elf32_External_compact_rel)); - cpt.reserved0 = 0; - cpt.reserved1 = 0; - bfd_elf32_swap_compact_rel_out (output_bfd, &cpt, - ((Elf32_External_compact_rel *) - s->contents)); - - /* Clean up a dummy stub function entry in .text. */ - s = bfd_get_section_by_name (dynobj, - MIPS_ELF_STUB_SECTION_NAME (dynobj)); - if (s != NULL) - { - file_ptr dummy_offset; - - BFD_ASSERT (s->_raw_size >= MIPS_FUNCTION_STUB_SIZE); - dummy_offset = s->_raw_size - MIPS_FUNCTION_STUB_SIZE; - memset (s->contents + dummy_offset, 0, - MIPS_FUNCTION_STUB_SIZE); - } - } - } - - /* We need to sort the entries of the dynamic relocation section. */ - - if (!ABI_64_P (output_bfd)) - { - asection *reldyn; - - reldyn = bfd_get_section_by_name (dynobj, - MIPS_ELF_REL_DYN_SECTION_NAME (dynobj)); - if (reldyn != NULL && reldyn->reloc_count > 2) - { - reldyn_sorting_bfd = output_bfd; - qsort ((Elf32_External_Rel *) reldyn->contents + 1, - (size_t) reldyn->reloc_count - 1, - sizeof (Elf32_External_Rel), sort_dynamic_relocs); - } - } - - /* Clean up a first relocation in .rel.dyn. */ - s = bfd_get_section_by_name (dynobj, - MIPS_ELF_REL_DYN_SECTION_NAME (dynobj)); - if (s != NULL && s->_raw_size > 0) - memset (s->contents, 0, MIPS_ELF_REL_SIZE (dynobj)); - } - - return true; -} - -/* Support for core dump NOTE sections */ -static boolean -_bfd_elf32_mips_grok_prstatus (abfd, note) - bfd *abfd; - Elf_Internal_Note *note; -{ - int offset; - int raw_size; - - switch (note->descsz) - { - default: - return false; - - case 256: /* Linux/MIPS */ - /* pr_cursig */ - elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); - - /* pr_pid */ - elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24); - - /* pr_reg */ - offset = 72; - raw_size = 180; - - break; - } - - /* Make a ".reg/999" section. */ - return _bfd_elfcore_make_pseudosection (abfd, ".reg", - raw_size, note->descpos + offset); -} - -static boolean -_bfd_elf32_mips_grok_psinfo (abfd, note) - bfd *abfd; - Elf_Internal_Note *note; -{ - switch (note->descsz) - { - default: - return false; - - case 128: /* Linux/MIPS elf_prpsinfo */ - elf_tdata (abfd)->core_program - = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16); - elf_tdata (abfd)->core_command - = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80); - } - - /* Note that for some reason, a spurious space is tacked - onto the end of the args in some (at least one anyway) - implementations, so strip it off if it exists. */ - - { - char *command = elf_tdata (abfd)->core_command; - int n = strlen (command); - - if (0 < n && command[n - 1] == ' ') - command[n - 1] = '\0'; - } - - return true; -} - -/* This is almost identical to bfd_generic_get_... except that some - MIPS relocations need to be handled specially. Sigh. */ - -static bfd_byte * -elf32_mips_get_relocated_section_contents (abfd, link_info, link_order, data, - relocateable, symbols) - bfd *abfd; - struct bfd_link_info *link_info; - struct bfd_link_order *link_order; - bfd_byte *data; - boolean relocateable; - asymbol **symbols; -{ - /* Get enough memory to hold the stuff */ - bfd *input_bfd = link_order->u.indirect.section->owner; - asection *input_section = link_order->u.indirect.section; - - long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section); - arelent **reloc_vector = NULL; - long reloc_count; - - if (reloc_size < 0) - goto error_return; - - reloc_vector = (arelent **) bfd_malloc (reloc_size); - if (reloc_vector == NULL && reloc_size != 0) - goto error_return; - - /* read in the section */ - if (!bfd_get_section_contents (input_bfd, - input_section, - (PTR) data, - 0, - input_section->_raw_size)) - goto error_return; - - /* We're not relaxing the section, so just copy the size info */ - input_section->_cooked_size = input_section->_raw_size; - input_section->reloc_done = true; - - reloc_count = bfd_canonicalize_reloc (input_bfd, - input_section, - reloc_vector, - symbols); - if (reloc_count < 0) - goto error_return; - - if (reloc_count > 0) - { - arelent **parent; - /* for mips */ - int gp_found; - bfd_vma gp = 0x12345678; /* initialize just to shut gcc up */ - - { - struct bfd_hash_entry *h; - struct bfd_link_hash_entry *lh; - /* Skip all this stuff if we aren't mixing formats. */ - if (abfd && input_bfd - && abfd->xvec == input_bfd->xvec) - lh = 0; - else - { - h = bfd_hash_lookup (&link_info->hash->table, "_gp", false, false); - lh = (struct bfd_link_hash_entry *) h; - } - lookup: - if (lh) - { - switch (lh->type) - { - case bfd_link_hash_undefined: - case bfd_link_hash_undefweak: - case bfd_link_hash_common: - gp_found = 0; - break; - case bfd_link_hash_defined: - case bfd_link_hash_defweak: - gp_found = 1; - gp = lh->u.def.value; - break; - case bfd_link_hash_indirect: - case bfd_link_hash_warning: - lh = lh->u.i.link; - /* @@FIXME ignoring warning for now */ - goto lookup; - case bfd_link_hash_new: - default: - abort (); - } - } - else - gp_found = 0; - } - /* end mips */ - for (parent = reloc_vector; *parent != (arelent *) NULL; - parent++) - { - char *error_message = (char *) NULL; - bfd_reloc_status_type r; - - /* Specific to MIPS: Deal with relocation types that require - knowing the gp of the output bfd. */ - asymbol *sym = *(*parent)->sym_ptr_ptr; - if (bfd_is_abs_section (sym->section) && abfd) - { - /* The special_function wouldn't get called anyways. */ - } - else if (!gp_found) - { - /* The gp isn't there; let the special function code - fall over on its own. */ - } - else if ((*parent)->howto->special_function - == _bfd_mips_elf_gprel16_reloc) - { - /* bypass special_function call */ - r = gprel16_with_gp (input_bfd, sym, *parent, input_section, - relocateable, (PTR) data, gp); - goto skip_bfd_perform_relocation; - } - /* end mips specific stuff */ - - r = bfd_perform_relocation (input_bfd, - *parent, - (PTR) data, - input_section, - relocateable ? abfd : (bfd *) NULL, - &error_message); - skip_bfd_perform_relocation: - - if (relocateable) - { - asection *os = input_section->output_section; - - /* A partial link, so keep the relocs */ - os->orelocation[os->reloc_count] = *parent; - os->reloc_count++; - } - - if (r != bfd_reloc_ok) - { - switch (r) - { - case bfd_reloc_undefined: - if (!((*link_info->callbacks->undefined_symbol) - (link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr), - input_bfd, input_section, (*parent)->address, - true))) - goto error_return; - break; - case bfd_reloc_dangerous: - BFD_ASSERT (error_message != (char *) NULL); - if (!((*link_info->callbacks->reloc_dangerous) - (link_info, error_message, input_bfd, input_section, - (*parent)->address))) - goto error_return; - break; - case bfd_reloc_overflow: - if (!((*link_info->callbacks->reloc_overflow) - (link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr), - (*parent)->howto->name, (*parent)->addend, - input_bfd, input_section, (*parent)->address))) - goto error_return; - break; - case bfd_reloc_outofrange: - default: - abort (); - break; - } - - } - } - } - if (reloc_vector != NULL) - free (reloc_vector); - return data; - -error_return: - if (reloc_vector != NULL) - free (reloc_vector); - return NULL; -} - -#define bfd_elf32_bfd_get_relocated_section_contents \ - elf32_mips_get_relocated_section_contents - -/* ECOFF swapping routines. These are used when dealing with the - .mdebug section, which is in the ECOFF debugging format. */ -static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = { - /* Symbol table magic number. */ - magicSym, - /* Alignment of debugging information. E.g., 4. */ - 4, - /* Sizes of external symbolic information. */ - sizeof (struct hdr_ext), - sizeof (struct dnr_ext), - sizeof (struct pdr_ext), - sizeof (struct sym_ext), - sizeof (struct opt_ext), - sizeof (struct fdr_ext), - sizeof (struct rfd_ext), - sizeof (struct ext_ext), - /* Functions to swap in external symbolic data. */ - ecoff_swap_hdr_in, - ecoff_swap_dnr_in, - ecoff_swap_pdr_in, - ecoff_swap_sym_in, - ecoff_swap_opt_in, - ecoff_swap_fdr_in, - ecoff_swap_rfd_in, - ecoff_swap_ext_in, - _bfd_ecoff_swap_tir_in, - _bfd_ecoff_swap_rndx_in, - /* Functions to swap out external symbolic data. */ - ecoff_swap_hdr_out, - ecoff_swap_dnr_out, - ecoff_swap_pdr_out, - ecoff_swap_sym_out, - ecoff_swap_opt_out, - ecoff_swap_fdr_out, - ecoff_swap_rfd_out, - ecoff_swap_ext_out, - _bfd_ecoff_swap_tir_out, - _bfd_ecoff_swap_rndx_out, - /* Function to read in symbolic data. */ - _bfd_mips_elf_read_ecoff_info -}; - -#define TARGET_LITTLE_SYM bfd_elf32_littlemips_vec -#define TARGET_LITTLE_NAME "elf32-littlemips" -#define TARGET_BIG_SYM bfd_elf32_bigmips_vec -#define TARGET_BIG_NAME "elf32-bigmips" -#define ELF_ARCH bfd_arch_mips -#define ELF_MACHINE_CODE EM_MIPS - -/* The SVR4 MIPS ABI says that this should be 0x10000, but Irix 5 uses - a value of 0x1000, and we are compatible. */ -#define ELF_MAXPAGESIZE 0x1000 - -#define elf_backend_collect true -#define elf_backend_type_change_ok true -#define elf_backend_can_gc_sections true -#define elf_backend_sign_extend_vma true -#define elf_info_to_howto mips_info_to_howto_rela -#define elf_info_to_howto_rel mips_info_to_howto_rel -#define elf_backend_sym_is_global mips_elf_sym_is_global -#define elf_backend_object_p _bfd_mips_elf_object_p -#define elf_backend_section_from_shdr _bfd_mips_elf_section_from_shdr -#define elf_backend_fake_sections _bfd_mips_elf_fake_sections -#define elf_backend_section_from_bfd_section \ - _bfd_mips_elf_section_from_bfd_section -#define elf_backend_section_processing _bfd_mips_elf_section_processing -#define elf_backend_symbol_processing _bfd_mips_elf_symbol_processing -#define elf_backend_additional_program_headers \ - _bfd_mips_elf_additional_program_headers -#define elf_backend_modify_segment_map _bfd_mips_elf_modify_segment_map -#define elf_backend_final_write_processing \ - _bfd_mips_elf_final_write_processing -#define elf_backend_ecoff_debug_swap &mips_elf32_ecoff_debug_swap -#define elf_backend_add_symbol_hook _bfd_mips_elf_add_symbol_hook -#define elf_backend_create_dynamic_sections \ - _bfd_mips_elf_create_dynamic_sections -#define elf_backend_check_relocs _bfd_mips_elf_check_relocs -#define elf_backend_adjust_dynamic_symbol \ - _bfd_mips_elf_adjust_dynamic_symbol -#define elf_backend_always_size_sections \ - _bfd_mips_elf_always_size_sections -#define elf_backend_size_dynamic_sections \ - _bfd_mips_elf_size_dynamic_sections -#define elf_backend_relocate_section _bfd_mips_elf_relocate_section -#define elf_backend_link_output_symbol_hook \ - _bfd_mips_elf_link_output_symbol_hook -#define elf_backend_finish_dynamic_symbol \ - _bfd_mips_elf_finish_dynamic_symbol -#define elf_backend_finish_dynamic_sections \ - _bfd_mips_elf_finish_dynamic_sections -#define elf_backend_gc_mark_hook _bfd_mips_elf_gc_mark_hook -#define elf_backend_gc_sweep_hook _bfd_mips_elf_gc_sweep_hook - -#define elf_backend_got_header_size (4*MIPS_RESERVED_GOTNO) -#define elf_backend_plt_header_size 0 - -#define elf_backend_copy_indirect_symbol \ - _bfd_mips_elf_copy_indirect_symbol - -#define elf_backend_hide_symbol _bfd_mips_elf_hide_symbol -#define elf_backend_grok_prstatus _bfd_elf32_mips_grok_prstatus -#define elf_backend_grok_psinfo _bfd_elf32_mips_grok_psinfo - -#define bfd_elf32_bfd_is_local_label_name \ - mips_elf_is_local_label_name -#define bfd_elf32_find_nearest_line _bfd_mips_elf_find_nearest_line -#define bfd_elf32_set_section_contents _bfd_mips_elf_set_section_contents -#define bfd_elf32_bfd_link_hash_table_create \ - _bfd_mips_elf_link_hash_table_create -#define bfd_elf32_bfd_final_link _bfd_mips_elf_final_link -#define bfd_elf32_bfd_copy_private_bfd_data \ - _bfd_mips_elf_copy_private_bfd_data -#define bfd_elf32_bfd_merge_private_bfd_data \ - _bfd_mips_elf_merge_private_bfd_data -#define bfd_elf32_bfd_set_private_flags _bfd_mips_elf_set_private_flags -#define bfd_elf32_bfd_print_private_bfd_data \ - _bfd_mips_elf_print_private_bfd_data -#include "elf32-target.h" - -/* Support for traditional mips targets */ - -#define INCLUDED_TARGET_FILE /* More a type of flag */ - -#undef TARGET_LITTLE_SYM -#undef TARGET_LITTLE_NAME -#undef TARGET_BIG_SYM -#undef TARGET_BIG_NAME - -#define TARGET_LITTLE_SYM bfd_elf32_tradlittlemips_vec -#define TARGET_LITTLE_NAME "elf32-tradlittlemips" -#define TARGET_BIG_SYM bfd_elf32_tradbigmips_vec -#define TARGET_BIG_NAME "elf32-tradbigmips" - -/* Include the target file again for this target */ -#include "elf32-target.h" diff -uprN binutils-2.11.90.0.31/bfd/elf32-openrisc.c binutils-2.11.92.0.5/bfd/elf32-openrisc.c --- binutils-2.11.90.0.31/bfd/elf32-openrisc.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/elf32-openrisc.c Mon Oct 1 15:25:21 2001 @@ -1,5 +1,5 @@ /* OpenRISC-specific support for 32-bit ELF. - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright 2001 Free Software Foundation, Inc. Contributed by Johan Rydberg, jrydberg@opencores.org This file is part of BFD, the Binary File Descriptor library. @@ -35,10 +35,10 @@ static boolean openrisc_elf_relocate_sec PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); static bfd_reloc_status_type openrisc_final_link_relocate - PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *, + PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, bfd_vma)); static boolean openrisc_elf_gc_sweep_hook - PARAMS ((bfd *, struct bfd_link_info *, asection *, + PARAMS ((bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *)); static asection * openrisc_elf_gc_mark_hook PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *, @@ -638,6 +638,7 @@ openrisc_elf_final_write_processing (abf #define ELF_ARCH bfd_arch_openrisc #define ELF_MACHINE_CODE EM_OPENRISC +#define ELF_MACHINE_ALT1 EM_OPENRISC_OLD #define ELF_MAXPAGESIZE 0x1000 #define TARGET_BIG_SYM bfd_elf32_openrisc_vec diff -uprN binutils-2.11.90.0.31/bfd/elf32-pj.c binutils-2.11.92.0.5/bfd/elf32-pj.c --- binutils-2.11.90.0.31/bfd/elf32-pj.c Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/bfd/elf32-pj.c Mon Oct 1 15:25:21 2001 @@ -1,5 +1,5 @@ /* picoJava specific support for 32-bit ELF - Copyright 1999, 2000 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001 Free Software Foundation, Inc. Contributed by Steve Chamberlan of Transmeta (sac@pobox.com). This file is part of BFD, the Binary File Descriptor library. @@ -224,7 +224,7 @@ pj_elf_reloc (abfd, reloc_entry, symbol_ case R_PJ_DATA_DIR32: insn = bfd_get_32 (abfd, hit_data); insn += sym_value + reloc_entry->addend; - bfd_put_32 (abfd, insn, hit_data); + bfd_put_32 (abfd, (bfd_vma) insn, hit_data); break; /* Relocations in code are always bigendian, no matter what the @@ -233,7 +233,7 @@ pj_elf_reloc (abfd, reloc_entry, symbol_ case R_PJ_CODE_DIR32: insn = bfd_getb32 (hit_data); insn += sym_value + reloc_entry->addend; - bfd_putb32 (insn, hit_data); + bfd_putb32 ((bfd_vma) insn, hit_data); break; case R_PJ_CODE_REL16: @@ -241,18 +241,18 @@ pj_elf_reloc (abfd, reloc_entry, symbol_ insn += sym_value + reloc_entry->addend - (input_section->output_section->vma + input_section->output_offset); - bfd_putb16 (insn, hit_data); + bfd_putb16 ((bfd_vma) insn, hit_data); break; case R_PJ_CODE_LO16: insn = bfd_getb16 (hit_data); insn += sym_value + reloc_entry->addend; - bfd_putb16 (insn, hit_data); + bfd_putb16 ((bfd_vma) insn, hit_data); break; case R_PJ_CODE_HI16: insn = bfd_getb16 (hit_data); insn += (sym_value + reloc_entry->addend) >> 16; - bfd_putb16 (insn, hit_data); + bfd_putb16 ((bfd_vma) insn, hit_data); break; default: @@ -341,6 +341,7 @@ pj_elf_final_write_processing (abfd, lin #define TARGET_LITTLE_NAME "elf32-pjl" #define ELF_ARCH bfd_arch_pj #define ELF_MACHINE_CODE EM_PJ +#define ELF_MACHINE_ALT1 EM_PJ_OLD #define ELF_MAXPAGESIZE 0x1000 #define bfd_elf32_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents #define bfd_elf32_bfd_reloc_type_lookup pj_elf_reloc_type_lookup diff -uprN binutils-2.11.90.0.31/bfd/elf32-ppc.c binutils-2.11.92.0.5/bfd/elf32-ppc.c --- binutils-2.11.90.0.31/bfd/elf32-ppc.c Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/bfd/elf32-ppc.c Sun Oct 7 16:33:12 2001 @@ -108,7 +108,8 @@ static boolean ppc_elf_finish_dynamic_sy Elf_Internal_Sym *)); static boolean ppc_elf_finish_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *)); -static enum elf_reloc_type_class ppc_elf_reloc_type_class PARAMS ((int)); +static enum elf_reloc_type_class ppc_elf_reloc_type_class + PARAMS ((const Elf_Internal_Rela *)); static boolean ppc_elf_grok_prstatus PARAMS ((bfd *abfd, Elf_Internal_Note *note)); static boolean ppc_elf_grok_psinfo @@ -1059,6 +1060,7 @@ ppc_elf_relax_section (abfd, isec, link_ if (isec->reloc_count) { unsigned n; + bfd_size_type amt; /* Get a copy of the native relocations. */ internal_relocs = _bfd_elf32_link_read_relocs ( @@ -1070,8 +1072,9 @@ ppc_elf_relax_section (abfd, isec, link_ free_relocs = internal_relocs; /* Setup a faster access method for the reloc info we need. */ - rela_comb = (Elf_Internal_Rela**) - bfd_malloc (isec->reloc_count*sizeof (Elf_Internal_Rela*)); + amt = isec->reloc_count; + amt *= sizeof (Elf_Internal_Rela*); + rela_comb = (Elf_Internal_Rela**) bfd_malloc (amt); if (rela_comb == NULL) goto error_return; for (n = 0; n < isec->reloc_count; ++n) @@ -1200,7 +1203,7 @@ ppc_elf_relax_section (abfd, isec, link_ #undef BO4 if (modified) { - bfd_put_32 (abfd, insn, contents + isec_offset); + bfd_put_32 (abfd, (bfd_vma) insn, contents + isec_offset); section_modified = true; } } @@ -1450,7 +1453,7 @@ ppc_elf_merge_private_bfd_data (ibfd, ob error = true; (*_bfd_error_handler) (_("%s: compiled with -mrelocatable and linked with modules compiled normally"), - bfd_get_filename (ibfd)); + bfd_archive_filename (ibfd)); } else if ((new_flags & (EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB)) == 0 && (old_flags & EF_PPC_RELOCATABLE) != 0) @@ -1458,7 +1461,7 @@ ppc_elf_merge_private_bfd_data (ibfd, ob error = true; (*_bfd_error_handler) (_("%s: compiled normally and linked with modules compiled with -mrelocatable"), - bfd_get_filename (ibfd)); + bfd_archive_filename (ibfd)); } /* The output is -mrelocatable-lib iff both the input files are. */ @@ -1484,7 +1487,7 @@ ppc_elf_merge_private_bfd_data (ibfd, ob error = true; (*_bfd_error_handler) (_("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"), - bfd_get_filename (ibfd), (long) new_flags, (long) old_flags); + bfd_archive_filename (ibfd), (long) new_flags, (long) old_flags); } if (error) @@ -2014,37 +2017,40 @@ ppc_elf_size_dynamic_sections (output_bf must add the entries now so that we get the correct size for the .dynamic section. The DT_DEBUG entry is filled in by the dynamic linker and used by the debugger. */ - if (! info->shared) +#define add_dynamic_entry(TAG, VAL) \ + bfd_elf32_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL)) + + if (!info->shared) { - if (! bfd_elf32_add_dynamic_entry (info, DT_DEBUG, 0)) + if (!add_dynamic_entry (DT_DEBUG, 0)) return false; } if (plt) { - if (! bfd_elf32_add_dynamic_entry (info, DT_PLTGOT, 0) - || ! bfd_elf32_add_dynamic_entry (info, DT_PLTRELSZ, 0) - || ! bfd_elf32_add_dynamic_entry (info, DT_PLTREL, DT_RELA) - || ! bfd_elf32_add_dynamic_entry (info, DT_JMPREL, 0)) + if (!add_dynamic_entry (DT_PLTGOT, 0) + || !add_dynamic_entry (DT_PLTRELSZ, 0) + || !add_dynamic_entry (DT_PLTREL, DT_RELA) + || !add_dynamic_entry (DT_JMPREL, 0)) return false; } if (relocs) { - if (! bfd_elf32_add_dynamic_entry (info, DT_RELA, 0) - || ! bfd_elf32_add_dynamic_entry (info, DT_RELASZ, 0) - || ! bfd_elf32_add_dynamic_entry (info, DT_RELAENT, - sizeof (Elf32_External_Rela))) + if (!add_dynamic_entry (DT_RELA, 0) + || !add_dynamic_entry (DT_RELASZ, 0) + || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela))) return false; } if ((info->flags & DF_TEXTREL) != 0) { - if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0)) + if (!add_dynamic_entry (DT_TEXTREL, 0)) return false; info->flags |= DF_TEXTREL; } } +#undef add_dynamic_entry return true; } @@ -2078,7 +2084,7 @@ ppc_elf_check_relocs (abfd, info, sec, r #ifdef DEBUG fprintf (stderr, "ppc_elf_check_relocs called for section %s in %s\n", bfd_get_section_name (abfd, sec), - bfd_get_filename (abfd)); + bfd_archive_filename (abfd)); #endif /* Create the linker generated sections all the time so that the @@ -2178,7 +2184,7 @@ ppc_elf_check_relocs (abfd, info, sec, r if (h != NULL) { - if (h->got.refcount == -1) + if (h->got.refcount == 0) { /* Make sure this symbol is output as a dynamic symbol. */ if (h->dynindx == -1) @@ -2189,28 +2195,25 @@ ppc_elf_check_relocs (abfd, info, sec, r sgot->_raw_size += 4; /* Allocate relocation space. */ srelgot->_raw_size += sizeof (Elf32_External_Rela); - - h->got.refcount = 1; } - else - h->got.refcount++; + h->got.refcount++; } else { /* This is a global offset table entry for a local symbol. */ if (local_got_refcounts == NULL) { - size_t size; + bfd_size_type size; - size = symtab_hdr->sh_info * sizeof (bfd_signed_vma); - local_got_refcounts = (bfd_signed_vma *) - bfd_alloc (abfd, size); + size = symtab_hdr->sh_info; + size *= sizeof (bfd_signed_vma); + local_got_refcounts + = (bfd_signed_vma *) bfd_zalloc (abfd, size); if (local_got_refcounts == NULL) return false; elf_local_got_refcounts (abfd) = local_got_refcounts; - memset (local_got_refcounts, -1, size); } - if (local_got_refcounts[r_symndx] == -1) + if (local_got_refcounts[r_symndx] == 0) { sgot->_raw_size += 4; @@ -2219,11 +2222,8 @@ ppc_elf_check_relocs (abfd, info, sec, r dynamic linker can adjust this GOT entry. */ if (info->shared) srelgot->_raw_size += sizeof (Elf32_External_Rela); - - local_got_refcounts[r_symndx] = 1; } - else - local_got_refcounts[r_symndx]++; + local_got_refcounts[r_symndx]++; } break; @@ -2233,7 +2233,7 @@ ppc_elf_check_relocs (abfd, info, sec, r { ((*_bfd_error_handler) (_("%s: relocation %s cannot be used when making a shared object"), - bfd_get_filename (abfd), "R_PPC_EMB_SDAI16")); + bfd_archive_filename (abfd), "R_PPC_EMB_SDAI16")); return false; } @@ -2267,7 +2267,7 @@ ppc_elf_check_relocs (abfd, info, sec, r { ((*_bfd_error_handler) (_("%s: relocation %s cannot be used when making a shared object"), - bfd_get_filename (abfd), "R_PPC_EMB_SDA2I16")); + bfd_archive_filename (abfd), "R_PPC_EMB_SDA2I16")); return false; } @@ -2302,7 +2302,7 @@ ppc_elf_check_relocs (abfd, info, sec, r { ((*_bfd_error_handler) (_("%s: relocation %s cannot be used when making a shared object"), - bfd_get_filename (abfd), + bfd_archive_filename (abfd), ppc_elf_howto_table[(int) ELF32_R_TYPE (rel->r_info)]->name)); return false; } @@ -2336,13 +2336,8 @@ ppc_elf_check_relocs (abfd, info, sec, r if (! bfd_elf32_link_record_dynamic_symbol (info, h)) return false; } - if (h->plt.refcount == -1) - { - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; - h->plt.refcount = 1; - } - else - h->plt.refcount++; + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + h->plt.refcount++; break; /* The following relocations don't need to propagate the @@ -2387,7 +2382,7 @@ ppc_elf_check_relocs (abfd, info, sec, r /* fall through */ default: - if (info->shared) + if (info->shared && (sec->flags & SEC_ALLOC) != 0) { #ifdef DEBUG fprintf (stderr, "ppc_elf_check_relocs need to create relocation for %s\n", @@ -2579,21 +2574,24 @@ ppc_elf_add_symbol_hook (abfd, info, sym if (!sdata->bss_section) { + bfd_size_type amt; + /* We don't go through bfd_make_section, because we don't want to attach this common section to DYNOBJ. The linker will move the symbols to the appropriate output section when it defines common symbols. */ - sdata->bss_section = ((asection *) - bfd_zalloc (abfd, sizeof (asection))); + amt = sizeof (asection); + sdata->bss_section = (asection *) bfd_zalloc (abfd, amt); if (sdata->bss_section == NULL) return false; sdata->bss_section->name = sdata->bss_name; sdata->bss_section->flags = SEC_IS_COMMON; sdata->bss_section->output_section = sdata->bss_section; - sdata->bss_section->symbol = - (asymbol *) bfd_zalloc (abfd, sizeof (asymbol)); + amt = sizeof (asymbol); + sdata->bss_section->symbol = (asymbol *) bfd_zalloc (abfd, amt); + amt = sizeof (asymbol *); sdata->bss_section->symbol_ptr_ptr = - (asymbol **) bfd_zalloc (abfd, sizeof (asymbol *)); + (asymbol **) bfd_zalloc (abfd, amt); if (sdata->bss_section->symbol == NULL || sdata->bss_section->symbol_ptr_ptr == NULL) return false; @@ -2697,7 +2695,7 @@ ppc_elf_finish_dynamic_symbol (output_bf rela.r_offset = (sgot->output_section->vma + sgot->output_offset - + (h->got.offset &~ 1)); + + (h->got.offset &~ (bfd_vma) 1)); /* If this is a -Bsymbolic link, and the symbol is defined locally, we just want to emit a RELATIVE reloc. The entry in @@ -2842,7 +2840,7 @@ ppc_elf_finish_dynamic_sections (output_ if (sgot) { unsigned char *contents = sgot->contents; - bfd_put_32 (output_bfd, 0x4e800021 /* blrl */, contents); + bfd_put_32 (output_bfd, (bfd_vma) 0x4e800021 /* blrl */, contents); if (sdyn == NULL) bfd_put_32 (output_bfd, (bfd_vma) 0, contents+4); @@ -2914,7 +2912,7 @@ ppc_elf_relocate_section (output_bfd, in #ifdef DEBUG fprintf (stderr, "ppc_elf_relocate_section called for %s section %s, %ld relocations%s\n", - bfd_get_filename (input_bfd), + bfd_archive_filename (input_bfd), bfd_section_name(input_bfd, input_section), (long) input_section->reloc_count, (info->relocateable) ? " (relocatable)" : ""); @@ -2953,7 +2951,7 @@ ppc_elf_relocate_section (output_bfd, in || !ppc_elf_howto_table[(int) r_type]) { (*_bfd_error_handler) (_("%s: unknown relocation type %d"), - bfd_get_filename (input_bfd), + bfd_archive_filename (input_bfd), (int) r_type); bfd_set_error (bfd_error_bad_value); @@ -3086,7 +3084,7 @@ ppc_elf_relocate_section (output_bfd, in { (*_bfd_error_handler) (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"), - bfd_get_filename (input_bfd), h->root.root.string, + bfd_archive_filename (input_bfd), h->root.root.string, bfd_get_section_name (input_bfd, input_section)); relocation = 0; } @@ -3097,7 +3095,9 @@ ppc_elf_relocate_section (output_bfd, in } else if (h->root.type == bfd_link_hash_undefweak) relocation = 0; - else if (info->shared && !info->symbolic && !info->no_undefined + else if (info->shared + && (!info->symbolic || info->allow_shlib_undefined) + && !info->no_undefined && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) relocation = 0; else @@ -3119,7 +3119,7 @@ ppc_elf_relocate_section (output_bfd, in { default: (*_bfd_error_handler) (_("%s: unknown relocation type %d for symbol %s"), - bfd_get_filename (input_bfd), + bfd_archive_filename (input_bfd), (int) r_type, sym_name); bfd_set_error (bfd_error_bad_value); @@ -3171,7 +3171,7 @@ ppc_elf_relocate_section (output_bfd, in case (int) R_PPC_ADDR14: case (int) R_PPC_UADDR32: case (int) R_PPC_UADDR16: - if (info->shared) + if (info->shared && (input_section->flags & SEC_ALLOC) != 0) { Elf_Internal_Rela outrel; boolean skip; @@ -3320,7 +3320,7 @@ ppc_elf_relocate_section (output_bfd, in insn &= ~BRANCH_PREDICT_BIT; else insn |= BRANCH_PREDICT_BIT; - bfd_put_32 (output_bfd, insn, contents + offset); + bfd_put_32 (output_bfd, (bfd_vma) insn, contents + offset); break; /* branch not taken predicition relocations */ @@ -3331,7 +3331,7 @@ ppc_elf_relocate_section (output_bfd, in insn |= BRANCH_PREDICT_BIT; else insn &= ~BRANCH_PREDICT_BIT; - bfd_put_32 (output_bfd, insn, contents + offset); + bfd_put_32 (output_bfd, (bfd_vma) insn, contents + offset); break; /* GOT16 relocations */ @@ -3483,7 +3483,7 @@ ppc_elf_relocate_section (output_bfd, in && strcmp (name, ".sbss") != 0) { (*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"), - bfd_get_filename (input_bfd), + bfd_archive_filename (input_bfd), sym_name, ppc_elf_howto_table[(int) r_type]->name, name); @@ -3504,7 +3504,7 @@ ppc_elf_relocate_section (output_bfd, in if (strcmp (name, ".sdata2") != 0 && strcmp (name, ".sbss2") != 0) { (*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"), - bfd_get_filename (input_bfd), + bfd_archive_filename (input_bfd), sym_name, ppc_elf_howto_table[(int) r_type]->name, name); @@ -3554,7 +3554,7 @@ ppc_elf_relocate_section (output_bfd, in else { (*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"), - bfd_get_filename (input_bfd), + bfd_archive_filename (input_bfd), sym_name, ppc_elf_howto_table[(int) r_type]->name, name); @@ -3568,7 +3568,7 @@ ppc_elf_relocate_section (output_bfd, in { /* fill in register field */ insn = bfd_get_32 (output_bfd, contents + offset); insn = (insn & ~RA_REGISTER_MASK) | (reg << RA_REGISTER_SHIFT); - bfd_put_32 (output_bfd, insn, contents + offset); + bfd_put_32 (output_bfd, (bfd_vma) insn, contents + offset); } } break; @@ -3620,7 +3620,7 @@ ppc_elf_relocate_section (output_bfd, in case (int) R_PPC_EMB_RELST_HA: case (int) R_PPC_EMB_BIT_FLD: (*_bfd_error_handler) (_("%s: Relocation %s is not yet supported for symbol %s."), - bfd_get_filename (input_bfd), + bfd_archive_filename (input_bfd), ppc_elf_howto_table[(int) r_type]->name, sym_name); @@ -3706,10 +3706,10 @@ ppc_elf_relocate_section (output_bfd, in } static enum elf_reloc_type_class -ppc_elf_reloc_type_class (type) - int type; +ppc_elf_reloc_type_class (rela) + const Elf_Internal_Rela *rela; { - switch (type) + switch ((int) ELF32_R_TYPE (rela->r_info)) { case R_PPC_RELATIVE: return reloc_class_relative; @@ -3731,7 +3731,7 @@ ppc_elf_grok_prstatus (abfd, note) Elf_Internal_Note *note; { int offset; - int raw_size; + unsigned int raw_size; switch (note->descsz) { @@ -3809,6 +3809,7 @@ ppc_elf_grok_psinfo (abfd, note) #define elf_backend_plt_not_loaded 1 #define elf_backend_got_symbol_offset 4 #define elf_backend_can_gc_sections 1 +#define elf_backend_can_refcount 1 #define elf_backend_got_header_size 12 #define elf_backend_plt_header_size PLT_INITIAL_ENTRY_SIZE diff -uprN binutils-2.11.90.0.31/bfd/elf32-s390.c binutils-2.11.92.0.5/bfd/elf32-s390.c --- binutils-2.11.90.0.31/bfd/elf32-s390.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/elf32-s390.c Mon Oct 1 15:25:21 2001 @@ -56,7 +56,8 @@ static boolean elf_s390_finish_dynamic_s static boolean elf_s390_finish_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *)); static boolean elf_s390_object_p PARAMS ((bfd *)); -static enum elf_reloc_type_class elf_s390_reloc_type_class PARAMS ((int)); +static enum elf_reloc_type_class elf_s390_reloc_type_class + PARAMS ((const Elf_Internal_Rela *)); #define USE_RELA 1 /* We want RELA relocations, not REL. */ @@ -104,7 +105,7 @@ static reloc_howto_type elf_howto_table[ static reloc_howto_type elf32_s390_vtinherit_howto = HOWTO (R_390_GNU_VTINHERIT, 0,2,0,false,0,complain_overflow_dont, NULL, "R_390_GNU_VTINHERIT", false,0, 0, false); static reloc_howto_type elf32_s390_vtentry_howto = - HOWTO (R_390_GNU_VTENTRY, 0,2,0,false,0,complain_overflow_dont, _bfd_elf_rel_vtable_reloc_fn,"R_390_GNU_VTENTRY", false,0,0, false); + HOWTO (R_390_GNU_VTENTRY, 0,2,0,false,0,complain_overflow_dont, _bfd_elf_rel_vtable_reloc_fn,"R_390_GNU_VTENTRY", false,0,0, false); static reloc_howto_type * elf_s390_reloc_type_lookup (abfd, code) @@ -157,7 +158,7 @@ elf_s390_reloc_type_lookup (abfd, code) case BFD_RELOC_VTABLE_ENTRY: return &elf32_s390_vtentry_howto; default: - break; + break; } return 0; } @@ -184,7 +185,7 @@ elf_s390_info_to_howto (abfd, cache_ptr, default: BFD_ASSERT (ELF32_R_TYPE(dst->r_info) < (unsigned int) R_390_max); cache_ptr->howto = &elf_howto_table[ELF32_R_TYPE(dst->r_info)]; - } + } } static boolean @@ -213,7 +214,7 @@ elf_s390_is_local_label_name (abfd, name /* The size in bytes of the first entry in the procedure linkage table. */ #define PLT_FIRST_ENTRY_SIZE 32 /* The size in bytes of an entry in the procedure linkage table. */ -#define PLT_ENTRY_SIZE 32 +#define PLT_ENTRY_SIZE 32 #define GOT_ENTRY_SIZE 4 @@ -227,7 +228,7 @@ elf_s390_is_local_label_name (abfd, name are needed to load an address in a register and execute a branch( or just saving the address) - Furthermore, only r 0 and 1 are free to use!!! */ + Furthermore, only r 0 and 1 are free to use!!! */ /* The first 3 words in the GOT are then reserved. Word 0 is the address of the dynamic table. @@ -241,7 +242,7 @@ elf_s390_is_local_label_name (abfd, name The GOT holds the address in the PLT to be executed. The loader then gets: 24(15) = Pointer to the structure describing the object. - 28(15) = Offset in symbol table + 28(15) = Offset in symbol table The loader must then find the module where the function is and insert the address in the GOT. @@ -334,7 +335,7 @@ RET1: BASR 1,0 # 2 bytes Return PLT0: ST 1,28(15) # R1 has offset into symbol table L 1,4(12) # Get loader ino(object struct address) - ST 1,24(15) # Store address + ST 1,24(15) # Store address L 1,8(12) # Entry address of loader in R1 BR 1 # Jump to loader @@ -456,9 +457,9 @@ elf_s390_link_hash_table_create (abfd) bfd *abfd; { struct elf_s390_link_hash_table *ret; + bfd_size_type amt = sizeof (struct elf_s390_link_hash_table); - ret = ((struct elf_s390_link_hash_table *) - bfd_alloc (abfd, sizeof (struct elf_s390_link_hash_table))); + ret = (struct elf_s390_link_hash_table *) bfd_alloc (abfd, amt); if (ret == (struct elf_s390_link_hash_table *) NULL) return NULL; @@ -517,7 +518,7 @@ elf_s390_check_relocs (abfd, info, sec, if (r_symndx < symtab_hdr->sh_info) h = NULL; else - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; /* Some relocs require a global offset table. */ if (dynobj == NULL) @@ -576,10 +577,8 @@ elf_s390_check_relocs (abfd, info, sec, if (h != NULL) { - if (h->got.refcount == -1) + if (h->got.refcount == 0) { - h->got.refcount = 1; - /* Make sure this symbol is output as a dynamic symbol. */ if (h->dynindx == -1) { @@ -590,28 +589,25 @@ elf_s390_check_relocs (abfd, info, sec, sgot->_raw_size += 4; srelgot->_raw_size += sizeof (Elf32_External_Rela); } - else - h->got.refcount += 1; + h->got.refcount += 1; } else { /* This is a global offset table entry for a local symbol. */ if (local_got_refcounts == NULL) { - size_t size; + bfd_size_type size; - size = symtab_hdr->sh_info * sizeof (bfd_signed_vma); + size = symtab_hdr->sh_info; + size *= sizeof (bfd_signed_vma); local_got_refcounts = (bfd_signed_vma *) - bfd_alloc (abfd, size); + bfd_zalloc (abfd, size); if (local_got_refcounts == NULL) return false; elf_local_got_refcounts (abfd) = local_got_refcounts; - memset (local_got_refcounts, -1, size); } - if (local_got_refcounts[r_symndx] == -1) + if (local_got_refcounts[r_symndx] == 0) { - local_got_refcounts[r_symndx] = 1; - sgot->_raw_size += 4; if (info->shared) { @@ -621,8 +617,7 @@ elf_s390_check_relocs (abfd, info, sec, srelgot->_raw_size += sizeof (Elf32_External_Rela); } } - else - local_got_refcounts[r_symndx] += 1; + local_got_refcounts[r_symndx] += 1; } break; @@ -640,13 +635,8 @@ elf_s390_check_relocs (abfd, info, sec, if (h == NULL) continue; - if (h->plt.refcount == -1) - { - h->plt.refcount = 1; - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; - } - else - h->plt.refcount += 1; + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + h->plt.refcount += 1; break; case R_390_8: @@ -744,7 +734,7 @@ elf_s390_check_relocs (abfd, info, sec, if (p == NULL) { p = ((struct elf_s390_pcrel_relocs_copied *) - bfd_alloc (dynobj, sizeof *p)); + bfd_alloc (dynobj, (bfd_size_type) sizeof *p)); if (p == NULL) return false; p->next = eh->pcrel_relocs_copied; @@ -772,7 +762,7 @@ elf_s390_check_relocs (abfd, info, sec, if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_addend)) return false; break; - + default: break; } @@ -1220,37 +1210,40 @@ elf_s390_size_dynamic_sections (output_b must add the entries now so that we get the correct size for the .dynamic section. The DT_DEBUG entry is filled in by the dynamic linker and used by the debugger. */ +#define add_dynamic_entry(TAG, VAL) \ + bfd_elf32_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL)) + if (! info->shared) { - if (! bfd_elf32_add_dynamic_entry (info, DT_DEBUG, 0)) + if (!add_dynamic_entry (DT_DEBUG, 0)) return false; } if (plt) { - if (! bfd_elf32_add_dynamic_entry (info, DT_PLTGOT, 0) - || ! bfd_elf32_add_dynamic_entry (info, DT_PLTRELSZ, 0) - || ! bfd_elf32_add_dynamic_entry (info, DT_PLTREL, DT_RELA) - || ! bfd_elf32_add_dynamic_entry (info, DT_JMPREL, 0)) + if (!add_dynamic_entry (DT_PLTGOT, 0) + || !add_dynamic_entry (DT_PLTRELSZ, 0) + || !add_dynamic_entry (DT_PLTREL, DT_RELA) + || !add_dynamic_entry (DT_JMPREL, 0)) return false; } if (relocs) { - if (! bfd_elf32_add_dynamic_entry (info, DT_RELA, 0) - || ! bfd_elf32_add_dynamic_entry (info, DT_RELASZ, 0) - || ! bfd_elf32_add_dynamic_entry (info, DT_RELAENT, - sizeof (Elf32_External_Rela))) + if (!add_dynamic_entry (DT_RELA, 0) + || !add_dynamic_entry (DT_RELASZ, 0) + || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela))) return false; } if ((info->flags & DF_TEXTREL) != 0) { - if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0)) + if (!add_dynamic_entry (DT_TEXTREL, 0)) return false; info->flags |= DF_TEXTREL; } } +#undef add_dynamic_entry return true; } @@ -1429,7 +1422,7 @@ elf_s390_relocate_section (output_bfd, i { (*_bfd_error_handler) (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"), - bfd_get_filename (input_bfd), h->root.root.string, + bfd_archive_filename (input_bfd), h->root.root.string, bfd_get_section_name (input_bfd, input_section)); relocation = 0; } @@ -1440,7 +1433,8 @@ elf_s390_relocate_section (output_bfd, i } else if (h->root.type == bfd_link_hash_undefweak) relocation = 0; - else if (info->shared && !info->symbolic + else if (info->shared + && (!info->symbolic || info->allow_shlib_undefined) && !info->no_undefined && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) relocation = 0; @@ -1546,7 +1540,7 @@ elf_s390_relocate_section (output_bfd, i break; - + case R_390_GOTOFF: /* Relocation is relative to the start of the global offset table. */ @@ -1798,7 +1792,7 @@ elf_s390_finish_dynamic_symbol (output_b srela = bfd_get_section_by_name (dynobj, ".rela.plt"); BFD_ASSERT (splt != NULL && sgot != NULL && srela != NULL); - /* Calc. index no. + /* Calc. index no. Current offset - size first entry / entry size. */ plt_index = (h->plt.offset - PLT_FIRST_ENTRY_SIZE) / PLT_ENTRY_SIZE; @@ -1807,81 +1801,82 @@ elf_s390_finish_dynamic_symbol (output_b got_offset = (plt_index + 3) * GOT_ENTRY_SIZE; /* S390 uses halfwords for relative branch calc! */ - relative_offset = - ((PLT_FIRST_ENTRY_SIZE + - (PLT_ENTRY_SIZE * plt_index) + 18)/2); + relative_offset = - ((PLT_FIRST_ENTRY_SIZE + + (PLT_ENTRY_SIZE * plt_index) + 18) / 2); /* If offset is > 32768, branch to a previous branch 390 can only handle +-64 K jumps. */ - if ( -32768 > (int)relative_offset ) - relative_offset = -(((65536/PLT_ENTRY_SIZE-1)*PLT_ENTRY_SIZE)/2); + if ( -32768 > (int) relative_offset ) + relative_offset = + -(unsigned) (((65536 / PLT_ENTRY_SIZE - 1) * PLT_ENTRY_SIZE) / 2); /* Fill in the entry in the procedure linkage table. */ if (!info->shared) { - bfd_put_32 (output_bfd, PLT_ENTRY_WORD0, + bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD0, splt->contents + h->plt.offset); - bfd_put_32 (output_bfd, PLT_ENTRY_WORD1, + bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD1, splt->contents + h->plt.offset + 4); - bfd_put_32 (output_bfd, PLT_ENTRY_WORD2, + bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD2, splt->contents + h->plt.offset + 8); - bfd_put_32 (output_bfd, PLT_ENTRY_WORD3, + bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD3, splt->contents + h->plt.offset + 12); - bfd_put_32 (output_bfd, PLT_ENTRY_WORD4, + bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD4, splt->contents + h->plt.offset + 16); - bfd_put_32 (output_bfd, 0+(relative_offset << 16), + bfd_put_32 (output_bfd, (bfd_vma) 0 + (relative_offset << 16), splt->contents + h->plt.offset + 20); bfd_put_32 (output_bfd, - (sgot->output_section->vma + - sgot->output_offset + - got_offset), + (sgot->output_section->vma + + sgot->output_offset + + got_offset), splt->contents + h->plt.offset + 24); } else if (got_offset < 4096) { - bfd_put_32 (output_bfd, PLT_PIC12_ENTRY_WORD0 + got_offset, + bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC12_ENTRY_WORD0 + got_offset, splt->contents + h->plt.offset); - bfd_put_32 (output_bfd, PLT_PIC12_ENTRY_WORD1, + bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC12_ENTRY_WORD1, splt->contents + h->plt.offset + 4); - bfd_put_32 (output_bfd, PLT_PIC12_ENTRY_WORD2, + bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC12_ENTRY_WORD2, splt->contents + h->plt.offset + 8); - bfd_put_32 (output_bfd, PLT_PIC12_ENTRY_WORD3, + bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC12_ENTRY_WORD3, splt->contents + h->plt.offset + 12); - bfd_put_32 (output_bfd, PLT_PIC12_ENTRY_WORD4, + bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC12_ENTRY_WORD4, splt->contents + h->plt.offset + 16); - bfd_put_32 (output_bfd, 0+(relative_offset << 16), + bfd_put_32 (output_bfd, (bfd_vma) 0 + (relative_offset << 16), splt->contents + h->plt.offset + 20); - bfd_put_32 (output_bfd, 0, + bfd_put_32 (output_bfd, (bfd_vma) 0, splt->contents + h->plt.offset + 24); } else if (got_offset < 32768) { - bfd_put_32 (output_bfd, PLT_PIC16_ENTRY_WORD0 + got_offset, + bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC16_ENTRY_WORD0 + got_offset, splt->contents + h->plt.offset); - bfd_put_32 (output_bfd, PLT_PIC16_ENTRY_WORD1, + bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC16_ENTRY_WORD1, splt->contents + h->plt.offset + 4); - bfd_put_32 (output_bfd, PLT_PIC16_ENTRY_WORD2, + bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC16_ENTRY_WORD2, splt->contents + h->plt.offset + 8); - bfd_put_32 (output_bfd, PLT_PIC16_ENTRY_WORD3, + bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC16_ENTRY_WORD3, splt->contents + h->plt.offset + 12); - bfd_put_32 (output_bfd, PLT_PIC16_ENTRY_WORD4, + bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC16_ENTRY_WORD4, splt->contents + h->plt.offset + 16); - bfd_put_32 (output_bfd, 0+(relative_offset << 16), + bfd_put_32 (output_bfd, (bfd_vma) 0 + (relative_offset << 16), splt->contents + h->plt.offset + 20); - bfd_put_32 (output_bfd, 0, + bfd_put_32 (output_bfd, (bfd_vma) 0, splt->contents + h->plt.offset + 24); } else { - bfd_put_32 (output_bfd, PLT_PIC_ENTRY_WORD0, + bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_ENTRY_WORD0, splt->contents + h->plt.offset); - bfd_put_32 (output_bfd, PLT_PIC_ENTRY_WORD1, + bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_ENTRY_WORD1, splt->contents + h->plt.offset + 4); - bfd_put_32 (output_bfd, PLT_PIC_ENTRY_WORD2, + bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_ENTRY_WORD2, splt->contents + h->plt.offset + 8); - bfd_put_32 (output_bfd, PLT_PIC_ENTRY_WORD3, + bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_ENTRY_WORD3, splt->contents + h->plt.offset + 12); - bfd_put_32 (output_bfd, PLT_PIC_ENTRY_WORD4, + bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_ENTRY_WORD4, splt->contents + h->plt.offset + 16); - bfd_put_32 (output_bfd, 0+(relative_offset << 16), + bfd_put_32 (output_bfd, (bfd_vma) 0 + (relative_offset << 16), splt->contents + h->plt.offset + 20); bfd_put_32 (output_bfd, got_offset, splt->contents + h->plt.offset + 24); @@ -1932,7 +1927,7 @@ elf_s390_finish_dynamic_symbol (output_b rela.r_offset = (sgot->output_section->vma + sgot->output_offset - + (h->got.offset &~ 1)); + + (h->got.offset &~ (bfd_vma) 1)); /* If this is a static link, or it is a -Bsymbolic link and the symbol is defined locally or was forced to be local because @@ -2069,31 +2064,31 @@ elf_s390_finish_dynamic_sections (output memset (splt->contents, 0, PLT_FIRST_ENTRY_SIZE); if (info->shared) { - bfd_put_32 (output_bfd, PLT_PIC_FIRST_ENTRY_WORD0, + bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_FIRST_ENTRY_WORD0, splt->contents ); - bfd_put_32 (output_bfd, PLT_PIC_FIRST_ENTRY_WORD1, - splt->contents +4 ); - bfd_put_32 (output_bfd, PLT_PIC_FIRST_ENTRY_WORD2, - splt->contents +8 ); - bfd_put_32 (output_bfd, PLT_PIC_FIRST_ENTRY_WORD3, - splt->contents +12 ); - bfd_put_32 (output_bfd, PLT_PIC_FIRST_ENTRY_WORD4, - splt->contents +16 ); + bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_FIRST_ENTRY_WORD1, + splt->contents + 4 ); + bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_FIRST_ENTRY_WORD2, + splt->contents + 8 ); + bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_FIRST_ENTRY_WORD3, + splt->contents + 12 ); + bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_FIRST_ENTRY_WORD4, + splt->contents + 16 ); } else { - bfd_put_32 (output_bfd, PLT_FIRST_ENTRY_WORD0, + bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD0, splt->contents ); - bfd_put_32 (output_bfd, PLT_FIRST_ENTRY_WORD1, - splt->contents +4 ); - bfd_put_32 (output_bfd, PLT_FIRST_ENTRY_WORD2, - splt->contents +8 ); - bfd_put_32 (output_bfd, PLT_FIRST_ENTRY_WORD3, - splt->contents +12 ); - bfd_put_32 (output_bfd, PLT_FIRST_ENTRY_WORD4, - splt->contents +16 ); - bfd_put_32 (output_bfd, PLT_FIRST_ENTRY_WORD5, - splt->contents +20 ); + bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD1, + splt->contents + 4 ); + bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD2, + splt->contents + 8 ); + bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD3, + splt->contents + 12 ); + bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD4, + splt->contents + 16 ); + bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD5, + splt->contents + 20 ); bfd_put_32 (output_bfd, sgot->output_section->vma + sgot->output_offset, splt->contents + 24); @@ -2133,10 +2128,10 @@ elf_s390_object_p (abfd) } static enum elf_reloc_type_class -elf_s390_reloc_type_class (type) - int type; +elf_s390_reloc_type_class (rela) + const Elf_Internal_Rela *rela; { - switch (type) + switch ((int) ELF32_R_TYPE (rela->r_info)) { case R_390_RELATIVE: return reloc_class_relative; @@ -2157,6 +2152,7 @@ elf_s390_reloc_type_class (type) #define ELF_MAXPAGESIZE 0x1000 #define elf_backend_can_gc_sections 1 +#define elf_backend_can_refcount 1 #define elf_backend_want_got_plt 1 #define elf_backend_plt_readonly 1 #define elf_backend_want_plt_sym 0 diff -uprN binutils-2.11.90.0.31/bfd/elf32-sh-lin.c binutils-2.11.92.0.5/bfd/elf32-sh-lin.c --- binutils-2.11.90.0.31/bfd/elf32-sh-lin.c Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/bfd/elf32-sh-lin.c Mon Oct 1 15:25:21 2001 @@ -1,5 +1,5 @@ /* Hitachi SH specific support for 32-bit Linux - Copyright 2000 Free Software Foundation, Inc. + Copyright 2000, 2001 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -43,7 +43,7 @@ elf32_shlin_grok_prstatus (abfd, note) Elf_Internal_Note *note; { int offset; - int raw_size; + unsigned int raw_size; switch (note->descsz) { diff -uprN binutils-2.11.90.0.31/bfd/elf32-sh.c binutils-2.11.92.0.5/bfd/elf32-sh.c --- binutils-2.11.90.0.31/bfd/elf32-sh.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/elf32-sh.c Mon Oct 1 15:25:21 2001 @@ -84,7 +84,7 @@ static boolean sh_elf_gc_sweep_hook PARAMS ((bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *)); static enum elf_reloc_type_class sh_elf_reloc_type_class - PARAMS ((int)); + PARAMS ((const Elf_Internal_Rela *)); /* The name of the dynamic interpreter. This is put in the .interp section. */ @@ -134,8 +134,8 @@ static reloc_howto_type sh_elf_howto_tab complain_overflow_signed, /* complain_on_overflow */ sh_elf_ignore_reloc, /* special_function */ "R_SH_REL32", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ + true, /* partial_inplace */ + 0xffffffff, /* src_mask */ 0xffffffff, /* dst_mask */ true), /* pcrel_offset */ @@ -767,10 +767,10 @@ sh_elf_reloc_loop (r_type, input_bfd, in contents = elf_section_data (symbol_section)->this_hdr.contents; else { - free_contents = contents - = (bfd_byte *) bfd_malloc (symbol_section->_raw_size); + contents = (bfd_byte *) bfd_malloc (symbol_section->_raw_size); if (contents == NULL) return bfd_reloc_outofrange; + free_contents = contents; if (! bfd_get_section_contents (input_bfd, symbol_section, contents, (file_ptr) 0, symbol_section->_raw_size)) @@ -825,7 +825,7 @@ sh_elf_reloc_loop (r_type, input_bfd, in return bfd_reloc_overflow; x = (insn & ~0xff) | (x & 0xff); - bfd_put_16 (input_bfd, x, contents + addr); + bfd_put_16 (input_bfd, (bfd_vma) x, contents + addr); return bfd_reloc_ok; } @@ -880,7 +880,7 @@ sh_elf_reloc (abfd, reloc_entry, symbol_ case R_SH_DIR32: insn = bfd_get_32 (abfd, hit_data); insn += sym_value + reloc_entry->addend; - bfd_put_32 (abfd, insn, hit_data); + bfd_put_32 (abfd, (bfd_vma) insn, hit_data); break; case R_SH_IND12W: insn = bfd_get_16 (abfd, hit_data); @@ -893,7 +893,7 @@ sh_elf_reloc (abfd, reloc_entry, symbol_ if (insn & 0x800) sym_value -= 0x1000; insn = (insn & 0xf000) | (sym_value & 0xfff); - bfd_put_16 (abfd, insn, hit_data); + bfd_put_16 (abfd, (bfd_vma) insn, hit_data); if (sym_value < (bfd_vma) -0x1000 || sym_value >= 0x1000) return bfd_reloc_overflow; break; @@ -1096,7 +1096,7 @@ sh_elf_relax_section (abfd, sec, link_in if (laddr >= sec->_raw_size) { (*_bfd_error_handler) (_("%s: 0x%lx: warning: bad R_SH_USES offset"), - bfd_get_filename (abfd), + bfd_archive_filename (abfd), (unsigned long) irel->r_offset); continue; } @@ -1108,7 +1108,7 @@ sh_elf_relax_section (abfd, sec, link_in { ((*_bfd_error_handler) (_("%s: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x"), - bfd_get_filename (abfd), (unsigned long) irel->r_offset, insn)); + bfd_archive_filename (abfd), (unsigned long) irel->r_offset, insn)); continue; } @@ -1120,12 +1120,12 @@ sh_elf_relax_section (abfd, sec, link_in on a four byte boundary. */ paddr = insn & 0xff; paddr *= 4; - paddr += (laddr + 4) & ~3; + paddr += (laddr + 4) &~ (bfd_vma) 3; if (paddr >= sec->_raw_size) { ((*_bfd_error_handler) (_("%s: 0x%lx: warning: bad R_SH_USES load offset"), - bfd_get_filename (abfd), (unsigned long) irel->r_offset)); + bfd_archive_filename (abfd), (unsigned long) irel->r_offset)); continue; } @@ -1140,7 +1140,7 @@ sh_elf_relax_section (abfd, sec, link_in { ((*_bfd_error_handler) (_("%s: 0x%lx: warning: could not find expected reloc"), - bfd_get_filename (abfd), (unsigned long) paddr)); + bfd_archive_filename (abfd), (unsigned long) paddr)); continue; } @@ -1151,13 +1151,12 @@ sh_elf_relax_section (abfd, sec, link_in extsyms = (Elf32_External_Sym *) symtab_hdr->contents; else { - extsyms = ((Elf32_External_Sym *) - bfd_malloc (symtab_hdr->sh_size)); + extsyms = (Elf32_External_Sym *) bfd_malloc (symtab_hdr->sh_size); if (extsyms == NULL) goto error_return; free_extsyms = extsyms; if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0 - || (bfd_read (extsyms, 1, symtab_hdr->sh_size, abfd) + || (bfd_bread (extsyms, symtab_hdr->sh_size, abfd) != symtab_hdr->sh_size)) goto error_return; } @@ -1177,7 +1176,7 @@ sh_elf_relax_section (abfd, sec, link_in { ((*_bfd_error_handler) (_("%s: 0x%lx: warning: symbol in unexpected section"), - bfd_get_filename (abfd), (unsigned long) paddr)); + bfd_archive_filename (abfd), (unsigned long) paddr)); continue; } @@ -1251,7 +1250,7 @@ sh_elf_relax_section (abfd, sec, link_in it will be handled here like other internal IND12W relocs. */ bfd_put_16 (abfd, - 0xb000 | ((foff >> 1) & 0xfff), + (bfd_vma) 0xb000 | ((foff >> 1) & 0xfff), contents + irel->r_offset); } else @@ -1259,7 +1258,7 @@ sh_elf_relax_section (abfd, sec, link_in /* 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, 0xb000, contents + irel->r_offset); + bfd_put_16 (abfd, (bfd_vma) 0xb000, contents + irel->r_offset); } /* See if there is another R_SH_USES reloc referring to the same @@ -1299,7 +1298,7 @@ sh_elf_relax_section (abfd, sec, link_in { ((*_bfd_error_handler) (_("%s: 0x%lx: warning: could not find expected COUNT reloc"), - bfd_get_filename (abfd), (unsigned long) paddr)); + bfd_archive_filename (abfd), (unsigned long) paddr)); continue; } @@ -1308,7 +1307,7 @@ sh_elf_relax_section (abfd, sec, link_in if (irelcount->r_addend == 0) { ((*_bfd_error_handler) (_("%s: 0x%lx: warning: bad count"), - bfd_get_filename (abfd), + bfd_archive_filename (abfd), (unsigned long) paddr)); continue; } @@ -1460,7 +1459,8 @@ sh_elf_relax_delete_bytes (abfd, sec, ad } /* Actually delete the bytes. */ - memmove (contents + addr, contents + addr + count, toaddr - addr - count); + memmove (contents + addr, contents + addr + count, + (size_t) (toaddr - addr - count)); if (irelalign == NULL) sec->_cooked_size -= count; else @@ -1471,7 +1471,7 @@ sh_elf_relax_delete_bytes (abfd, sec, ad BFD_ASSERT ((count & 1) == 0); for (i = 0; i < count; i += 2) - bfd_put_16 (abfd, NOP_OPCODE, contents + toaddr - count + i); + bfd_put_16 (abfd, (bfd_vma) NOP_OPCODE, contents + toaddr - count + i); } /* Adjust all the relocs. */ @@ -1649,14 +1649,14 @@ sh_elf_relax_delete_bytes (abfd, sec, ad insn += adjust / 2; if ((oinsn & 0xff00) != (insn & 0xff00)) overflow = true; - bfd_put_16 (abfd, insn, contents + nraddr); + bfd_put_16 (abfd, (bfd_vma) insn, contents + nraddr); break; case R_SH_IND12W: insn += adjust / 2; if ((oinsn & 0xf000) != (insn & 0xf000)) overflow = true; - bfd_put_16 (abfd, insn, contents + nraddr); + bfd_put_16 (abfd, (bfd_vma) insn, contents + nraddr); break; case R_SH_DIR8WPL: @@ -1670,7 +1670,7 @@ sh_elf_relax_delete_bytes (abfd, sec, ad } if ((oinsn & 0xff00) != (insn & 0xff00)) overflow = true; - bfd_put_16 (abfd, insn, contents + nraddr); + bfd_put_16 (abfd, (bfd_vma) insn, contents + nraddr); break; case R_SH_SWITCH8: @@ -1684,12 +1684,12 @@ sh_elf_relax_delete_bytes (abfd, sec, ad voff += adjust; if (voff < - 0x8000 || voff >= 0x8000) overflow = true; - bfd_put_signed_16 (abfd, voff, contents + nraddr); + bfd_put_signed_16 (abfd, (bfd_vma) voff, contents + nraddr); break; case R_SH_SWITCH32: voff += adjust; - bfd_put_signed_32 (abfd, voff, contents + nraddr); + bfd_put_signed_32 (abfd, (bfd_vma) voff, contents + nraddr); break; case R_SH_USES: @@ -1701,7 +1701,7 @@ sh_elf_relax_delete_bytes (abfd, sec, ad { ((*_bfd_error_handler) (_("%s: 0x%lx: fatal: reloc overflow while relaxing"), - bfd_get_filename (abfd), (unsigned long) irel->r_offset)); + bfd_archive_filename (abfd), (unsigned long) irel->r_offset)); bfd_set_error (bfd_error_bad_value); return false; } @@ -1780,12 +1780,12 @@ sh_elf_relax_delete_bytes (abfd, sec, ad if (start > addr && start < toaddr && (stop <= addr || stop >= toaddr)) - bfd_put_signed_32 (abfd, voff + count, + bfd_put_signed_32 (abfd, (bfd_vma) voff + count, ocontents + irelscan->r_offset); else if (stop > addr && stop < toaddr && (start <= addr || start >= toaddr)) - bfd_put_signed_32 (abfd, voff - count, + bfd_put_signed_32 (abfd, (bfd_vma) voff - count, ocontents + irelscan->r_offset); } @@ -1886,7 +1886,7 @@ sh_elf_relax_delete_bytes (abfd, sec, ad { /* Tail recursion. */ return sh_elf_relax_delete_bytes (abfd, sec, alignaddr, - alignto - alignaddr); + (int) (alignto - alignaddr)); } } @@ -1907,13 +1907,16 @@ sh_elf_align_loads (abfd, sec, internal_ Elf_Internal_Rela *irel, *irelend; bfd_vma *labels = NULL; bfd_vma *label, *label_end; + bfd_size_type amt; *pswapped = false; irelend = internal_relocs + sec->reloc_count; /* Get all the addresses with labels on them. */ - labels = (bfd_vma *) bfd_malloc (sec->reloc_count * sizeof (bfd_vma)); + amt = sec->reloc_count; + amt *= sizeof (bfd_vma); + labels = (bfd_vma *) bfd_malloc (amt); if (labels == NULL) goto error_return; label_end = labels; @@ -1982,8 +1985,8 @@ sh_elf_swap_insns (abfd, sec, relocs, co /* Swap the instructions themselves. */ i1 = bfd_get_16 (abfd, contents + addr); i2 = bfd_get_16 (abfd, contents + addr + 2); - bfd_put_16 (abfd, i2, contents + addr); - bfd_put_16 (abfd, i1, contents + addr + 2); + bfd_put_16 (abfd, (bfd_vma) i2, contents + addr); + bfd_put_16 (abfd, (bfd_vma) i1, contents + addr + 2); /* Adjust all reloc addresses. */ irelend = internal_relocs + sec->reloc_count; @@ -2052,7 +2055,7 @@ sh_elf_swap_insns (abfd, sec, relocs, co insn += add / 2; if ((oinsn & 0xff00) != (insn & 0xff00)) overflow = true; - bfd_put_16 (abfd, insn, loc); + bfd_put_16 (abfd, (bfd_vma) insn, loc); break; case R_SH_IND12W: @@ -2061,7 +2064,7 @@ sh_elf_swap_insns (abfd, sec, relocs, co insn += add / 2; if ((oinsn & 0xf000) != (insn & 0xf000)) overflow = true; - bfd_put_16 (abfd, insn, loc); + bfd_put_16 (abfd, (bfd_vma) insn, loc); break; case R_SH_DIR8WPL: @@ -2078,7 +2081,7 @@ sh_elf_swap_insns (abfd, sec, relocs, co insn += add / 2; if ((oinsn & 0xff00) != (insn & 0xff00)) overflow = true; - bfd_put_16 (abfd, insn, loc); + bfd_put_16 (abfd, (bfd_vma) insn, loc); } break; @@ -2088,7 +2091,7 @@ sh_elf_swap_insns (abfd, sec, relocs, co { ((*_bfd_error_handler) (_("%s: 0x%lx: fatal: reloc overflow while relaxing"), - bfd_get_filename (abfd), (unsigned long) irel->r_offset)); + bfd_archive_filename (abfd), (unsigned long) irel->r_offset)); bfd_set_error (bfd_error_bad_value); return false; } @@ -2431,9 +2434,9 @@ sh_elf_link_hash_table_create (abfd) bfd *abfd; { struct elf_sh_link_hash_table *ret; + bfd_size_type amt = sizeof (struct elf_sh_link_hash_table); - ret = ((struct elf_sh_link_hash_table *) - bfd_alloc (abfd, sizeof (struct elf_sh_link_hash_table))); + ret = (struct elf_sh_link_hash_table *) bfd_alloc (abfd, amt); if (ret == (struct elf_sh_link_hash_table *) NULL) return NULL; @@ -2535,7 +2538,7 @@ sh_elf_create_dynamic_sections (abfd, in || ((secflags & SEC_HAS_CONTENTS) != SEC_HAS_CONTENTS)) continue; secname = bfd_get_section_name (abfd, sec); - relname = (char *) bfd_malloc (strlen (secname) + 6); + relname = (char *) bfd_malloc ((bfd_size_type) strlen (secname) + 6); strcpy (relname, ".rela"); strcat (relname, secname); s = bfd_make_section (abfd, relname); @@ -2891,36 +2894,39 @@ sh_elf_size_dynamic_sections (output_bfd must add the entries now so that we get the correct size for the .dynamic section. The DT_DEBUG entry is filled in by the dynamic linker and used by the debugger. */ +#define add_dynamic_entry(TAG, VAL) \ + bfd_elf32_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL)) + if (! info->shared) { - if (! bfd_elf32_add_dynamic_entry (info, DT_DEBUG, 0)) + if (!add_dynamic_entry (DT_DEBUG, 0)) return false; } if (plt) { - if (! bfd_elf32_add_dynamic_entry (info, DT_PLTGOT, 0) - || ! bfd_elf32_add_dynamic_entry (info, DT_PLTRELSZ, 0) - || ! bfd_elf32_add_dynamic_entry (info, DT_PLTREL, DT_RELA) - || ! bfd_elf32_add_dynamic_entry (info, DT_JMPREL, 0)) + if (!add_dynamic_entry (DT_PLTGOT, 0) + || !add_dynamic_entry (DT_PLTRELSZ, 0) + || !add_dynamic_entry (DT_PLTREL, DT_RELA) + || !add_dynamic_entry (DT_JMPREL, 0)) return false; } if (relocs) { - if (! bfd_elf32_add_dynamic_entry (info, DT_RELA, 0) - || ! bfd_elf32_add_dynamic_entry (info, DT_RELASZ, 0) - || ! bfd_elf32_add_dynamic_entry (info, DT_RELAENT, - sizeof (Elf32_External_Rela))) + if (!add_dynamic_entry (DT_RELA, 0) + || !add_dynamic_entry (DT_RELASZ, 0) + || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela))) return false; } if ((info->flags & DF_TEXTREL) != 0) { - if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0)) + if (!add_dynamic_entry (DT_TEXTREL, 0)) return false; } } +#undef add_dynamic_entry return true; } @@ -3020,7 +3026,11 @@ sh_elf_relocate_section (output_bfd, inf howto = sh_elf_howto_table + r_type; - /* This is a final link. */ + /* For relocs that aren't partial_inplace, we get the addend from + the relocation. */ + if (! howto->partial_inplace) + addend = rel->r_addend; + h = NULL; sym = NULL; sec = NULL; @@ -3040,7 +3050,32 @@ sh_elf_relocate_section (output_bfd, inf section symbol winds up in the output section. */ sym = local_syms + r_symndx; if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - goto final_link_relocate; + { + if (! howto->partial_inplace) + { + /* For relocations with the addend in the + relocation, we need just to update the addend. + All real relocs are of type partial_inplace; this + code is mostly for completeness. */ + rel->r_addend += sec->output_offset + sym->st_value; + + continue; + } + + /* Relocs of type partial_inplace need to pick up the + contents in the contents and add the offset resulting + from the changed location of the section symbol. + Using _bfd_final_link_relocate (e.g. goto + final_link_relocate) here would be wrong, because + relocations marked pc_relative would get the current + location subtracted, and we must only do that at the + final link. */ + r = _bfd_relocate_contents (howto, input_bfd, + sec->output_offset + + sym->st_value, + contents + rel->r_offset); + goto relocation_done; + } continue; } @@ -3097,7 +3132,7 @@ sh_elf_relocate_section (output_bfd, inf { (*_bfd_error_handler) (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"), - bfd_get_filename (input_bfd), h->root.root.string, + bfd_archive_filename (input_bfd), h->root.root.string, bfd_get_section_name (input_bfd, input_section)); relocation = 0; } @@ -3108,7 +3143,9 @@ sh_elf_relocate_section (output_bfd, inf } else if (h->root.type == bfd_link_hash_undefweak) relocation = 0; - else if (info->shared && !info->symbolic && !info->no_undefined) + else if (info->shared + && (!info->symbolic || info->allow_shlib_undefined) + && !info->no_undefined) relocation = 0; else { @@ -3161,7 +3198,7 @@ sh_elf_relocate_section (output_bfd, inf { ((*_bfd_error_handler) (_("%s: 0x%lx: fatal: unaligned branch target for relax-support relocation"), - bfd_get_filename (input_section->owner), + bfd_archive_filename (input_section->owner), (unsigned long) rel->r_offset)); bfd_set_error (bfd_error_bad_value); return false; @@ -3245,7 +3282,8 @@ sh_elf_relocate_section (output_bfd, inf BFD_ASSERT (h != NULL && h->dynindx != -1); relocate = false; outrel.r_info = ELF32_R_INFO (h->dynindx, R_SH_REL32); - outrel.r_addend = rel->r_addend; + outrel.r_addend + = bfd_get_32 (input_bfd, contents + rel->r_offset); } else { @@ -3258,14 +3296,18 @@ sh_elf_relocate_section (output_bfd, inf { relocate = true; outrel.r_info = ELF32_R_INFO (0, R_SH_RELATIVE); - outrel.r_addend = relocation + rel->r_addend; + outrel.r_addend + = relocation + bfd_get_32 (input_bfd, + contents + rel->r_offset); } else { BFD_ASSERT (h->dynindx != -1); relocate = false; outrel.r_info = ELF32_R_INFO (h->dynindx, R_SH_DIR32); - outrel.r_addend = relocation + rel->r_addend; + outrel.r_addend + = relocation + bfd_get_32 (input_bfd, + contents + rel->r_offset); } } @@ -3282,8 +3324,6 @@ sh_elf_relocate_section (output_bfd, inf if (! relocate) continue; } - else if (r_type == R_SH_DIR32) - addend = rel->r_addend; goto final_link_relocate; case R_SH_GOT32: @@ -3463,6 +3503,7 @@ sh_elf_relocate_section (output_bfd, inf } } + relocation_done: if (r != bfd_reloc_ok) { switch (r) @@ -3531,7 +3572,7 @@ sh_elf_get_relocated_section_contents (o symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; memcpy (data, elf_section_data (input_section)->this_hdr.contents, - input_section->_raw_size); + (size_t) input_section->_raw_size); if ((input_section->flags & SEC_RELOC) != 0 && input_section->reloc_count > 0) @@ -3539,20 +3580,19 @@ sh_elf_get_relocated_section_contents (o Elf_Internal_Sym *isymp; asection **secpp; Elf32_External_Sym *esym, *esymend; + bfd_size_type size; if (symtab_hdr->contents != NULL) external_syms = (Elf32_External_Sym *) symtab_hdr->contents; else { - external_syms = ((Elf32_External_Sym *) - bfd_malloc (symtab_hdr->sh_info - * sizeof (Elf32_External_Sym))); - if (external_syms == NULL && symtab_hdr->sh_info > 0) + size = symtab_hdr->sh_info; + size *= sizeof (Elf32_External_Sym); + external_syms = (Elf32_External_Sym *) bfd_malloc (size); + if (external_syms == NULL && size != 0) goto error_return; if (bfd_seek (input_bfd, symtab_hdr->sh_offset, SEEK_SET) != 0 - || (bfd_read (external_syms, sizeof (Elf32_External_Sym), - symtab_hdr->sh_info, input_bfd) - != (symtab_hdr->sh_info * sizeof (Elf32_External_Sym)))) + || bfd_bread (external_syms, size, input_bfd) != size) goto error_return; } @@ -3562,14 +3602,15 @@ sh_elf_get_relocated_section_contents (o if (internal_relocs == NULL) goto error_return; - internal_syms = ((Elf_Internal_Sym *) - bfd_malloc (symtab_hdr->sh_info - * sizeof (Elf_Internal_Sym))); + size = symtab_hdr->sh_info; + size *= sizeof (Elf_Internal_Sym); + internal_syms = (Elf_Internal_Sym *) bfd_malloc (size); if (internal_syms == NULL && symtab_hdr->sh_info > 0) goto error_return; - sections = (asection **) bfd_malloc (symtab_hdr->sh_info - * sizeof (asection *)); + size = symtab_hdr->sh_info; + size *= sizeof (asection *); + sections = (asection **) bfd_malloc (size); if (sections == NULL && symtab_hdr->sh_info > 0) goto error_return; @@ -3828,10 +3869,11 @@ sh_elf_check_relocs (abfd, info, sec, re symbol. */ if (local_got_offsets == NULL) { - size_t size; + bfd_size_type size; register unsigned int i; - size = symtab_hdr->sh_info * sizeof (bfd_vma); + size = symtab_hdr->sh_info; + size *= sizeof (bfd_vma); local_got_offsets = (bfd_vma *) bfd_alloc (abfd, size); if (local_got_offsets == NULL) return false; @@ -3967,7 +4009,7 @@ sh_elf_check_relocs (abfd, info, sec, re if (p == NULL) { p = ((struct elf_sh_pcrel_relocs_copied *) - bfd_alloc (dynobj, sizeof *p)); + bfd_alloc (dynobj, (bfd_size_type) sizeof *p)); if (p == NULL) return false; p->next = eh->pcrel_relocs_copied; @@ -4082,7 +4124,7 @@ sh_elf_merge_private_data (ibfd, obfd) { (*_bfd_error_handler) ("%s: uses %s instructions while previous modules use %s instructions", - bfd_get_filename (ibfd), + bfd_archive_filename (ibfd), EF_SH_HAS_DSP (new_flags) ? "dsp" : "floating point", EF_SH_HAS_DSP (new_flags) ? "floating point" : "dsp"); bfd_set_error (bfd_error_bad_value); @@ -4220,7 +4262,7 @@ sh_elf_finish_dynamic_symbol (output_bfd rel.r_offset = (sgot->output_section->vma + sgot->output_offset - + (h->got.offset &~ 1)); + + (h->got.offset &~ (bfd_vma) 1)); /* If this is a -Bsymbolic link, and the symbol is defined locally, we just want to emit a RELATIVE reloc. Likewise if @@ -4425,10 +4467,10 @@ sh_elf_finish_dynamic_sections (output_b } static enum elf_reloc_type_class -sh_elf_reloc_type_class (type) - int type; +sh_elf_reloc_type_class (rela) + const Elf_Internal_Rela *rela; { - switch (type) + switch ((int) ELF32_R_TYPE (rela->r_info)) { case R_SH_RELATIVE: return reloc_class_relative; diff -uprN binutils-2.11.90.0.31/bfd/elf32-sparc.c binutils-2.11.92.0.5/bfd/elf32-sparc.c --- binutils-2.11.90.0.31/bfd/elf32-sparc.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/elf32-sparc.c Mon Oct 1 15:25:21 2001 @@ -53,7 +53,7 @@ static boolean elf32_sparc_object_p static void elf32_sparc_final_write_processing PARAMS ((bfd *, boolean)); static enum elf_reloc_type_class elf32_sparc_reloc_type_class - PARAMS ((int)); + PARAMS ((const Elf_Internal_Rela *)); static asection * elf32_sparc_gc_mark_hook PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *, struct elf_link_hash_entry *, Elf_Internal_Sym *)); @@ -142,7 +142,7 @@ struct elf_reloc_map { unsigned char elf_reloc_val; }; -static CONST struct elf_reloc_map sparc_reloc_map[] = +static const struct elf_reloc_map sparc_reloc_map[] = { { BFD_RELOC_NONE, R_SPARC_NONE, }, { BFD_RELOC_16, R_SPARC_16, }, @@ -455,10 +455,11 @@ elf32_sparc_check_relocs (abfd, info, se symbol. */ if (local_got_offsets == NULL) { - size_t size; + bfd_size_type size; register unsigned int i; - size = symtab_hdr->sh_info * sizeof (bfd_vma); + size = symtab_hdr->sh_info; + size *= sizeof (bfd_vma); local_got_offsets = (bfd_vma *) bfd_alloc (abfd, size); if (local_got_offsets == NULL) return false; @@ -1032,33 +1033,36 @@ elf32_sparc_size_dynamic_sections (outpu must add the entries now so that we get the correct size for the .dynamic section. The DT_DEBUG entry is filled in by the dynamic linker and used by the debugger. */ - if (! info->shared) +#define add_dynamic_entry(TAG, VAL) \ + bfd_elf32_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL)) + + if (!info->shared) { - if (! bfd_elf32_add_dynamic_entry (info, DT_DEBUG, 0)) + if (!add_dynamic_entry (DT_DEBUG, 0)) return false; } if (relplt) { - if (! bfd_elf32_add_dynamic_entry (info, DT_PLTGOT, 0) - || ! bfd_elf32_add_dynamic_entry (info, DT_PLTRELSZ, 0) - || ! bfd_elf32_add_dynamic_entry (info, DT_PLTREL, DT_RELA) - || ! bfd_elf32_add_dynamic_entry (info, DT_JMPREL, 0)) + if (!add_dynamic_entry (DT_PLTGOT, 0) + || !add_dynamic_entry (DT_PLTRELSZ, 0) + || !add_dynamic_entry (DT_PLTREL, DT_RELA) + || !add_dynamic_entry (DT_JMPREL, 0)) return false; } - if (! bfd_elf32_add_dynamic_entry (info, DT_RELA, 0) - || ! bfd_elf32_add_dynamic_entry (info, DT_RELASZ, 0) - || ! bfd_elf32_add_dynamic_entry (info, DT_RELAENT, - sizeof (Elf32_External_Rela))) + if (!add_dynamic_entry (DT_RELA, 0) + || !add_dynamic_entry (DT_RELASZ, 0) + || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela))) return false; if (info->flags & DF_TEXTREL) { - if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0)) + if (!add_dynamic_entry (DT_TEXTREL, 0)) return false; } } +#undef add_dynamic_entry return true; } @@ -1233,7 +1237,8 @@ elf32_sparc_relocate_section (output_bfd } else if (h->root.type == bfd_link_hash_undefweak) relocation = 0; - else if (info->shared && !info->symbolic + else if (info->shared + && (!info->symbolic || info->allow_shlib_undefined) && !info->no_undefined && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) relocation = 0; @@ -1491,7 +1496,7 @@ elf32_sparc_relocate_section (output_bfd } else { - if (r_type == R_SPARC_32) + if (r_type == R_SPARC_32 || r_type == R_SPARC_UA32) { outrel.r_info = ELF32_R_INFO (0, R_SPARC_RELATIVE); outrel.r_addend = relocation + rel->r_addend; @@ -1530,7 +1535,7 @@ elf32_sparc_relocate_section (output_bfd BFD_FAIL (); (*_bfd_error_handler) (_("%s: probably compiled without -fPIC?"), - bfd_get_filename (input_bfd)); + bfd_archive_filename (input_bfd)); bfd_set_error (bfd_error_bad_value); return false; } @@ -1670,7 +1675,7 @@ elf32_sparc_relocate_section (output_bfd || reg == G0 || reg == O7) break; - bfd_put_32 (input_bfd, INSN_NOP, + bfd_put_32 (input_bfd, (bfd_vma) INSN_NOP, contents + rel->r_offset + 4); } @@ -1757,7 +1762,7 @@ elf32_sparc_finish_dynamic_symbol (outpu (PLT_ENTRY_WORD1 + (((- (h->plt.offset + 4)) >> 2) & 0x3fffff)), splt->contents + h->plt.offset + 4); - bfd_put_32 (output_bfd, PLT_ENTRY_WORD2, + bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD2, splt->contents + h->plt.offset + 8); /* Fill in the entry in the .rela.plt section. */ @@ -1800,7 +1805,7 @@ elf32_sparc_finish_dynamic_symbol (outpu rela.r_offset = (sgot->output_section->vma + sgot->output_offset - + (h->got.offset &~ 1)); + + (h->got.offset &~ (bfd_vma) 1)); /* If this is a -Bsymbolic link, and the symbol is defined locally, we just want to emit a RELATIVE reloc. Likewise if @@ -1926,7 +1931,7 @@ elf32_sparc_finish_dynamic_sections (out if (splt->_raw_size > 0) { memset (splt->contents, 0, 4 * PLT_ENTRY_SIZE); - bfd_put_32 (output_bfd, SPARC_NOP, + bfd_put_32 (output_bfd, (bfd_vma) SPARC_NOP, splt->contents + splt->_raw_size - 4); } @@ -1983,7 +1988,7 @@ elf32_sparc_merge_private_bfd_data (ibfd error = true; (*_bfd_error_handler) (_("%s: compiled for a 64 bit system and target is 32 bit"), - bfd_get_filename (ibfd)); + bfd_archive_filename (ibfd)); } else if ((ibfd->flags & DYNAMIC) == 0) { @@ -1997,7 +2002,7 @@ elf32_sparc_merge_private_bfd_data (ibfd { (*_bfd_error_handler) (_("%s: linking little endian files with big endian files"), - bfd_get_filename (ibfd)); + bfd_archive_filename (ibfd)); error = true; } previous_ibfd_e_flags = elf_elfheader (ibfd)->e_flags & EF_SPARC_LEDATA; @@ -2077,10 +2082,10 @@ elf32_sparc_final_write_processing (abfd } static enum elf_reloc_type_class -elf32_sparc_reloc_type_class (type) - int type; +elf32_sparc_reloc_type_class (rela) + const Elf_Internal_Rela *rela; { - switch (type) + switch ((int) ELF32_R_TYPE (rela->r_info)) { case R_SPARC_RELATIVE: return reloc_class_relative; diff -uprN binutils-2.11.90.0.31/bfd/elf32-v850.c binutils-2.11.92.0.5/bfd/elf32-v850.c --- binutils-2.11.90.0.31/bfd/elf32-v850.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/elf32-v850.c Mon Oct 1 15:25:21 2001 @@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suit #include "libiberty.h" /* Sign-extend a 24-bit number. */ -#define SEXT24(x) ((((x) & 0xffffff) ^ (~ 0x7fffff)) + 0x800000) +#define SEXT24(x) ((((x) & 0xffffff) ^ 0x800000) - 0x800000) static reloc_howto_type *v850_elf_reloc_type_lookup PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); @@ -46,7 +46,7 @@ static boolean v850_elf_relocate_section PARAMS((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); static bfd_reloc_status_type v850_elf_perform_relocation - PARAMS ((bfd *, int, bfd_vma, bfd_byte *)); + PARAMS ((bfd *, unsigned int, bfd_vma, bfd_byte *)); static boolean v850_elf_check_relocs PARAMS ((bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *)); static void remember_hi16s_reloc @@ -524,7 +524,7 @@ v850_elf_reloc_type_lookup (abfd, code) if (v850_elf_reloc_map[i].bfd_reloc_val == code) { unsigned int elf_reloc_val = v850_elf_reloc_map[i].elf_reloc_val; - + BFD_ASSERT (v850_elf_howto_table[elf_reloc_val].type == elf_reloc_val); return v850_elf_howto_table + elf_reloc_val; @@ -590,7 +590,7 @@ v850_elf_check_relocs (abfd, info, sec, #ifdef DEBUG fprintf (stderr, "v850_elf_check_relocs called for section %s in %s\n", bfd_get_section_name (abfd, sec), - bfd_get_filename (abfd)); + bfd_archive_filename (abfd)); #endif dynobj = elf_hash_table (info)->dynobj; @@ -699,7 +699,8 @@ v850_elf_check_relocs (abfd, info, sec, sprintf (buff, msg, h->root.root.string); info->callbacks->warning (info, buff, h->root.root.string, - abfd, h->root.u.def.section, 0); + abfd, h->root.u.def.section, + (bfd_vma) 0); bfd_set_error (bfd_error_bad_value); h->other |= V850_OTHER_ERROR; @@ -764,10 +765,11 @@ remember_hi16s_reloc (abfd, addend, addr bfd_byte * address; { hi16s_location * entry = NULL; + bfd_size_type amt = sizeof (* free_hi16s); /* Find a free structure. */ if (free_hi16s == NULL) - free_hi16s = (hi16s_location *) bfd_zalloc (abfd, sizeof (* free_hi16s)); + free_hi16s = (hi16s_location *) bfd_zalloc (abfd, amt); entry = free_hi16s; free_hi16s = free_hi16s->next; @@ -837,10 +839,10 @@ find_remembered_hi16s_reloc (addend, alr static bfd_reloc_status_type v850_elf_perform_relocation (abfd, r_type, addend, address) - bfd * abfd; - int r_type; - bfd_vma addend; - bfd_byte * address; + bfd *abfd; + unsigned int r_type; + bfd_vma addend; + bfd_byte *address; { unsigned long insn; bfd_signed_vma saddend = (bfd_signed_vma) addend; @@ -865,7 +867,7 @@ v850_elf_perform_relocation (abfd, r_typ insn = bfd_get_32 (abfd, address); insn &= ~0xfffe003f; insn |= (((addend & 0xfffe) << 16) | ((addend & 0x3f0000) >> 16)); - bfd_put_32 (abfd, insn, address); + bfd_put_32 (abfd, (bfd_vma) insn, address); return bfd_reloc_ok; case R_V850_9_PCREL: @@ -1064,7 +1066,7 @@ v850_elf_perform_relocation (abfd, r_typ { insn = bfd_get_16 (abfd, hi16s_address); insn += 1; - bfd_put_16 (abfd, insn, hi16s_address); + bfd_put_16 (abfd, (bfd_vma) insn, hi16s_address); } } else @@ -1130,7 +1132,7 @@ v850_elf_perform_relocation (abfd, r_typ if (addend & 1) return bfd_reloc_dangerous; - insn = (addend & ~1) | (insn & 1); + insn = (addend &~ (bfd_vma) 1) | (insn & 1); break; case R_V850_TDA_6_8_OFFSET: @@ -1219,9 +1221,9 @@ v850_elf_perform_relocation (abfd, r_typ insn &= 0x0001ffdf; insn |= (addend & 1) << 5; - insn |= (addend & ~1) << 16; + insn |= (addend &~ (bfd_vma) 1) << 16; - bfd_put_32 (abfd, insn, address); + bfd_put_32 (abfd, (bfd_vma) insn, address); return bfd_reloc_ok; case R_V850_CALLT_6_7_OFFSET: @@ -1246,7 +1248,7 @@ v850_elf_perform_relocation (abfd, r_typ } - bfd_put_16 (abfd, insn, address); + bfd_put_16 (abfd, (bfd_vma) insn, address); return bfd_reloc_ok; } @@ -1315,7 +1317,7 @@ v850_elf_reloc (abfd, reloc, symbol, dat .text .globl _start nop - _start: + _start: jr foo .section ".foo","ax" @@ -1363,7 +1365,7 @@ v850_elf_final_link_relocate (howto, inp asection * sym_sec; int is_local ATTRIBUTE_UNUSED; { - unsigned long r_type = howto->type; + unsigned int r_type = howto->type; bfd_byte * hit_data = contents + offset; /* Adjust the value according to the relocation. */ @@ -1535,7 +1537,8 @@ v850_elf_relocate_section (output_bfd, i if (sym_hashes == NULL) { info->callbacks->warning - (info, "no hash table available", NULL, input_bfd, input_section, 0); + (info, "no hash table available", + NULL, input_bfd, input_section, (bfd_vma) 0); return false; } @@ -1903,7 +1906,7 @@ v850_elf_merge_private_bfd_data (ibfd, o if ((in_flags & EF_V850_ARCH) != (out_flags & EF_V850_ARCH) && (in_flags & EF_V850_ARCH) != E_V850_ARCH) _bfd_error_handler (_("%s: Architecture mismatch with previous modules"), - bfd_get_filename (ibfd)); + bfd_archive_filename (ibfd)); return true; } @@ -2218,7 +2221,8 @@ v850_elf_fake_sections (abfd, hdr, sec) #define TARGET_LITTLE_SYM bfd_elf32_v850_vec #define TARGET_LITTLE_NAME "elf32-v850" #define ELF_ARCH bfd_arch_v850 -#define ELF_MACHINE_CODE EM_CYGNUS_V850 +#define ELF_MACHINE_CODE EM_V850 +#define ELF_MACHINE_ALT1 EM_CYGNUS_V850 #define ELF_MAXPAGESIZE 0x1000 #define elf_info_to_howto v850_elf_info_to_howto_rela diff -uprN binutils-2.11.90.0.31/bfd/elf64-alpha.c binutils-2.11.92.0.5/bfd/elf64-alpha.c --- binutils-2.11.90.0.31/bfd/elf64-alpha.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/elf64-alpha.c Mon Oct 1 15:25:21 2001 @@ -74,6 +74,8 @@ static boolean elf64_alpha_object_p PARAMS((bfd *)); static boolean elf64_alpha_section_from_shdr PARAMS((bfd *, Elf64_Internal_Shdr *, char *)); +static boolean elf64_alpha_section_flags + PARAMS((flagword *, Elf64_Internal_Shdr *)); static boolean elf64_alpha_fake_sections PARAMS((bfd *, Elf64_Internal_Shdr *, asection *)); static boolean elf64_alpha_create_got_section @@ -134,7 +136,7 @@ static boolean elf64_alpha_merge_ind_sym static Elf_Internal_Rela * elf64_alpha_find_reloc_at_ofs PARAMS ((Elf_Internal_Rela *, Elf_Internal_Rela *, bfd_vma, int)); static enum elf_reloc_type_class elf64_alpha_reloc_type_class - PARAMS ((int)); + PARAMS ((const Elf_Internal_Rela *)); struct alpha_elf_link_hash_entry { @@ -161,7 +163,7 @@ struct alpha_elf_link_hash_entry bfd *gotobj; /* the addend in effect for this entry. */ - bfd_signed_vma addend; + bfd_vma addend; /* the .got offset for this entry. */ int got_offset; @@ -319,9 +321,9 @@ elf64_alpha_bfd_link_hash_table_create ( bfd *abfd; { struct alpha_elf_link_hash_table *ret; + bfd_size_type amt = sizeof (struct alpha_elf_link_hash_table); - ret = ((struct alpha_elf_link_hash_table *) - bfd_zalloc (abfd, sizeof (struct alpha_elf_link_hash_table))); + ret = (struct alpha_elf_link_hash_table *) bfd_zalloc (abfd, amt); if (ret == (struct alpha_elf_link_hash_table *) NULL) return NULL; @@ -373,7 +375,8 @@ static boolean elf64_alpha_mkobject (abfd) bfd *abfd; { - abfd->tdata.any = bfd_zalloc (abfd, sizeof (struct alpha_elf_obj_tdata)); + bfd_size_type amt = sizeof (struct alpha_elf_obj_tdata); + abfd->tdata.any = bfd_zalloc (abfd, amt); if (abfd->tdata.any == NULL) return false; return true; @@ -385,7 +388,8 @@ elf64_alpha_object_p (abfd) { /* Allocate our special target data. */ struct alpha_elf_obj_tdata *new_tdata; - new_tdata = bfd_zalloc (abfd, sizeof (struct alpha_elf_obj_tdata)); + bfd_size_type amt = sizeof (struct alpha_elf_obj_tdata); + new_tdata = bfd_zalloc (abfd, amt); if (new_tdata == NULL) return false; new_tdata->root = *abfd->tdata.elf_obj_data; @@ -399,6 +403,9 @@ elf64_alpha_object_p (abfd) from smaller values. Start with zero, widen, *then* decrement. */ #define MINUS_ONE (((bfd_vma)0) - 1) +#define SKIP_HOWTO(N) \ + HOWTO(N, 0, 0, 0, 0, 0, 0, elf64_alpha_reloc_bad, 0, 0, 0, 0, 0) + static reloc_howto_type elf64_alpha_howto_table[] = { HOWTO (R_ALPHA_NONE, /* type */ @@ -465,7 +472,7 @@ static reloc_howto_type elf64_alpha_howt /* Used for an instruction that refers to memory off the GP register. */ HOWTO (R_ALPHA_LITERAL, /* type */ 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ @@ -486,7 +493,7 @@ static reloc_howto_type elf64_alpha_howt This does not actually do any relocation. */ HOWTO (R_ALPHA_LITUSE, /* type */ 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ 32, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ @@ -546,7 +553,7 @@ static reloc_howto_type elf64_alpha_howt /* A hint for a jump to a register. */ HOWTO (R_ALPHA_HINT, /* type */ 2, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ 14, /* bitsize */ true, /* pc_relative */ 0, /* bitpos */ @@ -603,99 +610,22 @@ static reloc_howto_type elf64_alpha_howt MINUS_ONE, /* dst_mask */ true), /* pcrel_offset */ - /* Push a value on the reloc evaluation stack. */ - /* Not implemented -- it's dumb. */ - HOWTO (R_ALPHA_OP_PUSH, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - elf64_alpha_reloc_bad, /* special_function */ - "OP_PUSH", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* Store the value from the stack at the given address. Store it in - a bitfield of size r_size starting at bit position r_offset. */ - /* Not implemented -- it's dumb. */ - HOWTO (R_ALPHA_OP_STORE, /* type */ - 0, /* rightshift */ - 4, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - elf64_alpha_reloc_bad, /* special_function */ - "OP_STORE", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - MINUS_ONE, /* dst_mask */ - false), /* pcrel_offset */ - - /* Subtract the reloc address from the value on the top of the - relocation stack. */ - /* Not implemented -- it's dumb. */ - HOWTO (R_ALPHA_OP_PSUB, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - elf64_alpha_reloc_bad, /* special_function */ - "OP_PSUB", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* Shift the value on the top of the relocation stack right by the - given value. */ - /* Not implemented -- it's dumb. */ - HOWTO (R_ALPHA_OP_PRSHIFT, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - elf64_alpha_reloc_bad, /* special_function */ - "OP_PRSHIFT", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* Change the value of GP used by +r_addend until the next GPVALUE or the - end of the input bfd. */ - /* Not implemented -- it's dumb. */ - HOWTO (R_ALPHA_GPVALUE, - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - elf64_alpha_reloc_bad, /* special_function */ - "GPVALUE", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ + /* Skip 12 - 16; deprecated ECOFF relocs. */ + SKIP_HOWTO (12), + SKIP_HOWTO (13), + SKIP_HOWTO (14), + SKIP_HOWTO (15), + SKIP_HOWTO (16), /* The high 16 bits of the displacement from GP to the target. */ HOWTO (R_ALPHA_GPRELHIGH, 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - elf64_alpha_reloc_bad, /* special_function */ + 0, /* special_function */ "GPRELHIGH", /* name */ false, /* partial_inplace */ 0xffff, /* src_mask */ @@ -705,12 +635,12 @@ static reloc_howto_type elf64_alpha_howt /* The low 16 bits of the displacement from GP to the target. */ HOWTO (R_ALPHA_GPRELLOW, 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - elf64_alpha_reloc_bad, /* special_function */ + 0, /* special_function */ "GPRELLOW", /* name */ false, /* partial_inplace */ 0xffff, /* src_mask */ @@ -718,89 +648,25 @@ static reloc_howto_type elf64_alpha_howt false), /* pcrel_offset */ /* A 16-bit displacement from the GP to the target. */ - /* XXX: Not implemented. */ - HOWTO (R_ALPHA_IMMED_GP_16, + HOWTO (R_ALPHA_GPREL16, 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ 0, /* special_function */ - "IMMED_GP_16", /* name */ + "GPREL16", /* name */ false, /* partial_inplace */ 0xffff, /* src_mask */ 0xffff, /* dst_mask */ false), /* pcrel_offset */ - /* The high bits of a 32-bit displacement from the GP to the target; the - low bits are supplied in the subsequent R_ALPHA_IMMED_LO32 relocs. */ - /* XXX: Not implemented. */ - HOWTO (R_ALPHA_IMMED_GP_HI32, - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - elf64_alpha_reloc_bad, /* special_function */ - "IMMED_GP_HI32", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* The high bits of a 32-bit displacement to the starting address of the - current section (the relocation target is ignored); the low bits are - supplied in the subsequent R_ALPHA_IMMED_LO32 relocs. */ - /* XXX: Not implemented. */ - HOWTO (R_ALPHA_IMMED_SCN_HI32, - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - elf64_alpha_reloc_bad, /* special_function */ - "IMMED_SCN_HI32", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* The high bits of a 32-bit displacement from the previous br, bsr, jsr - or jmp insn (as tagged by a BRADDR or HINT reloc) to the target; the - low bits are supplied by subsequent R_ALPHA_IMMED_LO32 relocs. */ - /* XXX: Not implemented. */ - HOWTO (R_ALPHA_IMMED_BR_HI32, - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - elf64_alpha_reloc_bad, /* special_function */ - "IMMED_BR_HI32", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* The low 16 bits of a displacement calculated in a previous HI32 reloc. */ - /* XXX: Not implemented. */ - HOWTO (R_ALPHA_IMMED_LO32, - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - elf64_alpha_reloc_bad, /* special_function */ - "IMMED_LO32", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ + /* Skip 20 - 23; deprecated ECOFF relocs. */ + SKIP_HOWTO (20), + SKIP_HOWTO (21), + SKIP_HOWTO (22), + SKIP_HOWTO (23), /* Misc ELF relocations. */ @@ -939,8 +805,8 @@ elf64_alpha_do_reloc_gpdisp (abfd, gpdis | (((gpdisp >> 16) + ((gpdisp >> 15) & 1)) & 0xffff)); i_lda = (i_lda & 0xffff0000) | (gpdisp & 0xffff); - bfd_put_32 (abfd, i_ldah, p_ldah); - bfd_put_32 (abfd, i_lda, p_lda); + bfd_put_32 (abfd, (bfd_vma) i_ldah, p_ldah); + bfd_put_32 (abfd, (bfd_vma) i_lda, p_lda); return ret; } @@ -1003,30 +869,22 @@ struct elf_reloc_map static const struct elf_reloc_map elf64_alpha_reloc_map[] = { - {BFD_RELOC_NONE, R_ALPHA_NONE}, - {BFD_RELOC_32, R_ALPHA_REFLONG}, - {BFD_RELOC_64, R_ALPHA_REFQUAD}, - {BFD_RELOC_CTOR, R_ALPHA_REFQUAD}, - {BFD_RELOC_GPREL32, R_ALPHA_GPREL32}, - {BFD_RELOC_ALPHA_ELF_LITERAL, R_ALPHA_LITERAL}, - {BFD_RELOC_ALPHA_LITUSE, R_ALPHA_LITUSE}, - {BFD_RELOC_ALPHA_GPDISP, R_ALPHA_GPDISP}, - {BFD_RELOC_23_PCREL_S2, R_ALPHA_BRADDR}, - {BFD_RELOC_ALPHA_HINT, R_ALPHA_HINT}, - {BFD_RELOC_16_PCREL, R_ALPHA_SREL16}, - {BFD_RELOC_32_PCREL, R_ALPHA_SREL32}, - {BFD_RELOC_64_PCREL, R_ALPHA_SREL64}, - -/* The BFD_RELOC_ALPHA_USER_* relocations are used by the assembler to process - the explicit !!sequence relocations, and are mapped into the normal - relocations at the end of processing. */ - {BFD_RELOC_ALPHA_USER_LITERAL, R_ALPHA_LITERAL}, - {BFD_RELOC_ALPHA_USER_LITUSE_BASE, R_ALPHA_LITUSE}, - {BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF, R_ALPHA_LITUSE}, - {BFD_RELOC_ALPHA_USER_LITUSE_JSR, R_ALPHA_LITUSE}, - {BFD_RELOC_ALPHA_USER_GPDISP, R_ALPHA_GPDISP}, - {BFD_RELOC_ALPHA_USER_GPRELHIGH, R_ALPHA_GPRELHIGH}, - {BFD_RELOC_ALPHA_USER_GPRELLOW, R_ALPHA_GPRELLOW}, + {BFD_RELOC_NONE, R_ALPHA_NONE}, + {BFD_RELOC_32, R_ALPHA_REFLONG}, + {BFD_RELOC_64, R_ALPHA_REFQUAD}, + {BFD_RELOC_CTOR, R_ALPHA_REFQUAD}, + {BFD_RELOC_GPREL32, R_ALPHA_GPREL32}, + {BFD_RELOC_ALPHA_ELF_LITERAL, R_ALPHA_LITERAL}, + {BFD_RELOC_ALPHA_LITUSE, R_ALPHA_LITUSE}, + {BFD_RELOC_ALPHA_GPDISP, R_ALPHA_GPDISP}, + {BFD_RELOC_23_PCREL_S2, R_ALPHA_BRADDR}, + {BFD_RELOC_ALPHA_HINT, R_ALPHA_HINT}, + {BFD_RELOC_16_PCREL, R_ALPHA_SREL16}, + {BFD_RELOC_32_PCREL, R_ALPHA_SREL32}, + {BFD_RELOC_64_PCREL, R_ALPHA_SREL64}, + {BFD_RELOC_ALPHA_GPREL_HI16, R_ALPHA_GPRELHIGH}, + {BFD_RELOC_ALPHA_GPREL_LO16, R_ALPHA_GPRELLOW}, + {BFD_RELOC_GPREL16, R_ALPHA_GPREL16}, }; /* Given a BFD reloc type, return a HOWTO structure. */ @@ -1152,8 +1010,8 @@ elf64_alpha_relax_with_lituse (info, sym { ((*_bfd_error_handler) ("%s: %s+0x%lx: warning: LITERAL relocation against unexpected insn", - bfd_get_filename (info->abfd), info->sec->name, - (unsigned long)irel->r_offset)); + bfd_archive_filename (info->abfd), info->sec->name, + (unsigned long) irel->r_offset)); return irel; } @@ -1162,7 +1020,7 @@ elf64_alpha_relax_with_lituse (info, sym { if (ELF64_R_TYPE (urel->r_info) != R_ALPHA_LITUSE) break; - if (urel->r_addend >= 0 && urel->r_addend <= 3) + if (urel->r_addend <= 3) flags |= 1 << urel->r_addend; } @@ -1205,11 +1063,12 @@ elf64_alpha_relax_with_lituse (info, sym register from the literal insn. Leave the offset alone. */ insn = (insn & 0xffe0ffff) | (lit_insn & 0x001f0000); urel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info), - R_ALPHA_GPRELLOW); + R_ALPHA_GPREL16); urel->r_addend = irel->r_addend; info->changed_relocs = true; - bfd_put_32 (info->abfd, insn, info->contents + urel->r_offset); + bfd_put_32 (info->abfd, (bfd_vma) insn, + info->contents + urel->r_offset); info->changed_contents = true; } @@ -1221,7 +1080,7 @@ elf64_alpha_relax_with_lituse (info, sym irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info), R_ALPHA_GPRELHIGH); lit_insn = (OP_LDAH << 26) | (lit_insn & 0x03ff0000); - bfd_put_32 (info->abfd, lit_insn, + bfd_put_32 (info->abfd, (bfd_vma) lit_insn, info->contents + irel->r_offset); lit_reused = true; info->changed_contents = true; @@ -1241,13 +1100,15 @@ elf64_alpha_relax_with_lituse (info, sym /* FIXME: sanity check the insn for byte op. Check that the literal dest reg is indeed Rb in the byte insn. */ - insn = (insn & ~0x001ff000) | ((symval & 7) << 13) | 0x1000; + insn &= ~ (unsigned) 0x001ff000; + insn |= ((symval & 7) << 13) | 0x1000; urel->r_info = ELF64_R_INFO (0, R_ALPHA_NONE); urel->r_addend = 0; info->changed_relocs = true; - bfd_put_32 (info->abfd, insn, info->contents + urel->r_offset); + bfd_put_32 (info->abfd, (bfd_vma) insn, + info->contents + urel->r_offset); info->changed_contents = true; break; @@ -1280,7 +1141,8 @@ elf64_alpha_relax_with_lituse (info, sym else all_optimized = false; - bfd_put_32 (info->abfd, insn, info->contents + urel->r_offset); + bfd_put_32 (info->abfd, (bfd_vma) insn, + info->contents + urel->r_offset); /* Kill any HINT reloc that might exist for this insn. */ xrel = (elf64_alpha_find_reloc_at_ofs @@ -1295,14 +1157,36 @@ elf64_alpha_relax_with_lituse (info, sym else all_optimized = false; - /* ??? If target gp == current gp we can eliminate the gp reload. - This does depend on every place a gp could be reloaded will - be, which currently happens for all code produced by gcc, but - not necessarily by hand-coded assembly, or if sibling calls - are enabled in gcc. - - Perhaps conditionalize this on a flag being set in the target - object file's header, and have gcc set it? */ + /* Even if the target is not in range for a direct branch, + if we share a GP, we can eliminate the gp reload. */ + if (optdest) + { + Elf_Internal_Rela *gpdisp + = (elf64_alpha_find_reloc_at_ofs + (irel, irelend, urel->r_offset + 4, R_ALPHA_GPDISP)); + if (gpdisp) + { + bfd_byte *p_ldah = info->contents + gpdisp->r_offset; + bfd_byte *p_lda = p_ldah + gpdisp->r_addend; + unsigned int ldah = bfd_get_32 (info->abfd, p_ldah); + unsigned int lda = bfd_get_32 (info->abfd, p_lda); + + /* Verify that the instruction is "ldah $29,0($26)". + Consider a function that ends in a noreturn call, + and that the next function begins with an ldgp, + and that by accident there is no padding between. + In that case the insn would use $27 as the base. */ + if (ldah == 0x27ba0000 && lda == 0x23bd0000) + { + bfd_put_32 (info->abfd, (bfd_vma) INSN_UNOP, p_ldah); + bfd_put_32 (info->abfd, (bfd_vma) INSN_UNOP, p_lda); + + gpdisp->r_info = ELF64_R_INFO (0, R_ALPHA_NONE); + info->changed_contents = true; + info->changed_relocs = true; + } + } + } } break; } @@ -1326,7 +1210,8 @@ elf64_alpha_relax_with_lituse (info, sym irel->r_info = ELF64_R_INFO (0, R_ALPHA_NONE); info->changed_relocs = true; - bfd_put_32 (info->abfd, INSN_UNOP, info->contents + irel->r_offset); + bfd_put_32 (info->abfd, (bfd_vma) INSN_UNOP, + info->contents + irel->r_offset); info->changed_contents = true; } } @@ -1422,7 +1307,7 @@ elf64_alpha_relax_without_lituse (info, { ((*_bfd_error_handler) ("%s: %s+0x%lx: warning: LITERAL relocation against unexpected insn", - bfd_get_filename (info->abfd), info->sec->name, + bfd_archive_filename (info->abfd), info->sec->name, (unsigned long) irel->r_offset)); return true; } @@ -1439,10 +1324,10 @@ elf64_alpha_relax_without_lituse (info, `ldq R,X(gp)' for `lda R,Y(gp)'. */ insn = (OP_LDA << 26) | (insn & 0x03ff0000); - bfd_put_32 (info->abfd, insn, info->contents + irel->r_offset); + bfd_put_32 (info->abfd, (bfd_vma) insn, info->contents + irel->r_offset); info->changed_contents = true; - irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info), R_ALPHA_GPRELLOW); + irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info), R_ALPHA_GPREL16); info->changed_relocs = true; /* Reduce the use count on this got entry by one, possibly @@ -1566,13 +1451,12 @@ elf64_alpha_relax_section (abfd, sec, li extsyms = (Elf64_External_Sym *) symtab_hdr->contents; else { - extsyms = ((Elf64_External_Sym *) - bfd_malloc (symtab_hdr->sh_size)); + extsyms = (Elf64_External_Sym *) bfd_malloc (symtab_hdr->sh_size); if (extsyms == NULL) goto error_return; free_extsyms = extsyms; if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0 - || (bfd_read (extsyms, 1, symtab_hdr->sh_size, abfd) + || (bfd_bread (extsyms, symtab_hdr->sh_size, abfd) != symtab_hdr->sh_size)) goto error_return; } @@ -1708,10 +1592,10 @@ elf64_alpha_relax_section (abfd, sec, li /* PLT/GOT Stuff */ #define PLT_HEADER_SIZE 32 -#define PLT_HEADER_WORD1 0xc3600000 /* br $27,.+4 */ -#define PLT_HEADER_WORD2 0xa77b000c /* ldq $27,12($27) */ -#define PLT_HEADER_WORD3 0x47ff041f /* nop */ -#define PLT_HEADER_WORD4 0x6b7b0000 /* jmp $27,($27) */ +#define PLT_HEADER_WORD1 (bfd_vma) 0xc3600000 /* br $27,.+4 */ +#define PLT_HEADER_WORD2 (bfd_vma) 0xa77b000c /* ldq $27,12($27) */ +#define PLT_HEADER_WORD3 (bfd_vma) 0x47ff041f /* nop */ +#define PLT_HEADER_WORD4 (bfd_vma) 0x6b7b0000 /* jmp $27,($27) */ #define PLT_ENTRY_SIZE 12 #define PLT_ENTRY_WORD1 0xc3800000 /* br $28, plt0 */ @@ -1746,13 +1630,6 @@ elf64_alpha_section_from_shdr (abfd, hdr if (strcmp (name, ".mdebug") != 0) return false; break; -#ifdef ERIC_neverdef - case SHT_ALPHA_REGINFO: - if (strcmp (name, ".reginfo") != 0 - || hdr->sh_size != sizeof (Elf64_External_RegInfo)) - return false; - break; -#endif default: return false; } @@ -1769,22 +1646,18 @@ elf64_alpha_section_from_shdr (abfd, hdr return false; } -#ifdef ERIC_neverdef - /* For a .reginfo section, set the gp value in the tdata information - from the contents of this section. We need the gp value while - processing relocs, so we just get it now. */ - if (hdr->sh_type == SHT_ALPHA_REGINFO) - { - Elf64_External_RegInfo ext; - Elf64_RegInfo s; + return true; +} - if (! bfd_get_section_contents (abfd, newsect, (PTR) &ext, - (file_ptr) 0, sizeof ext)) - return false; - bfd_alpha_elf64_swap_reginfo_in (abfd, &ext, &s); - elf_gp (abfd) = s.ri_gp_value; - } -#endif +/* Convert Alpha specific section flags to bfd internal section flags. */ + +static boolean +elf64_alpha_section_flags (flags, hdr) + flagword *flags; + Elf64_Internal_Shdr *hdr; +{ + if (hdr->sh_flags & SHF_ALPHA_GPREL) + *flags |= SEC_SMALL_DATA; return true; } @@ -1812,31 +1685,8 @@ elf64_alpha_fake_sections (abfd, hdr, se else hdr->sh_entsize = 1; } -#ifdef ERIC_neverdef - else if (strcmp (name, ".reginfo") == 0) - { - hdr->sh_type = SHT_ALPHA_REGINFO; - /* In a shared object on Irix 5.3, the .reginfo section has an - entsize of 0x18. FIXME: Does this matter? */ - if ((abfd->flags & DYNAMIC) != 0) - hdr->sh_entsize = sizeof (Elf64_External_RegInfo); - else - hdr->sh_entsize = 1; - - /* Force the section size to the correct value, even if the - linker thinks it is larger. The link routine below will only - write out this much data for .reginfo. */ - hdr->sh_size = sec->_raw_size = sizeof (Elf64_External_RegInfo); - } - else if (strcmp (name, ".hash") == 0 - || strcmp (name, ".dynamic") == 0 - || strcmp (name, ".dynstr") == 0) - { - hdr->sh_entsize = 0; - hdr->sh_info = SIZEOF_ALPHA_DYNSYM_SECNAMES; - } -#endif - else if (strcmp (name, ".sdata") == 0 + else if ((sec->flags & SEC_SMALL_DATA) + || strcmp (name, ".sdata") == 0 || strcmp (name, ".sbss") == 0 || strcmp (name, ".lit4") == 0 || strcmp (name, ".lit8") == 0) @@ -2013,7 +1863,7 @@ elf64_alpha_read_ecoff_info (abfd, secti swap = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap; memset (debug, 0, sizeof (*debug)); - ext_hdr = (char *) bfd_malloc ((size_t) swap->external_hdr_size); + ext_hdr = (char *) bfd_malloc (swap->external_hdr_size); if (ext_hdr == NULL && swap->external_hdr_size != 0) goto error_return; @@ -2032,12 +1882,12 @@ elf64_alpha_read_ecoff_info (abfd, secti debug->ptr = NULL; \ else \ { \ - debug->ptr = (type) bfd_malloc ((size_t) (size * symhdr->count)); \ + bfd_size_type amt = (bfd_size_type) size * symhdr->count; \ + debug->ptr = (type) bfd_malloc (amt); \ if (debug->ptr == NULL) \ goto error_return; \ if (bfd_seek (abfd, (file_ptr) symhdr->offset, SEEK_SET) != 0 \ - || (bfd_read (debug->ptr, size, symhdr->count, \ - abfd) != size * symhdr->count)) \ + || bfd_bread (debug->ptr, amt, abfd) != amt) \ goto error_return; \ } @@ -2150,9 +2000,9 @@ elf64_alpha_find_nearest_line (abfd, sec char *fraw_src; char *fraw_end; struct fdr *fdr_ptr; + bfd_size_type amt = sizeof (struct mips_elf_find_line); - fi = ((struct mips_elf_find_line *) - bfd_zalloc (abfd, sizeof (struct mips_elf_find_line))); + fi = (struct mips_elf_find_line *) bfd_zalloc (abfd, amt); if (fi == NULL) { msec->flags = origflags; @@ -2166,10 +2016,8 @@ elf64_alpha_find_nearest_line (abfd, sec } /* Swap in the FDR information. */ - fi->d.fdr = ((struct fdr *) - bfd_alloc (abfd, - (fi->d.symbolic_header.ifdMax * - sizeof (struct fdr)))); + amt = fi->d.symbolic_header.ifdMax * sizeof (struct fdr); + fi->d.fdr = (struct fdr *) bfd_alloc (abfd, amt); if (fi->d.fdr == NULL) { msec->flags = origflags; @@ -2340,9 +2188,6 @@ elf64_alpha_output_extsym (h, data) else h->esym.asym.value = 0; } -#if 0 /* FIXME? */ - h->esym.ifd = 0; -#endif } if (! bfd_ecoff_debug_one_external (einfo->abfd, einfo->debug, einfo->swap, @@ -2384,6 +2229,7 @@ elf64_alpha_check_relocs (abfd, info, se struct alpha_elf_got_entry **local_got_entries; const Elf_Internal_Rela *rel, *relend; int got_created; + bfd_size_type amt; if (info->relocateable) return true; @@ -2437,9 +2283,9 @@ elf64_alpha_check_relocs (abfd, info, se if (!gotent) { + amt = sizeof (struct alpha_elf_got_entry); gotent = ((struct alpha_elf_got_entry *) - bfd_alloc (abfd, - sizeof (struct alpha_elf_got_entry))); + bfd_alloc (abfd, amt)); if (!gotent) return false; @@ -2462,16 +2308,16 @@ elf64_alpha_check_relocs (abfd, info, se /* This is a local .got entry -- record for merge. */ if (!local_got_entries) { - size_t size; - size = (symtab_hdr->sh_info - * sizeof (struct alpha_elf_got_entry *)); + bfd_size_type size; + size = symtab_hdr->sh_info; + size *= sizeof (struct alpha_elf_got_entry *); local_got_entries = ((struct alpha_elf_got_entry **) bfd_alloc (abfd, size)); if (!local_got_entries) return false; - memset (local_got_entries, 0, size); + memset (local_got_entries, 0, (size_t) size); alpha_elf_tdata (abfd)->local_got_entries = local_got_entries; } @@ -2482,9 +2328,9 @@ elf64_alpha_check_relocs (abfd, info, se continue; if (!gotent) { + amt = sizeof (struct alpha_elf_got_entry); gotent = ((struct alpha_elf_got_entry *) - bfd_alloc (abfd, - sizeof (struct alpha_elf_got_entry))); + bfd_alloc (abfd, amt)); if (!gotent) return false; @@ -2539,6 +2385,7 @@ elf64_alpha_check_relocs (abfd, info, se /* FALLTHRU */ case R_ALPHA_GPDISP: + case R_ALPHA_GPREL16: case R_ALPHA_GPREL32: case R_ALPHA_GPRELHIGH: case R_ALPHA_GPRELLOW: @@ -2591,17 +2438,15 @@ elf64_alpha_check_relocs (abfd, info, se sreloc = bfd_get_section_by_name (dynobj, rel_sec_name); if (sreloc == NULL) { + flagword flags; + sreloc = bfd_make_section (dynobj, rel_sec_name); + flags = (SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_LINKER_CREATED | SEC_READONLY); + if (sec->flags & SEC_ALLOC) + flags |= SEC_ALLOC | SEC_LOAD; if (sreloc == NULL - || !bfd_set_section_flags (dynobj, sreloc, - (((sec->flags - & SEC_ALLOC) - ? (SEC_ALLOC - | SEC_LOAD) : 0) - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY - | SEC_LINKER_CREATED - | SEC_READONLY)) + || !bfd_set_section_flags (dynobj, sreloc, flags) || !bfd_set_section_alignment (dynobj, sreloc, 3)) return false; } @@ -2623,9 +2468,8 @@ elf64_alpha_check_relocs (abfd, info, se if (!rent) { - rent = ((struct alpha_elf_reloc_entry *) - bfd_alloc (abfd, - sizeof (struct alpha_elf_reloc_entry))); + amt = sizeof (struct alpha_elf_reloc_entry); + rent = (struct alpha_elf_reloc_entry *) bfd_alloc (abfd, amt); if (!rent) return false; @@ -3063,7 +2907,7 @@ elf64_alpha_size_got_sections (output_bf /* Yikes! A single object file has too many entries. */ (*_bfd_error_handler) (_("%s: .got subsegment exceeds 64K (size %d)"), - bfd_get_filename (i), + bfd_archive_filename (i), alpha_elf_tdata (this_got)->total_got_entries * 8); return false; } @@ -3320,7 +3164,7 @@ elf64_alpha_size_dynamic_sections (outpu else { /* Allocate memory for the section contents. */ - s->contents = (bfd_byte *) bfd_zalloc(dynobj, s->_raw_size); + s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); if (s->contents == NULL && s->_raw_size != 0) return false; } @@ -3333,35 +3177,38 @@ elf64_alpha_size_dynamic_sections (outpu must add the entries now so that we get the correct size for the .dynamic section. The DT_DEBUG entry is filled in by the dynamic linker and used by the debugger. */ +#define add_dynamic_entry(TAG, VAL) \ + bfd_elf64_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL)) + if (!info->shared) { - if (!bfd_elf64_add_dynamic_entry (info, DT_DEBUG, 0)) + if (!add_dynamic_entry (DT_DEBUG, 0)) return false; } - if (! bfd_elf64_add_dynamic_entry (info, DT_PLTGOT, 0)) + if (!add_dynamic_entry (DT_PLTGOT, 0)) return false; if (relplt) { - if (! bfd_elf64_add_dynamic_entry (info, DT_PLTRELSZ, 0) - || ! bfd_elf64_add_dynamic_entry (info, DT_PLTREL, DT_RELA) - || ! bfd_elf64_add_dynamic_entry (info, DT_JMPREL, 0)) + if (!add_dynamic_entry (DT_PLTRELSZ, 0) + || !add_dynamic_entry (DT_PLTREL, DT_RELA) + || !add_dynamic_entry (DT_JMPREL, 0)) return false; } - if (! bfd_elf64_add_dynamic_entry (info, DT_RELA, 0) - || ! bfd_elf64_add_dynamic_entry (info, DT_RELASZ, 0) - || ! bfd_elf64_add_dynamic_entry (info, DT_RELAENT, - sizeof (Elf64_External_Rela))) + if (!add_dynamic_entry (DT_RELA, 0) + || !add_dynamic_entry (DT_RELASZ, 0) + || !add_dynamic_entry (DT_RELAENT, sizeof (Elf64_External_Rela))) return false; if (info->flags & DF_TEXTREL) { - if (! bfd_elf64_add_dynamic_entry (info, DT_TEXTREL, 0)) + if (!add_dynamic_entry (DT_TEXTREL, 0)) return false; } } +#undef add_dynamic_entry return true; } @@ -3386,6 +3233,7 @@ elf64_alpha_relocate_section (output_bfd asection *sec, *sgot, *srel, *srelgot; bfd *dynobj, *gotobj; bfd_vma gp; + boolean ret_val = true; srelgot = srel = NULL; symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; @@ -3422,7 +3270,7 @@ elf64_alpha_relocate_section (output_bfd struct alpha_elf_link_hash_entry *h; Elf_Internal_Sym *sym; bfd_vma relocation; - bfd_signed_vma addend; + bfd_vma addend; bfd_reloc_status_type r; r_type = ELF64_R_TYPE(rel->r_info); @@ -3487,33 +3335,8 @@ elf64_alpha_relocate_section (output_bfd { sec = h->root.root.u.def.section; -#if rth_notdef - if ((r_type == R_ALPHA_LITERAL - && elf_hash_table(info)->dynamic_sections_created - && (!info->shared - || !info->symbolic - || !(h->root.elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR))) - || (info->shared - && (!info->symbolic - || !(h->root.elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR)) - && (input_section->flags & SEC_ALLOC) - && (r_type == R_ALPHA_REFLONG - || r_type == R_ALPHA_REFQUAD - || r_type == R_ALPHA_LITERAL))) - { - /* In these cases, we don't need the relocation value. - We check specially because in some obscure cases - sec->output_section will be NULL. */ - relocation = 0; - } -#else - /* FIXME: Are not these obscure cases simply bugs? Let's - get something working and come back to this. */ if (sec->output_section == NULL) relocation = 0; -#endif /* rth_notdef */ else { relocation = (h->root.root.u.def.value @@ -3523,7 +3346,8 @@ elf64_alpha_relocate_section (output_bfd } else if (h->root.root.type == bfd_link_hash_undefweak) relocation = 0; - else if (info->shared && !info->symbolic + else if (info->shared + && (!info->symbolic || info->allow_shlib_undefined) && !info->no_undefined && ELF_ST_VISIBILITY (h->root.other) == STV_DEFAULT) relocation = 0; @@ -3534,7 +3358,7 @@ elf64_alpha_relocate_section (output_bfd input_section, rel->r_offset, (!info->shared || info->no_undefined || ELF_ST_VISIBILITY (h->root.other))))) - return false; + ret_val = false; relocation = 0; } } @@ -3560,13 +3384,6 @@ elf64_alpha_relocate_section (output_bfd } break; - case R_ALPHA_OP_PUSH: - case R_ALPHA_OP_STORE: - case R_ALPHA_OP_PSUB: - case R_ALPHA_OP_PRSHIFT: - /* We hate these silly beasts. */ - abort (); - case R_ALPHA_LITERAL: { struct alpha_elf_got_entry *gotent; @@ -3597,7 +3414,7 @@ elf64_alpha_relocate_section (output_bfd /* Initialize the .got entry's value. */ if (!(gotent->flags & ALPHA_ELF_GOT_ENTRY_RELOCS_DONE)) { - bfd_put_64 (output_bfd, relocation+addend, + bfd_put_64 (output_bfd, relocation + addend, sgot->contents + gotent->got_offset); /* If the symbol has been forced local, output a @@ -3613,7 +3430,7 @@ elf64_alpha_relocate_section (output_bfd + sgot->output_offset + gotent->got_offset); outrel.r_info = ELF64_R_INFO(0, R_ALPHA_RELATIVE); - outrel.r_addend = 0; + outrel.r_addend = relocation + addend; bfd_elf64_swap_reloca_out (output_bfd, &outrel, ((Elf64_External_Rela *) @@ -3637,13 +3454,28 @@ elf64_alpha_relocate_section (output_bfd /* overflow handled by _bfd_final_link_relocate */ goto default_reloc; + case R_ALPHA_GPREL16: case R_ALPHA_GPREL32: case R_ALPHA_GPRELLOW: + if (h && alpha_elf_dynamic_symbol_p (&h->root, info)) + { + (*_bfd_error_handler) + (_("%s: gp-relative relocation against dynamic symbol %s"), + bfd_archive_filename (input_bfd), h->root.root.root.string); + ret_val = false; + } BFD_ASSERT(gp != 0); relocation -= gp; goto default_reloc; case R_ALPHA_GPRELHIGH: + if (h && alpha_elf_dynamic_symbol_p (&h->root, info)) + { + (*_bfd_error_handler) + (_("%s: gp-relative relocation against dynamic symbol %s"), + bfd_archive_filename (input_bfd), h->root.root.root.string); + ret_val = false; + } BFD_ASSERT(gp != 0); relocation -= gp; relocation += addend; @@ -3652,8 +3484,17 @@ elf64_alpha_relocate_section (output_bfd + ((relocation >> 15) & 1)); goto default_reloc; - case R_ALPHA_BRADDR: case R_ALPHA_HINT: + /* A call to a dynamic symbol is definitely out of range of + the 16-bit displacement. Don't bother writing anything. */ + if (h && alpha_elf_dynamic_symbol_p (&h->root, info)) + { + r = bfd_reloc_ok; + break; + } + /* FALLTHRU */ + + case R_ALPHA_BRADDR: /* The regular PC-relative stuff measures from the start of the instruction rather than the end. */ addend -= 4; @@ -3678,7 +3519,7 @@ elf64_alpha_relocate_section (output_bfd else if (info->shared && (input_section->flags & SEC_ALLOC)) { outrel.r_info = ELF64_R_INFO(0, R_ALPHA_RELATIVE); - outrel.r_addend = 0; + outrel.r_addend = relocation + addend; } else goto default_reloc; @@ -3760,7 +3601,7 @@ elf64_alpha_relocate_section (output_bfd if (! ((*info->callbacks->reloc_overflow) (info, name, howto->name, (bfd_vma) 0, input_bfd, input_section, rel->r_offset))) - return false; + ret_val = false; } break; @@ -3770,7 +3611,7 @@ elf64_alpha_relocate_section (output_bfd } } - return true; + return ret_val; } /* Finish up dynamic symbol handling. We set the contents of various @@ -3819,7 +3660,7 @@ elf64_alpha_finish_dynamic_symbol (outpu /* Fill in the entry in the procedure linkage table. */ { - unsigned insn1, insn2, insn3; + bfd_vma insn1, insn2, insn3; insn1 = PLT_ENTRY_WORD1 | ((-(h->plt.offset + 4) >> 2) & 0x1fffff); insn2 = PLT_ENTRY_WORD2; @@ -3871,7 +3712,7 @@ elf64_alpha_finish_dynamic_symbol (outpu + sgot->output_offset + gotent->got_offset); outrel.r_info = ELF64_R_INFO(0, R_ALPHA_RELATIVE); - outrel.r_addend = 0; + outrel.r_addend = plt_addr; bfd_elf64_swap_reloca_out (output_bfd, &outrel, ((Elf64_External_Rela *) @@ -4005,8 +3846,8 @@ elf64_alpha_finish_dynamic_sections (out bfd_put_32 (output_bfd, PLT_HEADER_WORD4, splt->contents + 12); /* The next two words will be filled in by ld.so */ - bfd_put_64 (output_bfd, 0, splt->contents + 16); - bfd_put_64 (output_bfd, 0, splt->contents + 24); + bfd_put_64 (output_bfd, (bfd_vma) 0, splt->contents + 16); + bfd_put_64 (output_bfd, (bfd_vma) 0, splt->contents + 24); elf_section_data (splt->output_section)->this_hdr.sh_entsize = PLT_HEADER_SIZE; @@ -4016,9 +3857,9 @@ elf64_alpha_finish_dynamic_sections (out return true; } -/* We need to use a special link routine to handle the .reginfo and - the .mdebug sections. We need to merge all instances of these - sections together, not write them all out sequentially. */ +/* We need to use a special link routine to handle the .mdebug section. + We need to merge all instances of these sections together, not write + them all out sequentially. */ static boolean elf64_alpha_final_link (abfd, info) @@ -4027,96 +3868,17 @@ elf64_alpha_final_link (abfd, info) { asection *o; struct bfd_link_order *p; - asection *reginfo_sec, *mdebug_sec, *gptab_data_sec, *gptab_bss_sec; + asection *mdebug_sec; struct ecoff_debug_info debug; const struct ecoff_debug_swap *swap = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap; HDRR *symhdr = &debug.symbolic_header; PTR mdebug_handle = NULL; -#if 0 - if (++ngots == 2) - { - (*info->callbacks->warning) - (info, _("using multiple gp values"), (char *) NULL, - output_bfd, (asection *) NULL, (bfd_vma) 0); - } -#endif - - /* Go through the sections and collect the .reginfo and .mdebug - information. */ - reginfo_sec = NULL; + /* Go through the sections and collect the mdebug information. */ mdebug_sec = NULL; - gptab_data_sec = NULL; - gptab_bss_sec = NULL; for (o = abfd->sections; o != (asection *) NULL; o = o->next) { -#ifdef ERIC_neverdef - if (strcmp (o->name, ".reginfo") == 0) - { - memset (®info, 0, sizeof reginfo); - - /* We have found the .reginfo section in the output file. - Look through all the link_orders comprising it and merge - the information together. */ - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) - { - asection *input_section; - bfd *input_bfd; - Elf64_External_RegInfo ext; - Elf64_RegInfo sub; - - if (p->type != bfd_indirect_link_order) - { - if (p->type == bfd_fill_link_order) - continue; - abort (); - } - - input_section = p->u.indirect.section; - input_bfd = input_section->owner; - - /* The linker emulation code has probably clobbered the - size to be zero bytes. */ - if (input_section->_raw_size == 0) - input_section->_raw_size = sizeof (Elf64_External_RegInfo); - - if (! bfd_get_section_contents (input_bfd, input_section, - (PTR) &ext, - (file_ptr) 0, - sizeof ext)) - return false; - - bfd_alpha_elf64_swap_reginfo_in (input_bfd, &ext, &sub); - - reginfo.ri_gprmask |= sub.ri_gprmask; - reginfo.ri_cprmask[0] |= sub.ri_cprmask[0]; - reginfo.ri_cprmask[1] |= sub.ri_cprmask[1]; - reginfo.ri_cprmask[2] |= sub.ri_cprmask[2]; - reginfo.ri_cprmask[3] |= sub.ri_cprmask[3]; - - /* ri_gp_value is set by the function - alpha_elf_section_processing when the section is - finally written out. */ - - /* Hack: reset the SEC_HAS_CONTENTS flag so that - elf_link_input_bfd ignores this section. */ - input_section->flags &=~ SEC_HAS_CONTENTS; - } - - /* Force the section size to the value we want. */ - o->_raw_size = sizeof (Elf64_External_RegInfo); - - /* Skip this section later on (I don't think this currently - matters, but someday it might). */ - o->link_order_head = (struct bfd_link_order *) NULL; - - reginfo_sec = o; - } -#endif - if (strcmp (o->name, ".mdebug") == 0) { struct extsym_info einfo; @@ -4303,31 +4065,6 @@ elf64_alpha_final_link (abfd, info) input_section->flags &=~ SEC_HAS_CONTENTS; } -#ifdef ERIC_neverdef - if (info->shared) - { - /* Create .rtproc section. */ - rtproc_sec = bfd_get_section_by_name (abfd, ".rtproc"); - if (rtproc_sec == NULL) - { - flagword flags = (SEC_HAS_CONTENTS - | SEC_IN_MEMORY - | SEC_LINKER_CREATED - | SEC_READONLY); - - rtproc_sec = bfd_make_section (abfd, ".rtproc"); - if (rtproc_sec == NULL - || ! bfd_set_section_flags (abfd, rtproc_sec, flags) - || ! bfd_set_section_alignment (abfd, rtproc_sec, 12)) - return false; - } - - if (! alpha_elf_create_procedure_table (mdebug_handle, abfd, - info, rtproc_sec, &debug)) - return false; - } -#endif - /* Build the external symbol information. */ einfo.abfd = abfd; einfo.info = info; @@ -4349,229 +4086,6 @@ elf64_alpha_final_link (abfd, info) mdebug_sec = o; } - -#ifdef ERIC_neverdef - if (strncmp (o->name, ".gptab.", sizeof ".gptab." - 1) == 0) - { - const char *subname; - unsigned int c; - Elf64_gptab *tab; - Elf64_External_gptab *ext_tab; - unsigned int i; - - /* The .gptab.sdata and .gptab.sbss sections hold - information describing how the small data area would - change depending upon the -G switch. These sections - not used in executables files. */ - if (! info->relocateable) - { - asection **secpp; - - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) - { - asection *input_section; - - if (p->type != bfd_indirect_link_order) - { - if (p->type == bfd_fill_link_order) - continue; - abort (); - } - - input_section = p->u.indirect.section; - - /* Hack: reset the SEC_HAS_CONTENTS flag so that - elf_link_input_bfd ignores this section. */ - input_section->flags &=~ SEC_HAS_CONTENTS; - } - - /* Skip this section later on (I don't think this - currently matters, but someday it might). */ - o->link_order_head = (struct bfd_link_order *) NULL; - - /* Really remove the section. */ - for (secpp = &abfd->sections; - *secpp != o; - secpp = &(*secpp)->next) - ; - *secpp = (*secpp)->next; - --abfd->section_count; - - continue; - } - - /* There is one gptab for initialized data, and one for - uninitialized data. */ - if (strcmp (o->name, ".gptab.sdata") == 0) - gptab_data_sec = o; - else if (strcmp (o->name, ".gptab.sbss") == 0) - gptab_bss_sec = o; - else - { - (*_bfd_error_handler) - (_("%s: illegal section name `%s'"), - bfd_get_filename (abfd), o->name); - bfd_set_error (bfd_error_nonrepresentable_section); - return false; - } - - /* The linker script always combines .gptab.data and - .gptab.sdata into .gptab.sdata, and likewise for - .gptab.bss and .gptab.sbss. It is possible that there is - no .sdata or .sbss section in the output file, in which - case we must change the name of the output section. */ - subname = o->name + sizeof ".gptab" - 1; - if (bfd_get_section_by_name (abfd, subname) == NULL) - { - if (o == gptab_data_sec) - o->name = ".gptab.data"; - else - o->name = ".gptab.bss"; - subname = o->name + sizeof ".gptab" - 1; - BFD_ASSERT (bfd_get_section_by_name (abfd, subname) != NULL); - } - - /* Set up the first entry. */ - c = 1; - tab = (Elf64_gptab *) bfd_malloc (c * sizeof (Elf64_gptab)); - if (tab == NULL) - return false; - tab[0].gt_header.gt_current_g_value = elf_gp_size (abfd); - tab[0].gt_header.gt_unused = 0; - - /* Combine the input sections. */ - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) - { - asection *input_section; - bfd *input_bfd; - bfd_size_type size; - unsigned long last; - bfd_size_type gpentry; - - if (p->type != bfd_indirect_link_order) - { - if (p->type == bfd_fill_link_order) - continue; - abort (); - } - - input_section = p->u.indirect.section; - input_bfd = input_section->owner; - - /* Combine the gptab entries for this input section one - by one. We know that the input gptab entries are - sorted by ascending -G value. */ - size = bfd_section_size (input_bfd, input_section); - last = 0; - for (gpentry = sizeof (Elf64_External_gptab); - gpentry < size; - gpentry += sizeof (Elf64_External_gptab)) - { - Elf64_External_gptab ext_gptab; - Elf64_gptab int_gptab; - unsigned long val; - unsigned long add; - boolean exact; - unsigned int look; - - if (! (bfd_get_section_contents - (input_bfd, input_section, (PTR) &ext_gptab, - gpentry, sizeof (Elf64_External_gptab)))) - { - free (tab); - return false; - } - - bfd_alpha_elf64_swap_gptab_in (input_bfd, &ext_gptab, - &int_gptab); - val = int_gptab.gt_entry.gt_g_value; - add = int_gptab.gt_entry.gt_bytes - last; - - exact = false; - for (look = 1; look < c; look++) - { - if (tab[look].gt_entry.gt_g_value >= val) - tab[look].gt_entry.gt_bytes += add; - - if (tab[look].gt_entry.gt_g_value == val) - exact = true; - } - - if (! exact) - { - Elf64_gptab *new_tab; - unsigned int max; - - /* We need a new table entry. */ - new_tab = ((Elf64_gptab *) - bfd_realloc ((PTR) tab, - (c + 1) * sizeof (Elf64_gptab))); - if (new_tab == NULL) - { - free (tab); - return false; - } - tab = new_tab; - tab[c].gt_entry.gt_g_value = val; - tab[c].gt_entry.gt_bytes = add; - - /* Merge in the size for the next smallest -G - value, since that will be implied by this new - value. */ - max = 0; - for (look = 1; look < c; look++) - { - if (tab[look].gt_entry.gt_g_value < val - && (max == 0 - || (tab[look].gt_entry.gt_g_value - > tab[max].gt_entry.gt_g_value))) - max = look; - } - if (max != 0) - tab[c].gt_entry.gt_bytes += - tab[max].gt_entry.gt_bytes; - - ++c; - } - - last = int_gptab.gt_entry.gt_bytes; - } - - /* Hack: reset the SEC_HAS_CONTENTS flag so that - elf_link_input_bfd ignores this section. */ - input_section->flags &=~ SEC_HAS_CONTENTS; - } - - /* The table must be sorted by -G value. */ - if (c > 2) - qsort (tab + 1, c - 1, sizeof (tab[0]), gptab_compare); - - /* Swap out the table. */ - ext_tab = ((Elf64_External_gptab *) - bfd_alloc (abfd, c * sizeof (Elf64_External_gptab))); - if (ext_tab == NULL) - { - free (tab); - return false; - } - - for (i = 0; i < c; i++) - bfd_alpha_elf64_swap_gptab_out (abfd, tab + i, ext_tab + i); - free (tab); - - o->_raw_size = c * sizeof (Elf64_External_gptab); - o->contents = (bfd_byte *) ext_tab; - - /* Skip this section later on (I don't think this currently - matters, but someday it might). */ - o->link_order_head = (struct bfd_link_order *) NULL; - } -#endif - } /* Invoke the regular ELF backend linker to do all the work. */ @@ -4595,24 +4109,13 @@ elf64_alpha_final_link (abfd, info) sgot = alpha_elf_tdata(i)->got; if (! bfd_set_section_contents (abfd, sgot->output_section, - sgot->contents, sgot->output_offset, + sgot->contents, + (file_ptr) sgot->output_offset, sgot->_raw_size)) return false; } } -#ifdef ERIC_neverdef - if (reginfo_sec != (asection *) NULL) - { - Elf64_External_RegInfo ext; - - bfd_alpha_elf64_swap_reginfo_out (abfd, ®info, &ext); - if (! bfd_set_section_contents (abfd, reginfo_sec, (PTR) &ext, - (file_ptr) 0, sizeof ext)) - return false; - } -#endif - if (mdebug_sec != (asection *) NULL) { BFD_ASSERT (abfd->output_has_begun); @@ -4624,32 +4127,14 @@ elf64_alpha_final_link (abfd, info) bfd_ecoff_debug_free (mdebug_handle, abfd, &debug, swap, info); } - if (gptab_data_sec != (asection *) NULL) - { - if (! bfd_set_section_contents (abfd, gptab_data_sec, - gptab_data_sec->contents, - (file_ptr) 0, - gptab_data_sec->_raw_size)) - return false; - } - - if (gptab_bss_sec != (asection *) NULL) - { - if (! bfd_set_section_contents (abfd, gptab_bss_sec, - gptab_bss_sec->contents, - (file_ptr) 0, - gptab_bss_sec->_raw_size)) - return false; - } - return true; } static enum elf_reloc_type_class -elf64_alpha_reloc_type_class (type) - int type; +elf64_alpha_reloc_type_class (rela) + const Elf_Internal_Rela *rela; { - switch (type) + switch ((int) ELF64_R_TYPE (rela->r_info)) { case R_ALPHA_RELATIVE: return reloc_class_relative; @@ -4758,6 +4243,8 @@ const struct elf_size_info alpha_elf_siz #define elf_backend_section_from_shdr \ elf64_alpha_section_from_shdr +#define elf_backend_section_flags \ + elf64_alpha_section_flags #define elf_backend_fake_sections \ elf64_alpha_fake_sections diff -uprN binutils-2.11.90.0.31/bfd/elf64-gen.c binutils-2.11.92.0.5/bfd/elf64-gen.c --- binutils-2.11.90.0.31/bfd/elf64-gen.c Fri Aug 10 14:08:01 2001 +++ binutils-2.11.92.0.5/bfd/elf64-gen.c Mon Oct 1 15:25:21 2001 @@ -79,15 +79,9 @@ elf64_generic_link_add_symbols (abfd, in Elf_Internal_Ehdr *ehdrp; ehdrp = elf_elfheader (abfd); - if (abfd->my_archive) - (*_bfd_error_handler) (_("%s(%s): Relocations in generic ELF (EM: %d)"), - bfd_get_filename (abfd->my_archive), - bfd_get_filename (abfd), - ehdrp->e_machine); - else - (*_bfd_error_handler) (_("%s: Relocations in generic ELF (EM: %d)"), - bfd_get_filename (abfd), - ehdrp->e_machine); + (*_bfd_error_handler) (_("%s: Relocations in generic ELF (EM: %d)"), + bfd_archive_filename (abfd), + ehdrp->e_machine); bfd_set_error (bfd_error_wrong_format); return false; diff -uprN binutils-2.11.90.0.31/bfd/elf64-hppa.c binutils-2.11.92.0.5/bfd/elf64-hppa.c --- binutils-2.11.90.0.31/bfd/elf64-hppa.c Wed Aug 22 08:52:09 2001 +++ binutils-2.11.92.0.5/bfd/elf64-hppa.c Mon Oct 1 15:25:21 2001 @@ -62,7 +62,7 @@ struct elf64_hppa_dyn_hash_entry /* The index of the (possibly local) symbol in the input bfd and its associated BFD. Needed so that we can have relocs against local symbols in shared libraries. */ - unsigned long sym_indx; + long sym_indx; bfd *owner; /* Dynamic symbols may need to have two different values. One for @@ -317,7 +317,7 @@ elf64_hppa_hash_table_create (abfd) { struct elf64_hppa_link_hash_table *ret; - ret = bfd_zalloc (abfd, sizeof (*ret)); + ret = bfd_zalloc (abfd, (bfd_size_type) sizeof (*ret)); if (!ret) return 0; if (!_bfd_elf_link_hash_table_init (&ret->root, abfd, @@ -557,7 +557,7 @@ count_dyn_reloc (abfd, dyn_h, type, sec, struct elf64_hppa_dyn_reloc_entry *rent; rent = (struct elf64_hppa_dyn_reloc_entry *) - bfd_alloc (abfd, sizeof (*rent)); + bfd_alloc (abfd, (bfd_size_type) sizeof (*rent)); if (!rent) return false; @@ -614,6 +614,7 @@ elf64_hppa_check_relocs (abfd, info, sec int highest_shndx; Elf_Internal_Sym *local_syms, *isym; Elf64_External_Sym *ext_syms, *esym; + bfd_size_type amt; /* We're done with the old cache of section index to section symbol index information. Free it. @@ -624,15 +625,15 @@ elf64_hppa_check_relocs (abfd, info, sec free (hppa_info->section_syms); /* Allocate memory for the internal and external symbols. */ - local_syms - = (Elf_Internal_Sym *) bfd_malloc (symtab_hdr->sh_info - * sizeof (Elf_Internal_Sym)); + amt = symtab_hdr->sh_info; + amt *= sizeof (Elf_Internal_Sym); + local_syms = (Elf_Internal_Sym *) bfd_malloc (amt); if (local_syms == NULL) return false; - ext_syms - = (Elf64_External_Sym *) bfd_malloc (symtab_hdr->sh_info - * sizeof (Elf64_External_Sym)); + amt = symtab_hdr->sh_info; + amt *= sizeof (Elf64_External_Sym); + ext_syms = (Elf64_External_Sym *) bfd_malloc (amt); if (ext_syms == NULL) { free (local_syms); @@ -641,10 +642,7 @@ elf64_hppa_check_relocs (abfd, info, sec /* Read in the local symbols. */ if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0 - || bfd_read (ext_syms, 1, - (symtab_hdr->sh_info - * sizeof (Elf64_External_Sym)), abfd) - != (symtab_hdr->sh_info * sizeof (Elf64_External_Sym))) + || bfd_bread (ext_syms, amt, abfd) != amt) { free (local_syms); free (ext_syms); @@ -669,8 +667,9 @@ elf64_hppa_check_relocs (abfd, info, sec /* Allocate an array to hold the section index to section symbol index mapping. Bump by one since we start counting at zero. */ highest_shndx++; - hppa_info->section_syms = (int *) bfd_malloc (highest_shndx - * sizeof (int)); + amt = highest_shndx; + amt *= sizeof (int); + hppa_info->section_syms = (int *) bfd_malloc (amt); /* Now walk the local symbols again. If we find a section symbol, record the index of the symbol into the section_syms array. */ @@ -747,7 +746,8 @@ elf64_hppa_check_relocs (abfd, info, sec have yet been processed. Do something with what we know, as this may help reduce memory usage and processing time later. */ maybe_dynamic = false; - if (h && ((info->shared && ! info->symbolic) + if (h && ((info->shared + && (!info->symbolic || info->allow_shlib_undefined) ) || ! (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) || h->root.type == bfd_link_hash_defweak)) maybe_dynamic = true; @@ -974,7 +974,7 @@ elf64_hppa_dynamic_symbol_p (h, info) if (h->root.root.string[0] == '$' && h->root.root.string[1] == '$') return false; - if ((info->shared && !info->symbolic) + if ((info->shared && (!info->symbolic || info->allow_shlib_undefined)) || ((h->elf_link_hash_flags & (ELF_LINK_HASH_DEF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR)) == (ELF_LINK_HASH_DEF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR))) @@ -1047,8 +1047,8 @@ allocate_global_data_dlt (dyn_h, data) bfd *owner; owner = (h ? h->root.u.def.section->owner : dyn_h->owner); - if (!_bfd_elf64_link_record_local_dynamic_symbol - (x->info, owner, dyn_h->sym_indx)) + if (! (_bfd_elf64_link_record_local_dynamic_symbol + (x->info, owner, dyn_h->sym_indx))) return false; } } @@ -1801,8 +1801,11 @@ elf64_hppa_size_dynamic_sections (output /* Always create a DT_PLTGOT. It actually has nothing to do with the PLT, it is how we communicate the __gp value of a load module to the dynamic linker. */ - if (! bfd_elf64_add_dynamic_entry (info, DT_HP_DLD_FLAGS, 0) - || ! bfd_elf64_add_dynamic_entry (info, DT_PLTGOT, 0)) +#define add_dynamic_entry(TAG, VAL) \ + bfd_elf64_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL)) + + if (!add_dynamic_entry (DT_HP_DLD_FLAGS, 0) + || !add_dynamic_entry (DT_PLTGOT, 0)) return false; /* Add some entries to the .dynamic section. We fill in the @@ -1812,36 +1815,36 @@ elf64_hppa_size_dynamic_sections (output dynamic linker and used by the debugger. */ if (! info->shared) { - if (! bfd_elf64_add_dynamic_entry (info, DT_DEBUG, 0) - || ! bfd_elf64_add_dynamic_entry (info, DT_HP_DLD_HOOK, 0) - || ! bfd_elf64_add_dynamic_entry (info, DT_HP_LOAD_MAP, 0)) + if (!add_dynamic_entry (DT_DEBUG, 0) + || !add_dynamic_entry (DT_HP_DLD_HOOK, 0) + || !add_dynamic_entry (DT_HP_LOAD_MAP, 0)) return false; } if (plt) { - if (! bfd_elf64_add_dynamic_entry (info, DT_PLTRELSZ, 0) - || ! bfd_elf64_add_dynamic_entry (info, DT_PLTREL, DT_RELA) - || ! bfd_elf64_add_dynamic_entry (info, DT_JMPREL, 0)) + if (!add_dynamic_entry (DT_PLTRELSZ, 0) + || !add_dynamic_entry (DT_PLTREL, DT_RELA) + || !add_dynamic_entry (DT_JMPREL, 0)) return false; } if (relocs) { - if (! bfd_elf64_add_dynamic_entry (info, DT_RELA, 0) - || ! bfd_elf64_add_dynamic_entry (info, DT_RELASZ, 0) - || ! bfd_elf64_add_dynamic_entry (info, DT_RELAENT, - sizeof (Elf64_External_Rela))) + if (!add_dynamic_entry (DT_RELA, 0) + || !add_dynamic_entry (DT_RELASZ, 0) + || !add_dynamic_entry (DT_RELAENT, sizeof (Elf64_External_Rela))) return false; } if (reltext) { - if (! bfd_elf64_add_dynamic_entry (info, DT_TEXTREL, 0)) + if (!add_dynamic_entry (DT_TEXTREL, 0)) return false; info->flags |= DF_TEXTREL; } } +#undef add_dynamic_entry return true; } @@ -2026,13 +2029,13 @@ elf64_hppa_finish_dynamic_symbol (output /* Wide mode allows 16 bit offsets. */ max_offset = 32768; insn &= ~ 0xfff1; - insn |= re_assemble_16 (value); + insn |= re_assemble_16 ((int) value); } else { max_offset = 8192; insn &= ~ 0x3ff1; - insn |= re_assemble_14 (value); + insn |= re_assemble_14 ((int) value); } if ((value & 7) || value + max_offset >= 2*max_offset - 8) @@ -2043,7 +2046,7 @@ elf64_hppa_finish_dynamic_symbol (output return false; } - bfd_put_32 (stub->owner, insn, + bfd_put_32 (stub->owner, (bfd_vma) insn, stub->contents + dyn_h->stub_offset); /* Fix up the second ldd instruction. */ @@ -2052,14 +2055,14 @@ elf64_hppa_finish_dynamic_symbol (output if (output_bfd->arch_info->mach >= 25) { insn &= ~ 0xfff1; - insn |= re_assemble_16 (value); + insn |= re_assemble_16 ((int) value); } else { insn &= ~ 0x3ff1; - insn |= re_assemble_14 (value); + insn |= re_assemble_14 ((int) value); } - bfd_put_32 (stub->owner, insn, + bfd_put_32 (stub->owner, (bfd_vma) insn, stub->contents + dyn_h->stub_offset + 8); } @@ -2571,7 +2574,8 @@ elf64_hppa_modify_segment_map (abfd) break; if (m == NULL) { - m = (struct elf_segment_map *) bfd_zalloc (abfd, sizeof *m); + m = ((struct elf_segment_map *) + bfd_zalloc (abfd, (bfd_size_type) sizeof *m)); if (m == NULL) return false; diff -uprN binutils-2.11.90.0.31/bfd/elf64-mips.c binutils-2.11.92.0.5/bfd/elf64-mips.c --- binutils-2.11.90.0.31/bfd/elf64-mips.c Wed Aug 22 08:52:09 2001 +++ binutils-2.11.92.0.5/bfd/elf64-mips.c Thu Oct 4 14:35:43 2001 @@ -131,7 +131,7 @@ static reloc_howto_type mips_elf64_howto 32, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ + complain_overflow_dont, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_32", /* name */ true, /* partial_inplace */ @@ -146,7 +146,7 @@ static reloc_howto_type mips_elf64_howto 32, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ + complain_overflow_dont, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_REL32", /* name */ true, /* partial_inplace */ @@ -154,7 +154,7 @@ static reloc_howto_type mips_elf64_howto 0xffffffff, /* dst_mask */ false), /* pcrel_offset */ - /* 26 bit branch address. */ + /* 26 bit jump address. */ HOWTO (R_MIPS_26, /* type */ 2, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ @@ -163,7 +163,7 @@ static reloc_howto_type mips_elf64_howto 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ /* This needs complex overflow - detection, because the upper four + detection, because the upper 36 bits must match the PC + 4. */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_26", /* name */ @@ -336,7 +336,7 @@ static reloc_howto_type mips_elf64_howto 64, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ + complain_overflow_dont, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_64", /* name */ true, /* partial_inplace */ @@ -352,10 +352,10 @@ static reloc_howto_type mips_elf64_howto 16, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ + complain_overflow_signed, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_DISP", /* name */ - true, /* partial_inplace */ + false, /* partial_inplace */ 0x0000ffff, /* src_mask */ 0x0000ffff, /* dst_mask */ false), /* pcrel_offset */ @@ -368,10 +368,10 @@ static reloc_howto_type mips_elf64_howto 16, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ + complain_overflow_signed, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_PAGE", /* name */ - true, /* partial_inplace */ + false, /* partial_inplace */ 0x0000ffff, /* src_mask */ 0x0000ffff, /* dst_mask */ false), /* pcrel_offset */ @@ -384,10 +384,10 @@ static reloc_howto_type mips_elf64_howto 16, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ + complain_overflow_signed, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_OFST", /* name */ - true, /* partial_inplace */ + false, /* partial_inplace */ 0x0000ffff, /* src_mask */ 0x0000ffff, /* dst_mask */ false), /* pcrel_offset */ @@ -403,7 +403,7 @@ static reloc_howto_type mips_elf64_howto complain_overflow_dont, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_HI16", /* name */ - true, /* partial_inplace */ + false, /* partial_inplace */ 0x0000ffff, /* src_mask */ 0x0000ffff, /* dst_mask */ false), /* pcrel_offset */ @@ -419,7 +419,7 @@ static reloc_howto_type mips_elf64_howto complain_overflow_dont, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_LO16", /* name */ - true, /* partial_inplace */ + false, /* partial_inplace */ 0x0000ffff, /* src_mask */ 0x0000ffff, /* dst_mask */ false), /* pcrel_offset */ @@ -432,7 +432,7 @@ static reloc_howto_type mips_elf64_howto 64, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ + complain_overflow_dont, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_SUB", /* name */ true, /* partial_inplace */ @@ -444,16 +444,16 @@ static reloc_howto_type mips_elf64_howto /* FIXME: Not handled correctly. */ HOWTO (R_MIPS_INSERT_A, /* type */ 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_INSERT_A", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ + true, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ false), /* pcrel_offset */ /* Insert the addend as an instruction, and change all relocations @@ -461,36 +461,35 @@ static reloc_howto_type mips_elf64_howto /* FIXME: Not handled correctly. */ HOWTO (R_MIPS_INSERT_B, /* type */ 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_INSERT_B", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ + true, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ false), /* pcrel_offset */ /* Delete a 32 bit instruction. */ /* FIXME: Not handled correctly. */ HOWTO (R_MIPS_DELETE, /* type */ 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_DELETE", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ + true, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ false), /* pcrel_offset */ /* Get the higher value of a 64 bit addend. */ - /* FIXME: Not handled correctly. */ HOWTO (R_MIPS_HIGHER, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ @@ -533,8 +532,8 @@ static reloc_howto_type mips_elf64_howto bfd_elf_generic_reloc, /* special_function */ "R_MIPS_CALL_HI16", /* name */ true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ false), /* pcrel_offset */ /* Low 16 bits of displacement in global offset table. */ @@ -549,8 +548,8 @@ static reloc_howto_type mips_elf64_howto bfd_elf_generic_reloc, /* special_function */ "R_MIPS_CALL_LO16", /* name */ true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ false), /* pcrel_offset */ /* I'm not sure what the remaining relocs are, but they are defined @@ -558,79 +557,55 @@ static reloc_howto_type mips_elf64_howto HOWTO (R_MIPS_SCN_DISP, /* type */ 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_SCN_DISP", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ + true, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ false), /* pcrel_offset */ HOWTO (R_MIPS_REL16, /* type */ 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ + complain_overflow_signed, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_REL16", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_MIPS_ADD_IMMEDIATE, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_ADD_IMMEDIATE", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ + true, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ false), /* pcrel_offset */ - HOWTO (R_MIPS_PJUMP, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_PJUMP", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ + /* These two are obsolete. */ + EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE), + EMPTY_HOWTO (R_MIPS_PJUMP), HOWTO (R_MIPS_RELGOT, /* type */ 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_RELGOT", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ + true, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ false), /* pcrel_offset */ /* Protected jump conversion. This is an optimization hint. No relocation is required for correctness. */ HOWTO (R_MIPS_JALR, /* type */ 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ 0, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ @@ -638,8 +613,8 @@ static reloc_howto_type mips_elf64_howto bfd_elf_generic_reloc, /* special_function */ "R_MIPS_JALR", /* name */ false, /* partial_inplace */ - 0x00000000, /* src_mask */ - 0x00000000, /* dst_mask */ + 0, /* src_mask */ + 0, /* dst_mask */ false), /* pcrel_offset */ }; @@ -672,7 +647,7 @@ static reloc_howto_type mips_elf64_howto complain_overflow_bitfield, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_16", /* name */ - true, /* partial_inplace */ + false, /* partial_inplace */ 0, /* src_mask */ 0xffff, /* dst_mask */ false), /* pcrel_offset */ @@ -684,10 +659,10 @@ static reloc_howto_type mips_elf64_howto 32, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ + complain_overflow_dont, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_32", /* name */ - true, /* partial_inplace */ + false, /* partial_inplace */ 0, /* src_mask */ 0xffffffff, /* dst_mask */ false), /* pcrel_offset */ @@ -699,15 +674,15 @@ static reloc_howto_type mips_elf64_howto 32, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ + complain_overflow_dont, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_REL32", /* name */ - true, /* partial_inplace */ + false, /* partial_inplace */ 0, /* src_mask */ 0xffffffff, /* dst_mask */ false), /* pcrel_offset */ - /* 26 bit branch address. */ + /* 26 bit jump address. */ HOWTO (R_MIPS_26, /* type */ 2, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ @@ -716,11 +691,11 @@ static reloc_howto_type mips_elf64_howto 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ /* This needs complex overflow - detection, because the upper four + detection, because the upper 36 bits must match the PC + 4. */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_26", /* name */ - true, /* partial_inplace */ + false, /* partial_inplace */ 0, /* src_mask */ 0x3ffffff, /* dst_mask */ false), /* pcrel_offset */ @@ -735,7 +710,7 @@ static reloc_howto_type mips_elf64_howto complain_overflow_dont, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_HI16", /* name */ - true, /* partial_inplace */ + false, /* partial_inplace */ 0, /* src_mask */ 0xffff, /* dst_mask */ false), /* pcrel_offset */ @@ -750,7 +725,7 @@ static reloc_howto_type mips_elf64_howto complain_overflow_dont, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_LO16", /* name */ - true, /* partial_inplace */ + false, /* partial_inplace */ 0, /* src_mask */ 0xffff, /* dst_mask */ false), /* pcrel_offset */ @@ -794,7 +769,7 @@ static reloc_howto_type mips_elf64_howto false, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + bfd_elf_generic_reloc, /* special_function */ "R_MIPS_GOT16", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -811,7 +786,7 @@ static reloc_howto_type mips_elf64_howto complain_overflow_signed, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_PC16", /* name */ - true, /* partial_inplace */ + false, /* partial_inplace */ 0, /* src_mask */ 0xffff, /* dst_mask */ false), /* pcrel_offset */ @@ -861,7 +836,7 @@ static reloc_howto_type mips_elf64_howto complain_overflow_bitfield, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_SHIFT5", /* name */ - true, /* partial_inplace */ + false, /* partial_inplace */ 0, /* src_mask */ 0x000007c0, /* dst_mask */ false), /* pcrel_offset */ @@ -878,7 +853,7 @@ static reloc_howto_type mips_elf64_howto complain_overflow_bitfield, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_SHIFT6", /* name */ - true, /* partial_inplace */ + false, /* partial_inplace */ 0, /* src_mask */ 0x000007c4, /* dst_mask */ false), /* pcrel_offset */ @@ -890,10 +865,10 @@ static reloc_howto_type mips_elf64_howto 64, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ + complain_overflow_dont, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_64", /* name */ - true, /* partial_inplace */ + false, /* partial_inplace */ 0, /* src_mask */ MINUS_ONE, /* dst_mask */ false), /* pcrel_offset */ @@ -906,10 +881,10 @@ static reloc_howto_type mips_elf64_howto 16, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ + complain_overflow_signed, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_DISP", /* name */ - true, /* partial_inplace */ + false, /* partial_inplace */ 0, /* src_mask */ 0x0000ffff, /* dst_mask */ false), /* pcrel_offset */ @@ -922,10 +897,10 @@ static reloc_howto_type mips_elf64_howto 16, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ + complain_overflow_signed, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_PAGE", /* name */ - true, /* partial_inplace */ + false, /* partial_inplace */ 0, /* src_mask */ 0x0000ffff, /* dst_mask */ false), /* pcrel_offset */ @@ -938,10 +913,10 @@ static reloc_howto_type mips_elf64_howto 16, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ + complain_overflow_signed, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_OFST", /* name */ - true, /* partial_inplace */ + false, /* partial_inplace */ 0, /* src_mask */ 0x0000ffff, /* dst_mask */ false), /* pcrel_offset */ @@ -957,7 +932,7 @@ static reloc_howto_type mips_elf64_howto complain_overflow_dont, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_HI16", /* name */ - true, /* partial_inplace */ + false, /* partial_inplace */ 0, /* src_mask */ 0x0000ffff, /* dst_mask */ false), /* pcrel_offset */ @@ -973,7 +948,7 @@ static reloc_howto_type mips_elf64_howto complain_overflow_dont, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_GOT_LO16", /* name */ - true, /* partial_inplace */ + false, /* partial_inplace */ 0, /* src_mask */ 0x0000ffff, /* dst_mask */ false), /* pcrel_offset */ @@ -986,10 +961,10 @@ static reloc_howto_type mips_elf64_howto 64, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ + complain_overflow_dont, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_SUB", /* name */ - true, /* partial_inplace */ + false, /* partial_inplace */ 0, /* src_mask */ MINUS_ONE, /* dst_mask */ false), /* pcrel_offset */ @@ -998,8 +973,8 @@ static reloc_howto_type mips_elf64_howto /* FIXME: Not handled correctly. */ HOWTO (R_MIPS_INSERT_A, /* type */ 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ @@ -1007,7 +982,7 @@ static reloc_howto_type mips_elf64_howto "R_MIPS_INSERT_A", /* name */ false, /* partial_inplace */ 0, /* src_mask */ - 0, /* dst_mask */ + 0xffffffff, /* dst_mask */ false), /* pcrel_offset */ /* Insert the addend as an instruction, and change all relocations @@ -1015,8 +990,8 @@ static reloc_howto_type mips_elf64_howto /* FIXME: Not handled correctly. */ HOWTO (R_MIPS_INSERT_B, /* type */ 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ @@ -1024,15 +999,15 @@ static reloc_howto_type mips_elf64_howto "R_MIPS_INSERT_B", /* name */ false, /* partial_inplace */ 0, /* src_mask */ - 0, /* dst_mask */ + 0xffffffff, /* dst_mask */ false), /* pcrel_offset */ /* Delete a 32 bit instruction. */ /* FIXME: Not handled correctly. */ HOWTO (R_MIPS_DELETE, /* type */ 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ @@ -1040,11 +1015,10 @@ static reloc_howto_type mips_elf64_howto "R_MIPS_DELETE", /* name */ false, /* partial_inplace */ 0, /* src_mask */ - 0, /* dst_mask */ + 0xffffffff, /* dst_mask */ false), /* pcrel_offset */ /* Get the higher value of a 64 bit addend. */ - /* FIXME: Not handled correctly. */ HOWTO (R_MIPS_HIGHER, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ @@ -1052,15 +1026,14 @@ static reloc_howto_type mips_elf64_howto false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + bfd_elf_generic_reloc, /* special_function */ "R_MIPS_HIGHER", /* name */ - true, /* partial_inplace */ + false, /* partial_inplace */ 0, /* src_mask */ 0xffff, /* dst_mask */ false), /* pcrel_offset */ /* Get the highest value of a 64 bit addend. */ - /* FIXME: Not handled correctly. */ HOWTO (R_MIPS_HIGHEST, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ @@ -1068,9 +1041,9 @@ static reloc_howto_type mips_elf64_howto false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + bfd_elf_generic_reloc, /* special_function */ "R_MIPS_HIGHEST", /* name */ - true, /* partial_inplace */ + false, /* partial_inplace */ 0, /* src_mask */ 0xffff, /* dst_mask */ false), /* pcrel_offset */ @@ -1086,9 +1059,9 @@ static reloc_howto_type mips_elf64_howto complain_overflow_dont, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_CALL_HI16", /* name */ - true, /* partial_inplace */ + false, /* partial_inplace */ 0, /* src_mask */ - 0x0000ffff, /* dst_mask */ + 0xffff, /* dst_mask */ false), /* pcrel_offset */ /* Low 16 bits of displacement in global offset table. */ @@ -1102,9 +1075,9 @@ static reloc_howto_type mips_elf64_howto complain_overflow_dont, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_CALL_LO16", /* name */ - true, /* partial_inplace */ + false, /* partial_inplace */ 0, /* src_mask */ - 0x0000ffff, /* dst_mask */ + 0xffff, /* dst_mask */ false), /* pcrel_offset */ /* I'm not sure what the remaining relocs are, but they are defined @@ -1112,8 +1085,8 @@ static reloc_howto_type mips_elf64_howto HOWTO (R_MIPS_SCN_DISP, /* type */ 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ @@ -1121,55 +1094,31 @@ static reloc_howto_type mips_elf64_howto "R_MIPS_SCN_DISP", /* name */ false, /* partial_inplace */ 0, /* src_mask */ - 0, /* dst_mask */ + 0xffffffff, /* dst_mask */ false), /* pcrel_offset */ HOWTO (R_MIPS_REL16, /* type */ 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ + complain_overflow_signed, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_MIPS_REL16", /* name */ false, /* partial_inplace */ 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_MIPS_ADD_IMMEDIATE, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_ADD_IMMEDIATE", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ + 0xffff, /* dst_mask */ false), /* pcrel_offset */ - HOWTO (R_MIPS_PJUMP, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_PJUMP", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ + /* These two are obsolete. */ + EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE), + EMPTY_HOWTO (R_MIPS_PJUMP), HOWTO (R_MIPS_RELGOT, /* type */ 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ @@ -1177,14 +1126,14 @@ static reloc_howto_type mips_elf64_howto "R_MIPS_RELGOT", /* name */ false, /* partial_inplace */ 0, /* src_mask */ - 0, /* dst_mask */ + 0xffffffff, /* dst_mask */ false), /* pcrel_offset */ /* Protected jump conversion. This is an optimization hint. No relocation is required for correctness. */ HOWTO (R_MIPS_JALR, /* type */ 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ 0, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ @@ -1192,8 +1141,8 @@ static reloc_howto_type mips_elf64_howto bfd_elf_generic_reloc, /* special_function */ "R_MIPS_JALR", /* name */ false, /* partial_inplace */ - 0x00000000, /* src_mask */ - 0x00000000, /* dst_mask */ + 0, /* src_mask */ + 0, /* dst_mask */ false), /* pcrel_offset */ }; @@ -1205,12 +1154,12 @@ mips_elf64_swap_reloc_in (abfd, src, dst const Elf64_Mips_External_Rel *src; Elf64_Mips_Internal_Rel *dst; { - dst->r_offset = bfd_h_get_64 (abfd, (bfd_byte *) src->r_offset); - dst->r_sym = bfd_h_get_32 (abfd, (bfd_byte *) src->r_sym); - dst->r_ssym = bfd_h_get_8 (abfd, (bfd_byte *) src->r_ssym); - dst->r_type3 = bfd_h_get_8 (abfd, (bfd_byte *) src->r_type3); - dst->r_type2 = bfd_h_get_8 (abfd, (bfd_byte *) src->r_type2); - dst->r_type = bfd_h_get_8 (abfd, (bfd_byte *) src->r_type); + dst->r_offset = H_GET_64 (abfd, src->r_offset); + dst->r_sym = H_GET_32 (abfd, src->r_sym); + dst->r_ssym = H_GET_8 (abfd, src->r_ssym); + dst->r_type3 = H_GET_8 (abfd, src->r_type3); + dst->r_type2 = H_GET_8 (abfd, src->r_type2); + dst->r_type = H_GET_8 (abfd, src->r_type); } /* Swap in a MIPS 64-bit Rela reloc. */ @@ -1221,13 +1170,13 @@ mips_elf64_swap_reloca_in (abfd, src, ds const Elf64_Mips_External_Rela *src; Elf64_Mips_Internal_Rela *dst; { - dst->r_offset = bfd_h_get_64 (abfd, (bfd_byte *) src->r_offset); - dst->r_sym = bfd_h_get_32 (abfd, (bfd_byte *) src->r_sym); - dst->r_ssym = bfd_h_get_8 (abfd, (bfd_byte *) src->r_ssym); - dst->r_type3 = bfd_h_get_8 (abfd, (bfd_byte *) src->r_type3); - dst->r_type2 = bfd_h_get_8 (abfd, (bfd_byte *) src->r_type2); - dst->r_type = bfd_h_get_8 (abfd, (bfd_byte *) src->r_type); - dst->r_addend = bfd_h_get_signed_64 (abfd, (bfd_byte *) src->r_addend); + dst->r_offset = H_GET_64 (abfd, src->r_offset); + dst->r_sym = H_GET_32 (abfd, src->r_sym); + dst->r_ssym = H_GET_8 (abfd, src->r_ssym); + dst->r_type3 = H_GET_8 (abfd, src->r_type3); + dst->r_type2 = H_GET_8 (abfd, src->r_type2); + dst->r_type = H_GET_8 (abfd, src->r_type); + dst->r_addend = H_GET_S64 (abfd, src->r_addend); } /* Swap out a MIPS 64-bit Rel reloc. */ @@ -1238,12 +1187,12 @@ mips_elf64_swap_reloc_out (abfd, src, ds const Elf64_Mips_Internal_Rel *src; Elf64_Mips_External_Rel *dst; { - bfd_h_put_64 (abfd, src->r_offset, (bfd_byte *) dst->r_offset); - bfd_h_put_32 (abfd, src->r_sym, (bfd_byte *) dst->r_sym); - bfd_h_put_8 (abfd, src->r_ssym, (bfd_byte *) dst->r_ssym); - bfd_h_put_8 (abfd, src->r_type3, (bfd_byte *) dst->r_type3); - bfd_h_put_8 (abfd, src->r_type2, (bfd_byte *) dst->r_type2); - bfd_h_put_8 (abfd, src->r_type, (bfd_byte *) dst->r_type); + H_PUT_64 (abfd, src->r_offset, dst->r_offset); + H_PUT_32 (abfd, src->r_sym, dst->r_sym); + H_PUT_8 (abfd, src->r_ssym, dst->r_ssym); + H_PUT_8 (abfd, src->r_type3, dst->r_type3); + H_PUT_8 (abfd, src->r_type2, dst->r_type2); + H_PUT_8 (abfd, src->r_type, dst->r_type); } /* Swap out a MIPS 64-bit Rela reloc. */ @@ -1254,13 +1203,13 @@ mips_elf64_swap_reloca_out (abfd, src, d const Elf64_Mips_Internal_Rela *src; Elf64_Mips_External_Rela *dst; { - bfd_h_put_64 (abfd, src->r_offset, (bfd_byte *) dst->r_offset); - bfd_h_put_32 (abfd, src->r_sym, (bfd_byte *) dst->r_sym); - bfd_h_put_8 (abfd, src->r_ssym, (bfd_byte *) dst->r_ssym); - bfd_h_put_8 (abfd, src->r_type3, (bfd_byte *) dst->r_type3); - bfd_h_put_8 (abfd, src->r_type2, (bfd_byte *) dst->r_type2); - bfd_h_put_8 (abfd, src->r_type, (bfd_byte *) dst->r_type); - bfd_h_put_64 (abfd, src->r_addend, (bfd_byte *) dst->r_addend); + H_PUT_64 (abfd, src->r_offset, dst->r_offset); + H_PUT_32 (abfd, src->r_sym, dst->r_sym); + H_PUT_8 (abfd, src->r_ssym, dst->r_ssym); + H_PUT_8 (abfd, src->r_type3, dst->r_type3); + H_PUT_8 (abfd, src->r_type2, dst->r_type2); + H_PUT_8 (abfd, src->r_type, dst->r_type); + H_PUT_64 (abfd, src->r_addend, dst->r_addend); } /* Swap in a MIPS 64-bit Rel reloc. */ @@ -1361,7 +1310,7 @@ struct elf_reloc_map enum elf_mips_reloc_type elf_reloc_val; }; -static CONST struct elf_reloc_map mips_reloc_map[] = +static const struct elf_reloc_map mips_reloc_map[] = { { BFD_RELOC_NONE, R_MIPS_NONE, }, { BFD_RELOC_16, R_MIPS_16 }, @@ -1442,10 +1391,10 @@ mips_elf64_slurp_one_reloc_table (abfd, allocated = (PTR) bfd_malloc (rel_hdr->sh_size); if (allocated == NULL) - goto error_return; + return false; if (bfd_seek (abfd, rel_hdr->sh_offset, SEEK_SET) != 0 - || (bfd_read (allocated, 1, rel_hdr->sh_size, abfd) != rel_hdr->sh_size)) + || (bfd_bread (allocated, rel_hdr->sh_size, abfd) != rel_hdr->sh_size)) goto error_return; native_relocs = (bfd_byte *) allocated; @@ -1634,6 +1583,7 @@ mips_elf64_slurp_reloc_table (abfd, asec asymbol **symbols; boolean dynamic; { + bfd_size_type amt; struct bfd_elf_section_data * const d = elf_section_data (asect); if (dynamic) @@ -1648,9 +1598,9 @@ mips_elf64_slurp_reloc_table (abfd, asec return true; /* Allocate space for 3 arelent structures for each Rel structure. */ - asect->relocation = ((arelent *) - bfd_alloc (abfd, - asect->reloc_count * 3 * sizeof (arelent))); + amt = asect->reloc_count; + amt *= 3 * sizeof (arelent); + asect->relocation = (arelent *) bfd_alloc (abfd, amt); if (asect->relocation == NULL) return false; @@ -1836,18 +1786,19 @@ mips_elf64_slurp_armap (abfd) char *stringbase; bfd_byte *raw_armap = NULL; carsym *carsyms; + bfd_size_type amt; ardata->symdefs = NULL; /* Get the name of the first element. */ arhdrpos = bfd_tell (abfd); - i = bfd_read ((PTR) nextname, 1, 16, abfd); + i = bfd_bread ((PTR) nextname, (bfd_size_type) 16, abfd); if (i == 0) return true; if (i != 16) return false; - if (bfd_seek (abfd, (file_ptr) - 16, SEEK_CUR) != 0) + if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0) return false; /* Archives with traditional armaps are still permitted. */ @@ -1866,7 +1817,7 @@ mips_elf64_slurp_armap (abfd) parsed_size = mapdata->parsed_size; bfd_release (abfd, (PTR) mapdata); - if (bfd_read (int_buf, 1, 8, abfd) != 8) + if (bfd_bread (int_buf, (bfd_size_type) 8, abfd) != 8) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_malformed_archive); @@ -1879,7 +1830,8 @@ mips_elf64_slurp_armap (abfd) carsym_size = nsymz * sizeof (carsym); ptrsize = 8 * nsymz; - ardata->symdefs = (carsym *) bfd_zalloc (abfd, carsym_size + stringsize + 1); + amt = carsym_size + stringsize + 1; + ardata->symdefs = (carsym *) bfd_zalloc (abfd, amt); if (ardata->symdefs == NULL) return false; carsyms = ardata->symdefs; @@ -1889,8 +1841,8 @@ mips_elf64_slurp_armap (abfd) if (raw_armap == NULL) goto error_return; - if (bfd_read (raw_armap, 1, ptrsize, abfd) != ptrsize - || bfd_read (stringbase, 1, stringsize, abfd) != stringsize) + if (bfd_bread (raw_armap, ptrsize, abfd) != ptrsize + || bfd_bread (stringbase, stringsize, abfd) != stringsize) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_malformed_archive); @@ -1970,12 +1922,12 @@ mips_elf64_write_armap (arch, elength, m /* Write the ar header for this item and the number of symbols */ - if (bfd_write ((PTR) &hdr, 1, sizeof (struct ar_hdr), arch) + if (bfd_bwrite ((PTR) &hdr, (bfd_size_type) sizeof (struct ar_hdr), arch) != sizeof (struct ar_hdr)) return false; - bfd_putb64 (symbol_count, buf); - if (bfd_write (buf, 1, 8, arch) != 8) + bfd_putb64 ((bfd_vma) symbol_count, buf); + if (bfd_bwrite (buf, (bfd_size_type) 8, arch) != 8) return false; /* Two passes, first write the file offsets for each symbol - @@ -1991,10 +1943,10 @@ mips_elf64_write_armap (arch, elength, m /* For each symbol which is used defined in this object, write out the object file's address in the archive */ - while (((bfd *) (map[count]).pos) == current) + while (map[count].u.abfd == current) { - bfd_putb64 (archive_member_file_ptr, buf); - if (bfd_write (buf, 1, 8, arch) != 8) + bfd_putb64 ((bfd_vma) archive_member_file_ptr, buf); + if (bfd_bwrite (buf, (bfd_size_type) 8, arch) != 8) return false; count++; } @@ -2011,7 +1963,7 @@ mips_elf64_write_armap (arch, elength, m { size_t len = strlen (*map[count].name) + 1; - if (bfd_write (*map[count].name, 1, len, arch) != len) + if (bfd_bwrite (*map[count].name, (bfd_size_type) len, arch) != len) return false; } @@ -2019,7 +1971,7 @@ mips_elf64_write_armap (arch, elength, m However, the Irix 6.2 tools do not appear to do this. */ while (padding != 0) { - if (bfd_write ("", 1, 1, arch) != 1) + if (bfd_bwrite ("", (bfd_size_type) 1, arch) != 1) return false; --padding; } @@ -2151,7 +2103,12 @@ const struct elf_size_info mips_elf64_si #define elf_backend_gc_sweep_hook _bfd_mips_elf_gc_sweep_hook #define elf_backend_got_header_size (4*MIPS_RESERVED_GOTNO) #define elf_backend_plt_header_size 0 -#define elf_backend_may_use_rel_p 1 + +/* MIPS ELF64 can use a mixture of REL and RELA, but some Relocations + * work better/work only in RELA, so we default to this. */ +#define elf_backend_may_use_rel_p 1 +#define elf_backend_may_use_rela_p 1 +#define elf_backend_default_use_rela_p 1 /* We don't set bfd_elf64_bfd_is_local_label_name because the 32-bit MIPS-specific function only applies to IRIX5, which had no 64-bit diff -uprN binutils-2.11.90.0.31/bfd/elf64-ppc.c binutils-2.11.92.0.5/bfd/elf64-ppc.c --- binutils-2.11.90.0.31/bfd/elf64-ppc.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/elf64-ppc.c Thu Oct 4 14:35:43 2001 @@ -48,8 +48,16 @@ static boolean ppc64_elf_merge_private_b PARAMS ((bfd *, bfd *)); static boolean ppc64_elf_section_from_shdr PARAMS ((bfd *, Elf64_Internal_Shdr *, char *)); +static struct bfd_hash_entry *link_hash_newfunc + PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); +static struct bfd_link_hash_table *ppc64_elf_link_hash_table_create + PARAMS ((bfd *)); +static boolean create_got_section + PARAMS ((bfd *, struct bfd_link_info *)); static boolean ppc64_elf_create_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *)); +static void ppc64_elf_copy_indirect_symbol + PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *)); static boolean ppc64_elf_check_relocs PARAMS ((bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *)); @@ -61,8 +69,12 @@ static boolean ppc64_elf_gc_sweep_hook const Elf_Internal_Rela *relocs)); static boolean ppc64_elf_adjust_dynamic_symbol PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); -static boolean ppc_adjust_dynindx +static boolean allocate_dynrelocs + PARAMS ((struct elf_link_hash_entry *, PTR)); +static boolean readonly_dynrelocs PARAMS ((struct elf_link_hash_entry *, PTR)); +static enum elf_reloc_type_class ppc64_elf_reloc_type_class + PARAMS ((const Elf_Internal_Rela *)); static boolean ppc64_elf_size_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *)); static boolean ppc64_elf_final_link @@ -1353,15 +1365,19 @@ ppc64_elf_info_to_howto (abfd, cache_ptr arelent *cache_ptr; Elf64_Internal_Rela *dst; { + unsigned int type; + if (!ppc64_elf_howto_table[R_PPC64_ADDR32]) /* Initialize howto table if needed. */ ppc_howto_init (); - BFD_ASSERT (ELF64_R_TYPE (dst->r_info) < (unsigned int) R_PPC_max); - cache_ptr->howto = ppc64_elf_howto_table[ELF64_R_TYPE (dst->r_info)]; + type = ELF64_R_TYPE (dst->r_info); + BFD_ASSERT (type < (sizeof (ppc64_elf_howto_table) + / sizeof (ppc64_elf_howto_table[0]))); + cache_ptr->howto = ppc64_elf_howto_table[type]; } -/* Handle the R_PPC_ADDR16_HA reloc. */ +/* Handle the R_PPC_ADDR16_HA and similar relocs. */ static bfd_reloc_status_type ppc64_elf_addr16_ha_reloc (abfd, reloc_entry, symbol, data, input_section, @@ -1454,7 +1470,7 @@ ppc64_elf_merge_private_bfd_data (ibfd, else msg = _("%s: compiled for a little endian system and target is big endian"); - (*_bfd_error_handler) (msg, bfd_get_filename (ibfd)); + (*_bfd_error_handler) (msg, bfd_archive_filename (ibfd)); bfd_set_error (bfd_error_wrong_format); return false; @@ -1488,7 +1504,7 @@ ppc64_elf_merge_private_bfd_data (ibfd, error = true; (*_bfd_error_handler) (_("%s: compiled with -mrelocatable and linked with modules compiled normally"), - bfd_get_filename (ibfd)); + bfd_archive_filename (ibfd)); } else if ((new_flags & (EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB)) == 0 && (old_flags & EF_PPC_RELOCATABLE) != 0) @@ -1496,7 +1512,7 @@ ppc64_elf_merge_private_bfd_data (ibfd, error = true; (*_bfd_error_handler) (_("%s: compiled normally and linked with modules compiled with -mrelocatable"), - bfd_get_filename (ibfd)); + bfd_archive_filename (ibfd)); } /* The output is -mrelocatable-lib iff both the input files are. */ @@ -1523,7 +1539,7 @@ ppc64_elf_merge_private_bfd_data (ibfd, error = true; (*_bfd_error_handler) (_("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"), - bfd_get_filename (ibfd), (long) new_flags, (long) old_flags); + bfd_archive_filename (ibfd), (long) new_flags, (long) old_flags); } if (error) @@ -1563,51 +1579,235 @@ ppc64_elf_section_from_shdr (abfd, hdr, return true; } -/* The following routines are specific to the ELF linker, while - routines above are used generally. They appear in this file more - or less in the order in which they are called from external - routines. eg. ppc64_elf_check_relocs is called early in the link - process, ppc64_elf_finish_dynamic_sections is one of the last - functions called. */ +/* The following functions are specific to the ELF linker, while + functions above are used generally. Those named ppc64_elf_* are + called by the main ELF linker code. They appear in this file more + or less in the order in which they are called. eg. + ppc64_elf_check_relocs is called early in the link process, + ppc64_elf_finish_dynamic_sections is one of the last functions + called. */ + +/* The linker needs to keep track of the number of relocs that it + decides to copy as dynamic relocs in check_relocs for each symbol. + This is so that it can later discard them if they are found to be + unnecessary. We store the information in a field extending the + regular ELF linker hash table. */ + +struct ppc_dyn_relocs +{ + struct ppc_dyn_relocs *next; + + /* The input section of the reloc. */ + asection *sec; + + /* Total number of relocs copied for the input section. */ + bfd_size_type count; + + /* Number of pc-relative relocs copied for the input section. */ + bfd_size_type pc_count; +}; + +/* Of those relocs that might be copied as dynamic relocs, this macro + selects between relative and absolute types. */ + +#define IS_ABSOLUTE_RELOC(RTYPE) \ + ((RTYPE) != R_PPC64_REL14 \ + && (RTYPE) != R_PPC64_REL14_BRNTAKEN \ + && (RTYPE) != R_PPC64_REL14_BRTAKEN \ + && (RTYPE) != R_PPC64_REL24 \ + && (RTYPE) != R_PPC64_REL32 \ + && (RTYPE) != R_PPC64_REL64) + +/* ppc64 ELF linker hash entry. */ + +struct ppc_link_hash_entry +{ + struct elf_link_hash_entry elf; + + /* Track dynamic relocs copied for this symbol. */ + struct ppc_dyn_relocs *dyn_relocs; +}; + +/* ppc64 ELF linker hash table. */ + +struct ppc_link_hash_table +{ + struct elf_link_hash_table elf; + + /* Short-cuts to get to dynamic linker sections. */ + asection *sgot; + asection *srelgot; + asection *splt; + asection *srelplt; + asection *sdynbss; + asection *srelbss; + asection *sglink; +}; + +/* Get the ppc64 ELF linker hash table from a link_info structure. */ + +#define ppc_hash_table(p) \ + ((struct ppc_link_hash_table *) ((p)->hash)) + +/* Create an entry in a ppc64 ELF linker hash table. */ + +static struct bfd_hash_entry * +link_hash_newfunc (entry, table, string) + struct bfd_hash_entry *entry; + struct bfd_hash_table *table; + const char *string; +{ + /* Allocate the structure if it has not already been allocated by a + subclass. */ + if (entry == NULL) + { + entry = bfd_hash_allocate (table, sizeof (struct ppc_link_hash_entry)); + if (entry == NULL) + return entry; + } + + /* Call the allocation method of the superclass. */ + entry = _bfd_elf_link_hash_newfunc (entry, table, string); + if (entry != NULL) + { + struct ppc_link_hash_entry *eh = (struct ppc_link_hash_entry *) entry; + + eh->dyn_relocs = NULL; + } + + return entry; +} + +/* Create a ppc64 ELF linker hash table. */ + +static struct bfd_link_hash_table * +ppc64_elf_link_hash_table_create (abfd) + bfd *abfd; +{ + struct ppc_link_hash_table *htab; + bfd_size_type amt = sizeof (struct ppc_link_hash_table); + + htab = (struct ppc_link_hash_table *) bfd_alloc (abfd, amt); + if (htab == NULL) + return NULL; + + if (! _bfd_elf_link_hash_table_init (&htab->elf, abfd, link_hash_newfunc)) + { + bfd_release (abfd, htab); + return NULL; + } + + htab->sgot = NULL; + htab->srelgot = NULL; + htab->splt = NULL; + htab->srelplt = NULL; + htab->sdynbss = NULL; + htab->srelbss = NULL; + htab->sglink = NULL; + + return &htab->elf.root; +} + +/* Create .got and .rela.got sections in DYNOBJ, and set up + shortcuts to them in our hash table. */ + +static boolean +create_got_section (dynobj, info) + bfd *dynobj; + struct bfd_link_info *info; +{ + struct ppc_link_hash_table *htab; + + if (! _bfd_elf_create_got_section (dynobj, info)) + return false; + + htab = ppc_hash_table (info); + htab->sgot = bfd_get_section_by_name (dynobj, ".got"); + if (!htab->sgot) + abort (); + + htab->srelgot = bfd_make_section (dynobj, ".rela.got"); + if (!htab->srelgot + || ! bfd_set_section_flags (dynobj, htab->srelgot, + (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS + | SEC_IN_MEMORY | SEC_LINKER_CREATED + | SEC_READONLY)) + || ! bfd_set_section_alignment (dynobj, htab->srelgot, 3)) + return false; + return true; +} /* Create the .glink section as well as the ordinary dynamic sections. */ static boolean -ppc64_elf_create_dynamic_sections (abfd, info) - bfd *abfd; +ppc64_elf_create_dynamic_sections (dynobj, info) + bfd *dynobj; struct bfd_link_info *info; { - asection *s; + struct ppc_link_hash_table *htab; flagword flags; - if (!_bfd_elf_create_dynamic_sections (abfd, info)) + htab = ppc_hash_table (info); + if (!htab->sgot && !create_got_section (dynobj, info)) return false; - /* Our .plt just contains pointers, no code. */ - s = bfd_get_section_by_name (abfd, ".plt"); - if (s == NULL) + if (!_bfd_elf_create_dynamic_sections (dynobj, info)) return false; - flags = bfd_get_section_flags (abfd, s); + + htab->splt = bfd_get_section_by_name (dynobj, ".plt"); + htab->srelplt = bfd_get_section_by_name (dynobj, ".rela.plt"); + htab->sdynbss = bfd_get_section_by_name (dynobj, ".dynbss"); + if (!info->shared) + htab->srelbss = bfd_get_section_by_name (dynobj, ".rela.bss"); + + if (!htab->splt || !htab->srelplt || !htab->sdynbss + || (!info->shared && !htab->srelbss)) + abort (); + + /* Our .plt just contains pointers, no code. */ + flags = bfd_get_section_flags (dynobj, htab->splt); flags &= ~SEC_CODE; - if (! bfd_set_section_flags (abfd, s, flags)) + if (! bfd_set_section_flags (dynobj, htab->splt, flags)) return false; /* Create .glink for global linkage functions. */ flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED); - s = bfd_make_section (abfd, ".glink"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags) - || ! bfd_set_section_alignment (abfd, s, 3)) + htab->sglink = bfd_make_section (dynobj, ".glink"); + if (htab->sglink == NULL + || ! bfd_set_section_flags (dynobj, htab->sglink, flags) + || ! bfd_set_section_alignment (dynobj, htab->sglink, 3)) return false; return true; } +/* Copy the extra info we tack onto an elf_link_hash_entry. */ + +static void +ppc64_elf_copy_indirect_symbol (dir, ind) + struct elf_link_hash_entry *dir, *ind; +{ + struct ppc_link_hash_entry *edir, *eind; + + edir = (struct ppc_link_hash_entry *) dir; + eind = (struct ppc_link_hash_entry *) ind; + + if (edir->dyn_relocs == NULL) + { + edir->dyn_relocs = eind->dyn_relocs; + eind->dyn_relocs = NULL; + } + else if (eind->dyn_relocs != NULL) + abort (); + + _bfd_elf_link_hash_copy_indirect (dir, ind); +} + /* Look through the relocs for a section during the first phase, and - allocate space in the global offset table or procedure linkage - table. */ + calculate needed space in the global offset table, procedure + linkage table, and dynamic reloc sections. */ static boolean ppc64_elf_check_relocs (abfd, info, sec, relocs) @@ -1616,28 +1816,18 @@ ppc64_elf_check_relocs (abfd, info, sec, asection *sec; const Elf_Internal_Rela *relocs; { - bfd *dynobj; + struct ppc_link_hash_table *htab; Elf_Internal_Shdr *symtab_hdr; struct elf_link_hash_entry **sym_hashes, **sym_hashes_end; const Elf_Internal_Rela *rel; const Elf_Internal_Rela *rel_end; - bfd_signed_vma *local_got_refcounts; asection *sreloc; - asection *sgot = NULL; - asection *srelgot = NULL; if (info->relocateable) return true; -#ifdef DEBUG - fprintf (stderr, "ppc64_elf_check_relocs called for section %s in %s\n", - bfd_get_section_name (abfd, sec), - bfd_get_filename (abfd)); -#endif - - dynobj = elf_hash_table (info)->dynobj; + htab = ppc_hash_table (info); symtab_hdr = &elf_tdata (abfd)->symtab_hdr; - local_got_refcounts = elf_local_got_refcounts (abfd); sym_hashes = elf_sym_hashes (abfd); sym_hashes_end = (sym_hashes @@ -1652,6 +1842,7 @@ ppc64_elf_check_relocs (abfd, info, sec, { unsigned long r_symndx; struct elf_link_hash_entry *h; + enum elf_ppc_reloc_type r_type; r_symndx = ELF64_R_SYM (rel->r_info); if (r_symndx < symtab_hdr->sh_info) @@ -1659,114 +1850,62 @@ ppc64_elf_check_relocs (abfd, info, sec, else h = sym_hashes[r_symndx - symtab_hdr->sh_info]; - switch (ELF64_R_TYPE (rel->r_info)) + r_type = (enum elf_ppc_reloc_type) ELF64_R_TYPE (rel->r_info); + switch (r_type) { /* GOT16 relocations */ case R_PPC64_GOT16: - case R_PPC64_GOT16_LO: - case R_PPC64_GOT16_HI: - case R_PPC64_GOT16_HA: case R_PPC64_GOT16_DS: + case R_PPC64_GOT16_HA: + case R_PPC64_GOT16_HI: + case R_PPC64_GOT16_LO: case R_PPC64_GOT16_LO_DS: - /* This symbol requires a global offset table entry. */ - if (sgot == NULL) + /* This symbol requires a global offset table entry. */ + if (htab->sgot == NULL) { - if (dynobj == NULL) - elf_hash_table (info)->dynobj = dynobj = abfd; - if (! _bfd_elf_create_got_section (dynobj, info)) + if (htab->elf.dynobj == NULL) + htab->elf.dynobj = abfd; + if (!create_got_section (htab->elf.dynobj, info)) return false; - sgot = bfd_get_section_by_name (dynobj, ".got"); - BFD_ASSERT (sgot != NULL); - } - - if (srelgot == NULL - && (h != NULL || info->shared)) - { - srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); - if (srelgot == NULL) - { - srelgot = bfd_make_section (dynobj, ".rela.got"); - if (srelgot == NULL - || ! bfd_set_section_flags (dynobj, srelgot, - (SEC_ALLOC - | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY - | SEC_LINKER_CREATED - | SEC_READONLY)) - || ! bfd_set_section_alignment (dynobj, srelgot, 2)) - return false; - } } if (h != NULL) { - if (h->got.refcount == -1) - { - /* Make sure this symbol is output as a dynamic symbol. */ - if (h->dynindx == -1) - if (!bfd_elf64_link_record_dynamic_symbol (info, h)) - return false; - - /* Allocate space in the .got. */ - sgot->_raw_size += 8; - /* Allocate relocation space. */ - srelgot->_raw_size += sizeof (Elf64_External_Rela); - - h->got.refcount = 1; - } - else - h->got.refcount++; + h->got.refcount += 1; } else { + bfd_signed_vma *local_got_refcounts; + /* This is a global offset table entry for a local symbol. */ + local_got_refcounts = elf_local_got_refcounts (abfd); if (local_got_refcounts == NULL) { - size_t size; + bfd_size_type size; - size = symtab_hdr->sh_info * sizeof (bfd_signed_vma); - local_got_refcounts = (bfd_signed_vma *) - bfd_alloc (abfd, size); + size = symtab_hdr->sh_info; + size *= sizeof (bfd_signed_vma); + local_got_refcounts = ((bfd_signed_vma *) + bfd_zalloc (abfd, size)); if (local_got_refcounts == NULL) return false; elf_local_got_refcounts (abfd) = local_got_refcounts; - memset (local_got_refcounts, -1, size); - } - if (local_got_refcounts[r_symndx] == -1) - { - sgot->_raw_size += 8; - - /* If we are generating a shared object, we need to - output a R_PPC64_RELATIVE reloc so that the - dynamic linker can adjust this GOT entry. */ - if (info->shared) - srelgot->_raw_size += sizeof (Elf64_External_Rela); - - local_got_refcounts[r_symndx] = 1; } - else - local_got_refcounts[r_symndx]++; + local_got_refcounts[r_symndx] += 1; } break; - case R_PPC64_PLT64: - case R_PPC64_PLT32: - case R_PPC64_PLT16_LO: - case R_PPC64_PLT16_HI: case R_PPC64_PLT16_HA: - case R_PPC64_PLTGOT16_DS: - case R_PPC64_PLTGOT16_LO_DS: -#ifdef DEBUG - fprintf (stderr, "Reloc requires a PLT entry\n"); -#endif + case R_PPC64_PLT16_HI: + case R_PPC64_PLT16_LO: + case R_PPC64_PLT32: + case R_PPC64_PLT64: /* This symbol requires a procedure linkage table entry. We actually build the entry in adjust_dynamic_symbol, because this might be a case of linking PIC code without linking in any dynamic objects, in which case we don't need to generate a procedure linkage table after all. */ - if (h == NULL) { /* It does not make sense to have a procedure linkage @@ -1775,19 +1914,8 @@ ppc64_elf_check_relocs (abfd, info, sec, return false; } - /* Make sure this symbol is output as a dynamic symbol. */ - if (h->dynindx == -1) - { - if (! bfd_elf64_link_record_dynamic_symbol (info, h)) - return false; - } - if (h->plt.refcount == -1) - { - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; - h->plt.refcount = 1; - } - else - h->plt.refcount++; + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + h->plt.refcount += 1; break; /* The following relocations don't need to propagate the @@ -1821,34 +1949,76 @@ ppc64_elf_check_relocs (abfd, info, sec, return false; break; - /* When creating a shared object, we must copy these - relocs into the output file. We create a reloc - section in dynobj and make room for the reloc. */ case R_PPC64_REL64: case R_PPC64_REL32: case R_PPC64_REL24: case R_PPC64_REL14: case R_PPC64_REL14_BRTAKEN: case R_PPC64_REL14_BRNTAKEN: - if (h == NULL) - break; - /* fall through */ - + case R_PPC64_ADDR14: + case R_PPC64_ADDR14_BRNTAKEN: + case R_PPC64_ADDR14_BRTAKEN: + case R_PPC64_ADDR16: + case R_PPC64_ADDR16_DS: + case R_PPC64_ADDR16_HA: + case R_PPC64_ADDR16_HI: + case R_PPC64_ADDR16_HIGHER: + case R_PPC64_ADDR16_HIGHERA: + case R_PPC64_ADDR16_HIGHEST: + case R_PPC64_ADDR16_HIGHESTA: + case R_PPC64_ADDR16_LO: + case R_PPC64_ADDR16_LO_DS: + case R_PPC64_ADDR24: + case R_PPC64_ADDR30: + case R_PPC64_ADDR32: + case R_PPC64_ADDR64: + case R_PPC64_UADDR16: + case R_PPC64_UADDR32: + case R_PPC64_UADDR64: case R_PPC64_TOC: - /* fall through */ - - default: - if (info->shared) - { -#ifdef DEBUG - fprintf (stderr, "ppc64_elf_check_relocs need to create relocation for %s\n", - (h && h->root.root.string - ? h->root.root.string - : "")); -#endif + /* If we are creating a shared library, and this is a reloc + against a global symbol, or a non PC relative reloc + against a local symbol, then we need to copy the reloc + into the shared library. However, if we are linking with + -Bsymbolic, we do not need to copy a reloc against a + global symbol which is defined in an object we are + including in the link (i.e., DEF_REGULAR is set). At + this point we have not seen all the input files, so it is + possible that DEF_REGULAR is not set now but will be set + later (it is never cleared). In case of a weak definition, + DEF_REGULAR may be cleared later by a strong definition in + a shared library. We account for that possibility below by + storing information in the relocs_copied field of the hash + table entry. A similar situation occurs when creating + shared libraries and symbol visibility changes render the + symbol local. + + If on the other hand, we are creating an executable, we + may need to keep relocations for symbols satisfied by a + dynamic library if we manage to avoid copy relocs for the + symbol. */ + if ((info->shared + && (sec->flags & SEC_ALLOC) != 0 + && (IS_ABSOLUTE_RELOC (r_type) + || (h != NULL + && (! info->symbolic + || h->root.type == bfd_link_hash_defweak + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)))) + || (!info->shared + && (sec->flags & SEC_ALLOC) != 0 + && h != NULL + && (h->root.type == bfd_link_hash_defweak + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0))) + { + /* We must copy these reloc types into the output file. + Create a reloc section in dynobj and make room for + this reloc. */ if (sreloc == NULL) { const char *name; + bfd *dynobj; name = (bfd_elf_string_from_elf_section (abfd, @@ -1857,10 +2027,19 @@ ppc64_elf_check_relocs (abfd, info, sec, if (name == NULL) return false; - BFD_ASSERT (strncmp (name, ".rela", 5) == 0 - && strcmp (bfd_get_section_name (abfd, sec), - name + 5) == 0); + if (strncmp (name, ".rela", 5) != 0 + || strcmp (bfd_get_section_name (abfd, sec), + name + 5) != 0) + { + (*_bfd_error_handler) + (_("%s: bad relocation section name `%s\'"), + bfd_archive_filename (abfd), name); + } + + if (htab->elf.dynobj == NULL) + htab->elf.dynobj = abfd; + dynobj = htab->elf.dynobj; sreloc = bfd_get_section_by_name (dynobj, name); if (sreloc == NULL) { @@ -1873,22 +2052,49 @@ ppc64_elf_check_relocs (abfd, info, sec, flags |= SEC_ALLOC | SEC_LOAD; if (sreloc == NULL || ! bfd_set_section_flags (dynobj, sreloc, flags) - || ! bfd_set_section_alignment (dynobj, sreloc, 2)) + || ! bfd_set_section_alignment (dynobj, sreloc, 3)) return false; } + elf_section_data (sec)->sreloc = sreloc; } - sreloc->_raw_size += sizeof (Elf64_External_Rela); + /* If this is a global symbol, we count the number of + relocations we need for this symbol. */ + if (h != NULL) + { + struct ppc_link_hash_entry *eh; + struct ppc_dyn_relocs *p; + + eh = (struct ppc_link_hash_entry *) h; + p = eh->dyn_relocs; - /* FIXME: We should here do what the m68k and i386 - backends do: if the reloc is pc-relative, record it - in case it turns out that the reloc is unnecessary - because the symbol is forced local by versioning or - we are linking with -Bdynamic. Fortunately this - case is not frequent. */ - } + if (p == NULL || p->sec != sec) + { + p = ((struct ppc_dyn_relocs *) + bfd_alloc (htab->elf.dynobj, + (bfd_size_type) sizeof *p)); + if (p == NULL) + return false; + p->next = eh->dyn_relocs; + eh->dyn_relocs = p; + p->sec = sec; + p->count = 0; + p->pc_count = 0; + } + p->count += 1; + if (!IS_ABSOLUTE_RELOC (r_type)) + p->pc_count += 1; + } + else + { + /* Track dynamic relocs needed for local syms too. */ + elf_section_data (sec)->local_dynrel += 1; + } + } break; + + default: } } @@ -1908,7 +2114,10 @@ ppc64_elf_gc_mark_hook (abfd, info, rel, { if (h != NULL) { - switch (ELF64_R_TYPE (rel->r_info)) + enum elf_ppc_reloc_type r_type; + + r_type = (enum elf_ppc_reloc_type) ELF64_R_TYPE (rel->r_info); + switch (r_type) { case R_PPC64_GNU_VTINHERIT: case R_PPC64_GNU_VTENTRY: @@ -1943,7 +2152,8 @@ ppc64_elf_gc_mark_hook (abfd, info, rel, return NULL; } -/* Update the got entry reference counts for the section being removed. */ +/* Update the .got, .plt. and dynamic reloc reference counts for the + section being removed. */ static boolean ppc64_elf_gc_sweep_hook (abfd, info, sec, relocs) @@ -1956,8 +2166,6 @@ ppc64_elf_gc_sweep_hook (abfd, info, sec struct elf_link_hash_entry **sym_hashes; bfd_signed_vma *local_got_refcounts; const Elf_Internal_Rela *rel, *relend; - unsigned long r_symndx; - struct elf_link_hash_entry *h; symtab_hdr = &elf_tdata (abfd)->symtab_hdr; sym_hashes = elf_sym_hashes (abfd); @@ -1965,43 +2173,119 @@ ppc64_elf_gc_sweep_hook (abfd, info, sec relend = relocs + sec->reloc_count; for (rel = relocs; rel < relend; rel++) - switch (ELF64_R_TYPE (rel->r_info)) - { - case R_PPC64_GOT16: - case R_PPC64_GOT16_LO: - case R_PPC64_GOT16_HI: - case R_PPC64_GOT16_HA: - r_symndx = ELF64_R_SYM (rel->r_info); - if (r_symndx >= symtab_hdr->sh_info) - { - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; - if (h->got.refcount > 0) - h->got.refcount--; - } - else - { - if (local_got_refcounts[r_symndx] > 0) - local_got_refcounts[r_symndx]--; - } - break; + { + unsigned long r_symndx; + enum elf_ppc_reloc_type r_type; + struct elf_link_hash_entry *h; - case R_PPC64_PLT32: - case R_PPC64_PLT16_LO: - case R_PPC64_PLT16_HI: - case R_PPC64_PLT16_HA: - r_symndx = ELF64_R_SYM (rel->r_info); - if (r_symndx >= symtab_hdr->sh_info) - { - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; - if (h->plt.refcount > 0) - h->plt.refcount--; - } - break; + r_symndx = ELF64_R_SYM (rel->r_info); + r_type = (enum elf_ppc_reloc_type) ELF64_R_TYPE (rel->r_info); + switch (r_type) + { + case R_PPC64_GOT16: + case R_PPC64_GOT16_DS: + case R_PPC64_GOT16_HA: + case R_PPC64_GOT16_HI: + case R_PPC64_GOT16_LO: + case R_PPC64_GOT16_LO_DS: + if (r_symndx >= symtab_hdr->sh_info) + { + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + if (h->got.refcount > 0) + h->got.refcount--; + } + else + { + if (local_got_refcounts[r_symndx] > 0) + local_got_refcounts[r_symndx]--; + } + break; - default: - break; - } + case R_PPC64_PLT16_HA: + case R_PPC64_PLT16_HI: + case R_PPC64_PLT16_LO: + case R_PPC64_PLT32: + case R_PPC64_PLT64: + if (r_symndx >= symtab_hdr->sh_info) + { + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + if (h->plt.refcount > 0) + h->plt.refcount--; + } + break; + + case R_PPC64_REL14: + case R_PPC64_REL14_BRNTAKEN: + case R_PPC64_REL14_BRTAKEN: + case R_PPC64_REL24: + case R_PPC64_REL32: + case R_PPC64_REL64: + if (r_symndx >= symtab_hdr->sh_info) + { + struct ppc_link_hash_entry *eh; + struct ppc_dyn_relocs **pp; + struct ppc_dyn_relocs *p; + + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + eh = (struct ppc_link_hash_entry *) h; + + for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next) + if (p->sec == sec) + { + p->pc_count -= 1; + p->count -= 1; + if (p->count == 0) + *pp = p->next; + break; + } + } + break; + + case R_PPC64_ADDR14: + case R_PPC64_ADDR14_BRNTAKEN: + case R_PPC64_ADDR14_BRTAKEN: + case R_PPC64_ADDR16: + case R_PPC64_ADDR16_DS: + case R_PPC64_ADDR16_HA: + case R_PPC64_ADDR16_HI: + case R_PPC64_ADDR16_HIGHER: + case R_PPC64_ADDR16_HIGHERA: + case R_PPC64_ADDR16_HIGHEST: + case R_PPC64_ADDR16_HIGHESTA: + case R_PPC64_ADDR16_LO: + case R_PPC64_ADDR16_LO_DS: + case R_PPC64_ADDR24: + case R_PPC64_ADDR30: + case R_PPC64_ADDR32: + case R_PPC64_ADDR64: + case R_PPC64_UADDR16: + case R_PPC64_UADDR32: + case R_PPC64_UADDR64: + case R_PPC64_TOC: + if (r_symndx >= symtab_hdr->sh_info) + { + struct ppc_link_hash_entry *eh; + struct ppc_dyn_relocs **pp; + struct ppc_dyn_relocs *p; + + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + eh = (struct ppc_link_hash_entry *) h; + + for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next) + if (p->sec == sec) + { + p->count -= 1; + if (p->count == 0) + *pp = p->next; + break; + } + } + break; + default: + break; + } + } return true; } @@ -2016,199 +2300,70 @@ ppc64_elf_adjust_dynamic_symbol (info, h struct bfd_link_info *info; struct elf_link_hash_entry *h; { - bfd *dynobj = elf_hash_table (info)->dynobj; + struct ppc_link_hash_table *htab; + struct ppc_link_hash_entry * eh; + struct ppc_dyn_relocs *p; asection *s; unsigned int power_of_two; - bfd_vma plt_offset; -#ifdef DEBUG - fprintf (stderr, "ppc64_elf_adjust_dynamic_symbol called for %s\n", - h->root.root.string); -#endif + htab = ppc_hash_table (info); - /* Make sure we know what is going on here. */ - BFD_ASSERT (dynobj != NULL - && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) - || h->weakdef != NULL - || ((h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_REF_REGULAR) != 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0))); - - /* If this is a function, alter the symbol to refer to global - linkage code, which will be generated by ppc64_elf_relocate_section. - Also, allocate a slot in the PLT. */ + /* If this is a function, put it in the procedure linkage table. We + will fill in the contents of the procedure linkage table later. */ if (h->type == STT_FUNC || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) { - asection *splt, *sglink; - - if (! elf_hash_table (info)->dynamic_sections_created - || ((!info->shared || info->symbolic || h->dynindx == -1) - && (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) != 0)) - { - /* A PLT entry is not required/allowed when: - - 1. We are not using ld.so; because then the PLT entry - can't be set up, so we can't use one. - - 2. We know for certain that a symbol is defined in - this object, because this object is the application, - is linked with -Bsymbolic, or because the symbol is local. - - We used to end up here for GC if - (info->shared && h->plt.refcount <= 0) - We can't use plt.refcount here since - ppc64_elf_check_relocs can't detect all needs for - PLT. FIXME: Rewrite GC. */ + struct elf_link_hash_entry *fdh; + /* If it's a function entry point, the name starts with a dot + unless someone has written some poor assembly code. The ABI + for .plt calls requires that there be a function descriptor + sym which has the name of the function minus the dot. */ + + if (h->plt.refcount <= 0 + || h->root.root.string[0] != '.' + || h->root.root.string[1] == '\0' + || (! info->shared + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 + && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0)) + { + /* This case can occur if we saw a PLT reloc in an input + file, but the symbol was never referred to by a dynamic + object, or if all references were garbage collected. In + such a case, we don't actually need to build a procedure + linkage table entry. */ h->plt.offset = (bfd_vma) -1; h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; return true; } - splt = bfd_get_section_by_name (dynobj, ".plt"); - sglink = bfd_get_section_by_name (dynobj, ".glink"); - BFD_ASSERT (splt != NULL && sglink != NULL); - - /* If it's a function entry point (the name starts with a dot) - (FIXME: Could it ever be anything else?), find its - corresponding function descriptor symbol and make sure it's - output as a dynamic symbol. Create it as undefined if - necessary. ppc64_elf_finish_dynamic_symbol will look it up - again and create a JMP_SLOT reloc for it. FIXME: The second - lookup could be avoided by adding a new flag to - elf_link_hash_entry->elf_link_hash_flags. */ - - if (h->root.root.string[0] == '.') - { - struct elf_link_hash_entry *fdh; - - /* FIXME: Follow bfd_link_hash_indirect? */ - fdh = elf_link_hash_lookup (elf_hash_table (info), - h->root.root.string + 1, - false, false, false); - - if (fdh == (struct elf_link_hash_entry *) NULL) - { - asymbol *newsym; - - /* Create it as undefined. */ - newsym = bfd_make_empty_symbol (dynobj); - BFD_ASSERT (newsym != NULL); - /* FIXME: Need own copy of name? */ - newsym->name = h->root.root.string + 1; - newsym->section = bfd_und_section_ptr; - newsym->value = 0; - newsym->flags = BSF_DYNAMIC | BSF_OBJECT; - - if ( ! (_bfd_generic_link_add_one_symbol - (info, dynobj, newsym->name, newsym->flags, - newsym->section, newsym->value, - NULL, /* string */ - true, /* copy */ - false, /*collect*/ - (struct bfd_link_hash_entry **) &fdh))) - { - /* FIXME: Print error message. */ - return false; - } - fdh->root.type = bfd_link_hash_undefined; -#ifdef DEBUG - fprintf (stderr, "\tcreated %s", newsym->name); -#endif - } -#ifdef DEBUG - else - fprintf (stderr, "\tfound %s", fdh->root.root.string); - fprintf (stderr, "\n"); -#endif - - BFD_ASSERT (fdh != NULL); - - /* Make sure it's output as a dynamic symbol. */ - if (fdh->dynindx == -1) + /* Find the corresponding function descriptor symbol. Create it + as undefined if necessary. ppc_elf64_finish_dynamic_symbol + will look it up again and create a JMP_SLOT reloc for it. */ + + fdh = elf_link_hash_lookup (elf_hash_table (info), + h->root.root.string + 1, + false, false, false); + + if (fdh == NULL) + { + asymbol *newsym; + + /* Create it as undefined. */ + newsym = bfd_make_empty_symbol (htab->elf.dynobj); + newsym->name = h->root.root.string + 1; + newsym->section = bfd_und_section_ptr; + newsym->value = 0; + newsym->flags = BSF_DYNAMIC | BSF_OBJECT; + + if ( !(_bfd_generic_link_add_one_symbol + (info, htab->elf.dynobj, newsym->name, newsym->flags, + newsym->section, newsym->value, NULL, false, false, + (struct bfd_link_hash_entry **) &fdh))) { - if (! bfd_elf64_link_record_dynamic_symbol (info, fdh)) - return false; + return false; } - BFD_ASSERT (fdh->dynindx != -1); - } - - /* If this is the first .plt entry, make room for the special - first entry. */ - if (splt->_raw_size == 0) - splt->_raw_size = PLT_INITIAL_ENTRY_SIZE; - - plt_offset = splt->_raw_size; - - /* FIXME: What about function pointer comparisons in 64-bit PPC? - We can't use the same trick as 32-bit PPC, since we set the - symbol to the linkage function. This will make function entry - point comparison work as expected within one object, but not - across object boundaries. From the ABI: - - In this ABI, the address of a function is actually the address of a - function descriptor. A reference to a function, other than a function - call, will normally load the address of the function descriptor from - the global offset table. The dynamic linker will ensure that for a - given function, the same address is used for all references to the - function from any global offset table. Thus, function address - comparisons will work as expected. - - When making a call to the function, the code may refer to the - procedure linkage table entry, in order to permit lazy symbol - resolution at run time. In order to support correct function address - comparisons, the compiler should be careful to only generate - references to the procedure linkage table entry for function calls. - For any other use of a function, the compiler should use the real - address. - - I don't see how this could ever work when passing a pointer to - a function across an object boundary. The compiler has no - way of knowing how to find the function descriptor for a - function whose entrypoint is taken as an argument. - - Or should the compiler arrange so that the function descriptor - address is passed and make the callee dig out the entry point - from that? */ -#if 0 - /* If this symbol is not defined in a regular file, and we are - not generating a shared library, then set the symbol to this - location in the .plt. This is required to make function - pointers compare as equal between the normal executable and - the shared library. */ - if (! info->shared - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - { - h->root.u.def.section = splt; - h->root.u.def.value = plt_offset; } -#endif - - /* FIXME: How should a linkage symbol be defined? It shouldn't - be global, since it can't be used by any other object than - this one. Set ELF_LINK_FORCED_LOCAL? */ - h->root.type = bfd_link_hash_defined; - h->root.u.def.section = sglink; - h->root.u.def.value = sglink->_raw_size; - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; - h->plt.offset = plt_offset; - - /* Make room for global linkage code in .glink. */ - sglink->_raw_size += PPC64_ELF_GLINK_SIZE; - - /* Make room for this entry in PLT. */ - splt->_raw_size += PLT_ENTRY_SIZE; - - /* We also need to make an entry in the .rela.plt section. */ - s = bfd_get_section_by_name (dynobj, ".rela.plt"); - BFD_ASSERT (s != NULL); - s->_raw_size += sizeof (Elf64_External_Rela); - return true; } @@ -2234,6 +2389,27 @@ ppc64_elf_adjust_dynamic_symbol (info, h if (info->shared) return true; + /* If there are no references to this symbol that do not use the + GOT, we don't need to generate a copy reloc. */ + if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0) + return true; + + eh = (struct ppc_link_hash_entry *) h; + for (p = eh->dyn_relocs; p != NULL; p = p->next) + { + s = p->sec->output_section; + if (s != NULL && (s->flags & SEC_READONLY) != 0) + break; + } + + /* If we didn't find any dynamic relocs in read-only sections, then + we'll be keeping the dynamic relocs and avoiding the copy reloc. */ + if (p == NULL) + { + h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF; + return true; + } + /* We must allocate the symbol in our .dynbss section, which will become part of the .bss section of the executable. There will be an entry for this symbol in the .dynsym section. The dynamic @@ -2243,8 +2419,6 @@ ppc64_elf_adjust_dynamic_symbol (info, h determine the address it must put in the global offset table, so both the dynamic object and the regular object will refer to the same memory location for the variable. */ - s = bfd_get_section_by_name (dynobj, ".dynbss"); - BFD_ASSERT (s != NULL); /* We must generate a R_PPC_COPY reloc to tell the dynamic linker to copy the initial value out of the dynamic object and into the @@ -2252,11 +2426,7 @@ ppc64_elf_adjust_dynamic_symbol (info, h .rela.bss section we are going to use. */ if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) { - asection *srel; - - srel = bfd_get_section_by_name (dynobj, ".rela.bss"); - BFD_ASSERT (srel != NULL); - srel->_raw_size += sizeof (Elf64_External_Rela); + htab->srelbss->_raw_size += sizeof (Elf64_External_Rela); h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY; } @@ -2267,11 +2437,11 @@ ppc64_elf_adjust_dynamic_symbol (info, h power_of_two = 4; /* Apply the required alignment. */ - s->_raw_size = BFD_ALIGN (s->_raw_size, - (bfd_size_type) (1 << power_of_two)); - if (power_of_two > bfd_get_section_alignment (dynobj, s)) + s = htab->sdynbss; + s->_raw_size = BFD_ALIGN (s->_raw_size, (bfd_size_type) (1 << power_of_two)); + if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s)) { - if (! bfd_set_section_alignment (dynobj, s, power_of_two)) + if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two)) return false; } @@ -2285,107 +2455,337 @@ ppc64_elf_adjust_dynamic_symbol (info, h return true; } -/* Increment the index of a dynamic symbol by a given amount. Called - via elf_link_hash_traverse. */ +/* This is the condition under which ppc64_elf_finish_dynamic_symbol + will be called from elflink.h. If elflink.h doesn't call our + finish_dynamic_symbol routine, we'll need to do something about + initializing any .plt and .got entries in ppc64_elf_relocate_section. */ +#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, INFO, H) \ + ((DYN) \ + && ((INFO)->shared \ + || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) \ + && ((H)->dynindx != -1 \ + || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)) + +/* Allocate space in .plt, .got and associated reloc sections for + dynamic relocs. */ static boolean -ppc_adjust_dynindx (h, cparg) +allocate_dynrelocs (h, inf) struct elf_link_hash_entry *h; - PTR cparg; + PTR inf; { - int *cp = (int *) cparg; + struct bfd_link_info *info; + struct ppc_link_hash_table *htab; + asection *s; + struct ppc_link_hash_entry *eh; + struct ppc_dyn_relocs *p; -#ifdef DEBUG - fprintf (stderr, - "ppc_adjust_dynindx: h->dynindx = %ld, *cp = %d (%s)\n", - h->dynindx, *cp, - h->root.root.string ? h->root.root.string : ""); -#endif + if (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + return true; - if (h->dynindx != -1) - h->dynindx += *cp; + info = (struct bfd_link_info *) inf; + htab = ppc_hash_table (info); - return true; -} + if (htab->elf.dynamic_sections_created + && h->plt.refcount > 0) + { + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 + && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + { + if (! bfd_elf64_link_record_dynamic_symbol (info, h)) + return false; + } -/* Set the sizes of the dynamic sections. */ + BFD_ASSERT (h->root.root.string[0] == '.' + && h->root.root.string[1] != '\0'); -static boolean + if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h)) + { + /* Make sure the corresponding function descriptor symbol is + dynamic too. */ + + if (h->dynindx != -1) + { + struct elf_link_hash_entry *fdh; + + fdh = elf_link_hash_lookup (elf_hash_table (info), + h->root.root.string + 1, + false, false, false); + + if (fdh == NULL) + abort (); + + if (fdh->dynindx == -1 + && (fdh->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + { + if (! bfd_elf64_link_record_dynamic_symbol (info, fdh)) + return false; + } + } + + /* If this is the first .plt entry, make room for the special + first entry. */ + s = htab->splt; + if (s->_raw_size == 0) + s->_raw_size += PLT_INITIAL_ENTRY_SIZE; + + h->plt.offset = s->_raw_size; + + /* Make room for this entry. */ + s->_raw_size += PLT_ENTRY_SIZE; + + /* Point the function at the linkage stub. This works because + the only references to the function code sym are calls. + Function pointer comparisons use the function descriptor. */ + s = htab->sglink; + h->root.type = bfd_link_hash_defined; + h->root.u.def.section = s; + h->root.u.def.value = s->_raw_size; + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + + /* Make room for global linkage code in .glink. */ + s->_raw_size += PPC64_ELF_GLINK_SIZE; + + /* We also need to make an entry in the .rela.plt section. */ + s = htab->srelplt; + s->_raw_size += sizeof (Elf64_External_Rela); + } + else + { + h->plt.offset = (bfd_vma) -1; + h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + } + } + else + { + h->plt.offset = (bfd_vma) -1; + h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + } + + if (h->got.refcount > 0) + { + boolean dyn; + + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 + && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + { + if (! bfd_elf64_link_record_dynamic_symbol (info, h)) + return false; + } + + s = htab->sgot; + h->got.offset = s->_raw_size; + s->_raw_size += 8; + dyn = htab->elf.dynamic_sections_created; + if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h)) + htab->srelgot->_raw_size += sizeof (Elf64_External_Rela); + } + else + h->got.offset = (bfd_vma) -1; + + eh = (struct ppc_link_hash_entry *) h; + if (eh->dyn_relocs == NULL) + return true; + + /* In the shared -Bsymbolic case, discard space allocated for + dynamic pc-relative relocs against symbols which turn out to be + defined in regular objects. For the normal shared case, discard + space for relocs that have become local due to symbol visibility + changes. */ + + if (info->shared) + { + if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0 + && ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0 + || info->symbolic)) + { + struct ppc_dyn_relocs **pp; + + for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + { + p->count -= p->pc_count; + p->pc_count = 0; + if (p->count == 0) + *pp = p->next; + else + pp = &p->next; + } + } + } + else + { + /* For the non-shared case, discard space for relocs against + symbols which turn out to need copy relocs or are not + dynamic. */ + + if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 + && (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + || (htab->elf.dynamic_sections_created + && (h->root.type == bfd_link_hash_undefweak + || h->root.type == bfd_link_hash_undefined)))) + { + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 + && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + { + if (! bfd_elf32_link_record_dynamic_symbol (info, h)) + return false; + } + + /* If that succeeded, we know we'll be keeping all the + relocs. */ + if (h->dynindx != -1) + goto keep; + } + + eh->dyn_relocs = NULL; + + keep: + } + + /* Finally, allocate space. */ + for (p = eh->dyn_relocs; p != NULL; p = p->next) + { + asection *sreloc = elf_section_data (p->sec)->sreloc; + sreloc->_raw_size += p->count * sizeof (Elf64_External_Rela); + } + + return true; +} + +/* Find any dynamic relocs that apply to read-only sections. */ + +static boolean +readonly_dynrelocs (h, inf) + struct elf_link_hash_entry *h; + PTR inf; +{ + struct ppc_link_hash_entry *eh; + struct ppc_dyn_relocs *p; + + eh = (struct ppc_link_hash_entry *) h; + for (p = eh->dyn_relocs; p != NULL; p = p->next) + { + asection *s = p->sec->output_section; + + if (s != NULL && (s->flags & SEC_READONLY) != 0) + { + struct bfd_link_info *info = (struct bfd_link_info *) inf; + + info->flags |= DF_TEXTREL; + + /* Not an error, just cut short the traversal. */ + return false; + } + } + return true; +} + +/* Set the sizes of the dynamic sections. */ + +static boolean ppc64_elf_size_dynamic_sections (output_bfd, info) - bfd *output_bfd; + bfd *output_bfd ATTRIBUTE_UNUSED; struct bfd_link_info *info; { + struct ppc_link_hash_table *htab; bfd *dynobj; asection *s; - boolean plt; boolean relocs; - boolean reltext; - -#ifdef DEBUG - fprintf (stderr, "ppc64_elf_size_dynamic_sections called\n"); -#endif + bfd *ibfd; - dynobj = elf_hash_table (info)->dynobj; - BFD_ASSERT (dynobj != NULL); + htab = ppc_hash_table (info); + dynobj = htab->elf.dynobj; + if (dynobj == NULL) + abort (); - if (elf_hash_table (info)->dynamic_sections_created) + if (htab->elf.dynamic_sections_created) { /* Set the contents of the .interp section to the interpreter. */ if (! info->shared) { s = bfd_get_section_by_name (dynobj, ".interp"); - BFD_ASSERT (s != NULL); + if (s == NULL) + abort (); s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER; s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; } } - else - { - /* We may have created entries in the .rela.got section. - However, if we are not creating the dynamic sections, we will - not actually use these entries. Reset the size of .rela.got - which will cause it to get stripped from the output file - below. */ - s = bfd_get_section_by_name (dynobj, ".rela.got"); - if (s != NULL) - s->_raw_size = 0; + + /* Set up .got offsets for local syms, and space for local dynamic + relocs. */ + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) + { + bfd_signed_vma *local_got; + bfd_signed_vma *end_local_got; + bfd_size_type locsymcount; + Elf_Internal_Shdr *symtab_hdr; + asection *srel; + + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour) + continue; + + for (s = ibfd->sections; s != NULL; s = s->next) + { + bfd_size_type count = elf_section_data (s)->local_dynrel; + + if (count != 0) + { + srel = elf_section_data (s)->sreloc; + srel->_raw_size += count * sizeof (Elf64_External_Rela); + } + } + + local_got = elf_local_got_refcounts (ibfd); + if (!local_got) + continue; + + symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; + locsymcount = symtab_hdr->sh_info; + end_local_got = local_got + locsymcount; + s = htab->sgot; + srel = htab->srelgot; + for (; local_got < end_local_got; ++local_got) + { + if (*local_got > 0) + { + *local_got = s->_raw_size; + s->_raw_size += 8; + if (info->shared) + srel->_raw_size += sizeof (Elf64_External_Rela); + } + else + *local_got = (bfd_vma) -1; + } } - /* The check_relocs and adjust_dynamic_symbol entry points have - determined the sizes of the various dynamic sections. Allocate - memory for them. */ - plt = false; + /* Allocate global sym .plt and .got entries, and space for global + sym dynamic relocs. */ + elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info); + + /* We now have determined the sizes of the various dynamic sections. + Allocate memory for them. */ relocs = false; - reltext = false; for (s = dynobj->sections; s != NULL; s = s->next) { - const char *name; - boolean strip; - if ((s->flags & SEC_LINKER_CREATED) == 0) continue; - /* It's OK to base decisions on the section name, because none - of the dynobj section names depend upon the input files. */ - name = bfd_get_section_name (dynobj, s); - - strip = false; - - if (strcmp (name, ".plt") == 0) + if (s == htab->splt + || s == htab->sgot + || s == htab->sglink) { - if (s->_raw_size == 0) - { - /* Strip this section if we don't need it; see the - comment below. */ - strip = true; - } - else - { - /* Remember whether there is a PLT. */ - plt = true; - } + /* Strip this section if we don't need it; see the + comment below. */ } - else if (strncmp (name, ".rela", 5) == 0) + else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0) { if (s->_raw_size == 0) { @@ -2398,53 +2798,36 @@ ppc64_elf_size_dynamic_sections (output_ adjust_dynamic_symbol is called, and it is that function which decides whether anything needs to go into these sections. */ - strip = true; } else { - asection *target; - const char *outname; - - /* Remember whether there are any relocation sections. */ - relocs = true; - - /* If this relocation section applies to a read only - section, then we probably need a DT_TEXTREL entry. */ - outname = bfd_get_section_name (output_bfd, - s->output_section); - target = bfd_get_section_by_name (output_bfd, outname + 5); - if (target != NULL - && (target->flags & SEC_READONLY) != 0 - && (target->flags & SEC_ALLOC) != 0) - reltext = true; + if (s != htab->srelplt) + relocs = true; /* We use the reloc_count field as a counter if we need to copy relocs into the output file. */ s->reloc_count = 0; } } - else if (strcmp (name, ".got") != 0 - && strcmp (name, ".toc") != 0 - && strcmp (name, ".glink") != 0) + else { /* It's not one of our sections, so don't allocate space. */ continue; } - if (strip) + if (s->_raw_size == 0) { _bfd_strip_section_from_output (info, s); continue; } -#ifdef DEBUG - fprintf (stderr, "\tallocating %lu bytes for section %s\n", - (unsigned long) s->_raw_size, name); -#endif - - /* Allocate memory for the section contents. */ + /* Allocate memory for the section contents. We use bfd_zalloc + here in case unused entries are not reclaimed before the + section's contents are written out. This should not happen, + but this way if it does, we get a R_PPC64_NONE reloc instead + of garbage. */ s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); - if (s->contents == NULL && s->_raw_size != 0) + if (s->contents == NULL) return false; } @@ -2455,73 +2838,43 @@ ppc64_elf_size_dynamic_sections (output_ must add the entries now so that we get the correct size for the .dynamic section. The DT_DEBUG entry is filled in by the dynamic linker and used by the debugger. */ - if (! info->shared) - { - if (! bfd_elf64_add_dynamic_entry (info, DT_DEBUG, 0)) - return false; - } +#define add_dynamic_entry(TAG, VAL) \ + bfd_elf64_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL)) - if (plt) + if (!info->shared) { - if (! bfd_elf64_add_dynamic_entry (info, DT_PLTGOT, 0) - || ! bfd_elf64_add_dynamic_entry (info, DT_PLTRELSZ, 0) - || ! bfd_elf64_add_dynamic_entry (info, DT_PLTREL, DT_RELA) - || ! bfd_elf64_add_dynamic_entry (info, DT_JMPREL, 0)) + if (!add_dynamic_entry (DT_DEBUG, 0)) return false; } - if (relocs) + if (htab->splt->_raw_size != 0) { - if (! bfd_elf64_add_dynamic_entry (info, DT_RELA, 0) - || ! bfd_elf64_add_dynamic_entry (info, DT_RELASZ, 0) - || ! bfd_elf64_add_dynamic_entry (info, DT_RELAENT, - sizeof (Elf64_External_Rela))) + if (!add_dynamic_entry (DT_PLTGOT, 0) + || !add_dynamic_entry (DT_PLTRELSZ, 0) + || !add_dynamic_entry (DT_PLTREL, DT_RELA) + || !add_dynamic_entry (DT_JMPREL, 0)) return false; } - if (reltext) + if (relocs) { - if (! bfd_elf64_add_dynamic_entry (info, DT_TEXTREL, 0)) + if (!add_dynamic_entry (DT_RELA, 0) + || !add_dynamic_entry (DT_RELASZ, 0) + || !add_dynamic_entry (DT_RELAENT, sizeof (Elf64_External_Rela))) return false; - } - } - /* If we are generating a shared library, we generate a section - symbol for each output section. These are local symbols, which - means that they must come first in the dynamic symbol table. - That means we must increment the dynamic symbol index of every - other dynamic symbol. - - FIXME: We assume that there will never be relocations to - locations in linker-created sections that do not have - externally-visible names. Instead, we should work out precisely - which sections relocations are targetted at. */ - if (info->shared) - { - int c; + /* If any dynamic relocs apply to a read-only section, + then we need a DT_TEXTREL entry. */ + elf_link_hash_traverse (&htab->elf, readonly_dynrelocs, (PTR) info); - for (c = 0, s = output_bfd->sections; s != NULL; s = s->next) - { - if ((s->flags & SEC_LINKER_CREATED) != 0 - || (s->flags & SEC_ALLOC) == 0) + if ((info->flags & DF_TEXTREL) != 0) { - elf_section_data (s)->dynindx = -1; - continue; + if (!add_dynamic_entry (DT_TEXTREL, 0)) + return false; } - - /* These symbols will have no names, so we don't need to - fiddle with dynstr_index. */ - - elf_section_data (s)->dynindx = c + 1; - - c++; } - - elf_link_hash_traverse (elf_hash_table (info), - ppc_adjust_dynindx, - (PTR) &c); - elf_hash_table (info)->dynsymcount += c; } +#undef add_dynamic_entry return true; } @@ -2590,8 +2943,8 @@ ppc64_elf_final_link (abfd, info) elf_gp (abfd) = TOCstart; } - /* Invoke the regular gc ELF backend linker to do all the work. */ - return _bfd_elf64_gc_common_final_link (abfd, info); + /* Invoke the regular ELF backend linker to do all the work. */ + return bfd_elf64_bfd_final_link (abfd, info); } /* Set up any other section flags and such that may be necessary. */ @@ -2652,46 +3005,25 @@ ppc64_elf_relocate_section (output_bfd, Elf_Internal_Sym *local_syms; asection **local_sections; { + struct ppc_link_hash_table *htab; Elf_Internal_Shdr *symtab_hdr; struct elf_link_hash_entry **sym_hashes; - bfd *dynobj; Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; - asection *sreloc; - asection *splt; - asection *sgot; bfd_vma *local_got_offsets; bfd_vma TOCstart; boolean ret = true; - long insn; - -#ifdef DEBUG - fprintf (stderr, "ppc64_elf_relocate_section called for %s section %s, %ld relocations%s\n", - bfd_get_filename (input_bfd), - bfd_section_name (input_bfd, input_section), - (long) input_section->reloc_count, - (info->relocateable) ? " (relocatable)" : ""); -#endif + /* Initialize howto table if needed. */ if (!ppc64_elf_howto_table[R_PPC64_ADDR32]) - /* Initialize howto table if needed. */ ppc_howto_init (); + htab = ppc_hash_table (info); local_got_offsets = elf_local_got_offsets (input_bfd); - - sreloc = NULL; - splt = NULL; - sgot = NULL; - dynobj = elf_hash_table (info)->dynobj; - if (dynobj != NULL) - { - splt = bfd_get_section_by_name (dynobj, ".plt"); - sgot = bfd_get_section_by_name (dynobj, ".got"); - } TOCstart = elf_gp (output_bfd); - symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); + rel = relocs; relend = relocs + input_section->reloc_count; for (; rel < relend; rel++) @@ -2704,32 +3036,12 @@ ppc64_elf_relocate_section (output_bfd, asection *sec; struct elf_link_hash_entry *h; const char *sym_name; - reloc_howto_type *howto; unsigned long r_symndx; bfd_vma relocation; + boolean unresolved_reloc; + long insn; r_type = (enum elf_ppc_reloc_type) ELF64_R_TYPE (rel->r_info); - offset = rel->r_offset; - addend = rel->r_addend; - r = bfd_reloc_other; - sym = (Elf_Internal_Sym *) 0; - sec = (asection *) 0; - h = (struct elf_link_hash_entry *) 0; - sym_name = (const char *) 0; - - /* Unknown relocation handling. */ - if ((unsigned) r_type >= (unsigned) R_PPC_max - || !ppc64_elf_howto_table[(int) r_type]) - { - (*_bfd_error_handler) (_("%s: unknown relocation type %d"), - bfd_get_filename (input_bfd), - (int) r_type); - bfd_set_error (bfd_error_bad_value); - ret = false; - continue; - } - - howto = ppc64_elf_howto_table[(int) r_type]; r_symndx = ELF64_R_SYM (rel->r_info); if (info->relocateable) @@ -2744,24 +3056,23 @@ ppc64_elf_relocate_section (output_bfd, if ((unsigned) ELF_ST_TYPE (sym->st_info) == STT_SECTION) { sec = local_sections[r_symndx]; - addend = rel->r_addend += sec->output_offset + sym->st_value; + rel->r_addend += sec->output_offset + sym->st_value; } } - -#ifdef DEBUG - fprintf (stderr, "\ttype = %s (%d), symbol index = %ld, offset = %ld, addend = %ld\n", - howto->name, - (int) r_type, - r_symndx, - (long) offset, - (long) addend); -#endif continue; } /* This is a final link. */ - /* Set `relocation'. */ + offset = rel->r_offset; + addend = rel->r_addend; + r = bfd_reloc_other; + sym = (Elf_Internal_Sym *) 0; + sec = (asection *) 0; + h = (struct elf_link_hash_entry *) 0; + sym_name = (const char *) 0; + unresolved_reloc = false; + if (r_type == R_PPC64_TOC) { /* Relocation value is TOC base. Symbol is ignored. */ @@ -2786,119 +3097,73 @@ ppc64_elf_relocate_section (output_bfd, || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; sym_name = h->root.root.string; + relocation = 0; if (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) { sec = h->root.u.def.section; - if ((r_type == R_PPC64_PLT32 - && h->plt.offset != (bfd_vma) -1) - || ((r_type == R_PPC64_GOT16 - || r_type == R_PPC64_GOT16_LO - || r_type == R_PPC64_GOT16_HI - || r_type == R_PPC64_GOT16_HA - || r_type == R_PPC64_GOT16_DS - || r_type == R_PPC64_GOT16_LO_DS) - && elf_hash_table (info)->dynamic_sections_created - && (! info->shared - || (! info->symbolic && h->dynindx != -1) - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)) - || (info->shared - && ((! info->symbolic && h->dynindx != -1) - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0) - && (input_section->flags & SEC_ALLOC) != 0 - && (r_type == R_PPC64_ADDR64 - || r_type == R_PPC64_ADDR32 - || r_type == R_PPC64_ADDR24 - || r_type == R_PPC64_ADDR16 - || r_type == R_PPC64_ADDR16_LO - || r_type == R_PPC64_ADDR16_DS - || r_type == R_PPC64_ADDR16_LO_DS - || r_type == R_PPC64_ADDR16_HI - || r_type == R_PPC64_ADDR16_HA - || r_type == R_PPC64_ADDR16_HIGHER - || r_type == R_PPC64_ADDR16_HIGHERA - || r_type == R_PPC64_ADDR16_HIGHEST - || r_type == R_PPC64_ADDR16_HIGHESTA - || r_type == R_PPC64_ADDR14 - || r_type == R_PPC64_ADDR14_BRTAKEN - || r_type == R_PPC64_ADDR14_BRNTAKEN - || r_type == R_PPC64_COPY - || r_type == R_PPC64_GLOB_DAT - || r_type == R_PPC64_JMP_SLOT - || r_type == R_PPC64_UADDR64 - || r_type == R_PPC64_UADDR32 - || r_type == R_PPC64_UADDR16))) - { - /* In these cases, we don't need the relocation - value. We check specially because in some - obscure cases sec->output_section will be NULL. */ - relocation = 0; - } + if (sec->output_section == NULL) + /* Set a flag that will be cleared later if we find a + relocation value for this symbol. output_section + is typically NULL for symbols satisfied by a shared + library. */ + unresolved_reloc = true; else relocation = (h->root.u.def.value + sec->output_section->vma + sec->output_offset); } else if (h->root.type == bfd_link_hash_undefweak) - relocation = 0; - else if (info->shared && !info->symbolic && !info->no_undefined) - relocation = 0; + ; + else if (info->shared + && (!info->symbolic || info->allow_shlib_undefined) + && !info->no_undefined + && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) + ; else { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, - rel->r_offset, (!info->shared - || info->no_undefined - || ELF_ST_VISIBILITY (h->other))))) + offset, (!info->shared + || info->no_undefined + || ELF_ST_VISIBILITY (h->other))))) return false; relocation = 0; } } - switch ((int) r_type) - { - case (int) R_PPC64_ADDR16_DS: - case (int) R_PPC64_ADDR16_LO_DS: - case (int) R_PPC64_GOT16_DS: - case (int) R_PPC64_GOT16_LO_DS: - case (int) R_PPC64_PLT16_LO_DS: - case (int) R_PPC64_SECTOFF_DS: - case (int) R_PPC64_SECTOFF_LO_DS: - case (int) R_PPC64_TOC16_DS: - case (int) R_PPC64_TOC16_LO_DS: - case (int) R_PPC64_PLTGOT16_DS: - case (int) R_PPC64_PLTGOT16_LO_DS: - if (((relocation + addend) & 3) != 0) - { - (*_bfd_error_handler) (_("%s: error: relocation %s not a multiple of 4"), - bfd_get_filename (input_bfd), - howto->name); - bfd_set_error (bfd_error_bad_value); - ret = false; - continue; - } - } - - /* Set `addend'. */ - switch ((int) r_type) + /* First handle relocations that tweak non-addend part of insn. */ + switch (r_type) { default: - (*_bfd_error_handler) (_("%s: unknown relocation type %d for symbol %s"), - bfd_get_filename (input_bfd), - (int) r_type, sym_name); + break; - bfd_set_error (bfd_error_bad_value); - ret = false; - continue; + /* Branch taken prediction relocations. */ + case R_PPC64_ADDR14_BRTAKEN: + case R_PPC64_REL14_BRTAKEN: + insn = bfd_get_32 (output_bfd, contents + offset); + if ((relocation - offset) & 0x8000) + insn &= ~BRANCH_PREDICT_BIT; + else + insn |= BRANCH_PREDICT_BIT; + bfd_put_32 (output_bfd, (bfd_vma) insn, contents + offset); + break; + + /* Branch not taken predicition relocations. */ + case R_PPC64_ADDR14_BRNTAKEN: + case R_PPC64_REL14_BRNTAKEN: + insn = bfd_get_32 (output_bfd, contents + offset); + if ((relocation - offset) & 0x8000) + insn |= BRANCH_PREDICT_BIT; + else + insn &= ~BRANCH_PREDICT_BIT; + bfd_put_32 (output_bfd, (bfd_vma) insn, contents + offset); + break; - /* Relocations that may need to be propagated if this is a shared - object. */ - case (int) R_PPC64_REL24: - case (int) R_PPC64_ADDR24: + case R_PPC64_REL24: + case R_PPC64_ADDR24: /* An ADDR24 or REL24 branching to a linkage function may be - followed by a nop that we have to replace with an ld in + followed by a nop that we have to replace with a ld in order to restore the TOC base pointer. Only calls to shared objects need to alter the TOC base. These are recognized by their need for a PLT entry. */ @@ -2906,273 +3171,85 @@ ppc64_elf_relocate_section (output_bfd, && (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0 /* Make sure that there really is an instruction after the branch that we can decode. */ - && (rel->r_offset - input_section->vma + 8 - <= input_section->_cooked_size)) + && offset + 8 <= input_section->_cooked_size) { bfd_byte *pnext; - unsigned long insn; - pnext = contents + (rel->r_offset - input_section->vma) + 4; + pnext = contents + offset + 4; insn = bfd_get_32 (input_bfd, pnext); if (insn == 0x60000000 /* nop (ori r0,r0,0) */ || insn == 0x4def7b82 /* cror 15,15,15 */ - || insn == 0x4ffffb82) /* cror 31,31,31 */ + || insn == 0x4ffffb82) /* cror 31,31,31 */ { - bfd_put_32 (input_bfd, 0xe8410028, pnext); /* ld r2,40(r1) */ -#ifdef DEBUG - fprintf (stderr, "ppc64_elf_relocate_section: " \ - "patched nop after call to %s\n", sym_name); -#endif + bfd_put_32 (input_bfd, + (bfd_vma) 0xe8410028, /* ld r2,40(r1) */ + pnext); } } - /* fall through */ - - case (int) R_PPC64_REL64: - case (int) R_PPC64_REL32: - case (int) R_PPC64_REL14: - /* If these relocations are not to a named symbol, they can be - handled right here, no need to bother the dynamic linker. */ - if (h == NULL && r_type != R_PPC64_ADDR24) - break; - /* fall through */ - - /* Relocations that always need to be propagated if this is a shared - object. */ - case (int) R_PPC64_NONE: - case (int) R_PPC64_ADDR64: - case (int) R_PPC64_ADDR32: - case (int) R_PPC64_ADDR16: - case (int) R_PPC64_ADDR16_LO: - case (int) R_PPC64_ADDR16_DS: - case (int) R_PPC64_ADDR16_LO_DS: - case (int) R_PPC64_ADDR16_HI: - case (int) R_PPC64_ADDR16_HA: - case (int) R_PPC64_ADDR16_HIGHER: - case (int) R_PPC64_ADDR16_HIGHERA: - case (int) R_PPC64_ADDR16_HIGHEST: - case (int) R_PPC64_ADDR16_HIGHESTA: - case (int) R_PPC64_ADDR14: - case (int) R_PPC64_UADDR64: - case (int) R_PPC64_UADDR32: - case (int) R_PPC64_UADDR16: - case (int) R_PPC64_TOC: - if (info->shared) - { - Elf_Internal_Rela outrel; - boolean skip; + break; + } -#ifdef DEBUG - fprintf (stderr, "ppc64_elf_relocate_section need to create relocation for %s\n", - (h && h->root.root.string - ? h->root.root.string - : "")); -#endif + /* Set `addend'. */ + switch (r_type) + { + default: + (*_bfd_error_handler) + (_("%s: unknown relocation type %d for symbol %s"), + bfd_archive_filename (input_bfd), (int) r_type, sym_name); - /* When generating a shared object, these relocations - are copied into the output file to be resolved at run - time. */ + bfd_set_error (bfd_error_bad_value); + ret = false; + continue; - if (sreloc == NULL) - { - const char *name; + case R_PPC64_NONE: + case R_PPC_GNU_VTINHERIT: + case R_PPC_GNU_VTENTRY: + continue; - name = (bfd_elf_string_from_elf_section - (input_bfd, - elf_elfheader (input_bfd)->e_shstrndx, - elf_section_data (input_section)->rel_hdr.sh_name)); - if (name == NULL) - return false; + /* GOT16 relocations. Like an ADDR16 using the symbol's + address in the GOT as relocation value instead of the + symbols value itself. Also, create a GOT entry for the + symbol and put the symbol value there. */ + case R_PPC64_GOT16: + case R_PPC64_GOT16_LO: + case R_PPC64_GOT16_HI: + case R_PPC64_GOT16_HA: + case R_PPC64_GOT16_DS: + case R_PPC64_GOT16_LO_DS: + { + /* Relocation is to the entry for this symbol in the global + offset table. */ + bfd_vma off; - BFD_ASSERT (strncmp (name, ".rela", 5) == 0 - && strcmp (bfd_get_section_name (input_bfd, - input_section), - name + 5) == 0); + if (htab->sgot == NULL) + abort (); - sreloc = bfd_get_section_by_name (dynobj, name); - BFD_ASSERT (sreloc != NULL); - } + if (h != NULL) + { + boolean dyn; - skip = false; + off = h->got.offset; + dyn = htab->elf.dynamic_sections_created; + if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h) + || (info->shared + && (info->symbolic + || h->dynindx == -1 + || (h->elf_link_hash_flags + & ELF_LINK_FORCED_LOCAL)) + && (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR))) + { + /* This is actually a static link, or it is a + -Bsymbolic link and the symbol is defined + locally, or the symbol was forced to be local + because of a version file. We must initialize + this entry in the global offset table. Since the + offset must always be a multiple of 8, we use the + least significant bit to record whether we have + initialized it already. - if (elf_section_data (input_section)->stab_info == NULL) - outrel.r_offset = rel->r_offset; - else - { - bfd_vma off; - - off = (_bfd_stab_section_offset - (output_bfd, &elf_hash_table (info)->stab_info, - input_section, - &elf_section_data (input_section)->stab_info, - rel->r_offset)); - if (off == (bfd_vma) -1) - skip = true; - outrel.r_offset = off; - } - - outrel.r_offset += (input_section->output_section->vma - + input_section->output_offset); - - if (skip) - memset (&outrel, 0, sizeof outrel); - /* h->dynindx may be -1 if this symbol was marked to - become local. */ - else if (h != NULL - && ((! info->symbolic && h->dynindx != -1) - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)) - { - BFD_ASSERT (h->dynindx != -1); - outrel.r_info = ELF64_R_INFO (h->dynindx, r_type); - outrel.r_addend = rel->r_addend; - } - else - { - if (r_type == R_PPC64_ADDR64) - { - outrel.r_info = ELF64_R_INFO (0, R_PPC64_RELATIVE); - outrel.r_addend = relocation + rel->r_addend; - } - else - { - long indx; - - if (h == NULL) - sec = local_sections[r_symndx]; - else - { - BFD_ASSERT (h->root.type == bfd_link_hash_defined - || (h->root.type - == bfd_link_hash_defweak)); - sec = h->root.u.def.section; - } - - if (r_type == R_PPC64_TOC - || (sec != NULL && bfd_is_abs_section (sec))) - { - indx = 0; - } - else if (sec == NULL || sec->owner == NULL) - { - bfd_set_error (bfd_error_bad_value); - return false; - } - else - { - asection *osec; - - osec = sec->output_section; - indx = elf_section_data (osec)->dynindx; - BFD_ASSERT (indx > 0); -#ifdef DEBUG - if (indx <= 0) - { - printf ("indx=%ld section=%s flags=%08x name=%s\n", - indx, osec->name, osec->flags, - h->root.root.string); - } -#endif - } - - outrel.r_info = ELF64_R_INFO (indx, r_type); - outrel.r_addend = relocation + rel->r_addend; - } - } - - bfd_elf64_swap_reloca_out (output_bfd, &outrel, - (((Elf64_External_Rela *) - sreloc->contents) - + sreloc->reloc_count)); - ++sreloc->reloc_count; - - /* This reloc will be computed at runtime, so there's no - need to do anything now, unless this is a RELATIVE - reloc in an unallocated section. */ - if (skip - || (input_section->flags & SEC_ALLOC) != 0 - || ELF64_R_TYPE (outrel.r_info) != R_PPC64_RELATIVE) - continue; - } - - /* Arithmetic adjust relocations that aren't going into a - shared object. */ - if ((r_type == R_PPC64_ADDR16_HA - || r_type == R_PPC64_ADDR16_HIGHERA - || r_type == R_PPC64_ADDR16_HIGHESTA) - /* It's just possible that this symbol is a weak symbol - that's not actually defined anywhere. In that case, - 'sec' would be NULL, and we should leave the symbol - alone (it will be set to zero elsewhere in the link). */ - && sec != NULL) - { - addend += ((relocation + addend) & 0x8000) << 1; - } - break; - - /* Branch taken prediction relocations. */ - case (int) R_PPC64_ADDR14_BRTAKEN: - case (int) R_PPC64_REL14_BRTAKEN: - insn = bfd_get_32 (output_bfd, contents + offset); - if ((relocation - offset) & 0x8000) - insn &= ~BRANCH_PREDICT_BIT; - else - insn |= BRANCH_PREDICT_BIT; - bfd_put_32 (output_bfd, insn, contents + offset); - break; - - /* Branch not taken predicition relocations. */ - case (int) R_PPC64_ADDR14_BRNTAKEN: - case (int) R_PPC64_REL14_BRNTAKEN: - insn = bfd_get_32 (output_bfd, contents + offset); - if ((relocation - offset) & 0x8000) - insn |= BRANCH_PREDICT_BIT; - else - insn &= ~BRANCH_PREDICT_BIT; - bfd_put_32 (output_bfd, insn, contents + offset); - break; - - - /* GOT16 relocations. Like an ADDR16 using the symbol's - address in the GOT as relocation value instead of the - symbols value itself. Also, create a GOT entry for the - symbol and put the symbol value there. */ - /* FIXME: If the symbol is not in the .got section - (typically in the .toc section) we fail (h->got.offset is - 0). */ - /* NOTE: Sets `relocation'. */ - case (int) R_PPC64_GOT16: - case (int) R_PPC64_GOT16_LO: - case (int) R_PPC64_GOT16_HI: - case (int) R_PPC64_GOT16_HA: - case (int) R_PPC64_GOT16_DS: - case (int) R_PPC64_GOT16_LO_DS: - { - /* Relocation is to the entry for this symbol in the global - offset table. */ - bfd_vma off; - BFD_ASSERT (sgot != NULL); - - if (h != NULL) - { - off = h->got.offset; - BFD_ASSERT (off != (bfd_vma) -1); - - if (! elf_hash_table (info)->dynamic_sections_created - || (info->shared - && (info->symbolic || h->dynindx == -1) - && (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR))) - { - /* This is actually a static link, or it is a - -Bsymbolic link and the symbol is defined - locally. We must initialize this entry in the - global offset table. Since the offset must - always be a multiple of 4, we use the least - significant bit to record whether we have - initialized it already. - - When doing a dynamic link, we create a .rela.got + When doing a dynamic link, we create a .rel.got relocation entry to initialize the value. This is done in the finish_dynamic_symbol routine. */ if ((off & 1) != 0) @@ -3180,153 +3257,361 @@ ppc64_elf_relocate_section (output_bfd, else { bfd_put_64 (output_bfd, relocation, - sgot->contents + off); + htab->sgot->contents + off); h->got.offset |= 1; } } + else + unresolved_reloc = false; } else { - BFD_ASSERT (local_got_offsets != NULL - && local_got_offsets[r_symndx] != (bfd_vma) -1); + if (local_got_offsets == NULL) + abort (); off = local_got_offsets[r_symndx]; - /* The offset must always be a multiple of 4. We use + /* The offset must always be a multiple of 8. We use the least significant bit to record whether we have already processed this entry. */ if ((off & 1) != 0) off &= ~1; else { - bfd_put_64 (output_bfd, relocation, sgot->contents + off); + bfd_put_64 (output_bfd, relocation, + htab->sgot->contents + off); if (info->shared) { - asection *srelgot; Elf_Internal_Rela outrel; + Elf64_External_Rela *loc; /* We need to generate a R_PPC64_RELATIVE reloc for the dynamic linker. */ - srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); - BFD_ASSERT (srelgot != NULL); - - outrel.r_offset = (sgot->output_section->vma - + sgot->output_offset + outrel.r_offset = (htab->sgot->output_section->vma + + htab->sgot->output_offset + off); outrel.r_info = ELF64_R_INFO (0, R_PPC64_RELATIVE); outrel.r_addend = relocation; - bfd_elf64_swap_reloca_out (output_bfd, &outrel, - (((Elf64_External_Rela *) - srelgot->contents) - + srelgot->reloc_count)); - ++srelgot->reloc_count; + loc = (Elf64_External_Rela *) htab->srelgot->contents; + loc += htab->srelgot->reloc_count++; + bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc); } local_got_offsets[r_symndx] |= 1; } } - relocation = sgot->output_offset + off; + if (off >= (bfd_vma) -2) + abort (); + + relocation = htab->sgot->output_offset + off; + /* TOC base (r2) is TOC start plus 0x8000. */ addend -= TOC_BASE_OFF; - break; } + break; + + case R_PPC64_PLT16_HA: + case R_PPC64_PLT16_HI: + case R_PPC64_PLT16_LO: + case R_PPC64_PLT32: + case R_PPC64_PLT64: + /* Relocation is to the entry for this symbol in the + procedure linkage table. */ + + /* Resolve a PLT reloc against a local symbol directly, + without using the procedure linkage table. */ + if (h == NULL) + break; + + if (h->plt.offset == (bfd_vma) -1 + || htab->splt == NULL) + { + /* We didn't make a PLT entry for this symbol. This + happens when statically linking PIC code, or when + using -Bsymbolic. */ + break; + } + + relocation = (htab->splt->output_section->vma + + htab->splt->output_offset + + h->plt.offset); + unresolved_reloc = false; + break; /* TOC16 relocs. We want the offset relative to the TOC base, which is the address of the start of the TOC plus 0x8000. The TOC consists of sections .got, .toc, .tocbss, and .plt, in this order. */ - case (int) R_PPC64_TOC16: - case (int) R_PPC64_TOC16_LO: - case (int) R_PPC64_TOC16_HI: - case (int) R_PPC64_TOC16_DS: - case (int) R_PPC64_TOC16_LO_DS: - BFD_ASSERT (sec != (asection *) 0); + case R_PPC64_TOC16: + case R_PPC64_TOC16_LO: + case R_PPC64_TOC16_HI: + case R_PPC64_TOC16_DS: + case R_PPC64_TOC16_LO_DS: + case R_PPC64_TOC16_HA: /* Only .got, .toc and *UND* symbols are allowed. */ - BFD_ASSERT (bfd_is_und_section (sec) - || strcmp (bfd_get_section_name (abfd, sec), - ".got") == 0 - || strcmp (bfd_get_section_name (abfd, sec), - ".toc") == 0); + BFD_ASSERT (sec != (asection *) 0 + && (bfd_is_und_section (sec) + || strcmp (bfd_get_section_name (abfd, sec), + ".toc") == 0 + || strcmp (bfd_get_section_name (abfd, sec), + ".got") == 0)); addend -= TOCstart + TOC_BASE_OFF; break; - case (int) R_PPC64_TOC16_HA: - BFD_ASSERT (sec != (asection *) 0); - BFD_ASSERT (bfd_is_und_section (sec) - || strcmp (bfd_get_section_name (abfd, sec), - ".got") == 0 - || strcmp (bfd_get_section_name (abfd, sec), - ".toc") == 0); + /* Relocate against the beginning of the section. */ + case R_PPC64_SECTOFF: + case R_PPC64_SECTOFF_LO: + case R_PPC64_SECTOFF_HI: + case R_PPC64_SECTOFF_DS: + case R_PPC64_SECTOFF_LO_DS: + case R_PPC64_SECTOFF_HA: + if (sec != (asection *) 0) + addend -= sec->output_section->vma; + break; - addend -= TOCstart + TOC_BASE_OFF; - /* Add 1 to 16-bit word 16:31 if sign bit in 0:15 is set. */ - addend += ((relocation + addend) & 0x8000) << 1; + /* Relocations that may need to be propagated if this is a + dynamic object. */ + case R_PPC64_REL14: + case R_PPC64_REL14_BRNTAKEN: + case R_PPC64_REL14_BRTAKEN: + case R_PPC64_REL24: + case R_PPC64_REL32: + case R_PPC64_REL64: + case R_PPC64_ADDR14: + case R_PPC64_ADDR14_BRNTAKEN: + case R_PPC64_ADDR14_BRTAKEN: + case R_PPC64_ADDR16: + case R_PPC64_ADDR16_DS: + case R_PPC64_ADDR16_HA: + case R_PPC64_ADDR16_HI: + case R_PPC64_ADDR16_HIGHER: + case R_PPC64_ADDR16_HIGHERA: + case R_PPC64_ADDR16_HIGHEST: + case R_PPC64_ADDR16_HIGHESTA: + case R_PPC64_ADDR16_LO: + case R_PPC64_ADDR16_LO_DS: + case R_PPC64_ADDR24: + case R_PPC64_ADDR30: + case R_PPC64_ADDR32: + case R_PPC64_ADDR64: + case R_PPC64_UADDR16: + case R_PPC64_UADDR32: + case R_PPC64_UADDR64: + case R_PPC64_TOC: + if ((info->shared + && (input_section->flags & SEC_ALLOC) != 0 + && (IS_ABSOLUTE_RELOC (r_type) + || (h != NULL + && h->dynindx != -1 + && (! info->symbolic + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)))) + || (!info->shared + && (input_section->flags & SEC_ALLOC) != 0 + && h != NULL + && h->dynindx != -1 + && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 + && (((h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_DYNAMIC) != 0 + && (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0) + || h->root.type == bfd_link_hash_undefweak + || h->root.type == bfd_link_hash_undefined))) + { + Elf_Internal_Rela outrel; + boolean skip, relocate; + asection *sreloc; + Elf64_External_Rela *loc; + + /* When generating a dynamic object, these relocations + are copied into the output file to be resolved at run + time. */ + + skip = false; + + if (elf_section_data (input_section)->stab_info == NULL) + outrel.r_offset = offset; + else + { + bfd_vma off; + + off = (_bfd_stab_section_offset + (output_bfd, htab->elf.stab_info, input_section, + &elf_section_data (input_section)->stab_info, + offset)); + if (off == (bfd_vma) -1) + skip = true; + outrel.r_offset = off; + } + + outrel.r_offset += (input_section->output_section->vma + + input_section->output_offset); + outrel.r_addend = addend; + + if (skip) + { + relocate = false; + memset (&outrel, 0, sizeof outrel); + } + else if (h != NULL + && h->dynindx != -1 + && (!IS_ABSOLUTE_RELOC (r_type) + || !info->shared + || !info->symbolic + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)) + { + relocate = false; + outrel.r_info = ELF64_R_INFO (h->dynindx, r_type); + } + else + { + /* This symbol is local, or marked to become local. */ + outrel.r_addend += relocation; + relocate = true; + if (r_type == R_PPC64_ADDR64) + { + outrel.r_info = ELF64_R_INFO (0, R_PPC64_RELATIVE); + } + else + { + long indx = 0; + + if (r_type == R_PPC64_TOC || bfd_is_abs_section (sec)) + ; + else if (sec == NULL || sec->owner == NULL) + { + bfd_set_error (bfd_error_bad_value); + return false; + } + else + { + asection *osec; + + osec = sec->output_section; + indx = elf_section_data (osec)->dynindx; + + /* We are turning this relocation into one + against a section symbol, so subtract out + the output section's address but not the + offset of the input section in the output + section. */ + outrel.r_addend -= osec->vma; + } + + outrel.r_info = ELF64_R_INFO (indx, r_type); + } + } + + sreloc = elf_section_data (input_section)->sreloc; + if (sreloc == NULL) + abort (); + + loc = (Elf64_External_Rela *) sreloc->contents; + loc += sreloc->reloc_count++; + bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc); + + /* If this reloc is against an external symbol, it will + be computed at runtime, so there's no need to do + anything now. */ + if (! relocate) + continue; + } break; - /* Relocate against the beginning of the section. */ - case (int) R_PPC64_SECTOFF: - case (int) R_PPC64_SECTOFF_LO: - case (int) R_PPC64_SECTOFF_HI: - case (int) R_PPC64_SECTOFF_DS: - case (int) R_PPC64_SECTOFF_LO_DS: - BFD_ASSERT (sec != (asection *) 0); - addend -= sec->output_section->vma; - break; - - case (int) R_PPC64_SECTOFF_HA: - BFD_ASSERT (sec != (asection *) 0); - addend -= sec->output_section->vma; - addend += ((relocation + addend) & 0x8000) << 1; - break; - - case (int) R_PPC64_COPY: - case (int) R_PPC64_GLOB_DAT: - case (int) R_PPC64_JMP_SLOT: - case (int) R_PPC64_RELATIVE: - case (int) R_PPC64_PLT32: - case (int) R_PPC64_PLTREL32: - case (int) R_PPC64_PLT16_LO: - case (int) R_PPC64_PLT16_LO_DS: - case (int) R_PPC64_PLT16_HI: - case (int) R_PPC64_PLT16_HA: - case (int) R_PPC64_PLT64: - case (int) R_PPC64_PLTREL64: - case (int) R_PPC64_PLTGOT16: - case (int) R_PPC64_PLTGOT16_LO: - case (int) R_PPC64_PLTGOT16_DS: - case (int) R_PPC64_PLTGOT16_LO_DS: - case (int) R_PPC64_PLTGOT16_HI: - case (int) R_PPC64_PLTGOT16_HA: - (*_bfd_error_handler) (_("%s: Relocation %s is not yet supported for symbol %s."), - bfd_get_filename (input_bfd), - ppc64_elf_howto_table[(int) r_type]->name, - sym_name); + case R_PPC64_COPY: + case R_PPC64_GLOB_DAT: + case R_PPC64_JMP_SLOT: + case R_PPC64_RELATIVE: + /* We shouldn't ever see these dynamic relocs in relocatable + files. */ + /* Fall thru */ + + case R_PPC64_PLTGOT16: + case R_PPC64_PLTGOT16_DS: + case R_PPC64_PLTGOT16_HA: + case R_PPC64_PLTGOT16_HI: + case R_PPC64_PLTGOT16_LO: + case R_PPC64_PLTGOT16_LO_DS: + case R_PPC64_PLTREL32: + case R_PPC64_PLTREL64: + /* These ones haven't been implemented yet. */ + + (*_bfd_error_handler) + (_("%s: Relocation %s is not supported for symbol %s."), + bfd_archive_filename (input_bfd), + ppc64_elf_howto_table[(int) r_type]->name, sym_name); bfd_set_error (bfd_error_invalid_operation); ret = false; continue; + } - case (int) R_PPC_GNU_VTINHERIT: - case (int) R_PPC_GNU_VTENTRY: - /* These are no-ops in the end. */ - continue; + /* Do any further special processing. */ + switch (r_type) + { + default: + break; + + case R_PPC64_ADDR16_HA: + case R_PPC64_ADDR16_HIGHERA: + case R_PPC64_ADDR16_HIGHESTA: + case R_PPC64_PLT16_HA: + case R_PPC64_TOC16_HA: + case R_PPC64_SECTOFF_HA: + /* It's just possible that this symbol is a weak symbol + that's not actually defined anywhere. In that case, + 'sec' would be NULL, and we should leave the symbol + alone (it will be set to zero elsewhere in the link). */ + if (sec != NULL) + /* Add 0x10000 if sign bit in 0:15 is set. */ + addend += ((relocation + addend) & 0x8000) << 1; + break; + + case R_PPC64_ADDR16_DS: + case R_PPC64_ADDR16_LO_DS: + case R_PPC64_GOT16_DS: + case R_PPC64_GOT16_LO_DS: + case R_PPC64_PLT16_LO_DS: + case R_PPC64_SECTOFF_DS: + case R_PPC64_SECTOFF_LO_DS: + case R_PPC64_TOC16_DS: + case R_PPC64_TOC16_LO_DS: + case R_PPC64_PLTGOT16_DS: + case R_PPC64_PLTGOT16_LO_DS: + if (((relocation + addend) & 3) != 0) + { + (*_bfd_error_handler) + (_("%s: error: relocation %s not a multiple of 4"), + bfd_archive_filename (input_bfd), + ppc64_elf_howto_table[(int) r_type]->name); + bfd_set_error (bfd_error_bad_value); + ret = false; + continue; + } + break; } -#ifdef DEBUG - fprintf (stderr, " type = %s (%d), name = %s, sym index = %ld, offset = %ld, addend = %ld\n", - howto->name, - (int) r_type, - sym_name, - r_symndx, - (long) offset, - (long) addend); -#endif + /* FIXME: Why do we allow debugging sections to escape this error? + More importantly, why do we not emit dynamic relocs above in + debugging sections (which are ! SEC_ALLOC)? If we had + emitted the dynamic reloc, we could remove the fudge here. */ + if (unresolved_reloc + && !(info->shared + && (input_section->flags & SEC_DEBUGGING) != 0 + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) + (*_bfd_error_handler) + (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"), + bfd_archive_filename (input_bfd), + bfd_get_section_name (input_bfd, input_section), + (long) rel->r_offset, + h->root.root.string); - r = _bfd_final_link_relocate (howto, + r = _bfd_final_link_relocate (ppc64_elf_howto_table[(int) r_type], input_bfd, input_section, contents, @@ -3343,7 +3628,7 @@ ppc64_elf_relocate_section (output_bfd, if (h != NULL) { if (h->root.type == bfd_link_hash_undefweak - && howto->pc_relative) + && ppc64_elf_howto_table[(int) r_type]->pc_relative) { /* Assume this is a call protected by other code that detects the symbol is undefined. If this is the case, @@ -3367,23 +3652,15 @@ ppc64_elf_relocate_section (output_bfd, name = bfd_section_name (input_bfd, sec); } - if (! (*info->callbacks->reloc_overflow) (info, - name, - howto->name, - (bfd_vma) 0, - input_bfd, - input_section, - offset)) + if (! ((*info->callbacks->reloc_overflow) + (info, name, ppc64_elf_howto_table[(int) r_type]->name, + (bfd_vma) 0, input_bfd, input_section, offset))) return false; } else ret = false; } -#ifdef DEBUG - fprintf (stderr, "\n"); -#endif - return ret; } @@ -3397,42 +3674,54 @@ ppc64_elf_finish_dynamic_symbol (output_ struct elf_link_hash_entry *h; Elf_Internal_Sym *sym; { + struct ppc_link_hash_table *htab; bfd *dynobj; -#ifdef DEBUG - fprintf (stderr, "ppc64_elf_finish_dynamic_symbol called for %s", - h->root.root.string); -#endif - - dynobj = elf_hash_table (info)->dynobj; - BFD_ASSERT (dynobj != NULL); + htab = ppc_hash_table (info); + dynobj = htab->elf.dynobj; if (h->plt.offset != (bfd_vma) -1) { - asection *splt, *srela, *sglink; - Elf_Internal_Rela rela; - bfd_vma reloc_index, plt_offset; struct elf_link_hash_entry *funcdesc_h; - -#ifdef DEBUG - fprintf (stderr, ", plt_offset = 0x%lx", (unsigned long) h->plt.offset); -#endif + Elf_Internal_Rela rela; + Elf64_External_Rela *loc; /* This symbol has an entry in the procedure linkage table. Set it up. */ - BFD_ASSERT (h->dynindx != -1); + if (h->dynindx == -1 + || htab->splt == NULL + || htab->srelplt == NULL + || htab->sglink == NULL + || h->root.root.string[0] != '.' + || h->root.root.string[1] == '\0') + abort (); - splt = bfd_get_section_by_name (dynobj, ".plt"); - srela = bfd_get_section_by_name (dynobj, ".rela.plt"); - BFD_ASSERT (splt != NULL && srela != NULL); - - /* We don't need to fill in the .plt. The dynamic linker will - fill it in. */ - - /* We may need to create a linkage function. */ - sglink = bfd_get_section_by_name (dynobj, ".glink"); - if (sglink != NULL && h->root.u.def.section == sglink) + /* Find its corresponding function descriptor. + ppc64_elf_adjust_dynamic_symbol has already set it up for us. */ + + funcdesc_h = elf_link_hash_lookup (elf_hash_table (info), + h->root.root.string + 1, + false, false, false); + + if (funcdesc_h == NULL || funcdesc_h->dynindx == -1) + abort (); + + /* Create a JMP_SLOT reloc to inform the dynamic linker to + fill in the PLT entry. */ + + rela.r_offset = (htab->splt->output_section->vma + + htab->splt->output_offset + + h->plt.offset); + rela.r_info = ELF64_R_INFO (funcdesc_h->dynindx, R_PPC64_JMP_SLOT); + rela.r_addend = 0; + + loc = (Elf64_External_Rela *) htab->srelplt->contents; + loc += (h->plt.offset - PLT_INITIAL_ENTRY_SIZE) / PLT_ENTRY_SIZE; + bfd_elf64_swap_reloca_out (output_bfd, &rela, loc); + + /* We need to create a linkage function. */ + if (h->root.u.def.section == htab->sglink) { bfd_byte *p; bfd_vma pltoff; @@ -3442,8 +3731,8 @@ ppc64_elf_finish_dynamic_symbol (output_ p = h->root.u.def.section->contents + h->root.u.def.value; /* The function descriptor is in the PLT. */ - pltoff = splt->output_section->vma - + splt->output_section->output_offset + pltoff = htab->splt->output_section->vma + + htab->splt->output_section->output_offset + h->plt.offset - elf_gp (output_bfd) - TOC_BASE_OFF; @@ -3461,90 +3750,40 @@ ppc64_elf_finish_dynamic_symbol (output_ + (sizeof (ppc64_elf_glink_code) / sizeof (*ppc64_elf_glink_code)))); { - bfd_put_32 (output_bfd, *stub, p); + bfd_put_32 (output_bfd, (bfd_vma) *stub, p); } -#ifdef DEBUG - fprintf (stderr, ", linkage function"); -#endif - } - - /* Create a JMP_SLOT reloc to inform the dynamic linker to fix - the PLT entry. */ - - /* Save the PLT offset, since `h' may be changed below. */ - plt_offset = h->plt.offset; - - /* If it's a function entry point, find its corresponding - function descriptor. ppc64_elf_adjust_dynamic_symbol have - already set it up for us. */ - - /* FIXME: Is it safe to assume that this symbol is a function? */ - BFD_ASSERT (h->root.root.string[0] == '.'); - - /* FIXME: Follow bfd_link_hash_indirect? */ - funcdesc_h = elf_link_hash_lookup (elf_hash_table (info), - h->root.root.string + 1, - false, false, false); - BFD_ASSERT (funcdesc_h != NULL); - BFD_ASSERT (funcdesc_h->dynindx != -1); - - /* FIXME: Rename the symbol for the function entry point to - `linkage_for_FUNC'? */ - - rela.r_offset = (splt->output_section->vma - + splt->output_offset - + plt_offset); - rela.r_info = ELF64_R_INFO (funcdesc_h->dynindx, R_PPC64_JMP_SLOT); - rela.r_addend = 0; - - reloc_index = (plt_offset - PLT_INITIAL_ENTRY_SIZE) / PLT_ENTRY_SIZE; - bfd_elf64_swap_reloca_out (output_bfd, &rela, - ((Elf64_External_Rela *) srela->contents - + reloc_index)); -#ifdef DEBUG - fprintf (stderr, ", JMP_SLOT for %s", funcdesc_h->root.root.string); -#endif - -#if 0 - /* FIXME: Really do this? */ - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - { - /* Mark the symbol as undefined, rather than as defined in - the .plt section. Leave the value alone. */ - sym->st_shndx = SHN_UNDEF; } -#endif + else + abort (); } if (h->got.offset != (bfd_vma) -1) { - asection *sgot; - asection *srela; Elf_Internal_Rela rela; - -#ifdef DEBUG - fprintf (stderr, ", got.offset = %08lx", (unsigned long) h->got.offset); -#endif + Elf64_External_Rela *loc; /* This symbol has an entry in the global offset table. Set it up. */ - sgot = bfd_get_section_by_name (dynobj, ".got"); - srela = bfd_get_section_by_name (dynobj, ".rela.got"); - BFD_ASSERT (sgot != NULL && srela != NULL); - - rela.r_offset = (sgot->output_section->vma - + sgot->output_offset - + (h->got.offset &~ 1)); - - /* If this is a -Bsymbolic link, and the symbol is defined - locally, we just want to emit a RELATIVE reloc. The entry in - the global offset table will already have been initialized in - the relocate_section function. */ + if (htab->sgot == NULL || htab->srelgot == NULL) + abort (); + + rela.r_offset = (htab->sgot->output_section->vma + + htab->sgot->output_offset + + (h->got.offset &~ (bfd_vma) 1)); + + /* If this is a static link, or it is a -Bsymbolic link and the + symbol is defined locally or was forced to be local because + of a version file, we just want to emit a RELATIVE reloc. + The entry in the global offset table will already have been + initialized in the relocate_section function. */ if (info->shared - && (info->symbolic || h->dynindx == -1) + && (info->symbolic + || h->dynindx == -1 + || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL)) && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) { + BFD_ASSERT((h->got.offset & 1) != 0); rela.r_info = ELF64_R_INFO (0, R_PPC64_RELATIVE); rela.r_addend = (h->root.u.def.value + h->root.u.def.section->output_section->vma @@ -3553,49 +3792,40 @@ ppc64_elf_finish_dynamic_symbol (output_ else { BFD_ASSERT ((h->got.offset & 1) == 0); - bfd_put_64 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset); + bfd_put_64 (output_bfd, (bfd_vma) 0, + htab->sgot->contents + h->got.offset); rela.r_info = ELF64_R_INFO (h->dynindx, R_PPC64_GLOB_DAT); rela.r_addend = 0; } - bfd_elf64_swap_reloca_out (output_bfd, &rela, - ((Elf64_External_Rela *) srela->contents - + srela->reloc_count)); - ++srela->reloc_count; + loc = (Elf64_External_Rela *) htab->srelgot->contents; + loc += htab->srelgot->reloc_count++; + bfd_elf64_swap_reloca_out (output_bfd, &rela, loc); } if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0) { - asection *s; Elf_Internal_Rela rela; + Elf64_External_Rela *loc; - /* This symbols needs a copy reloc. Set it up. */ - -#ifdef DEBUG - fprintf (stderr, ", copy"); -#endif - - BFD_ASSERT (h->dynindx != -1); + /* This symbol needs a copy reloc. Set it up. */ - s = bfd_get_section_by_name (h->root.u.def.section->owner, - ".rela.bss"); - BFD_ASSERT (s != NULL); + if (h->dynindx == -1 + || (h->root.type != bfd_link_hash_defined + && h->root.type != bfd_link_hash_defweak) + || htab->srelbss == NULL) + abort (); rela.r_offset = (h->root.u.def.value + h->root.u.def.section->output_section->vma + h->root.u.def.section->output_offset); rela.r_info = ELF64_R_INFO (h->dynindx, R_PPC64_COPY); rela.r_addend = 0; - bfd_elf64_swap_reloca_out (output_bfd, &rela, - ((Elf64_External_Rela *) s->contents - + s->reloc_count)); - ++s->reloc_count; + loc = (Elf64_External_Rela *) htab->srelbss->contents; + loc += htab->srelbss->reloc_count++; + bfd_elf64_swap_reloca_out (output_bfd, &rela, loc); } -#ifdef DEBUG - fprintf (stderr, "\n"); -#endif - /* Mark some specially defined symbols as absolute. */ if (strcmp (h->root.root.string, "_DYNAMIC") == 0) sym->st_shndx = SHN_ABS; @@ -3603,6 +3833,29 @@ ppc64_elf_finish_dynamic_symbol (output_ return true; } +/* Used to decide how to sort relocs in an optimal manner for the + dynamic linker, before writing them out. */ + +static enum elf_reloc_type_class +ppc64_elf_reloc_type_class (rela) + const Elf_Internal_Rela *rela; +{ + enum elf_ppc_reloc_type r_type; + + r_type = (enum elf_ppc_reloc_type) ELF64_R_TYPE (rela->r_info); + switch (r_type) + { + case R_PPC64_RELATIVE: + return reloc_class_relative; + case R_PPC64_JMP_SLOT: + return reloc_class_plt; + case R_PPC64_COPY: + return reloc_class_copy; + default: + return reloc_class_normal; + } +} + /* Finish up the dynamic sections. */ static boolean @@ -3610,111 +3863,52 @@ ppc64_elf_finish_dynamic_sections (outpu bfd *output_bfd; struct bfd_link_info *info; { + struct ppc_link_hash_table *htab; + bfd *dynobj; asection *sdyn; - bfd *dynobj = elf_hash_table (info)->dynobj; - -#ifdef DEBUG - fprintf (stderr, "ppc64_elf_finish_dynamic_sections called\n"); -#endif + htab = ppc_hash_table (info); + dynobj = htab->elf.dynobj; sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); - if (elf_hash_table (info)->dynamic_sections_created) + if (htab->elf.dynamic_sections_created) { - asection *splt; Elf64_External_Dyn *dyncon, *dynconend; - splt = bfd_get_section_by_name (dynobj, ".plt"); - BFD_ASSERT (splt != NULL && sdyn != NULL); + if (sdyn == NULL || htab->sgot == NULL) + abort (); dyncon = (Elf64_External_Dyn *) sdyn->contents; dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->_raw_size); for (; dyncon < dynconend; dyncon++) { Elf_Internal_Dyn dyn; - const char *name; - boolean size; bfd_elf64_swap_dyn_in (dynobj, dyncon, &dyn); switch (dyn.d_tag) { - case DT_PLTGOT: name = ".plt"; size = false; break; - case DT_PLTRELSZ: name = ".rela.plt"; size = true; break; - case DT_JMPREL: name = ".rela.plt"; size = false; break; - default: name = NULL; size = false; break; - } + default: + continue; - if (name != NULL) - { - asection *s; + case DT_PLTGOT: + dyn.d_un.d_ptr = htab->splt->output_section->vma; + break; + + case DT_JMPREL: + dyn.d_un.d_ptr = htab->srelplt->output_section->vma; + break; - s = bfd_get_section_by_name (output_bfd, name); - if (s == NULL) - dyn.d_un.d_val = 0; + case DT_PLTRELSZ: + if (htab->srelplt->output_section->_cooked_size != 0) + dyn.d_un.d_val = htab->srelplt->output_section->_cooked_size; else - { - if (! size) - dyn.d_un.d_ptr = s->vma; - else - { - if (s->_cooked_size != 0) - dyn.d_un.d_val = s->_cooked_size; - else - dyn.d_un.d_val = s->_raw_size; - } - } - bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); + dyn.d_un.d_val = htab->srelplt->output_section->_raw_size; + break; } - } - } - - if (info->shared) - { - asection *sdynsym; - asection *s; - Elf_Internal_Sym sym; - int maxdindx = 0; - - /* Set up the section symbols for the output sections. */ - - sdynsym = bfd_get_section_by_name (dynobj, ".dynsym"); - BFD_ASSERT (sdynsym != NULL); - sym.st_size = 0; - sym.st_name = 0; - sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION); - sym.st_other = 0; - - for (s = output_bfd->sections; s != NULL; s = s->next) - { - int indx, dindx; - - sym.st_value = s->vma; - - indx = elf_section_data (s)->this_idx; - dindx = elf_section_data (s)->dynindx; - if (dindx != -1) - { - BFD_ASSERT (indx > 0); - BFD_ASSERT (dindx > 0); - - if (dindx > maxdindx) - maxdindx = dindx; - - sym.st_shndx = indx; - - bfd_elf64_swap_symbol_out (output_bfd, &sym, - (PTR) (((Elf64_External_Sym *) - sdynsym->contents) - + dindx)); - } + bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); } - - /* Set the sh_info field of the output .dynsym section to the - index of the first global symbol. */ - elf_section_data (sdynsym->output_section)->this_hdr.sh_info = - maxdindx + 1; } return true; @@ -3744,25 +3938,29 @@ ppc64_elf_finish_dynamic_sections (outpu #define elf_backend_got_symbol_offset 0 #define elf_backend_got_header_size 0 #define elf_backend_can_gc_sections 1 +#define elf_backend_can_refcount 1 #define elf_backend_plt_header_size PLT_INITIAL_ENTRY_SIZE -#define bfd_elf64_bfd_copy_private_bfd_data ppc64_elf_copy_private_bfd_data -#define bfd_elf64_bfd_merge_private_bfd_data ppc64_elf_merge_private_bfd_data -#define bfd_elf64_bfd_reloc_type_lookup ppc64_elf_reloc_type_lookup -#define bfd_elf64_bfd_set_private_flags ppc64_elf_set_private_flags -#define bfd_elf64_bfd_final_link ppc64_elf_final_link - -#define elf_backend_gc_mark_hook ppc64_elf_gc_mark_hook -#define elf_backend_gc_sweep_hook ppc64_elf_gc_sweep_hook -#define elf_backend_section_from_shdr ppc64_elf_section_from_shdr -#define elf_backend_relocate_section ppc64_elf_relocate_section -#define elf_backend_create_dynamic_sections ppc64_elf_create_dynamic_sections -#define elf_backend_check_relocs ppc64_elf_check_relocs -#define elf_backend_adjust_dynamic_symbol ppc64_elf_adjust_dynamic_symbol -#define elf_backend_size_dynamic_sections ppc64_elf_size_dynamic_sections -#define elf_backend_finish_dynamic_symbol ppc64_elf_finish_dynamic_symbol -#define elf_backend_finish_dynamic_sections ppc64_elf_finish_dynamic_sections -#define elf_backend_fake_sections ppc64_elf_fake_sections +#define bfd_elf64_bfd_reloc_type_lookup ppc64_elf_reloc_type_lookup +#define bfd_elf64_bfd_set_private_flags ppc64_elf_set_private_flags +#define bfd_elf64_bfd_copy_private_bfd_data ppc64_elf_copy_private_bfd_data +#define bfd_elf64_bfd_merge_private_bfd_data ppc64_elf_merge_private_bfd_data +#define bfd_elf64_bfd_link_hash_table_create ppc64_elf_link_hash_table_create +#define bfd_elf64_bfd_final_link ppc64_elf_final_link + +#define elf_backend_section_from_shdr ppc64_elf_section_from_shdr +#define elf_backend_create_dynamic_sections ppc64_elf_create_dynamic_sections +#define elf_backend_copy_indirect_symbol ppc64_elf_copy_indirect_symbol +#define elf_backend_check_relocs ppc64_elf_check_relocs +#define elf_backend_gc_mark_hook ppc64_elf_gc_mark_hook +#define elf_backend_gc_sweep_hook ppc64_elf_gc_sweep_hook +#define elf_backend_adjust_dynamic_symbol ppc64_elf_adjust_dynamic_symbol +#define elf_backend_size_dynamic_sections ppc64_elf_size_dynamic_sections +#define elf_backend_fake_sections ppc64_elf_fake_sections +#define elf_backend_relocate_section ppc64_elf_relocate_section +#define elf_backend_finish_dynamic_symbol ppc64_elf_finish_dynamic_symbol +#define elf_backend_reloc_type_class ppc64_elf_reloc_type_class +#define elf_backend_finish_dynamic_sections ppc64_elf_finish_dynamic_sections #include "elf64-target.h" diff -uprN binutils-2.11.90.0.31/bfd/elf64-s390.c binutils-2.11.92.0.5/bfd/elf64-s390.c --- binutils-2.11.90.0.31/bfd/elf64-s390.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/elf64-s390.c Mon Oct 1 15:25:21 2001 @@ -56,7 +56,8 @@ static boolean elf_s390_finish_dynamic_s static boolean elf_s390_finish_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *)); static boolean elf_s390_object_p PARAMS ((bfd *)); -static enum elf_reloc_type_class elf_s390_reloc_type_class PARAMS ((int)); +static enum elf_reloc_type_class elf_s390_reloc_type_class + PARAMS ((const Elf_Internal_Rela *)); #define USE_RELA 1 /* We want RELA relocations, not REL. */ @@ -289,14 +290,14 @@ elf_s390_is_local_label_name (abfd, name the program that manages to have a symbol table of more than 2 GB with a total size of at max 4 GB. */ -#define PLT_ENTRY_WORD0 0xc0100000 -#define PLT_ENTRY_WORD1 0x0000e310 -#define PLT_ENTRY_WORD2 0x10000004 -#define PLT_ENTRY_WORD3 0x07f10d10 -#define PLT_ENTRY_WORD4 0xe310100c -#define PLT_ENTRY_WORD5 0x0014c0f4 -#define PLT_ENTRY_WORD6 0x00000000 -#define PLT_ENTRY_WORD7 0x00000000 +#define PLT_ENTRY_WORD0 (bfd_vma) 0xc0100000 +#define PLT_ENTRY_WORD1 (bfd_vma) 0x0000e310 +#define PLT_ENTRY_WORD2 (bfd_vma) 0x10000004 +#define PLT_ENTRY_WORD3 (bfd_vma) 0x07f10d10 +#define PLT_ENTRY_WORD4 (bfd_vma) 0xe310100c +#define PLT_ENTRY_WORD5 (bfd_vma) 0x0014c0f4 +#define PLT_ENTRY_WORD6 (bfd_vma) 0x00000000 +#define PLT_ENTRY_WORD7 (bfd_vma) 0x00000000 /* The first PLT entry pushes the offset into the symbol table from R1 onto the stack at 8(15) and the loader object info @@ -313,14 +314,14 @@ elf_s390_is_local_label_name (abfd, name Fixup at offset 8: relative address to start of GOT. */ -#define PLT_FIRST_ENTRY_WORD0 0xe310f038 -#define PLT_FIRST_ENTRY_WORD1 0x0024c010 -#define PLT_FIRST_ENTRY_WORD2 0x00000000 -#define PLT_FIRST_ENTRY_WORD3 0xd207f030 -#define PLT_FIRST_ENTRY_WORD4 0x1008e310 -#define PLT_FIRST_ENTRY_WORD5 0x10100004 -#define PLT_FIRST_ENTRY_WORD6 0x07f10700 -#define PLT_FIRST_ENTRY_WORD7 0x07000700 +#define PLT_FIRST_ENTRY_WORD0 (bfd_vma) 0xe310f038 +#define PLT_FIRST_ENTRY_WORD1 (bfd_vma) 0x0024c010 +#define PLT_FIRST_ENTRY_WORD2 (bfd_vma) 0x00000000 +#define PLT_FIRST_ENTRY_WORD3 (bfd_vma) 0xd207f030 +#define PLT_FIRST_ENTRY_WORD4 (bfd_vma) 0x1008e310 +#define PLT_FIRST_ENTRY_WORD5 (bfd_vma) 0x10100004 +#define PLT_FIRST_ENTRY_WORD6 (bfd_vma) 0x07f10700 +#define PLT_FIRST_ENTRY_WORD7 (bfd_vma) 0x07000700 /* The s390 linker needs to keep track of the number of relocs that it decides to copy in check_relocs for each symbol. This is so that @@ -415,9 +416,9 @@ elf_s390_link_hash_table_create (abfd) bfd *abfd; { struct elf_s390_link_hash_table *ret; + bfd_size_type amt = sizeof (struct elf_s390_link_hash_table); - ret = ((struct elf_s390_link_hash_table *) - bfd_alloc (abfd, sizeof (struct elf_s390_link_hash_table))); + ret = ((struct elf_s390_link_hash_table *) bfd_alloc (abfd, amt)); if (ret == (struct elf_s390_link_hash_table *) NULL) return NULL; @@ -540,10 +541,8 @@ elf_s390_check_relocs (abfd, info, sec, if (h != NULL) { - if (h->got.refcount == -1) + if (h->got.refcount == 0) { - h->got.refcount = 1; - /* Make sure this symbol is output as a dynamic symbol. */ if (h->dynindx == -1) { @@ -554,28 +553,24 @@ elf_s390_check_relocs (abfd, info, sec, sgot->_raw_size += 8; srelgot->_raw_size += sizeof (Elf64_External_Rela); } - else - h->got.refcount += 1; + h->got.refcount += 1; } else { /* This is a global offset table entry for a local symbol. */ if (local_got_refcounts == NULL) { - size_t size; + bfd_size_type size; size = symtab_hdr->sh_info * sizeof (bfd_vma); - local_got_refcounts = (bfd_signed_vma *) - bfd_alloc (abfd, size); + local_got_refcounts = ((bfd_signed_vma *) + bfd_zalloc (abfd, size)); if (local_got_refcounts == NULL) return false; elf_local_got_refcounts (abfd) = local_got_refcounts; - memset (local_got_refcounts, -1, size); } - if (local_got_refcounts[r_symndx] == -1) + if (local_got_refcounts[r_symndx] == 0) { - local_got_refcounts[r_symndx] = 1; - sgot->_raw_size += 8; if (info->shared) { @@ -585,9 +580,7 @@ elf_s390_check_relocs (abfd, info, sec, srelgot->_raw_size += sizeof (Elf64_External_Rela); } } - else - local_got_refcounts[r_symndx] += 1; - + local_got_refcounts[r_symndx] += 1; } break; @@ -607,13 +600,8 @@ elf_s390_check_relocs (abfd, info, sec, if (h == NULL) continue; - if (h->plt.refcount == -1) - { - h->plt.refcount = 1; - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; - } - else - h->plt.refcount += 1; + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + h->plt.refcount += 1; break; case R_390_8: @@ -718,7 +706,7 @@ elf_s390_check_relocs (abfd, info, sec, if (p == NULL) { p = ((struct elf_s390_pcrel_relocs_copied *) - bfd_alloc (dynobj, sizeof *p)); + bfd_alloc (dynobj, (bfd_size_type) sizeof *p)); if (p == NULL) return false; p->next = eh->pcrel_relocs_copied; @@ -1200,37 +1188,40 @@ elf_s390_size_dynamic_sections (output_b must add the entries now so that we get the correct size for the .dynamic section. The DT_DEBUG entry is filled in by the dynamic linker and used by the debugger. */ +#define add_dynamic_entry(TAG, VAL) \ + bfd_elf64_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL)) + if (! info->shared) { - if (! bfd_elf64_add_dynamic_entry (info, DT_DEBUG, 0)) + if (!add_dynamic_entry (DT_DEBUG, 0)) return false; } if (plt) { - if (! bfd_elf64_add_dynamic_entry (info, DT_PLTGOT, 0) - || ! bfd_elf64_add_dynamic_entry (info, DT_PLTRELSZ, 0) - || ! bfd_elf64_add_dynamic_entry (info, DT_PLTREL, DT_RELA) - || ! bfd_elf64_add_dynamic_entry (info, DT_JMPREL, 0)) + if (!add_dynamic_entry (DT_PLTGOT, 0) + || !add_dynamic_entry (DT_PLTRELSZ, 0) + || !add_dynamic_entry (DT_PLTREL, DT_RELA) + || !add_dynamic_entry (DT_JMPREL, 0)) return false; } if (relocs) { - if (! bfd_elf64_add_dynamic_entry (info, DT_RELA, 0) - || ! bfd_elf64_add_dynamic_entry (info, DT_RELASZ, 0) - || ! bfd_elf64_add_dynamic_entry (info, DT_RELAENT, - sizeof (Elf64_External_Rela))) + if (!add_dynamic_entry (DT_RELA, 0) + || !add_dynamic_entry (DT_RELASZ, 0) + || !add_dynamic_entry (DT_RELAENT, sizeof (Elf64_External_Rela))) return false; } if ((info->flags & DF_TEXTREL) != 0) { - if (! bfd_elf64_add_dynamic_entry (info, DT_TEXTREL, 0)) + if (!add_dynamic_entry (DT_TEXTREL, 0)) return false; info->flags |= DF_TEXTREL; } } +#undef add_dynamic_entry return true; } @@ -1418,7 +1409,7 @@ elf_s390_relocate_section (output_bfd, i { (*_bfd_error_handler) (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"), - bfd_get_filename (input_bfd), h->root.root.string, + bfd_archive_filename (input_bfd), h->root.root.string, bfd_get_section_name (input_bfd, input_section)); relocation = 0; } @@ -1429,7 +1420,8 @@ elf_s390_relocate_section (output_bfd, i } else if (h->root.type == bfd_link_hash_undefweak) relocation = 0; - else if (info->shared && !info->symbolic + else if (info->shared + && (!info->symbolic || info->allow_shlib_undefined) && !info->no_undefined && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) relocation = 0; @@ -1886,7 +1878,7 @@ elf_s390_finish_dynamic_symbol (output_b rela.r_offset = (sgot->output_section->vma + sgot->output_offset - + (h->got.offset &~ 1)); + + (h->got.offset &~ (bfd_vma) 1)); /* If this is a static link, or it is a -Bsymbolic link and the symbol is defined locally or was forced to be local because @@ -2096,10 +2088,10 @@ elf_s390_object_p (abfd) static enum elf_reloc_type_class -elf_s390_reloc_type_class (type) - int type; +elf_s390_reloc_type_class (rela) + const Elf_Internal_Rela *rela; { - switch (type) + switch ((int) ELF64_R_TYPE (rela->r_info)) { case R_390_RELATIVE: return reloc_class_relative; @@ -2157,6 +2149,7 @@ const struct elf_size_info s390_elf64_si #define elf_backend_size_info s390_elf64_size_info #define elf_backend_can_gc_sections 1 +#define elf_backend_can_refcount 1 #define elf_backend_want_got_plt 1 #define elf_backend_plt_readonly 1 #define elf_backend_want_plt_sym 0 diff -uprN binutils-2.11.90.0.31/bfd/elf64-sparc.c binutils-2.11.92.0.5/bfd/elf64-sparc.c --- binutils-2.11.90.0.31/bfd/elf64-sparc.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/elf64-sparc.c Mon Oct 1 15:25:21 2001 @@ -47,9 +47,9 @@ static void sparc64_elf_info_to_howto static void sparc64_elf_build_plt PARAMS ((bfd *, unsigned char *, int)); static bfd_vma sparc64_elf_plt_entry_offset - PARAMS ((int)); + PARAMS ((bfd_vma)); static bfd_vma sparc64_elf_plt_ptr_offset - PARAMS ((int, int)); + PARAMS ((bfd_vma, bfd_vma)); static boolean sparc64_elf_check_relocs PARAMS ((bfd *, struct bfd_link_info *, asection *sec, @@ -96,7 +96,8 @@ static boolean sparc64_elf_slurp_reloc_t static long sparc64_elf_canonicalize_dynamic_reloc PARAMS ((bfd *, arelent **, asymbol **)); static void sparc64_elf_write_relocs PARAMS ((bfd *, asection *, PTR)); -static enum elf_reloc_type_class sparc64_elf_reloc_type_class PARAMS ((int)); +static enum elf_reloc_type_class sparc64_elf_reloc_type_class + PARAMS ((const Elf_Internal_Rela *)); /* The relocation "howto" table. */ @@ -177,7 +178,7 @@ struct elf_reloc_map { unsigned char elf_reloc_val; }; -static CONST struct elf_reloc_map sparc_reloc_map[] = +static const struct elf_reloc_map sparc_reloc_map[] = { { BFD_RELOC_NONE, R_SPARC_NONE, }, { BFD_RELOC_16, R_SPARC_16, }, @@ -294,13 +295,12 @@ sparc64_elf_slurp_one_reloc_table (abfd, bfd_size_type count; arelent *relents; - allocated = (PTR) bfd_malloc ((size_t) rel_hdr->sh_size); + allocated = (PTR) bfd_malloc (rel_hdr->sh_size); if (allocated == NULL) goto error_return; if (bfd_seek (abfd, rel_hdr->sh_offset, SEEK_SET) != 0 - || (bfd_read (allocated, 1, rel_hdr->sh_size, abfd) - != rel_hdr->sh_size)) + || bfd_bread (allocated, rel_hdr->sh_size, abfd) != rel_hdr->sh_size) goto error_return; native_relocs = (bfd_byte *) allocated; @@ -385,6 +385,7 @@ sparc64_elf_slurp_reloc_table (abfd, ase struct bfd_elf_section_data * const d = elf_section_data (asect); Elf_Internal_Shdr *rel_hdr; Elf_Internal_Shdr *rel_hdr2; + bfd_size_type amt; if (asect->relocation != NULL) return true; @@ -415,9 +416,9 @@ sparc64_elf_slurp_reloc_table (abfd, ase rel_hdr2 = NULL; } - asect->relocation = ((arelent *) - bfd_alloc (abfd, - asect->reloc_count * 2 * sizeof (arelent))); + amt = asect->reloc_count; + amt *= 2 * sizeof (arelent); + asect->relocation = (arelent *) bfd_alloc (abfd, amt); if (asect->relocation == NULL) return false; @@ -653,9 +654,9 @@ sparc64_elf_bfd_link_hash_table_create ( bfd *abfd; { struct sparc64_elf_link_hash_table *ret; + bfd_size_type amt = sizeof (struct sparc64_elf_link_hash_table); - ret = ((struct sparc64_elf_link_hash_table *) - bfd_zalloc (abfd, sizeof (struct sparc64_elf_link_hash_table))); + ret = (struct sparc64_elf_link_hash_table *) bfd_zalloc (abfd, amt); if (ret == (struct sparc64_elf_link_hash_table *) NULL) return NULL; @@ -773,8 +774,8 @@ sparc_elf_wdisp16_reloc (abfd, reloc_ent if (status != bfd_reloc_other) return status; - insn = (insn & ~0x303fff) | ((((relocation >> 2) & 0xc000) << 6) - | ((relocation >> 2) & 0x3fff)); + insn &= ~ (bfd_vma) 0x303fff; + insn |= (((relocation >> 2) & 0xc000) << 6) | ((relocation >> 2) & 0x3fff); bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address); if ((bfd_signed_vma) relocation < - 0x40000 @@ -812,7 +813,7 @@ sparc_elf_hix22_reloc (abfd, return status; relocation ^= MINUS_ONE; - insn = (insn & ~0x3fffff) | ((relocation >> 10) & 0x3fffff); + insn = (insn &~ (bfd_vma) 0x3fffff) | ((relocation >> 10) & 0x3fffff); bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address); if ((relocation & ~ (bfd_vma) 0xffffffff) != 0) @@ -848,7 +849,7 @@ sparc_elf_lox10_reloc (abfd, if (status != bfd_reloc_other) return status; - insn = (insn & ~0x1fff) | 0x1c00 | (relocation & 0x3ff); + insn = (insn &~ (bfd_vma) 0x1fff) | 0x1c00 | (relocation & 0x3ff); bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address); return bfd_reloc_ok; @@ -879,7 +880,7 @@ sparc64_elf_build_plt (output_bfd, conte We fill them with `illtrap 0' to force ld.so to do something. */ for (i = 0; i < PLT_HEADER_SIZE/4; ++i) - bfd_put_32 (output_bfd, 0, contents+i*4); + bfd_put_32 (output_bfd, (bfd_vma) 0, contents+i*4); /* The first 32768 entries are close enough to plt1 to get there via a straight branch. */ @@ -895,14 +896,14 @@ sparc64_elf_build_plt (output_bfd, conte /* ba,a,pt %xcc, plt1 */ ba = 0x30680000 | (((contents+PLT_ENTRY_SIZE) - (entry+4)) / 4 & 0x7ffff); - bfd_put_32 (output_bfd, sethi, entry); - bfd_put_32 (output_bfd, ba, entry+4); - bfd_put_32 (output_bfd, nop, entry+8); - bfd_put_32 (output_bfd, nop, entry+12); - bfd_put_32 (output_bfd, nop, entry+16); - bfd_put_32 (output_bfd, nop, entry+20); - bfd_put_32 (output_bfd, nop, entry+24); - bfd_put_32 (output_bfd, nop, entry+28); + bfd_put_32 (output_bfd, (bfd_vma) sethi, entry); + bfd_put_32 (output_bfd, (bfd_vma) ba, entry + 4); + bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 8); + bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 12); + bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 16); + bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 20); + bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 24); + bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 28); } /* Now the tricky bit. Entries 32768 and higher are grouped in blocks of @@ -920,17 +921,23 @@ sparc64_elf_build_plt (output_bfd, conte entry = contents + i*PLT_ENTRY_SIZE + j*4*6; ptr = contents + i*PLT_ENTRY_SIZE + block*4*6 + j*8; - /* ldx [%o7 + ptr - entry+4], %g1 */ - ldx = 0xc25be000 | ((ptr - entry+4) & 0x1fff); + /* ldx [%o7 + ptr - (entry+4)], %g1 */ + ldx = 0xc25be000 | ((ptr - (entry+4)) & 0x1fff); - bfd_put_32 (output_bfd, 0x8a10000f, entry); /* mov %o7,%g5 */ - bfd_put_32 (output_bfd, 0x40000002, entry+4); /* call .+8 */ - bfd_put_32 (output_bfd, nop, entry+8); /* nop */ - bfd_put_32 (output_bfd, ldx, entry+12); /* ldx [%o7+P],%g1 */ - bfd_put_32 (output_bfd, 0x83c3c001, entry+16); /* jmpl %o7+%g1,%g1 */ - bfd_put_32 (output_bfd, 0x9e100005, entry+20); /* mov %g5,%o7 */ + /* mov %o7,%g5 + call .+8 + nop + ldx [%o7+P],%g1 + jmpl %o7+%g1,%g1 + mov %g5,%o7 */ + bfd_put_32 (output_bfd, (bfd_vma) 0x8a10000f, entry); + bfd_put_32 (output_bfd, (bfd_vma) 0x40000002, entry + 4); + bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 8); + bfd_put_32 (output_bfd, (bfd_vma) ldx, entry + 12); + bfd_put_32 (output_bfd, (bfd_vma) 0x83c3c001, entry + 16); + bfd_put_32 (output_bfd, (bfd_vma) 0x9e100005, entry + 20); - bfd_put_64 (output_bfd, contents - (entry+4), ptr); + bfd_put_64 (output_bfd, (bfd_vma) (contents - (entry + 4)), ptr); } } } @@ -939,9 +946,9 @@ sparc64_elf_build_plt (output_bfd, conte static bfd_vma sparc64_elf_plt_entry_offset (index) - int index; + bfd_vma index; { - int block, ofs; + bfd_vma block, ofs; if (index < LARGE_PLT_THRESHOLD) return index * PLT_ENTRY_SIZE; @@ -951,22 +958,21 @@ sparc64_elf_plt_entry_offset (index) block = (index - LARGE_PLT_THRESHOLD) / 160; ofs = (index - LARGE_PLT_THRESHOLD) % 160; - return ((bfd_vma) (LARGE_PLT_THRESHOLD + block*160) * PLT_ENTRY_SIZE - + ofs * 6*4); + return (LARGE_PLT_THRESHOLD + block * 160) * PLT_ENTRY_SIZE + ofs * 6 * 4; } static bfd_vma sparc64_elf_plt_ptr_offset (index, max) - int index, max; + bfd_vma index; + bfd_vma max; { - int block, ofs, last; + bfd_vma block, ofs, last; BFD_ASSERT(index >= LARGE_PLT_THRESHOLD); /* See above for details. */ - block = (((index - LARGE_PLT_THRESHOLD) / 160) * 160) - + LARGE_PLT_THRESHOLD; + block = (((index - LARGE_PLT_THRESHOLD) / 160) * 160) + LARGE_PLT_THRESHOLD; ofs = index - block; if (block + 160 > max) last = (max - LARGE_PLT_THRESHOLD) % 160; @@ -1087,10 +1093,11 @@ sparc64_elf_check_relocs (abfd, info, se symbol. */ if (local_got_offsets == NULL) { - size_t size; + bfd_size_type size; register unsigned int i; - size = symtab_hdr->sh_info * sizeof (bfd_vma); + size = symtab_hdr->sh_info; + size *= sizeof (bfd_vma); local_got_offsets = (bfd_vma *) bfd_alloc (abfd, size); if (local_got_offsets == NULL) return false; @@ -1263,7 +1270,7 @@ sparc64_elf_check_relocs (abfd, info, se default: (*_bfd_error_handler) (_("%s: check_relocs: unhandled reloc type %d"), - bfd_get_filename(abfd), + bfd_archive_filename (abfd), ELF64_R_TYPE_ID (rel->r_info)); return false; } @@ -1285,7 +1292,7 @@ sparc64_elf_add_symbol_hook (abfd, info, asection **secp ATTRIBUTE_UNUSED; bfd_vma *valp ATTRIBUTE_UNUSED; { - static char *stt_types[] = { "NOTYPE", "OBJECT", "FUNCTION" }; + static const char *const stt_types[] = { "NOTYPE", "OBJECT", "FUNCTION" }; if (ELF_ST_TYPE (sym->st_info) == STT_REGISTER) { @@ -1300,7 +1307,7 @@ sparc64_elf_add_symbol_hook (abfd, info, default: (*_bfd_error_handler) (_("%s: Only registers %%g[2367] can be declared using STT_REGISTER"), - bfd_get_filename (abfd)); + bfd_archive_filename (abfd)); return false; } @@ -1319,11 +1326,12 @@ sparc64_elf_add_symbol_hook (abfd, info, if (p->name != NULL && strcmp (p->name, *namep)) { (*_bfd_error_handler) - (_("Register %%g%d used incompatibly: " - "previously declared in %s to %s, in %s redefined to %s"), - (int)sym->st_value, - bfd_get_filename (p->abfd), *p->name ? p->name : "#scratch", - bfd_get_filename (abfd), **namep ? *namep : "#scratch"); + (_("Register %%g%d used incompatibly: %s in %s"), + (int) sym->st_value, + **namep ? *namep : "#scratch", bfd_archive_filename (abfd)); + (*_bfd_error_handler) + (_(" previously %s in %s"), + *p->name ? p->name : "#scratch", bfd_archive_filename (p->abfd)); return false; } @@ -1340,11 +1348,14 @@ sparc64_elf_add_symbol_hook (abfd, info, { unsigned char type = h->type; - if (type > STT_FUNC) type = 0; + if (type > STT_FUNC) + type = 0; + (*_bfd_error_handler) + (_("Symbol `%s' has differing types: %s in %s"), + *namep, "REGISTER", bfd_archive_filename (abfd)); (*_bfd_error_handler) - (_("Symbol `%s' has differing types: " - "previously %s, REGISTER in %s"), - *namep, stt_types [type], bfd_get_filename (abfd)); + (_(" previously %s in %s"), + stt_types[type], bfd_archive_filename (p->abfd)); return false; } @@ -1386,12 +1397,14 @@ sparc64_elf_add_symbol_hook (abfd, info, { unsigned char type = ELF_ST_TYPE (sym->st_info); - if (type > STT_FUNC) type = 0; + if (type > STT_FUNC) + type = 0; (*_bfd_error_handler) - (_("Symbol `%s' has differing types: " - "REGISTER in %s, %s in %s"), - *namep, bfd_get_filename (p->abfd), stt_types [type], - bfd_get_filename (abfd)); + (_("Symbol `%s' has differing types: %s in %s"), + *namep, stt_types[type], bfd_archive_filename (abfd)); + (*_bfd_error_handler) + (_(" previously %s in %s"), + "REGISTER", bfd_archive_filename (p->abfd)); return false; } } @@ -1768,35 +1781,37 @@ sparc64_elf_size_dynamic_sections (outpu must add the entries now so that we get the correct size for the .dynamic section. The DT_DEBUG entry is filled in by the dynamic linker and used by the debugger. */ +#define add_dynamic_entry(TAG, VAL) \ + bfd_elf64_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL)) + int reg; struct sparc64_elf_app_reg * app_regs; struct bfd_strtab_hash *dynstr; struct elf_link_hash_table *eht = elf_hash_table (info); - if (! info->shared) + if (!info->shared) { - if (! bfd_elf64_add_dynamic_entry (info, DT_DEBUG, 0)) + if (!add_dynamic_entry (DT_DEBUG, 0)) return false; } if (relplt) { - if (! bfd_elf64_add_dynamic_entry (info, DT_PLTGOT, 0) - || ! bfd_elf64_add_dynamic_entry (info, DT_PLTRELSZ, 0) - || ! bfd_elf64_add_dynamic_entry (info, DT_PLTREL, DT_RELA) - || ! bfd_elf64_add_dynamic_entry (info, DT_JMPREL, 0)) + if (!add_dynamic_entry (DT_PLTGOT, 0) + || !add_dynamic_entry (DT_PLTRELSZ, 0) + || !add_dynamic_entry (DT_PLTREL, DT_RELA) + || !add_dynamic_entry (DT_JMPREL, 0)) return false; } - if (! bfd_elf64_add_dynamic_entry (info, DT_RELA, 0) - || ! bfd_elf64_add_dynamic_entry (info, DT_RELASZ, 0) - || ! bfd_elf64_add_dynamic_entry (info, DT_RELAENT, - sizeof (Elf64_External_Rela))) + if (!add_dynamic_entry (DT_RELA, 0) + || !add_dynamic_entry (DT_RELASZ, 0) + || !add_dynamic_entry (DT_RELAENT, sizeof (Elf64_External_Rela))) return false; if (info->flags & DF_TEXTREL) { - if (! bfd_elf64_add_dynamic_entry (info, DT_TEXTREL, 0)) + if (!add_dynamic_entry (DT_TEXTREL, 0)) return false; } @@ -1810,7 +1825,7 @@ sparc64_elf_size_dynamic_sections (outpu { struct elf_link_local_dynamic_entry *entry, *e; - if (! bfd_elf64_add_dynamic_entry (info, DT_SPARC_REGISTER, 0)) + if (!add_dynamic_entry (DT_SPARC_REGISTER, 0)) return false; entry = (struct elf_link_local_dynamic_entry *) @@ -1847,6 +1862,7 @@ sparc64_elf_size_dynamic_sections (outpu eht->dynsymcount++; } } +#undef add_dynamic_entry return true; } @@ -2060,7 +2076,8 @@ sparc64_elf_relocate_section (output_bfd } else if (h->root.type == bfd_link_hash_undefweak) relocation = 0; - else if (info->shared && !info->symbolic + else if (info->shared + && (!info->symbolic || info->allow_shlib_undefined) && !info->no_undefined && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) relocation = 0; @@ -2262,7 +2279,7 @@ sparc64_elf_relocate_section (output_bfd BFD_FAIL (); (*_bfd_error_handler) (_("%s: probably compiled without -fPIC?"), - bfd_get_filename (input_bfd)); + bfd_archive_filename (input_bfd)); bfd_set_error (bfd_error_bad_value); return false; } @@ -2365,7 +2382,8 @@ sparc64_elf_relocate_section (output_bfd Note this is different behaviour to the 32-bit linker, which both adds the contents and ignores the addend. So clear the location. */ - bfd_put_64 (output_bfd, 0, sgot->contents + off); + bfd_put_64 (output_bfd, (bfd_vma) 0, + sgot->contents + off); /* We need to generate a R_SPARC_RELATIVE reloc for the dynamic linker. */ @@ -2431,7 +2449,7 @@ sparc64_elf_relocate_section (output_bfd relocation = (relocation & 0x3ff) + ELF64_R_TYPE_DATA (rel->r_info); x = bfd_get_32 (input_bfd, contents + rel->r_offset); - x = (x & ~0x1fff) | (relocation & 0x1fff); + x = (x & ~(bfd_vma) 0x1fff) | (relocation & 0x1fff); bfd_put_32 (input_bfd, x, contents + rel->r_offset); r = bfd_check_overflow (howto->complain_on_overflow, @@ -2452,8 +2470,9 @@ sparc64_elf_relocate_section (output_bfd relocation -= rel->r_offset; x = bfd_get_32 (input_bfd, contents + rel->r_offset); - x = (x & ~0x303fff) | ((((relocation >> 2) & 0xc000) << 6) - | ((relocation >> 2) & 0x3fff)); + x &= ~(bfd_vma) 0x303fff; + x |= ((((relocation >> 2) & 0xc000) << 6) + | ((relocation >> 2) & 0x3fff)); bfd_put_32 (input_bfd, x, contents + rel->r_offset); r = bfd_check_overflow (howto->complain_on_overflow, @@ -2471,7 +2490,7 @@ sparc64_elf_relocate_section (output_bfd relocation = relocation ^ MINUS_ONE; x = bfd_get_32 (input_bfd, contents + rel->r_offset); - x = (x & ~0x3fffff) | ((relocation >> 10) & 0x3fffff); + x = (x & ~(bfd_vma) 0x3fffff) | ((relocation >> 10) & 0x3fffff); bfd_put_32 (input_bfd, x, contents + rel->r_offset); r = bfd_check_overflow (howto->complain_on_overflow, @@ -2489,7 +2508,7 @@ sparc64_elf_relocate_section (output_bfd relocation = (relocation & 0x3ff) | 0x1c00; x = bfd_get_32 (input_bfd, contents + rel->r_offset); - x = (x & ~0x1fff) | relocation; + x = (x & ~(bfd_vma) 0x1fff) | relocation; bfd_put_32 (input_bfd, x, contents + rel->r_offset); r = bfd_reloc_ok; @@ -2578,7 +2597,7 @@ sparc64_elf_relocate_section (output_bfd || reg == G0 || reg == O7) break; - bfd_put_32 (input_bfd, INSN_NOP, + bfd_put_32 (input_bfd, (bfd_vma) INSN_NOP, contents + rel->r_offset + 4); } break; @@ -2683,7 +2702,7 @@ sparc64_elf_finish_dynamic_symbol (outpu } else { - int max = splt->_raw_size / PLT_ENTRY_SIZE; + bfd_vma max = splt->_raw_size / PLT_ENTRY_SIZE; rela.r_offset = sparc64_elf_plt_ptr_offset (h->plt.offset, max); rela.r_addend = -(sparc64_elf_plt_entry_offset (h->plt.offset) + 4) -(splt->output_section->vma + splt->output_offset); @@ -2729,7 +2748,7 @@ sparc64_elf_finish_dynamic_symbol (outpu rela.r_offset = (sgot->output_section->vma + sgot->output_offset - + (h->got.offset &~ 1)); + + (h->got.offset &~ (bfd_vma) 1)); /* If this is a -Bsymbolic link, and the symbol is defined locally, we just want to emit a RELATIVE reloc. Likewise if @@ -2871,8 +2890,8 @@ sparc64_elf_finish_dynamic_sections (out /* Initialize the contents of the .plt section. */ if (splt->_raw_size > 0) { - sparc64_elf_build_plt(output_bfd, splt->contents, - splt->_raw_size / PLT_ENTRY_SIZE); + sparc64_elf_build_plt (output_bfd, splt->contents, + (int) (splt->_raw_size / PLT_ENTRY_SIZE)); } elf_section_data (splt->output_section)->this_hdr.sh_entsize = @@ -2899,10 +2918,10 @@ sparc64_elf_finish_dynamic_sections (out } static enum elf_reloc_type_class -sparc64_elf_reloc_type_class (type) - int type; +sparc64_elf_reloc_type_class (rela) + const Elf_Internal_Rela *rela; { - switch (type) + switch ((int) ELF64_R_TYPE (rela->r_info)) { case R_SPARC_RELATIVE: return reloc_class_relative; @@ -2990,7 +3009,7 @@ sparc64_elf_merge_private_bfd_data (ibfd error = true; (*_bfd_error_handler) (_("%s: linking UltraSPARC specific with HAL specific code"), - bfd_get_filename (ibfd)); + bfd_archive_filename (ibfd)); } /* Choose the most restrictive memory ordering. */ old_mm = (old_flags & EF_SPARCV9_MM); @@ -3009,7 +3028,7 @@ sparc64_elf_merge_private_bfd_data (ibfd error = true; (*_bfd_error_handler) (_("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"), - bfd_get_filename (ibfd), (long)new_flags, (long)old_flags); + bfd_archive_filename (ibfd), (long) new_flags, (long) old_flags); } elf_elfheader (obfd)->e_flags = old_flags; diff -uprN binutils-2.11.90.0.31/bfd/elf64-x86-64.c binutils-2.11.92.0.5/bfd/elf64-x86-64.c --- binutils-2.11.90.0.31/bfd/elf64-x86-64.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/elf64-x86-64.c Mon Oct 1 15:25:21 2001 @@ -98,7 +98,7 @@ struct elf_reloc_map unsigned char elf_reloc_val; }; -static CONST struct elf_reloc_map x86_64_reloc_map[] = +static const struct elf_reloc_map x86_64_reloc_map[] = { { BFD_RELOC_NONE, R_X86_64_NONE, }, { BFD_RELOC_64, R_X86_64_64, }, @@ -153,7 +153,8 @@ static boolean elf64_x86_64_finish_dynam Elf_Internal_Sym *sym)); static boolean elf64_x86_64_finish_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *)); -static enum elf_reloc_type_class elf64_x86_64_reloc_type_class PARAMS ((int)); +static enum elf_reloc_type_class elf64_x86_64_reloc_type_class + PARAMS ((const Elf_Internal_Rela *)); /* Given a BFD reloc type, return a HOWTO structure. */ static reloc_howto_type * @@ -166,8 +167,7 @@ elf64_x86_64_reloc_type_lookup (abfd, co i++) { if (x86_64_reloc_map[i].bfd_reloc_val == code) - return &x86_64_elf_howto_table[(int) - x86_64_reloc_map[i].elf_reloc_val]; + return &x86_64_elf_howto_table[i]; } return 0; } @@ -327,9 +327,9 @@ elf64_x86_64_link_hash_table_create (abf bfd *abfd; { struct elf64_x86_64_link_hash_table *ret; + bfd_size_type amt = sizeof (struct elf64_x86_64_link_hash_table); - ret = ((struct elf64_x86_64_link_hash_table *) - bfd_alloc (abfd, sizeof (struct elf64_x86_64_link_hash_table))); + ret = ((struct elf64_x86_64_link_hash_table *) bfd_alloc (abfd, amt)); if (ret == (struct elf64_x86_64_link_hash_table *) NULL) return NULL; @@ -441,10 +441,8 @@ elf64_x86_64_check_relocs (abfd, info, s if (h != NULL) { - if (h->got.refcount == -1) + if (h->got.refcount == 0) { - h->got.refcount = 1; - /* Make sure this symbol is output as a dynamic symbol. */ if (h->dynindx == -1) { @@ -455,28 +453,25 @@ elf64_x86_64_check_relocs (abfd, info, s sgot->_raw_size += GOT_ENTRY_SIZE; srelgot->_raw_size += sizeof (Elf64_External_Rela); } - else - h->got.refcount += 1; + h->got.refcount += 1; } else { /* This is a global offset table entry for a local symbol. */ if (local_got_refcounts == NULL) { - size_t size; + bfd_size_type size; - size = symtab_hdr->sh_info * sizeof (bfd_signed_vma); + size = symtab_hdr->sh_info; + size *= sizeof (bfd_signed_vma); local_got_refcounts = ((bfd_signed_vma *) - bfd_alloc (abfd, size)); + bfd_zalloc (abfd, size)); if (local_got_refcounts == NULL) return false; elf_local_got_refcounts (abfd) = local_got_refcounts; - memset (local_got_refcounts, -1, size); } - if (local_got_refcounts[r_symndx] == -1) + if (local_got_refcounts[r_symndx] == 0) { - local_got_refcounts[r_symndx] = 1; - sgot->_raw_size += GOT_ENTRY_SIZE; if (info->shared) { @@ -486,8 +481,7 @@ elf64_x86_64_check_relocs (abfd, info, s srelgot->_raw_size += sizeof (Elf64_External_Rela); } } - else - local_got_refcounts[r_symndx] += 1; + local_got_refcounts[r_symndx] += 1; } break; @@ -505,10 +499,7 @@ elf64_x86_64_check_relocs (abfd, info, s continue; h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; - if (h->plt.refcount == -1) - h->plt.refcount = 1; - else - h->plt.refcount += 1; + h->plt.refcount += 1; break; case R_X86_64_8: @@ -606,7 +597,7 @@ elf64_x86_64_check_relocs (abfd, info, s if (p == NULL) { p = ((struct elf64_x86_64_pcrel_relocs_copied *) - bfd_alloc (dynobj, sizeof *p)); + bfd_alloc (dynobj, (bfd_size_type) sizeof *p)); if (p == NULL) return false; p->next = eh->pcrel_relocs_copied; @@ -1077,36 +1068,39 @@ elf64_x86_64_size_dynamic_sections (outp must add the entries now so that we get the correct size for the .dynamic section. The DT_DEBUG entry is filled in by the dynamic linker and used by the debugger. */ +#define add_dynamic_entry(TAG, VAL) \ + bfd_elf64_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL)) + if (! info->shared) { - if (! bfd_elf64_add_dynamic_entry (info, DT_DEBUG, 0)) + if (!add_dynamic_entry (DT_DEBUG, 0)) return false; } if (plt) { - if (! bfd_elf64_add_dynamic_entry (info, DT_PLTGOT, 0) - || ! bfd_elf64_add_dynamic_entry (info, DT_PLTRELSZ, 0) - || ! bfd_elf64_add_dynamic_entry (info, DT_PLTREL, DT_RELA) - || ! bfd_elf64_add_dynamic_entry (info, DT_JMPREL, 0)) + if (!add_dynamic_entry (DT_PLTGOT, 0) + || !add_dynamic_entry (DT_PLTRELSZ, 0) + || !add_dynamic_entry (DT_PLTREL, DT_RELA) + || !add_dynamic_entry (DT_JMPREL, 0)) return false; } if (relocs) { - if (! bfd_elf64_add_dynamic_entry (info, DT_RELA, 0) - || ! bfd_elf64_add_dynamic_entry (info, DT_RELASZ, 0) - || ! bfd_elf64_add_dynamic_entry (info, DT_RELAENT, - sizeof (Elf64_External_Rela))) + if (!add_dynamic_entry (DT_RELA, 0) + || !add_dynamic_entry (DT_RELASZ, 0) + || !add_dynamic_entry (DT_RELAENT, sizeof (Elf64_External_Rela))) return false; } if ((info->flags & DF_TEXTREL) != 0) { - if (! bfd_elf64_add_dynamic_entry (info, DT_TEXTREL, 0)) + if (!add_dynamic_entry (DT_TEXTREL, 0)) return false; } } +#undef add_dynamic_entry return true; } @@ -1285,7 +1279,7 @@ elf64_x86_64_relocate_section (output_bf { (*_bfd_error_handler) (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"), - bfd_get_filename (input_bfd), h->root.root.string, + bfd_archive_filename (input_bfd), h->root.root.string, bfd_get_section_name (input_bfd, input_section)); relocation = 0; } @@ -1296,7 +1290,9 @@ elf64_x86_64_relocate_section (output_bf } else if (h->root.type == bfd_link_hash_undefweak) relocation = 0; - else if (info->shared && !info->symbolic && !info->no_undefined + else if (info->shared + && (!info->symbolic || info->allow_shlib_undefined) + && !info->no_undefined && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) relocation = 0; else @@ -1521,7 +1517,7 @@ elf64_x86_64_relocate_section (output_bf } else { - long indx; + long sindx; if (h == NULL) sec = local_sections[r_symndx]; @@ -1533,7 +1529,7 @@ elf64_x86_64_relocate_section (output_bf sec = h->root.u.def.section; } if (sec != NULL && bfd_is_abs_section (sec)) - indx = 0; + sindx = 0; else if (sec == NULL || sec->owner == NULL) { bfd_set_error (bfd_error_bad_value); @@ -1544,12 +1540,12 @@ elf64_x86_64_relocate_section (output_bf asection *osec; osec = sec->output_section; - indx = elf_section_data (osec)->dynindx; - BFD_ASSERT (indx > 0); + sindx = elf_section_data (osec)->dynindx; + BFD_ASSERT (sindx > 0); } relocate = false; - outrel.r_info = ELF64_R_INFO (indx, r_type); + outrel.r_info = ELF64_R_INFO (sindx, r_type); outrel.r_addend = relocation + rela->r_addend; } @@ -1730,7 +1726,7 @@ elf64_x86_64_finish_dynamic_symbol (outp rela.r_offset = (sgot->output_section->vma + sgot->output_offset - + (h->got.offset &~ 1)); + + (h->got.offset &~ (bfd_vma) 1)); /* If this is a static link, or it is a -Bsymbolic link and the symbol is defined locally or was forced to be local because @@ -1930,10 +1926,10 @@ elf64_x86_64_finish_dynamic_sections (ou } static enum elf_reloc_type_class -elf64_x86_64_reloc_type_class (type) - int type; +elf64_x86_64_reloc_type_class (rela) + const Elf_Internal_Rela *rela; { - switch (type) + switch ((int) ELF64_R_TYPE (rela->r_info)) { case R_X86_64_RELATIVE: return reloc_class_relative; @@ -1953,6 +1949,7 @@ elf64_x86_64_reloc_type_class (type) #define ELF_MAXPAGESIZE 0x100000 #define elf_backend_can_gc_sections 1 +#define elf_backend_can_refcount 1 #define elf_backend_want_got_plt 1 #define elf_backend_plt_readonly 1 #define elf_backend_want_plt_sym 0 diff -uprN binutils-2.11.90.0.31/bfd/elfarm-nabi.c binutils-2.11.92.0.5/bfd/elfarm-nabi.c --- binutils-2.11.90.0.31/bfd/elfarm-nabi.c Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/bfd/elfarm-nabi.c Mon Oct 1 15:25:21 2001 @@ -688,7 +688,7 @@ elf32_arm_nabi_grok_prstatus (abfd, note Elf_Internal_Note *note; { int offset; - int raw_size; + size_t raw_size; switch (note->descsz) { diff -uprN binutils-2.11.90.0.31/bfd/elfcode.h binutils-2.11.92.0.5/bfd/elfcode.h --- binutils-2.11.90.0.31/bfd/elfcode.h Wed May 23 10:54:15 2001 +++ binutils-2.11.92.0.5/bfd/elfcode.h Mon Oct 1 15:25:21 2001 @@ -185,16 +185,16 @@ static char *elf_symbol_flags PARAMS ((f /* Should perhaps use put_offset, put_word, etc. For now, the two versions can be handled by explicitly specifying 32 bits or "the long type". */ #if ARCH_SIZE == 64 -#define put_word bfd_h_put_64 -#define put_signed_word bfd_h_put_signed_64 -#define get_word bfd_h_get_64 -#define get_signed_word bfd_h_get_signed_64 +#define H_PUT_WORD H_PUT_64 +#define H_PUT_SIGNED_WORD H_PUT_S64 +#define H_GET_WORD H_GET_64 +#define H_GET_SIGNED_WORD H_GET_S64 #endif #if ARCH_SIZE == 32 -#define put_word bfd_h_put_32 -#define put_signed_word bfd_h_put_signed_32 -#define get_word bfd_h_get_32 -#define get_signed_word bfd_h_get_signed_32 +#define H_PUT_WORD H_PUT_32 +#define H_PUT_SIGNED_WORD H_PUT_S32 +#define H_GET_WORD H_GET_32 +#define H_GET_SIGNED_WORD H_GET_S32 #endif /* Translate an ELF symbol in external format into an ELF symbol in internal @@ -208,15 +208,15 @@ elf_swap_symbol_in (abfd, src, dst) { int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma; - dst->st_name = bfd_h_get_32 (abfd, (bfd_byte *) src->st_name); + dst->st_name = H_GET_32 (abfd, src->st_name); if (signed_vma) - dst->st_value = get_signed_word (abfd, (bfd_byte *) src->st_value); + dst->st_value = H_GET_SIGNED_WORD (abfd, src->st_value); else - dst->st_value = get_word (abfd, (bfd_byte *) src->st_value); - dst->st_size = get_word (abfd, (bfd_byte *) src->st_size); - dst->st_info = bfd_h_get_8 (abfd, (bfd_byte *) src->st_info); - dst->st_other = bfd_h_get_8 (abfd, (bfd_byte *) src->st_other); - dst->st_shndx = bfd_h_get_16 (abfd, (bfd_byte *) src->st_shndx); + dst->st_value = H_GET_WORD (abfd, src->st_value); + dst->st_size = H_GET_WORD (abfd, src->st_size); + dst->st_info = H_GET_8 (abfd, src->st_info); + dst->st_other = H_GET_8 (abfd, src->st_other); + dst->st_shndx = H_GET_16 (abfd, src->st_shndx); } /* Translate an ELF symbol in internal format into an ELF symbol in external @@ -229,12 +229,12 @@ elf_swap_symbol_out (abfd, src, cdst) PTR cdst; { Elf_External_Sym *dst = (Elf_External_Sym *) cdst; - bfd_h_put_32 (abfd, src->st_name, dst->st_name); - put_word (abfd, src->st_value, dst->st_value); - put_word (abfd, src->st_size, dst->st_size); - bfd_h_put_8 (abfd, src->st_info, dst->st_info); - bfd_h_put_8 (abfd, src->st_other, dst->st_other); - bfd_h_put_16 (abfd, src->st_shndx, dst->st_shndx); + H_PUT_32 (abfd, src->st_name, dst->st_name); + H_PUT_WORD (abfd, src->st_value, dst->st_value); + H_PUT_WORD (abfd, src->st_size, dst->st_size); + H_PUT_8 (abfd, src->st_info, dst->st_info); + H_PUT_8 (abfd, src->st_other, dst->st_other); + H_PUT_16 (abfd, src->st_shndx, dst->st_shndx); } /* Translate an ELF file header in external format into an ELF file header in @@ -248,22 +248,22 @@ elf_swap_ehdr_in (abfd, src, dst) { int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma; memcpy (dst->e_ident, src->e_ident, EI_NIDENT); - dst->e_type = bfd_h_get_16 (abfd, (bfd_byte *) src->e_type); - dst->e_machine = bfd_h_get_16 (abfd, (bfd_byte *) src->e_machine); - dst->e_version = bfd_h_get_32 (abfd, (bfd_byte *) src->e_version); + dst->e_type = H_GET_16 (abfd, src->e_type); + dst->e_machine = H_GET_16 (abfd, src->e_machine); + dst->e_version = H_GET_32 (abfd, src->e_version); if (signed_vma) - dst->e_entry = get_signed_word (abfd, (bfd_byte *) src->e_entry); + dst->e_entry = H_GET_SIGNED_WORD (abfd, src->e_entry); else - dst->e_entry = get_word (abfd, (bfd_byte *) src->e_entry); - dst->e_phoff = get_word (abfd, (bfd_byte *) src->e_phoff); - dst->e_shoff = get_word (abfd, (bfd_byte *) src->e_shoff); - dst->e_flags = bfd_h_get_32 (abfd, (bfd_byte *) src->e_flags); - dst->e_ehsize = bfd_h_get_16 (abfd, (bfd_byte *) src->e_ehsize); - dst->e_phentsize = bfd_h_get_16 (abfd, (bfd_byte *) src->e_phentsize); - dst->e_phnum = bfd_h_get_16 (abfd, (bfd_byte *) src->e_phnum); - dst->e_shentsize = bfd_h_get_16 (abfd, (bfd_byte *) src->e_shentsize); - dst->e_shnum = bfd_h_get_16 (abfd, (bfd_byte *) src->e_shnum); - dst->e_shstrndx = bfd_h_get_16 (abfd, (bfd_byte *) src->e_shstrndx); + dst->e_entry = H_GET_WORD (abfd, src->e_entry); + dst->e_phoff = H_GET_WORD (abfd, src->e_phoff); + dst->e_shoff = H_GET_WORD (abfd, src->e_shoff); + dst->e_flags = H_GET_32 (abfd, src->e_flags); + dst->e_ehsize = H_GET_16 (abfd, src->e_ehsize); + dst->e_phentsize = H_GET_16 (abfd, src->e_phentsize); + dst->e_phnum = H_GET_16 (abfd, src->e_phnum); + dst->e_shentsize = H_GET_16 (abfd, src->e_shentsize); + dst->e_shnum = H_GET_16 (abfd, src->e_shnum); + dst->e_shstrndx = H_GET_16 (abfd, src->e_shstrndx); } /* Translate an ELF file header in internal format into an ELF file header in @@ -278,22 +278,22 @@ elf_swap_ehdr_out (abfd, src, dst) int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma; memcpy (dst->e_ident, src->e_ident, EI_NIDENT); /* note that all elements of dst are *arrays of unsigned char* already... */ - bfd_h_put_16 (abfd, src->e_type, dst->e_type); - bfd_h_put_16 (abfd, src->e_machine, dst->e_machine); - bfd_h_put_32 (abfd, src->e_version, dst->e_version); + H_PUT_16 (abfd, src->e_type, dst->e_type); + H_PUT_16 (abfd, src->e_machine, dst->e_machine); + H_PUT_32 (abfd, src->e_version, dst->e_version); if (signed_vma) - put_signed_word (abfd, src->e_entry, dst->e_entry); + H_PUT_SIGNED_WORD (abfd, src->e_entry, dst->e_entry); else - put_word (abfd, src->e_entry, dst->e_entry); - put_word (abfd, src->e_phoff, dst->e_phoff); - put_word (abfd, src->e_shoff, dst->e_shoff); - bfd_h_put_32 (abfd, src->e_flags, dst->e_flags); - bfd_h_put_16 (abfd, src->e_ehsize, dst->e_ehsize); - bfd_h_put_16 (abfd, src->e_phentsize, dst->e_phentsize); - bfd_h_put_16 (abfd, src->e_phnum, dst->e_phnum); - bfd_h_put_16 (abfd, src->e_shentsize, dst->e_shentsize); - bfd_h_put_16 (abfd, src->e_shnum, dst->e_shnum); - bfd_h_put_16 (abfd, src->e_shstrndx, dst->e_shstrndx); + H_PUT_WORD (abfd, src->e_entry, dst->e_entry); + H_PUT_WORD (abfd, src->e_phoff, dst->e_phoff); + H_PUT_WORD (abfd, src->e_shoff, dst->e_shoff); + H_PUT_32 (abfd, src->e_flags, dst->e_flags); + H_PUT_16 (abfd, src->e_ehsize, dst->e_ehsize); + H_PUT_16 (abfd, src->e_phentsize, dst->e_phentsize); + H_PUT_16 (abfd, src->e_phnum, dst->e_phnum); + H_PUT_16 (abfd, src->e_shentsize, dst->e_shentsize); + H_PUT_16 (abfd, src->e_shnum, dst->e_shnum); + H_PUT_16 (abfd, src->e_shstrndx, dst->e_shstrndx); } /* Translate an ELF section header table entry in external format into an @@ -307,19 +307,19 @@ elf_swap_shdr_in (abfd, src, dst) { int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma; - dst->sh_name = bfd_h_get_32 (abfd, (bfd_byte *) src->sh_name); - dst->sh_type = bfd_h_get_32 (abfd, (bfd_byte *) src->sh_type); - dst->sh_flags = get_word (abfd, (bfd_byte *) src->sh_flags); + dst->sh_name = H_GET_32 (abfd, src->sh_name); + dst->sh_type = H_GET_32 (abfd, src->sh_type); + dst->sh_flags = H_GET_WORD (abfd, src->sh_flags); if (signed_vma) - dst->sh_addr = get_signed_word (abfd, (bfd_byte *) src->sh_addr); + dst->sh_addr = H_GET_SIGNED_WORD (abfd, src->sh_addr); else - dst->sh_addr = get_word (abfd, (bfd_byte *) src->sh_addr); - dst->sh_offset = get_word (abfd, (bfd_byte *) src->sh_offset); - dst->sh_size = get_word (abfd, (bfd_byte *) src->sh_size); - dst->sh_link = bfd_h_get_32 (abfd, (bfd_byte *) src->sh_link); - dst->sh_info = bfd_h_get_32 (abfd, (bfd_byte *) src->sh_info); - dst->sh_addralign = get_word (abfd, (bfd_byte *) src->sh_addralign); - dst->sh_entsize = get_word (abfd, (bfd_byte *) src->sh_entsize); + dst->sh_addr = H_GET_WORD (abfd, src->sh_addr); + dst->sh_offset = H_GET_WORD (abfd, src->sh_offset); + dst->sh_size = H_GET_WORD (abfd, src->sh_size); + dst->sh_link = H_GET_32 (abfd, src->sh_link); + dst->sh_info = H_GET_32 (abfd, src->sh_info); + dst->sh_addralign = H_GET_WORD (abfd, src->sh_addralign); + dst->sh_entsize = H_GET_WORD (abfd, src->sh_entsize); dst->bfd_section = NULL; dst->contents = NULL; } @@ -334,16 +334,16 @@ elf_swap_shdr_out (abfd, src, dst) Elf_External_Shdr *dst; { /* note that all elements of dst are *arrays of unsigned char* already... */ - bfd_h_put_32 (abfd, src->sh_name, dst->sh_name); - bfd_h_put_32 (abfd, src->sh_type, dst->sh_type); - put_word (abfd, src->sh_flags, dst->sh_flags); - put_word (abfd, src->sh_addr, dst->sh_addr); - put_word (abfd, src->sh_offset, dst->sh_offset); - put_word (abfd, src->sh_size, dst->sh_size); - bfd_h_put_32 (abfd, src->sh_link, dst->sh_link); - bfd_h_put_32 (abfd, src->sh_info, dst->sh_info); - put_word (abfd, src->sh_addralign, dst->sh_addralign); - put_word (abfd, src->sh_entsize, dst->sh_entsize); + H_PUT_32 (abfd, src->sh_name, dst->sh_name); + H_PUT_32 (abfd, src->sh_type, dst->sh_type); + H_PUT_WORD (abfd, src->sh_flags, dst->sh_flags); + H_PUT_WORD (abfd, src->sh_addr, dst->sh_addr); + H_PUT_WORD (abfd, src->sh_offset, dst->sh_offset); + H_PUT_WORD (abfd, src->sh_size, dst->sh_size); + H_PUT_32 (abfd, src->sh_link, dst->sh_link); + H_PUT_32 (abfd, src->sh_info, dst->sh_info); + H_PUT_WORD (abfd, src->sh_addralign, dst->sh_addralign); + H_PUT_WORD (abfd, src->sh_entsize, dst->sh_entsize); } /* Translate an ELF program header table entry in external format into an @@ -357,22 +357,22 @@ elf_swap_phdr_in (abfd, src, dst) { int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma; - dst->p_type = bfd_h_get_32 (abfd, (bfd_byte *) src->p_type); - dst->p_flags = bfd_h_get_32 (abfd, (bfd_byte *) src->p_flags); - dst->p_offset = get_word (abfd, (bfd_byte *) src->p_offset); + dst->p_type = H_GET_32 (abfd, src->p_type); + dst->p_flags = H_GET_32 (abfd, src->p_flags); + dst->p_offset = H_GET_WORD (abfd, src->p_offset); if (signed_vma) { - dst->p_vaddr = get_signed_word (abfd, (bfd_byte *) src->p_vaddr); - dst->p_paddr = get_signed_word (abfd, (bfd_byte *) src->p_paddr); + dst->p_vaddr = H_GET_SIGNED_WORD (abfd, src->p_vaddr); + dst->p_paddr = H_GET_SIGNED_WORD (abfd, src->p_paddr); } else { - dst->p_vaddr = get_word (abfd, (bfd_byte *) src->p_vaddr); - dst->p_paddr = get_word (abfd, (bfd_byte *) src->p_paddr); + dst->p_vaddr = H_GET_WORD (abfd, src->p_vaddr); + dst->p_paddr = H_GET_WORD (abfd, src->p_paddr); } - dst->p_filesz = get_word (abfd, (bfd_byte *) src->p_filesz); - dst->p_memsz = get_word (abfd, (bfd_byte *) src->p_memsz); - dst->p_align = get_word (abfd, (bfd_byte *) src->p_align); + dst->p_filesz = H_GET_WORD (abfd, src->p_filesz); + dst->p_memsz = H_GET_WORD (abfd, src->p_memsz); + dst->p_align = H_GET_WORD (abfd, src->p_align); } void @@ -382,14 +382,14 @@ elf_swap_phdr_out (abfd, src, dst) Elf_External_Phdr *dst; { /* note that all elements of dst are *arrays of unsigned char* already... */ - bfd_h_put_32 (abfd, src->p_type, dst->p_type); - put_word (abfd, src->p_offset, dst->p_offset); - put_word (abfd, src->p_vaddr, dst->p_vaddr); - put_word (abfd, src->p_paddr, dst->p_paddr); - put_word (abfd, src->p_filesz, dst->p_filesz); - put_word (abfd, src->p_memsz, dst->p_memsz); - bfd_h_put_32 (abfd, src->p_flags, dst->p_flags); - put_word (abfd, src->p_align, dst->p_align); + H_PUT_32 (abfd, src->p_type, dst->p_type); + H_PUT_WORD (abfd, src->p_offset, dst->p_offset); + H_PUT_WORD (abfd, src->p_vaddr, dst->p_vaddr); + H_PUT_WORD (abfd, src->p_paddr, dst->p_paddr); + H_PUT_WORD (abfd, src->p_filesz, dst->p_filesz); + H_PUT_WORD (abfd, src->p_memsz, dst->p_memsz); + H_PUT_32 (abfd, src->p_flags, dst->p_flags); + H_PUT_WORD (abfd, src->p_align, dst->p_align); } /* Translate an ELF reloc from external format to internal format. */ @@ -399,8 +399,8 @@ elf_swap_reloc_in (abfd, src, dst) const Elf_External_Rel *src; Elf_Internal_Rel *dst; { - dst->r_offset = get_word (abfd, (bfd_byte *) src->r_offset); - dst->r_info = get_word (abfd, (bfd_byte *) src->r_info); + dst->r_offset = H_GET_WORD (abfd, src->r_offset); + dst->r_info = H_GET_WORD (abfd, src->r_info); } INLINE void @@ -409,9 +409,9 @@ elf_swap_reloca_in (abfd, src, dst) const Elf_External_Rela *src; Elf_Internal_Rela *dst; { - dst->r_offset = get_word (abfd, (bfd_byte *) src->r_offset); - dst->r_info = get_word (abfd, (bfd_byte *) src->r_info); - dst->r_addend = get_signed_word (abfd, (bfd_byte *) src->r_addend); + dst->r_offset = H_GET_WORD (abfd, src->r_offset); + dst->r_info = H_GET_WORD (abfd, src->r_info); + dst->r_addend = H_GET_SIGNED_WORD (abfd, src->r_addend); } /* Translate an ELF reloc from internal format to external format. */ @@ -421,8 +421,8 @@ elf_swap_reloc_out (abfd, src, dst) const Elf_Internal_Rel *src; Elf_External_Rel *dst; { - put_word (abfd, src->r_offset, dst->r_offset); - put_word (abfd, src->r_info, dst->r_info); + H_PUT_WORD (abfd, src->r_offset, dst->r_offset); + H_PUT_WORD (abfd, src->r_info, dst->r_info); } INLINE void @@ -431,9 +431,9 @@ elf_swap_reloca_out (abfd, src, dst) const Elf_Internal_Rela *src; Elf_External_Rela *dst; { - put_word (abfd, src->r_offset, dst->r_offset); - put_word (abfd, src->r_info, dst->r_info); - put_signed_word (abfd, src->r_addend, dst->r_addend); + H_PUT_WORD (abfd, src->r_offset, dst->r_offset); + H_PUT_WORD (abfd, src->r_info, dst->r_info); + H_PUT_SIGNED_WORD (abfd, src->r_addend, dst->r_addend); } INLINE void @@ -444,8 +444,8 @@ elf_swap_dyn_in (abfd, p, dst) { const Elf_External_Dyn *src = (const Elf_External_Dyn *) p; - dst->d_tag = get_word (abfd, src->d_tag); - dst->d_un.d_val = get_word (abfd, src->d_un.d_val); + dst->d_tag = H_GET_WORD (abfd, src->d_tag); + dst->d_un.d_val = H_GET_WORD (abfd, src->d_un.d_val); } INLINE void @@ -456,8 +456,8 @@ elf_swap_dyn_out (abfd, src, p) { Elf_External_Dyn *dst = (Elf_External_Dyn *) p; - put_word (abfd, src->d_tag, dst->d_tag); - put_word (abfd, src->d_un.d_val, dst->d_un.d_val); + H_PUT_WORD (abfd, src->d_tag, dst->d_tag); + H_PUT_WORD (abfd, src->d_un.d_val, dst->d_un.d_val); } /* ELF .o/exec file reading */ @@ -503,6 +503,7 @@ elf_object_p (abfd) unsigned long previous_mach = bfd_get_mach (abfd); struct elf_obj_tdata *new_tdata = NULL; asection *s; + bfd_size_type amt; /* Clear section information, since there might be a recognized bfd that we now check if we can replace, and we don't want to append to it. */ @@ -511,7 +512,8 @@ elf_object_p (abfd) /* Read in the ELF header in external format. */ - if (bfd_read ((PTR) & x_ehdr, sizeof (x_ehdr), 1, abfd) != sizeof (x_ehdr)) + if (bfd_bread ((PTR) & x_ehdr, (bfd_size_type) sizeof (x_ehdr), abfd) + != sizeof (x_ehdr)) { if (bfd_get_error () != bfd_error_system_call) goto got_wrong_format_error; @@ -549,8 +551,8 @@ elf_object_p (abfd) /* Allocate an instance of the elf_obj_tdata structure and hook it up to the tdata pointer in the bfd. */ - new_tdata = ((struct elf_obj_tdata *) - bfd_zalloc (abfd, sizeof (struct elf_obj_tdata))); + amt = sizeof (struct elf_obj_tdata); + new_tdata = (struct elf_obj_tdata *) bfd_zalloc (abfd, amt); if (new_tdata == NULL) goto got_no_match; elf_tdata (abfd) = new_tdata; @@ -566,14 +568,15 @@ elf_object_p (abfd) if (i_ehdrp->e_type == ET_CORE) goto got_wrong_format_error; - /* If there is no section header table, we're hosed. */ - if (i_ehdrp->e_shoff == 0) + /* If this is a relocatable file and there is no section header + table, then we're hosed. */ + if (i_ehdrp->e_shoff == 0 && i_ehdrp->e_type == ET_REL) goto got_wrong_format_error; /* As a simple sanity check, verify that the what BFD thinks is the size of each section header table entry actually matches the size - recorded in the file. */ - if (i_ehdrp->e_shentsize != sizeof (x_shdr)) + recorded in the file, but only if there are any sections. */ + if (i_ehdrp->e_shentsize != sizeof (x_shdr) && i_ehdrp->e_shnum != 0) goto got_wrong_format_error; ebd = get_elf_backend_data (abfd); @@ -632,18 +635,21 @@ elf_object_p (abfd) /* Allocate space for a copy of the section header table in internal form, seek to the section header table in the file, read it in, and convert it to internal form. */ - i_shdrp = ((Elf_Internal_Shdr *) - bfd_alloc (abfd, sizeof (*i_shdrp) * i_ehdrp->e_shnum)); - elf_elfsections (abfd) = ((Elf_Internal_Shdr **) - bfd_alloc (abfd, - sizeof (i_shdrp) * i_ehdrp->e_shnum)); - if (!i_shdrp || !elf_elfsections (abfd)) - goto got_no_match; - if (bfd_seek (abfd, i_ehdrp->e_shoff, SEEK_SET) != 0) - goto got_no_match; + if (i_ehdrp->e_shnum != 0) + { + amt = sizeof (*i_shdrp) * i_ehdrp->e_shnum; + i_shdrp = (Elf_Internal_Shdr *) bfd_alloc (abfd, amt); + amt = sizeof (i_shdrp) * i_ehdrp->e_shnum; + elf_elfsections (abfd) = (Elf_Internal_Shdr **) bfd_alloc (abfd, amt); + if (!i_shdrp || !elf_elfsections (abfd)) + goto got_no_match; + if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_shoff, SEEK_SET) != 0) + goto got_no_match; + } for (shindex = 0; shindex < i_ehdrp->e_shnum; shindex++) { - if (bfd_read ((PTR) & x_shdr, sizeof x_shdr, 1, abfd) != sizeof (x_shdr)) + if (bfd_bread ((PTR) & x_shdr, (bfd_size_type) sizeof x_shdr, abfd) + != sizeof (x_shdr)) goto got_no_match; elf_swap_shdr_in (abfd, &x_shdr, i_shdrp + shindex); elf_elfsections (abfd)[shindex] = i_shdrp + shindex; @@ -671,20 +677,18 @@ elf_object_p (abfd) Elf_Internal_Phdr *i_phdr; unsigned int i; - elf_tdata (abfd)->phdr = ((Elf_Internal_Phdr *) - bfd_alloc (abfd, - (i_ehdrp->e_phnum - * sizeof (Elf_Internal_Phdr)))); + amt = i_ehdrp->e_phnum * sizeof (Elf_Internal_Phdr); + elf_tdata (abfd)->phdr = (Elf_Internal_Phdr *) bfd_alloc (abfd, amt); if (elf_tdata (abfd)->phdr == NULL) goto got_no_match; - if (bfd_seek (abfd, i_ehdrp->e_phoff, SEEK_SET) != 0) + if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_phoff, SEEK_SET) != 0) goto got_no_match; i_phdr = elf_tdata (abfd)->phdr; for (i = 0; i < i_ehdrp->e_phnum; i++, i_phdr++) { Elf_External_Phdr x_phdr; - if (bfd_read ((PTR) &x_phdr, sizeof x_phdr, 1, abfd) + if (bfd_bread ((PTR) &x_phdr, (bfd_size_type) sizeof x_phdr, abfd) != sizeof x_phdr) goto got_no_match; elf_swap_phdr_in (abfd, &x_phdr, i_phdr); @@ -697,18 +701,21 @@ elf_object_p (abfd) bfd_section_from_shdr with it (since this particular strtab is used to find all of the ELF section names.) */ - shstrtab = bfd_elf_get_str_section (abfd, i_ehdrp->e_shstrndx); - if (!shstrtab) - goto got_no_match; - - /* Once all of the section headers have been read and converted, we - can start processing them. Note that the first section header is - a dummy placeholder entry, so we ignore it. */ - - for (shindex = 1; shindex < i_ehdrp->e_shnum; shindex++) + if (i_ehdrp->e_shstrndx != 0) { - if (! bfd_section_from_shdr (abfd, shindex)) + shstrtab = bfd_elf_get_str_section (abfd, i_ehdrp->e_shstrndx); + if (!shstrtab) goto got_no_match; + + /* Once all of the section headers have been read and converted, we + can start processing them. Note that the first section header is + a dummy placeholder entry, so we ignore it. */ + + for (shindex = 1; shindex < i_ehdrp->e_shnum; shindex++) + { + if (! bfd_section_from_shdr (abfd, shindex)) + goto got_no_match; + } } /* Let the backend double check the format and override global @@ -936,14 +943,14 @@ int elf_write_out_phdrs (abfd, phdr, count) bfd *abfd; const Elf_Internal_Phdr *phdr; - int count; + unsigned int count; { while (count--) { Elf_External_Phdr extphdr; elf_swap_phdr_out (abfd, phdr, &extphdr); - if (bfd_write (&extphdr, sizeof (Elf_External_Phdr), 1, abfd) - != sizeof (Elf_External_Phdr)) + if (bfd_bwrite (&extphdr, (bfd_size_type) sizeof (Elf_External_Phdr), + abfd) != sizeof (Elf_External_Phdr)) return -1; phdr++; } @@ -961,6 +968,7 @@ elf_write_shdrs_and_ehdr (abfd) Elf_External_Shdr *x_shdrp; /* Section header table, external form */ Elf_Internal_Shdr **i_shdrp; /* Section header table, internal form */ unsigned int count; + bfd_size_type amt; i_ehdrp = elf_elfheader (abfd); i_shdrp = elf_elfsections (abfd); @@ -971,14 +979,14 @@ elf_write_shdrs_and_ehdr (abfd) elf_debug_file (i_ehdrp); #endif elf_swap_ehdr_out (abfd, i_ehdrp, &x_ehdr); + amt = sizeof (x_ehdr); if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 - || (bfd_write ((PTR) & x_ehdr, sizeof (x_ehdr), 1, abfd) - != sizeof (x_ehdr))) + || bfd_bwrite ((PTR) & x_ehdr, amt, abfd) != amt) return false; /* at this point we've concocted all the ELF sections... */ - x_shdrp = (Elf_External_Shdr *) - bfd_alloc (abfd, sizeof (*x_shdrp) * (i_ehdrp->e_shnum)); + amt = sizeof (*x_shdrp) * i_ehdrp->e_shnum; + x_shdrp = (Elf_External_Shdr *) bfd_alloc (abfd, amt); if (!x_shdrp) return false; @@ -989,9 +997,10 @@ elf_write_shdrs_and_ehdr (abfd) #endif elf_swap_shdr_out (abfd, i_shdrp[count], x_shdrp + count); } + amt = i_ehdrp->e_shnum; + amt *= sizeof (*x_shdrp); if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_shoff, SEEK_SET) != 0 - || (bfd_write ((PTR) x_shdrp, sizeof (*x_shdrp), i_ehdrp->e_shnum, abfd) - != sizeof (*x_shdrp) * i_ehdrp->e_shnum)) + || bfd_bwrite ((PTR) x_shdrp, amt, abfd) != amt) return false; /* need to dump the string table too... */ @@ -1013,6 +1022,7 @@ elf_slurp_symbol_table (abfd, symptrs, d Elf_Internal_Sym i_sym; Elf_External_Sym *x_symp = NULL; Elf_External_Versym *x_versymp = NULL; + bfd_size_type amt; /* Read each raw ELF symbol, converting from external ELF form to internal ELF form, and then using the information to create a @@ -1046,7 +1056,7 @@ elf_slurp_symbol_table (abfd, symptrs, d } } - if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) == -1) + if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0) return -1; symcount = hdr->sh_size / sizeof (Elf_External_Sym); @@ -1057,22 +1067,26 @@ elf_slurp_symbol_table (abfd, symptrs, d { unsigned long i; - if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) == -1) + if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0) return -1; - symbase = ((elf_symbol_type *) - bfd_zalloc (abfd, symcount * sizeof (elf_symbol_type))); + amt = symcount; + amt *= sizeof (elf_symbol_type); + symbase = (elf_symbol_type *) bfd_zalloc (abfd, amt); if (symbase == (elf_symbol_type *) NULL) return -1; sym = symbase; /* Temporarily allocate room for the raw ELF symbols. */ - x_symp = ((Elf_External_Sym *) - bfd_malloc (symcount * sizeof (Elf_External_Sym))); + amt = symcount; + amt *= sizeof (Elf_External_Sym); + x_symp = (Elf_External_Sym *) bfd_malloc (amt); if (x_symp == NULL && symcount != 0) goto error_return; - if (bfd_read ((PTR) x_symp, sizeof (Elf_External_Sym), symcount, abfd) + if (bfd_bread ((PTR) x_symp, + (bfd_size_type) (symcount * sizeof (Elf_External_Sym)), + abfd) != symcount * sizeof (Elf_External_Sym)) goto error_return; @@ -1101,7 +1115,7 @@ elf_slurp_symbol_table (abfd, symptrs, d if (x_versymp == NULL && verhdr->sh_size != 0) goto error_return; - if (bfd_read ((PTR) x_versymp, 1, verhdr->sh_size, abfd) + if (bfd_bread ((PTR) x_versymp, (bfd_size_type) verhdr->sh_size, abfd) != verhdr->sh_size) goto error_return; } @@ -1271,12 +1285,12 @@ elf_slurp_reloc_table_from_section (abfd unsigned int i; int entsize; - allocated = (PTR) bfd_malloc ((size_t) rel_hdr->sh_size); + allocated = (PTR) bfd_malloc (rel_hdr->sh_size); if (allocated == NULL) goto error_return; if (bfd_seek (abfd, rel_hdr->sh_offset, SEEK_SET) != 0 - || (bfd_read (allocated, 1, rel_hdr->sh_size, abfd) + || (bfd_bread (allocated, rel_hdr->sh_size, abfd) != rel_hdr->sh_size)) goto error_return; @@ -1362,6 +1376,7 @@ elf_slurp_reloc_table (abfd, asect, symb bfd_size_type reloc_count; bfd_size_type reloc_count2; arelent *relents; + bfd_size_type amt; if (asect->relocation != NULL) return true; @@ -1397,9 +1412,8 @@ elf_slurp_reloc_table (abfd, asect, symb reloc_count2 = 0; } - relents = ((arelent *) - bfd_alloc (abfd, - (reloc_count + reloc_count2) * sizeof (arelent))); + amt = (reloc_count + reloc_count2) * sizeof (arelent); + relents = (arelent *) bfd_alloc (abfd, amt); if (relents == NULL) return false; diff -uprN binutils-2.11.90.0.31/bfd/elfcore.h binutils-2.11.92.0.5/bfd/elfcore.h --- binutils-2.11.90.0.31/bfd/elfcore.h Fri Jul 6 09:26:10 2001 +++ binutils-2.11.92.0.5/bfd/elfcore.h Mon Oct 1 15:25:21 2001 @@ -86,9 +86,11 @@ elf_core_file_p (abfd) struct elf_backend_data *ebd; struct elf_obj_tdata *preserved_tdata = elf_tdata (abfd); struct elf_obj_tdata *new_tdata = NULL; + bfd_size_type amt; /* Read in the ELF header in external format. */ - if (bfd_read ((PTR) & x_ehdr, sizeof (x_ehdr), 1, abfd) != sizeof (x_ehdr)) + if (bfd_bread ((PTR) &x_ehdr, (bfd_size_type) sizeof (x_ehdr), abfd) + != sizeof (x_ehdr)) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -121,8 +123,8 @@ elf_core_file_p (abfd) } /* Give abfd an elf_obj_tdata. */ - new_tdata = - (struct elf_obj_tdata *) bfd_zalloc (abfd, sizeof (struct elf_obj_tdata)); + amt = sizeof (struct elf_obj_tdata); + new_tdata = (struct elf_obj_tdata *) bfd_zalloc (abfd, amt); if (new_tdata == NULL) return NULL; elf_tdata (abfd) = new_tdata; @@ -181,12 +183,12 @@ elf_core_file_p (abfd) goto wrong; /* Move to the start of the program headers. */ - if (bfd_seek (abfd, i_ehdrp->e_phoff, SEEK_SET) != 0) + if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_phoff, SEEK_SET) != 0) goto wrong; /* Allocate space for the program headers. */ - i_phdrp = (Elf_Internal_Phdr *) - bfd_alloc (abfd, sizeof (*i_phdrp) * i_ehdrp->e_phnum); + amt = sizeof (*i_phdrp) * i_ehdrp->e_phnum; + i_phdrp = (Elf_Internal_Phdr *) bfd_alloc (abfd, amt); if (!i_phdrp) goto fail; @@ -196,7 +198,7 @@ elf_core_file_p (abfd) for (phindex = 0; phindex < i_ehdrp->e_phnum; ++phindex) { Elf_External_Phdr x_phdr; - if (bfd_read ((PTR) &x_phdr, sizeof (x_phdr), 1, abfd) + if (bfd_bread ((PTR) &x_phdr, (bfd_size_type) sizeof (x_phdr), abfd) != sizeof (x_phdr)) goto fail; @@ -206,7 +208,7 @@ elf_core_file_p (abfd) /* Process each program header. */ for (phindex = 0; phindex < i_ehdrp->e_phnum; ++phindex) { - if (! bfd_section_from_phdr (abfd, i_phdrp + phindex, phindex)) + if (! bfd_section_from_phdr (abfd, i_phdrp + phindex, (int) phindex)) goto fail; } diff -uprN binutils-2.11.90.0.31/bfd/elflink.c binutils-2.11.92.0.5/bfd/elflink.c --- binutils-2.11.90.0.31/bfd/elflink.c Fri Aug 10 14:08:01 2001 +++ binutils-2.11.92.0.5/bfd/elflink.c Mon Oct 1 15:25:21 2001 @@ -278,10 +278,10 @@ _bfd_elf_link_record_dynamic_symbol (inf } else { - alc = bfd_malloc (p - name + 1); + alc = bfd_malloc ((bfd_size_type) (p - name + 1)); if (alc == NULL) return false; - strncpy (alc, name, p - name); + strncpy (alc, name, (size_t) (p - name)); alc[p - name] = '\0'; name = alc; copy = true; @@ -397,9 +397,9 @@ _bfd_elf_create_linker_section (abfd, in if (!lsect) { asection *s; + bfd_size_type amt = sizeof (elf_linker_section_t); - lsect = (elf_linker_section_t *) - bfd_alloc (dynobj, sizeof (elf_linker_section_t)); + lsect = (elf_linker_section_t *) bfd_alloc (dynobj, amt); *lsect = *defaults; elf_linker_section (dynobj, which) = lsect; @@ -431,10 +431,10 @@ _bfd_elf_create_linker_section (abfd, in s->_raw_size += lsect->hole_size; if (lsect->hole_offset > lsect->max_hole_offset) { - (*_bfd_error_handler) (_("%s: Section %s is already to large to put hole of %ld bytes in"), + (*_bfd_error_handler) (_("%s: Section %s is too large to add hole of %ld bytes"), bfd_get_filename (abfd), lsect->name, - (long)lsect->hole_size); + (long) lsect->hole_size); bfd_set_error (bfd_error_bad_value); return (elf_linker_section_t *)0; @@ -506,7 +506,7 @@ _bfd_elf_create_linker_section (abfd, in elf_linker_section_pointers_t * _bfd_elf_find_pointer_linker_section (linker_pointers, addend, which) elf_linker_section_pointers_t *linker_pointers; - bfd_signed_vma addend; + bfd_vma addend; elf_linker_section_enum_t which; { for ( ; linker_pointers != NULL; linker_pointers = linker_pointers->next) diff -uprN binutils-2.11.90.0.31/bfd/elflink.h binutils-2.11.92.0.5/bfd/elflink.h --- binutils-2.11.90.0.31/bfd/elflink.h Wed Oct 3 13:53:08 2001 +++ binutils-2.11.92.0.5/bfd/elflink.h Fri Oct 5 14:11:21 2001 @@ -97,13 +97,15 @@ elf_link_check_versioned_symbol (info, h { bfd *input; Elf_Internal_Shdr *hdr; - size_t symcount; - size_t extsymcount; - size_t extsymoff; + bfd_size_type symcount; + bfd_size_type extsymcount; + bfd_size_type extsymoff; Elf_Internal_Shdr *versymhdr; Elf_External_Versym *ever; Elf_External_Sym *esym; Elf_External_Sym *esymend; + bfd_size_type count; + file_ptr pos; input = loaded->abfd; @@ -136,13 +138,10 @@ elf_link_check_versioned_symbol (info, h goto no_memory; /* Read in the symbol table. */ - if (bfd_seek (input, - hdr->sh_offset - + extsymoff * sizeof (Elf_External_Sym), - SEEK_SET) != 0 - || (bfd_read ((PTR) buf, sizeof (Elf_External_Sym), - extsymcount, input) - != extsymcount * sizeof (Elf_External_Sym))) + pos = hdr->sh_offset + extsymoff * sizeof (Elf_External_Sym); + count = extsymcount * sizeof (Elf_External_Sym); + if (bfd_seek (input, pos, SEEK_SET) != 0 + || bfd_bread ((PTR) buf, count, input) != count) goto error_return; /* Read in any version definitions. */ @@ -153,8 +152,8 @@ elf_link_check_versioned_symbol (info, h goto no_memory; if (bfd_seek (input, versymhdr->sh_offset, SEEK_SET) != 0 - || (bfd_read ((PTR) extversym, 1, versymhdr->sh_size, input) - != versymhdr->sh_size)) + || bfd_bread ((PTR) extversym, versymhdr->sh_size, input) + != versymhdr->sh_size) goto error_return; ever = extversym + extsymoff; @@ -285,10 +284,12 @@ elf_link_is_defined_archive_symbol (abfd Elf_External_Sym * esym; Elf_External_Sym * esymend; Elf_External_Sym * buf = NULL; - size_t symcount; - size_t extsymcount; - size_t extsymoff; + bfd_size_type symcount; + bfd_size_type extsymcount; + bfd_size_type extsymoff; boolean result = false; + file_ptr pos; + bfd_size_type amt; abfd = _bfd_get_elt_at_filepos (abfd, symdef->file_offset); if (abfd == (bfd *) NULL) @@ -325,18 +326,16 @@ elf_link_is_defined_archive_symbol (abfd extsymoff = hdr->sh_info; } - buf = ((Elf_External_Sym *) - bfd_malloc (extsymcount * sizeof (Elf_External_Sym))); + amt = extsymcount * sizeof (Elf_External_Sym); + buf = (Elf_External_Sym *) bfd_malloc (amt); if (buf == NULL && extsymcount != 0) return false; /* Read in the symbol table. FIXME: This ought to be cached somewhere. */ - if (bfd_seek (abfd, - hdr->sh_offset + extsymoff * sizeof (Elf_External_Sym), - SEEK_SET) != 0 - || (bfd_read ((PTR) buf, sizeof (Elf_External_Sym), extsymcount, abfd) - != extsymcount * sizeof (Elf_External_Sym))) + pos = hdr->sh_offset + extsymoff * sizeof (Elf_External_Sym); + if (bfd_seek (abfd, pos, SEEK_SET) != 0 + || bfd_bread ((PTR) buf, amt, abfd) != amt) { free (buf); return false; @@ -404,6 +403,7 @@ elf_link_add_archive_symbols (abfd, info boolean *included = NULL; carsym *symdefs; boolean loop; + bfd_size_type amt; if (! bfd_has_map (abfd)) { @@ -420,12 +420,14 @@ elf_link_add_archive_symbols (abfd, info c = bfd_ardata (abfd)->symdef_count; if (c == 0) return true; - defined = (boolean *) bfd_malloc (c * sizeof (boolean)); - included = (boolean *) bfd_malloc (c * sizeof (boolean)); + amt = c; + amt *= sizeof (boolean); + defined = (boolean *) bfd_malloc (amt); + included = (boolean *) bfd_malloc (amt); if (defined == (boolean *) NULL || included == (boolean *) NULL) goto error_return; - memset (defined, 0, c * sizeof (boolean)); - memset (included, 0, c * sizeof (boolean)); + memset (defined, 0, (size_t) amt); + memset (included, 0, (size_t) amt); symdefs = bfd_ardata (abfd)->symdefs; @@ -477,7 +479,8 @@ elf_link_add_archive_symbols (abfd, info copy = bfd_alloc (abfd, strlen (symdef->name)); if (copy == NULL) goto error_return; - memcpy (copy, symdef->name, p - symdef->name + 1); + memcpy (copy, symdef->name, + (size_t) (p - symdef->name + 1)); strcpy (© [p - symdef->name + 1], &symdef->name [p - symdef->name + 2]); @@ -1049,9 +1052,9 @@ elf_link_add_object_symbols (abfd, info) asection *, const Elf_Internal_Rela *)); boolean collect; Elf_Internal_Shdr *hdr; - size_t symcount; - size_t extsymcount; - size_t extsymoff; + bfd_size_type symcount; + bfd_size_type extsymcount; + bfd_size_type extsymoff; Elf_External_Sym *buf = NULL; struct elf_link_hash_entry **sym_hash; boolean dynamic; @@ -1064,6 +1067,8 @@ elf_link_add_object_symbols (abfd, info) struct elf_backend_data *bed; boolean dt_needed; struct elf_link_hash_table * hash_table; + file_ptr pos; + bfd_size_type amt; hash_table = elf_hash_table (info); @@ -1188,9 +1193,9 @@ elf_link_add_object_symbols (abfd, info) extversym = (Elf_External_Versym *) bfd_malloc (versymhdr->sh_size); if (extversym == NULL) goto error_return; + amt = versymhdr->sh_size; if (bfd_seek (abfd, versymhdr->sh_offset, SEEK_SET) != 0 - || (bfd_read ((PTR) extversym, 1, versymhdr->sh_size, abfd) - != versymhdr->sh_size)) + || bfd_bread ((PTR) extversym, amt, abfd) != amt) goto error_return; } } @@ -1211,16 +1216,15 @@ elf_link_add_object_symbols (abfd, info) extsymoff = hdr->sh_info; } - buf = ((Elf_External_Sym *) - bfd_malloc (extsymcount * sizeof (Elf_External_Sym))); + amt = extsymcount * sizeof (Elf_External_Sym); + buf = (Elf_External_Sym *) bfd_malloc (amt); if (buf == NULL && extsymcount != 0) goto error_return; /* We store a pointer to the hash table entry for each external symbol. */ - sym_hash = ((struct elf_link_hash_entry **) - bfd_alloc (abfd, - extsymcount * sizeof (struct elf_link_hash_entry *))); + amt = extsymcount * sizeof (struct elf_link_hash_entry *); + sym_hash = (struct elf_link_hash_entry **) bfd_alloc (abfd, amt); if (sym_hash == NULL) goto error_return; elf_sym_hashes (abfd) = sym_hash; @@ -1279,11 +1283,11 @@ elf_link_add_object_symbols (abfd, info) Elf_External_Dyn *extdyn; Elf_External_Dyn *extdynend; int elfsec; - unsigned long link; + unsigned long shlink; int rpath; int runpath; - dynbuf = (Elf_External_Dyn *) bfd_malloc ((size_t) s->_raw_size); + dynbuf = (Elf_External_Dyn *) bfd_malloc (s->_raw_size); if (dynbuf == NULL) goto error_return; @@ -1294,22 +1298,22 @@ elf_link_add_object_symbols (abfd, info) elfsec = _bfd_elf_section_from_bfd_section (abfd, s); if (elfsec == -1) goto error_return; - link = elf_elfsections (abfd)[elfsec]->sh_link; + shlink = elf_elfsections (abfd)[elfsec]->sh_link; { /* The shared libraries distributed with hpux11 have a bogus sh_link field for the ".dynamic" section. This code detects - when LINK refers to a section that is not a string table and - tries to find the string table for the ".dynsym" section + when SHLINK refers to a section that is not a string table + and tries to find the string table for the ".dynsym" section instead. */ - Elf_Internal_Shdr *hdr = elf_elfsections (abfd)[link]; - if (hdr->sh_type != SHT_STRTAB) + Elf_Internal_Shdr *shdr = elf_elfsections (abfd)[shlink]; + if (shdr->sh_type != SHT_STRTAB) { - asection *s = bfd_get_section_by_name (abfd, ".dynsym"); - int elfsec = _bfd_elf_section_from_bfd_section (abfd, s); - if (elfsec == -1) + asection *ds = bfd_get_section_by_name (abfd, ".dynsym"); + int elfdsec = _bfd_elf_section_from_bfd_section (abfd, ds); + if (elfdsec == -1) goto error_return; - link = elf_elfsections (abfd)[elfsec]->sh_link; + shlink = elf_elfsections (abfd)[elfdsec]->sh_link; } } @@ -1324,8 +1328,8 @@ elf_link_add_object_symbols (abfd, info) elf_swap_dyn_in (abfd, extdyn, &dyn); if (dyn.d_tag == DT_SONAME) { - name = bfd_elf_string_from_elf_section (abfd, link, - dyn.d_un.d_val); + unsigned int tagv = dyn.d_un.d_val; + name = bfd_elf_string_from_elf_section (abfd, shlink, tagv); if (name == NULL) goto error_return; } @@ -1333,14 +1337,14 @@ elf_link_add_object_symbols (abfd, info) { struct bfd_link_needed_list *n, **pn; char *fnm, *anm; + unsigned int tagv = dyn.d_un.d_val; - n = ((struct bfd_link_needed_list *) - bfd_alloc (abfd, sizeof (struct bfd_link_needed_list))); - fnm = bfd_elf_string_from_elf_section (abfd, link, - dyn.d_un.d_val); + amt = sizeof (struct bfd_link_needed_list); + n = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt); + fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv); if (n == NULL || fnm == NULL) goto error_return; - anm = bfd_alloc (abfd, strlen (fnm) + 1); + anm = bfd_alloc (abfd, (bfd_size_type) strlen (fnm) + 1); if (anm == NULL) goto error_return; strcpy (anm, fnm); @@ -1357,6 +1361,7 @@ elf_link_add_object_symbols (abfd, info) { struct bfd_link_needed_list *n, **pn; char *fnm, *anm; + unsigned int tagv = dyn.d_un.d_val; /* When we see DT_RPATH before DT_RUNPATH, we have to clear runpath. Do _NOT_ bfd_release, as that @@ -1365,13 +1370,12 @@ elf_link_add_object_symbols (abfd, info) if (rpath && hash_table->runpath) hash_table->runpath = NULL; - n = ((struct bfd_link_needed_list *) - bfd_alloc (abfd, sizeof (struct bfd_link_needed_list))); - fnm = bfd_elf_string_from_elf_section (abfd, link, - dyn.d_un.d_val); + amt = sizeof (struct bfd_link_needed_list); + n = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt); + fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv); if (n == NULL || fnm == NULL) goto error_return; - anm = bfd_alloc (abfd, strlen (fnm) + 1); + anm = bfd_alloc (abfd, (bfd_size_type) strlen (fnm) + 1); if (anm == NULL) goto error_return; strcpy (anm, fnm); @@ -1391,14 +1395,14 @@ elf_link_add_object_symbols (abfd, info) { struct bfd_link_needed_list *n, **pn; char *fnm, *anm; + unsigned int tagv = dyn.d_un.d_val; - n = ((struct bfd_link_needed_list *) - bfd_alloc (abfd, sizeof (struct bfd_link_needed_list))); - fnm = bfd_elf_string_from_elf_section (abfd, link, - dyn.d_un.d_val); + amt = sizeof (struct bfd_link_needed_list); + n = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt); + fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv); if (n == NULL || fnm == NULL) goto error_return; - anm = bfd_alloc (abfd, strlen (fnm) + 1); + anm = bfd_alloc (abfd, (bfd_size_type) strlen (fnm) + 1); if (anm == NULL) goto error_return; strcpy (anm, fnm); @@ -1476,7 +1480,7 @@ elf_link_add_object_symbols (abfd, info) } } - if (! elf_add_dynamic_entry (info, DT_NEEDED, strindex)) + if (! elf_add_dynamic_entry (info, (bfd_vma) DT_NEEDED, strindex)) goto error_return; } @@ -1487,11 +1491,10 @@ elf_link_add_object_symbols (abfd, info) elf_dt_name (abfd) = name; } - if (bfd_seek (abfd, - hdr->sh_offset + extsymoff * sizeof (Elf_External_Sym), - SEEK_SET) != 0 - || (bfd_read ((PTR) buf, sizeof (Elf_External_Sym), extsymcount, abfd) - != extsymcount * sizeof (Elf_External_Sym))) + pos = hdr->sh_offset + extsymoff * sizeof (Elf_External_Sym); + amt = extsymcount * sizeof (Elf_External_Sym); + if (bfd_seek (abfd, pos, SEEK_SET) != 0 + || bfd_bread ((PTR) buf, amt, abfd) != amt) goto error_return; weaks = NULL; @@ -1619,7 +1622,8 @@ elf_link_add_object_symbols (abfd, info) || (vernum > 1 && ! bfd_is_abs_section (sec))) { const char *verstr; - int namelen, newlen; + unsigned int namelen; + bfd_size_type newlen; char *newname, *p; if (sym.st_shndx != SHN_UNDEF) @@ -1628,7 +1632,7 @@ elf_link_add_object_symbols (abfd, info) { (*_bfd_error_handler) (_("%s: %s: invalid version %u (max %d)"), - bfd_get_filename (abfd), name, vernum, + bfd_archive_filename (abfd), name, vernum, elf_tdata (abfd)->dynverdef_hdr.sh_info); bfd_set_error (bfd_error_bad_value); goto error_return; @@ -1669,7 +1673,7 @@ elf_link_add_object_symbols (abfd, info) { (*_bfd_error_handler) (_("%s: %s: invalid needed version %d"), - bfd_get_filename (abfd), name, vernum); + bfd_archive_filename (abfd), name, vernum); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -1790,7 +1794,7 @@ elf_link_add_object_symbols (abfd, info) (*_bfd_error_handler) (_("Warning: size of symbol `%s' changed from %lu to %lu in %s"), name, (unsigned long) h->size, (unsigned long) sym.st_size, - bfd_get_filename (abfd)); + bfd_archive_filename (abfd)); h->size = sym.st_size; } @@ -1812,7 +1816,7 @@ elf_link_add_object_symbols (abfd, info) (*_bfd_error_handler) (_("Warning: type of symbol `%s' changed from %d to %d in %s"), name, h->type, ELF_ST_TYPE (sym.st_info), - bfd_get_filename (abfd)); + bfd_archive_filename (abfd)); h->type = ELF_ST_TYPE (sym.st_info); } @@ -1891,10 +1895,10 @@ elf_link_add_object_symbols (abfd, info) boolean override; shortname = bfd_hash_allocate (&info->hash->table, - p - name + 1); + (size_t) (p - name + 1)); if (shortname == NULL) goto error_return; - strncpy (shortname, name, p - name); + strncpy (shortname, name, (size_t) (p - name)); shortname[p - name] = '\0'; /* We are going to create a new symbol. Merge it @@ -2016,7 +2020,7 @@ elf_link_add_object_symbols (abfd, info) strlen (name)); if (shortname == NULL) goto error_return; - strncpy (shortname, name, p - name); + strncpy (shortname, name, (size_t) (p - name)); strcpy (shortname + (p - name), p + 1); /* Once again, merge with any existing symbol. */ @@ -2035,7 +2039,7 @@ elf_link_add_object_symbols (abfd, info) do in the case above. */ (*_bfd_error_handler) (_("%s: warning: unexpected redefinition of `%s'"), - bfd_get_filename (abfd), shortname); + bfd_archive_filename (abfd), shortname); } else { @@ -2157,7 +2161,7 @@ elf_link_add_object_symbols (abfd, info) } } - if (! elf_add_dynamic_entry (info, DT_NEEDED, strindex)) + if (! elf_add_dynamic_entry (info, (bfd_vma) DT_NEEDED, strindex)) goto error_return; } } @@ -2512,7 +2516,7 @@ elf_add_dynamic_entry (info, tag, val) Elf_Internal_Dyn dyn; bfd *dynobj; asection *s; - size_t newsize; + bfd_size_type newsize; bfd_byte *newcontents; if (! is_elf_hash_table (info)) @@ -2553,6 +2557,8 @@ elf_link_record_local_dynamic_symbol (in Elf_External_Sym esym; unsigned long dynstr_index; char *name; + file_ptr pos; + bfd_size_type amt; if (! is_elf_hash_table (info)) return false; @@ -2563,17 +2569,15 @@ elf_link_record_local_dynamic_symbol (in return true; entry = (struct elf_link_local_dynamic_entry *) - bfd_alloc (input_bfd, sizeof (*entry)); + bfd_alloc (input_bfd, (bfd_size_type) sizeof (*entry)); if (entry == NULL) return false; /* Go find the symbol, so that we can find it's name. */ - if (bfd_seek (input_bfd, - (elf_tdata (input_bfd)->symtab_hdr.sh_offset - + input_indx * sizeof (Elf_External_Sym)), - SEEK_SET) != 0 - || (bfd_read (&esym, sizeof (Elf_External_Sym), 1, input_bfd) - != sizeof (Elf_External_Sym))) + amt = sizeof (Elf_External_Sym); + pos = elf_tdata (input_bfd)->symtab_hdr.sh_offset + input_indx * amt; + if (bfd_seek (input_bfd, pos, SEEK_SET) != 0 + || bfd_bread (&esym, amt, input_bfd) != amt) return false; elf_swap_symbol_in (input_bfd, &esym, &entry->isym); @@ -2630,6 +2634,7 @@ elf_link_read_relocs_from_section (abfd, Elf_Internal_Rela *internal_relocs; { struct elf_backend_data *bed; + bfd_size_type amt; /* If there aren't any relocations, that's OK. */ if (!shdr) @@ -2640,8 +2645,7 @@ elf_link_read_relocs_from_section (abfd, return false; /* Read the relocations. */ - if (bfd_read (external_relocs, 1, shdr->sh_size, abfd) - != shdr->sh_size) + if (bfd_bread (external_relocs, shdr->sh_size, abfd) != shdr->sh_size) return false; bed = get_elf_backend_data (abfd); @@ -2657,8 +2661,8 @@ elf_link_read_relocs_from_section (abfd, erel = (Elf_External_Rel *) external_relocs; erelend = erel + NUM_SHDR_ENTRIES (shdr); irela = internal_relocs; - irel = bfd_alloc (abfd, (bed->s->int_rels_per_ext_rel - * sizeof (Elf_Internal_Rel))); + amt = bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rel); + irel = bfd_alloc (abfd, amt); for (; erel < erelend; erel++, irela += bed->s->int_rels_per_ext_rel) { unsigned int i; @@ -2733,10 +2737,10 @@ NAME(_bfd_elf,link_read_relocs) (abfd, o if (internal_relocs == NULL) { - size_t size; + bfd_size_type size; - size = (o->reloc_count * bed->s->int_rels_per_ext_rel - * sizeof (Elf_Internal_Rela)); + size = o->reloc_count; + size *= bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rela); if (keep_memory) internal_relocs = (Elf_Internal_Rela *) bfd_alloc (abfd, size); else @@ -2747,10 +2751,10 @@ NAME(_bfd_elf,link_read_relocs) (abfd, o if (external_relocs == NULL) { - size_t size = (size_t) rel_hdr->sh_size; + bfd_size_type size = rel_hdr->sh_size; if (elf_section_data (o)->rel_hdr2) - size += (size_t) elf_section_data (o)->rel_hdr2->sh_size; + size += elf_section_data (o)->rel_hdr2->sh_size; alloc1 = (PTR) bfd_malloc (size); if (alloc1 == NULL) goto error_return; @@ -2916,12 +2920,14 @@ compute_bucket_count (info) unsigned long int *hashcodes; unsigned long int *hashcodesp; unsigned long int i; + bfd_size_type amt; /* Compute the hash values for all exported symbols. At the same time store the values in an array so that we could use them for optimizations. */ - hashcodes = (unsigned long int *) bfd_malloc (dynsymcount - * sizeof (unsigned long int)); + amt = dynsymcount; + amt *= sizeof (unsigned long int); + hashcodes = (unsigned long int *) bfd_malloc (amt); if (hashcodes == NULL) return 0; hashcodesp = hashcodes; @@ -2952,8 +2958,9 @@ compute_bucket_count (info) /* Create array where we count the collisions in. We must use bfd_malloc since the size could be large. */ - counts = (unsigned long int *) bfd_malloc (maxsize - * sizeof (unsigned long int)); + amt = maxsize; + amt *= sizeof (unsigned long int); + counts = (unsigned long int *) bfd_malloc (amt); if (counts == NULL) { free (hashcodes); @@ -3076,6 +3083,10 @@ NAME(bfd_elf,size_dynamic_sections) (out if (! is_elf_hash_table (info)) return false; + /* Any syms created from now on start with -1 in + got.refcount/offset and plt.refcount/offset. */ + elf_hash_table (info)->init_refcount = -1; + /* The backend may have to create some sections regardless of whether we're dynamic or not. */ bed = get_elf_backend_data (output_bfd); @@ -3104,13 +3115,15 @@ NAME(bfd_elf,size_dynamic_sections) (out soname_indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr, soname, true, true); if (soname_indx == (bfd_size_type) -1 - || ! elf_add_dynamic_entry (info, DT_SONAME, soname_indx)) + || ! elf_add_dynamic_entry (info, (bfd_vma) DT_SONAME, + soname_indx)) return false; } if (info->symbolic) { - if (! elf_add_dynamic_entry (info, DT_SYMBOLIC, 0)) + if (! elf_add_dynamic_entry (info, (bfd_vma) DT_SYMBOLIC, + (bfd_vma) 0)) return false; info->flags |= DF_SYMBOLIC; } @@ -3122,9 +3135,10 @@ NAME(bfd_elf,size_dynamic_sections) (out indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr, rpath, true, true); if (indx == (bfd_size_type) -1 - || ! elf_add_dynamic_entry (info, DT_RPATH, indx) + || ! elf_add_dynamic_entry (info, (bfd_vma) DT_RPATH, indx) || (info->new_dtags - && ! elf_add_dynamic_entry (info, DT_RUNPATH, indx))) + && ! elf_add_dynamic_entry (info, (bfd_vma) DT_RUNPATH, + indx))) return false; } @@ -3135,7 +3149,7 @@ NAME(bfd_elf,size_dynamic_sections) (out indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr, filter_shlib, true, true); if (indx == (bfd_size_type) -1 - || ! elf_add_dynamic_entry (info, DT_FILTER, indx)) + || ! elf_add_dynamic_entry (info, (bfd_vma) DT_FILTER, indx)) return false; } @@ -3150,7 +3164,8 @@ NAME(bfd_elf,size_dynamic_sections) (out indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr, *p, true, true); if (indx == (bfd_size_type) -1 - || ! elf_add_dynamic_entry (info, DT_AUXILIARY, indx)) + || ! elf_add_dynamic_entry (info, (bfd_vma) DT_AUXILIARY, + indx)) return false; } } @@ -3204,7 +3219,7 @@ NAME(bfd_elf,size_dynamic_sections) (out && (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR | ELF_LINK_HASH_DEF_REGULAR)) != 0) { - if (! elf_add_dynamic_entry (info, DT_INIT, 0)) + if (! elf_add_dynamic_entry (info, (bfd_vma) DT_INIT, (bfd_vma) 0)) return false; } h = (info->fini_function @@ -3216,7 +3231,7 @@ NAME(bfd_elf,size_dynamic_sections) (out && (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR | ELF_LINK_HASH_DEF_REGULAR)) != 0) { - if (! elf_add_dynamic_entry (info, DT_FINI, 0)) + if (! elf_add_dynamic_entry (info, (bfd_vma) DT_FINI, (bfd_vma) 0)) return false; } @@ -3230,12 +3245,12 @@ NAME(bfd_elf,size_dynamic_sections) (out bfd_size_type strsize; strsize = _bfd_stringtab_size (elf_hash_table (info)->dynstr); - if (! elf_add_dynamic_entry (info, DT_HASH, 0) - || ! elf_add_dynamic_entry (info, DT_STRTAB, 0) - || ! elf_add_dynamic_entry (info, DT_SYMTAB, 0) - || ! elf_add_dynamic_entry (info, DT_STRSZ, strsize) - || ! elf_add_dynamic_entry (info, DT_SYMENT, - sizeof (Elf_External_Sym))) + if (! elf_add_dynamic_entry (info, (bfd_vma) DT_HASH, (bfd_vma) 0) + || ! elf_add_dynamic_entry (info, (bfd_vma) DT_STRTAB, (bfd_vma) 0) + || ! elf_add_dynamic_entry (info, (bfd_vma) DT_SYMTAB, (bfd_vma) 0) + || ! elf_add_dynamic_entry (info, (bfd_vma) DT_STRSZ, strsize) + || ! elf_add_dynamic_entry (info, (bfd_vma) DT_SYMENT, + (bfd_vma) sizeof (Elf_External_Sym))) return false; } } @@ -3248,7 +3263,7 @@ NAME(bfd_elf,size_dynamic_sections) (out if (elf_hash_table (info)->dynamic_sections_created) { - size_t dynsymcount; + bfd_size_type dynsymcount; asection *s; size_t bucketcount = 0; size_t hash_entry_size; @@ -3413,8 +3428,9 @@ NAME(bfd_elf,size_dynamic_sections) (out } } - if (! elf_add_dynamic_entry (info, DT_VERDEF, 0) - || ! elf_add_dynamic_entry (info, DT_VERDEFNUM, cdefs)) + if (! elf_add_dynamic_entry (info, (bfd_vma) DT_VERDEF, (bfd_vma) 0) + || ! elf_add_dynamic_entry (info, (bfd_vma) DT_VERDEFNUM, + (bfd_vma) cdefs)) return false; elf_tdata (output_bfd)->cverdefs = cdefs; @@ -3422,7 +3438,7 @@ NAME(bfd_elf,size_dynamic_sections) (out if (info->new_dtags && info->flags) { - if (! elf_add_dynamic_entry (info, DT_FLAGS, info->flags)) + if (! elf_add_dynamic_entry (info, (bfd_vma) DT_FLAGS, info->flags)) return false; } @@ -3432,7 +3448,8 @@ NAME(bfd_elf,size_dynamic_sections) (out info->flags_1 &= ~ (DF_1_INITFIRST | DF_1_NODELETE | DF_1_NOOPEN); - if (! elf_add_dynamic_entry (info, DT_FLAGS_1, info->flags_1)) + if (! elf_add_dynamic_entry (info, (bfd_vma) DT_FLAGS_1, + info->flags_1)) return false; } @@ -3479,7 +3496,7 @@ NAME(bfd_elf,size_dynamic_sections) (out } s->_raw_size = size; - s->contents = (bfd_byte *) bfd_alloc (output_bfd, size); + s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size); if (s->contents == NULL) return false; @@ -3539,8 +3556,10 @@ NAME(bfd_elf,size_dynamic_sections) (out } } - if (! elf_add_dynamic_entry (info, DT_VERNEED, 0) - || ! elf_add_dynamic_entry (info, DT_VERNEEDNUM, crefs)) + if (! elf_add_dynamic_entry (info, (bfd_vma) DT_VERNEED, + (bfd_vma) 0) + || ! elf_add_dynamic_entry (info, (bfd_vma) DT_VERNEEDNUM, + (bfd_vma) crefs)) return false; elf_tdata (output_bfd)->cverrefs = crefs; @@ -3572,7 +3591,7 @@ NAME(bfd_elf,size_dynamic_sections) (out if (s->contents == NULL) return false; - if (! elf_add_dynamic_entry (info, DT_VERSYM, 0)) + if (! elf_add_dynamic_entry (info, (bfd_vma) DT_VERSYM, (bfd_vma) 0)) return false; } @@ -3617,8 +3636,9 @@ NAME(bfd_elf,size_dynamic_sections) (out return false; memset (s->contents, 0, (size_t) s->_raw_size); - bfd_put (8 * hash_entry_size, output_bfd, bucketcount, s->contents); - bfd_put (8 * hash_entry_size, output_bfd, dynsymcount, + bfd_put (8 * hash_entry_size, output_bfd, (bfd_vma) bucketcount, + s->contents); + bfd_put (8 * hash_entry_size, output_bfd, (bfd_vma) dynsymcount, s->contents + hash_entry_size); elf_hash_table (info)->bucketcount = bucketcount; @@ -3628,7 +3648,7 @@ NAME(bfd_elf,size_dynamic_sections) (out s->_raw_size = _bfd_stringtab_size (elf_hash_table (info)->dynstr); for (dtagcount = 0; dtagcount <= info->spare_dynamic_tags; ++dtagcount) - if (! elf_add_dynamic_entry (info, DT_NULL, 0)) + if (! elf_add_dynamic_entry (info, (bfd_vma) DT_NULL, (bfd_vma) 0)) return false; } @@ -3758,11 +3778,12 @@ elf_fix_symbol_flags (h, eif) if ((weakdef->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0) h->weakdef = NULL; else - weakdef->elf_link_hash_flags |= - (h->elf_link_hash_flags - & (ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK - | ELF_LINK_NON_GOT_REF)); + { + struct elf_backend_data *bed; + + bed = get_elf_backend_data (elf_hash_table (eif->info)->dynobj); + (*bed->elf_backend_copy_indirect_symbol) (weakdef, h); + } } return true; @@ -3952,6 +3973,7 @@ elf_link_find_version_dependencies (h, d struct elf_find_verdep_info *rinfo = (struct elf_find_verdep_info *) data; Elf_Internal_Verneed *t; Elf_Internal_Vernaux *a; + bfd_size_type amt; /* We only care about symbols defined in shared objects with version information. */ @@ -3978,7 +4000,8 @@ elf_link_find_version_dependencies (h, d if (t == NULL) { - t = (Elf_Internal_Verneed *) bfd_zalloc (rinfo->output_bfd, sizeof *t); + amt = sizeof *t; + t = (Elf_Internal_Verneed *) bfd_zalloc (rinfo->output_bfd, amt); if (t == NULL) { rinfo->failed = true; @@ -3990,7 +4013,8 @@ elf_link_find_version_dependencies (h, d elf_tdata (rinfo->output_bfd)->verref = t; } - a = (Elf_Internal_Vernaux *) bfd_zalloc (rinfo->output_bfd, sizeof *a); + amt = sizeof *a; + a = (Elf_Internal_Vernaux *) bfd_zalloc (rinfo->output_bfd, amt); /* Note that we are copying a string pointer here, and testing it above. If bfd_elf_string_from_elf_section is ever changed to @@ -4021,12 +4045,15 @@ elf_link_assign_sym_version (h, data) struct elf_link_hash_entry *h; PTR data; { - struct elf_assign_sym_version_info *sinfo = - (struct elf_assign_sym_version_info *) data; - struct bfd_link_info *info = sinfo->info; + struct elf_assign_sym_version_info *sinfo; + struct bfd_link_info *info; struct elf_backend_data *bed; struct elf_info_failed eif; char *p; + bfd_size_type amt; + + sinfo = (struct elf_assign_sym_version_info *) data; + info = sinfo->info; /* Fix the symbol flags. */ eif.failed = false; @@ -4074,12 +4101,12 @@ elf_link_assign_sym_version (h, data) { if (strcmp (t->name, p) == 0) { - int len; + size_t len; char *alc; struct bfd_elf_version_expr *d; len = p - h->root.root.string; - alc = bfd_alloc (sinfo->output_bfd, len); + alc = bfd_alloc (sinfo->output_bfd, (bfd_size_type) len); if (alc == NULL) return false; strncpy (alc, h->root.root.string, len - 1); @@ -4139,8 +4166,9 @@ elf_link_assign_sym_version (h, data) if (h->dynindx == -1) return true; + amt = sizeof *t; t = ((struct bfd_elf_version_tree *) - bfd_alloc (sinfo->output_bfd, sizeof *t)); + bfd_alloc (sinfo->output_bfd, amt)); if (t == NULL) { sinfo->failed = true; @@ -4332,8 +4360,8 @@ elf_link_size_reloc_section (abfd, rel_h Elf_Internal_Shdr *rel_hdr; asection *o; { - unsigned reloc_count; - unsigned num_rel_hashes; + bfd_size_type reloc_count; + bfd_size_type num_rel_hashes; /* Figure out how many relocations there will be. */ if (rel_hdr == &elf_section_data (o)->rel_hdr) @@ -4344,7 +4372,7 @@ elf_link_size_reloc_section (abfd, rel_h num_rel_hashes = o->reloc_count; if (num_rel_hashes < reloc_count) num_rel_hashes = reloc_count; - + /* That allows us to calculate the size of the section. */ rel_hdr->sh_size = rel_hdr->sh_entsize * reloc_count; @@ -4391,17 +4419,17 @@ elf_link_adjust_relocs (abfd, rel_hdr, c struct elf_backend_data *bed = get_elf_backend_data (abfd); Elf_Internal_Rel *irel; Elf_Internal_Rela *irela; + bfd_size_type amt = sizeof (Elf_Internal_Rel) * bed->s->int_rels_per_ext_rel; - irel = (Elf_Internal_Rel *) bfd_zmalloc (sizeof (Elf_Internal_Rel) - * bed->s->int_rels_per_ext_rel); + irel = (Elf_Internal_Rel *) bfd_zmalloc (amt); if (irel == NULL) { (*_bfd_error_handler) (_("Error: out of memory")); abort (); } - irela = (Elf_Internal_Rela *) bfd_zmalloc (sizeof (Elf_Internal_Rela) - * bed->s->int_rels_per_ext_rel); + amt = sizeof (Elf_Internal_Rela) * bed->s->int_rels_per_ext_rel; + irela = (Elf_Internal_Rela *) bfd_zmalloc (amt); if (irela == NULL) { (*_bfd_error_handler) (_("Error: out of memory")); @@ -4478,8 +4506,8 @@ elf_link_sort_cmp1 (A, B) const PTR A; const PTR B; { - struct elf_link_sort_rela *a = (struct elf_link_sort_rela *)A; - struct elf_link_sort_rela *b = (struct elf_link_sort_rela *)B; + struct elf_link_sort_rela *a = (struct elf_link_sort_rela *) A; + struct elf_link_sort_rela *b = (struct elf_link_sort_rela *) B; int relativea, relativeb; relativea = a->type == reloc_class_relative; @@ -4505,8 +4533,8 @@ elf_link_sort_cmp2 (A, B) const PTR A; const PTR B; { - struct elf_link_sort_rela *a = (struct elf_link_sort_rela *)A; - struct elf_link_sort_rela *b = (struct elf_link_sort_rela *)B; + struct elf_link_sort_rela *a = (struct elf_link_sort_rela *) A; + struct elf_link_sort_rela *b = (struct elf_link_sort_rela *) B; int copya, copyb; if (a->offset < b->offset) @@ -4535,7 +4563,8 @@ elf_link_sort_relocs (abfd, info, psec) bfd *dynobj = elf_hash_table (info)->dynobj; asection *reldyn, *o; boolean rel = false; - size_t count, size, i, j, ret; + bfd_size_type count, size; + size_t i, j, ret; struct elf_link_sort_rela *rela; struct elf_backend_data *bed = get_elf_backend_data (abfd); @@ -4561,11 +4590,12 @@ elf_link_sort_relocs (abfd, info, psec) if (size != reldyn->_raw_size) return 0; - rela = (struct elf_link_sort_rela *) calloc (sizeof (*rela), count); + rela = (struct elf_link_sort_rela *) bfd_zmalloc (sizeof (*rela) * count); if (rela == NULL) { (*info->callbacks->warning) - (info, _("Not enough memory to sort relocations"), 0, abfd, 0, 0); + (info, _("Not enough memory to sort relocations"), 0, abfd, 0, + (bfd_vma) 0); return 0; } @@ -4580,7 +4610,7 @@ elf_link_sort_relocs (abfd, info, psec) struct elf_link_sort_rela *s; erel = (Elf_External_Rel *) o->contents; - erelend = (Elf_External_Rel *) ((PTR) o->contents + o->_raw_size); + erelend = (Elf_External_Rel *) (o->contents + o->_raw_size); s = rela + o->output_offset / sizeof (Elf_External_Rel); for (; erel < erelend; erel++, s++) { @@ -4589,9 +4619,8 @@ elf_link_sort_relocs (abfd, info, psec) else elf_swap_reloc_in (abfd, erel, &s->u.rel); - s->type = (*bed->elf_backend_reloc_type_class) - (ELF_R_TYPE (s->u.rel.r_info)); - } + s->type = (*bed->elf_backend_reloc_type_class) (&s->u.rela); + } } else { @@ -4599,18 +4628,18 @@ elf_link_sort_relocs (abfd, info, psec) struct elf_link_sort_rela *s; erela = (Elf_External_Rela *) o->contents; - erelaend = (Elf_External_Rela *) ((PTR) o->contents + o->_raw_size); + erelaend = (Elf_External_Rela *) (o->contents + o->_raw_size); s = rela + o->output_offset / sizeof (Elf_External_Rela); for (; erela < erelaend; erela++, s++) { if (bed->s->swap_reloca_in) - (*bed->s->swap_reloca_in) (dynobj, (bfd_byte *) erela, &s->u.rela); + (*bed->s->swap_reloca_in) (dynobj, (bfd_byte *) erela, + &s->u.rela); else elf_swap_reloca_in (dynobj, erela, &s->u.rela); - s->type = (*bed->elf_backend_reloc_type_class) - (ELF_R_TYPE (s->u.rel.r_info)); - } + s->type = (*bed->elf_backend_reloc_type_class) (&s->u.rela); + } } } @@ -4624,7 +4653,7 @@ elf_link_sort_relocs (abfd, info, psec) rela[i].offset = rela[j].u.rel.r_offset; } qsort (rela + ret, count - ret, sizeof (*rela), elf_link_sort_cmp2); - + for (o = dynobj->sections; o != NULL; o = o->next) if ((o->flags & (SEC_HAS_CONTENTS|SEC_LINKER_CREATED)) == (SEC_HAS_CONTENTS|SEC_LINKER_CREATED) @@ -4641,7 +4670,8 @@ elf_link_sort_relocs (abfd, info, psec) for (; erel < erelend; erel++, s++) { if (bed->s->swap_reloc_out) - (*bed->s->swap_reloc_out) (abfd, &s->u.rel, (bfd_byte *) erel); + (*bed->s->swap_reloc_out) (abfd, &s->u.rel, + (bfd_byte *) erel); else elf_swap_reloc_out (abfd, &s->u.rel, erel); } @@ -4657,10 +4687,11 @@ elf_link_sort_relocs (abfd, info, psec) for (; erela < erelaend; erela++, s++) { if (bed->s->swap_reloca_out) - (*bed->s->swap_reloca_out) (dynobj, &s->u.rela, (bfd_byte *) erela); + (*bed->s->swap_reloca_out) (dynobj, &s->u.rela, + (bfd_byte *) erela); else elf_swap_reloca_out (dynobj, &s->u.rela, erela); - } + } } } @@ -4683,10 +4714,10 @@ elf_bfd_final_link (abfd, info) register asection *o; register struct bfd_link_order *p; register bfd *sub; - size_t max_contents_size; - size_t max_external_reloc_size; - size_t max_internal_reloc_count; - size_t max_sym_count; + bfd_size_type max_contents_size; + bfd_size_type max_external_reloc_size; + bfd_size_type max_internal_reloc_count; + bfd_size_type max_sym_count; file_ptr off; Elf_Internal_Sym elfsym; unsigned int i; @@ -4697,6 +4728,7 @@ elf_bfd_final_link (abfd, info) boolean merged; size_t relativecount = 0; asection *reldyn = 0; + bfd_size_type amt; if (! is_elf_hash_table (info)) return false; @@ -4960,8 +4992,9 @@ elf_bfd_final_link (abfd, info) finfo.symbuf_size = 20; else finfo.symbuf_size = max_sym_count; - finfo.symbuf = ((Elf_External_Sym *) - bfd_malloc (finfo.symbuf_size * sizeof (Elf_External_Sym))); + amt = finfo.symbuf_size; + amt *= sizeof (Elf_External_Sym); + finfo.symbuf = (Elf_External_Sym *) bfd_malloc (amt); if (finfo.symbuf == NULL) goto error_return; @@ -5211,11 +5244,12 @@ elf_bfd_final_link (abfd, info) table, do it now. */ if (bed->elf_backend_output_arch_syms) { - if (! (*bed->elf_backend_output_arch_syms) - (abfd, info, (PTR) &finfo, - (boolean (*) PARAMS ((PTR, const char *, - Elf_Internal_Sym *, asection *))) - elf_link_output_sym)) + typedef boolean (*out_sym_func) PARAMS ((PTR, const char *, + Elf_Internal_Sym *, + asection *)); + + if (! ((*bed->elf_backend_output_arch_syms) + (abfd, info, (PTR) &finfo, (out_sym_func) elf_link_output_sym))) return false; } @@ -5426,14 +5460,13 @@ elf_bfd_final_link (abfd, info) || strcmp (bfd_get_section_name (abfd, o), ".dynstr") != 0) { if (! bfd_set_section_contents (abfd, o->output_section, - o->contents, o->output_offset, + o->contents, + (file_ptr) o->output_offset, o->_raw_size)) goto error_return; } else { - file_ptr off; - /* The contents of the .dynstr section are actually in a stringtab. */ off = elf_section_data (o->output_section)->this_hdr.sh_offset; @@ -5570,14 +5603,14 @@ elf_link_flush_output_syms (finfo) if (finfo->symbuf_count > 0) { Elf_Internal_Shdr *symtab; + file_ptr pos; + bfd_size_type amt; symtab = &elf_tdata (finfo->output_bfd)->symtab_hdr; - - if (bfd_seek (finfo->output_bfd, symtab->sh_offset + symtab->sh_size, - SEEK_SET) != 0 - || (bfd_write ((PTR) finfo->symbuf, finfo->symbuf_count, - sizeof (Elf_External_Sym), finfo->output_bfd) - != finfo->symbuf_count * sizeof (Elf_External_Sym))) + pos = symtab->sh_offset + symtab->sh_size; + amt = finfo->symbuf_count * sizeof (Elf_External_Sym); + if (bfd_seek (finfo->output_bfd, pos, SEEK_SET) != 0 + || bfd_bwrite ((PTR) finfo->symbuf, amt, finfo->output_bfd) != amt) return false; symtab->sh_size += finfo->symbuf_count * sizeof (Elf_External_Sym); @@ -5674,7 +5707,7 @@ elf_link_output_extsym (h, data) && ! ((*finfo->info->callbacks->undefined_symbol) (finfo->info, h->root.root.string, h->root.u.undef.abfd, (asection *) NULL, - 0, true))) + (bfd_vma) 0, true))) { eoinfo->failed = true; return false; @@ -5853,13 +5886,11 @@ elf_link_output_extsym (h, data) size_t hash_entry_size; bfd_byte *bucketpos; bfd_vma chain; + Elf_External_Sym *esym; sym.st_name = h->dynstr_index; - - elf_swap_symbol_out (finfo->output_bfd, &sym, - (PTR) (((Elf_External_Sym *) - finfo->dynsym_sec->contents) - + h->dynindx)); + esym = (Elf_External_Sym *) finfo->dynsym_sec->contents + h->dynindx; + elf_swap_symbol_out (finfo->output_bfd, &sym, (PTR) esym); bucketcount = elf_hash_table (finfo->info)->bucketcount; bucket = h->elf_hash_value % bucketcount; @@ -5868,7 +5899,8 @@ elf_link_output_extsym (h, data) bucketpos = ((bfd_byte *) finfo->hash_sec->contents + (bucket + 2) * hash_entry_size); chain = bfd_get (8 * hash_entry_size, finfo->output_bfd, bucketpos); - bfd_put (8 * hash_entry_size, finfo->output_bfd, h->dynindx, bucketpos); + bfd_put (8 * hash_entry_size, finfo->output_bfd, (bfd_vma) h->dynindx, + bucketpos); bfd_put (8 * hash_entry_size, finfo->output_bfd, chain, ((bfd_byte *) finfo->hash_sec->contents + (bucketcount + 2 + h->dynindx) * hash_entry_size)); @@ -5876,6 +5908,7 @@ elf_link_output_extsym (h, data) if (finfo->symver_sec != NULL && finfo->symver_sec->contents != NULL) { Elf_Internal_Versym iversym; + Elf_External_Versym *eversym; if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) { @@ -5895,10 +5928,9 @@ elf_link_output_extsym (h, data) if ((h->elf_link_hash_flags & ELF_LINK_HIDDEN) != 0) iversym.vs_vers |= VERSYM_HIDDEN; - _bfd_elf_swap_versym_out (finfo->output_bfd, &iversym, - (((Elf_External_Versym *) - finfo->symver_sec->contents) - + h->dynindx)); + eversym = (Elf_External_Versym *) finfo->symver_sec->contents; + eversym += h->dynindx; + _bfd_elf_swap_versym_out (finfo->output_bfd, &iversym, eversym); } } @@ -5936,6 +5968,7 @@ elf_link_output_relocs (output_bfd, inpu asection *output_section; unsigned int *rel_countp = NULL; struct elf_backend_data *bed; + bfd_size_type amt; output_section = input_section->output_section; output_rel_hdr = NULL; @@ -5965,9 +5998,9 @@ elf_link_output_relocs (output_bfd, inpu { Elf_External_Rel *erel; Elf_Internal_Rel *irel; - - irel = (Elf_Internal_Rel *) bfd_zmalloc (bed->s->int_rels_per_ext_rel - * sizeof (Elf_Internal_Rel)); + + amt = bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rel); + irel = (Elf_Internal_Rel *) bfd_zmalloc (amt); if (irel == NULL) { (*_bfd_error_handler) (_("Error: out of memory")); @@ -5978,7 +6011,7 @@ elf_link_output_relocs (output_bfd, inpu for (; irela < irelaend; irela += bed->s->int_rels_per_ext_rel, erel++) { unsigned int i; - + for (i = 0; i < bed->s->int_rels_per_ext_rel; i++) { irel[i].r_offset = irela[i].r_offset; @@ -6074,11 +6107,10 @@ elf_link_input_bfd (finfo, input_bfd) external_syms = NULL; else { + bfd_size_type amt = locsymcount * sizeof (Elf_External_Sym); external_syms = finfo->external_syms; if (bfd_seek (input_bfd, symtab_hdr->sh_offset, SEEK_SET) != 0 - || (bfd_read (external_syms, sizeof (Elf_External_Sym), - locsymcount, input_bfd) - != locsymcount * sizeof (Elf_External_Sym))) + || bfd_bread (external_syms, amt, input_bfd) != amt) return false; } @@ -6107,12 +6139,8 @@ elf_link_input_bfd (finfo, input_bfd) } } - name = NULL; if (isym->st_shndx == SHN_UNDEF) - { - isec = bfd_und_section_ptr; - name = isec->name; - } + isec = bfd_und_section_ptr; else if (isym->st_shndx > 0 && isym->st_shndx < SHN_LORESERVE) { isec = section_from_elf_index (input_bfd, isym->st_shndx); @@ -6124,15 +6152,9 @@ elf_link_input_bfd (finfo, input_bfd) isym->st_value, (bfd_vma) 0); } else if (isym->st_shndx == SHN_ABS) - { - isec = bfd_abs_section_ptr; - name = isec->name; - } + isec = bfd_abs_section_ptr; else if (isym->st_shndx == SHN_COMMON) - { - isec = bfd_com_section_ptr; - name = isec->name; - } + isec = bfd_com_section_ptr; else { /* Who knows? */ @@ -6147,41 +6169,6 @@ elf_link_input_bfd (finfo, input_bfd) if (ELF_ST_TYPE (isym->st_info) == STT_SECTION) { - asection *ksec; - - /* Save away all section symbol values. */ - if (isec != NULL) - { - if (name) - { - if (isec->symbol->value != isym->st_value) - (*_bfd_error_handler) - (_("%s: invalid section symbol index 0x%x (%s) ingored"), - bfd_get_filename (input_bfd), isym->st_shndx, - name); - continue; - } - isec->symbol->value = isym->st_value; - } - - /* If this is a discarded link-once section symbol, update - it's value to that of the kept section symbol. The - linker will keep the first of any matching link-once - sections, so we should have already seen it's section - symbol. I trust no-one will have the bright idea of - re-ordering the bfd list... */ - if (isec != NULL - && (bfd_get_section_flags (input_bfd, isec) & SEC_LINK_ONCE) != 0 - && (ksec = isec->kept_section) != NULL) - { - isym->st_value = ksec->symbol->value; - - /* That put the value right, but the section info is all - wrong. I hope this works. */ - isec->output_offset = ksec->output_offset; - isec->output_section = ksec->output_section; - } - /* We never output section symbols. Instead, we use the section symbol of the corresponding section in the output file. */ @@ -6305,6 +6292,50 @@ elf_link_input_bfd (finfo, input_bfd) && o->reloc_count > 0) return false; + { + Elf_Internal_Rela *rel, *relend; + /* Run through the relocs looking for any against section + symbols from removed link-once sections. Set any such + relocs to be against 0. We should really complain if + anything in the final link tries to use it, but + DWARF-based exception handling might have an entry in + .eh_frame to describe a routine in the linkonce section, + and it turns out to be hard to remove the .eh_frame entry + too. FIXME. */ + rel = internal_relocs; + relend = rel + o->reloc_count * bed->s->int_rels_per_ext_rel; + for ( ; rel < relend; rel++) + { + unsigned long r_symndx = ELF_R_SYM (rel->r_info); + + if (r_symndx < locsymcount + && (!elf_bad_symtab (input_bfd) + || finfo->sections[r_symndx] != NULL)) + { + isym = finfo->internal_syms + r_symndx; + if (ELF_ST_TYPE (isym->st_info) == STT_SECTION) + { + asection *sec = finfo->sections[r_symndx]; + + if (sec != NULL + && (sec->flags & SEC_LINK_ONCE) != 0 + && bfd_is_abs_section (sec->output_section)) + { + long r_type = ELF_R_TYPE (rel->r_info); + rel->r_info = ELF_R_INFO (0, r_type); + +#if BFD_VERSION_DATE > 20031005 + (*finfo->info->callbacks->warning) + (finfo->info, + _("Relocation against removed section; zeroing"), + 0, input_bfd, 0, (bfd_vma) 0); +#endif + } + } + } + } + } + /* Relocate the section by invoking a back end routine. The back end routine is responsible for adjusting the @@ -6339,22 +6370,20 @@ elf_link_input_bfd (finfo, input_bfd) struct elf_link_hash_entry **rel_hash; Elf_Internal_Shdr *input_rel_hdr; unsigned int next_erel; - void (* reloc_emitter) PARAMS ((bfd *, asection *, - Elf_Internal_Shdr *, - Elf_Internal_Rela *)); + void (*reloc_emitter) PARAMS ((bfd *, asection *, + Elf_Internal_Shdr *, + Elf_Internal_Rela *)); /* Adjust the reloc addresses and symbol indices. */ irela = internal_relocs; - irelaend = irela - + o->reloc_count * bed->s->int_rels_per_ext_rel; + irelaend = irela + o->reloc_count * bed->s->int_rels_per_ext_rel; rel_hash = (elf_section_data (o->output_section)->rel_hashes + elf_section_data (o->output_section)->rel_count + elf_section_data (o->output_section)->rel_count2); for (next_erel = 0; irela < irelaend; irela++, next_erel++) { unsigned long r_symndx; - Elf_Internal_Sym *isym; asection *sec; if (next_erel == bed->s->int_rels_per_ext_rel) @@ -6437,7 +6466,7 @@ elf_link_input_bfd (finfo, input_bfd) { if (finfo->indices[r_symndx] == -1) { - unsigned long link; + unsigned long shlink; const char *name; asection *osec; @@ -6451,9 +6480,9 @@ elf_link_input_bfd (finfo, input_bfd) /* This symbol was skipped earlier, but since it is needed by a reloc, we must output it now. */ - link = symtab_hdr->sh_link; + shlink = symtab_hdr->sh_link; name = (bfd_elf_string_from_elf_section - (input_bfd, link, isym->st_name)); + (input_bfd, shlink, isym->st_name)); if (name == NULL) return false; @@ -6496,8 +6525,8 @@ elf_link_input_bfd (finfo, input_bfd) input_rel_hdr = elf_section_data (o)->rel_hdr2; if (input_rel_hdr) { - internal_relocs += NUM_SHDR_ENTRIES (input_rel_hdr) - * bed->s->int_rels_per_ext_rel; + internal_relocs += (NUM_SHDR_ENTRIES (input_rel_hdr) + * bed->s->int_rels_per_ext_rel); reloc_emitter (output_bfd, o, input_rel_hdr, internal_relocs); } @@ -6520,12 +6549,14 @@ elf_link_input_bfd (finfo, input_bfd) } else { - if (! (o->flags & SEC_EXCLUDE) && - ! bfd_set_section_contents (output_bfd, o->output_section, - contents, o->output_offset, - (o->_cooked_size != 0 - ? o->_cooked_size - : o->_raw_size))) + bfd_size_type sec_size; + + sec_size = (o->_cooked_size != 0 ? o->_cooked_size : o->_raw_size); + if (! (o->flags & SEC_EXCLUDE) + && ! bfd_set_section_contents (output_bfd, o->output_section, + contents, + (file_ptr) o->output_offset, + sec_size)) return false; } } @@ -6622,28 +6653,31 @@ elf_reloc_link_order (output_bfd, info, bfd_reloc_status_type rstat; bfd_byte *buf; boolean ok; + const char *sym_name; size = bfd_get_reloc_size (howto); buf = (bfd_byte *) bfd_zmalloc (size); if (buf == (bfd_byte *) NULL) return false; - rstat = _bfd_relocate_contents (howto, output_bfd, addend, buf); + rstat = _bfd_relocate_contents (howto, output_bfd, (bfd_vma) addend, buf); switch (rstat) { case bfd_reloc_ok: break; + default: case bfd_reloc_outofrange: abort (); + case bfd_reloc_overflow: + if (link_order->type == bfd_section_reloc_link_order) + sym_name = bfd_section_name (output_bfd, + link_order->u.reloc.p->u.section); + else + sym_name = link_order->u.reloc.p->u.name; if (! ((*info->callbacks->reloc_overflow) - (info, - (link_order->type == bfd_section_reloc_link_order - ? bfd_section_name (output_bfd, - link_order->u.reloc.p->u.section) - : link_order->u.reloc.p->u.name), - howto->name, addend, (bfd *) NULL, (asection *) NULL, - (bfd_vma) 0))) + (info, sym_name, howto->name, addend, + (bfd *) NULL, (asection *) NULL, (bfd_vma) 0))) { free (buf); return false; @@ -6668,15 +6702,16 @@ elf_reloc_link_order (output_bfd, info, if (rel_hdr->sh_type == SHT_REL) { + bfd_size_type size; Elf_Internal_Rel *irel; Elf_External_Rel *erel; unsigned int i; - - irel = (Elf_Internal_Rel *) bfd_zmalloc (bed->s->int_rels_per_ext_rel - * sizeof (Elf_Internal_Rel)); + + size = bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rel); + irel = (Elf_Internal_Rel *) bfd_zmalloc (size); if (irel == NULL) return false; - + for (i = 0; i < bed->s->int_rels_per_ext_rel; i++) irel[i].r_offset = offset; irel[0].r_info = ELF_R_INFO (indx, howto->type); @@ -6693,12 +6728,13 @@ elf_reloc_link_order (output_bfd, info, } else { + bfd_size_type size; Elf_Internal_Rela *irela; Elf_External_Rela *erela; unsigned int i; - - irela = (Elf_Internal_Rela *) bfd_zmalloc (bed->s->int_rels_per_ext_rel - * sizeof (Elf_Internal_Rela)); + + size = bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rela); + irela = (Elf_Internal_Rela *) bfd_zmalloc (size); if (irela == NULL) return false; @@ -6733,7 +6769,8 @@ elf_create_pointer_linker_section (abfd, { elf_linker_section_pointers_t **ptr_linker_section_ptr = NULL; elf_linker_section_pointers_t *linker_section_ptr; - unsigned long r_symndx = ELF_R_SYM (rel->r_info);; + unsigned long r_symndx = ELF_R_SYM (rel->r_info); + bfd_size_type amt; BFD_ASSERT (lsect != NULL); @@ -6768,9 +6805,9 @@ elf_create_pointer_linker_section (abfd, unsigned int num_symbols = elf_tdata (abfd)->symtab_hdr.sh_info; register unsigned int i; - ptr = (elf_linker_section_pointers_t **) - bfd_alloc (abfd, - num_symbols * sizeof (elf_linker_section_pointers_t *)); + amt = num_symbols; + amt *= sizeof (elf_linker_section_pointers_t *); + ptr = (elf_linker_section_pointers_t **) bfd_alloc (abfd, amt); if (!ptr) return false; @@ -6801,8 +6838,8 @@ elf_create_pointer_linker_section (abfd, /* Allocate space for a pointer in the linker section, and allocate a new pointer record from internal memory. */ BFD_ASSERT (ptr_linker_section_ptr != NULL); - linker_section_ptr = (elf_linker_section_pointers_t *) - bfd_alloc (abfd, sizeof (elf_linker_section_pointers_t)); + amt = sizeof (elf_linker_section_pointers_t); + linker_section_ptr = (elf_linker_section_pointers_t *) bfd_alloc (abfd, amt); if (!linker_section_ptr) return false; @@ -6930,12 +6967,13 @@ elf_finish_pointer_linker_section (outpu { asection *srel = lsect->rel_section; Elf_Internal_Rela *outrel; + Elf_External_Rela *erel; struct elf_backend_data *bed = get_elf_backend_data (output_bfd); unsigned int i; + bfd_size_type amt; - outrel = (Elf_Internal_Rela *) - bfd_zmalloc (sizeof (Elf_Internal_Rela) - * bed->s->int_rels_per_ext_rel); + amt = sizeof (Elf_Internal_Rela) * bed->s->int_rels_per_ext_rel; + outrel = (Elf_Internal_Rela *) bfd_zmalloc (amt); if (outrel == NULL) { (*_bfd_error_handler) (_("Error: out of memory")); @@ -6959,13 +6997,11 @@ elf_finish_pointer_linker_section (outpu + linker_section_ptr->offset); outrel[0].r_info = ELF_R_INFO (0, relative_reloc); outrel[0].r_addend = 0; - elf_swap_reloca_out (output_bfd, outrel, - (((Elf_External_Rela *) - lsect->section->contents) - + (elf_section_data (lsect->section) - ->rel_count))); + erel = (Elf_External_Rela *) lsect->section->contents; + erel += elf_section_data (lsect->section)->rel_count; + elf_swap_reloca_out (output_bfd, outrel, erel); ++elf_section_data (lsect->section)->rel_count; - + free (outrel); } } @@ -7061,13 +7097,11 @@ elf_gc_mark (info, sec, gc_mark_hook) locsyms = NULL; else { - locsyms = freesyms = - bfd_malloc (nlocsyms * sizeof (Elf_External_Sym)); + bfd_size_type amt = nlocsyms * sizeof (Elf_External_Sym); + locsyms = freesyms = bfd_malloc (amt); if (freesyms == NULL || bfd_seek (input_bfd, symtab_hdr->sh_offset, SEEK_SET) != 0 - || (bfd_read (locsyms, sizeof (Elf_External_Sym), - nlocsyms, input_bfd) - != nlocsyms * sizeof (Elf_External_Sym))) + || bfd_bread (locsyms, amt, input_bfd) != amt) { ret = false; goto out1; @@ -7277,10 +7311,12 @@ elf_gc_propagate_vtable_entries_used (h, int file_align = bed->s->file_align; n = h->vtable_parent->vtable_entries_size / file_align; - while (--n != 0) + while (n--) { - if (*pu) *cu = true; - pu++, cu++; + if (*pu) + *cu = true; + pu++; + cu++; } } } @@ -7348,7 +7384,7 @@ elf_gc_sections (abfd, info) boolean ok = true; bfd *sub; asection * (*gc_mark_hook) - PARAMS ((bfd *abfd, struct bfd_link_info *, Elf_Internal_Rela *, + PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *, struct elf_link_hash_entry *h, Elf_Internal_Sym *)); if (!get_elf_backend_data (abfd)->can_gc_sections @@ -7431,12 +7467,12 @@ elf_gc_record_vtinherit (abfd, sec, h, o } (*_bfd_error_handler) ("%s: %s+%lu: No symbol found for INHERIT", - bfd_get_filename (abfd), sec->name, + bfd_archive_filename (abfd), sec->name, (unsigned long) offset); bfd_set_error (bfd_error_invalid_operation); return false; -win: + win: if (!h) { /* This *should* only be the absolute section. It could potentially @@ -7490,7 +7526,7 @@ elf_gc_record_vtentry (abfd, sec, h, add if (ptr) { - ptr = bfd_realloc (ptr - 1, bytes); + ptr = bfd_realloc (ptr - 1, (bfd_size_type) bytes); if (ptr != NULL) { @@ -7502,7 +7538,7 @@ elf_gc_record_vtentry (abfd, sec, h, add } } else - ptr = bfd_zmalloc (bytes); + ptr = bfd_zmalloc ((bfd_size_type) bytes); if (ptr == NULL) return false; @@ -7634,8 +7670,8 @@ elf_collect_hash_codes (h, data) p = strchr (name, ELF_VER_CHR); if (p != NULL) { - alc = bfd_malloc (p - name + 1); - memcpy (alc, name, p - name); + alc = bfd_malloc ((bfd_size_type) (p - name + 1)); + memcpy (alc, name, (size_t) (p - name)); alc[p - name] = '\0'; name = alc; } diff -uprN binutils-2.11.90.0.31/bfd/elflink.h.weak binutils-2.11.92.0.5/bfd/elflink.h.weak --- binutils-2.11.90.0.31/bfd/elflink.h.weak Wed Oct 3 09:49:15 2001 +++ binutils-2.11.92.0.5/bfd/elflink.h.weak Wed Dec 31 16:00:00 1969 @@ -1,7662 +0,0 @@ -/* ELF linker support. - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001 - Free Software Foundation, Inc. - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -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. */ - -/* ELF linker code. */ - -/* This struct is used to pass information to routines called via - elf_link_hash_traverse which must return failure. */ - -struct elf_info_failed -{ - boolean failed; - struct bfd_link_info *info; - struct bfd_elf_version_tree *verdefs; -}; - -static boolean is_global_data_symbol_definition - PARAMS ((bfd *, Elf_Internal_Sym *)); -static boolean elf_link_is_defined_archive_symbol - PARAMS ((bfd *, carsym *)); -static boolean elf_link_add_object_symbols - PARAMS ((bfd *, struct bfd_link_info *)); -static boolean elf_link_add_archive_symbols - PARAMS ((bfd *, struct bfd_link_info *)); -static boolean elf_merge_symbol - PARAMS ((bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *, - asection **, bfd_vma *, struct elf_link_hash_entry **, - boolean *, boolean *, boolean *, boolean)); -static boolean elf_export_symbol - PARAMS ((struct elf_link_hash_entry *, PTR)); -static boolean elf_fix_symbol_flags - PARAMS ((struct elf_link_hash_entry *, struct elf_info_failed *)); -static boolean elf_adjust_dynamic_symbol - PARAMS ((struct elf_link_hash_entry *, PTR)); -static boolean elf_link_find_version_dependencies - PARAMS ((struct elf_link_hash_entry *, PTR)); -static boolean elf_link_find_version_dependencies - PARAMS ((struct elf_link_hash_entry *, PTR)); -static boolean elf_link_assign_sym_version - PARAMS ((struct elf_link_hash_entry *, PTR)); -static boolean elf_collect_hash_codes - PARAMS ((struct elf_link_hash_entry *, PTR)); -static boolean elf_link_read_relocs_from_section - PARAMS ((bfd *, Elf_Internal_Shdr *, PTR, Elf_Internal_Rela *)); -static size_t compute_bucket_count - PARAMS ((struct bfd_link_info *)); -static void elf_link_output_relocs - PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *)); -static boolean elf_link_size_reloc_section - PARAMS ((bfd *, Elf_Internal_Shdr *, asection *)); -static void elf_link_adjust_relocs - PARAMS ((bfd *, Elf_Internal_Shdr *, unsigned int, - struct elf_link_hash_entry **)); -static int elf_link_sort_cmp1 - PARAMS ((const void *, const void *)); -static int elf_link_sort_cmp2 - PARAMS ((const void *, const void *)); -static size_t elf_link_sort_relocs - PARAMS ((bfd *, struct bfd_link_info *, asection **)); -static boolean elf_link_check_versioned_symbol - PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); - -static boolean -elf_link_check_versioned_symbol (info, h) - struct bfd_link_info *info; - struct elf_link_hash_entry *h; -{ - boolean found = false; - bfd *undef_bfd = h->root.u.undef.abfd; - struct elf_link_loaded_list *loaded; - Elf_External_Sym *buf = NULL; - Elf_External_Versym *extversym = NULL; - - if ((undef_bfd->flags & DYNAMIC) == 0 - || info->hash->creator->flavour != bfd_target_elf_flavour) - return false; - - for (loaded = elf_hash_table (info)->loaded; - loaded != NULL && !found; - loaded = loaded->next) - { - bfd *input; - Elf_Internal_Shdr *hdr; - size_t symcount; - size_t extsymcount; - size_t extsymoff; - Elf_Internal_Shdr *versymhdr; - Elf_External_Versym *ever; - Elf_External_Sym *esym; - Elf_External_Sym *esymend; - - input = loaded->abfd; - - /* We check each DSO for a possible versioned difinition. */ - if (input == undef_bfd - || (input->flags & DYNAMIC) == 0 - || elf_dynversym (input) == 0) - continue; - - hdr = &elf_tdata (input)->dynsymtab_hdr; - - symcount = hdr->sh_size / sizeof (Elf_External_Sym); - if (elf_bad_symtab (input)) - { - extsymcount = symcount; - extsymoff = 0; - } - else - { - extsymcount = symcount - hdr->sh_info; - extsymoff = hdr->sh_info; - } - - if (extsymcount == 0) - continue; - - buf = ((Elf_External_Sym *) - bfd_malloc (extsymcount * sizeof (Elf_External_Sym))); - if (buf == NULL) - goto no_memory; - - /* Read in the symbol table. */ - if (bfd_seek (input, - hdr->sh_offset - + extsymoff * sizeof (Elf_External_Sym), - SEEK_SET) != 0 - || (bfd_read ((PTR) buf, sizeof (Elf_External_Sym), - extsymcount, input) - != extsymcount * sizeof (Elf_External_Sym))) - goto error_return; - - /* Read in any version definitions. */ - versymhdr = &elf_tdata (input)->dynversym_hdr; - extversym = - (Elf_External_Versym *) bfd_malloc (versymhdr->sh_size); - if (extversym == NULL) - goto no_memory; - - if (bfd_seek (input, versymhdr->sh_offset, SEEK_SET) != 0 - || (bfd_read ((PTR) extversym, 1, versymhdr->sh_size, input) - != versymhdr->sh_size)) - goto error_return; - - ever = extversym + extsymoff; - esymend = buf + extsymcount; - for (esym = buf; esym < esymend; esym++, ever++) - { - const char *name; - Elf_Internal_Sym sym; - Elf_Internal_Versym iver; - - elf_swap_symbol_in (input, esym, &sym); - if (ELF_ST_BIND (sym.st_info) == STB_LOCAL - || sym.st_shndx == SHN_UNDEF) - continue; - - name = bfd_elf_string_from_elf_section (input, - hdr->sh_link, - sym.st_name); - if (strcmp (name, h->root.root.string) != 0) - continue; - - _bfd_elf_swap_versym_in (input, ever, &iver); - - /* It is defined here and we still get an undefined - symbol. It must be an error. */ - if ((iver.vs_vers & VERSYM_HIDDEN) == 0) - { - (*_bfd_error_handler) - (_("%s: defined in %s"), name, - bfd_get_filename (input)); - bfd_set_error (bfd_error_bad_value); - goto error_return; - } - - if ((iver.vs_vers & VERSYM_VERSION) == 2) - { - /* We found one we can use. This is the first vesion - of the symbol and it is hidden. */ - found = true; - break; - } - } - - free (buf); - free (extversym); - } - - return found; - -no_memory: - bfd_set_error (bfd_error_no_memory); -error_return: - if (buf != NULL) - free (buf); - if (extversym != NULL) - free (extversym); - return found; -} - -/* Given an ELF BFD, add symbols to the global hash table as - appropriate. */ - -boolean -elf_bfd_link_add_symbols (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - switch (bfd_get_format (abfd)) - { - case bfd_object: - return elf_link_add_object_symbols (abfd, info); - case bfd_archive: - return elf_link_add_archive_symbols (abfd, info); - default: - bfd_set_error (bfd_error_wrong_format); - return false; - } -} - -/* Return true iff this is a non-common, definition of a non-function symbol. */ -static boolean -is_global_data_symbol_definition (abfd, sym) - bfd * abfd ATTRIBUTE_UNUSED; - Elf_Internal_Sym * sym; -{ - /* Local symbols do not count, but target specific ones might. */ - if (ELF_ST_BIND (sym->st_info) != STB_GLOBAL - && ELF_ST_BIND (sym->st_info) < STB_LOOS) - return false; - - /* Function symbols do not count. */ - if (ELF_ST_TYPE (sym->st_info) == STT_FUNC) - return false; - - /* If the section is undefined, then so is the symbol. */ - if (sym->st_shndx == SHN_UNDEF) - return false; - - /* If the symbol is defined in the common section, then - it is a common definition and so does not count. */ - if (sym->st_shndx == SHN_COMMON) - return false; - - /* If the symbol is in a target specific section then we - must rely upon the backend to tell us what it is. */ - if (sym->st_shndx >= SHN_LORESERVE && sym->st_shndx < SHN_ABS) - /* FIXME - this function is not coded yet: - - return _bfd_is_global_symbol_definition (abfd, sym); - - Instead for now assume that the definition is not global, - Even if this is wrong, at least the linker will behave - in the same way that it used to do. */ - return false; - - return true; -} - -/* Search the symbol table of the archive element of the archive ABFD - whose archive map contains a mention of SYMDEF, and determine if - the symbol is defined in this element. */ -static boolean -elf_link_is_defined_archive_symbol (abfd, symdef) - bfd * abfd; - carsym * symdef; -{ - Elf_Internal_Shdr * hdr; - Elf_External_Sym * esym; - Elf_External_Sym * esymend; - Elf_External_Sym * buf = NULL; - size_t symcount; - size_t extsymcount; - size_t extsymoff; - boolean result = false; - - abfd = _bfd_get_elt_at_filepos (abfd, symdef->file_offset); - if (abfd == (bfd *) NULL) - return false; - - if (! bfd_check_format (abfd, bfd_object)) - return false; - - /* If we have already included the element containing this symbol in the - link then we do not need to include it again. Just claim that any symbol - it contains is not a definition, so that our caller will not decide to - (re)include this element. */ - if (abfd->archive_pass) - return false; - - /* Select the appropriate symbol table. */ - if ((abfd->flags & DYNAMIC) == 0 || elf_dynsymtab (abfd) == 0) - hdr = &elf_tdata (abfd)->symtab_hdr; - else - hdr = &elf_tdata (abfd)->dynsymtab_hdr; - - symcount = hdr->sh_size / sizeof (Elf_External_Sym); - - /* The sh_info field of the symtab header tells us where the - external symbols start. We don't care about the local symbols. */ - if (elf_bad_symtab (abfd)) - { - extsymcount = symcount; - extsymoff = 0; - } - else - { - extsymcount = symcount - hdr->sh_info; - extsymoff = hdr->sh_info; - } - - buf = ((Elf_External_Sym *) - bfd_malloc (extsymcount * sizeof (Elf_External_Sym))); - if (buf == NULL && extsymcount != 0) - return false; - - /* Read in the symbol table. - FIXME: This ought to be cached somewhere. */ - if (bfd_seek (abfd, - hdr->sh_offset + extsymoff * sizeof (Elf_External_Sym), - SEEK_SET) != 0 - || (bfd_read ((PTR) buf, sizeof (Elf_External_Sym), extsymcount, abfd) - != extsymcount * sizeof (Elf_External_Sym))) - { - free (buf); - return false; - } - - /* Scan the symbol table looking for SYMDEF. */ - esymend = buf + extsymcount; - for (esym = buf; - esym < esymend; - esym++) - { - Elf_Internal_Sym sym; - const char * name; - - elf_swap_symbol_in (abfd, esym, & sym); - - name = bfd_elf_string_from_elf_section (abfd, hdr->sh_link, sym.st_name); - if (name == (const char *) NULL) - break; - - if (strcmp (name, symdef->name) == 0) - { - result = is_global_data_symbol_definition (abfd, & sym); - break; - } - } - - free (buf); - - return result; -} - -/* Add symbols from an ELF archive file to the linker hash table. We - don't use _bfd_generic_link_add_archive_symbols because of a - problem which arises on UnixWare. The UnixWare libc.so is an - archive which includes an entry libc.so.1 which defines a bunch of - symbols. The libc.so archive also includes a number of other - object files, which also define symbols, some of which are the same - as those defined in libc.so.1. Correct linking requires that we - consider each object file in turn, and include it if it defines any - symbols we need. _bfd_generic_link_add_archive_symbols does not do - this; it looks through the list of undefined symbols, and includes - any object file which defines them. When this algorithm is used on - UnixWare, it winds up pulling in libc.so.1 early and defining a - bunch of symbols. This means that some of the other objects in the - archive are not included in the link, which is incorrect since they - precede libc.so.1 in the archive. - - Fortunately, ELF archive handling is simpler than that done by - _bfd_generic_link_add_archive_symbols, which has to allow for a.out - oddities. In ELF, if we find a symbol in the archive map, and the - symbol is currently undefined, we know that we must pull in that - object file. - - Unfortunately, we do have to make multiple passes over the symbol - table until nothing further is resolved. */ - -static boolean -elf_link_add_archive_symbols (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - symindex c; - boolean *defined = NULL; - boolean *included = NULL; - carsym *symdefs; - boolean loop; - - if (! bfd_has_map (abfd)) - { - /* An empty archive is a special case. */ - if (bfd_openr_next_archived_file (abfd, (bfd *) NULL) == NULL) - return true; - bfd_set_error (bfd_error_no_armap); - return false; - } - - /* Keep track of all symbols we know to be already defined, and all - files we know to be already included. This is to speed up the - second and subsequent passes. */ - c = bfd_ardata (abfd)->symdef_count; - if (c == 0) - return true; - defined = (boolean *) bfd_malloc (c * sizeof (boolean)); - included = (boolean *) bfd_malloc (c * sizeof (boolean)); - if (defined == (boolean *) NULL || included == (boolean *) NULL) - goto error_return; - memset (defined, 0, c * sizeof (boolean)); - memset (included, 0, c * sizeof (boolean)); - - symdefs = bfd_ardata (abfd)->symdefs; - - do - { - file_ptr last; - symindex i; - carsym *symdef; - carsym *symdefend; - - loop = false; - last = -1; - - symdef = symdefs; - symdefend = symdef + c; - for (i = 0; symdef < symdefend; symdef++, i++) - { - struct elf_link_hash_entry *h; - bfd *element; - struct bfd_link_hash_entry *undefs_tail; - symindex mark; - - if (defined[i] || included[i]) - continue; - if (symdef->file_offset == last) - { - included[i] = true; - continue; - } - - h = elf_link_hash_lookup (elf_hash_table (info), symdef->name, - false, false, false); - - if (h == NULL) - { - char *p, *copy; - - /* If this is a default version (the name contains @@), - look up the symbol again with only one `@' as well - as without the version. The effect is that references - to the symbol with and without the version will be - matched by the default symbol in the archive. */ - - p = strchr (symdef->name, ELF_VER_CHR); - if (p == NULL || p[1] != ELF_VER_CHR) - continue; - - /* First check with only one `@'. */ - copy = bfd_alloc (abfd, strlen (symdef->name)); - if (copy == NULL) - goto error_return; - memcpy (copy, symdef->name, p - symdef->name + 1); - strcpy (© [p - symdef->name + 1], - &symdef->name [p - symdef->name + 2]); - - h = elf_link_hash_lookup (elf_hash_table (info), copy, - false, false, false); - - if (h == NULL) - { - /* We also need to check references to the symbol - without the version. */ - - copy[p - symdef->name] = '\0'; - h = elf_link_hash_lookup (elf_hash_table (info), - copy, false, false, false); - } - - bfd_release (abfd, copy); - } - - if (h == NULL) - continue; - - if (h->root.type == bfd_link_hash_common) - { - /* We currently have a common symbol. The archive map contains - a reference to this symbol, so we may want to include it. We - only want to include it however, if this archive element - contains a definition of the symbol, not just another common - declaration of it. - - Unfortunately some archivers (including GNU ar) will put - declarations of common symbols into their archive maps, as - well as real definitions, so we cannot just go by the archive - map alone. Instead we must read in the element's symbol - table and check that to see what kind of symbol definition - this is. */ - if (! elf_link_is_defined_archive_symbol (abfd, symdef)) - continue; - } - else if (h->root.type != bfd_link_hash_undefined) - { - if (h->root.type != bfd_link_hash_undefweak) - defined[i] = true; - continue; - } - - /* We need to include this archive member. */ - element = _bfd_get_elt_at_filepos (abfd, symdef->file_offset); - if (element == (bfd *) NULL) - goto error_return; - - if (! bfd_check_format (element, bfd_object)) - goto error_return; - - /* Doublecheck that we have not included this object - already--it should be impossible, but there may be - something wrong with the archive. */ - if (element->archive_pass != 0) - { - bfd_set_error (bfd_error_bad_value); - goto error_return; - } - element->archive_pass = 1; - - undefs_tail = info->hash->undefs_tail; - - if (! (*info->callbacks->add_archive_element) (info, element, - symdef->name)) - goto error_return; - if (! elf_link_add_object_symbols (element, info)) - goto error_return; - - /* If there are any new undefined symbols, we need to make - another pass through the archive in order to see whether - they can be defined. FIXME: This isn't perfect, because - common symbols wind up on undefs_tail and because an - undefined symbol which is defined later on in this pass - does not require another pass. This isn't a bug, but it - does make the code less efficient than it could be. */ - if (undefs_tail != info->hash->undefs_tail) - loop = true; - - /* Look backward to mark all symbols from this object file - which we have already seen in this pass. */ - mark = i; - do - { - included[mark] = true; - if (mark == 0) - break; - --mark; - } - while (symdefs[mark].file_offset == symdef->file_offset); - - /* We mark subsequent symbols from this object file as we go - on through the loop. */ - last = symdef->file_offset; - } - } - while (loop); - - free (defined); - free (included); - - return true; - - error_return: - if (defined != (boolean *) NULL) - free (defined); - if (included != (boolean *) NULL) - free (included); - return false; -} - -/* This function is called when we want to define a new symbol. It - handles the various cases which arise when we find a definition in - a dynamic object, or when there is already a definition in a - dynamic object. The new symbol is described by NAME, SYM, PSEC, - and PVALUE. We set SYM_HASH to the hash table entry. We set - OVERRIDE if the old symbol is overriding a new definition. We set - TYPE_CHANGE_OK if it is OK for the type to change. We set - SIZE_CHANGE_OK if it is OK for the size to change. By OK to - change, we mean that we shouldn't warn if the type or size does - change. DT_NEEDED indicates if it comes from a DT_NEEDED entry of - a shared object. */ - -static boolean -elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash, - override, type_change_ok, size_change_ok, dt_needed) - bfd *abfd; - struct bfd_link_info *info; - const char *name; - Elf_Internal_Sym *sym; - asection **psec; - bfd_vma *pvalue; - struct elf_link_hash_entry **sym_hash; - boolean *override; - boolean *type_change_ok; - boolean *size_change_ok; - boolean dt_needed; -{ - asection *sec; - struct elf_link_hash_entry *h; - int bind; - bfd *oldbfd; - boolean newdyn, olddyn, olddef, newdef, newdyncommon, olddyncommon; - - *override = false; - - sec = *psec; - bind = ELF_ST_BIND (sym->st_info); - - if (! bfd_is_und_section (sec)) - h = elf_link_hash_lookup (elf_hash_table (info), name, true, false, false); - else - h = ((struct elf_link_hash_entry *) - bfd_wrapped_link_hash_lookup (abfd, info, name, true, false, false)); - if (h == NULL) - return false; - *sym_hash = h; - - /* This code is for coping with dynamic objects, and is only useful - if we are doing an ELF link. */ - if (info->hash->creator != abfd->xvec) - return true; - - /* For merging, we only care about real symbols. */ - - while (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - - /* If we just created the symbol, mark it as being an ELF symbol. - Other than that, there is nothing to do--there is no merge issue - with a newly defined symbol--so we just return. */ - - if (h->root.type == bfd_link_hash_new) - { - h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF; - return true; - } - - /* OLDBFD is a BFD associated with the existing symbol. */ - - switch (h->root.type) - { - default: - oldbfd = NULL; - break; - - case bfd_link_hash_undefined: - case bfd_link_hash_undefweak: - oldbfd = h->root.u.undef.abfd; - break; - - case bfd_link_hash_defined: - case bfd_link_hash_defweak: - oldbfd = h->root.u.def.section->owner; - break; - - case bfd_link_hash_common: - oldbfd = h->root.u.c.p->section->owner; - break; - } - - /* In cases involving weak versioned symbols, we may wind up trying - to merge a symbol with itself. Catch that here, to avoid the - confusion that results if we try to override a symbol with - itself. The additional tests catch cases like - _GLOBAL_OFFSET_TABLE_, which are regular symbols defined in a - dynamic object, which we do want to handle here. */ - if (abfd == oldbfd - && ((abfd->flags & DYNAMIC) == 0 - || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)) - return true; - - /* NEWDYN and OLDDYN indicate whether the new or old symbol, - respectively, is from a dynamic object. */ - - if ((abfd->flags & DYNAMIC) != 0) - newdyn = true; - else - newdyn = false; - - if (oldbfd != NULL) - olddyn = (oldbfd->flags & DYNAMIC) != 0; - else - { - asection *hsec; - - /* This code handles the special SHN_MIPS_{TEXT,DATA} section - indices used by MIPS ELF. */ - switch (h->root.type) - { - default: - hsec = NULL; - break; - - case bfd_link_hash_defined: - case bfd_link_hash_defweak: - hsec = h->root.u.def.section; - break; - - case bfd_link_hash_common: - hsec = h->root.u.c.p->section; - break; - } - - if (hsec == NULL) - olddyn = false; - else - olddyn = (hsec->symbol->flags & BSF_DYNAMIC) != 0; - } - - /* NEWDEF and OLDDEF indicate whether the new or old symbol, - respectively, appear to be a definition rather than reference. */ - - if (bfd_is_und_section (sec) || bfd_is_com_section (sec)) - newdef = false; - else - newdef = true; - - if (h->root.type == bfd_link_hash_undefined - || h->root.type == bfd_link_hash_undefweak - || h->root.type == bfd_link_hash_common) - olddef = false; - else - olddef = true; - - /* NEWDYNCOMMON and OLDDYNCOMMON indicate whether the new or old - symbol, respectively, appears to be a common symbol in a dynamic - object. If a symbol appears in an uninitialized section, and is - not weak, and is not a function, then it may be a common symbol - which was resolved when the dynamic object was created. We want - to treat such symbols specially, because they raise special - considerations when setting the symbol size: if the symbol - appears as a common symbol in a regular object, and the size in - the regular object is larger, we must make sure that we use the - larger size. This problematic case can always be avoided in C, - but it must be handled correctly when using Fortran shared - libraries. - - Note that if NEWDYNCOMMON is set, NEWDEF will be set, and - likewise for OLDDYNCOMMON and OLDDEF. - - Note that this test is just a heuristic, and that it is quite - possible to have an uninitialized symbol in a shared object which - is really a definition, rather than a common symbol. This could - lead to some minor confusion when the symbol really is a common - symbol in some regular object. However, I think it will be - harmless. */ - - if (newdyn - && newdef - && (sec->flags & SEC_ALLOC) != 0 - && (sec->flags & SEC_LOAD) == 0 - && sym->st_size > 0 - && bind != STB_WEAK - && ELF_ST_TYPE (sym->st_info) != STT_FUNC) - newdyncommon = true; - else - newdyncommon = false; - - if (olddyn - && olddef - && h->root.type == bfd_link_hash_defined - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->root.u.def.section->flags & SEC_ALLOC) != 0 - && (h->root.u.def.section->flags & SEC_LOAD) == 0 - && h->size > 0 - && h->type != STT_FUNC) - olddyncommon = true; - else - olddyncommon = false; - - /* It's OK to change the type if either the existing symbol or the - new symbol is weak unless it comes from a DT_NEEDED entry of - a shared object, in which case, the DT_NEEDED entry may not be - required at the run time. */ - - if ((! dt_needed && h->root.type == bfd_link_hash_defweak) - || h->root.type == bfd_link_hash_undefweak - || bind == STB_WEAK) - *type_change_ok = true; - - /* It's OK to change the size if either the existing symbol or the - new symbol is weak, or if the old symbol is undefined. */ - - if (*type_change_ok - || h->root.type == bfd_link_hash_undefined) - *size_change_ok = true; - - /* If both the old and the new symbols look like common symbols in a - dynamic object, set the size of the symbol to the larger of the - two. */ - - if (olddyncommon - && newdyncommon - && sym->st_size != h->size) - { - /* Since we think we have two common symbols, issue a multiple - common warning if desired. Note that we only warn if the - size is different. If the size is the same, we simply let - the old symbol override the new one as normally happens with - symbols defined in dynamic objects. */ - - if (! ((*info->callbacks->multiple_common) - (info, h->root.root.string, oldbfd, bfd_link_hash_common, - h->size, abfd, bfd_link_hash_common, sym->st_size))) - return false; - - if (sym->st_size > h->size) - h->size = sym->st_size; - - *size_change_ok = true; - } - - /* If we are looking at a dynamic object, and we have found a - definition, we need to see if the symbol was already defined by - some other object. If so, we want to use the existing - definition, and we do not want to report a multiple symbol - definition error; we do this by clobbering *PSEC to be - bfd_und_section_ptr. - - We treat a common symbol as a definition if the symbol in the - shared library is a function, since common symbols always - represent variables; this can cause confusion in principle, but - any such confusion would seem to indicate an erroneous program or - shared library. We also permit a common symbol in a regular - object to override a weak symbol in a shared object. - - We prefer a non-weak definition in a shared library to a weak - definition in the executable unless it comes from a DT_NEEDED - entry of a shared object, in which case, the DT_NEEDED entry - may not be required at the run time. */ - - if (newdyn - && newdef - && (olddef - || (h->root.type == bfd_link_hash_common - && (bind == STB_WEAK - || ELF_ST_TYPE (sym->st_info) == STT_FUNC))) - && (h->root.type != bfd_link_hash_defweak - || dt_needed - || bind == STB_WEAK)) - { - *override = true; - newdef = false; - newdyncommon = false; - - *psec = sec = bfd_und_section_ptr; - *size_change_ok = true; - - /* If we get here when the old symbol is a common symbol, then - we are explicitly letting it override a weak symbol or - function in a dynamic object, and we don't want to warn about - a type change. If the old symbol is a defined symbol, a type - change warning may still be appropriate. */ - - if (h->root.type == bfd_link_hash_common) - *type_change_ok = true; - } - - /* Handle the special case of an old common symbol merging with a - new symbol which looks like a common symbol in a shared object. - We change *PSEC and *PVALUE to make the new symbol look like a - common symbol, and let _bfd_generic_link_add_one_symbol will do - the right thing. */ - - if (newdyncommon - && h->root.type == bfd_link_hash_common) - { - *override = true; - newdef = false; - newdyncommon = false; - *pvalue = sym->st_size; - *psec = sec = bfd_com_section_ptr; - *size_change_ok = true; - } - - /* If the old symbol is from a dynamic object, and the new symbol is - a definition which is not from a dynamic object, then the new - symbol overrides the old symbol. Symbols from regular files - always take precedence over symbols from dynamic objects, even if - they are defined after the dynamic object in the link. - - As above, we again permit a common symbol in a regular object to - override a definition in a shared object if the shared object - symbol is a function or is weak. - - As above, we permit a non-weak definition in a shared object to - override a weak definition in a regular object. */ - - if (! newdyn - && (newdef - || (bfd_is_com_section (sec) - && (h->root.type == bfd_link_hash_defweak - || h->type == STT_FUNC))) - && olddyn - && olddef - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (bind != STB_WEAK - || h->root.type == bfd_link_hash_defweak)) - { - /* Change the hash table entry to undefined, and let - _bfd_generic_link_add_one_symbol do the right thing with the - new definition. */ - - h->root.type = bfd_link_hash_undefined; - h->root.u.undef.abfd = h->root.u.def.section->owner; - *size_change_ok = true; - - olddef = false; - olddyncommon = false; - - /* We again permit a type change when a common symbol may be - overriding a function. */ - - if (bfd_is_com_section (sec)) - *type_change_ok = true; - - /* This union may have been set to be non-NULL when this symbol - was seen in a dynamic object. We must force the union to be - NULL, so that it is correct for a regular symbol. */ - - h->verinfo.vertree = NULL; - - /* In this special case, if H is the target of an indirection, - we want the caller to frob with H rather than with the - indirect symbol. That will permit the caller to redefine the - target of the indirection, rather than the indirect symbol - itself. FIXME: This will break the -y option if we store a - symbol with a different name. */ - *sym_hash = h; - } - - /* Handle the special case of a new common symbol merging with an - old symbol that looks like it might be a common symbol defined in - a shared object. Note that we have already handled the case in - which a new common symbol should simply override the definition - in the shared library. */ - - if (! newdyn - && bfd_is_com_section (sec) - && olddyncommon) - { - /* It would be best if we could set the hash table entry to a - common symbol, but we don't know what to use for the section - or the alignment. */ - if (! ((*info->callbacks->multiple_common) - (info, h->root.root.string, oldbfd, bfd_link_hash_common, - h->size, abfd, bfd_link_hash_common, sym->st_size))) - return false; - - /* If the predumed common symbol in the dynamic object is - larger, pretend that the new symbol has its size. */ - - if (h->size > *pvalue) - *pvalue = h->size; - - /* FIXME: We no longer know the alignment required by the symbol - in the dynamic object, so we just wind up using the one from - the regular object. */ - - olddef = false; - olddyncommon = false; - - h->root.type = bfd_link_hash_undefined; - h->root.u.undef.abfd = h->root.u.def.section->owner; - - *size_change_ok = true; - *type_change_ok = true; - - h->verinfo.vertree = NULL; - } - - /* Handle the special case of a weak definition in a regular object - followed by a non-weak definition in a shared object. In this - case, we prefer the definition in the shared object unless it - comes from a DT_NEEDED entry of a shared object, in which case, - the DT_NEEDED entry may not be required at the run time. */ - if (olddef - && ! dt_needed - && h->root.type == bfd_link_hash_defweak - && newdef - && newdyn - && bind != STB_WEAK) - { - /* To make this work we have to frob the flags so that the rest - of the code does not think we are using the regular - definition. */ - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0) - h->elf_link_hash_flags |= ELF_LINK_HASH_REF_REGULAR; - else if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0) - h->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC; - h->elf_link_hash_flags &= ~ (ELF_LINK_HASH_DEF_REGULAR - | ELF_LINK_HASH_DEF_DYNAMIC); - - /* If H is the target of an indirection, we want the caller to - use H rather than the indirect symbol. Otherwise if we are - defining a new indirect symbol we will wind up attaching it - to the entry we are overriding. */ - *sym_hash = h; - } - - /* Handle the special case of a non-weak definition in a shared - object followed by a weak definition in a regular object. In - this case we prefer to definition in the shared object. To make - this work we have to tell the caller to not treat the new symbol - as a definition. */ - if (olddef - && olddyn - && h->root.type != bfd_link_hash_defweak - && newdef - && ! newdyn - && bind == STB_WEAK) - *override = true; - - return true; -} - -/* Add symbols from an ELF object file to the linker hash table. */ - -static boolean -elf_link_add_object_symbols (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - boolean (*add_symbol_hook) PARAMS ((bfd *, struct bfd_link_info *, - const Elf_Internal_Sym *, - const char **, flagword *, - asection **, bfd_vma *)); - boolean (*check_relocs) PARAMS ((bfd *, struct bfd_link_info *, - asection *, const Elf_Internal_Rela *)); - boolean collect; - Elf_Internal_Shdr *hdr; - size_t symcount; - size_t extsymcount; - size_t extsymoff; - Elf_External_Sym *buf = NULL; - struct elf_link_hash_entry **sym_hash; - boolean dynamic; - Elf_External_Versym *extversym = NULL; - Elf_External_Versym *ever; - Elf_External_Dyn *dynbuf = NULL; - struct elf_link_hash_entry *weaks; - Elf_External_Sym *esym; - Elf_External_Sym *esymend; - struct elf_backend_data *bed; - boolean dt_needed; - struct elf_link_hash_table * hash_table; - - hash_table = elf_hash_table (info); - - bed = get_elf_backend_data (abfd); - add_symbol_hook = bed->elf_add_symbol_hook; - collect = bed->collect; - - if ((abfd->flags & DYNAMIC) == 0) - dynamic = false; - else - { - dynamic = true; - - /* You can't use -r against a dynamic object. Also, there's no - hope of using a dynamic object which does not exactly match - the format of the output file. */ - if (info->relocateable || info->hash->creator != abfd->xvec) - { - bfd_set_error (bfd_error_invalid_operation); - goto error_return; - } - } - - /* As a GNU extension, any input sections which are named - .gnu.warning.SYMBOL are treated as warning symbols for the given - symbol. This differs from .gnu.warning sections, which generate - warnings when they are included in an output file. */ - if (! info->shared) - { - asection *s; - - for (s = abfd->sections; s != NULL; s = s->next) - { - const char *name; - - name = bfd_get_section_name (abfd, s); - if (strncmp (name, ".gnu.warning.", sizeof ".gnu.warning." - 1) == 0) - { - char *msg; - bfd_size_type sz; - - name += sizeof ".gnu.warning." - 1; - - /* If this is a shared object, then look up the symbol - in the hash table. If it is there, and it is already - been defined, then we will not be using the entry - from this shared object, so we don't need to warn. - FIXME: If we see the definition in a regular object - later on, we will warn, but we shouldn't. The only - fix is to keep track of what warnings we are supposed - to emit, and then handle them all at the end of the - link. */ - if (dynamic && abfd->xvec == info->hash->creator) - { - struct elf_link_hash_entry *h; - - h = elf_link_hash_lookup (hash_table, name, - false, false, true); - - /* FIXME: What about bfd_link_hash_common? */ - if (h != NULL - && (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak)) - { - /* We don't want to issue this warning. Clobber - the section size so that the warning does not - get copied into the output file. */ - s->_raw_size = 0; - continue; - } - } - - sz = bfd_section_size (abfd, s); - msg = (char *) bfd_alloc (abfd, sz + 1); - if (msg == NULL) - goto error_return; - - if (! bfd_get_section_contents (abfd, s, msg, (file_ptr) 0, sz)) - goto error_return; - - msg[sz] = '\0'; - - if (! (_bfd_generic_link_add_one_symbol - (info, abfd, name, BSF_WARNING, s, (bfd_vma) 0, msg, - false, collect, (struct bfd_link_hash_entry **) NULL))) - goto error_return; - - if (! info->relocateable) - { - /* Clobber the section size so that the warning does - not get copied into the output file. */ - s->_raw_size = 0; - } - } - } - } - - /* If this is a dynamic object, we always link against the .dynsym - symbol table, not the .symtab symbol table. The dynamic linker - will only see the .dynsym symbol table, so there is no reason to - look at .symtab for a dynamic object. */ - - if (! dynamic || elf_dynsymtab (abfd) == 0) - hdr = &elf_tdata (abfd)->symtab_hdr; - else - hdr = &elf_tdata (abfd)->dynsymtab_hdr; - - if (dynamic) - { - /* Read in any version definitions. */ - - if (! _bfd_elf_slurp_version_tables (abfd)) - goto error_return; - - /* Read in the symbol versions, but don't bother to convert them - to internal format. */ - if (elf_dynversym (abfd) != 0) - { - Elf_Internal_Shdr *versymhdr; - - versymhdr = &elf_tdata (abfd)->dynversym_hdr; - extversym = (Elf_External_Versym *) bfd_malloc (versymhdr->sh_size); - if (extversym == NULL) - goto error_return; - if (bfd_seek (abfd, versymhdr->sh_offset, SEEK_SET) != 0 - || (bfd_read ((PTR) extversym, 1, versymhdr->sh_size, abfd) - != versymhdr->sh_size)) - goto error_return; - } - } - - symcount = hdr->sh_size / sizeof (Elf_External_Sym); - - /* The sh_info field of the symtab header tells us where the - external symbols start. We don't care about the local symbols at - this point. */ - if (elf_bad_symtab (abfd)) - { - extsymcount = symcount; - extsymoff = 0; - } - else - { - extsymcount = symcount - hdr->sh_info; - extsymoff = hdr->sh_info; - } - - buf = ((Elf_External_Sym *) - bfd_malloc (extsymcount * sizeof (Elf_External_Sym))); - if (buf == NULL && extsymcount != 0) - goto error_return; - - /* We store a pointer to the hash table entry for each external - symbol. */ - sym_hash = ((struct elf_link_hash_entry **) - bfd_alloc (abfd, - extsymcount * sizeof (struct elf_link_hash_entry *))); - if (sym_hash == NULL) - goto error_return; - elf_sym_hashes (abfd) = sym_hash; - - dt_needed = false; - - if (! dynamic) - { - /* If we are creating a shared library, create all the dynamic - sections immediately. We need to attach them to something, - so we attach them to this BFD, provided it is the right - format. FIXME: If there are no input BFD's of the same - format as the output, we can't make a shared library. */ - if (info->shared - && is_elf_hash_table (info) - && ! hash_table->dynamic_sections_created - && abfd->xvec == info->hash->creator) - { - if (! elf_link_create_dynamic_sections (abfd, info)) - goto error_return; - } - } - else if (! is_elf_hash_table (info)) - goto error_return; - else - { - asection *s; - boolean add_needed; - const char *name; - bfd_size_type oldsize; - bfd_size_type strindex; - - /* Find the name to use in a DT_NEEDED entry that refers to this - object. If the object has a DT_SONAME entry, we use it. - Otherwise, if the generic linker stuck something in - elf_dt_name, we use that. Otherwise, we just use the file - name. If the generic linker put a null string into - elf_dt_name, we don't make a DT_NEEDED entry at all, even if - there is a DT_SONAME entry. */ - add_needed = true; - name = bfd_get_filename (abfd); - if (elf_dt_name (abfd) != NULL) - { - name = elf_dt_name (abfd); - if (*name == '\0') - { - if (elf_dt_soname (abfd) != NULL) - dt_needed = true; - - add_needed = false; - } - } - s = bfd_get_section_by_name (abfd, ".dynamic"); - if (s != NULL) - { - Elf_External_Dyn *extdyn; - Elf_External_Dyn *extdynend; - int elfsec; - unsigned long link; - int rpath; - int runpath; - - dynbuf = (Elf_External_Dyn *) bfd_malloc ((size_t) s->_raw_size); - if (dynbuf == NULL) - goto error_return; - - if (! bfd_get_section_contents (abfd, s, (PTR) dynbuf, - (file_ptr) 0, s->_raw_size)) - goto error_return; - - elfsec = _bfd_elf_section_from_bfd_section (abfd, s); - if (elfsec == -1) - goto error_return; - link = elf_elfsections (abfd)[elfsec]->sh_link; - - { - /* The shared libraries distributed with hpux11 have a bogus - sh_link field for the ".dynamic" section. This code detects - when LINK refers to a section that is not a string table and - tries to find the string table for the ".dynsym" section - instead. */ - Elf_Internal_Shdr *hdr = elf_elfsections (abfd)[link]; - if (hdr->sh_type != SHT_STRTAB) - { - asection *s = bfd_get_section_by_name (abfd, ".dynsym"); - int elfsec = _bfd_elf_section_from_bfd_section (abfd, s); - if (elfsec == -1) - goto error_return; - link = elf_elfsections (abfd)[elfsec]->sh_link; - } - } - - extdyn = dynbuf; - extdynend = extdyn + s->_raw_size / sizeof (Elf_External_Dyn); - rpath = 0; - runpath = 0; - for (; extdyn < extdynend; extdyn++) - { - Elf_Internal_Dyn dyn; - - elf_swap_dyn_in (abfd, extdyn, &dyn); - if (dyn.d_tag == DT_SONAME) - { - name = bfd_elf_string_from_elf_section (abfd, link, - dyn.d_un.d_val); - if (name == NULL) - goto error_return; - } - if (dyn.d_tag == DT_NEEDED) - { - struct bfd_link_needed_list *n, **pn; - char *fnm, *anm; - - n = ((struct bfd_link_needed_list *) - bfd_alloc (abfd, sizeof (struct bfd_link_needed_list))); - fnm = bfd_elf_string_from_elf_section (abfd, link, - dyn.d_un.d_val); - if (n == NULL || fnm == NULL) - goto error_return; - anm = bfd_alloc (abfd, strlen (fnm) + 1); - if (anm == NULL) - goto error_return; - strcpy (anm, fnm); - n->name = anm; - n->by = abfd; - n->next = NULL; - for (pn = & hash_table->needed; - *pn != NULL; - pn = &(*pn)->next) - ; - *pn = n; - } - if (dyn.d_tag == DT_RUNPATH) - { - struct bfd_link_needed_list *n, **pn; - char *fnm, *anm; - - /* When we see DT_RPATH before DT_RUNPATH, we have - to clear runpath. Do _NOT_ bfd_release, as that - frees all more recently bfd_alloc'd blocks as - well. */ - if (rpath && hash_table->runpath) - hash_table->runpath = NULL; - - n = ((struct bfd_link_needed_list *) - bfd_alloc (abfd, sizeof (struct bfd_link_needed_list))); - fnm = bfd_elf_string_from_elf_section (abfd, link, - dyn.d_un.d_val); - if (n == NULL || fnm == NULL) - goto error_return; - anm = bfd_alloc (abfd, strlen (fnm) + 1); - if (anm == NULL) - goto error_return; - strcpy (anm, fnm); - n->name = anm; - n->by = abfd; - n->next = NULL; - for (pn = & hash_table->runpath; - *pn != NULL; - pn = &(*pn)->next) - ; - *pn = n; - runpath = 1; - rpath = 0; - } - /* Ignore DT_RPATH if we have seen DT_RUNPATH. */ - if (!runpath && dyn.d_tag == DT_RPATH) - { - struct bfd_link_needed_list *n, **pn; - char *fnm, *anm; - - n = ((struct bfd_link_needed_list *) - bfd_alloc (abfd, sizeof (struct bfd_link_needed_list))); - fnm = bfd_elf_string_from_elf_section (abfd, link, - dyn.d_un.d_val); - if (n == NULL || fnm == NULL) - goto error_return; - anm = bfd_alloc (abfd, strlen (fnm) + 1); - if (anm == NULL) - goto error_return; - strcpy (anm, fnm); - n->name = anm; - n->by = abfd; - n->next = NULL; - for (pn = & hash_table->runpath; - *pn != NULL; - pn = &(*pn)->next) - ; - *pn = n; - rpath = 1; - } - } - - free (dynbuf); - dynbuf = NULL; - } - - /* We do not want to include any of the sections in a dynamic - object in the output file. We hack by simply clobbering the - list of sections in the BFD. This could be handled more - cleanly by, say, a new section flag; the existing - SEC_NEVER_LOAD flag is not the one we want, because that one - still implies that the section takes up space in the output - file. */ - abfd->sections = NULL; - abfd->section_count = 0; - - /* If this is the first dynamic object found in the link, create - the special sections required for dynamic linking. */ - if (! hash_table->dynamic_sections_created) - if (! elf_link_create_dynamic_sections (abfd, info)) - goto error_return; - - if (add_needed) - { - /* Add a DT_NEEDED entry for this dynamic object. */ - oldsize = _bfd_stringtab_size (hash_table->dynstr); - strindex = _bfd_stringtab_add (hash_table->dynstr, name, - true, false); - if (strindex == (bfd_size_type) -1) - goto error_return; - - if (oldsize == _bfd_stringtab_size (hash_table->dynstr)) - { - asection *sdyn; - Elf_External_Dyn *dyncon, *dynconend; - - /* The hash table size did not change, which means that - the dynamic object name was already entered. If we - have already included this dynamic object in the - link, just ignore it. There is no reason to include - a particular dynamic object more than once. */ - sdyn = bfd_get_section_by_name (hash_table->dynobj, ".dynamic"); - BFD_ASSERT (sdyn != NULL); - - dyncon = (Elf_External_Dyn *) sdyn->contents; - dynconend = (Elf_External_Dyn *) (sdyn->contents + - sdyn->_raw_size); - for (; dyncon < dynconend; dyncon++) - { - Elf_Internal_Dyn dyn; - - elf_swap_dyn_in (hash_table->dynobj, dyncon, & dyn); - if (dyn.d_tag == DT_NEEDED - && dyn.d_un.d_val == strindex) - { - if (buf != NULL) - free (buf); - if (extversym != NULL) - free (extversym); - return true; - } - } - } - - if (! elf_add_dynamic_entry (info, DT_NEEDED, strindex)) - goto error_return; - } - - /* Save the SONAME, if there is one, because sometimes the - linker emulation code will need to know it. */ - if (*name == '\0') - name = basename (bfd_get_filename (abfd)); - elf_dt_name (abfd) = name; - } - - if (bfd_seek (abfd, - hdr->sh_offset + extsymoff * sizeof (Elf_External_Sym), - SEEK_SET) != 0 - || (bfd_read ((PTR) buf, sizeof (Elf_External_Sym), extsymcount, abfd) - != extsymcount * sizeof (Elf_External_Sym))) - goto error_return; - - weaks = NULL; - - ever = extversym != NULL ? extversym + extsymoff : NULL; - esymend = buf + extsymcount; - for (esym = buf; - esym < esymend; - esym++, sym_hash++, ever = (ever != NULL ? ever + 1 : NULL)) - { - Elf_Internal_Sym sym; - int bind; - bfd_vma value; - asection *sec; - flagword flags; - const char *name; - struct elf_link_hash_entry *h; - boolean definition; - boolean size_change_ok, type_change_ok; - boolean new_weakdef; - unsigned int old_alignment; - - elf_swap_symbol_in (abfd, esym, &sym); - - flags = BSF_NO_FLAGS; - sec = NULL; - value = sym.st_value; - *sym_hash = NULL; - - bind = ELF_ST_BIND (sym.st_info); - if (bind == STB_LOCAL) - { - /* This should be impossible, since ELF requires that all - global symbols follow all local symbols, and that sh_info - point to the first global symbol. Unfortunatealy, Irix 5 - screws this up. */ - continue; - } - else if (bind == STB_GLOBAL) - { - if (sym.st_shndx != SHN_UNDEF - && sym.st_shndx != SHN_COMMON) - flags = BSF_GLOBAL; - } - else if (bind == STB_WEAK) - flags = BSF_WEAK; - else - { - /* Leave it up to the processor backend. */ - } - - if (sym.st_shndx == SHN_UNDEF) - sec = bfd_und_section_ptr; - else if (sym.st_shndx > 0 && sym.st_shndx < SHN_LORESERVE) - { - sec = section_from_elf_index (abfd, sym.st_shndx); - if (sec == NULL) - sec = bfd_abs_section_ptr; - else if ((abfd->flags & (EXEC_P | DYNAMIC)) != 0) - value -= sec->vma; - } - else if (sym.st_shndx == SHN_ABS) - sec = bfd_abs_section_ptr; - else if (sym.st_shndx == SHN_COMMON) - { - sec = bfd_com_section_ptr; - /* What ELF calls the size we call the value. What ELF - calls the value we call the alignment. */ - value = sym.st_size; - } - else - { - /* Leave it up to the processor backend. */ - } - - name = bfd_elf_string_from_elf_section (abfd, hdr->sh_link, sym.st_name); - if (name == (const char *) NULL) - goto error_return; - - if (add_symbol_hook) - { - if (! (*add_symbol_hook) (abfd, info, &sym, &name, &flags, &sec, - &value)) - goto error_return; - - /* The hook function sets the name to NULL if this symbol - should be skipped for some reason. */ - if (name == (const char *) NULL) - continue; - } - - /* Sanity check that all possibilities were handled. */ - if (sec == (asection *) NULL) - { - bfd_set_error (bfd_error_bad_value); - goto error_return; - } - - if (bfd_is_und_section (sec) - || bfd_is_com_section (sec)) - definition = false; - else - definition = true; - - size_change_ok = false; - type_change_ok = get_elf_backend_data (abfd)->type_change_ok; - old_alignment = 0; - if (info->hash->creator->flavour == bfd_target_elf_flavour) - { - Elf_Internal_Versym iver; - unsigned int vernum = 0; - boolean override; - - if (ever != NULL) - { - _bfd_elf_swap_versym_in (abfd, ever, &iver); - vernum = iver.vs_vers & VERSYM_VERSION; - - /* If this is a hidden symbol, or if it is not version - 1, we append the version name to the symbol name. - However, we do not modify a non-hidden absolute - symbol, because it might be the version symbol - itself. FIXME: What if it isn't? */ - if ((iver.vs_vers & VERSYM_HIDDEN) != 0 - || (vernum > 1 && ! bfd_is_abs_section (sec))) - { - const char *verstr; - int namelen, newlen; - char *newname, *p; - - if (sym.st_shndx != SHN_UNDEF) - { - if (vernum > elf_tdata (abfd)->dynverdef_hdr.sh_info) - { - (*_bfd_error_handler) - (_("%s: %s: invalid version %u (max %d)"), - bfd_get_filename (abfd), name, vernum, - elf_tdata (abfd)->dynverdef_hdr.sh_info); - bfd_set_error (bfd_error_bad_value); - goto error_return; - } - else if (vernum > 1) - verstr = - elf_tdata (abfd)->verdef[vernum - 1].vd_nodename; - else - verstr = ""; - } - else - { - /* We cannot simply test for the number of - entries in the VERNEED section since the - numbers for the needed versions do not start - at 0. */ - Elf_Internal_Verneed *t; - - verstr = NULL; - for (t = elf_tdata (abfd)->verref; - t != NULL; - t = t->vn_nextref) - { - Elf_Internal_Vernaux *a; - - for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr) - { - if (a->vna_other == vernum) - { - verstr = a->vna_nodename; - break; - } - } - if (a != NULL) - break; - } - if (verstr == NULL) - { - (*_bfd_error_handler) - (_("%s: %s: invalid needed version %d"), - bfd_get_filename (abfd), name, vernum); - bfd_set_error (bfd_error_bad_value); - goto error_return; - } - } - - namelen = strlen (name); - newlen = namelen + strlen (verstr) + 2; - if ((iver.vs_vers & VERSYM_HIDDEN) == 0) - ++newlen; - - newname = (char *) bfd_alloc (abfd, newlen); - if (newname == NULL) - goto error_return; - strcpy (newname, name); - p = newname + namelen; - *p++ = ELF_VER_CHR; - /* If this is a defined non-hidden version symbol, - we add another @ to the name. This indicates the - default version of the symbol. */ - if ((iver.vs_vers & VERSYM_HIDDEN) == 0 - && sym.st_shndx != SHN_UNDEF) - *p++ = ELF_VER_CHR; - strcpy (p, verstr); - - name = newname; - } - } - - if (! elf_merge_symbol (abfd, info, name, &sym, &sec, &value, - sym_hash, &override, &type_change_ok, - &size_change_ok, dt_needed)) - goto error_return; - - if (override) - definition = false; - - h = *sym_hash; - while (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - - /* Remember the old alignment if this is a common symbol, so - that we don't reduce the alignment later on. We can't - check later, because _bfd_generic_link_add_one_symbol - will set a default for the alignment which we want to - override. */ - if (h->root.type == bfd_link_hash_common) - old_alignment = h->root.u.c.p->alignment_power; - - if (elf_tdata (abfd)->verdef != NULL - && ! override - && vernum > 1 - && definition) - h->verinfo.verdef = &elf_tdata (abfd)->verdef[vernum - 1]; - } - - if (! (_bfd_generic_link_add_one_symbol - (info, abfd, name, flags, sec, value, (const char *) NULL, - false, collect, (struct bfd_link_hash_entry **) sym_hash))) - goto error_return; - - h = *sym_hash; - while (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - *sym_hash = h; - - new_weakdef = false; - if (dynamic - && definition - && (flags & BSF_WEAK) != 0 - && ELF_ST_TYPE (sym.st_info) != STT_FUNC - && info->hash->creator->flavour == bfd_target_elf_flavour - && h->weakdef == NULL) - { - /* Keep a list of all weak defined non function symbols from - a dynamic object, using the weakdef field. Later in this - function we will set the weakdef field to the correct - value. We only put non-function symbols from dynamic - objects on this list, because that happens to be the only - time we need to know the normal symbol corresponding to a - weak symbol, and the information is time consuming to - figure out. If the weakdef field is not already NULL, - then this symbol was already defined by some previous - dynamic object, and we will be using that previous - definition anyhow. */ - - h->weakdef = weaks; - weaks = h; - new_weakdef = true; - } - - /* Set the alignment of a common symbol. */ - if (sym.st_shndx == SHN_COMMON - && h->root.type == bfd_link_hash_common) - { - unsigned int align; - - align = bfd_log2 (sym.st_value); - if (align > old_alignment - /* Permit an alignment power of zero if an alignment of one - is specified and no other alignments have been specified. */ - || (sym.st_value == 1 && old_alignment == 0)) - h->root.u.c.p->alignment_power = align; - } - - if (info->hash->creator->flavour == bfd_target_elf_flavour) - { - int old_flags; - boolean dynsym; - int new_flag; - - /* Remember the symbol size and type. */ - if (sym.st_size != 0 - && (definition || h->size == 0)) - { - if (h->size != 0 && h->size != sym.st_size && ! size_change_ok) - (*_bfd_error_handler) - (_("Warning: size of symbol `%s' changed from %lu to %lu in %s"), - name, (unsigned long) h->size, (unsigned long) sym.st_size, - bfd_get_filename (abfd)); - - h->size = sym.st_size; - } - - /* If this is a common symbol, then we always want H->SIZE - to be the size of the common symbol. The code just above - won't fix the size if a common symbol becomes larger. We - don't warn about a size change here, because that is - covered by --warn-common. */ - if (h->root.type == bfd_link_hash_common) - h->size = h->root.u.c.size; - - if (ELF_ST_TYPE (sym.st_info) != STT_NOTYPE - && (definition || h->type == STT_NOTYPE)) - { - if (h->type != STT_NOTYPE - && h->type != ELF_ST_TYPE (sym.st_info) - && ! type_change_ok) - (*_bfd_error_handler) - (_("Warning: type of symbol `%s' changed from %d to %d in %s"), - name, h->type, ELF_ST_TYPE (sym.st_info), - bfd_get_filename (abfd)); - - h->type = ELF_ST_TYPE (sym.st_info); - } - - /* If st_other has a processor-specific meaning, specific code - might be needed here. */ - if (sym.st_other != 0) - { - /* Combine visibilities, using the most constraining one. */ - unsigned char hvis = ELF_ST_VISIBILITY (h->other); - unsigned char symvis = ELF_ST_VISIBILITY (sym.st_other); - - if (symvis && (hvis > symvis || hvis == 0)) - h->other = sym.st_other; - - /* If neither has visibility, use the st_other of the - definition. This is an arbitrary choice, since the - other bits have no general meaning. */ - if (!symvis && !hvis - && (definition || h->other == 0)) - h->other = sym.st_other; - } - - /* Set a flag in the hash table entry indicating the type of - reference or definition we just found. Keep a count of - the number of dynamic symbols we find. A dynamic symbol - is one which is referenced or defined by both a regular - object and a shared object. */ - old_flags = h->elf_link_hash_flags; - dynsym = false; - if (! dynamic) - { - if (! definition) - { - new_flag = ELF_LINK_HASH_REF_REGULAR; - if (bind != STB_WEAK) - new_flag |= ELF_LINK_HASH_REF_REGULAR_NONWEAK; - } - else - new_flag = ELF_LINK_HASH_DEF_REGULAR; - if (info->shared - || (old_flags & (ELF_LINK_HASH_DEF_DYNAMIC - | ELF_LINK_HASH_REF_DYNAMIC)) != 0) - dynsym = true; - } - else - { - if (! definition) - new_flag = ELF_LINK_HASH_REF_DYNAMIC; - else - new_flag = ELF_LINK_HASH_DEF_DYNAMIC; - if ((old_flags & (ELF_LINK_HASH_DEF_REGULAR - | ELF_LINK_HASH_REF_REGULAR)) != 0 - || (h->weakdef != NULL - && ! new_weakdef - && h->weakdef->dynindx != -1)) - dynsym = true; - } - - h->elf_link_hash_flags |= new_flag; - - /* If this symbol has a version, and it is the default - version, we create an indirect symbol from the default - name to the fully decorated name. This will cause - external references which do not specify a version to be - bound to this version of the symbol. */ - if (definition || h->root.type == bfd_link_hash_common) - { - char *p; - - p = strchr (name, ELF_VER_CHR); - if (p != NULL && p[1] == ELF_VER_CHR) - { - char *shortname; - struct elf_link_hash_entry *hi; - boolean override; - - shortname = bfd_hash_allocate (&info->hash->table, - p - name + 1); - if (shortname == NULL) - goto error_return; - strncpy (shortname, name, p - name); - shortname[p - name] = '\0'; - - /* We are going to create a new symbol. Merge it - with any existing symbol with this name. For the - purposes of the merge, act as though we were - defining the symbol we just defined, although we - actually going to define an indirect symbol. */ - type_change_ok = false; - size_change_ok = false; - if (! elf_merge_symbol (abfd, info, shortname, &sym, &sec, - &value, &hi, &override, - &type_change_ok, - &size_change_ok, dt_needed)) - goto error_return; - - if (! override) - { - if (! (_bfd_generic_link_add_one_symbol - (info, abfd, shortname, BSF_INDIRECT, - bfd_ind_section_ptr, (bfd_vma) 0, name, false, - collect, (struct bfd_link_hash_entry **) &hi))) - goto error_return; - } - else - { - /* In this case the symbol named SHORTNAME is - overriding the indirect symbol we want to - add. We were planning on making SHORTNAME an - indirect symbol referring to NAME. SHORTNAME - is the name without a version. NAME is the - fully versioned name, and it is the default - version. - - Overriding means that we already saw a - definition for the symbol SHORTNAME in a - regular object, and it is overriding the - symbol defined in the dynamic object. - - When this happens, we actually want to change - NAME, the symbol we just added, to refer to - SHORTNAME. This will cause references to - NAME in the shared object to become - references to SHORTNAME in the regular - object. This is what we expect when we - override a function in a shared object: that - the references in the shared object will be - mapped to the definition in the regular - object. */ - - while (hi->root.type == bfd_link_hash_indirect - || hi->root.type == bfd_link_hash_warning) - hi = (struct elf_link_hash_entry *) hi->root.u.i.link; - - h->root.type = bfd_link_hash_indirect; - h->root.u.i.link = (struct bfd_link_hash_entry *) hi; - if (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) - { - h->elf_link_hash_flags &=~ ELF_LINK_HASH_DEF_DYNAMIC; - hi->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC; - if (hi->elf_link_hash_flags - & (ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_DEF_REGULAR)) - { - if (! _bfd_elf_link_record_dynamic_symbol (info, - hi)) - goto error_return; - } - } - - /* Now set HI to H, so that the following code - will set the other fields correctly. */ - hi = h; - } - - /* If there is a duplicate definition somewhere, - then HI may not point to an indirect symbol. We - will have reported an error to the user in that - case. */ - - if (hi->root.type == bfd_link_hash_indirect) - { - struct elf_link_hash_entry *ht; - - /* If the symbol became indirect, then we assume - that we have not seen a definition before. */ - BFD_ASSERT ((hi->elf_link_hash_flags - & (ELF_LINK_HASH_DEF_DYNAMIC - | ELF_LINK_HASH_DEF_REGULAR)) - == 0); - - ht = (struct elf_link_hash_entry *) hi->root.u.i.link; - (*bed->elf_backend_copy_indirect_symbol) (ht, hi); - - /* See if the new flags lead us to realize that - the symbol must be dynamic. */ - if (! dynsym) - { - if (! dynamic) - { - if (info->shared - || ((hi->elf_link_hash_flags - & ELF_LINK_HASH_REF_DYNAMIC) - != 0)) - dynsym = true; - } - else - { - if ((hi->elf_link_hash_flags - & ELF_LINK_HASH_REF_REGULAR) != 0) - dynsym = true; - } - } - } - - /* We also need to define an indirection from the - nondefault version of the symbol. */ - - shortname = bfd_hash_allocate (&info->hash->table, - strlen (name)); - if (shortname == NULL) - goto error_return; - strncpy (shortname, name, p - name); - strcpy (shortname + (p - name), p + 1); - - /* Once again, merge with any existing symbol. */ - type_change_ok = false; - size_change_ok = false; - if (! elf_merge_symbol (abfd, info, shortname, &sym, &sec, - &value, &hi, &override, - &type_change_ok, - &size_change_ok, dt_needed)) - goto error_return; - - if (override) - { - /* Here SHORTNAME is a versioned name, so we - don't expect to see the type of override we - do in the case above. */ - (*_bfd_error_handler) - (_("%s: warning: unexpected redefinition of `%s'"), - bfd_get_filename (abfd), shortname); - } - else - { - if (! (_bfd_generic_link_add_one_symbol - (info, abfd, shortname, BSF_INDIRECT, - bfd_ind_section_ptr, (bfd_vma) 0, name, false, - collect, (struct bfd_link_hash_entry **) &hi))) - goto error_return; - - /* If there is a duplicate definition somewhere, - then HI may not point to an indirect symbol. - We will have reported an error to the user in - that case. */ - - if (hi->root.type == bfd_link_hash_indirect) - { - /* If the symbol became indirect, then we - assume that we have not seen a definition - before. */ - BFD_ASSERT ((hi->elf_link_hash_flags - & (ELF_LINK_HASH_DEF_DYNAMIC - | ELF_LINK_HASH_DEF_REGULAR)) - == 0); - - (*bed->elf_backend_copy_indirect_symbol) (h, hi); - - /* See if the new flags lead us to realize - that the symbol must be dynamic. */ - if (! dynsym) - { - if (! dynamic) - { - if (info->shared - || ((hi->elf_link_hash_flags - & ELF_LINK_HASH_REF_DYNAMIC) - != 0)) - dynsym = true; - } - else - { - if ((hi->elf_link_hash_flags - & ELF_LINK_HASH_REF_REGULAR) != 0) - dynsym = true; - } - } - } - } - } - } - - if (dynsym && h->dynindx == -1) - { - if (! _bfd_elf_link_record_dynamic_symbol (info, h)) - goto error_return; - if (h->weakdef != NULL - && ! new_weakdef - && h->weakdef->dynindx == -1) - { - if (! _bfd_elf_link_record_dynamic_symbol (info, h->weakdef)) - goto error_return; - } - } - else if (dynsym && h->dynindx != -1) - /* If the symbol already has a dynamic index, but - visibility says it should not be visible, turn it into - a local symbol. */ - switch (ELF_ST_VISIBILITY (h->other)) - { - case STV_INTERNAL: - case STV_HIDDEN: - h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL; - (*bed->elf_backend_hide_symbol) (info, h); - break; - } - - if (dt_needed && definition - && (h->elf_link_hash_flags - & ELF_LINK_HASH_REF_REGULAR) != 0) - { - bfd_size_type oldsize; - bfd_size_type strindex; - - if (! is_elf_hash_table (info)) - goto error_return; - - /* The symbol from a DT_NEEDED object is referenced from - the regular object to create a dynamic executable. We - have to make sure there is a DT_NEEDED entry for it. */ - - dt_needed = false; - oldsize = _bfd_stringtab_size (hash_table->dynstr); - strindex = _bfd_stringtab_add (hash_table->dynstr, - elf_dt_soname (abfd), - true, false); - if (strindex == (bfd_size_type) -1) - goto error_return; - - if (oldsize - == _bfd_stringtab_size (hash_table->dynstr)) - { - asection *sdyn; - Elf_External_Dyn *dyncon, *dynconend; - - sdyn = bfd_get_section_by_name (hash_table->dynobj, - ".dynamic"); - BFD_ASSERT (sdyn != NULL); - - dyncon = (Elf_External_Dyn *) sdyn->contents; - dynconend = (Elf_External_Dyn *) (sdyn->contents + - sdyn->_raw_size); - for (; dyncon < dynconend; dyncon++) - { - Elf_Internal_Dyn dyn; - - elf_swap_dyn_in (hash_table->dynobj, - dyncon, &dyn); - BFD_ASSERT (dyn.d_tag != DT_NEEDED || - dyn.d_un.d_val != strindex); - } - } - - if (! elf_add_dynamic_entry (info, DT_NEEDED, strindex)) - goto error_return; - } - } - } - - /* Now set the weakdefs field correctly for all the weak defined - symbols we found. The only way to do this is to search all the - symbols. Since we only need the information for non functions in - dynamic objects, that's the only time we actually put anything on - the list WEAKS. We need this information so that if a regular - object refers to a symbol defined weakly in a dynamic object, the - real symbol in the dynamic object is also put in the dynamic - symbols; we also must arrange for both symbols to point to the - same memory location. We could handle the general case of symbol - aliasing, but a general symbol alias can only be generated in - assembler code, handling it correctly would be very time - consuming, and other ELF linkers don't handle general aliasing - either. */ - while (weaks != NULL) - { - struct elf_link_hash_entry *hlook; - asection *slook; - bfd_vma vlook; - struct elf_link_hash_entry **hpp; - struct elf_link_hash_entry **hppend; - - hlook = weaks; - weaks = hlook->weakdef; - hlook->weakdef = NULL; - - BFD_ASSERT (hlook->root.type == bfd_link_hash_defined - || hlook->root.type == bfd_link_hash_defweak - || hlook->root.type == bfd_link_hash_common - || hlook->root.type == bfd_link_hash_indirect); - slook = hlook->root.u.def.section; - vlook = hlook->root.u.def.value; - - hpp = elf_sym_hashes (abfd); - hppend = hpp + extsymcount; - for (; hpp < hppend; hpp++) - { - struct elf_link_hash_entry *h; - - h = *hpp; - if (h != NULL && h != hlook - && h->root.type == bfd_link_hash_defined - && h->root.u.def.section == slook - && h->root.u.def.value == vlook) - { - hlook->weakdef = h; - - /* If the weak definition is in the list of dynamic - symbols, make sure the real definition is put there - as well. */ - if (hlook->dynindx != -1 - && h->dynindx == -1) - { - if (! _bfd_elf_link_record_dynamic_symbol (info, h)) - goto error_return; - } - - /* If the real definition is in the list of dynamic - symbols, make sure the weak definition is put there - as well. If we don't do this, then the dynamic - loader might not merge the entries for the real - definition and the weak definition. */ - if (h->dynindx != -1 - && hlook->dynindx == -1) - { - if (! _bfd_elf_link_record_dynamic_symbol (info, hlook)) - goto error_return; - } - - break; - } - } - } - - if (buf != NULL) - { - free (buf); - buf = NULL; - } - - if (extversym != NULL) - { - free (extversym); - extversym = NULL; - } - - /* If this object is the same format as the output object, and it is - not a shared library, then let the backend look through the - relocs. - - This is required to build global offset table entries and to - arrange for dynamic relocs. It is not required for the - particular common case of linking non PIC code, even when linking - against shared libraries, but unfortunately there is no way of - knowing whether an object file has been compiled PIC or not. - Looking through the relocs is not particularly time consuming. - The problem is that we must either (1) keep the relocs in memory, - which causes the linker to require additional runtime memory or - (2) read the relocs twice from the input file, which wastes time. - This would be a good case for using mmap. - - I have no idea how to handle linking PIC code into a file of a - different format. It probably can't be done. */ - check_relocs = get_elf_backend_data (abfd)->check_relocs; - if (! dynamic - && abfd->xvec == info->hash->creator - && check_relocs != NULL) - { - asection *o; - - for (o = abfd->sections; o != NULL; o = o->next) - { - Elf_Internal_Rela *internal_relocs; - boolean ok; - - if ((o->flags & SEC_RELOC) == 0 - || o->reloc_count == 0 - || ((info->strip == strip_all || info->strip == strip_debugger) - && (o->flags & SEC_DEBUGGING) != 0) - || bfd_is_abs_section (o->output_section)) - continue; - - internal_relocs = (NAME(_bfd_elf,link_read_relocs) - (abfd, o, (PTR) NULL, - (Elf_Internal_Rela *) NULL, - info->keep_memory)); - if (internal_relocs == NULL) - goto error_return; - - ok = (*check_relocs) (abfd, info, o, internal_relocs); - - if (! info->keep_memory) - free (internal_relocs); - - if (! ok) - goto error_return; - } - } - - /* If this is a non-traditional, non-relocateable link, try to - optimize the handling of the .stab/.stabstr sections. */ - if (! dynamic - && ! info->relocateable - && ! info->traditional_format - && info->hash->creator->flavour == bfd_target_elf_flavour - && is_elf_hash_table (info) - && (info->strip != strip_all && info->strip != strip_debugger)) - { - asection *stab, *stabstr; - - stab = bfd_get_section_by_name (abfd, ".stab"); - if (stab != NULL) - { - stabstr = bfd_get_section_by_name (abfd, ".stabstr"); - - if (stabstr != NULL) - { - struct bfd_elf_section_data *secdata; - - secdata = elf_section_data (stab); - if (! _bfd_link_section_stabs (abfd, - & hash_table->stab_info, - stab, stabstr, - &secdata->stab_info)) - goto error_return; - } - } - } - - if (! info->relocateable && ! dynamic - && is_elf_hash_table (info)) - { - asection *s; - - for (s = abfd->sections; s != NULL; s = s->next) - if ((s->flags & SEC_MERGE) - && ! _bfd_merge_section (abfd, & hash_table->merge_info, s, - & elf_section_data (s)->merge_info)) - goto error_return; - } - - if (is_elf_hash_table (info)) - { - /* We add this to the loaded list. */ - struct elf_link_loaded_list *n, **pn; - - n = (struct elf_link_loaded_list *) - bfd_alloc (abfd, sizeof (struct elf_link_loaded_list)); - if (n == NULL) - goto error_return; - n->next = NULL; - n->abfd = abfd; - for (pn = &hash_table->loaded; *pn != NULL; pn = &(*pn)->next) - ; - *pn = n; - } - - return true; - - error_return: - if (buf != NULL) - free (buf); - if (dynbuf != NULL) - free (dynbuf); - if (extversym != NULL) - free (extversym); - return false; -} - -/* Create some sections which will be filled in with dynamic linking - information. ABFD is an input file which requires dynamic sections - to be created. The dynamic sections take up virtual memory space - when the final executable is run, so we need to create them before - addresses are assigned to the output sections. We work out the - actual contents and size of these sections later. */ - -boolean -elf_link_create_dynamic_sections (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - flagword flags; - register asection *s; - struct elf_link_hash_entry *h; - struct elf_backend_data *bed; - - if (! is_elf_hash_table (info)) - return false; - - if (elf_hash_table (info)->dynamic_sections_created) - return true; - - /* Make sure that all dynamic sections use the same input BFD. */ - if (elf_hash_table (info)->dynobj == NULL) - elf_hash_table (info)->dynobj = abfd; - else - abfd = elf_hash_table (info)->dynobj; - - /* Note that we set the SEC_IN_MEMORY flag for all of these - sections. */ - flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS - | SEC_IN_MEMORY | SEC_LINKER_CREATED); - - /* A dynamically linked executable has a .interp section, but a - shared library does not. */ - if (! info->shared) - { - s = bfd_make_section (abfd, ".interp"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)) - return false; - } - - /* Create sections to hold version informations. These are removed - if they are not needed. */ - s = bfd_make_section (abfd, ".gnu.version_d"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) - || ! bfd_set_section_alignment (abfd, s, LOG_FILE_ALIGN)) - return false; - - s = bfd_make_section (abfd, ".gnu.version"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) - || ! bfd_set_section_alignment (abfd, s, 1)) - return false; - - s = bfd_make_section (abfd, ".gnu.version_r"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) - || ! bfd_set_section_alignment (abfd, s, LOG_FILE_ALIGN)) - return false; - - s = bfd_make_section (abfd, ".dynsym"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) - || ! bfd_set_section_alignment (abfd, s, LOG_FILE_ALIGN)) - return false; - - s = bfd_make_section (abfd, ".dynstr"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)) - return false; - - /* Create a strtab to hold the dynamic symbol names. */ - if (elf_hash_table (info)->dynstr == NULL) - { - elf_hash_table (info)->dynstr = elf_stringtab_init (); - if (elf_hash_table (info)->dynstr == NULL) - return false; - } - - s = bfd_make_section (abfd, ".dynamic"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags) - || ! bfd_set_section_alignment (abfd, s, LOG_FILE_ALIGN)) - return false; - - /* The special symbol _DYNAMIC is always set to the start of the - .dynamic section. This call occurs before we have processed the - symbols for any dynamic object, so we don't have to worry about - overriding a dynamic definition. We could set _DYNAMIC in a - linker script, but we only want to define it if we are, in fact, - creating a .dynamic section. We don't want to define it if there - is no .dynamic section, since on some ELF platforms the start up - code examines it to decide how to initialize the process. */ - h = NULL; - if (! (_bfd_generic_link_add_one_symbol - (info, abfd, "_DYNAMIC", BSF_GLOBAL, s, (bfd_vma) 0, - (const char *) NULL, false, get_elf_backend_data (abfd)->collect, - (struct bfd_link_hash_entry **) &h))) - return false; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - h->type = STT_OBJECT; - - if (info->shared - && ! _bfd_elf_link_record_dynamic_symbol (info, h)) - return false; - - bed = get_elf_backend_data (abfd); - - s = bfd_make_section (abfd, ".hash"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) - || ! bfd_set_section_alignment (abfd, s, LOG_FILE_ALIGN)) - return false; - elf_section_data (s)->this_hdr.sh_entsize = bed->s->sizeof_hash_entry; - - /* Let the backend create the rest of the sections. This lets the - backend set the right flags. The backend will normally create - the .got and .plt sections. */ - if (! (*bed->elf_backend_create_dynamic_sections) (abfd, info)) - return false; - - elf_hash_table (info)->dynamic_sections_created = true; - - return true; -} - -/* Add an entry to the .dynamic table. */ - -boolean -elf_add_dynamic_entry (info, tag, val) - struct bfd_link_info *info; - bfd_vma tag; - bfd_vma val; -{ - Elf_Internal_Dyn dyn; - bfd *dynobj; - asection *s; - size_t newsize; - bfd_byte *newcontents; - - if (! is_elf_hash_table (info)) - return false; - - dynobj = elf_hash_table (info)->dynobj; - - s = bfd_get_section_by_name (dynobj, ".dynamic"); - BFD_ASSERT (s != NULL); - - newsize = s->_raw_size + sizeof (Elf_External_Dyn); - newcontents = (bfd_byte *) bfd_realloc (s->contents, newsize); - if (newcontents == NULL) - return false; - - dyn.d_tag = tag; - dyn.d_un.d_val = val; - elf_swap_dyn_out (dynobj, &dyn, - (Elf_External_Dyn *) (newcontents + s->_raw_size)); - - s->_raw_size = newsize; - s->contents = newcontents; - - return true; -} - -/* Record a new local dynamic symbol. */ - -boolean -elf_link_record_local_dynamic_symbol (info, input_bfd, input_indx) - struct bfd_link_info *info; - bfd *input_bfd; - long input_indx; -{ - struct elf_link_local_dynamic_entry *entry; - struct elf_link_hash_table *eht; - struct bfd_strtab_hash *dynstr; - Elf_External_Sym esym; - unsigned long dynstr_index; - char *name; - - if (! is_elf_hash_table (info)) - return false; - - /* See if the entry exists already. */ - for (entry = elf_hash_table (info)->dynlocal; entry ; entry = entry->next) - if (entry->input_bfd == input_bfd && entry->input_indx == input_indx) - return true; - - entry = (struct elf_link_local_dynamic_entry *) - bfd_alloc (input_bfd, sizeof (*entry)); - if (entry == NULL) - return false; - - /* Go find the symbol, so that we can find it's name. */ - if (bfd_seek (input_bfd, - (elf_tdata (input_bfd)->symtab_hdr.sh_offset - + input_indx * sizeof (Elf_External_Sym)), - SEEK_SET) != 0 - || (bfd_read (&esym, sizeof (Elf_External_Sym), 1, input_bfd) - != sizeof (Elf_External_Sym))) - return false; - elf_swap_symbol_in (input_bfd, &esym, &entry->isym); - - name = (bfd_elf_string_from_elf_section - (input_bfd, elf_tdata (input_bfd)->symtab_hdr.sh_link, - entry->isym.st_name)); - - dynstr = elf_hash_table (info)->dynstr; - if (dynstr == NULL) - { - /* Create a strtab to hold the dynamic symbol names. */ - elf_hash_table (info)->dynstr = dynstr = _bfd_elf_stringtab_init (); - if (dynstr == NULL) - return false; - } - - dynstr_index = _bfd_stringtab_add (dynstr, name, true, false); - if (dynstr_index == (unsigned long) -1) - return false; - entry->isym.st_name = dynstr_index; - - eht = elf_hash_table (info); - - entry->next = eht->dynlocal; - eht->dynlocal = entry; - entry->input_bfd = input_bfd; - entry->input_indx = input_indx; - eht->dynsymcount++; - - /* Whatever binding the symbol had before, it's now local. */ - entry->isym.st_info - = ELF_ST_INFO (STB_LOCAL, ELF_ST_TYPE (entry->isym.st_info)); - - /* The dynindx will be set at the end of size_dynamic_sections. */ - - return true; -} - -/* Read and swap the relocs from the section indicated by SHDR. This - may be either a REL or a RELA section. The relocations are - translated into RELA relocations and stored in INTERNAL_RELOCS, - which should have already been allocated to contain enough space. - The EXTERNAL_RELOCS are a buffer where the external form of the - relocations should be stored. - - Returns false if something goes wrong. */ - -static boolean -elf_link_read_relocs_from_section (abfd, shdr, external_relocs, - internal_relocs) - bfd *abfd; - Elf_Internal_Shdr *shdr; - PTR external_relocs; - Elf_Internal_Rela *internal_relocs; -{ - struct elf_backend_data *bed; - - /* If there aren't any relocations, that's OK. */ - if (!shdr) - return true; - - /* Position ourselves at the start of the section. */ - if (bfd_seek (abfd, shdr->sh_offset, SEEK_SET) != 0) - return false; - - /* Read the relocations. */ - if (bfd_read (external_relocs, 1, shdr->sh_size, abfd) - != shdr->sh_size) - return false; - - bed = get_elf_backend_data (abfd); - - /* Convert the external relocations to the internal format. */ - if (shdr->sh_entsize == sizeof (Elf_External_Rel)) - { - Elf_External_Rel *erel; - Elf_External_Rel *erelend; - Elf_Internal_Rela *irela; - Elf_Internal_Rel *irel; - - erel = (Elf_External_Rel *) external_relocs; - erelend = erel + NUM_SHDR_ENTRIES (shdr); - irela = internal_relocs; - irel = bfd_alloc (abfd, (bed->s->int_rels_per_ext_rel - * sizeof (Elf_Internal_Rel))); - for (; erel < erelend; erel++, irela += bed->s->int_rels_per_ext_rel) - { - unsigned int i; - - if (bed->s->swap_reloc_in) - (*bed->s->swap_reloc_in) (abfd, (bfd_byte *) erel, irel); - else - elf_swap_reloc_in (abfd, erel, irel); - - for (i = 0; i < bed->s->int_rels_per_ext_rel; ++i) - { - irela[i].r_offset = irel[i].r_offset; - irela[i].r_info = irel[i].r_info; - irela[i].r_addend = 0; - } - } - } - else - { - Elf_External_Rela *erela; - Elf_External_Rela *erelaend; - Elf_Internal_Rela *irela; - - BFD_ASSERT (shdr->sh_entsize == sizeof (Elf_External_Rela)); - - erela = (Elf_External_Rela *) external_relocs; - erelaend = erela + NUM_SHDR_ENTRIES (shdr); - irela = internal_relocs; - for (; erela < erelaend; erela++, irela += bed->s->int_rels_per_ext_rel) - { - if (bed->s->swap_reloca_in) - (*bed->s->swap_reloca_in) (abfd, (bfd_byte *) erela, irela); - else - elf_swap_reloca_in (abfd, erela, irela); - } - } - - return true; -} - -/* Read and swap the relocs for a section O. They may have been - cached. If the EXTERNAL_RELOCS and INTERNAL_RELOCS arguments are - not NULL, they are used as buffers to read into. They are known to - be large enough. If the INTERNAL_RELOCS relocs argument is NULL, - the return value is allocated using either malloc or bfd_alloc, - according to the KEEP_MEMORY argument. If O has two relocation - sections (both REL and RELA relocations), then the REL_HDR - relocations will appear first in INTERNAL_RELOCS, followed by the - REL_HDR2 relocations. */ - -Elf_Internal_Rela * -NAME(_bfd_elf,link_read_relocs) (abfd, o, external_relocs, internal_relocs, - keep_memory) - bfd *abfd; - asection *o; - PTR external_relocs; - Elf_Internal_Rela *internal_relocs; - boolean keep_memory; -{ - Elf_Internal_Shdr *rel_hdr; - PTR alloc1 = NULL; - Elf_Internal_Rela *alloc2 = NULL; - struct elf_backend_data *bed = get_elf_backend_data (abfd); - - if (elf_section_data (o)->relocs != NULL) - return elf_section_data (o)->relocs; - - if (o->reloc_count == 0) - return NULL; - - rel_hdr = &elf_section_data (o)->rel_hdr; - - if (internal_relocs == NULL) - { - size_t size; - - size = (o->reloc_count * bed->s->int_rels_per_ext_rel - * sizeof (Elf_Internal_Rela)); - if (keep_memory) - internal_relocs = (Elf_Internal_Rela *) bfd_alloc (abfd, size); - else - internal_relocs = alloc2 = (Elf_Internal_Rela *) bfd_malloc (size); - if (internal_relocs == NULL) - goto error_return; - } - - if (external_relocs == NULL) - { - size_t size = (size_t) rel_hdr->sh_size; - - if (elf_section_data (o)->rel_hdr2) - size += (size_t) elf_section_data (o)->rel_hdr2->sh_size; - alloc1 = (PTR) bfd_malloc (size); - if (alloc1 == NULL) - goto error_return; - external_relocs = alloc1; - } - - if (!elf_link_read_relocs_from_section (abfd, rel_hdr, - external_relocs, - internal_relocs)) - goto error_return; - if (!elf_link_read_relocs_from_section - (abfd, - elf_section_data (o)->rel_hdr2, - ((bfd_byte *) external_relocs) + rel_hdr->sh_size, - internal_relocs + (NUM_SHDR_ENTRIES (rel_hdr) - * bed->s->int_rels_per_ext_rel))) - goto error_return; - - /* Cache the results for next time, if we can. */ - if (keep_memory) - elf_section_data (o)->relocs = internal_relocs; - - if (alloc1 != NULL) - free (alloc1); - - /* Don't free alloc2, since if it was allocated we are passing it - back (under the name of internal_relocs). */ - - return internal_relocs; - - error_return: - if (alloc1 != NULL) - free (alloc1); - if (alloc2 != NULL) - free (alloc2); - return NULL; -} - -/* Record an assignment to a symbol made by a linker script. We need - this in case some dynamic object refers to this symbol. */ - -boolean -NAME(bfd_elf,record_link_assignment) (output_bfd, info, name, provide) - bfd *output_bfd ATTRIBUTE_UNUSED; - struct bfd_link_info *info; - const char *name; - boolean provide; -{ - struct elf_link_hash_entry *h; - - if (info->hash->creator->flavour != bfd_target_elf_flavour) - return true; - - h = elf_link_hash_lookup (elf_hash_table (info), name, true, true, false); - if (h == NULL) - return false; - - if (h->root.type == bfd_link_hash_new) - h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF; - - /* If this symbol is being provided by the linker script, and it is - currently defined by a dynamic object, but not by a regular - object, then mark it as undefined so that the generic linker will - force the correct value. */ - if (provide - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - h->root.type = bfd_link_hash_undefined; - - /* If this symbol is not being provided by the linker script, and it is - currently defined by a dynamic object, but not by a regular object, - then clear out any version information because the symbol will not be - associated with the dynamic object any more. */ - if (!provide - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - h->verinfo.verdef = NULL; - - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - - /* When possible, keep the original type of the symbol. */ - if (h->type == STT_NOTYPE) - h->type = STT_OBJECT; - - if (((h->elf_link_hash_flags & (ELF_LINK_HASH_DEF_DYNAMIC - | ELF_LINK_HASH_REF_DYNAMIC)) != 0 - || info->shared) - && h->dynindx == -1) - { - if (! _bfd_elf_link_record_dynamic_symbol (info, h)) - return false; - - /* If this is a weak defined symbol, and we know a corresponding - real symbol from the same dynamic object, make sure the real - symbol is also made into a dynamic symbol. */ - if (h->weakdef != NULL - && h->weakdef->dynindx == -1) - { - if (! _bfd_elf_link_record_dynamic_symbol (info, h->weakdef)) - return false; - } - } - - return true; -} - -/* This structure is used to pass information to - elf_link_assign_sym_version. */ - -struct elf_assign_sym_version_info -{ - /* Output BFD. */ - bfd *output_bfd; - /* General link information. */ - struct bfd_link_info *info; - /* Version tree. */ - struct bfd_elf_version_tree *verdefs; - /* Whether we had a failure. */ - boolean failed; -}; - -/* This structure is used to pass information to - elf_link_find_version_dependencies. */ - -struct elf_find_verdep_info -{ - /* Output BFD. */ - bfd *output_bfd; - /* General link information. */ - struct bfd_link_info *info; - /* The number of dependencies. */ - unsigned int vers; - /* Whether we had a failure. */ - boolean failed; -}; - -/* Array used to determine the number of hash table buckets to use - based on the number of symbols there are. If there are fewer than - 3 symbols we use 1 bucket, fewer than 17 symbols we use 3 buckets, - fewer than 37 we use 17 buckets, and so forth. We never use more - than 32771 buckets. */ - -static const size_t elf_buckets[] = -{ - 1, 3, 17, 37, 67, 97, 131, 197, 263, 521, 1031, 2053, 4099, 8209, - 16411, 32771, 0 -}; - -/* Compute bucket count for hashing table. We do not use a static set - of possible tables sizes anymore. Instead we determine for all - possible reasonable sizes of the table the outcome (i.e., the - number of collisions etc) and choose the best solution. The - weighting functions are not too simple to allow the table to grow - without bounds. Instead one of the weighting factors is the size. - Therefore the result is always a good payoff between few collisions - (= short chain lengths) and table size. */ -static size_t -compute_bucket_count (info) - struct bfd_link_info *info; -{ - size_t dynsymcount = elf_hash_table (info)->dynsymcount; - size_t best_size = 0; - unsigned long int *hashcodes; - unsigned long int *hashcodesp; - unsigned long int i; - - /* Compute the hash values for all exported symbols. At the same - time store the values in an array so that we could use them for - optimizations. */ - hashcodes = (unsigned long int *) bfd_malloc (dynsymcount - * sizeof (unsigned long int)); - if (hashcodes == NULL) - return 0; - hashcodesp = hashcodes; - - /* Put all hash values in HASHCODES. */ - elf_link_hash_traverse (elf_hash_table (info), - elf_collect_hash_codes, &hashcodesp); - -/* We have a problem here. The following code to optimize the table - size requires an integer type with more the 32 bits. If - BFD_HOST_U_64_BIT is set we know about such a type. */ -#ifdef BFD_HOST_U_64_BIT - if (info->optimize == true) - { - unsigned long int nsyms = hashcodesp - hashcodes; - size_t minsize; - size_t maxsize; - BFD_HOST_U_64_BIT best_chlen = ~((BFD_HOST_U_64_BIT) 0); - unsigned long int *counts ; - - /* Possible optimization parameters: if we have NSYMS symbols we say - that the hashing table must at least have NSYMS/4 and at most - 2*NSYMS buckets. */ - minsize = nsyms / 4; - if (minsize == 0) - minsize = 1; - best_size = maxsize = nsyms * 2; - - /* Create array where we count the collisions in. We must use bfd_malloc - since the size could be large. */ - counts = (unsigned long int *) bfd_malloc (maxsize - * sizeof (unsigned long int)); - if (counts == NULL) - { - free (hashcodes); - return 0; - } - - /* Compute the "optimal" size for the hash table. The criteria is a - minimal chain length. The minor criteria is (of course) the size - of the table. */ - for (i = minsize; i < maxsize; ++i) - { - /* Walk through the array of hashcodes and count the collisions. */ - BFD_HOST_U_64_BIT max; - unsigned long int j; - unsigned long int fact; - - memset (counts, '\0', i * sizeof (unsigned long int)); - - /* Determine how often each hash bucket is used. */ - for (j = 0; j < nsyms; ++j) - ++counts[hashcodes[j] % i]; - - /* For the weight function we need some information about the - pagesize on the target. This is information need not be 100% - accurate. Since this information is not available (so far) we - define it here to a reasonable default value. If it is crucial - to have a better value some day simply define this value. */ -# ifndef BFD_TARGET_PAGESIZE -# define BFD_TARGET_PAGESIZE (4096) -# endif - - /* We in any case need 2 + NSYMS entries for the size values and - the chains. */ - max = (2 + nsyms) * (ARCH_SIZE / 8); - -# if 1 - /* Variant 1: optimize for short chains. We add the squares - of all the chain lengths (which favous many small chain - over a few long chains). */ - for (j = 0; j < i; ++j) - max += counts[j] * counts[j]; - - /* This adds penalties for the overall size of the table. */ - fact = i / (BFD_TARGET_PAGESIZE / (ARCH_SIZE / 8)) + 1; - max *= fact * fact; -# else - /* Variant 2: Optimize a lot more for small table. Here we - also add squares of the size but we also add penalties for - empty slots (the +1 term). */ - for (j = 0; j < i; ++j) - max += (1 + counts[j]) * (1 + counts[j]); - - /* The overall size of the table is considered, but not as - strong as in variant 1, where it is squared. */ - fact = i / (BFD_TARGET_PAGESIZE / (ARCH_SIZE / 8)) + 1; - max *= fact; -# endif - - /* Compare with current best results. */ - if (max < best_chlen) - { - best_chlen = max; - best_size = i; - } - } - - free (counts); - } - else -#endif /* defined (BFD_HOST_U_64_BIT) */ - { - /* This is the fallback solution if no 64bit type is available or if we - are not supposed to spend much time on optimizations. We select the - bucket count using a fixed set of numbers. */ - for (i = 0; elf_buckets[i] != 0; i++) - { - best_size = elf_buckets[i]; - if (dynsymcount < elf_buckets[i + 1]) - break; - } - } - - /* Free the arrays we needed. */ - free (hashcodes); - - return best_size; -} - -/* Set up the sizes and contents of the ELF dynamic sections. This is - called by the ELF linker emulation before_allocation routine. We - must set the sizes of the sections before the linker sets the - addresses of the various sections. */ - -boolean -NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath, - filter_shlib, - auxiliary_filters, info, sinterpptr, - verdefs) - bfd *output_bfd; - const char *soname; - const char *rpath; - const char *filter_shlib; - const char * const *auxiliary_filters; - struct bfd_link_info *info; - asection **sinterpptr; - struct bfd_elf_version_tree *verdefs; -{ - bfd_size_type soname_indx; - bfd *dynobj; - struct elf_backend_data *bed; - struct elf_assign_sym_version_info asvinfo; - - *sinterpptr = NULL; - - soname_indx = (bfd_size_type) -1; - - if (info->hash->creator->flavour != bfd_target_elf_flavour) - return true; - - if (! is_elf_hash_table (info)) - return false; - - /* The backend may have to create some sections regardless of whether - we're dynamic or not. */ - bed = get_elf_backend_data (output_bfd); - if (bed->elf_backend_always_size_sections - && ! (*bed->elf_backend_always_size_sections) (output_bfd, info)) - return false; - - dynobj = elf_hash_table (info)->dynobj; - - /* If there were no dynamic objects in the link, there is nothing to - do here. */ - if (dynobj == NULL) - return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { - struct elf_info_failed eif; - struct elf_link_hash_entry *h; - asection *dynstr; - - *sinterpptr = bfd_get_section_by_name (dynobj, ".interp"); - BFD_ASSERT (*sinterpptr != NULL || info->shared); - - if (soname != NULL) - { - soname_indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr, - soname, true, true); - if (soname_indx == (bfd_size_type) -1 - || ! elf_add_dynamic_entry (info, DT_SONAME, soname_indx)) - return false; - } - - if (info->symbolic) - { - if (! elf_add_dynamic_entry (info, DT_SYMBOLIC, 0)) - return false; - info->flags |= DF_SYMBOLIC; - } - - if (rpath != NULL) - { - bfd_size_type indx; - - indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr, rpath, - true, true); - if (indx == (bfd_size_type) -1 - || ! elf_add_dynamic_entry (info, DT_RPATH, indx) - || (info->new_dtags - && ! elf_add_dynamic_entry (info, DT_RUNPATH, indx))) - return false; - } - - if (filter_shlib != NULL) - { - bfd_size_type indx; - - indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr, - filter_shlib, true, true); - if (indx == (bfd_size_type) -1 - || ! elf_add_dynamic_entry (info, DT_FILTER, indx)) - return false; - } - - if (auxiliary_filters != NULL) - { - const char * const *p; - - for (p = auxiliary_filters; *p != NULL; p++) - { - bfd_size_type indx; - - indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr, - *p, true, true); - if (indx == (bfd_size_type) -1 - || ! elf_add_dynamic_entry (info, DT_AUXILIARY, indx)) - return false; - } - } - - eif.info = info; - eif.verdefs = verdefs; - eif.failed = false; - - /* If we are supposed to export all symbols into the dynamic symbol - table (this is not the normal case), then do so. */ - if (info->export_dynamic) - { - elf_link_hash_traverse (elf_hash_table (info), elf_export_symbol, - (PTR) &eif); - if (eif.failed) - return false; - } - - /* Attach all the symbols to their version information. */ - asvinfo.output_bfd = output_bfd; - asvinfo.info = info; - asvinfo.verdefs = verdefs; - asvinfo.failed = false; - - elf_link_hash_traverse (elf_hash_table (info), - elf_link_assign_sym_version, - (PTR) &asvinfo); - if (asvinfo.failed) - return false; - - /* Find all symbols which were defined in a dynamic object and make - the backend pick a reasonable value for them. */ - elf_link_hash_traverse (elf_hash_table (info), - elf_adjust_dynamic_symbol, - (PTR) &eif); - if (eif.failed) - return false; - - /* Add some entries to the .dynamic section. We fill in some of the - values later, in elf_bfd_final_link, but we must add the entries - now so that we know the final size of the .dynamic section. */ - - /* If there are initialization and/or finalization functions to - call then add the corresponding DT_INIT/DT_FINI entries. */ - h = (info->init_function - ? elf_link_hash_lookup (elf_hash_table (info), - info->init_function, false, - false, false) - : NULL); - if (h != NULL - && (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_DEF_REGULAR)) != 0) - { - if (! elf_add_dynamic_entry (info, DT_INIT, 0)) - return false; - } - h = (info->fini_function - ? elf_link_hash_lookup (elf_hash_table (info), - info->fini_function, false, - false, false) - : NULL); - if (h != NULL - && (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_DEF_REGULAR)) != 0) - { - if (! elf_add_dynamic_entry (info, DT_FINI, 0)) - return false; - } - - dynstr = bfd_get_section_by_name (dynobj, ".dynstr"); - /* If .dynstr is excluded from the link, we don't want any of - these tags. Strictly, we should be checking each section - individually; This quick check covers for the case where - someone does a /DISCARD/ : { *(*) }. */ - if (dynstr != NULL && dynstr->output_section != bfd_abs_section_ptr) - { - bfd_size_type strsize; - - strsize = _bfd_stringtab_size (elf_hash_table (info)->dynstr); - if (! elf_add_dynamic_entry (info, DT_HASH, 0) - || ! elf_add_dynamic_entry (info, DT_STRTAB, 0) - || ! elf_add_dynamic_entry (info, DT_SYMTAB, 0) - || ! elf_add_dynamic_entry (info, DT_STRSZ, strsize) - || ! elf_add_dynamic_entry (info, DT_SYMENT, - sizeof (Elf_External_Sym))) - return false; - } - } - - /* The backend must work out the sizes of all the other dynamic - sections. */ - if (bed->elf_backend_size_dynamic_sections - && ! (*bed->elf_backend_size_dynamic_sections) (output_bfd, info)) - return false; - - if (elf_hash_table (info)->dynamic_sections_created) - { - size_t dynsymcount; - asection *s; - size_t bucketcount = 0; - size_t hash_entry_size; - unsigned int dtagcount; - - /* Set up the version definition section. */ - s = bfd_get_section_by_name (dynobj, ".gnu.version_d"); - BFD_ASSERT (s != NULL); - - /* We may have created additional version definitions if we are - just linking a regular application. */ - verdefs = asvinfo.verdefs; - - if (verdefs == NULL) - _bfd_strip_section_from_output (info, s); - else - { - unsigned int cdefs; - bfd_size_type size; - struct bfd_elf_version_tree *t; - bfd_byte *p; - Elf_Internal_Verdef def; - Elf_Internal_Verdaux defaux; - - cdefs = 0; - size = 0; - - /* Make space for the base version. */ - size += sizeof (Elf_External_Verdef); - size += sizeof (Elf_External_Verdaux); - ++cdefs; - - for (t = verdefs; t != NULL; t = t->next) - { - struct bfd_elf_version_deps *n; - - size += sizeof (Elf_External_Verdef); - size += sizeof (Elf_External_Verdaux); - ++cdefs; - - for (n = t->deps; n != NULL; n = n->next) - size += sizeof (Elf_External_Verdaux); - } - - s->_raw_size = size; - s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size); - if (s->contents == NULL && s->_raw_size != 0) - return false; - - /* Fill in the version definition section. */ - - p = s->contents; - - def.vd_version = VER_DEF_CURRENT; - def.vd_flags = VER_FLG_BASE; - def.vd_ndx = 1; - def.vd_cnt = 1; - def.vd_aux = sizeof (Elf_External_Verdef); - def.vd_next = (sizeof (Elf_External_Verdef) - + sizeof (Elf_External_Verdaux)); - - if (soname_indx != (bfd_size_type) -1) - { - def.vd_hash = bfd_elf_hash (soname); - defaux.vda_name = soname_indx; - } - else - { - const char *name; - bfd_size_type indx; - - name = basename (output_bfd->filename); - def.vd_hash = bfd_elf_hash (name); - indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr, - name, true, false); - if (indx == (bfd_size_type) -1) - return false; - defaux.vda_name = indx; - } - defaux.vda_next = 0; - - _bfd_elf_swap_verdef_out (output_bfd, &def, - (Elf_External_Verdef *) p); - p += sizeof (Elf_External_Verdef); - _bfd_elf_swap_verdaux_out (output_bfd, &defaux, - (Elf_External_Verdaux *) p); - p += sizeof (Elf_External_Verdaux); - - for (t = verdefs; t != NULL; t = t->next) - { - unsigned int cdeps; - struct bfd_elf_version_deps *n; - struct elf_link_hash_entry *h; - - cdeps = 0; - for (n = t->deps; n != NULL; n = n->next) - ++cdeps; - - /* Add a symbol representing this version. */ - h = NULL; - if (! (_bfd_generic_link_add_one_symbol - (info, dynobj, t->name, BSF_GLOBAL, bfd_abs_section_ptr, - (bfd_vma) 0, (const char *) NULL, false, - get_elf_backend_data (dynobj)->collect, - (struct bfd_link_hash_entry **) &h))) - return false; - h->elf_link_hash_flags &= ~ ELF_LINK_NON_ELF; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - h->type = STT_OBJECT; - h->verinfo.vertree = t; - - if (! _bfd_elf_link_record_dynamic_symbol (info, h)) - return false; - - def.vd_version = VER_DEF_CURRENT; - def.vd_flags = 0; - if (t->globals == NULL && t->locals == NULL && ! t->used) - def.vd_flags |= VER_FLG_WEAK; - def.vd_ndx = t->vernum + 1; - def.vd_cnt = cdeps + 1; - def.vd_hash = bfd_elf_hash (t->name); - def.vd_aux = sizeof (Elf_External_Verdef); - if (t->next != NULL) - def.vd_next = (sizeof (Elf_External_Verdef) - + (cdeps + 1) * sizeof (Elf_External_Verdaux)); - else - def.vd_next = 0; - - _bfd_elf_swap_verdef_out (output_bfd, &def, - (Elf_External_Verdef *) p); - p += sizeof (Elf_External_Verdef); - - defaux.vda_name = h->dynstr_index; - if (t->deps == NULL) - defaux.vda_next = 0; - else - defaux.vda_next = sizeof (Elf_External_Verdaux); - t->name_indx = defaux.vda_name; - - _bfd_elf_swap_verdaux_out (output_bfd, &defaux, - (Elf_External_Verdaux *) p); - p += sizeof (Elf_External_Verdaux); - - for (n = t->deps; n != NULL; n = n->next) - { - if (n->version_needed == NULL) - { - /* This can happen if there was an error in the - version script. */ - defaux.vda_name = 0; - } - else - defaux.vda_name = n->version_needed->name_indx; - if (n->next == NULL) - defaux.vda_next = 0; - else - defaux.vda_next = sizeof (Elf_External_Verdaux); - - _bfd_elf_swap_verdaux_out (output_bfd, &defaux, - (Elf_External_Verdaux *) p); - p += sizeof (Elf_External_Verdaux); - } - } - - if (! elf_add_dynamic_entry (info, DT_VERDEF, 0) - || ! elf_add_dynamic_entry (info, DT_VERDEFNUM, cdefs)) - return false; - - elf_tdata (output_bfd)->cverdefs = cdefs; - } - - if (info->new_dtags && info->flags) - { - if (! elf_add_dynamic_entry (info, DT_FLAGS, info->flags)) - return false; - } - - if (info->flags_1) - { - if (! info->shared) - info->flags_1 &= ~ (DF_1_INITFIRST - | DF_1_NODELETE - | DF_1_NOOPEN); - if (! elf_add_dynamic_entry (info, DT_FLAGS_1, info->flags_1)) - return false; - } - - /* Work out the size of the version reference section. */ - - s = bfd_get_section_by_name (dynobj, ".gnu.version_r"); - BFD_ASSERT (s != NULL); - { - struct elf_find_verdep_info sinfo; - - sinfo.output_bfd = output_bfd; - sinfo.info = info; - sinfo.vers = elf_tdata (output_bfd)->cverdefs; - if (sinfo.vers == 0) - sinfo.vers = 1; - sinfo.failed = false; - - elf_link_hash_traverse (elf_hash_table (info), - elf_link_find_version_dependencies, - (PTR) &sinfo); - - if (elf_tdata (output_bfd)->verref == NULL) - _bfd_strip_section_from_output (info, s); - else - { - Elf_Internal_Verneed *t; - unsigned int size; - unsigned int crefs; - bfd_byte *p; - - /* Build the version definition section. */ - size = 0; - crefs = 0; - for (t = elf_tdata (output_bfd)->verref; - t != NULL; - t = t->vn_nextref) - { - Elf_Internal_Vernaux *a; - - size += sizeof (Elf_External_Verneed); - ++crefs; - for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr) - size += sizeof (Elf_External_Vernaux); - } - - s->_raw_size = size; - s->contents = (bfd_byte *) bfd_alloc (output_bfd, size); - if (s->contents == NULL) - return false; - - p = s->contents; - for (t = elf_tdata (output_bfd)->verref; - t != NULL; - t = t->vn_nextref) - { - unsigned int caux; - Elf_Internal_Vernaux *a; - bfd_size_type indx; - - caux = 0; - for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr) - ++caux; - - t->vn_version = VER_NEED_CURRENT; - t->vn_cnt = caux; - if (elf_dt_name (t->vn_bfd) != NULL) - indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr, - elf_dt_name (t->vn_bfd), - true, false); - else - indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr, - basename (t->vn_bfd->filename), - true, false); - if (indx == (bfd_size_type) -1) - return false; - t->vn_file = indx; - t->vn_aux = sizeof (Elf_External_Verneed); - if (t->vn_nextref == NULL) - t->vn_next = 0; - else - t->vn_next = (sizeof (Elf_External_Verneed) - + caux * sizeof (Elf_External_Vernaux)); - - _bfd_elf_swap_verneed_out (output_bfd, t, - (Elf_External_Verneed *) p); - p += sizeof (Elf_External_Verneed); - - for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr) - { - a->vna_hash = bfd_elf_hash (a->vna_nodename); - indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr, - a->vna_nodename, true, false); - if (indx == (bfd_size_type) -1) - return false; - a->vna_name = indx; - if (a->vna_nextptr == NULL) - a->vna_next = 0; - else - a->vna_next = sizeof (Elf_External_Vernaux); - - _bfd_elf_swap_vernaux_out (output_bfd, a, - (Elf_External_Vernaux *) p); - p += sizeof (Elf_External_Vernaux); - } - } - - if (! elf_add_dynamic_entry (info, DT_VERNEED, 0) - || ! elf_add_dynamic_entry (info, DT_VERNEEDNUM, crefs)) - return false; - - elf_tdata (output_bfd)->cverrefs = crefs; - } - } - - /* Assign dynsym indicies. In a shared library we generate a - section symbol for each output section, which come first. - Next come all of the back-end allocated local dynamic syms, - followed by the rest of the global symbols. */ - - dynsymcount = _bfd_elf_link_renumber_dynsyms (output_bfd, info); - - /* Work out the size of the symbol version section. */ - s = bfd_get_section_by_name (dynobj, ".gnu.version"); - BFD_ASSERT (s != NULL); - if (dynsymcount == 0 - || (verdefs == NULL && elf_tdata (output_bfd)->verref == NULL)) - { - _bfd_strip_section_from_output (info, s); - /* The DYNSYMCOUNT might have changed if we were going to - output a dynamic symbol table entry for S. */ - dynsymcount = _bfd_elf_link_renumber_dynsyms (output_bfd, info); - } - else - { - s->_raw_size = dynsymcount * sizeof (Elf_External_Versym); - s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->_raw_size); - if (s->contents == NULL) - return false; - - if (! elf_add_dynamic_entry (info, DT_VERSYM, 0)) - return false; - } - - /* Set the size of the .dynsym and .hash sections. We counted - the number of dynamic symbols in elf_link_add_object_symbols. - We will build the contents of .dynsym and .hash when we build - the final symbol table, because until then we do not know the - correct value to give the symbols. We built the .dynstr - section as we went along in elf_link_add_object_symbols. */ - s = bfd_get_section_by_name (dynobj, ".dynsym"); - BFD_ASSERT (s != NULL); - s->_raw_size = dynsymcount * sizeof (Elf_External_Sym); - s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size); - if (s->contents == NULL && s->_raw_size != 0) - return false; - - if (dynsymcount != 0) - { - Elf_Internal_Sym isym; - - /* The first entry in .dynsym is a dummy symbol. */ - isym.st_value = 0; - isym.st_size = 0; - isym.st_name = 0; - isym.st_info = 0; - isym.st_other = 0; - isym.st_shndx = 0; - elf_swap_symbol_out (output_bfd, &isym, - (PTR) (Elf_External_Sym *) s->contents); - } - - /* Compute the size of the hashing table. As a side effect this - computes the hash values for all the names we export. */ - bucketcount = compute_bucket_count (info); - - s = bfd_get_section_by_name (dynobj, ".hash"); - BFD_ASSERT (s != NULL); - hash_entry_size = elf_section_data (s)->this_hdr.sh_entsize; - s->_raw_size = ((2 + bucketcount + dynsymcount) * hash_entry_size); - s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size); - if (s->contents == NULL) - return false; - memset (s->contents, 0, (size_t) s->_raw_size); - - bfd_put (8 * hash_entry_size, output_bfd, bucketcount, s->contents); - bfd_put (8 * hash_entry_size, output_bfd, dynsymcount, - s->contents + hash_entry_size); - - elf_hash_table (info)->bucketcount = bucketcount; - - s = bfd_get_section_by_name (dynobj, ".dynstr"); - BFD_ASSERT (s != NULL); - s->_raw_size = _bfd_stringtab_size (elf_hash_table (info)->dynstr); - - for (dtagcount = 0; dtagcount <= info->spare_dynamic_tags; ++dtagcount) - if (! elf_add_dynamic_entry (info, DT_NULL, 0)) - return false; - } - - return true; -} - -/* Fix up the flags for a symbol. This handles various cases which - can only be fixed after all the input files are seen. This is - currently called by both adjust_dynamic_symbol and - assign_sym_version, which is unnecessary but perhaps more robust in - the face of future changes. */ - -static boolean -elf_fix_symbol_flags (h, eif) - struct elf_link_hash_entry *h; - struct elf_info_failed *eif; -{ - /* If this symbol was mentioned in a non-ELF file, try to set - DEF_REGULAR and REF_REGULAR correctly. This is the only way to - permit a non-ELF file to correctly refer to a symbol defined in - an ELF dynamic object. */ - if ((h->elf_link_hash_flags & ELF_LINK_NON_ELF) != 0) - { - while (h->root.type == bfd_link_hash_indirect) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - - if (h->root.type != bfd_link_hash_defined - && h->root.type != bfd_link_hash_defweak) - h->elf_link_hash_flags |= (ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK); - else - { - if (h->root.u.def.section->owner != NULL - && (bfd_get_flavour (h->root.u.def.section->owner) - == bfd_target_elf_flavour)) - h->elf_link_hash_flags |= (ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK); - else - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - } - - if (h->dynindx == -1 - && ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - || (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0)) - { - if (! _bfd_elf_link_record_dynamic_symbol (eif->info, h)) - { - eif->failed = true; - return false; - } - } - } - else - { - /* Unfortunately, ELF_LINK_NON_ELF is only correct if the symbol - was first seen in a non-ELF file. Fortunately, if the symbol - was first seen in an ELF file, we're probably OK unless the - symbol was defined in a non-ELF file. Catch that case here. - FIXME: We're still in trouble if the symbol was first seen in - a dynamic object, and then later in a non-ELF regular object. */ - if ((h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0 - && (h->root.u.def.section->owner != NULL - ? (bfd_get_flavour (h->root.u.def.section->owner) - != bfd_target_elf_flavour) - : (bfd_is_abs_section (h->root.u.def.section) - && (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) == 0))) - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - } - - /* If this is a final link, and the symbol was defined as a common - symbol in a regular object file, and there was no definition in - any dynamic object, then the linker will have allocated space for - the symbol in a common section but the ELF_LINK_HASH_DEF_REGULAR - flag will not have been set. */ - if (h->root.type == bfd_link_hash_defined - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) != 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 - && (h->root.u.def.section->owner->flags & DYNAMIC) == 0) - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - - /* If -Bsymbolic was used (which means to bind references to global - symbols to the definition within the shared object), and this - symbol was defined in a regular object, then it actually doesn't - need a PLT entry, and we can accomplish that by forcing it local. - Likewise, if the symbol has hidden or internal visibility. - FIXME: It might be that we also do not need a PLT for other - non-hidden visibilities, but we would have to tell that to the - backend specifically; we can't just clear PLT-related data here. */ - if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0 - && eif->info->shared - && is_elf_hash_table (eif->info) - && (eif->info->symbolic - || ELF_ST_VISIBILITY (h->other) == STV_INTERNAL - || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN) - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0) - { - struct elf_backend_data *bed; - - bed = get_elf_backend_data (elf_hash_table (eif->info)->dynobj); - if (ELF_ST_VISIBILITY (h->other) == STV_INTERNAL - || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN) - h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL; - (*bed->elf_backend_hide_symbol) (eif->info, h); - } - - /* If this is a weak defined symbol in a dynamic object, and we know - the real definition in the dynamic object, copy interesting flags - over to the real definition. */ - if (h->weakdef != NULL) - { - struct elf_link_hash_entry *weakdef; - - BFD_ASSERT (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak); - weakdef = h->weakdef; - BFD_ASSERT (weakdef->root.type == bfd_link_hash_defined - || weakdef->root.type == bfd_link_hash_defweak); - BFD_ASSERT (weakdef->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC); - - /* If the real definition is defined by a regular object file, - don't do anything special. See the longer description in - elf_adjust_dynamic_symbol, below. */ - if ((weakdef->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0) - h->weakdef = NULL; - else - weakdef->elf_link_hash_flags |= - (h->elf_link_hash_flags - & (ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK - | ELF_LINK_NON_GOT_REF)); - } - - return true; -} - -/* Make the backend pick a good value for a dynamic symbol. This is - called via elf_link_hash_traverse, and also calls itself - recursively. */ - -static boolean -elf_adjust_dynamic_symbol (h, data) - struct elf_link_hash_entry *h; - PTR data; -{ - struct elf_info_failed *eif = (struct elf_info_failed *) data; - bfd *dynobj; - struct elf_backend_data *bed; - - /* Ignore indirect symbols. These are added by the versioning code. */ - if (h->root.type == bfd_link_hash_indirect) - return true; - - if (! is_elf_hash_table (eif->info)) - return false; - - /* Fix the symbol flags. */ - if (! elf_fix_symbol_flags (h, eif)) - return false; - - /* If this symbol does not require a PLT entry, and it is not - defined by a dynamic object, or is not referenced by a regular - object, ignore it. We do have to handle a weak defined symbol, - even if no regular object refers to it, if we decided to add it - to the dynamic symbol table. FIXME: Do we normally need to worry - about symbols which are defined by one dynamic object and - referenced by another one? */ - if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) == 0 - && ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0 - || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 - || ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0 - && (h->weakdef == NULL || h->weakdef->dynindx == -1)))) - { - h->plt.offset = (bfd_vma) -1; - return true; - } - - /* If we've already adjusted this symbol, don't do it again. This - can happen via a recursive call. */ - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DYNAMIC_ADJUSTED) != 0) - return true; - - /* Don't look at this symbol again. Note that we must set this - after checking the above conditions, because we may look at a - symbol once, decide not to do anything, and then get called - recursively later after REF_REGULAR is set below. */ - h->elf_link_hash_flags |= ELF_LINK_HASH_DYNAMIC_ADJUSTED; - - /* If this is a weak definition, and we know a real definition, and - the real symbol is not itself defined by a regular object file, - then get a good value for the real definition. We handle the - real symbol first, for the convenience of the backend routine. - - Note that there is a confusing case here. If the real definition - is defined by a regular object file, we don't get the real symbol - from the dynamic object, but we do get the weak symbol. If the - processor backend uses a COPY reloc, then if some routine in the - dynamic object changes the real symbol, we will not see that - change in the corresponding weak symbol. This is the way other - ELF linkers work as well, and seems to be a result of the shared - library model. - - I will clarify this issue. Most SVR4 shared libraries define the - variable _timezone and define timezone as a weak synonym. The - tzset call changes _timezone. If you write - extern int timezone; - int _timezone = 5; - int main () { tzset (); printf ("%d %d\n", timezone, _timezone); } - you might expect that, since timezone is a synonym for _timezone, - the same number will print both times. However, if the processor - backend uses a COPY reloc, then actually timezone will be copied - into your process image, and, since you define _timezone - yourself, _timezone will not. Thus timezone and _timezone will - wind up at different memory locations. The tzset call will set - _timezone, leaving timezone unchanged. */ - - if (h->weakdef != NULL) - { - /* If we get to this point, we know there is an implicit - reference by a regular object file via the weak symbol H. - FIXME: Is this really true? What if the traversal finds - H->WEAKDEF before it finds H? */ - h->weakdef->elf_link_hash_flags |= ELF_LINK_HASH_REF_REGULAR; - - if (! elf_adjust_dynamic_symbol (h->weakdef, (PTR) eif)) - return false; - } - - /* If a symbol has no type and no size and does not require a PLT - entry, then we are probably about to do the wrong thing here: we - are probably going to create a COPY reloc for an empty object. - This case can arise when a shared object is built with assembly - code, and the assembly code fails to set the symbol type. */ - if (h->size == 0 - && h->type == STT_NOTYPE - && (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) == 0) - (*_bfd_error_handler) - (_("warning: type and size of dynamic symbol `%s' are not defined"), - h->root.root.string); - - dynobj = elf_hash_table (eif->info)->dynobj; - bed = get_elf_backend_data (dynobj); - if (! (*bed->elf_backend_adjust_dynamic_symbol) (eif->info, h)) - { - eif->failed = true; - return false; - } - - return true; -} - -/* This routine is used to export all defined symbols into the dynamic - symbol table. It is called via elf_link_hash_traverse. */ - -static boolean -elf_export_symbol (h, data) - struct elf_link_hash_entry *h; - PTR data; -{ - struct elf_info_failed *eif = (struct elf_info_failed *) data; - - /* Ignore indirect symbols. These are added by the versioning code. */ - if (h->root.type == bfd_link_hash_indirect) - return true; - - if (h->dynindx == -1 - && (h->elf_link_hash_flags - & (ELF_LINK_HASH_DEF_REGULAR | ELF_LINK_HASH_REF_REGULAR)) != 0) - { - struct bfd_elf_version_tree *t; - struct bfd_elf_version_expr *d; - - for (t = eif->verdefs; t != NULL; t = t->next) - { - if (t->globals != NULL) - { - for (d = t->globals; d != NULL; d = d->next) - { - if ((*d->match) (d, h->root.root.string)) - goto doit; - } - } - - if (t->locals != NULL) - { - for (d = t->locals ; d != NULL; d = d->next) - { - if ((*d->match) (d, h->root.root.string)) - return true; - } - } - } - - if (!eif->verdefs) - { -doit: - if (! _bfd_elf_link_record_dynamic_symbol (eif->info, h)) - { - eif->failed = true; - return false; - } - } - } - - return true; -} - -/* Look through the symbols which are defined in other shared - libraries and referenced here. Update the list of version - dependencies. This will be put into the .gnu.version_r section. - This function is called via elf_link_hash_traverse. */ - -static boolean -elf_link_find_version_dependencies (h, data) - struct elf_link_hash_entry *h; - PTR data; -{ - struct elf_find_verdep_info *rinfo = (struct elf_find_verdep_info *) data; - Elf_Internal_Verneed *t; - Elf_Internal_Vernaux *a; - - /* We only care about symbols defined in shared objects with version - information. */ - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 - || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0 - || h->dynindx == -1 - || h->verinfo.verdef == NULL) - return true; - - /* See if we already know about this version. */ - for (t = elf_tdata (rinfo->output_bfd)->verref; t != NULL; t = t->vn_nextref) - { - if (t->vn_bfd != h->verinfo.verdef->vd_bfd) - continue; - - for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr) - if (a->vna_nodename == h->verinfo.verdef->vd_nodename) - return true; - - break; - } - - /* This is a new version. Add it to tree we are building. */ - - if (t == NULL) - { - t = (Elf_Internal_Verneed *) bfd_zalloc (rinfo->output_bfd, sizeof *t); - if (t == NULL) - { - rinfo->failed = true; - return false; - } - - t->vn_bfd = h->verinfo.verdef->vd_bfd; - t->vn_nextref = elf_tdata (rinfo->output_bfd)->verref; - elf_tdata (rinfo->output_bfd)->verref = t; - } - - a = (Elf_Internal_Vernaux *) bfd_zalloc (rinfo->output_bfd, sizeof *a); - - /* Note that we are copying a string pointer here, and testing it - above. If bfd_elf_string_from_elf_section is ever changed to - discard the string data when low in memory, this will have to be - fixed. */ - a->vna_nodename = h->verinfo.verdef->vd_nodename; - - a->vna_flags = h->verinfo.verdef->vd_flags; - a->vna_nextptr = t->vn_auxptr; - - h->verinfo.verdef->vd_exp_refno = rinfo->vers; - ++rinfo->vers; - - a->vna_other = h->verinfo.verdef->vd_exp_refno + 1; - - t->vn_auxptr = a; - - return true; -} - -/* Figure out appropriate versions for all the symbols. We may not - have the version number script until we have read all of the input - files, so until that point we don't know which symbols should be - local. This function is called via elf_link_hash_traverse. */ - -static boolean -elf_link_assign_sym_version (h, data) - struct elf_link_hash_entry *h; - PTR data; -{ - struct elf_assign_sym_version_info *sinfo = - (struct elf_assign_sym_version_info *) data; - struct bfd_link_info *info = sinfo->info; - struct elf_backend_data *bed; - struct elf_info_failed eif; - char *p; - - /* Fix the symbol flags. */ - eif.failed = false; - eif.info = info; - if (! elf_fix_symbol_flags (h, &eif)) - { - if (eif.failed) - sinfo->failed = true; - return false; - } - - /* We only need version numbers for symbols defined in regular - objects. */ - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - return true; - - bed = get_elf_backend_data (sinfo->output_bfd); - p = strchr (h->root.root.string, ELF_VER_CHR); - if (p != NULL && h->verinfo.vertree == NULL) - { - struct bfd_elf_version_tree *t; - boolean hidden; - - hidden = true; - - /* There are two consecutive ELF_VER_CHR characters if this is - not a hidden symbol. */ - ++p; - if (*p == ELF_VER_CHR) - { - hidden = false; - ++p; - } - - /* If there is no version string, we can just return out. */ - if (*p == '\0') - { - if (hidden) - h->elf_link_hash_flags |= ELF_LINK_HIDDEN; - return true; - } - - /* Look for the version. If we find it, it is no longer weak. */ - for (t = sinfo->verdefs; t != NULL; t = t->next) - { - if (strcmp (t->name, p) == 0) - { - int len; - char *alc; - struct bfd_elf_version_expr *d; - - len = p - h->root.root.string; - alc = bfd_alloc (sinfo->output_bfd, len); - if (alc == NULL) - return false; - strncpy (alc, h->root.root.string, len - 1); - alc[len - 1] = '\0'; - if (alc[len - 2] == ELF_VER_CHR) - alc[len - 2] = '\0'; - - h->verinfo.vertree = t; - t->used = true; - d = NULL; - - if (t->globals != NULL) - { - for (d = t->globals; d != NULL; d = d->next) - if ((*d->match) (d, alc)) - break; - } - - /* See if there is anything to force this symbol to - local scope. */ - if (d == NULL && t->locals != NULL) - { - for (d = t->locals; d != NULL; d = d->next) - { - if ((*d->match) (d, alc)) - { - if (h->dynindx != -1 - && info->shared - && ! info->export_dynamic) - { - h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL; - (*bed->elf_backend_hide_symbol) (info, h); - /* FIXME: The name of the symbol has - already been recorded in the dynamic - string table section. */ - } - - break; - } - } - } - - bfd_release (sinfo->output_bfd, alc); - break; - } - } - - /* If we are building an application, we need to create a - version node for this version. */ - if (t == NULL && ! info->shared) - { - struct bfd_elf_version_tree **pp; - int version_index; - - /* If we aren't going to export this symbol, we don't need - to worry about it. */ - if (h->dynindx == -1) - return true; - - t = ((struct bfd_elf_version_tree *) - bfd_alloc (sinfo->output_bfd, sizeof *t)); - if (t == NULL) - { - sinfo->failed = true; - return false; - } - - t->next = NULL; - t->name = p; - t->globals = NULL; - t->locals = NULL; - t->deps = NULL; - t->name_indx = (unsigned int) -1; - t->used = true; - - version_index = 1; - for (pp = &sinfo->verdefs; *pp != NULL; pp = &(*pp)->next) - ++version_index; - t->vernum = version_index; - - *pp = t; - - h->verinfo.vertree = t; - } - else if (t == NULL) - { - /* We could not find the version for a symbol when - generating a shared archive. Return an error. */ - (*_bfd_error_handler) - (_("%s: undefined versioned symbol name %s"), - bfd_get_filename (sinfo->output_bfd), h->root.root.string); - bfd_set_error (bfd_error_bad_value); - sinfo->failed = true; - return false; - } - - if (hidden) - h->elf_link_hash_flags |= ELF_LINK_HIDDEN; - } - - /* If we don't have a version for this symbol, see if we can find - something. */ - if (h->verinfo.vertree == NULL && sinfo->verdefs != NULL) - { - struct bfd_elf_version_tree *t; - struct bfd_elf_version_tree *deflt; - struct bfd_elf_version_expr *d; - - /* See if can find what version this symbol is in. If the - symbol is supposed to be local, then don't actually register - it. */ - deflt = NULL; - for (t = sinfo->verdefs; t != NULL; t = t->next) - { - if (t->globals != NULL) - { - for (d = t->globals; d != NULL; d = d->next) - { - if ((*d->match) (d, h->root.root.string)) - { - h->verinfo.vertree = t; - break; - } - } - - if (d != NULL) - break; - } - - if (t->locals != NULL) - { - for (d = t->locals; d != NULL; d = d->next) - { - if (d->pattern[0] == '*' && d->pattern[1] == '\0') - deflt = t; - else if ((*d->match) (d, h->root.root.string)) - { - h->verinfo.vertree = t; - if (h->dynindx != -1 - && info->shared - && ! info->export_dynamic) - { - h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL; - (*bed->elf_backend_hide_symbol) (info, h); - /* FIXME: The name of the symbol has already - been recorded in the dynamic string table - section. */ - } - break; - } - } - - if (d != NULL) - break; - } - } - - if (deflt != NULL && h->verinfo.vertree == NULL) - { - h->verinfo.vertree = deflt; - if (h->dynindx != -1 - && info->shared - && ! info->export_dynamic) - { - h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL; - (*bed->elf_backend_hide_symbol) (info, h); - /* FIXME: The name of the symbol has already been - recorded in the dynamic string table section. */ - } - } - } - - return true; -} - -/* Final phase of ELF linker. */ - -/* A structure we use to avoid passing large numbers of arguments. */ - -struct elf_final_link_info -{ - /* General link information. */ - struct bfd_link_info *info; - /* Output BFD. */ - bfd *output_bfd; - /* Symbol string table. */ - struct bfd_strtab_hash *symstrtab; - /* .dynsym section. */ - asection *dynsym_sec; - /* .hash section. */ - asection *hash_sec; - /* symbol version section (.gnu.version). */ - asection *symver_sec; - /* Buffer large enough to hold contents of any section. */ - bfd_byte *contents; - /* Buffer large enough to hold external relocs of any section. */ - PTR external_relocs; - /* Buffer large enough to hold internal relocs of any section. */ - Elf_Internal_Rela *internal_relocs; - /* Buffer large enough to hold external local symbols of any input - BFD. */ - Elf_External_Sym *external_syms; - /* Buffer large enough to hold internal local symbols of any input - BFD. */ - Elf_Internal_Sym *internal_syms; - /* Array large enough to hold a symbol index for each local symbol - of any input BFD. */ - long *indices; - /* Array large enough to hold a section pointer for each local - symbol of any input BFD. */ - asection **sections; - /* Buffer to hold swapped out symbols. */ - Elf_External_Sym *symbuf; - /* Number of swapped out symbols in buffer. */ - size_t symbuf_count; - /* Number of symbols which fit in symbuf. */ - size_t symbuf_size; -}; - -static boolean elf_link_output_sym - PARAMS ((struct elf_final_link_info *, const char *, - Elf_Internal_Sym *, asection *)); -static boolean elf_link_flush_output_syms - PARAMS ((struct elf_final_link_info *)); -static boolean elf_link_output_extsym - PARAMS ((struct elf_link_hash_entry *, PTR)); -static boolean elf_link_sec_merge_syms - PARAMS ((struct elf_link_hash_entry *, PTR)); -static boolean elf_link_input_bfd - PARAMS ((struct elf_final_link_info *, bfd *)); -static boolean elf_reloc_link_order - PARAMS ((bfd *, struct bfd_link_info *, asection *, - struct bfd_link_order *)); - -/* This struct is used to pass information to elf_link_output_extsym. */ - -struct elf_outext_info -{ - boolean failed; - boolean localsyms; - struct elf_final_link_info *finfo; -}; - -/* Compute the size of, and allocate space for, REL_HDR which is the - section header for a section containing relocations for O. */ - -static boolean -elf_link_size_reloc_section (abfd, rel_hdr, o) - bfd *abfd; - Elf_Internal_Shdr *rel_hdr; - asection *o; -{ - unsigned reloc_count; - unsigned num_rel_hashes; - - /* Figure out how many relocations there will be. */ - if (rel_hdr == &elf_section_data (o)->rel_hdr) - reloc_count = elf_section_data (o)->rel_count; - else - reloc_count = elf_section_data (o)->rel_count2; - - num_rel_hashes = o->reloc_count; - if (num_rel_hashes < reloc_count) - num_rel_hashes = reloc_count; - - /* That allows us to calculate the size of the section. */ - rel_hdr->sh_size = rel_hdr->sh_entsize * reloc_count; - - /* The contents field must last into write_object_contents, so we - allocate it with bfd_alloc rather than malloc. Also since we - cannot be sure that the contents will actually be filled in, - we zero the allocated space. */ - rel_hdr->contents = (PTR) bfd_zalloc (abfd, rel_hdr->sh_size); - if (rel_hdr->contents == NULL && rel_hdr->sh_size != 0) - return false; - - /* We only allocate one set of hash entries, so we only do it the - first time we are called. */ - if (elf_section_data (o)->rel_hashes == NULL - && num_rel_hashes) - { - struct elf_link_hash_entry **p; - - p = ((struct elf_link_hash_entry **) - bfd_zmalloc (num_rel_hashes - * sizeof (struct elf_link_hash_entry *))); - if (p == NULL) - return false; - - elf_section_data (o)->rel_hashes = p; - } - - return true; -} - -/* When performing a relocateable link, the input relocations are - preserved. But, if they reference global symbols, the indices - referenced must be updated. Update all the relocations in - REL_HDR (there are COUNT of them), using the data in REL_HASH. */ - -static void -elf_link_adjust_relocs (abfd, rel_hdr, count, rel_hash) - bfd *abfd; - Elf_Internal_Shdr *rel_hdr; - unsigned int count; - struct elf_link_hash_entry **rel_hash; -{ - unsigned int i; - struct elf_backend_data *bed = get_elf_backend_data (abfd); - Elf_Internal_Rel *irel; - Elf_Internal_Rela *irela; - - irel = (Elf_Internal_Rel *) bfd_zmalloc (sizeof (Elf_Internal_Rel) - * bed->s->int_rels_per_ext_rel); - if (irel == NULL) - { - (*_bfd_error_handler) (_("Error: out of memory")); - abort (); - } - - irela = (Elf_Internal_Rela *) bfd_zmalloc (sizeof (Elf_Internal_Rela) - * bed->s->int_rels_per_ext_rel); - if (irela == NULL) - { - (*_bfd_error_handler) (_("Error: out of memory")); - abort (); - } - - for (i = 0; i < count; i++, rel_hash++) - { - if (*rel_hash == NULL) - continue; - - BFD_ASSERT ((*rel_hash)->indx >= 0); - - if (rel_hdr->sh_entsize == sizeof (Elf_External_Rel)) - { - Elf_External_Rel *erel; - unsigned int j; - - erel = (Elf_External_Rel *) rel_hdr->contents + i; - if (bed->s->swap_reloc_in) - (*bed->s->swap_reloc_in) (abfd, (bfd_byte *) erel, irel); - else - elf_swap_reloc_in (abfd, erel, irel); - - for (j = 0; j < bed->s->int_rels_per_ext_rel; j++) - irel[j].r_info = ELF_R_INFO ((*rel_hash)->indx, - ELF_R_TYPE (irel[j].r_info)); - - if (bed->s->swap_reloc_out) - (*bed->s->swap_reloc_out) (abfd, irel, (bfd_byte *) erel); - else - elf_swap_reloc_out (abfd, irel, erel); - } - else - { - Elf_External_Rela *erela; - unsigned int j; - - BFD_ASSERT (rel_hdr->sh_entsize - == sizeof (Elf_External_Rela)); - - erela = (Elf_External_Rela *) rel_hdr->contents + i; - if (bed->s->swap_reloca_in) - (*bed->s->swap_reloca_in) (abfd, (bfd_byte *) erela, irela); - else - elf_swap_reloca_in (abfd, erela, irela); - - for (j = 0; j < bed->s->int_rels_per_ext_rel; j++) - irela[j].r_info = ELF_R_INFO ((*rel_hash)->indx, - ELF_R_TYPE (irela[j].r_info)); - - if (bed->s->swap_reloca_out) - (*bed->s->swap_reloca_out) (abfd, irela, (bfd_byte *) erela); - else - elf_swap_reloca_out (abfd, irela, erela); - } - } - - free (irel); - free (irela); -} - -struct elf_link_sort_rela { - bfd_vma offset; - enum elf_reloc_type_class type; - union { - Elf_Internal_Rel rel; - Elf_Internal_Rela rela; - } u; -}; - -static int -elf_link_sort_cmp1 (A, B) - const PTR A; - const PTR B; -{ - struct elf_link_sort_rela *a = (struct elf_link_sort_rela *)A; - struct elf_link_sort_rela *b = (struct elf_link_sort_rela *)B; - int relativea, relativeb; - - relativea = a->type == reloc_class_relative; - relativeb = b->type == reloc_class_relative; - - if (relativea < relativeb) - return 1; - if (relativea > relativeb) - return -1; - if (ELF_R_SYM (a->u.rel.r_info) < ELF_R_SYM (b->u.rel.r_info)) - return -1; - if (ELF_R_SYM (a->u.rel.r_info) > ELF_R_SYM (b->u.rel.r_info)) - return 1; - if (a->u.rel.r_offset < b->u.rel.r_offset) - return -1; - if (a->u.rel.r_offset > b->u.rel.r_offset) - return 1; - return 0; -} - -static int -elf_link_sort_cmp2 (A, B) - const PTR A; - const PTR B; -{ - struct elf_link_sort_rela *a = (struct elf_link_sort_rela *)A; - struct elf_link_sort_rela *b = (struct elf_link_sort_rela *)B; - int copya, copyb; - - if (a->offset < b->offset) - return -1; - if (a->offset > b->offset) - return 1; - copya = a->type == reloc_class_copy; - copyb = b->type == reloc_class_copy; - if (copya < copyb) - return -1; - if (copya > copyb) - return 1; - if (a->u.rel.r_offset < b->u.rel.r_offset) - return -1; - if (a->u.rel.r_offset > b->u.rel.r_offset) - return 1; - return 0; -} - -static size_t -elf_link_sort_relocs (abfd, info, psec) - bfd *abfd; - struct bfd_link_info *info; - asection **psec; -{ - bfd *dynobj = elf_hash_table (info)->dynobj; - asection *reldyn, *o; - boolean rel = false; - size_t count, size, i, j, ret; - struct elf_link_sort_rela *rela; - struct elf_backend_data *bed = get_elf_backend_data (abfd); - - reldyn = bfd_get_section_by_name (abfd, ".rela.dyn"); - if (reldyn == NULL || reldyn->_raw_size == 0) - { - reldyn = bfd_get_section_by_name (abfd, ".rel.dyn"); - if (reldyn == NULL || reldyn->_raw_size == 0) - return 0; - rel = true; - count = reldyn->_raw_size / sizeof (Elf_External_Rel); - } - else - count = reldyn->_raw_size / sizeof (Elf_External_Rela); - - size = 0; - for (o = dynobj->sections; o != NULL; o = o->next) - if ((o->flags & (SEC_HAS_CONTENTS|SEC_LINKER_CREATED)) - == (SEC_HAS_CONTENTS|SEC_LINKER_CREATED) - && o->output_section == reldyn) - size += o->_raw_size; - - if (size != reldyn->_raw_size) - return 0; - - rela = (struct elf_link_sort_rela *) calloc (sizeof (*rela), count); - if (rela == NULL) - { - (*info->callbacks->warning) - (info, _("Not enough memory to sort relocations"), 0, abfd, 0, 0); - return 0; - } - - for (o = dynobj->sections; o != NULL; o = o->next) - if ((o->flags & (SEC_HAS_CONTENTS|SEC_LINKER_CREATED)) - == (SEC_HAS_CONTENTS|SEC_LINKER_CREATED) - && o->output_section == reldyn) - { - if (rel) - { - Elf_External_Rel *erel, *erelend; - struct elf_link_sort_rela *s; - - erel = (Elf_External_Rel *) o->contents; - erelend = (Elf_External_Rel *) ((PTR) o->contents + o->_raw_size); - s = rela + o->output_offset / sizeof (Elf_External_Rel); - for (; erel < erelend; erel++, s++) - { - if (bed->s->swap_reloc_in) - (*bed->s->swap_reloc_in) (abfd, (bfd_byte *) erel, &s->u.rel); - else - elf_swap_reloc_in (abfd, erel, &s->u.rel); - - s->type = (*bed->elf_backend_reloc_type_class) - (ELF_R_TYPE (s->u.rel.r_info)); - } - } - else - { - Elf_External_Rela *erela, *erelaend; - struct elf_link_sort_rela *s; - - erela = (Elf_External_Rela *) o->contents; - erelaend = (Elf_External_Rela *) ((PTR) o->contents + o->_raw_size); - s = rela + o->output_offset / sizeof (Elf_External_Rela); - for (; erela < erelaend; erela++, s++) - { - if (bed->s->swap_reloca_in) - (*bed->s->swap_reloca_in) (dynobj, (bfd_byte *) erela, &s->u.rela); - else - elf_swap_reloca_in (dynobj, erela, &s->u.rela); - - s->type = (*bed->elf_backend_reloc_type_class) - (ELF_R_TYPE (s->u.rel.r_info)); - } - } - } - - qsort (rela, count, sizeof (*rela), elf_link_sort_cmp1); - for (ret = 0; ret < count && rela[ret].type == reloc_class_relative; ret++) - ; - for (i = ret, j = ret; i < count; i++) - { - if (ELF_R_SYM (rela[i].u.rel.r_info) != ELF_R_SYM (rela[j].u.rel.r_info)) - j = i; - rela[i].offset = rela[j].u.rel.r_offset; - } - qsort (rela + ret, count - ret, sizeof (*rela), elf_link_sort_cmp2); - - for (o = dynobj->sections; o != NULL; o = o->next) - if ((o->flags & (SEC_HAS_CONTENTS|SEC_LINKER_CREATED)) - == (SEC_HAS_CONTENTS|SEC_LINKER_CREATED) - && o->output_section == reldyn) - { - if (rel) - { - Elf_External_Rel *erel, *erelend; - struct elf_link_sort_rela *s; - - erel = (Elf_External_Rel *) o->contents; - erelend = (Elf_External_Rel *) ((PTR) o->contents + o->_raw_size); - s = rela + o->output_offset / sizeof (Elf_External_Rel); - for (; erel < erelend; erel++, s++) - { - if (bed->s->swap_reloc_out) - (*bed->s->swap_reloc_out) (abfd, &s->u.rel, (bfd_byte *) erel); - else - elf_swap_reloc_out (abfd, &s->u.rel, erel); - } - } - else - { - Elf_External_Rela *erela, *erelaend; - struct elf_link_sort_rela *s; - - erela = (Elf_External_Rela *) o->contents; - erelaend = (Elf_External_Rela *) ((PTR) o->contents + o->_raw_size); - s = rela + o->output_offset / sizeof (Elf_External_Rela); - for (; erela < erelaend; erela++, s++) - { - if (bed->s->swap_reloca_out) - (*bed->s->swap_reloca_out) (dynobj, &s->u.rela, (bfd_byte *) erela); - else - elf_swap_reloca_out (dynobj, &s->u.rela, erela); - } - } - } - - free (rela); - *psec = reldyn; - return ret; -} - -/* Do the final step of an ELF link. */ - -boolean -elf_bfd_final_link (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - boolean dynamic; - boolean emit_relocs; - bfd *dynobj; - struct elf_final_link_info finfo; - register asection *o; - register struct bfd_link_order *p; - register bfd *sub; - size_t max_contents_size; - size_t max_external_reloc_size; - size_t max_internal_reloc_count; - size_t max_sym_count; - file_ptr off; - Elf_Internal_Sym elfsym; - unsigned int i; - Elf_Internal_Shdr *symtab_hdr; - Elf_Internal_Shdr *symstrtab_hdr; - struct elf_backend_data *bed = get_elf_backend_data (abfd); - struct elf_outext_info eoinfo; - boolean merged; - size_t relativecount = 0; - asection *reldyn = 0; - - if (! is_elf_hash_table (info)) - return false; - - if (info->shared) - abfd->flags |= DYNAMIC; - - dynamic = elf_hash_table (info)->dynamic_sections_created; - dynobj = elf_hash_table (info)->dynobj; - - emit_relocs = (info->relocateable - || info->emitrelocations - || bed->elf_backend_emit_relocs); - - finfo.info = info; - finfo.output_bfd = abfd; - finfo.symstrtab = elf_stringtab_init (); - if (finfo.symstrtab == NULL) - return false; - - if (! dynamic) - { - finfo.dynsym_sec = NULL; - finfo.hash_sec = NULL; - finfo.symver_sec = NULL; - } - else - { - finfo.dynsym_sec = bfd_get_section_by_name (dynobj, ".dynsym"); - finfo.hash_sec = bfd_get_section_by_name (dynobj, ".hash"); - BFD_ASSERT (finfo.dynsym_sec != NULL && finfo.hash_sec != NULL); - finfo.symver_sec = bfd_get_section_by_name (dynobj, ".gnu.version"); - /* Note that it is OK if symver_sec is NULL. */ - } - - finfo.contents = NULL; - finfo.external_relocs = NULL; - finfo.internal_relocs = NULL; - finfo.external_syms = NULL; - finfo.internal_syms = NULL; - finfo.indices = NULL; - finfo.sections = NULL; - finfo.symbuf = NULL; - finfo.symbuf_count = 0; - - /* Count up the number of relocations we will output for each output - section, so that we know the sizes of the reloc sections. We - also figure out some maximum sizes. */ - max_contents_size = 0; - max_external_reloc_size = 0; - max_internal_reloc_count = 0; - max_sym_count = 0; - merged = false; - for (o = abfd->sections; o != (asection *) NULL; o = o->next) - { - o->reloc_count = 0; - - for (p = o->link_order_head; p != NULL; p = p->next) - { - if (p->type == bfd_section_reloc_link_order - || p->type == bfd_symbol_reloc_link_order) - ++o->reloc_count; - else if (p->type == bfd_indirect_link_order) - { - asection *sec; - - sec = p->u.indirect.section; - - /* Mark all sections which are to be included in the - link. This will normally be every section. We need - to do this so that we can identify any sections which - the linker has decided to not include. */ - sec->linker_mark = true; - - if (sec->flags & SEC_MERGE) - merged = true; - - if (info->relocateable || info->emitrelocations) - o->reloc_count += sec->reloc_count; - else if (bed->elf_backend_count_relocs) - { - Elf_Internal_Rela * relocs; - - relocs = (NAME(_bfd_elf,link_read_relocs) - (abfd, sec, (PTR) NULL, - (Elf_Internal_Rela *) NULL, info->keep_memory)); - - o->reloc_count += (*bed->elf_backend_count_relocs) - (sec, relocs); - - if (!info->keep_memory) - free (relocs); - } - - if (sec->_raw_size > max_contents_size) - max_contents_size = sec->_raw_size; - if (sec->_cooked_size > max_contents_size) - max_contents_size = sec->_cooked_size; - - /* We are interested in just local symbols, not all - symbols. */ - if (bfd_get_flavour (sec->owner) == bfd_target_elf_flavour - && (sec->owner->flags & DYNAMIC) == 0) - { - size_t sym_count; - - if (elf_bad_symtab (sec->owner)) - sym_count = (elf_tdata (sec->owner)->symtab_hdr.sh_size - / sizeof (Elf_External_Sym)); - else - sym_count = elf_tdata (sec->owner)->symtab_hdr.sh_info; - - if (sym_count > max_sym_count) - max_sym_count = sym_count; - - if ((sec->flags & SEC_RELOC) != 0) - { - size_t ext_size; - - ext_size = elf_section_data (sec)->rel_hdr.sh_size; - if (ext_size > max_external_reloc_size) - max_external_reloc_size = ext_size; - if (sec->reloc_count > max_internal_reloc_count) - max_internal_reloc_count = sec->reloc_count; - } - } - } - } - - if (o->reloc_count > 0) - o->flags |= SEC_RELOC; - else - { - /* Explicitly clear the SEC_RELOC flag. The linker tends to - set it (this is probably a bug) and if it is set - assign_section_numbers will create a reloc section. */ - o->flags &=~ SEC_RELOC; - } - - /* If the SEC_ALLOC flag is not set, force the section VMA to - zero. This is done in elf_fake_sections as well, but forcing - the VMA to 0 here will ensure that relocs against these - sections are handled correctly. */ - if ((o->flags & SEC_ALLOC) == 0 - && ! o->user_set_vma) - o->vma = 0; - } - - if (! info->relocateable && merged) - elf_link_hash_traverse (elf_hash_table (info), - elf_link_sec_merge_syms, (PTR) abfd); - - /* Figure out the file positions for everything but the symbol table - and the relocs. We set symcount to force assign_section_numbers - to create a symbol table. */ - bfd_get_symcount (abfd) = info->strip == strip_all ? 0 : 1; - BFD_ASSERT (! abfd->output_has_begun); - if (! _bfd_elf_compute_section_file_positions (abfd, info)) - goto error_return; - - /* Figure out how many relocations we will have in each section. - Just using RELOC_COUNT isn't good enough since that doesn't - maintain a separate value for REL vs. RELA relocations. */ - if (emit_relocs) - for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) - for (o = sub->sections; o != NULL; o = o->next) - { - asection *output_section; - - if (! o->linker_mark) - { - /* This section was omitted from the link. */ - continue; - } - - output_section = o->output_section; - - if (output_section != NULL - && (o->flags & SEC_RELOC) != 0) - { - struct bfd_elf_section_data *esdi - = elf_section_data (o); - struct bfd_elf_section_data *esdo - = elf_section_data (output_section); - unsigned int *rel_count; - unsigned int *rel_count2; - - /* We must be careful to add the relocation froms the - input section to the right output count. */ - if (esdi->rel_hdr.sh_entsize == esdo->rel_hdr.sh_entsize) - { - rel_count = &esdo->rel_count; - rel_count2 = &esdo->rel_count2; - } - else - { - rel_count = &esdo->rel_count2; - rel_count2 = &esdo->rel_count; - } - - *rel_count += NUM_SHDR_ENTRIES (& esdi->rel_hdr); - if (esdi->rel_hdr2) - *rel_count2 += NUM_SHDR_ENTRIES (esdi->rel_hdr2); - output_section->flags |= SEC_RELOC; - } - } - - /* That created the reloc sections. Set their sizes, and assign - them file positions, and allocate some buffers. */ - for (o = abfd->sections; o != NULL; o = o->next) - { - if ((o->flags & SEC_RELOC) != 0) - { - if (!elf_link_size_reloc_section (abfd, - &elf_section_data (o)->rel_hdr, - o)) - goto error_return; - - if (elf_section_data (o)->rel_hdr2 - && !elf_link_size_reloc_section (abfd, - elf_section_data (o)->rel_hdr2, - o)) - goto error_return; - } - - /* Now, reset REL_COUNT and REL_COUNT2 so that we can use them - to count upwards while actually outputting the relocations. */ - elf_section_data (o)->rel_count = 0; - elf_section_data (o)->rel_count2 = 0; - } - - _bfd_elf_assign_file_positions_for_relocs (abfd); - - /* We have now assigned file positions for all the sections except - .symtab and .strtab. We start the .symtab section at the current - file position, and write directly to it. We build the .strtab - section in memory. */ - bfd_get_symcount (abfd) = 0; - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; - /* sh_name is set in prep_headers. */ - symtab_hdr->sh_type = SHT_SYMTAB; - symtab_hdr->sh_flags = 0; - symtab_hdr->sh_addr = 0; - symtab_hdr->sh_size = 0; - symtab_hdr->sh_entsize = sizeof (Elf_External_Sym); - /* sh_link is set in assign_section_numbers. */ - /* sh_info is set below. */ - /* sh_offset is set just below. */ - symtab_hdr->sh_addralign = bed->s->file_align; - - off = elf_tdata (abfd)->next_file_pos; - off = _bfd_elf_assign_file_position_for_section (symtab_hdr, off, true); - - /* Note that at this point elf_tdata (abfd)->next_file_pos is - incorrect. We do not yet know the size of the .symtab section. - We correct next_file_pos below, after we do know the size. */ - - /* Allocate a buffer to hold swapped out symbols. This is to avoid - continuously seeking to the right position in the file. */ - if (! info->keep_memory || max_sym_count < 20) - finfo.symbuf_size = 20; - else - finfo.symbuf_size = max_sym_count; - finfo.symbuf = ((Elf_External_Sym *) - bfd_malloc (finfo.symbuf_size * sizeof (Elf_External_Sym))); - if (finfo.symbuf == NULL) - goto error_return; - - /* Start writing out the symbol table. The first symbol is always a - dummy symbol. */ - if (info->strip != strip_all - || emit_relocs) - { - elfsym.st_value = 0; - elfsym.st_size = 0; - elfsym.st_info = 0; - elfsym.st_other = 0; - elfsym.st_shndx = SHN_UNDEF; - if (! elf_link_output_sym (&finfo, (const char *) NULL, - &elfsym, bfd_und_section_ptr)) - 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)) - 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 - index field of the section, so that we can find it again when - outputting relocs. */ - if (info->strip != strip_all - || emit_relocs) - { - elfsym.st_size = 0; - elfsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION); - elfsym.st_other = 0; - for (i = 1; i < elf_elfheader (abfd)->e_shnum; i++) - { - o = section_from_elf_index (abfd, i); - if (o != NULL) - o->target_index = bfd_get_symcount (abfd); - elfsym.st_shndx = i; - if (info->relocateable || o == NULL) - elfsym.st_value = 0; - else - elfsym.st_value = o->vma; - if (! elf_link_output_sym (&finfo, (const char *) NULL, - &elfsym, o)) - goto error_return; - } - } - - /* Allocate some memory to hold information read in from the input - files. */ - finfo.contents = (bfd_byte *) bfd_malloc (max_contents_size); - finfo.external_relocs = (PTR) bfd_malloc (max_external_reloc_size); - finfo.internal_relocs = ((Elf_Internal_Rela *) - bfd_malloc (max_internal_reloc_count - * sizeof (Elf_Internal_Rela) - * bed->s->int_rels_per_ext_rel)); - finfo.external_syms = ((Elf_External_Sym *) - bfd_malloc (max_sym_count - * sizeof (Elf_External_Sym))); - finfo.internal_syms = ((Elf_Internal_Sym *) - bfd_malloc (max_sym_count - * sizeof (Elf_Internal_Sym))); - finfo.indices = (long *) bfd_malloc (max_sym_count * sizeof (long)); - finfo.sections = ((asection **) - bfd_malloc (max_sym_count * sizeof (asection *))); - if ((finfo.contents == NULL && max_contents_size != 0) - || (finfo.external_relocs == NULL && max_external_reloc_size != 0) - || (finfo.internal_relocs == NULL && max_internal_reloc_count != 0) - || (finfo.external_syms == NULL && max_sym_count != 0) - || (finfo.internal_syms == NULL && max_sym_count != 0) - || (finfo.indices == NULL && max_sym_count != 0) - || (finfo.sections == NULL && max_sym_count != 0)) - goto error_return; - - /* Since ELF permits relocations to be against local symbols, we - must have the local symbols available when we do the relocations. - Since we would rather only read the local symbols once, and we - would rather not keep them in memory, we handle all the - relocations for a single input file at the same time. - - Unfortunately, there is no way to know the total number of local - symbols until we have seen all of them, and the local symbol - indices precede the global symbol indices. This means that when - we are generating relocateable output, and we see a reloc against - a global symbol, we can not know the symbol index until we have - finished examining all the local symbols to see which ones we are - going to output. To deal with this, we keep the relocations in - memory, and don't output them until the end of the link. This is - an unfortunate waste of memory, but I don't see a good way around - it. Fortunately, it only happens when performing a relocateable - link, which is not the common case. FIXME: If keep_memory is set - we could write the relocs out and then read them again; I don't - know how bad the memory loss will be. */ - - for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) - sub->output_has_begun = false; - for (o = abfd->sections; o != NULL; o = o->next) - { - for (p = o->link_order_head; p != NULL; p = p->next) - { - if (p->type == bfd_indirect_link_order - && (bfd_get_flavour (p->u.indirect.section->owner) - == bfd_target_elf_flavour)) - { - sub = p->u.indirect.section->owner; - if (! sub->output_has_begun) - { - if (! elf_link_input_bfd (&finfo, sub)) - goto error_return; - sub->output_has_begun = true; - } - } - else if (p->type == bfd_section_reloc_link_order - || p->type == bfd_symbol_reloc_link_order) - { - if (! elf_reloc_link_order (abfd, info, o, p)) - goto error_return; - } - else - { - if (! _bfd_default_link_order (abfd, info, o, p)) - goto error_return; - } - } - } - - /* That wrote out all the local symbols. Finish up the symbol table - with the global symbols. Even if we want to strip everything we - can, we still need to deal with those global symbols that got - converted to local in a version script. */ - - if (info->shared) - { - /* Output any global symbols that got converted to local in a - version script. We do this in a separate step since ELF - requires all local symbols to appear prior to any global - symbols. FIXME: We should only do this if some global - symbols were, in fact, converted to become local. FIXME: - Will this work correctly with the Irix 5 linker? */ - eoinfo.failed = false; - eoinfo.finfo = &finfo; - eoinfo.localsyms = true; - elf_link_hash_traverse (elf_hash_table (info), elf_link_output_extsym, - (PTR) &eoinfo); - if (eoinfo.failed) - return false; - } - - /* The sh_info field records the index of the first non local symbol. */ - symtab_hdr->sh_info = bfd_get_symcount (abfd); - - if (dynamic - && finfo.dynsym_sec->output_section != bfd_abs_section_ptr) - { - Elf_Internal_Sym sym; - Elf_External_Sym *dynsym = - (Elf_External_Sym *) finfo.dynsym_sec->contents; - long last_local = 0; - - /* Write out the section symbols for the output sections. */ - if (info->shared) - { - asection *s; - - sym.st_size = 0; - sym.st_name = 0; - sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION); - sym.st_other = 0; - - for (s = abfd->sections; s != NULL; s = s->next) - { - int indx; - indx = elf_section_data (s)->this_idx; - BFD_ASSERT (indx > 0); - sym.st_shndx = indx; - sym.st_value = s->vma; - - elf_swap_symbol_out (abfd, &sym, - dynsym + elf_section_data (s)->dynindx); - } - - last_local = bfd_count_sections (abfd); - } - - /* Write out the local dynsyms. */ - if (elf_hash_table (info)->dynlocal) - { - struct elf_link_local_dynamic_entry *e; - for (e = elf_hash_table (info)->dynlocal; e ; e = e->next) - { - asection *s; - - sym.st_size = e->isym.st_size; - sym.st_other = e->isym.st_other; - - /* Copy the internal symbol as is. - Note that we saved a word of storage and overwrote - the original st_name with the dynstr_index. */ - sym = e->isym; - - if (e->isym.st_shndx > 0 && e->isym.st_shndx < SHN_LORESERVE) - { - s = bfd_section_from_elf_index (e->input_bfd, - e->isym.st_shndx); - - sym.st_shndx = - elf_section_data (s->output_section)->this_idx; - sym.st_value = (s->output_section->vma - + s->output_offset - + e->isym.st_value); - } - - if (last_local < e->dynindx) - last_local = e->dynindx; - - elf_swap_symbol_out (abfd, &sym, dynsym + e->dynindx); - } - } - - elf_section_data (finfo.dynsym_sec->output_section)->this_hdr.sh_info = - last_local + 1; - } - - /* We get the global symbols from the hash table. */ - eoinfo.failed = false; - eoinfo.localsyms = false; - eoinfo.finfo = &finfo; - elf_link_hash_traverse (elf_hash_table (info), elf_link_output_extsym, - (PTR) &eoinfo); - if (eoinfo.failed) - return false; - - /* If backend needs to output some symbols not present in the hash - table, do it now. */ - if (bed->elf_backend_output_arch_syms) - { - if (! (*bed->elf_backend_output_arch_syms) - (abfd, info, (PTR) &finfo, - (boolean (*) PARAMS ((PTR, const char *, - Elf_Internal_Sym *, asection *))) - elf_link_output_sym)) - return false; - } - - /* Flush all symbols to the file. */ - if (! elf_link_flush_output_syms (&finfo)) - return false; - - /* Now we know the size of the symtab section. */ - off += symtab_hdr->sh_size; - - /* Finish up and write out the symbol string table (.strtab) - section. */ - symstrtab_hdr = &elf_tdata (abfd)->strtab_hdr; - /* sh_name was set in prep_headers. */ - symstrtab_hdr->sh_type = SHT_STRTAB; - symstrtab_hdr->sh_flags = 0; - symstrtab_hdr->sh_addr = 0; - symstrtab_hdr->sh_size = _bfd_stringtab_size (finfo.symstrtab); - symstrtab_hdr->sh_entsize = 0; - symstrtab_hdr->sh_link = 0; - symstrtab_hdr->sh_info = 0; - /* sh_offset is set just below. */ - symstrtab_hdr->sh_addralign = 1; - - off = _bfd_elf_assign_file_position_for_section (symstrtab_hdr, off, true); - elf_tdata (abfd)->next_file_pos = off; - - if (bfd_get_symcount (abfd) > 0) - { - if (bfd_seek (abfd, symstrtab_hdr->sh_offset, SEEK_SET) != 0 - || ! _bfd_stringtab_emit (abfd, finfo.symstrtab)) - return false; - } - - /* Adjust the relocs to have the correct symbol indices. */ - for (o = abfd->sections; o != NULL; o = o->next) - { - if ((o->flags & SEC_RELOC) == 0) - continue; - - elf_link_adjust_relocs (abfd, &elf_section_data (o)->rel_hdr, - elf_section_data (o)->rel_count, - elf_section_data (o)->rel_hashes); - if (elf_section_data (o)->rel_hdr2 != NULL) - elf_link_adjust_relocs (abfd, elf_section_data (o)->rel_hdr2, - elf_section_data (o)->rel_count2, - (elf_section_data (o)->rel_hashes - + elf_section_data (o)->rel_count)); - - /* Set the reloc_count field to 0 to prevent write_relocs from - trying to swap the relocs out itself. */ - o->reloc_count = 0; - } - - if (dynamic && info->combreloc && dynobj != NULL) - relativecount = elf_link_sort_relocs (abfd, info, &reldyn); - - /* If we are linking against a dynamic object, or generating a - shared library, finish up the dynamic linking information. */ - if (dynamic) - { - Elf_External_Dyn *dyncon, *dynconend; - - /* Fix up .dynamic entries. */ - o = bfd_get_section_by_name (dynobj, ".dynamic"); - BFD_ASSERT (o != NULL); - - dyncon = (Elf_External_Dyn *) o->contents; - dynconend = (Elf_External_Dyn *) (o->contents + o->_raw_size); - for (; dyncon < dynconend; dyncon++) - { - Elf_Internal_Dyn dyn; - const char *name; - unsigned int type; - - elf_swap_dyn_in (dynobj, dyncon, &dyn); - - switch (dyn.d_tag) - { - default: - break; - case DT_NULL: - if (relativecount > 0 && dyncon + 1 < dynconend) - { - switch (elf_section_data (reldyn)->this_hdr.sh_type) - { - case SHT_REL: dyn.d_tag = DT_RELCOUNT; break; - case SHT_RELA: dyn.d_tag = DT_RELACOUNT; break; - default: break; - } - if (dyn.d_tag != DT_NULL) - { - dyn.d_un.d_val = relativecount; - elf_swap_dyn_out (dynobj, &dyn, dyncon); - relativecount = 0; - } - } - break; - case DT_INIT: - name = info->init_function; - goto get_sym; - case DT_FINI: - name = info->fini_function; - get_sym: - { - struct elf_link_hash_entry *h; - - h = elf_link_hash_lookup (elf_hash_table (info), name, - false, false, true); - if (h != NULL - && (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak)) - { - dyn.d_un.d_val = h->root.u.def.value; - o = h->root.u.def.section; - if (o->output_section != NULL) - dyn.d_un.d_val += (o->output_section->vma - + o->output_offset); - else - { - /* The symbol is imported from another shared - library and does not apply to this one. */ - dyn.d_un.d_val = 0; - } - - elf_swap_dyn_out (dynobj, &dyn, dyncon); - } - } - break; - - case DT_HASH: - name = ".hash"; - goto get_vma; - case DT_STRTAB: - name = ".dynstr"; - goto get_vma; - case DT_SYMTAB: - name = ".dynsym"; - goto get_vma; - case DT_VERDEF: - name = ".gnu.version_d"; - goto get_vma; - case DT_VERNEED: - name = ".gnu.version_r"; - goto get_vma; - case DT_VERSYM: - name = ".gnu.version"; - get_vma: - o = bfd_get_section_by_name (abfd, name); - BFD_ASSERT (o != NULL); - dyn.d_un.d_ptr = o->vma; - elf_swap_dyn_out (dynobj, &dyn, dyncon); - break; - - case DT_REL: - case DT_RELA: - case DT_RELSZ: - case DT_RELASZ: - if (dyn.d_tag == DT_REL || dyn.d_tag == DT_RELSZ) - type = SHT_REL; - else - type = SHT_RELA; - dyn.d_un.d_val = 0; - for (i = 1; i < elf_elfheader (abfd)->e_shnum; i++) - { - Elf_Internal_Shdr *hdr; - - hdr = elf_elfsections (abfd)[i]; - if (hdr->sh_type == type - && (hdr->sh_flags & SHF_ALLOC) != 0) - { - if (dyn.d_tag == DT_RELSZ || dyn.d_tag == DT_RELASZ) - dyn.d_un.d_val += hdr->sh_size; - else - { - if (dyn.d_un.d_val == 0 - || hdr->sh_addr < dyn.d_un.d_val) - dyn.d_un.d_val = hdr->sh_addr; - } - } - } - elf_swap_dyn_out (dynobj, &dyn, dyncon); - break; - } - } - } - - /* If we have created any dynamic sections, then output them. */ - if (dynobj != NULL) - { - if (! (*bed->elf_backend_finish_dynamic_sections) (abfd, info)) - goto error_return; - - for (o = dynobj->sections; o != NULL; o = o->next) - { - if ((o->flags & SEC_HAS_CONTENTS) == 0 - || o->_raw_size == 0 - || o->output_section == bfd_abs_section_ptr) - continue; - if ((o->flags & SEC_LINKER_CREATED) == 0) - { - /* At this point, we are only interested in sections - created by elf_link_create_dynamic_sections. */ - continue; - } - if ((elf_section_data (o->output_section)->this_hdr.sh_type - != SHT_STRTAB) - || strcmp (bfd_get_section_name (abfd, o), ".dynstr") != 0) - { - if (! bfd_set_section_contents (abfd, o->output_section, - o->contents, o->output_offset, - o->_raw_size)) - goto error_return; - } - else - { - file_ptr off; - - /* The contents of the .dynstr section are actually in a - stringtab. */ - off = elf_section_data (o->output_section)->this_hdr.sh_offset; - if (bfd_seek (abfd, off, SEEK_SET) != 0 - || ! _bfd_stringtab_emit (abfd, - elf_hash_table (info)->dynstr)) - goto error_return; - } - } - } - - /* If we have optimized stabs strings, output them. */ - if (elf_hash_table (info)->stab_info != NULL) - { - if (! _bfd_write_stab_strings (abfd, &elf_hash_table (info)->stab_info)) - goto error_return; - } - - if (finfo.symstrtab != NULL) - _bfd_stringtab_free (finfo.symstrtab); - if (finfo.contents != NULL) - free (finfo.contents); - if (finfo.external_relocs != NULL) - free (finfo.external_relocs); - if (finfo.internal_relocs != NULL) - free (finfo.internal_relocs); - if (finfo.external_syms != NULL) - free (finfo.external_syms); - if (finfo.internal_syms != NULL) - free (finfo.internal_syms); - if (finfo.indices != NULL) - free (finfo.indices); - if (finfo.sections != NULL) - free (finfo.sections); - if (finfo.symbuf != NULL) - free (finfo.symbuf); - for (o = abfd->sections; o != NULL; o = o->next) - { - if ((o->flags & SEC_RELOC) != 0 - && elf_section_data (o)->rel_hashes != NULL) - free (elf_section_data (o)->rel_hashes); - } - - elf_tdata (abfd)->linker = true; - - return true; - - error_return: - if (finfo.symstrtab != NULL) - _bfd_stringtab_free (finfo.symstrtab); - if (finfo.contents != NULL) - free (finfo.contents); - if (finfo.external_relocs != NULL) - free (finfo.external_relocs); - if (finfo.internal_relocs != NULL) - free (finfo.internal_relocs); - if (finfo.external_syms != NULL) - free (finfo.external_syms); - if (finfo.internal_syms != NULL) - free (finfo.internal_syms); - if (finfo.indices != NULL) - free (finfo.indices); - if (finfo.sections != NULL) - free (finfo.sections); - if (finfo.symbuf != NULL) - free (finfo.symbuf); - for (o = abfd->sections; o != NULL; o = o->next) - { - if ((o->flags & SEC_RELOC) != 0 - && elf_section_data (o)->rel_hashes != NULL) - free (elf_section_data (o)->rel_hashes); - } - - return false; -} - -/* Add a symbol to the output symbol table. */ - -static boolean -elf_link_output_sym (finfo, name, elfsym, input_sec) - struct elf_final_link_info *finfo; - const char *name; - Elf_Internal_Sym *elfsym; - asection *input_sec; -{ - boolean (*output_symbol_hook) PARAMS ((bfd *, - struct bfd_link_info *info, - const char *, - Elf_Internal_Sym *, - asection *)); - - output_symbol_hook = get_elf_backend_data (finfo->output_bfd)-> - elf_backend_link_output_symbol_hook; - if (output_symbol_hook != NULL) - { - if (! ((*output_symbol_hook) - (finfo->output_bfd, finfo->info, name, elfsym, input_sec))) - return false; - } - - if (name == (const char *) NULL || *name == '\0') - elfsym->st_name = 0; - else if (input_sec->flags & SEC_EXCLUDE) - elfsym->st_name = 0; - else - { - elfsym->st_name = (unsigned long) _bfd_stringtab_add (finfo->symstrtab, - name, true, false); - if (elfsym->st_name == (unsigned long) -1) - return false; - } - - if (finfo->symbuf_count >= finfo->symbuf_size) - { - if (! elf_link_flush_output_syms (finfo)) - return false; - } - - elf_swap_symbol_out (finfo->output_bfd, elfsym, - (PTR) (finfo->symbuf + finfo->symbuf_count)); - ++finfo->symbuf_count; - - ++ bfd_get_symcount (finfo->output_bfd); - - return true; -} - -/* Flush the output symbols to the file. */ - -static boolean -elf_link_flush_output_syms (finfo) - struct elf_final_link_info *finfo; -{ - if (finfo->symbuf_count > 0) - { - Elf_Internal_Shdr *symtab; - - symtab = &elf_tdata (finfo->output_bfd)->symtab_hdr; - - if (bfd_seek (finfo->output_bfd, symtab->sh_offset + symtab->sh_size, - SEEK_SET) != 0 - || (bfd_write ((PTR) finfo->symbuf, finfo->symbuf_count, - sizeof (Elf_External_Sym), finfo->output_bfd) - != finfo->symbuf_count * sizeof (Elf_External_Sym))) - return false; - - symtab->sh_size += finfo->symbuf_count * sizeof (Elf_External_Sym); - - finfo->symbuf_count = 0; - } - - return true; -} - -/* Adjust all external symbols pointing into SEC_MERGE sections - to reflect the object merging within the sections. */ - -static boolean -elf_link_sec_merge_syms (h, data) - struct elf_link_hash_entry *h; - PTR data; -{ - asection *sec; - - if ((h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - && ((sec = h->root.u.def.section)->flags & SEC_MERGE) - && elf_section_data (sec)->merge_info) - { - bfd *output_bfd = (bfd *) data; - - h->root.u.def.value = - _bfd_merged_section_offset (output_bfd, - &h->root.u.def.section, - elf_section_data (sec)->merge_info, - h->root.u.def.value, (bfd_vma) 0); - } - - return true; -} - -/* Add an external symbol to the symbol table. This is called from - the hash table traversal routine. When generating a shared object, - we go through the symbol table twice. The first time we output - anything that might have been forced to local scope in a version - script. The second time we output the symbols that are still - global symbols. */ - -static boolean -elf_link_output_extsym (h, data) - struct elf_link_hash_entry *h; - PTR data; -{ - struct elf_outext_info *eoinfo = (struct elf_outext_info *) data; - struct elf_final_link_info *finfo = eoinfo->finfo; - boolean strip; - Elf_Internal_Sym sym; - asection *input_sec; - - /* Decide whether to output this symbol in this pass. */ - if (eoinfo->localsyms) - { - if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) - return true; - } - else - { - if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) - return true; - } - - /* If we are not creating a shared library, and this symbol is - referenced by a shared library but is not defined anywhere, then - warn that it is undefined. If we do not do this, the runtime - linker will complain that the symbol is undefined when the - program is run. We don't have to worry about symbols that are - referenced by regular files, because we will already have issued - warnings for them. */ - if (! finfo->info->relocateable - && ! finfo->info->allow_shlib_undefined - && ! finfo->info->shared - && h->root.type == bfd_link_hash_undefined - && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0) - { - /* If elf_dt_soname (h->root.u.undef.abfd) != NULL, that means - this DSO is loaded in via a DT_NEEDED entry. In this case, - we do some extra check to see if there is a suitable - definition. */ - boolean def; - - if (elf_dt_soname (h->root.u.undef.abfd) != NULL) - def = elf_link_check_versioned_symbol (finfo->info, h); - else - def = false; - - if (!def - && ! ((*finfo->info->callbacks->undefined_symbol) - (finfo->info, h->root.root.string, - h->root.u.undef.abfd, (asection *) NULL, - 0, true))) - { - eoinfo->failed = true; - return false; - } - } - - /* We don't want to output symbols that have never been mentioned by - a regular file, or that we have been told to strip. However, if - h->indx is set to -2, the symbol is used by a reloc and we must - output it. */ - if (h->indx == -2) - strip = false; - else if (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - || (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0) - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0) - strip = true; - else if (finfo->info->strip == strip_all - || (finfo->info->strip == strip_some - && bfd_hash_lookup (finfo->info->keep_hash, - h->root.root.string, - false, false) == NULL)) - strip = true; - else - strip = false; - - /* If we're stripping it, and it's not a dynamic symbol, there's - nothing else to do unless it is a forced local symbol. */ - if (strip - && h->dynindx == -1 - && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) - return true; - - sym.st_value = 0; - sym.st_size = h->size; - sym.st_other = h->other; - if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) - sym.st_info = ELF_ST_INFO (STB_LOCAL, h->type); - else if (h->root.type == bfd_link_hash_undefweak - || h->root.type == bfd_link_hash_defweak) - sym.st_info = ELF_ST_INFO (STB_WEAK, h->type); - else - sym.st_info = ELF_ST_INFO (STB_GLOBAL, h->type); - - switch (h->root.type) - { - default: - case bfd_link_hash_new: - abort (); - return false; - - case bfd_link_hash_undefined: - input_sec = bfd_und_section_ptr; - sym.st_shndx = SHN_UNDEF; - break; - - case bfd_link_hash_undefweak: - input_sec = bfd_und_section_ptr; - sym.st_shndx = SHN_UNDEF; - break; - - case bfd_link_hash_defined: - case bfd_link_hash_defweak: - { - input_sec = h->root.u.def.section; - if (input_sec->output_section != NULL) - { - sym.st_shndx = - _bfd_elf_section_from_bfd_section (finfo->output_bfd, - input_sec->output_section); - if (sym.st_shndx == (unsigned short) -1) - { - (*_bfd_error_handler) - (_("%s: could not find output section %s for input section %s"), - bfd_get_filename (finfo->output_bfd), - input_sec->output_section->name, - input_sec->name); - eoinfo->failed = true; - return false; - } - - /* ELF symbols in relocateable files are section relative, - but in nonrelocateable files they are virtual - addresses. */ - sym.st_value = h->root.u.def.value + input_sec->output_offset; - if (! finfo->info->relocateable) - sym.st_value += input_sec->output_section->vma; - } - else - { - BFD_ASSERT (input_sec->owner == NULL - || (input_sec->owner->flags & DYNAMIC) != 0); - sym.st_shndx = SHN_UNDEF; - input_sec = bfd_und_section_ptr; - } - } - break; - - case bfd_link_hash_common: - input_sec = h->root.u.c.p->section; - sym.st_shndx = SHN_COMMON; - sym.st_value = 1 << h->root.u.c.p->alignment_power; - break; - - case bfd_link_hash_indirect: - /* These symbols are created by symbol versioning. They point - to the decorated version of the name. For example, if the - symbol foo@@GNU_1.2 is the default, which should be used when - foo is used with no version, then we add an indirect symbol - foo which points to foo@@GNU_1.2. We ignore these symbols, - since the indirected symbol is already in the hash table. */ - return true; - - case bfd_link_hash_warning: - /* We can't represent these symbols in ELF, although a warning - symbol may have come from a .gnu.warning.SYMBOL section. We - just put the target symbol in the hash table. If the target - symbol does not really exist, don't do anything. */ - if (h->root.u.i.link->type == bfd_link_hash_new) - return true; - return (elf_link_output_extsym - ((struct elf_link_hash_entry *) h->root.u.i.link, data)); - } - - /* Give the processor backend a chance to tweak the symbol value, - and also to finish up anything that needs to be done for this - symbol. */ - if ((h->dynindx != -1 - || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) - && elf_hash_table (finfo->info)->dynamic_sections_created) - { - struct elf_backend_data *bed; - - bed = get_elf_backend_data (finfo->output_bfd); - if (! ((*bed->elf_backend_finish_dynamic_symbol) - (finfo->output_bfd, finfo->info, h, &sym))) - { - eoinfo->failed = true; - return false; - } - } - - /* If we are marking the symbol as undefined, and there are no - non-weak references to this symbol from a regular object, then - mark the symbol as weak undefined; if there are non-weak - references, mark the symbol as strong. We can't do this earlier, - because it might not be marked as undefined until the - finish_dynamic_symbol routine gets through with it. */ - if (sym.st_shndx == SHN_UNDEF - && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) != 0 - && (ELF_ST_BIND (sym.st_info) == STB_GLOBAL - || ELF_ST_BIND (sym.st_info) == STB_WEAK)) - { - int bindtype; - - if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR_NONWEAK) != 0) - bindtype = STB_GLOBAL; - else - bindtype = STB_WEAK; - sym.st_info = ELF_ST_INFO (bindtype, ELF_ST_TYPE (sym.st_info)); - } - - /* If a symbol is not defined locally, we clear the visibility - field. */ - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - sym.st_other ^= ELF_ST_VISIBILITY (sym.st_other); - - /* If this symbol should be put in the .dynsym section, then put it - there now. We have already know the symbol index. We also fill - in the entry in the .hash section. */ - if (h->dynindx != -1 - && elf_hash_table (finfo->info)->dynamic_sections_created) - { - size_t bucketcount; - size_t bucket; - size_t hash_entry_size; - bfd_byte *bucketpos; - bfd_vma chain; - - sym.st_name = h->dynstr_index; - - elf_swap_symbol_out (finfo->output_bfd, &sym, - (PTR) (((Elf_External_Sym *) - finfo->dynsym_sec->contents) - + h->dynindx)); - - bucketcount = elf_hash_table (finfo->info)->bucketcount; - bucket = h->elf_hash_value % bucketcount; - hash_entry_size - = elf_section_data (finfo->hash_sec)->this_hdr.sh_entsize; - bucketpos = ((bfd_byte *) finfo->hash_sec->contents - + (bucket + 2) * hash_entry_size); - chain = bfd_get (8 * hash_entry_size, finfo->output_bfd, bucketpos); - bfd_put (8 * hash_entry_size, finfo->output_bfd, h->dynindx, bucketpos); - bfd_put (8 * hash_entry_size, finfo->output_bfd, chain, - ((bfd_byte *) finfo->hash_sec->contents - + (bucketcount + 2 + h->dynindx) * hash_entry_size)); - - if (finfo->symver_sec != NULL && finfo->symver_sec->contents != NULL) - { - Elf_Internal_Versym iversym; - - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - { - if (h->verinfo.verdef == NULL) - iversym.vs_vers = 0; - else - iversym.vs_vers = h->verinfo.verdef->vd_exp_refno + 1; - } - else - { - if (h->verinfo.vertree == NULL) - iversym.vs_vers = 1; - else - iversym.vs_vers = h->verinfo.vertree->vernum + 1; - } - - if ((h->elf_link_hash_flags & ELF_LINK_HIDDEN) != 0) - iversym.vs_vers |= VERSYM_HIDDEN; - - _bfd_elf_swap_versym_out (finfo->output_bfd, &iversym, - (((Elf_External_Versym *) - finfo->symver_sec->contents) - + h->dynindx)); - } - } - - /* If we're stripping it, then it was just a dynamic symbol, and - there's nothing else to do. */ - if (strip) - return true; - - h->indx = bfd_get_symcount (finfo->output_bfd); - - if (! elf_link_output_sym (finfo, h->root.root.string, &sym, input_sec)) - { - eoinfo->failed = true; - return false; - } - - return true; -} - -/* Copy the relocations indicated by the INTERNAL_RELOCS (which - originated from the section given by INPUT_REL_HDR) to the - OUTPUT_BFD. */ - -static void -elf_link_output_relocs (output_bfd, input_section, input_rel_hdr, - internal_relocs) - bfd *output_bfd; - asection *input_section; - Elf_Internal_Shdr *input_rel_hdr; - Elf_Internal_Rela *internal_relocs; -{ - Elf_Internal_Rela *irela; - Elf_Internal_Rela *irelaend; - Elf_Internal_Shdr *output_rel_hdr; - asection *output_section; - unsigned int *rel_countp = NULL; - struct elf_backend_data *bed; - - output_section = input_section->output_section; - output_rel_hdr = NULL; - - if (elf_section_data (output_section)->rel_hdr.sh_entsize - == input_rel_hdr->sh_entsize) - { - output_rel_hdr = &elf_section_data (output_section)->rel_hdr; - rel_countp = &elf_section_data (output_section)->rel_count; - } - else if (elf_section_data (output_section)->rel_hdr2 - && (elf_section_data (output_section)->rel_hdr2->sh_entsize - == input_rel_hdr->sh_entsize)) - { - output_rel_hdr = elf_section_data (output_section)->rel_hdr2; - rel_countp = &elf_section_data (output_section)->rel_count2; - } - - BFD_ASSERT (output_rel_hdr != NULL); - - bed = get_elf_backend_data (output_bfd); - irela = internal_relocs; - irelaend = irela + NUM_SHDR_ENTRIES (input_rel_hdr) - * bed->s->int_rels_per_ext_rel; - - if (input_rel_hdr->sh_entsize == sizeof (Elf_External_Rel)) - { - Elf_External_Rel *erel; - Elf_Internal_Rel *irel; - - irel = (Elf_Internal_Rel *) bfd_zmalloc (bed->s->int_rels_per_ext_rel - * sizeof (Elf_Internal_Rel)); - if (irel == NULL) - { - (*_bfd_error_handler) (_("Error: out of memory")); - abort (); - } - - erel = ((Elf_External_Rel *) output_rel_hdr->contents + *rel_countp); - for (; irela < irelaend; irela += bed->s->int_rels_per_ext_rel, erel++) - { - unsigned int i; - - for (i = 0; i < bed->s->int_rels_per_ext_rel; i++) - { - irel[i].r_offset = irela[i].r_offset; - irel[i].r_info = irela[i].r_info; - BFD_ASSERT (irela[i].r_addend == 0); - } - - if (bed->s->swap_reloc_out) - (*bed->s->swap_reloc_out) (output_bfd, irel, (PTR) erel); - else - elf_swap_reloc_out (output_bfd, irel, erel); - } - - free (irel); - } - else - { - Elf_External_Rela *erela; - - BFD_ASSERT (input_rel_hdr->sh_entsize == sizeof (Elf_External_Rela)); - - erela = ((Elf_External_Rela *) output_rel_hdr->contents + *rel_countp); - for (; irela < irelaend; irela += bed->s->int_rels_per_ext_rel, erela++) - if (bed->s->swap_reloca_out) - (*bed->s->swap_reloca_out) (output_bfd, irela, (PTR) erela); - else - elf_swap_reloca_out (output_bfd, irela, erela); - } - - /* Bump the counter, so that we know where to add the next set of - relocations. */ - *rel_countp += NUM_SHDR_ENTRIES (input_rel_hdr); -} - -/* Link an input file into the linker output file. This function - handles all the sections and relocations of the input file at once. - This is so that we only have to read the local symbols once, and - don't have to keep them in memory. */ - -static boolean -elf_link_input_bfd (finfo, input_bfd) - struct elf_final_link_info *finfo; - bfd *input_bfd; -{ - boolean (*relocate_section) PARAMS ((bfd *, struct bfd_link_info *, - bfd *, asection *, bfd_byte *, - Elf_Internal_Rela *, - Elf_Internal_Sym *, asection **)); - bfd *output_bfd; - Elf_Internal_Shdr *symtab_hdr; - size_t locsymcount; - size_t extsymoff; - Elf_External_Sym *external_syms; - Elf_External_Sym *esym; - Elf_External_Sym *esymend; - Elf_Internal_Sym *isym; - long *pindex; - asection **ppsection; - asection *o; - struct elf_backend_data *bed; - boolean emit_relocs; - - output_bfd = finfo->output_bfd; - bed = get_elf_backend_data (output_bfd); - relocate_section = bed->elf_backend_relocate_section; - - /* If this is a dynamic object, we don't want to do anything here: - we don't want the local symbols, and we don't want the section - contents. */ - if ((input_bfd->flags & DYNAMIC) != 0) - return true; - - emit_relocs = (finfo->info->relocateable - || finfo->info->emitrelocations - || bed->elf_backend_emit_relocs); - - symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; - if (elf_bad_symtab (input_bfd)) - { - locsymcount = symtab_hdr->sh_size / sizeof (Elf_External_Sym); - extsymoff = 0; - } - else - { - locsymcount = symtab_hdr->sh_info; - extsymoff = symtab_hdr->sh_info; - } - - /* Read the local symbols. */ - if (symtab_hdr->contents != NULL) - external_syms = (Elf_External_Sym *) symtab_hdr->contents; - else if (locsymcount == 0) - external_syms = NULL; - else - { - external_syms = finfo->external_syms; - if (bfd_seek (input_bfd, symtab_hdr->sh_offset, SEEK_SET) != 0 - || (bfd_read (external_syms, sizeof (Elf_External_Sym), - locsymcount, input_bfd) - != locsymcount * sizeof (Elf_External_Sym))) - return false; - } - - /* Swap in the local symbols and write out the ones which we know - are going into the output file. */ - esym = external_syms; - esymend = esym + locsymcount; - isym = finfo->internal_syms; - pindex = finfo->indices; - ppsection = finfo->sections; - for (; esym < esymend; esym++, isym++, pindex++, ppsection++) - { - asection *isec; - const char *name; - Elf_Internal_Sym osym; - - elf_swap_symbol_in (input_bfd, esym, isym); - *pindex = -1; - - if (elf_bad_symtab (input_bfd)) - { - if (ELF_ST_BIND (isym->st_info) != STB_LOCAL) - { - *ppsection = NULL; - continue; - } - } - - name = NULL; - if (isym->st_shndx == SHN_UNDEF) - { - isec = bfd_und_section_ptr; - name = isec->name; - } - else if (isym->st_shndx > 0 && isym->st_shndx < SHN_LORESERVE) - { - isec = section_from_elf_index (input_bfd, isym->st_shndx); - if (isec && elf_section_data (isec)->merge_info - && ELF_ST_TYPE (isym->st_info) != STT_SECTION) - isym->st_value = - _bfd_merged_section_offset (output_bfd, &isec, - elf_section_data (isec)->merge_info, - isym->st_value, (bfd_vma) 0); - } - else if (isym->st_shndx == SHN_ABS) - { - isec = bfd_abs_section_ptr; - name = isec->name; - } - else if (isym->st_shndx == SHN_COMMON) - { - isec = bfd_com_section_ptr; - name = isec->name; - } - else - { - /* Who knows? */ - isec = NULL; - } - - *ppsection = isec; - - /* Don't output the first, undefined, symbol. */ - if (esym == external_syms) - continue; - - if (ELF_ST_TYPE (isym->st_info) == STT_SECTION) - { - asection *ksec; - - /* Save away all section symbol values. */ - if (isec != NULL) - { - if (name) - { - if (isec->symbol->value != isym->st_value) - (*_bfd_error_handler) - (_("%s: invalid section symbol index 0x%x (%s) ingored"), - bfd_get_filename (input_bfd), isym->st_shndx, - name); - continue; - } - isec->symbol->value = isym->st_value; - } - - /* If this is a discarded link-once section symbol, update - it's value to that of the kept section symbol. The - linker will keep the first of any matching link-once - sections, so we should have already seen it's section - symbol. I trust no-one will have the bright idea of - re-ordering the bfd list... */ - if (isec != NULL - && (bfd_get_section_flags (input_bfd, isec) & SEC_LINK_ONCE) != 0 - && (ksec = isec->kept_section) != NULL) - { - isym->st_value = ksec->symbol->value; - - /* That put the value right, but the section info is all - wrong. I hope this works. */ - isec->output_offset = ksec->output_offset; - isec->output_section = ksec->output_section; - } - - /* We never output section symbols. Instead, we use the - section symbol of the corresponding section in the output - file. */ - continue; - } - - /* If we are stripping all symbols, we don't want to output this - one. */ - if (finfo->info->strip == strip_all) - continue; - - /* If we are discarding all local symbols, we don't want to - output this one. If we are generating a relocateable output - file, then some of the local symbols may be required by - relocs; we output them below as we discover that they are - needed. */ - if (finfo->info->discard == discard_all) - continue; - - /* If this symbol is defined in a section which we are - discarding, we don't need to keep it, but note that - linker_mark is only reliable for sections that have contents. - For the benefit of the MIPS ELF linker, we check SEC_EXCLUDE - as well as linker_mark. */ - if (isym->st_shndx > 0 - && isym->st_shndx < SHN_LORESERVE - && isec != NULL - && ((! isec->linker_mark && (isec->flags & SEC_HAS_CONTENTS) != 0) - || (! finfo->info->relocateable - && (isec->flags & SEC_EXCLUDE) != 0))) - continue; - - /* Get the name of the symbol. */ - name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, - isym->st_name); - if (name == NULL) - return false; - - /* See if we are discarding symbols with this name. */ - if ((finfo->info->strip == strip_some - && (bfd_hash_lookup (finfo->info->keep_hash, name, false, false) - == NULL)) - || (((finfo->info->discard == discard_sec_merge - && (isec->flags & SEC_MERGE) && ! finfo->info->relocateable) - || finfo->info->discard == discard_l) - && bfd_is_local_label_name (input_bfd, name))) - continue; - - /* If we get here, we are going to output this symbol. */ - - osym = *isym; - - /* Adjust the section index for the output file. */ - osym.st_shndx = _bfd_elf_section_from_bfd_section (output_bfd, - isec->output_section); - if (osym.st_shndx == (unsigned short) -1) - return false; - - *pindex = bfd_get_symcount (output_bfd); - - /* ELF symbols in relocateable files are section relative, but - in executable files they are virtual addresses. Note that - this code assumes that all ELF sections have an associated - BFD section with a reasonable value for output_offset; below - we assume that they also have a reasonable value for - output_section. Any special sections must be set up to meet - these requirements. */ - osym.st_value += isec->output_offset; - if (! finfo->info->relocateable) - osym.st_value += isec->output_section->vma; - - if (! elf_link_output_sym (finfo, name, &osym, isec)) - return false; - } - - /* Relocate the contents of each section. */ - for (o = input_bfd->sections; o != NULL; o = o->next) - { - bfd_byte *contents; - - if (! o->linker_mark) - { - /* This section was omitted from the link. */ - continue; - } - - if ((o->flags & SEC_HAS_CONTENTS) == 0 - || (o->_raw_size == 0 && (o->flags & SEC_RELOC) == 0)) - continue; - - if ((o->flags & SEC_LINKER_CREATED) != 0) - { - /* Section was created by elf_link_create_dynamic_sections - or somesuch. */ - continue; - } - - /* Get the contents of the section. They have been cached by a - relaxation routine. Note that o is a section in an input - file, so the contents field will not have been set by any of - the routines which work on output files. */ - if (elf_section_data (o)->this_hdr.contents != NULL) - contents = elf_section_data (o)->this_hdr.contents; - else - { - contents = finfo->contents; - if (! bfd_get_section_contents (input_bfd, o, contents, - (file_ptr) 0, o->_raw_size)) - return false; - } - - if ((o->flags & SEC_RELOC) != 0) - { - Elf_Internal_Rela *internal_relocs; - - /* Get the swapped relocs. */ - internal_relocs = (NAME(_bfd_elf,link_read_relocs) - (input_bfd, o, finfo->external_relocs, - finfo->internal_relocs, false)); - if (internal_relocs == NULL - && o->reloc_count > 0) - return false; - - /* Relocate the section by invoking a back end routine. - - The back end routine is responsible for adjusting the - section contents as necessary, and (if using Rela relocs - and generating a relocateable output file) adjusting the - reloc addend as necessary. - - The back end routine does not have to worry about setting - the reloc address or the reloc symbol index. - - The back end routine is given a pointer to the swapped in - internal symbols, and can access the hash table entries - for the external symbols via elf_sym_hashes (input_bfd). - - When generating relocateable output, the back end routine - must handle STB_LOCAL/STT_SECTION symbols specially. The - output symbol is going to be a section symbol - corresponding to the output section, which will require - the addend to be adjusted. */ - - if (! (*relocate_section) (output_bfd, finfo->info, - input_bfd, o, contents, - internal_relocs, - finfo->internal_syms, - finfo->sections)) - return false; - - if (emit_relocs) - { - Elf_Internal_Rela *irela; - Elf_Internal_Rela *irelaend; - struct elf_link_hash_entry **rel_hash; - Elf_Internal_Shdr *input_rel_hdr; - unsigned int next_erel; - void (* reloc_emitter) PARAMS ((bfd *, asection *, - Elf_Internal_Shdr *, - Elf_Internal_Rela *)); - - /* Adjust the reloc addresses and symbol indices. */ - - irela = internal_relocs; - irelaend = irela - + o->reloc_count * bed->s->int_rels_per_ext_rel; - rel_hash = (elf_section_data (o->output_section)->rel_hashes - + elf_section_data (o->output_section)->rel_count - + elf_section_data (o->output_section)->rel_count2); - for (next_erel = 0; irela < irelaend; irela++, next_erel++) - { - unsigned long r_symndx; - Elf_Internal_Sym *isym; - asection *sec; - - if (next_erel == bed->s->int_rels_per_ext_rel) - { - rel_hash++; - next_erel = 0; - } - - irela->r_offset += o->output_offset; - - /* Relocs in an executable have to be virtual addresses. */ - if (finfo->info->emitrelocations) - irela->r_offset += o->output_section->vma; - - r_symndx = ELF_R_SYM (irela->r_info); - - if (r_symndx == 0) - continue; - - if (r_symndx >= locsymcount - || (elf_bad_symtab (input_bfd) - && finfo->sections[r_symndx] == NULL)) - { - struct elf_link_hash_entry *rh; - unsigned long indx; - - /* This is a reloc against a global symbol. We - have not yet output all the local symbols, so - we do not know the symbol index of any global - symbol. We set the rel_hash entry for this - reloc to point to the global hash table entry - for this symbol. The symbol index is then - set at the end of elf_bfd_final_link. */ - indx = r_symndx - extsymoff; - rh = elf_sym_hashes (input_bfd)[indx]; - while (rh->root.type == bfd_link_hash_indirect - || rh->root.type == bfd_link_hash_warning) - rh = (struct elf_link_hash_entry *) rh->root.u.i.link; - - /* Setting the index to -2 tells - elf_link_output_extsym that this symbol is - used by a reloc. */ - BFD_ASSERT (rh->indx < 0); - rh->indx = -2; - - *rel_hash = rh; - - continue; - } - - /* This is a reloc against a local symbol. */ - - *rel_hash = NULL; - isym = finfo->internal_syms + r_symndx; - sec = finfo->sections[r_symndx]; - if (ELF_ST_TYPE (isym->st_info) == STT_SECTION) - { - /* I suppose the backend ought to fill in the - section of any STT_SECTION symbol against a - processor specific section. If we have - discarded a section, the output_section will - be the absolute section. */ - if (sec != NULL - && (bfd_is_abs_section (sec) - || (sec->output_section != NULL - && bfd_is_abs_section (sec->output_section)))) - r_symndx = 0; - else if (sec == NULL || sec->owner == NULL) - { - bfd_set_error (bfd_error_bad_value); - return false; - } - else - { - r_symndx = sec->output_section->target_index; - BFD_ASSERT (r_symndx != 0); - } - } - else - { - if (finfo->indices[r_symndx] == -1) - { - unsigned long link; - const char *name; - asection *osec; - - if (finfo->info->strip == strip_all) - { - /* You can't do ld -r -s. */ - bfd_set_error (bfd_error_invalid_operation); - return false; - } - - /* This symbol was skipped earlier, but - since it is needed by a reloc, we - must output it now. */ - link = symtab_hdr->sh_link; - name = (bfd_elf_string_from_elf_section - (input_bfd, link, isym->st_name)); - if (name == NULL) - return false; - - osec = sec->output_section; - isym->st_shndx = - _bfd_elf_section_from_bfd_section (output_bfd, - osec); - if (isym->st_shndx == (unsigned short) -1) - return false; - - isym->st_value += sec->output_offset; - if (! finfo->info->relocateable) - isym->st_value += osec->vma; - - finfo->indices[r_symndx] - = bfd_get_symcount (output_bfd); - - if (! elf_link_output_sym (finfo, name, isym, sec)) - return false; - } - - r_symndx = finfo->indices[r_symndx]; - } - - irela->r_info = ELF_R_INFO (r_symndx, - ELF_R_TYPE (irela->r_info)); - } - - /* Swap out the relocs. */ - if (bed->elf_backend_emit_relocs - && !(finfo->info->relocateable - || finfo->info->emitrelocations)) - reloc_emitter = bed->elf_backend_emit_relocs; - else - reloc_emitter = elf_link_output_relocs; - - input_rel_hdr = &elf_section_data (o)->rel_hdr; - (*reloc_emitter) (output_bfd, o, input_rel_hdr, internal_relocs); - - input_rel_hdr = elf_section_data (o)->rel_hdr2; - if (input_rel_hdr) - { - internal_relocs += NUM_SHDR_ENTRIES (input_rel_hdr) - * bed->s->int_rels_per_ext_rel; - reloc_emitter (output_bfd, o, input_rel_hdr, internal_relocs); - } - - } - } - - /* Write out the modified section contents. */ - if (elf_section_data (o)->stab_info) - { - if (! (_bfd_write_section_stabs - (output_bfd, &elf_hash_table (finfo->info)->stab_info, - o, &elf_section_data (o)->stab_info, contents))) - return false; - } - else if (elf_section_data (o)->merge_info) - { - if (! (_bfd_write_merged_section - (output_bfd, o, elf_section_data (o)->merge_info))) - return false; - } - else - { - if (! (o->flags & SEC_EXCLUDE) && - ! bfd_set_section_contents (output_bfd, o->output_section, - contents, o->output_offset, - (o->_cooked_size != 0 - ? o->_cooked_size - : o->_raw_size))) - return false; - } - } - - return true; -} - -/* Generate a reloc when linking an ELF file. This is a reloc - requested by the linker, and does come from any input file. This - is used to build constructor and destructor tables when linking - with -Ur. */ - -static boolean -elf_reloc_link_order (output_bfd, info, output_section, link_order) - bfd *output_bfd; - struct bfd_link_info *info; - asection *output_section; - struct bfd_link_order *link_order; -{ - reloc_howto_type *howto; - long indx; - bfd_vma offset; - bfd_vma addend; - struct elf_link_hash_entry **rel_hash_ptr; - Elf_Internal_Shdr *rel_hdr; - struct elf_backend_data *bed = get_elf_backend_data (output_bfd); - - howto = bfd_reloc_type_lookup (output_bfd, link_order->u.reloc.p->reloc); - if (howto == NULL) - { - bfd_set_error (bfd_error_bad_value); - return false; - } - - addend = link_order->u.reloc.p->addend; - - /* Figure out the symbol index. */ - rel_hash_ptr = (elf_section_data (output_section)->rel_hashes - + elf_section_data (output_section)->rel_count - + elf_section_data (output_section)->rel_count2); - if (link_order->type == bfd_section_reloc_link_order) - { - indx = link_order->u.reloc.p->u.section->target_index; - BFD_ASSERT (indx != 0); - *rel_hash_ptr = NULL; - } - else - { - struct elf_link_hash_entry *h; - - /* Treat a reloc against a defined symbol as though it were - actually against the section. */ - h = ((struct elf_link_hash_entry *) - bfd_wrapped_link_hash_lookup (output_bfd, info, - link_order->u.reloc.p->u.name, - false, false, true)); - if (h != NULL - && (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak)) - { - asection *section; - - section = h->root.u.def.section; - indx = section->output_section->target_index; - *rel_hash_ptr = NULL; - /* It seems that we ought to add the symbol value to the - addend here, but in practice it has already been added - because it was passed to constructor_callback. */ - addend += section->output_section->vma + section->output_offset; - } - else if (h != NULL) - { - /* Setting the index to -2 tells elf_link_output_extsym that - this symbol is used by a reloc. */ - h->indx = -2; - *rel_hash_ptr = h; - indx = 0; - } - else - { - if (! ((*info->callbacks->unattached_reloc) - (info, link_order->u.reloc.p->u.name, (bfd *) NULL, - (asection *) NULL, (bfd_vma) 0))) - return false; - indx = 0; - } - } - - /* If this is an inplace reloc, we must write the addend into the - object file. */ - if (howto->partial_inplace && addend != 0) - { - bfd_size_type size; - bfd_reloc_status_type rstat; - bfd_byte *buf; - boolean ok; - - size = bfd_get_reloc_size (howto); - buf = (bfd_byte *) bfd_zmalloc (size); - if (buf == (bfd_byte *) NULL) - return false; - rstat = _bfd_relocate_contents (howto, output_bfd, addend, buf); - switch (rstat) - { - case bfd_reloc_ok: - break; - default: - case bfd_reloc_outofrange: - abort (); - case bfd_reloc_overflow: - if (! ((*info->callbacks->reloc_overflow) - (info, - (link_order->type == bfd_section_reloc_link_order - ? bfd_section_name (output_bfd, - link_order->u.reloc.p->u.section) - : link_order->u.reloc.p->u.name), - howto->name, addend, (bfd *) NULL, (asection *) NULL, - (bfd_vma) 0))) - { - free (buf); - return false; - } - break; - } - ok = bfd_set_section_contents (output_bfd, output_section, (PTR) buf, - (file_ptr) link_order->offset, size); - free (buf); - if (! ok) - return false; - } - - /* The address of a reloc is relative to the section in a - relocateable file, and is a virtual address in an executable - file. */ - offset = link_order->offset; - if (! info->relocateable) - offset += output_section->vma; - - rel_hdr = &elf_section_data (output_section)->rel_hdr; - - if (rel_hdr->sh_type == SHT_REL) - { - Elf_Internal_Rel *irel; - Elf_External_Rel *erel; - unsigned int i; - - irel = (Elf_Internal_Rel *) bfd_zmalloc (bed->s->int_rels_per_ext_rel - * sizeof (Elf_Internal_Rel)); - if (irel == NULL) - return false; - - for (i = 0; i < bed->s->int_rels_per_ext_rel; i++) - irel[i].r_offset = offset; - irel[0].r_info = ELF_R_INFO (indx, howto->type); - - erel = ((Elf_External_Rel *) rel_hdr->contents - + elf_section_data (output_section)->rel_count); - - if (bed->s->swap_reloc_out) - (*bed->s->swap_reloc_out) (output_bfd, irel, (bfd_byte *) erel); - else - elf_swap_reloc_out (output_bfd, irel, erel); - - free (irel); - } - else - { - Elf_Internal_Rela *irela; - Elf_External_Rela *erela; - unsigned int i; - - irela = (Elf_Internal_Rela *) bfd_zmalloc (bed->s->int_rels_per_ext_rel - * sizeof (Elf_Internal_Rela)); - if (irela == NULL) - return false; - - for (i = 0; i < bed->s->int_rels_per_ext_rel; i++) - irela[i].r_offset = offset; - irela[0].r_info = ELF_R_INFO (indx, howto->type); - irela[0].r_addend = addend; - - erela = ((Elf_External_Rela *) rel_hdr->contents - + elf_section_data (output_section)->rel_count); - - if (bed->s->swap_reloca_out) - (*bed->s->swap_reloca_out) (output_bfd, irela, (bfd_byte *) erela); - else - elf_swap_reloca_out (output_bfd, irela, erela); - } - - ++elf_section_data (output_section)->rel_count; - - return true; -} - -/* Allocate a pointer to live in a linker created section. */ - -boolean -elf_create_pointer_linker_section (abfd, info, lsect, h, rel) - bfd *abfd; - struct bfd_link_info *info; - elf_linker_section_t *lsect; - struct elf_link_hash_entry *h; - const Elf_Internal_Rela *rel; -{ - elf_linker_section_pointers_t **ptr_linker_section_ptr = NULL; - elf_linker_section_pointers_t *linker_section_ptr; - unsigned long r_symndx = ELF_R_SYM (rel->r_info);; - - BFD_ASSERT (lsect != NULL); - - /* Is this a global symbol? */ - if (h != NULL) - { - /* Has this symbol already been allocated? If so, our work is done. */ - if (_bfd_elf_find_pointer_linker_section (h->linker_section_pointer, - rel->r_addend, - lsect->which)) - return true; - - ptr_linker_section_ptr = &h->linker_section_pointer; - /* Make sure this symbol is output as a dynamic symbol. */ - if (h->dynindx == -1) - { - if (! elf_link_record_dynamic_symbol (info, h)) - return false; - } - - if (lsect->rel_section) - lsect->rel_section->_raw_size += sizeof (Elf_External_Rela); - } - else - { - /* Allocation of a pointer to a local symbol. */ - elf_linker_section_pointers_t **ptr = elf_local_ptr_offsets (abfd); - - /* Allocate a table to hold the local symbols if first time. */ - if (!ptr) - { - unsigned int num_symbols = elf_tdata (abfd)->symtab_hdr.sh_info; - register unsigned int i; - - ptr = (elf_linker_section_pointers_t **) - bfd_alloc (abfd, - num_symbols * sizeof (elf_linker_section_pointers_t *)); - - if (!ptr) - return false; - - elf_local_ptr_offsets (abfd) = ptr; - for (i = 0; i < num_symbols; i++) - ptr[i] = (elf_linker_section_pointers_t *) 0; - } - - /* Has this symbol already been allocated? If so, our work is done. */ - if (_bfd_elf_find_pointer_linker_section (ptr[r_symndx], - rel->r_addend, - lsect->which)) - return true; - - ptr_linker_section_ptr = &ptr[r_symndx]; - - if (info->shared) - { - /* If we are generating a shared object, we need to - output a R__RELATIVE reloc so that the - dynamic linker can adjust this GOT entry. */ - BFD_ASSERT (lsect->rel_section != NULL); - lsect->rel_section->_raw_size += sizeof (Elf_External_Rela); - } - } - - /* Allocate space for a pointer in the linker section, and allocate - a new pointer record from internal memory. */ - BFD_ASSERT (ptr_linker_section_ptr != NULL); - linker_section_ptr = (elf_linker_section_pointers_t *) - bfd_alloc (abfd, sizeof (elf_linker_section_pointers_t)); - - if (!linker_section_ptr) - return false; - - linker_section_ptr->next = *ptr_linker_section_ptr; - linker_section_ptr->addend = rel->r_addend; - linker_section_ptr->which = lsect->which; - linker_section_ptr->written_address_p = false; - *ptr_linker_section_ptr = linker_section_ptr; - -#if 0 - if (lsect->hole_size && lsect->hole_offset < lsect->max_hole_offset) - { - linker_section_ptr->offset = (lsect->section->_raw_size - - lsect->hole_size + (ARCH_SIZE / 8)); - lsect->hole_offset += ARCH_SIZE / 8; - lsect->sym_offset += ARCH_SIZE / 8; - if (lsect->sym_hash) - { - /* Bump up symbol value if needed. */ - lsect->sym_hash->root.u.def.value += ARCH_SIZE / 8; -#ifdef DEBUG - fprintf (stderr, "Bump up %s by %ld, current value = %ld\n", - lsect->sym_hash->root.root.string, - (long) ARCH_SIZE / 8, - (long) lsect->sym_hash->root.u.def.value); -#endif - } - } - else -#endif - linker_section_ptr->offset = lsect->section->_raw_size; - - lsect->section->_raw_size += ARCH_SIZE / 8; - -#ifdef DEBUG - fprintf (stderr, - "Create pointer in linker section %s, offset = %ld, section size = %ld\n", - lsect->name, (long) linker_section_ptr->offset, - (long) lsect->section->_raw_size); -#endif - - return true; -} - -#if ARCH_SIZE==64 -#define bfd_put_ptr(BFD,VAL,ADDR) bfd_put_64 (BFD, VAL, ADDR) -#endif -#if ARCH_SIZE==32 -#define bfd_put_ptr(BFD,VAL,ADDR) bfd_put_32 (BFD, VAL, ADDR) -#endif - -/* Fill in the address for a pointer generated in a linker section. */ - -bfd_vma -elf_finish_pointer_linker_section (output_bfd, input_bfd, info, lsect, h, - relocation, rel, relative_reloc) - bfd *output_bfd; - bfd *input_bfd; - struct bfd_link_info *info; - elf_linker_section_t *lsect; - struct elf_link_hash_entry *h; - bfd_vma relocation; - const Elf_Internal_Rela *rel; - int relative_reloc; -{ - elf_linker_section_pointers_t *linker_section_ptr; - - BFD_ASSERT (lsect != NULL); - - if (h != NULL) - { - /* Handle global symbol. */ - linker_section_ptr = (_bfd_elf_find_pointer_linker_section - (h->linker_section_pointer, - rel->r_addend, - lsect->which)); - - BFD_ASSERT (linker_section_ptr != NULL); - - if (! elf_hash_table (info)->dynamic_sections_created - || (info->shared - && info->symbolic - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) - { - /* This is actually a static link, or it is a - -Bsymbolic link and the symbol is defined - locally. We must initialize this entry in the - global section. - - When doing a dynamic link, we create a .rela. - relocation entry to initialize the value. This - is done in the finish_dynamic_symbol routine. */ - if (!linker_section_ptr->written_address_p) - { - linker_section_ptr->written_address_p = true; - bfd_put_ptr (output_bfd, - relocation + linker_section_ptr->addend, - (lsect->section->contents - + linker_section_ptr->offset)); - } - } - } - else - { - /* Handle local symbol. */ - unsigned long r_symndx = ELF_R_SYM (rel->r_info); - BFD_ASSERT (elf_local_ptr_offsets (input_bfd) != NULL); - BFD_ASSERT (elf_local_ptr_offsets (input_bfd)[r_symndx] != NULL); - linker_section_ptr = (_bfd_elf_find_pointer_linker_section - (elf_local_ptr_offsets (input_bfd)[r_symndx], - rel->r_addend, - lsect->which)); - - BFD_ASSERT (linker_section_ptr != NULL); - - /* Write out pointer if it hasn't been rewritten out before. */ - if (!linker_section_ptr->written_address_p) - { - linker_section_ptr->written_address_p = true; - bfd_put_ptr (output_bfd, relocation + linker_section_ptr->addend, - lsect->section->contents + linker_section_ptr->offset); - - if (info->shared) - { - asection *srel = lsect->rel_section; - Elf_Internal_Rela *outrel; - struct elf_backend_data *bed = get_elf_backend_data (output_bfd); - unsigned int i; - - outrel = (Elf_Internal_Rela *) - bfd_zmalloc (sizeof (Elf_Internal_Rela) - * bed->s->int_rels_per_ext_rel); - if (outrel == NULL) - { - (*_bfd_error_handler) (_("Error: out of memory")); - return 0; - } - - /* We need to generate a relative reloc for the dynamic - linker. */ - if (!srel) - { - srel = bfd_get_section_by_name (elf_hash_table (info)->dynobj, - lsect->rel_name); - lsect->rel_section = srel; - } - - BFD_ASSERT (srel != NULL); - - for (i = 0; i < bed->s->int_rels_per_ext_rel; i++) - outrel[i].r_offset = (lsect->section->output_section->vma - + lsect->section->output_offset - + linker_section_ptr->offset); - outrel[0].r_info = ELF_R_INFO (0, relative_reloc); - outrel[0].r_addend = 0; - elf_swap_reloca_out (output_bfd, outrel, - (((Elf_External_Rela *) - lsect->section->contents) - + (elf_section_data (lsect->section) - ->rel_count))); - ++elf_section_data (lsect->section)->rel_count; - - free (outrel); - } - } - } - - relocation = (lsect->section->output_offset - + linker_section_ptr->offset - - lsect->hole_offset - - lsect->sym_offset); - -#ifdef DEBUG - fprintf (stderr, - "Finish pointer in linker section %s, offset = %ld (0x%lx)\n", - lsect->name, (long) relocation, (long) relocation); -#endif - - /* Subtract out the addend, because it will get added back in by the normal - processing. */ - return relocation - linker_section_ptr->addend; -} - -/* Garbage collect unused sections. */ - -static boolean elf_gc_mark - PARAMS ((struct bfd_link_info *info, asection *sec, - asection * (*gc_mark_hook) - PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *, - struct elf_link_hash_entry *, Elf_Internal_Sym *)))); - -static boolean elf_gc_sweep - PARAMS ((struct bfd_link_info *info, - boolean (*gc_sweep_hook) - PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *o, - const Elf_Internal_Rela *relocs)))); - -static boolean elf_gc_sweep_symbol - PARAMS ((struct elf_link_hash_entry *h, PTR idxptr)); - -static boolean elf_gc_allocate_got_offsets - PARAMS ((struct elf_link_hash_entry *h, PTR offarg)); - -static boolean elf_gc_propagate_vtable_entries_used - PARAMS ((struct elf_link_hash_entry *h, PTR dummy)); - -static boolean elf_gc_smash_unused_vtentry_relocs - PARAMS ((struct elf_link_hash_entry *h, PTR dummy)); - -/* The mark phase of garbage collection. For a given section, mark - it, and all the sections which define symbols to which it refers. */ - -static boolean -elf_gc_mark (info, sec, gc_mark_hook) - struct bfd_link_info *info; - asection *sec; - asection * (*gc_mark_hook) - PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *, - struct elf_link_hash_entry *, Elf_Internal_Sym *)); -{ - boolean ret = true; - - sec->gc_mark = 1; - - /* Look through the section relocs. */ - - if ((sec->flags & SEC_RELOC) != 0 && sec->reloc_count > 0) - { - Elf_Internal_Rela *relstart, *rel, *relend; - Elf_Internal_Shdr *symtab_hdr; - struct elf_link_hash_entry **sym_hashes; - size_t nlocsyms; - size_t extsymoff; - Elf_External_Sym *locsyms, *freesyms = NULL; - bfd *input_bfd = sec->owner; - struct elf_backend_data *bed = get_elf_backend_data (input_bfd); - - /* GCFIXME: how to arrange so that relocs and symbols are not - reread continually? */ - - symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; - sym_hashes = elf_sym_hashes (input_bfd); - - /* Read the local symbols. */ - if (elf_bad_symtab (input_bfd)) - { - nlocsyms = symtab_hdr->sh_size / sizeof (Elf_External_Sym); - extsymoff = 0; - } - else - extsymoff = nlocsyms = symtab_hdr->sh_info; - if (symtab_hdr->contents) - locsyms = (Elf_External_Sym *) symtab_hdr->contents; - else if (nlocsyms == 0) - locsyms = NULL; - else - { - locsyms = freesyms = - bfd_malloc (nlocsyms * sizeof (Elf_External_Sym)); - if (freesyms == NULL - || bfd_seek (input_bfd, symtab_hdr->sh_offset, SEEK_SET) != 0 - || (bfd_read (locsyms, sizeof (Elf_External_Sym), - nlocsyms, input_bfd) - != nlocsyms * sizeof (Elf_External_Sym))) - { - ret = false; - goto out1; - } - } - - /* Read the relocations. */ - relstart = (NAME(_bfd_elf,link_read_relocs) - (sec->owner, sec, NULL, (Elf_Internal_Rela *) NULL, - info->keep_memory)); - if (relstart == NULL) - { - ret = false; - goto out1; - } - relend = relstart + sec->reloc_count * bed->s->int_rels_per_ext_rel; - - for (rel = relstart; rel < relend; rel++) - { - unsigned long r_symndx; - asection *rsec; - struct elf_link_hash_entry *h; - Elf_Internal_Sym s; - - r_symndx = ELF_R_SYM (rel->r_info); - if (r_symndx == 0) - continue; - - if (elf_bad_symtab (sec->owner)) - { - elf_swap_symbol_in (input_bfd, &locsyms[r_symndx], &s); - if (ELF_ST_BIND (s.st_info) == STB_LOCAL) - rsec = (*gc_mark_hook) (sec->owner, info, rel, NULL, &s); - else - { - h = sym_hashes[r_symndx - extsymoff]; - rsec = (*gc_mark_hook) (sec->owner, info, rel, h, NULL); - } - } - else if (r_symndx >= nlocsyms) - { - h = sym_hashes[r_symndx - extsymoff]; - rsec = (*gc_mark_hook) (sec->owner, info, rel, h, NULL); - } - else - { - elf_swap_symbol_in (input_bfd, &locsyms[r_symndx], &s); - rsec = (*gc_mark_hook) (sec->owner, info, rel, NULL, &s); - } - - if (rsec && !rsec->gc_mark) - if (!elf_gc_mark (info, rsec, gc_mark_hook)) - { - ret = false; - goto out2; - } - } - - out2: - if (!info->keep_memory) - free (relstart); - out1: - if (freesyms) - free (freesyms); - } - - return ret; -} - -/* The sweep phase of garbage collection. Remove all garbage sections. */ - -static boolean -elf_gc_sweep (info, gc_sweep_hook) - struct bfd_link_info *info; - boolean (*gc_sweep_hook) - PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *o, - const Elf_Internal_Rela *relocs)); -{ - bfd *sub; - - for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) - { - asection *o; - - if (bfd_get_flavour (sub) != bfd_target_elf_flavour) - continue; - - for (o = sub->sections; o != NULL; o = o->next) - { - /* Keep special sections. Keep .debug sections. */ - if ((o->flags & SEC_LINKER_CREATED) - || (o->flags & SEC_DEBUGGING)) - o->gc_mark = 1; - - if (o->gc_mark) - continue; - - /* Skip sweeping sections already excluded. */ - if (o->flags & SEC_EXCLUDE) - continue; - - /* Since this is early in the link process, it is simple - to remove a section from the output. */ - o->flags |= SEC_EXCLUDE; - - /* But we also have to update some of the relocation - info we collected before. */ - if (gc_sweep_hook - && (o->flags & SEC_RELOC) && o->reloc_count > 0) - { - Elf_Internal_Rela *internal_relocs; - boolean r; - - internal_relocs = (NAME(_bfd_elf,link_read_relocs) - (o->owner, o, NULL, NULL, info->keep_memory)); - if (internal_relocs == NULL) - return false; - - r = (*gc_sweep_hook) (o->owner, info, o, internal_relocs); - - if (!info->keep_memory) - free (internal_relocs); - - if (!r) - return false; - } - } - } - - /* Remove the symbols that were in the swept sections from the dynamic - symbol table. GCFIXME: Anyone know how to get them out of the - static symbol table as well? */ - { - int i = 0; - - elf_link_hash_traverse (elf_hash_table (info), - elf_gc_sweep_symbol, - (PTR) &i); - - elf_hash_table (info)->dynsymcount = i; - } - - return true; -} - -/* Sweep symbols in swept sections. Called via elf_link_hash_traverse. */ - -static boolean -elf_gc_sweep_symbol (h, idxptr) - struct elf_link_hash_entry *h; - PTR idxptr; -{ - int *idx = (int *) idxptr; - - if (h->dynindx != -1 - && ((h->root.type != bfd_link_hash_defined - && h->root.type != bfd_link_hash_defweak) - || h->root.u.def.section->gc_mark)) - h->dynindx = (*idx)++; - - return true; -} - -/* Propogate collected vtable information. This is called through - elf_link_hash_traverse. */ - -static boolean -elf_gc_propagate_vtable_entries_used (h, okp) - struct elf_link_hash_entry *h; - PTR okp; -{ - /* Those that are not vtables. */ - if (h->vtable_parent == NULL) - return true; - - /* Those vtables that do not have parents, we cannot merge. */ - if (h->vtable_parent == (struct elf_link_hash_entry *) -1) - return true; - - /* If we've already been done, exit. */ - if (h->vtable_entries_used && h->vtable_entries_used[-1]) - return true; - - /* Make sure the parent's table is up to date. */ - elf_gc_propagate_vtable_entries_used (h->vtable_parent, okp); - - if (h->vtable_entries_used == NULL) - { - /* None of this table's entries were referenced. Re-use the - parent's table. */ - h->vtable_entries_used = h->vtable_parent->vtable_entries_used; - h->vtable_entries_size = h->vtable_parent->vtable_entries_size; - } - else - { - size_t n; - boolean *cu, *pu; - - /* Or the parent's entries into ours. */ - cu = h->vtable_entries_used; - cu[-1] = true; - pu = h->vtable_parent->vtable_entries_used; - if (pu != NULL) - { - asection *sec = h->root.u.def.section; - struct elf_backend_data *bed = get_elf_backend_data (sec->owner); - int file_align = bed->s->file_align; - - n = h->vtable_parent->vtable_entries_size / file_align; - while (--n != 0) - { - if (*pu) *cu = true; - pu++, cu++; - } - } - } - - return true; -} - -static boolean -elf_gc_smash_unused_vtentry_relocs (h, okp) - struct elf_link_hash_entry *h; - PTR okp; -{ - asection *sec; - bfd_vma hstart, hend; - Elf_Internal_Rela *relstart, *relend, *rel; - struct elf_backend_data *bed; - int file_align; - - /* Take care of both those symbols that do not describe vtables as - well as those that are not loaded. */ - if (h->vtable_parent == NULL) - return true; - - BFD_ASSERT (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak); - - sec = h->root.u.def.section; - hstart = h->root.u.def.value; - hend = hstart + h->size; - - relstart = (NAME(_bfd_elf,link_read_relocs) - (sec->owner, sec, NULL, (Elf_Internal_Rela *) NULL, true)); - if (!relstart) - return *(boolean *) okp = false; - bed = get_elf_backend_data (sec->owner); - file_align = bed->s->file_align; - - relend = relstart + sec->reloc_count * bed->s->int_rels_per_ext_rel; - - for (rel = relstart; rel < relend; ++rel) - if (rel->r_offset >= hstart && rel->r_offset < hend) - { - /* If the entry is in use, do nothing. */ - if (h->vtable_entries_used - && (rel->r_offset - hstart) < h->vtable_entries_size) - { - bfd_vma entry = (rel->r_offset - hstart) / file_align; - if (h->vtable_entries_used[entry]) - continue; - } - /* Otherwise, kill it. */ - rel->r_offset = rel->r_info = rel->r_addend = 0; - } - - return true; -} - -/* Do mark and sweep of unused sections. */ - -boolean -elf_gc_sections (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - boolean ok = true; - bfd *sub; - asection * (*gc_mark_hook) - PARAMS ((bfd *abfd, struct bfd_link_info *, Elf_Internal_Rela *, - struct elf_link_hash_entry *h, Elf_Internal_Sym *)); - - if (!get_elf_backend_data (abfd)->can_gc_sections - || info->relocateable || info->emitrelocations - || elf_hash_table (info)->dynamic_sections_created) - return true; - - /* Apply transitive closure to the vtable entry usage info. */ - elf_link_hash_traverse (elf_hash_table (info), - elf_gc_propagate_vtable_entries_used, - (PTR) &ok); - if (!ok) - return false; - - /* Kill the vtable relocations that were not used. */ - elf_link_hash_traverse (elf_hash_table (info), - elf_gc_smash_unused_vtentry_relocs, - (PTR) &ok); - if (!ok) - return false; - - /* Grovel through relocs to find out who stays ... */ - - gc_mark_hook = get_elf_backend_data (abfd)->gc_mark_hook; - for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) - { - asection *o; - - if (bfd_get_flavour (sub) != bfd_target_elf_flavour) - continue; - - for (o = sub->sections; o != NULL; o = o->next) - { - if (o->flags & SEC_KEEP) - if (!elf_gc_mark (info, o, gc_mark_hook)) - return false; - } - } - - /* ... and mark SEC_EXCLUDE for those that go. */ - if (!elf_gc_sweep (info, get_elf_backend_data (abfd)->gc_sweep_hook)) - return false; - - return true; -} - -/* Called from check_relocs to record the existance of a VTINHERIT reloc. */ - -boolean -elf_gc_record_vtinherit (abfd, sec, h, offset) - bfd *abfd; - asection *sec; - struct elf_link_hash_entry *h; - bfd_vma offset; -{ - struct elf_link_hash_entry **sym_hashes, **sym_hashes_end; - struct elf_link_hash_entry **search, *child; - bfd_size_type extsymcount; - - /* The sh_info field of the symtab header tells us where the - external symbols start. We don't care about the local symbols at - this point. */ - extsymcount = elf_tdata (abfd)->symtab_hdr.sh_size/sizeof (Elf_External_Sym); - if (!elf_bad_symtab (abfd)) - extsymcount -= elf_tdata (abfd)->symtab_hdr.sh_info; - - sym_hashes = elf_sym_hashes (abfd); - sym_hashes_end = sym_hashes + extsymcount; - - /* Hunt down the child symbol, which is in this section at the same - offset as the relocation. */ - for (search = sym_hashes; search != sym_hashes_end; ++search) - { - if ((child = *search) != NULL - && (child->root.type == bfd_link_hash_defined - || child->root.type == bfd_link_hash_defweak) - && child->root.u.def.section == sec - && child->root.u.def.value == offset) - goto win; - } - - (*_bfd_error_handler) ("%s: %s+%lu: No symbol found for INHERIT", - bfd_get_filename (abfd), sec->name, - (unsigned long) offset); - bfd_set_error (bfd_error_invalid_operation); - return false; - -win: - if (!h) - { - /* This *should* only be the absolute section. It could potentially - be that someone has defined a non-global vtable though, which - would be bad. It isn't worth paging in the local symbols to be - sure though; that case should simply be handled by the assembler. */ - - child->vtable_parent = (struct elf_link_hash_entry *) -1; - } - else - child->vtable_parent = h; - - return true; -} - -/* Called from check_relocs to record the existance of a VTENTRY reloc. */ - -boolean -elf_gc_record_vtentry (abfd, sec, h, addend) - bfd *abfd ATTRIBUTE_UNUSED; - asection *sec ATTRIBUTE_UNUSED; - struct elf_link_hash_entry *h; - bfd_vma addend; -{ - struct elf_backend_data *bed = get_elf_backend_data (abfd); - int file_align = bed->s->file_align; - - if (addend >= h->vtable_entries_size) - { - size_t size, bytes; - boolean *ptr = h->vtable_entries_used; - - /* While the symbol is undefined, we have to be prepared to handle - a zero size. */ - if (h->root.type == bfd_link_hash_undefined) - size = addend; - else - { - size = h->size; - if (size < addend) - { - /* Oops! We've got a reference past the defined end of - the table. This is probably a bug -- shall we warn? */ - size = addend; - } - } - - /* Allocate one extra entry for use as a "done" flag for the - consolidation pass. */ - bytes = (size / file_align + 1) * sizeof (boolean); - - if (ptr) - { - ptr = bfd_realloc (ptr - 1, bytes); - - if (ptr != NULL) - { - size_t oldbytes; - - oldbytes = ((h->vtable_entries_size / file_align + 1) - * sizeof (boolean)); - memset (((char *) ptr) + oldbytes, 0, bytes - oldbytes); - } - } - else - ptr = bfd_zmalloc (bytes); - - if (ptr == NULL) - return false; - - /* And arrange for that done flag to be at index -1. */ - h->vtable_entries_used = ptr + 1; - h->vtable_entries_size = size; - } - - h->vtable_entries_used[addend / file_align] = true; - - return true; -} - -/* And an accompanying bit to work out final got entry offsets once - we're done. Should be called from final_link. */ - -boolean -elf_gc_common_finalize_got_offsets (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - bfd *i; - struct elf_backend_data *bed = get_elf_backend_data (abfd); - bfd_vma gotoff; - - /* The GOT offset is relative to the .got section, but the GOT header is - put into the .got.plt section, if the backend uses it. */ - if (bed->want_got_plt) - gotoff = 0; - else - gotoff = bed->got_header_size; - - /* Do the local .got entries first. */ - for (i = info->input_bfds; i; i = i->link_next) - { - bfd_signed_vma *local_got; - bfd_size_type j, locsymcount; - Elf_Internal_Shdr *symtab_hdr; - - if (bfd_get_flavour (i) != bfd_target_elf_flavour) - continue; - - local_got = elf_local_got_refcounts (i); - if (!local_got) - continue; - - symtab_hdr = &elf_tdata (i)->symtab_hdr; - if (elf_bad_symtab (i)) - locsymcount = symtab_hdr->sh_size / sizeof (Elf_External_Sym); - else - locsymcount = symtab_hdr->sh_info; - - for (j = 0; j < locsymcount; ++j) - { - if (local_got[j] > 0) - { - local_got[j] = gotoff; - gotoff += ARCH_SIZE / 8; - } - else - local_got[j] = (bfd_vma) -1; - } - } - - /* Then the global .got entries. .plt refcounts are handled by - adjust_dynamic_symbol */ - elf_link_hash_traverse (elf_hash_table (info), - elf_gc_allocate_got_offsets, - (PTR) &gotoff); - return true; -} - -/* We need a special top-level link routine to convert got reference counts - to real got offsets. */ - -static boolean -elf_gc_allocate_got_offsets (h, offarg) - struct elf_link_hash_entry *h; - PTR offarg; -{ - bfd_vma *off = (bfd_vma *) offarg; - - if (h->got.refcount > 0) - { - h->got.offset = off[0]; - off[0] += ARCH_SIZE / 8; - } - else - h->got.offset = (bfd_vma) -1; - - return true; -} - -/* Many folk need no more in the way of final link than this, once - got entry reference counting is enabled. */ - -boolean -elf_gc_common_final_link (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - if (!elf_gc_common_finalize_got_offsets (abfd, info)) - return false; - - /* Invoke the regular ELF backend linker to do all the work. */ - return elf_bfd_final_link (abfd, info); -} - -/* This function will be called though elf_link_hash_traverse to store - all hash value of the exported symbols in an array. */ - -static boolean -elf_collect_hash_codes (h, data) - struct elf_link_hash_entry *h; - PTR data; -{ - unsigned long **valuep = (unsigned long **) data; - const char *name; - char *p; - unsigned long ha; - char *alc = NULL; - - /* Ignore indirect symbols. These are added by the versioning code. */ - if (h->dynindx == -1) - return true; - - name = h->root.root.string; - p = strchr (name, ELF_VER_CHR); - if (p != NULL) - { - alc = bfd_malloc (p - name + 1); - memcpy (alc, name, p - name); - alc[p - name] = '\0'; - name = alc; - } - - /* Compute the hash value. */ - ha = bfd_elf_hash (name); - - /* Store the found hash value in the array given as the argument. */ - *(*valuep)++ = ha; - - /* And store it in the struct so that we can put it in the hash table - later. */ - h->elf_hash_value = ha; - - if (alc != NULL) - free (alc); - - return true; -} diff -uprN binutils-2.11.90.0.31/bfd/elfxx-ia64.c binutils-2.11.92.0.5/bfd/elfxx-ia64.c --- binutils-2.11.90.0.31/bfd/elfxx-ia64.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/elfxx-ia64.c Thu Oct 4 14:35:43 2001 @@ -172,7 +172,7 @@ static boolean elfNN_ia64_add_symbol_hoo PARAMS ((bfd *abfd, struct bfd_link_info *info, const Elf_Internal_Sym *sym, const char **namep, flagword *flagsp, asection **secp, bfd_vma *valp)); -static boolean elfNN_ia64_aix_vec +static boolean elfNN_ia64_aix_vec PARAMS ((const bfd_target *vec)); static boolean elfNN_ia64_aix_add_symbol_hook PARAMS ((bfd *abfd, struct bfd_link_info *info, const Elf_Internal_Sym *sym, @@ -240,7 +240,7 @@ static boolean elfNN_ia64_check_relocs const Elf_Internal_Rela *relocs)); static boolean elfNN_ia64_adjust_dynamic_symbol PARAMS ((struct bfd_link_info *info, struct elf_link_hash_entry *h)); -static unsigned long global_sym_index +static long global_sym_index PARAMS ((struct elf_link_hash_entry *h)); static boolean allocate_fptr PARAMS ((struct elfNN_ia64_dyn_sym_info *dyn_i, PTR data)); @@ -301,7 +301,7 @@ static boolean elfNN_ia64_merge_private_ static boolean elfNN_ia64_print_private_bfd_data PARAMS ((bfd *abfd, PTR ptr)); static enum elf_reloc_type_class elfNN_ia64_reloc_type_class - PARAMS ((int)); + PARAMS ((const Elf_Internal_Rela *)); /* ia64-specific relocation */ @@ -548,7 +548,8 @@ elfNN_ia64_info_to_howto (abfd, bfd_relo arelent *bfd_reloc; ElfNN_Internal_Rela *elf_reloc; { - bfd_reloc->howto = lookup_howto (ELFNN_R_TYPE (elf_reloc->r_info)); + bfd_reloc->howto + = lookup_howto ((unsigned int) ELFNN_R_TYPE (elf_reloc->r_info)); } #define PLT_HEADER_SIZE (3 * 16) @@ -714,7 +715,7 @@ elfNN_ia64_relax_section (abfd, sec, lin goto error_return; free_extsyms = extsyms; if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0 - || (bfd_read (extsyms, 1, symtab_hdr->sh_size, abfd) + || (bfd_bread (extsyms, symtab_hdr->sh_size, abfd) != symtab_hdr->sh_size)) goto error_return; } @@ -725,6 +726,7 @@ elfNN_ia64_relax_section (abfd, sec, lin Elf_Internal_Sym isym; asection *tsec; struct one_fixup *f; + bfd_size_type amt; if (ELFNN_R_TYPE (irel->r_info) != (int) R_IA64_PCREL21B) continue; @@ -792,7 +794,7 @@ elfNN_ia64_relax_section (abfd, sec, lin roff = irel->r_offset; reladdr = (sec->output_section->vma + sec->output_offset - + roff) & -4; + + roff) & (bfd_vma) -4; /* If the branch is in range, no need to do anything. */ if ((bfd_signed_vma) (symaddr - reladdr) >= -0x1000000 @@ -816,7 +818,7 @@ elfNN_ia64_relax_section (abfd, sec, lin make a copy of the FULL_PLT entry. Otherwise, we'll have to use a `brl' insn to get where we're going. */ - int size; + size_t size; if (tsec == ia64_info->plt_sec) size = sizeof (plt_full_entry); @@ -830,11 +832,12 @@ elfNN_ia64_relax_section (abfd, sec, lin } /* Resize the current section to make room for the new branch. */ - trampoff = (sec->_cooked_size + 15) & -16; - contents = (bfd_byte *) bfd_realloc (contents, trampoff + size); + trampoff = (sec->_cooked_size + 15) & (bfd_vma) -16; + amt = trampoff + size; + contents = (bfd_byte *) bfd_realloc (contents, amt); if (contents == NULL) goto error_return; - sec->_cooked_size = trampoff + size; + sec->_cooked_size = amt; if (tsec == ia64_info->plt_sec) { @@ -862,7 +865,7 @@ elfNN_ia64_relax_section (abfd, sec, lin } /* Record the fixup so we don't do it again this section. */ - f = (struct one_fixup *) bfd_malloc (sizeof (*f)); + f = (struct one_fixup *) bfd_malloc ((bfd_size_type) sizeof (*f)); f->next = fixups; f->tsec = tsec; f->toff = toff; @@ -878,7 +881,7 @@ elfNN_ia64_relax_section (abfd, sec, lin /* Fix up the existing branch to hit the trampoline. Hope like hell this doesn't overflow too. */ if (elfNN_ia64_install_value (abfd, contents + roff, - f->trampoff - (roff & -4), + f->trampoff - (roff & (bfd_vma) -4), R_IA64_PCREL21B) != bfd_reloc_ok) goto error_return; @@ -1163,7 +1166,7 @@ elfNN_ia64_aix_vec (const bfd_target *ve extern const bfd_target bfd_elfNN_ia64_aix_little_vec; extern const bfd_target bfd_elfNN_ia64_aix_big_vec; - return (/**/vec == & bfd_elfNN_ia64_aix_little_vec + return (/**/vec == & bfd_elfNN_ia64_aix_little_vec || vec == & bfd_elfNN_ia64_aix_big_vec); } @@ -1187,25 +1190,26 @@ elfNN_ia64_aix_add_symbol_hook (abfd, in no one else should use it b/c it is undocumented. */ struct elf_link_hash_entry *h; - h = (struct elf_link_hash_entry *) bfd_link_hash_lookup (info->hash, *namep, false, false, false); - if (h == NULL) + h = elf_link_hash_lookup (elf_hash_table (info), *namep, + false, false, false); + if (h == NULL) { struct elf_backend_data *bed; struct elfNN_ia64_link_hash_table *ia64_info; bed = get_elf_backend_data (abfd); ia64_info = elfNN_ia64_hash_table (info); - + if (!(_bfd_generic_link_add_one_symbol - (info, abfd, *namep, BSF_GLOBAL, + (info, abfd, *namep, BSF_GLOBAL, bfd_get_section_by_name (abfd, ".bss"), bed->got_symbol_offset, (const char *) NULL, false, bed->collect, (struct bfd_link_hash_entry **) &h))) return false; - + h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; h->type = STT_OBJECT; - + if (! _bfd_elf_link_record_dynamic_symbol (info, h)) return false; } @@ -1215,15 +1219,15 @@ elfNN_ia64_aix_add_symbol_hook (abfd, in else if (sym->st_shndx == SHN_LOOS) { int i; - + /* SHN_AIX_SYSCALL: Treat this as any other symbol. The special symbol is only relevant when compiling code for extended system calls. - Replace the "special" section with .text, if possible. + Replace the "special" section with .text, if possible. Note that these symbols are always assumed to be in .text. */ for (i = 1; i < elf_elfheader (abfd)->e_shnum; i++) { - asection * sec = bfd_section_from_elf_index (abfd, i); - + asection * sec = bfd_section_from_elf_index (abfd, (unsigned) i); + if (sec && strcmp (sec->name, ".text") == 0) { *secp = sec; @@ -1233,14 +1237,14 @@ elfNN_ia64_aix_add_symbol_hook (abfd, in if (*secp == NULL) *secp = bfd_abs_section_ptr; - + *valp = sym->st_size; - + return true; } - else + else { - return elfNN_ia64_add_symbol_hook (abfd, info, sym, + return elfNN_ia64_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp); } } @@ -1302,7 +1306,8 @@ elfNN_ia64_modify_segment_map (abfd) break; if (m == NULL) { - m = (struct elf_segment_map *) bfd_zalloc (abfd, sizeof *m); + m = ((struct elf_segment_map *) + bfd_zalloc (abfd, (bfd_size_type) sizeof *m)); if (m == NULL) return false; @@ -1337,7 +1342,8 @@ elfNN_ia64_modify_segment_map (abfd) if (m == NULL) { - m = (struct elf_segment_map *) bfd_zalloc (abfd, sizeof *m); + m = ((struct elf_segment_map *) + bfd_zalloc (abfd, (bfd_size_type) sizeof *m)); if (m == NULL) return false; @@ -1424,7 +1430,7 @@ elfNN_ia64_dynamic_symbol_p (h, info) || h->root.type == bfd_link_hash_defweak) return true; - if ((info->shared && !info->symbolic) + if ((info->shared && (!info->symbolic || info->allow_shlib_undefined)) || ((h->elf_link_hash_flags & (ELF_LINK_HASH_DEF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR)) == (ELF_LINK_HASH_DEF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR))) @@ -1506,8 +1512,8 @@ elfNN_ia64_hash_copy_indirect (xdir, xin { struct elfNN_ia64_link_hash_entry *dir, *ind; - dir = (struct elfNN_ia64_link_hash_entry *)xdir; - ind = (struct elfNN_ia64_link_hash_entry *)xind; + dir = (struct elfNN_ia64_link_hash_entry *) xdir; + ind = (struct elfNN_ia64_link_hash_entry *) xind; /* Copy down any references that we may have already seen to the symbol which just became indirect. */ @@ -1518,6 +1524,9 @@ elfNN_ia64_hash_copy_indirect (xdir, xin | ELF_LINK_HASH_REF_REGULAR | ELF_LINK_HASH_REF_REGULAR_NONWEAK)); + if (xdir == xind->weakdef) + return; + /* Copy over the got and plt data. This would have been done by check_relocs. */ @@ -1574,7 +1583,7 @@ elfNN_ia64_hash_table_create (abfd) { struct elfNN_ia64_link_hash_table *ret; - ret = bfd_zalloc (abfd, sizeof (*ret)); + ret = bfd_zalloc (abfd, (bfd_size_type) sizeof (*ret)); if (!ret) return 0; if (!_bfd_elf_link_hash_table_init (&ret->root, abfd, @@ -1756,8 +1765,8 @@ get_dyn_sym_info (ia64_info, h, abfd, re if (dyn_i == NULL && create) { - dyn_i = (struct elfNN_ia64_dyn_sym_info *) - bfd_zalloc (abfd, sizeof *dyn_i); + dyn_i = ((struct elfNN_ia64_dyn_sym_info *) + bfd_zalloc (abfd, (bfd_size_type) sizeof *dyn_i)); *pp = dyn_i; dyn_i->addend = addend; } @@ -1940,8 +1949,8 @@ count_dyn_reloc (abfd, dyn_i, srel, type if (!rent) { - rent = (struct elfNN_ia64_dyn_reloc_entry *) - bfd_alloc (abfd, sizeof (*rent)); + rent = ((struct elfNN_ia64_dyn_reloc_entry *) + bfd_alloc (abfd, (bfd_size_type) sizeof (*rent))); if (!rent) return false; @@ -2015,7 +2024,8 @@ elfNN_ia64_check_relocs (abfd, info, sec have yet been processed. Do something with what we know, as this may help reduce memory usage and processing time later. */ maybe_dynamic = false; - if (h && ((info->shared && ! info->symbolic) + if (h && ((info->shared + && (!info->symbolic || info->allow_shlib_undefined)) || ! (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) || h->root.type == bfd_link_hash_defweak || elfNN_ia64_aix_vec (abfd->xvec))) @@ -2071,7 +2081,7 @@ elfNN_ia64_check_relocs (abfd, info, sec { (*info->callbacks->warning) (info, _("@pltoff reloc against local symbol"), 0, - abfd, 0, 0); + abfd, 0, (bfd_vma) 0); } break; @@ -2129,7 +2139,7 @@ elfNN_ia64_check_relocs (abfd, info, sec { (*info->callbacks->warning) (info, _("non-zero addend in @fptr reloc"), 0, - abfd, 0, 0); + abfd, 0, (bfd_vma) 0); } dyn_i = get_dyn_sym_info (ia64_info, h, abfd, rel, true); @@ -2165,7 +2175,7 @@ elfNN_ia64_check_relocs (abfd, info, sec || elfNN_ia64_aix_vec (abfd->xvec))) { if (! (_bfd_elfNN_link_record_local_dynamic_symbol - (info, abfd, r_symndx))) + (info, abfd, (long) r_symndx))) return false; } @@ -2270,7 +2280,7 @@ allocate_local_got (dyn_i, data) /* Search for the index of a global symbol in it's defining object file. */ -static unsigned long +static long global_sym_index (h) struct elf_link_hash_entry *h; { @@ -2594,7 +2604,7 @@ elfNN_ia64_size_dynamic_sections (output } /* Align the pointer for the plt2 entries. */ - data.ofs = (data.ofs + 31) & -32; + data.ofs = (data.ofs + 31) & (bfd_vma) -32; elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_plt2_entries, &data); if (data.ofs != 0) @@ -2711,7 +2721,7 @@ elfNN_ia64_size_dynamic_sections (output else { /* Allocate memory for the section contents. */ - sec->contents = (bfd_byte *) bfd_zalloc(dynobj, sec->_raw_size); + sec->contents = (bfd_byte *) bfd_zalloc (dynobj, sec->_raw_size); if (sec->contents == NULL && sec->_raw_size != 0) return false; } @@ -2727,32 +2737,34 @@ elfNN_ia64_size_dynamic_sections (output { /* The DT_DEBUG entry is filled in by the dynamic linker and used by the debugger. */ - if (!bfd_elfNN_add_dynamic_entry (info, DT_DEBUG, 0)) +#define add_dynamic_entry(TAG, VAL) \ + bfd_elfNN_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL)) + + if (!add_dynamic_entry (DT_DEBUG, 0)) return false; } - if (! bfd_elfNN_add_dynamic_entry (info, DT_IA_64_PLT_RESERVE, 0)) + if (!add_dynamic_entry (DT_IA_64_PLT_RESERVE, 0)) return false; - if (! bfd_elfNN_add_dynamic_entry (info, DT_PLTGOT, 0)) + if (!add_dynamic_entry (DT_PLTGOT, 0)) return false; if (relplt) { - if (! bfd_elfNN_add_dynamic_entry (info, DT_PLTRELSZ, 0) - || ! bfd_elfNN_add_dynamic_entry (info, DT_PLTREL, DT_RELA) - || ! bfd_elfNN_add_dynamic_entry (info, DT_JMPREL, 0)) + if (!add_dynamic_entry (DT_PLTRELSZ, 0) + || !add_dynamic_entry (DT_PLTREL, DT_RELA) + || !add_dynamic_entry (DT_JMPREL, 0)) return false; } - if (! bfd_elfNN_add_dynamic_entry (info, DT_RELA, 0) - || ! bfd_elfNN_add_dynamic_entry (info, DT_RELASZ, 0) - || ! bfd_elfNN_add_dynamic_entry (info, DT_RELAENT, - sizeof (ElfNN_External_Rela))) + if (!add_dynamic_entry (DT_RELA, 0) + || !add_dynamic_entry (DT_RELASZ, 0) + || !add_dynamic_entry (DT_RELAENT, sizeof (ElfNN_External_Rela))) return false; if (ia64_info->reltext) { - if (! bfd_elfNN_add_dynamic_entry (info, DT_TEXTREL, 0)) + if (!add_dynamic_entry (DT_TEXTREL, 0)) return false; info->flags |= DF_TEXTREL; } @@ -2764,10 +2776,10 @@ elfNN_ia64_size_dynamic_sections (output } static bfd_reloc_status_type -elfNN_ia64_install_value (abfd, hit_addr, val, r_type) +elfNN_ia64_install_value (abfd, hit_addr, v, r_type) bfd *abfd; bfd_byte *hit_addr; - bfd_vma val; + bfd_vma v; unsigned int r_type; { const struct ia64_operand *op; @@ -2776,6 +2788,11 @@ elfNN_ia64_install_value (abfd, hit_addr enum ia64_opnd opnd; const char *err; size_t size = 8; +#ifdef BFD_HOST_U_64_BIT + BFD_HOST_U_64_BIT val = (BFD_HOST_U_64_BIT) v; +#else + bfd_vma val = v; +#endif opnd = IA64_OPND_NIL; switch (r_type) @@ -2937,7 +2954,7 @@ elfNN_ia64_install_value (abfd, hit_addr insn = (dword >> shift) & 0x1ffffffffffLL; op = elf64_ia64_operands + opnd; - err = (*op->insert) (op, val, &insn); + err = (*op->insert) (op, val, (ia64_insn *)& insn); if (err) return bfd_reloc_overflow; @@ -3352,11 +3369,13 @@ elfNN_ia64_final_link (abfd, info) if (unwind_output_sec) { elfNN_ia64_unwind_entry_compare_bfd = abfd; - qsort (unwind_output_sec->contents, unwind_output_sec->_raw_size / 24, - 24, elfNN_ia64_unwind_entry_compare); + qsort (unwind_output_sec->contents, + (size_t) (unwind_output_sec->_raw_size / 24), + 24, + elfNN_ia64_unwind_entry_compare); if (! bfd_set_section_contents (abfd, unwind_output_sec, - unwind_output_sec->contents, 0, + unwind_output_sec->contents, (bfd_vma) 0, unwind_output_sec->_raw_size)) return false; } @@ -3424,7 +3443,7 @@ elfNN_ia64_relocate_section (output_bfd, { (*_bfd_error_handler) (_("%s: unknown relocation type %d"), - bfd_get_filename (input_bfd), (int)r_type); + bfd_archive_filename (input_bfd), (int)r_type); bfd_set_error (bfd_error_bad_value); ret_val = false; continue; @@ -3500,7 +3519,8 @@ elfNN_ia64_relocate_section (output_bfd, } else if (h->root.type == bfd_link_hash_undefweak) undef_weak_ref = true; - else if (info->shared && !info->symbolic + else if (info->shared + && (!info->symbolic || info->allow_shlib_undefined) && !info->no_undefined && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) ; @@ -3538,7 +3558,7 @@ elfNN_ia64_relocate_section (output_bfd, if ((dynamic_symbol_p || info->shared || (elfNN_ia64_aix_vec (info->hash->creator) /* Don't emit relocs for __GLOB_DATA_PTR on AIX. */ - && (!h || strcmp (h->root.root.string, + && (!h || strcmp (h->root.root.string, "__GLOB_DATA_PTR") != 0))) && (input_section->flags & SEC_ALLOC) != 0) { @@ -3583,7 +3603,7 @@ elfNN_ia64_relocate_section (output_bfd, shared libraries. Hork. */ (*_bfd_error_handler) (_("%s: linking non-pic code in a shared library"), - bfd_get_filename (input_bfd)); + bfd_archive_filename (input_bfd)); ret_val = false; continue; } @@ -3616,7 +3636,7 @@ elfNN_ia64_relocate_section (output_bfd, { (*_bfd_error_handler) (_("%s: @gprel relocation against dynamic symbol %s"), - bfd_get_filename (input_bfd), h->root.root.string); + bfd_archive_filename (input_bfd), h->root.root.string); ret_val = false; continue; } @@ -3674,7 +3694,7 @@ elfNN_ia64_relocate_section (output_bfd, else { dynindx = (_bfd_elf_link_lookup_local_dynindx - (info, input_bfd, r_symndx)); + (info, input_bfd, (long) r_symndx)); } elfNN_ia64_install_dyn_reloc (output_bfd, info, input_section, @@ -3718,7 +3738,7 @@ elfNN_ia64_relocate_section (output_bfd, } else dynindx = (_bfd_elf_link_lookup_local_dynindx - (info, input_bfd, r_symndx)); + (info, input_bfd, (long) r_symndx)); value = 0; } @@ -3754,7 +3774,7 @@ elfNN_ia64_relocate_section (output_bfd, { (*_bfd_error_handler) (_("%s: dynamic relocation against speculation fixup"), - bfd_get_filename (input_bfd)); + bfd_archive_filename (input_bfd)); ret_val = false; continue; } @@ -3762,7 +3782,7 @@ elfNN_ia64_relocate_section (output_bfd, { (*_bfd_error_handler) (_("%s: speculation fixup against undefined weak symbol"), - bfd_get_filename (input_bfd)); + bfd_archive_filename (input_bfd)); ret_val = false; continue; } @@ -3972,7 +3992,8 @@ elfNN_ia64_relocate_section (output_bfd, name = bfd_section_name (input_bfd, input_section); } if (!(*info->callbacks->reloc_overflow) (info, name, - howto->name, 0, + howto->name, + (bfd_vma) 0, input_bfd, input_section, rel->r_offset)) @@ -4242,7 +4263,7 @@ elfNN_ia64_merge_private_bfd_data (ibfd, { (*_bfd_error_handler) (_("%s: linking trap-on-NULL-dereference with non-trapping files"), - bfd_get_filename (ibfd)); + bfd_archive_filename (ibfd)); bfd_set_error (bfd_error_bad_value); ok = false; @@ -4251,7 +4272,7 @@ elfNN_ia64_merge_private_bfd_data (ibfd, { (*_bfd_error_handler) (_("%s: linking big-endian files with little-endian files"), - bfd_get_filename (ibfd)); + bfd_archive_filename (ibfd)); bfd_set_error (bfd_error_bad_value); ok = false; @@ -4260,7 +4281,7 @@ elfNN_ia64_merge_private_bfd_data (ibfd, { (*_bfd_error_handler) (_("%s: linking 64-bit files with 32-bit files"), - bfd_get_filename (ibfd)); + bfd_archive_filename (ibfd)); bfd_set_error (bfd_error_bad_value); ok = false; @@ -4269,7 +4290,7 @@ elfNN_ia64_merge_private_bfd_data (ibfd, { (*_bfd_error_handler) (_("%s: linking constant-gp files with non-constant-gp files"), - bfd_get_filename (ibfd)); + bfd_archive_filename (ibfd)); bfd_set_error (bfd_error_bad_value); ok = false; @@ -4279,7 +4300,7 @@ elfNN_ia64_merge_private_bfd_data (ibfd, { (*_bfd_error_handler) (_("%s: linking auto-pic files with non-auto-pic files"), - bfd_get_filename (ibfd)); + bfd_archive_filename (ibfd)); bfd_set_error (bfd_error_bad_value); ok = false; @@ -4313,10 +4334,10 @@ elfNN_ia64_print_private_bfd_data (abfd, } static enum elf_reloc_type_class -elfNN_ia64_reloc_type_class (type) - int type; +elfNN_ia64_reloc_type_class (rela) + const Elf_Internal_Rela *rela; { - switch (type) + switch ((int) ELFNN_R_TYPE (rela->r_info)) { case R_IA64_REL32MSB: case R_IA64_REL32LSB: diff -uprN binutils-2.11.90.0.31/bfd/elfxx-target.h binutils-2.11.92.0.5/bfd/elfxx-target.h --- binutils-2.11.90.0.31/bfd/elfxx-target.h Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/elfxx-target.h Mon Oct 1 15:25:21 2001 @@ -87,7 +87,8 @@ Foundation, Inc., 59 Temple Place - Suit #define bfd_elfNN_bfd_debug_info_start bfd_void #define bfd_elfNN_bfd_debug_info_end bfd_void -#define bfd_elfNN_bfd_debug_info_accumulate (PROTO(void,(*),(bfd*, struct sec *))) bfd_void +#define bfd_elfNN_bfd_debug_info_accumulate \ + (void (*) PARAMS ((bfd*, struct sec *))) bfd_void #ifndef bfd_elfNN_bfd_get_relocated_section_contents #define bfd_elfNN_bfd_get_relocated_section_contents \ @@ -101,6 +102,9 @@ Foundation, Inc., 59 Temple Place - Suit #ifndef elf_backend_can_gc_sections #define elf_backend_can_gc_sections 0 #endif +#ifndef elf_backend_can_refcount +#define elf_backend_can_refcount 0 +#endif #ifndef elf_backend_want_got_sym #define elf_backend_want_got_sym 1 #endif @@ -393,7 +397,7 @@ Foundation, Inc., 59 Temple Place - Suit extern const struct elf_size_info _bfd_elfNN_size_info; #ifndef INCLUDED_TARGET_FILE -static CONST struct elf_backend_data elfNN_bed = +static const struct elf_backend_data elfNN_bed = { ELF_ARCH, /* arch */ ELF_MACHINE_CODE, /* elf_machine_code */ @@ -458,6 +462,7 @@ static CONST struct elf_backend_data elf elf_backend_plt_not_loaded, elf_backend_plt_alignment, elf_backend_can_gc_sections, + elf_backend_can_refcount, elf_backend_want_dynbss, elf_backend_want_got_sym }; @@ -484,12 +489,13 @@ const bfd_target TARGET_BIG_SYM = BFD_ENDIAN_BIG, /* object_flags: mask of all file flags */ - (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS | - DYNAMIC | WP_TEXT | D_PAGED), + (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS + | DYNAMIC | WP_TEXT | D_PAGED), /* section_flags: mask of all section flags */ - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY | - SEC_CODE | SEC_DATA | SEC_DEBUGGING | SEC_EXCLUDE | SEC_SORT_ENTRIES), + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY + | SEC_CODE | SEC_DATA | SEC_DEBUGGING | SEC_EXCLUDE | SEC_SORT_ENTRIES + | SEC_ARCH_BIT_0 | SEC_SMALL_DATA | SEC_MERGE | SEC_STRINGS), /* leading_symbol_char: is the first char of a user symbol predictable, and if so what is it */ @@ -579,12 +585,13 @@ const bfd_target TARGET_LITTLE_SYM = BFD_ENDIAN_LITTLE, /* object_flags: mask of all file flags */ - (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS | - DYNAMIC | WP_TEXT | D_PAGED), + (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS + | DYNAMIC | WP_TEXT | D_PAGED), /* section_flags: mask of all section flags */ - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY | - SEC_CODE | SEC_DATA | SEC_DEBUGGING | SEC_EXCLUDE | SEC_SORT_ENTRIES), + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY + | SEC_CODE | SEC_DATA | SEC_DEBUGGING | SEC_EXCLUDE | SEC_SORT_ENTRIES + | SEC_ARCH_BIT_0 | SEC_SMALL_DATA | SEC_MERGE | SEC_STRINGS), /* leading_symbol_char: is the first char of a user symbol predictable, and if so what is it */ diff -uprN binutils-2.11.90.0.31/bfd/format.c binutils-2.11.92.0.5/bfd/format.c --- binutils-2.11.90.0.31/bfd/format.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/bfd/format.c Mon Oct 1 15:25:21 2001 @@ -142,10 +142,11 @@ bfd_check_format_matches (abfd, format, if (matching) { + bfd_size_type amt; + *matching = NULL; - matching_vector = - (char **) bfd_malloc (sizeof (char *) - * 2 * _bfd_target_vector_entries); + amt = sizeof (char *) * 2 * _bfd_target_vector_entries; + matching_vector = (char **) bfd_malloc (amt); if (!matching_vector) return false; } @@ -159,7 +160,7 @@ bfd_check_format_matches (abfd, format, /* If the target type was explicitly specified, just check that target. */ if (!abfd->target_defaulted) { - if (bfd_seek (abfd, (file_ptr)0, SEEK_SET) != 0) /* rewind! */ + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) /* rewind! */ return false; right_targ = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd)); @@ -210,7 +211,7 @@ bfd_check_format_matches (abfd, format, abfd->xvec = *target; /* Change BFD's target temporarily */ - if (bfd_seek (abfd, (file_ptr)0, SEEK_SET) != 0) + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) return false; /* If _bfd_check_format neglects to set bfd_error, assume diff -uprN binutils-2.11.90.0.31/bfd/gen-aout.c binutils-2.11.92.0.5/bfd/gen-aout.c --- binutils-2.11.90.0.31/bfd/gen-aout.c Fri Mar 9 11:15:59 2001 +++ binutils-2.11.92.0.5/bfd/gen-aout.c Thu Oct 4 14:35:43 2001 @@ -1,5 +1,5 @@ /* Generate parameters for an a.out system. - Copyright 1990, 1991, 1992, 1993, 1994, 1995 + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 2001 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -87,9 +87,12 @@ main (argc, argv) fprintf (stderr, _(" fix DEFAULT_ARCH in the output file yourself\n")); arch = "unknown"; } - printf("#define DEFAULT_ARCH bfd_arch_%s\n", arch); + printf("#define DEFAULT_ARCH bfd_arch_%s\n\n", arch); - printf("\n#define MY(OP) CAT(%s_,OP)\n", target); + printf("/* Do not \"beautify\" the CONCAT* macro args. Traditional C will not"); + printf(" remove whitespace added here, and thus will fail to concatenate"); + printf(" the tokens. */"); + printf("\n#define MY(OP) CONCAT2 (%s_,OP)\n\n", target); printf("#define TARGETNAME \"a.out-%s\"\n\n", target); printf("#include \"bfd.h\"\n"); diff -uprN binutils-2.11.90.0.31/bfd/hash.c binutils-2.11.92.0.5/bfd/hash.c --- binutils-2.11.90.0.31/bfd/hash.c Fri Mar 9 11:16:00 2001 +++ binutils-2.11.92.0.5/bfd/hash.c Mon Oct 1 15:25:21 2001 @@ -582,9 +582,9 @@ struct bfd_strtab_hash * _bfd_stringtab_init () { struct bfd_strtab_hash *table; + bfd_size_type amt = sizeof (struct bfd_strtab_hash); - table = ((struct bfd_strtab_hash *) - bfd_malloc (sizeof (struct bfd_strtab_hash))); + table = (struct bfd_strtab_hash *) bfd_malloc (amt); if (table == NULL) return NULL; @@ -711,8 +711,8 @@ _bfd_stringtab_emit (abfd, tab) for (entry = tab->first; entry != NULL; entry = entry->next) { - register const char *str; - register size_t len; + const char *str; + size_t len; str = entry->root.string; len = strlen (str) + 1; @@ -722,12 +722,12 @@ _bfd_stringtab_emit (abfd, tab) bfd_byte buf[2]; /* The output length includes the null byte. */ - bfd_put_16 (abfd, len, buf); - if (bfd_write ((PTR) buf, 1, 2, abfd) != 2) + bfd_put_16 (abfd, (bfd_vma) len, buf); + if (bfd_bwrite ((PTR) buf, (bfd_size_type) 2, abfd) != 2) return false; } - if (bfd_write ((PTR) str, 1, len, abfd) != len) + if (bfd_bwrite ((PTR) str, (bfd_size_type) len, abfd) != len) return false; } diff -uprN binutils-2.11.90.0.31/bfd/host-aout.c binutils-2.11.92.0.5/bfd/host-aout.c --- binutils-2.11.90.0.31/bfd/host-aout.c Fri Mar 9 11:16:00 2001 +++ binutils-2.11.92.0.5/bfd/host-aout.c Thu Oct 4 14:35:43 2001 @@ -1,5 +1,6 @@ /* BFD backend for local host's a.out binaries - Copyright 1990, 1991, 1992, 1994, 1995 Free Software Foundation, Inc. + Copyright 1990, 1991, 1992, 1994, 1995, 2001 + Free Software Foundation, Inc. Written by Cygnus Support. Probably John Gilmore's fault. This file is part of BFD, the Binary File Descriptor library. @@ -77,7 +78,10 @@ Foundation, Inc., 59 Temple Place - Suit #endif #endif /* HOST_MACHINE_ARCH */ -#define MY(OP) CAT(host_aout_,OP) +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (host_aout_,OP) #define TARGETNAME "a.out" #include "aout-target.h" diff -uprN binutils-2.11.90.0.31/bfd/hosts/alphavms.h binutils-2.11.92.0.5/bfd/hosts/alphavms.h --- binutils-2.11.90.0.31/bfd/hosts/alphavms.h Thu Jun 3 11:01:55 1999 +++ binutils-2.11.92.0.5/bfd/hosts/alphavms.h Mon Oct 1 15:25:22 2001 @@ -1,5 +1,5 @@ /* alphavms.h -- BFD definitions for an openVMS host - Copyright 1996 Free Software Foundation, Inc. + Copyright 1996, 2000 Free Software Foundation, Inc. Written by Klaus Kämpf (kkaempf@progis.de) of proGIS Softwareentwicklung, Aachen, Germany @@ -25,7 +25,6 @@ Foundation, Inc., 59 Temple Place - Suit #include #include #include -#include #include #include #include diff -uprN binutils-2.11.90.0.31/bfd/hp300bsd.c binutils-2.11.92.0.5/bfd/hp300bsd.c --- binutils-2.11.90.0.31/bfd/hp300bsd.c Fri Mar 9 11:16:00 2001 +++ binutils-2.11.92.0.5/bfd/hp300bsd.c Thu Oct 4 14:35:43 2001 @@ -1,5 +1,5 @@ /* BFD back-end for HP 9000/300 (68000-based) machines running BSD Unix. - Copyright 1992, 1994, 1995 Free Software Foundation, Inc. + Copyright 1992, 1994, 1995, 2001 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -27,7 +27,10 @@ Foundation, Inc., 59 Temple Place - Suit #define SEGMENT_SIZE TARGET_PAGE_SIZE #define DEFAULT_ARCH bfd_arch_m68k -#define MY(OP) CAT(hp300bsd_,OP) +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (hp300bsd_,OP) #define TARGETNAME "a.out-hp300bsd" #include "bfd.h" diff -uprN binutils-2.11.90.0.31/bfd/hp300hpux.c binutils-2.11.92.0.5/bfd/hp300hpux.c --- binutils-2.11.90.0.31/bfd/hp300hpux.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/hp300hpux.c Thu Oct 4 14:35:43 2001 @@ -100,7 +100,11 @@ Foundation, Inc., 59 Temple Place - Suit This should also be fixed. */ #define TARGETNAME "a.out-hp300hpux" -#define MY(OP) CAT(hp300hpux_,OP) + +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (hp300hpux_,OP) #define external_exec hp300hpux_exec_bytes #define external_nlist hp300hpux_nlist_bytes @@ -123,7 +127,7 @@ Foundation, Inc., 59 Temple Place - Suit /* provide overrides for routines in this file */ /***********************************************/ /* these don't use MY because that causes problems within JUMP_TABLE - (CAT winds up being expanded recursively, which ANSI C compilers + (CONCAT2 winds up being expanded recursively, which ANSI C compilers will not do). */ #define MY_get_symtab hp300hpux_get_symtab #define MY_get_symtab_upper_bound hp300hpux_get_symtab_upper_bound @@ -181,7 +185,7 @@ Foundation, Inc., 59 Temple Place - Suit #define HP_RLENGTH_LONG 0x02 #define HP_RLENGTH_ALIGN 0x03 -#define NAME(x,y) CAT3(hp300hpux,_32_,y) +#define NAME(x,y) CONCAT3 (hp300hpux,_32_,y) #define ARCH_SIZE 32 /* aoutx.h requires definitions for BMAGIC and QMAGIC. */ @@ -301,10 +305,10 @@ MY (write_object_contents) (abfd) /* update fields not covered by default swap_exec_header_out */ /* this is really the sym table size but we store it in drelocs */ - bfd_h_put_32 (abfd, bfd_get_symcount (abfd) * 12, exec_bytes.e_drelocs); + H_PUT_32 (abfd, (bfd_get_symcount (abfd) * 12), exec_bytes.e_drelocs); - if (bfd_seek (abfd, 0L, false) != 0 - || (bfd_write ((PTR) & exec_bytes, 1, EXEC_BYTES_SIZE, abfd) + if (bfd_seek (abfd, (file_ptr) 0, false) != 0 + || (bfd_bwrite ((PTR) &exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, abfd) != EXEC_BYTES_SIZE)) return false; @@ -314,7 +318,7 @@ MY (write_object_contents) (abfd) if (bfd_get_symcount (abfd) != 0) { /* Skip the relocs to where we want to put the symbols. */ - if (bfd_seek (abfd, (file_ptr) N_DRELOFF (*execp) + execp->a_drsize, + if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (*execp) + execp->a_drsize), SEEK_SET) != 0) return false; } @@ -324,11 +328,11 @@ MY (write_object_contents) (abfd) if (bfd_get_symcount (abfd) != 0) { - if (bfd_seek (abfd, (long) (N_TRELOFF (*execp)), false) != 0) + if (bfd_seek (abfd, (file_ptr) N_TRELOFF (*execp), SEEK_CUR) != 0) return false; if (!NAME (aout,squirt_out_relocs) (abfd, obj_textsec (abfd))) return false; - if (bfd_seek (abfd, (long) (N_DRELOFF (*execp)), false) != 0) + if (bfd_seek (abfd, (file_ptr) N_DRELOFF (*execp), SEEK_CUR) != 0) return false; if (!NAME (aout,squirt_out_relocs) (abfd, obj_datasec (abfd))) return false; @@ -449,7 +453,7 @@ NAME (aout,swap_exec_header_in) (abfd, r are memcmp'd, and thus the contents do matter. */ memset (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_info = H_GET_32 (abfd, bytes->e_info); execp->a_text = GET_WORD (abfd, bytes->e_text); execp->a_data = GET_WORD (abfd, bytes->e_data); execp->a_bss = GET_WORD (abfd, bytes->e_bss); @@ -468,14 +472,16 @@ NAME (aout,swap_exec_header_in) (abfd, r { long syms; struct aout_data_struct *rawptr; - if (bfd_h_get_32 (abfd, bytes->e_passize) != 0) + bfd_size_type amt; + + if (H_GET_32 (abfd, bytes->e_passize) != 0) break; - if (bfd_h_get_32 (abfd, bytes->e_syms) != 0) + if (H_GET_32 (abfd, bytes->e_syms) != 0) break; - if (bfd_h_get_32 (abfd, bytes->e_supsize) != 0) + if (H_GET_32 (abfd, bytes->e_supsize) != 0) break; - syms = bfd_h_get_32 (abfd, bytes->e_drelocs); + syms = H_GET_32 (abfd, bytes->e_drelocs); if (syms == 0) break; @@ -483,7 +489,8 @@ NAME (aout,swap_exec_header_in) (abfd, r execp->a_syms = syms; /* allocate storage for where we will store this result */ - rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, sizeof (*rawptr)); + amt = sizeof (*rawptr); + rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, amt); if (rawptr == NULL) return; @@ -527,19 +534,20 @@ MY (slurp_symbol_table) (abfd) char *strings; aout_symbol_type *cached; unsigned num_syms = 0; + bfd_size_type amt; /* If there's no work to be done, don't do any */ if (obj_aout_symbols (abfd) != (aout_symbol_type *) NULL) return true; symbol_bytes = exec_hdr (abfd)->a_syms; - strings = (char *) bfd_alloc (abfd, - symbol_bytes + SYM_EXTRA_BYTES); + amt = symbol_bytes + SYM_EXTRA_BYTES; + strings = (char *) bfd_alloc (abfd, amt); if (!strings) return false; syms = (struct external_nlist *) (strings + SYM_EXTRA_BYTES); if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0 - || bfd_read ((PTR) syms, symbol_bytes, 1, abfd) != symbol_bytes) + || bfd_bread ((PTR) syms, symbol_bytes, abfd) != symbol_bytes) { bfd_release (abfd, syms); return false; @@ -558,10 +566,10 @@ MY (slurp_symbol_table) (abfd) /* now that we know the symbol count, update the bfd header */ bfd_get_symcount (abfd) = num_syms; - cached = ((aout_symbol_type *) - bfd_zalloc (abfd, - bfd_get_symcount (abfd) * sizeof (aout_symbol_type))); - if (cached == NULL && bfd_get_symcount (abfd) != 0) + amt = num_syms; + amt *= sizeof (aout_symbol_type); + cached = (aout_symbol_type *) bfd_zalloc (abfd, amt); + if (cached == NULL && num_syms != 0) return false; /* as we march thru the hp symbol table, convert it into a list of @@ -635,8 +643,8 @@ MY (swap_std_reloc_in) (abfd, bytes, cac int r_pcrel = 0; struct aoutdata *su = &(abfd->tdata.aout_data->a); - cache_ptr->address = bfd_h_get_32 (abfd, bytes->r_address); - r_index = bfd_h_get_16 (abfd, bytes->r_index); + cache_ptr->address = H_GET_32 (abfd, bytes->r_address); + r_index = H_GET_16 (abfd, bytes->r_index); switch (bytes->r_type[0]) { @@ -706,7 +714,7 @@ MY (slurp_reloc_table) (abfd, asect, sym sec_ptr asect; asymbol **symbols; { - unsigned int count; + bfd_size_type count; bfd_size_type reloc_size; PTR relocs; arelent *reloc_cache; @@ -743,8 +751,7 @@ doit: count = reloc_size / each_size; - reloc_cache = (arelent *) bfd_zalloc (abfd, (size_t) (count * sizeof - (arelent))); + reloc_cache = (arelent *) bfd_zalloc (abfd, count * sizeof (arelent)); if (!reloc_cache && count != 0) return false; @@ -755,7 +762,7 @@ doit: return false; } - if (bfd_read (relocs, 1, reloc_size, abfd) != reloc_size) + if (bfd_bread (relocs, reloc_size, abfd) != reloc_size) { bfd_release (abfd, relocs); bfd_release (abfd, reloc_cache); @@ -769,7 +776,7 @@ doit: for (; counter < count; counter++, rptr++, cache_ptr++) { MY (swap_std_reloc_in) (abfd, rptr, cache_ptr, symbols, - bfd_get_symcount (abfd)); + (bfd_size_type) bfd_get_symcount (abfd)); } bfd_release (abfd, relocs); diff -uprN binutils-2.11.90.0.31/bfd/hppabsd-core.c binutils-2.11.92.0.5/bfd/hppabsd-core.c --- binutils-2.11.90.0.31/bfd/hppabsd-core.c Fri Mar 9 11:16:00 2001 +++ binutils-2.11.92.0.5/bfd/hppabsd-core.c Mon Oct 1 15:25:21 2001 @@ -48,7 +48,7 @@ #include /* After a.out.h */ #include -static asection *make_bfd_asection PARAMS ((bfd *, CONST char *, +static asection *make_bfd_asection PARAMS ((bfd *, const char *, flagword, bfd_size_type, file_ptr, unsigned int)); static asymbol *hppabsd_core_make_empty_symbol PARAMS ((bfd *)); @@ -80,7 +80,7 @@ struct hppabsd_core_struct static asection * make_bfd_asection (abfd, name, flags, _raw_size, offset, alignment_power) bfd *abfd; - CONST char *name; + const char *name; flagword flags; bfd_size_type _raw_size; file_ptr offset; @@ -104,7 +104,9 @@ static asymbol * hppabsd_core_make_empty_symbol (abfd) bfd *abfd; { - asymbol *new = (asymbol *) bfd_zalloc (abfd, sizeof (asymbol)); + asymbol *new; + + new = (asymbol *) bfd_zalloc (abfd, (bfd_size_type) sizeof (asymbol)); if (new) new->the_bfd = abfd; return new; @@ -121,7 +123,7 @@ hppabsd_core_core_file_p (abfd) /* Try to read in the u-area. We will need information from this to know how to grok the rest of the core structures. */ - val = bfd_read ((void *) &u, 1, sizeof u, abfd); + val = bfd_bread ((void *) &u, (bfd_size_type) sizeof u, abfd); if (val != sizeof u) { if (bfd_get_error () != bfd_error_system_call) @@ -168,7 +170,7 @@ hppabsd_core_core_file_p (abfd) /* OK, we believe you. You're a core file (sure, sure). */ coredata = (struct hppabsd_core_struct *) - bfd_zalloc (abfd, sizeof (struct hppabsd_core_struct)); + bfd_zalloc (abfd, (bfd_size_type) sizeof (struct hppabsd_core_struct)); if (!coredata) return NULL; diff -uprN binutils-2.11.90.0.31/bfd/hpux-core.c binutils-2.11.92.0.5/bfd/hpux-core.c --- binutils-2.11.90.0.31/bfd/hpux-core.c Fri Mar 9 11:16:00 2001 +++ binutils-2.11.92.0.5/bfd/hpux-core.c Mon Oct 1 15:25:21 2001 @@ -100,12 +100,21 @@ struct hpux_core_struct #define core_kernel_thread_id(bfd) (core_hdr(bfd)->lwpid) #define core_user_thread_id(bfd) (core_hdr(bfd)->user_tid) +static asection *make_bfd_asection + PARAMS ((bfd *, const char *, flagword, bfd_size_type, bfd_vma, + unsigned int)); +static asymbol *hpux_core_make_empty_symbol PARAMS ((bfd *)); +static const bfd_target *hpux_core_core_file_p PARAMS ((bfd *)); +static char *hpux_core_core_file_failing_command PARAMS ((bfd *)); +static int hpux_core_core_file_failing_signal PARAMS ((bfd *)); +static boolean hpux_core_core_file_matches_executable_p + PARAMS ((bfd *, bfd *)); static void swap_abort PARAMS ((void)); static asection * make_bfd_asection (abfd, name, flags, _raw_size, vma, alignment_power) bfd *abfd; - CONST char *name; + const char *name; flagword flags; bfd_size_type _raw_size; bfd_vma vma; @@ -114,7 +123,7 @@ make_bfd_asection (abfd, name, flags, _r asection *asect; char *newname; - newname = bfd_alloc (abfd, strlen (name) + 1); + newname = bfd_alloc (abfd, (bfd_size_type) strlen (name) + 1); if (!newname) return NULL; @@ -137,7 +146,9 @@ static asymbol * hpux_core_make_empty_symbol (abfd) bfd *abfd; { - asymbol *new = (asymbol *) bfd_zalloc (abfd, sizeof (asymbol)); + asymbol *new; + + new = (asymbol *) bfd_zalloc (abfd, (bfd_size_type) sizeof (asymbol)); if (new) new->the_bfd = abfd; return new; @@ -160,7 +171,7 @@ hpux_core_core_file_p (abfd) int unknown_sections = 0; core_hdr (abfd) = (struct hpux_core_struct *) - bfd_zalloc (abfd, sizeof (struct hpux_core_struct)); + bfd_zalloc (abfd, (bfd_size_type) sizeof (struct hpux_core_struct)); if (!core_hdr (abfd)) return NULL; @@ -169,21 +180,23 @@ hpux_core_core_file_p (abfd) int val; struct corehead core_header; - val = bfd_read ((void *) &core_header, 1, sizeof core_header, abfd); + val = bfd_bread ((void *) &core_header, + (bfd_size_type) sizeof core_header, abfd); if (val <= 0) break; switch (core_header.type) { case CORE_KERNEL: case CORE_FORMAT: - bfd_seek (abfd, core_header.len, SEEK_CUR); /* Just skip this */ + /* Just skip this. */ + bfd_seek (abfd, (file_ptr) core_header.len, SEEK_CUR); good_sections++; break; case CORE_EXEC: { struct proc_exec proc_exec; - if (bfd_read ((void *) &proc_exec, 1, core_header.len, abfd) - != core_header.len) + if (bfd_bread ((void *) &proc_exec, (bfd_size_type) core_header.len, + abfd) != core_header.len) break; strncpy (core_command (abfd), proc_exec.cmd, MAXCOMLEN + 1); good_sections++; @@ -197,13 +210,13 @@ hpux_core_core_file_p (abfd) /* We need to read this section, 'cause we need to determine whether the core-dumped app was threaded before we create any .reg sections. */ - if (bfd_read (&proc_info, 1, core_header.len, abfd) + if (bfd_bread (&proc_info, (bfd_size_type) core_header.len, abfd) != core_header.len) break; /* However, we also want to create those sections with the file positioned at the start of the record, it seems. */ - if (bfd_seek (abfd, -core_header.len, SEEK_CUR) != 0) + if (bfd_seek (abfd, (file_ptr) -core_header.len, SEEK_CUR) != 0) break; #if defined(PROC_INFO_HAS_THREAD_ID) @@ -258,7 +271,7 @@ hpux_core_core_file_p (abfd) return NULL; } core_signal (abfd) = proc_info.sig; - if (bfd_seek (abfd, core_header.len, SEEK_CUR) != 0) + if (bfd_seek (abfd, (file_ptr) core_header.len, SEEK_CUR) != 0) break; good_sections++; } @@ -275,7 +288,7 @@ hpux_core_core_file_p (abfd) core_header.len, core_header.addr, 2)) return NULL; - bfd_seek (abfd, core_header.len, SEEK_CUR); + bfd_seek (abfd, (file_ptr) core_header.len, SEEK_CUR); good_sections++; break; @@ -327,7 +340,8 @@ hpux_core_core_file_failing_signal (abfd /* ARGSUSED */ static boolean hpux_core_core_file_matches_executable_p (core_bfd, exec_bfd) - bfd *core_bfd, *exec_bfd; + bfd *core_bfd ATTRIBUTE_UNUSED; + bfd *exec_bfd ATTRIBUTE_UNUSED; { return true; /* FIXME, We have no way of telling at this point */ } @@ -346,7 +360,7 @@ hpux_core_core_file_matches_executable_p /* If somebody calls any byte-swapping routines, shoot them. */ static void -swap_abort() +swap_abort () { abort(); /* This way doesn't require any declaration for ANSI to fuck up */ } diff -uprN binutils-2.11.90.0.31/bfd/i386aout.c binutils-2.11.92.0.5/bfd/i386aout.c --- binutils-2.11.90.0.31/bfd/i386aout.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/i386aout.c Thu Oct 4 14:35:43 2001 @@ -19,7 +19,7 @@ along with this program; if not, write t Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* The only 386 aout system we have here is GO32 from DJ. +/* The only 386 aout system we have here is GO32 from DJ. These numbers make BFD work with that. If your aout 386 system doesn't work with these, we'll have to split them into different files. Send me (sac@cygnus.com) the runes to make it work on your @@ -41,7 +41,10 @@ Foundation, Inc., 59 Temple Place - Suit #define SEGMENT_SIZE 0x400000 #define DEFAULT_ARCH bfd_arch_i386 -#define MY(OP) CAT(i386aout_,OP) +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (i386aout_,OP) #define TARGETNAME "a.out-i386" #define NO_WRITE_HEADER_KLUDGE 1 @@ -75,7 +78,7 @@ i386aout_write_object_contents (abfd) #define MY_write_object_contents i386aout_write_object_contents #define MY_backend_data &MY(backend_data) -static CONST struct aout_backend_data MY(backend_data) = { +static const struct aout_backend_data MY(backend_data) = { 0, /* zmagic contiguous */ 1, /* text incl header */ 0, /* entry is text address */ diff -uprN binutils-2.11.90.0.31/bfd/i386bsd.c binutils-2.11.92.0.5/bfd/i386bsd.c --- binutils-2.11.90.0.31/bfd/i386bsd.c Fri Mar 9 11:16:00 2001 +++ binutils-2.11.92.0.5/bfd/i386bsd.c Thu Oct 4 14:35:43 2001 @@ -1,5 +1,6 @@ /* BFD back-end for i386 a.out binaries under BSD. - Copyright 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. + Copyright 1990, 1991, 1992, 1993, 1994, 2001 + Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -35,7 +36,10 @@ Foundation, Inc., 59 Temple Place - Suit #define DEFAULT_ARCH bfd_arch_i386 #define MACHTYPE_OK(mtype) ((mtype) == M_386 || (mtype) == M_UNKNOWN) -#define MY(OP) CAT(i386bsd_,OP) +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (i386bsd_,OP) #define TARGETNAME "a.out-i386-bsd" #include "bfd.h" diff -uprN binutils-2.11.90.0.31/bfd/i386dynix.c binutils-2.11.92.0.5/bfd/i386dynix.c --- binutils-2.11.90.0.31/bfd/i386dynix.c Fri Mar 9 11:16:00 2001 +++ binutils-2.11.92.0.5/bfd/i386dynix.c Thu Oct 4 14:35:43 2001 @@ -1,5 +1,5 @@ /* BFD back-end for i386 a.out binaries under dynix. - Copyright 1994, 1995 Free Software Foundation, Inc. + Copyright 1994, 1995, 2001 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -31,9 +31,12 @@ Foundation, Inc., 59 Temple Place - Suit #define DEFAULT_ARCH bfd_arch_i386 #define MACHTYPE_OK(mtype) ((mtype) == M_386 || (mtype) == M_UNKNOWN) -#define MY(OP) CAT(i386dynix_,OP) +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (i386dynix_,OP) #define TARGETNAME "a.out-i386-dynix" -#define NAME(x,y) CAT3(i386dynix,_32_,y) +#define NAME(x,y) CONCAT3 (i386dynix,_32_,y) #define ARCH_SIZE 32 #define NAME_swap_exec_header_in NAME(i386dynix_32_,swap_exec_header_in) #define MY_get_section_contents aout_32_get_section_contents @@ -65,7 +68,7 @@ i386dynix_32_swap_exec_header_in (abfd, are memcmp'd, and thus the contents do matter. */ 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_info = H_GET_32 (abfd, bytes->e_info); execp->a_text = GET_WORD (abfd, bytes->e_text); execp->a_data = GET_WORD (abfd, bytes->e_data); execp->a_bss = GET_WORD (abfd, bytes->e_bss); diff -uprN binutils-2.11.90.0.31/bfd/i386freebsd.c binutils-2.11.92.0.5/bfd/i386freebsd.c --- binutils-2.11.90.0.31/bfd/i386freebsd.c Fri Mar 9 11:16:00 2001 +++ binutils-2.11.92.0.5/bfd/i386freebsd.c Thu Oct 4 14:35:43 2001 @@ -1,5 +1,5 @@ /* BFD back-end for FreeBSD/386 a.out-ish binaries. - Copyright 1990, 1991, 1992, 1996 Free Software Foundation, Inc. + Copyright 1990, 1991, 1992, 1996, 2001 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -26,7 +26,11 @@ Foundation, Inc., 59 Temple Place - Suit #define DEFAULT_ARCH bfd_arch_i386 #define MACHTYPE_OK(mtype) ((mtype) == M_386_NETBSD || (mtype) == M_UNKNOWN) -#define MY(OP) CAT(i386freebsd_,OP) +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (i386freebsd_,OP) + /* This needs to start with a.out so GDB knows it is an a.out variant. */ #define TARGETNAME "a.out-i386-freebsd" diff -uprN binutils-2.11.90.0.31/bfd/i386linux.c binutils-2.11.92.0.5/bfd/i386linux.c --- binutils-2.11.90.0.31/bfd/i386linux.c Fri Mar 9 11:16:00 2001 +++ binutils-2.11.92.0.5/bfd/i386linux.c Thu Oct 4 14:35:43 2001 @@ -1,5 +1,5 @@ /* BFD back-end for linux flavored i386 a.out binaries. - Copyright 1992, 1993, 1994, 1995, 1996, 1997 + Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2001 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -36,7 +36,11 @@ Foundation, Inc., 59 Temple Place - Suit #include "libaout.h" /* BFD a.out internal data structures */ #define DEFAULT_ARCH bfd_arch_i386 -#define MY(OP) CAT(i386linux_,OP) + +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (i386linux_,OP) #define TARGETNAME "a.out-i386-linux" extern const bfd_target MY(vec); @@ -223,9 +227,9 @@ linux_link_hash_table_create (abfd) bfd *abfd; { struct linux_link_hash_table *ret; + bfd_size_type amt = sizeof (struct linux_link_hash_table); - ret = ((struct linux_link_hash_table *) - bfd_alloc (abfd, sizeof (struct linux_link_hash_table))); + ret = (struct linux_link_hash_table *) bfd_alloc (abfd, amt); if (ret == (struct linux_link_hash_table *) NULL) return (struct bfd_link_hash_table *) NULL; if (! NAME(aout,link_hash_table_init) (&ret->root, abfd, @@ -405,7 +409,8 @@ linux_add_one_symbol (info, abfd, name, if (! (_bfd_generic_link_add_one_symbol (info, linux_hash_table (info)->dynobj, SHARABLE_CONFLICTS, - BSF_GLOBAL | BSF_CONSTRUCTOR, s, 0, NULL, false, false, NULL))) + BSF_GLOBAL | BSF_CONSTRUCTOR, s, (bfd_vma) 0, NULL, + false, false, NULL))) return false; } @@ -444,7 +449,7 @@ linux_tally_symbols (h, data) name = h->root.root.root.string + sizeof NEEDS_SHRLIB - 1; p = strrchr (name, '_'); if (p != NULL) - alloc = (char *) bfd_malloc (strlen (name) + 1); + alloc = (char *) bfd_malloc ((bfd_size_type) strlen (name) + 1); if (p == NULL || alloc == NULL) (*_bfd_error_handler) (_("Output file requires shared library `%s'\n"), @@ -476,7 +481,7 @@ linux_tally_symbols (h, data) + sizeof PLT_REF_PREFIX - 1), false, false, true); /* h2 does not follow indirect symbols. */ - h2 = linux_link_hash_lookup (linux_hash_table (info), + h2 = linux_link_hash_lookup (linux_hash_table (info), (h->root.root.root.string + sizeof PLT_REF_PREFIX - 1), false, false, false); @@ -587,7 +592,8 @@ bfd_i386linux_size_dynamic_sections (out ".linux-dynamic"); if (s != NULL) { - s->_raw_size = 8 + linux_hash_table (info)->fixup_count * 8; + s->_raw_size = linux_hash_table (info)->fixup_count + 1; + s->_raw_size *= 8; s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size); if (s->contents == NULL) return false; @@ -624,13 +630,14 @@ linux_finish_dynamic_link (output_bfd, i fixups_written = 0; #ifdef LINUX_LINK_DEBUG - printf ("Fixup table file offset: %x VMA: %x\n", + printf ("Fixup table file offset: %x VMA: %x\n", os->filepos + s->output_offset, os->vma + s->output_offset); #endif fixup_table = s->contents; - bfd_put_32 (output_bfd, linux_hash_table (info)->fixup_count, fixup_table); + bfd_put_32 (output_bfd, + (bfd_vma) linux_hash_table (info)->fixup_count, fixup_table); fixup_table += 4; /* Fill in fixup table. */ @@ -660,15 +667,15 @@ linux_finish_dynamic_link (output_bfd, i if (f->jump) { /* Relative address */ - new_addr = new_addr - (f->value + 5); - bfd_put_32 (output_bfd, new_addr, fixup_table); + new_addr = new_addr - (f->value + 5); + bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table); fixup_table += 4; bfd_put_32 (output_bfd, f->value + 1, fixup_table); fixup_table += 4; } else { - bfd_put_32 (output_bfd, new_addr, fixup_table); + bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table); fixup_table += 4; bfd_put_32 (output_bfd, f->value, fixup_table); fixup_table += 4; @@ -679,9 +686,9 @@ linux_finish_dynamic_link (output_bfd, i if (linux_hash_table (info)->local_builtins != 0) { /* Special marker so we know to switch to the other type of fixup */ - bfd_put_32 (output_bfd, 0, fixup_table); + bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table); fixup_table += 4; - bfd_put_32 (output_bfd, 0, fixup_table); + bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table); fixup_table += 4; ++fixups_written; for (f = linux_hash_table (info)->fixup_list; f != NULL; f = f->next) @@ -707,7 +714,7 @@ linux_finish_dynamic_link (output_bfd, i new_addr, f->value); #endif - bfd_put_32 (output_bfd, new_addr, fixup_table); + bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table); fixup_table += 4; bfd_put_32 (output_bfd, f->value, fixup_table); fixup_table += 4; @@ -720,15 +727,15 @@ linux_finish_dynamic_link (output_bfd, i (*_bfd_error_handler) (_("Warning: fixup count mismatch\n")); while (linux_hash_table (info)->fixup_count > fixups_written) { - bfd_put_32 (output_bfd, 0, fixup_table); + bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table); fixup_table += 4; - bfd_put_32 (output_bfd, 0, fixup_table); + bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table); fixup_table += 4; ++fixups_written; } } - h = linux_link_hash_lookup (linux_hash_table (info), + h = linux_link_hash_lookup (linux_hash_table (info), "__BUILTIN_FIXUPS__", false, false, false); @@ -744,16 +751,16 @@ linux_finish_dynamic_link (output_bfd, i printf ("Builtin fixup table at %x\n", new_addr); #endif - bfd_put_32 (output_bfd, new_addr, fixup_table); + bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table); } else - bfd_put_32 (output_bfd, 0, fixup_table); + bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table); - if (bfd_seek (output_bfd, os->filepos + s->output_offset, SEEK_SET) != 0) + if (bfd_seek (output_bfd, (file_ptr) (os->filepos + s->output_offset), + SEEK_SET) != 0) return false; - if (bfd_write ((PTR) s->contents, 1, s->_raw_size, output_bfd) - != s->_raw_size) + if (bfd_bwrite ((PTR) s->contents, s->_raw_size, output_bfd) != s->_raw_size) return false; return true; diff -uprN binutils-2.11.90.0.31/bfd/i386lynx.c binutils-2.11.92.0.5/bfd/i386lynx.c --- binutils-2.11.90.0.31/bfd/i386lynx.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/i386lynx.c Thu Oct 4 14:35:43 2001 @@ -26,7 +26,10 @@ Foundation, Inc., 59 Temple Place - Suit #define SEGMENT_SIZE TARGET_PAGE_SIZE #define DEFAULT_ARCH bfd_arch_i386 -#define MY(OP) CAT(i386lynx_aout_,OP) +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (i386lynx_aout_,OP) #define TARGETNAME "a.out-i386-lynx" #include "bfd.h" @@ -50,31 +53,31 @@ Foundation, Inc., 59 Temple Place - Suit obj_reloc_entry_size (abfd)); \ NAME(aout,swap_exec_header_out) (abfd, execp, &exec_bytes); \ \ - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) return false; \ - if (bfd_write ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd) \ - != EXEC_BYTES_SIZE) \ + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 \ + || bfd_bwrite ((PTR) &exec_bytes, (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(*execp)), SEEK_SET) \ + if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*execp)), SEEK_SET) \ != 0) \ return false; \ \ - if (! NAME(aout,write_syms)(abfd)) return false; \ + if (! NAME(aout,write_syms) (abfd)) return false; \ \ - if (bfd_seek (abfd, (file_ptr)(N_TRELOFF(*execp)), SEEK_SET) \ + if (bfd_seek (abfd, (file_ptr) (N_TRELOFF(*execp)), SEEK_SET) \ != 0) \ return false; \ \ if (!NAME(lynx,squirt_out_relocs) (abfd, obj_textsec (abfd))) \ return false; \ - if (bfd_seek (abfd, (file_ptr)(N_DRELOFF(*execp)), SEEK_SET) \ + if (bfd_seek (abfd, (file_ptr) (N_DRELOFF(*execp)), SEEK_SET) \ != 0) \ return 0; \ \ - if (!NAME(lynx,squirt_out_relocs)(abfd, obj_datasec (abfd))) \ + if (!NAME(lynx,squirt_out_relocs) (abfd, obj_datasec (abfd))) \ return false; \ } \ } @@ -366,7 +369,7 @@ NAME(lynx,swap_std_reloc_in) (abfd, byte int r_baserel, r_jmptable, r_relative; struct aoutdata *su = &(abfd->tdata.aout_data->a); - cache_ptr->address = bfd_h_get_32 (abfd, bytes->r_address); + cache_ptr->address = H_GET_32 (abfd, bytes->r_address); r_index = bytes->r_index[1]; r_extern = (0 != (bytes->r_index[0] & RELOC_STD_BITS_EXTERN_BIG)); @@ -391,7 +394,7 @@ NAME(lynx,slurp_reloc_table) (abfd, asec sec_ptr asect; asymbol **symbols; { - unsigned int count; + bfd_size_type count; bfd_size_type reloc_size; PTR relocs; arelent *reloc_cache; @@ -429,7 +432,7 @@ doit: reloc_cache = (arelent *) bfd_malloc (count * sizeof (arelent)); if (!reloc_cache && count != 0) return false; - memset (reloc_cache, 0, count * sizeof (arelent)); + memset (reloc_cache, 0, (size_t) count * sizeof (arelent)); relocs = (PTR) bfd_alloc (abfd, reloc_size); if (!relocs && reloc_size != 0) @@ -438,7 +441,7 @@ doit: return false; } - if (bfd_read (relocs, 1, reloc_size, abfd) != reloc_size) + if (bfd_bread (relocs, reloc_size, abfd) != reloc_size) { bfd_release (abfd, relocs); free (reloc_cache); @@ -454,7 +457,7 @@ doit: for (; counter < count; counter++, rptr++, cache_ptr++) { NAME(lynx,swap_ext_reloc_in) (abfd, rptr, cache_ptr, symbols, - bfd_get_symcount (abfd)); + (bfd_size_type) bfd_get_symcount (abfd)); } } else @@ -466,7 +469,7 @@ doit: for (; counter < count; counter++, rptr++, cache_ptr++) { NAME(lynx,swap_std_reloc_in) (abfd, rptr, cache_ptr, symbols, - bfd_get_symcount (abfd)); + (bfd_size_type) bfd_get_symcount (abfd)); } } @@ -491,13 +494,14 @@ NAME(lynx,squirt_out_relocs) (abfd, sect size_t each_size; unsigned int count = section->reloc_count; - size_t natsize; + bfd_size_type natsize; if (count == 0) return true; each_size = obj_reloc_entry_size (abfd); - natsize = each_size * count; + natsize = count; + natsize *= each_size; native = (unsigned char *) bfd_zalloc (abfd, natsize); if (!native) return false; @@ -519,7 +523,7 @@ NAME(lynx,squirt_out_relocs) (abfd, sect NAME(lynx,swap_std_reloc_out) (abfd, *generic, (struct reloc_std_external *) natptr); } - if (bfd_write ((PTR) native, 1, natsize, abfd) != natsize) + if (bfd_bwrite ((PTR) native, natsize, abfd) != natsize) { bfd_release (abfd, native); return false; diff -uprN binutils-2.11.90.0.31/bfd/i386mach3.c binutils-2.11.92.0.5/bfd/i386mach3.c --- binutils-2.11.90.0.31/bfd/i386mach3.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/i386mach3.c Thu Oct 4 14:35:43 2001 @@ -43,12 +43,16 @@ Foundation, Inc., 59 Temple Place - Suit #include "libaout.h" /* BFD a.out internal data structures */ #define DEFAULT_ARCH bfd_arch_i386 -#define MY(OP) CAT(i386mach3_,OP) + +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (i386mach3_,OP) #define TARGETNAME "a.out-mach3" static boolean MY (set_sizes) PARAMS ((bfd *)); #define MY_backend_data &MY(backend_data) -static CONST struct aout_backend_data MY(backend_data) = { +static const struct aout_backend_data MY(backend_data) = { 0, /* zmagic contiguous */ 1, /* text incl header */ 0, /* entry is text address */ diff -uprN binutils-2.11.90.0.31/bfd/i386msdos.c binutils-2.11.92.0.5/bfd/i386msdos.c --- binutils-2.11.90.0.31/bfd/i386msdos.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/i386msdos.c Mon Oct 1 15:25:21 2001 @@ -107,27 +107,26 @@ msdos_write_object_contents (abfd) } /* Constants. */ - bfd_h_put_16(abfd, EXE_MAGIC, &hdr[0]); - bfd_h_put_16(abfd, EXE_PAGE_SIZE / 16, &hdr[8]); - bfd_h_put_16(abfd, EXE_LOAD_LOW, &hdr[12]); - bfd_h_put_16(abfd, 0x3e, &hdr[24]); - bfd_h_put_16(abfd, 0x0001, &hdr[28]); /* XXX??? */ - bfd_h_put_16(abfd, 0x30fb, &hdr[30]); /* XXX??? */ - bfd_h_put_16(abfd, 0x726a, &hdr[32]); /* XXX??? */ + H_PUT_16 (abfd, EXE_MAGIC, &hdr[0]); + H_PUT_16 (abfd, EXE_PAGE_SIZE / 16, &hdr[8]); + H_PUT_16 (abfd, EXE_LOAD_LOW, &hdr[12]); + H_PUT_16 (abfd, 0x3e, &hdr[24]); + H_PUT_16 (abfd, 0x0001, &hdr[28]); /* XXX??? */ + H_PUT_16 (abfd, 0x30fb, &hdr[30]); /* XXX??? */ + H_PUT_16 (abfd, 0x726a, &hdr[32]); /* XXX??? */ /* Bytes in last page (0 = full page). */ - bfd_h_put_16(abfd, outfile_size & (EXE_PAGE_SIZE - 1), &hdr[2]); + H_PUT_16 (abfd, outfile_size & (EXE_PAGE_SIZE - 1), &hdr[2]); /* Number of pages. */ - bfd_h_put_16(abfd, (outfile_size + EXE_PAGE_SIZE - 1) / EXE_PAGE_SIZE, - &hdr[4]); + H_PUT_16 (abfd, (outfile_size + EXE_PAGE_SIZE - 1) / EXE_PAGE_SIZE, &hdr[4]); /* Set the initial stack pointer to the end of the bss. The program's crt0 code must relocate it to a real stack. */ - bfd_h_put_16(abfd, high_vma, &hdr[16]); + H_PUT_16 (abfd, high_vma, &hdr[16]); if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 - || bfd_write (hdr, 1, sizeof(hdr), abfd) != sizeof(hdr)) + || bfd_bwrite (hdr, (bfd_size_type) sizeof(hdr), abfd) != sizeof(hdr)) return false; return true; @@ -149,8 +148,8 @@ msdos_set_section_contents (abfd, sectio if (bfd_get_section_flags (abfd, section) & SEC_LOAD) { - if (bfd_seek (abfd, (file_ptr) (section->filepos + offset), SEEK_SET) != 0 - || bfd_write (location, 1, count, abfd) != count) + if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0 + || bfd_bwrite (location, count, abfd) != count) return false; } @@ -244,7 +243,7 @@ const bfd_target i386msdos_vec = BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), NULL, - + (PTR) 0 }; diff -uprN binutils-2.11.90.0.31/bfd/i386netbsd.c binutils-2.11.92.0.5/bfd/i386netbsd.c --- binutils-2.11.90.0.31/bfd/i386netbsd.c Fri Mar 9 11:16:00 2001 +++ binutils-2.11.92.0.5/bfd/i386netbsd.c Thu Oct 4 14:35:43 2001 @@ -1,5 +1,5 @@ /* BFD back-end for NetBSD/386 a.out-ish binaries. - Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1998 + Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1998, 2001 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -27,7 +27,11 @@ Foundation, Inc., 59 Temple Place - Suit #define DEFAULT_ARCH bfd_arch_i386 #define DEFAULT_MID M_386_NETBSD -#define MY(OP) CAT(i386netbsd_,OP) +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (i386netbsd_,OP) + /* This needs to start with a.out so GDB knows it is an a.out variant. */ #define TARGETNAME "a.out-i386-netbsd" diff -uprN binutils-2.11.90.0.31/bfd/i386os9k.c binutils-2.11.92.0.5/bfd/i386os9k.c --- binutils-2.11.90.0.31/bfd/i386os9k.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/i386os9k.c Mon Oct 1 15:25:21 2001 @@ -44,28 +44,28 @@ os9k_swap_exec_header_in (abfd, raw_byte unsigned int dload, dmemsize, dmemstart; /* Now fill in fields in the execp, from the bytes in the raw data. */ - execp->a_info = bfd_h_get_16 (abfd, bytes->m_sync); + execp->a_info = H_GET_16 (abfd, bytes->m_sync); execp->a_syms = 0; - execp->a_entry = bfd_h_get_32 (abfd, bytes->m_exec); + execp->a_entry = H_GET_32 (abfd, bytes->m_exec); execp->a_talign = 2; execp->a_dalign = 2; execp->a_balign = 2; - dload = bfd_h_get_32 (abfd, bytes->m_idata); + dload = H_GET_32 (abfd, bytes->m_idata); execp->a_data = dload + 8; if (bfd_seek (abfd, (file_ptr) dload, SEEK_SET) != 0 - || (bfd_read (&dmemstart, sizeof (dmemstart), 1, abfd) + || (bfd_bread (&dmemstart, (bfd_size_type) sizeof (dmemstart), abfd) != sizeof (dmemstart)) - || (bfd_read (&dmemsize, sizeof (dmemsize), 1, abfd) + || (bfd_bread (&dmemsize, (bfd_size_type) sizeof (dmemsize), abfd) != sizeof (dmemsize))) return false; execp->a_tload = 0; - execp->a_dload = bfd_h_get_32 (abfd, (unsigned char *) &dmemstart); + execp->a_dload = H_GET_32 (abfd, (unsigned char *) &dmemstart); execp->a_text = dload - execp->a_tload; - execp->a_data = bfd_h_get_32 (abfd, (unsigned char *) &dmemsize); - execp->a_bss = bfd_h_get_32 (abfd, bytes->m_data) - execp->a_data; + execp->a_data = H_GET_32 (abfd, (unsigned char *) &dmemsize); + execp->a_bss = H_GET_32 (abfd, bytes->m_data) - execp->a_data; execp->a_trsize = 0; execp->a_drsize = 0; @@ -77,10 +77,9 @@ os9k_swap_exec_header_in (abfd, raw_byte /* Swaps the information in an internal exec header structure into the supplied buffer ready for writing to disk. */ -PROTO (void, os9k_swap_exec_header_out, - (bfd * abfd, - struct internal_exec * execp, - struct mh_com * raw_bytes)); +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; @@ -90,16 +89,16 @@ os9k_swap_exec_header_out (abfd, execp, mh_com *bytes = (mh_com *) raw_bytes; /* 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); - bfd_h_put_32 (abfd, execp->a_text, bytes->e_text); - bfd_h_put_32 (abfd, execp->a_data, bytes->e_data); - bfd_h_put_32 (abfd, execp->a_bss, bytes->e_bss); - bfd_h_put_32 (abfd, execp->a_syms, bytes->e_syms); - bfd_h_put_32 (abfd, execp->a_entry, bytes->e_entry); - bfd_h_put_32 (abfd, execp->a_trsize, bytes->e_trsize); - bfd_h_put_32 (abfd, execp->a_drsize, bytes->e_drsize); - bfd_h_put_32 (abfd, execp->a_tload, bytes->e_tload); - bfd_h_put_32 (abfd, execp->a_dload, bytes->e_dload); + 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; @@ -115,7 +114,7 @@ os9k_object_p (abfd) struct internal_exec anexec; mh_com exec_bytes; - if (bfd_read ((PTR) & exec_bytes, MHCOM_BYTES_SIZE, 1, abfd) + if (bfd_bread ((PTR) &exec_bytes, (bfd_size_type) MHCOM_BYTES_SIZE, abfd) != MHCOM_BYTES_SIZE) { if (bfd_get_error () != bfd_error_system_call) @@ -123,7 +122,7 @@ os9k_object_p (abfd) return 0; } - anexec.a_info = bfd_h_get_16 (abfd, exec_bytes.m_sync); + anexec.a_info = H_GET_16 (abfd, exec_bytes.m_sync); if (N_BADMAG (anexec)) { bfd_set_error (bfd_error_wrong_format); @@ -199,8 +198,9 @@ 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, sizeof (struct bout_data_struct)); + rawptr = (struct bout_data_struct *) bfd_zalloc (abfd, amt); if (rawptr == NULL) return false; @@ -245,8 +245,8 @@ os9k_write_object_contents (abfd) bout_swap_exec_header_out (abfd, exec_hdr (abfd), &swapped_hdr); if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 - || (bfd_write ((PTR) & swapped_hdr, 1, EXEC_BYTES_SIZE, abfd) - != EXEC_BYTES_SIZE)) + || 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. */ @@ -299,7 +299,7 @@ os9k_set_section_contents (abfd, section return false; if (count != 0) - return (bfd_write ((PTR) location, 1, count, abfd) == count) ? true : false; + return bfd_bwrite ((PTR) location, (bfd_size_type) count, abfd) == count; return true; } @@ -368,7 +368,7 @@ const bfd_target i386os9k_vec = BFD_JUMP_TABLE_WRITE (aout_32), BFD_JUMP_TABLE_LINK (os9k), BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), - + NULL, (PTR) 0, diff -uprN binutils-2.11.90.0.31/bfd/ieee.c binutils-2.11.92.0.5/bfd/ieee.c --- binutils-2.11.90.0.31/bfd/ieee.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/ieee.c Mon Oct 1 15:25:21 2001 @@ -32,8 +32,7 @@ Foundation, Inc., 59 Temple Place - Suit #include "libbfd.h" #include "ieee.h" #include "libieee.h" - -#include +#include "safe-ctype.h" struct output_buffer_struct { @@ -61,7 +60,7 @@ static void parse_expression static file_ptr ieee_part_after PARAMS ((ieee_data_type *, file_ptr)); static ieee_symbol_type *get_symbol PARAMS ((bfd *, ieee_data_type *, ieee_symbol_type *, unsigned int *, - ieee_symbol_type ***, unsigned int *, char)); + ieee_symbol_type ***, unsigned int *, int)); static boolean ieee_slurp_external_symbols PARAMS ((bfd *)); static boolean ieee_slurp_symbol_table PARAMS ((bfd *)); static long ieee_get_symtab_upper_bound PARAMS ((bfd *)); @@ -135,7 +134,7 @@ ieee_write_byte (abfd, barg) bfd_byte byte; byte = barg; - if (bfd_write ((PTR) &byte, 1, 1, abfd) != 1) + if (bfd_bwrite ((PTR) &byte, (bfd_size_type) 1, abfd) != 1) return false; return true; } @@ -149,7 +148,7 @@ ieee_write_2bytes (abfd, bytes) buffer[0] = bytes >> 8; buffer[1] = bytes & 0xff; - if (bfd_write ((PTR) buffer, 1, 2, abfd) != 2) + if (bfd_bwrite ((PTR) buffer, (bfd_size_type) 2, abfd) != 2) return false; return true; } @@ -239,7 +238,7 @@ ieee_write_id (abfd, id) return false; } - if (bfd_write ((PTR) id, 1, length, abfd) != length) + if (bfd_bwrite ((PTR) id, (bfd_size_type) length, abfd) != length) return false; return true; } @@ -298,7 +297,7 @@ read_id (ieee) length = (length * 256) + this_byte_and_next (ieee); } /* Buy memory and read string */ - string = bfd_alloc (ieee->abfd, length + 1); + string = bfd_alloc (ieee->abfd, (bfd_size_type) length + 1); if (!string) return NULL; bfd_get_string (ieee, string, length); @@ -384,7 +383,7 @@ ieee_write_expression (abfd, value, symb /* Handle the degenerate case of a 0 address. */ if (term_count == 0) { - if (! ieee_write_int (abfd, 0)) + if (! ieee_write_int (abfd, (bfd_vma) 0)) return false; } @@ -423,7 +422,7 @@ ieee_write_int5_out (abfd, value) bfd_byte b[5]; ieee_write_int5 (b, value); - if (bfd_write ((PTR) b, 1, 5, abfd) != 5) + if (bfd_bwrite ((PTR) b, (bfd_size_type) 5, abfd) != 5) return false; return true; } @@ -775,14 +774,16 @@ get_symbol (abfd, ieee, last_symbol, sym unsigned int *symbol_count; ieee_symbol_type ***pptr; unsigned int *max_index; - char this_type; + int this_type; { /* Need a new symbol */ unsigned int new_index = must_parse_int (&(ieee->h)); if (new_index != last_index || this_type != last_type) { - ieee_symbol_type *new_symbol = (ieee_symbol_type *) bfd_alloc (ieee->h.abfd, - sizeof (ieee_symbol_type)); + ieee_symbol_type *new_symbol; + bfd_size_type amt = sizeof (ieee_symbol_type); + + new_symbol = (ieee_symbol_type *) bfd_alloc (ieee->h.abfd, amt); if (!new_symbol) return NULL; @@ -874,7 +875,7 @@ ieee_slurp_external_symbols (abfd) default: (*_bfd_error_handler) (_("%s: unimplemented ATI record %u for symbol %u"), - bfd_get_filename (abfd), symbol_attribute_def, + bfd_archive_filename (abfd), symbol_attribute_def, symbol_name_index); bfd_set_error (bfd_error_bad_value); return false; @@ -899,7 +900,7 @@ ieee_slurp_external_symbols (abfd) { (*_bfd_error_handler) (_("%s: unexpected ATN type %d in external part"), - bfd_get_filename (abfd), (int) value); + bfd_archive_filename (abfd), (int) value); bfd_set_error (bfd_error_bad_value); return false; } @@ -921,7 +922,7 @@ ieee_slurp_external_symbols (abfd) default: (*_bfd_error_handler) (_("%s: unexpected type after ATN"), - bfd_get_filename (abfd)); + bfd_archive_filename (abfd)); bfd_set_error (bfd_error_bad_value); return false; } @@ -1161,6 +1162,7 @@ get_section_entry (abfd, ieee, index) { unsigned int c, i; asection **n; + bfd_size_type amt; c = ieee->section_table_size; if (c == 0) @@ -1168,8 +1170,9 @@ get_section_entry (abfd, ieee, index) while (c <= index) c *= 2; - n = ((asection **) - bfd_realloc (ieee->section_table, c * sizeof (asection *))); + amt = c; + amt *= sizeof (asection *); + n = (asection **) bfd_realloc (ieee->section_table, amt); if (n == NULL) return NULL; @@ -1182,7 +1185,7 @@ get_section_entry (abfd, ieee, index) if (ieee->section_table[index] == (asection *) NULL) { - char *tmp = bfd_alloc (abfd, 11); + char *tmp = bfd_alloc (abfd, (bfd_size_type) 11); asection *section; if (!tmp) @@ -1203,7 +1206,6 @@ ieee_slurp_sections (abfd) { ieee_data_type *ieee = IEEE_DATA (abfd); file_ptr offset = ieee->w.r.section_part; - asection *section = (asection *) NULL; char *name; if (offset != 0) @@ -1216,6 +1218,7 @@ ieee_slurp_sections (abfd) { case ieee_section_type_enum: { + asection *section; unsigned int section_index; next_byte (&(ieee->h)); section_index = must_parse_int (&(ieee->h)); @@ -1315,8 +1318,10 @@ ieee_slurp_sections (abfd) break; case ieee_e2_first_byte_enum: { - ieee_record_enum_type t = (ieee_record_enum_type) (read_2bytes (&(ieee->h))); + asection *section; + ieee_record_enum_type t; + t = (ieee_record_enum_type) (read_2bytes (&(ieee->h))); switch (t) { case ieee_section_size_enum: @@ -1403,18 +1408,18 @@ ieee_archive_p (abfd) file_ptr buffer_offset = 0; ieee_ar_data_type *save = abfd->tdata.ieee_ar_data; ieee_ar_data_type *ieee; - unsigned int alc_elts; + bfd_size_type alc_elts; ieee_ar_obstack_type *elts = NULL; + bfd_size_type amt = sizeof (ieee_ar_data_type); - abfd->tdata.ieee_ar_data = - (ieee_ar_data_type *) bfd_alloc (abfd, sizeof (ieee_ar_data_type)); + abfd->tdata.ieee_ar_data = (ieee_ar_data_type *) bfd_alloc (abfd, amt); if (!abfd->tdata.ieee_ar_data) goto error_return; ieee = IEEE_AR_DATA (abfd); /* Ignore the return value here. It doesn't matter if we don't read the entire buffer. We might have a very small ieee file. */ - bfd_read ((PTR) buffer, 1, sizeof (buffer), abfd); + bfd_bread ((PTR) buffer, (bfd_size_type) sizeof (buffer), abfd); ieee->h.first_byte = buffer; ieee->h.input_p = buffer; @@ -1481,21 +1486,20 @@ ieee_archive_p (abfd) if (bfd_seek (abfd, buffer_offset, SEEK_SET) != 0) goto error_return; - /* Again ignore return value of bfd_read. */ - bfd_read ((PTR) buffer, 1, sizeof (buffer), abfd); + /* Again ignore return value of bfd_bread. */ + bfd_bread ((PTR) buffer, (bfd_size_type) sizeof (buffer), abfd); ieee->h.first_byte = buffer; ieee->h.input_p = buffer; } } - ieee->elements = ((ieee_ar_obstack_type *) - bfd_alloc (abfd, - ieee->element_count * sizeof *ieee->elements)); + amt = ieee->element_count; + amt *= sizeof *ieee->elements; + ieee->elements = (ieee_ar_obstack_type *) bfd_alloc (abfd, amt); if (ieee->elements == NULL) goto error_return; - memcpy (ieee->elements, elts, - ieee->element_count * sizeof *ieee->elements); + memcpy (ieee->elements, elts, (size_t) amt); free (elts); elts = NULL; @@ -1505,15 +1509,15 @@ ieee_archive_p (abfd) if (bfd_seek (abfd, ieee->elements[i].file_offset, SEEK_SET) != 0) goto error_return; - /* Again ignore return value of bfd_read. */ - bfd_read ((PTR) buffer, 1, sizeof (buffer), abfd); + /* Again ignore return value of bfd_bread. */ + bfd_bread ((PTR) buffer, (bfd_size_type) sizeof (buffer), abfd); ieee->h.first_byte = buffer; ieee->h.input_p = buffer; next_byte (&(ieee->h)); /* Drop F8. */ next_byte (&(ieee->h)); /* Drop 14. */ must_parse_int (&(ieee->h)); /* Drop size of block. */ - + if (must_parse_int (&(ieee->h)) != 0) /* This object has been deleted. */ ieee->elements[i].file_offset = 0; @@ -1546,6 +1550,7 @@ ieee_object_p (abfd) ieee_data_type *ieee; unsigned char buffer[300]; ieee_data_type *save = IEEE_DATA (abfd); + bfd_size_type amt; abfd->tdata.ieee_data = 0; ieee_mkobject (abfd); @@ -1554,8 +1559,8 @@ ieee_object_p (abfd) if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) goto fail; /* Read the first few bytes in to see if it makes sense. Ignore - bfd_read return value; The file might be very small. */ - bfd_read ((PTR) buffer, 1, sizeof (buffer), abfd); + bfd_bread return value; The file might be very small. */ + bfd_bread ((PTR) buffer, (bfd_size_type) sizeof (buffer), abfd); ieee->h.input_p = buffer; if (this_byte_and_next (&(ieee->h)) != Module_Beginning) @@ -1620,12 +1625,12 @@ ieee_object_p (abfd) strcpy (family, "68332"); /* Guess it will be CPU32 */ } } - else if (toupper (processor[3]) == 'F') /* 68F333 */ - strcpy (family, "68332"); /* CPU32 */ - else if ((toupper (processor[3]) == 'C') /* Embedded controllers */ - && ((toupper (processor[2]) == 'E') - || (toupper (processor[2]) == 'H') - || (toupper (processor[2]) == 'L'))) + else if (TOUPPER (processor[3]) == 'F') /* 68F333 */ + strcpy (family, "68332"); /* CPU32 */ + else if ((TOUPPER (processor[3]) == 'C') /* Embedded controllers */ + && ((TOUPPER (processor[2]) == 'E') + || (TOUPPER (processor[2]) == 'H') + || (TOUPPER (processor[2]) == 'L'))) { strcpy (family, "68"); strncat (family, processor + 4, 7); @@ -1700,16 +1705,17 @@ ieee_object_p (abfd) quickly. We can work out how big the file is from the trailer record */ + amt = ieee->w.r.me_record + 1; IEEE_DATA (abfd)->h.first_byte = - (unsigned char *) bfd_alloc (ieee->h.abfd, ieee->w.r.me_record + 1); + (unsigned char *) bfd_alloc (ieee->h.abfd, amt); if (!IEEE_DATA (abfd)->h.first_byte) goto fail; if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) goto fail; /* FIXME: Check return value. I'm not sure whether it needs to read the entire buffer or not. */ - bfd_read ((PTR) (IEEE_DATA (abfd)->h.first_byte), 1, - ieee->w.r.me_record + 1, abfd); + bfd_bread ((PTR) (IEEE_DATA (abfd)->h.first_byte), + (bfd_size_type) ieee->w.r.me_record + 1, abfd); ieee_slurp_sections (abfd); @@ -1721,7 +1727,7 @@ ieee_object_p (abfd) if (! ieee_slurp_section_data (abfd)) goto fail; - + return abfd->xvec; got_wrong_format: bfd_set_error (bfd_error_wrong_format); @@ -1832,9 +1838,10 @@ do_one (ieee, current_map, location_ptr, unsigned int extra = 4; boolean pcrel = false; asection *section; - ieee_reloc_type *r = - (ieee_reloc_type *) bfd_alloc (ieee->h.abfd, - sizeof (ieee_reloc_type)); + ieee_reloc_type *r; + bfd_size_type amt = sizeof (ieee_reloc_type); + + r = (ieee_reloc_type *) bfd_alloc (ieee->h.abfd, amt); if (!r) return false; @@ -1891,21 +1898,20 @@ do_one (ieee, current_map, location_ptr, if (pcrel == true) { #if KEEPMINUSPCININST - bfd_put_32 (ieee->h.abfd, -current_map->pc, location_ptr + - current_map->pc); + bfd_put_32 (ieee->h.abfd, -current_map->pc, + location_ptr + current_map->pc); r->relent.howto = &rel32_howto; - r->relent.addend -= - current_map->pc; + r->relent.addend -= current_map->pc; #else - bfd_put_32 (ieee->h.abfd, 0, location_ptr + + bfd_put_32 (ieee->h.abfd, (bfd_vma) 0, location_ptr + current_map->pc); r->relent.howto = &rel32_howto; #endif } else { - bfd_put_32 (ieee->h.abfd, 0, location_ptr + - current_map->pc); + bfd_put_32 (ieee->h.abfd, (bfd_vma) 0, + location_ptr + current_map->pc); r->relent.howto = &abs32_howto; } current_map->pc += 4; @@ -1914,19 +1920,22 @@ do_one (ieee, current_map, location_ptr, if (pcrel == true) { #if KEEPMINUSPCININST - bfd_put_16 (ieee->h.abfd, (int) (-current_map->pc), location_ptr + current_map->pc); + bfd_put_16 (ieee->h.abfd, (bfd_vma) -current_map->pc, + location_ptr + current_map->pc); r->relent.addend -= current_map->pc; r->relent.howto = &rel16_howto; #else - bfd_put_16 (ieee->h.abfd, 0, location_ptr + current_map->pc); + bfd_put_16 (ieee->h.abfd, (bfd_vma) 0, + location_ptr + current_map->pc); r->relent.howto = &rel16_howto; #endif } else { - bfd_put_16 (ieee->h.abfd, 0, location_ptr + current_map->pc); + bfd_put_16 (ieee->h.abfd, (bfd_vma) 0, + location_ptr + current_map->pc); r->relent.howto = &abs16_howto; } current_map->pc += 2; @@ -2103,7 +2112,7 @@ ieee_slurp_section_data (abfd) { ieee->h.input_p = start; if (!do_one (ieee, current_map, location_ptr, s, - iterations)) + (int) iterations)) return false; iterations--; } @@ -2126,7 +2135,7 @@ ieee_new_section_hook (abfd, newsect) asection *newsect; { newsect->used_by_bfd = (PTR) - bfd_alloc (abfd, sizeof (ieee_per_section_type)); + bfd_alloc (abfd, (bfd_size_type) sizeof (ieee_per_section_type)); if (!newsect->used_by_bfd) return false; ieee_per_section (newsect)->data = (bfd_byte *) NULL; @@ -2282,7 +2291,7 @@ ieee_write_section_part (abfd) || ! ieee_write_byte (abfd, (bfd_byte) (s->index + IEEE_SECTION_NUMBER_BASE)) - || ! ieee_write_int (abfd, 1 << s->alignment_power)) + || ! ieee_write_int (abfd, (bfd_vma) 1 << s->alignment_power)) return false; /* Size */ @@ -2344,7 +2353,7 @@ do_with_relocs (abfd, s) } else { - if (! ieee_write_expression (abfd, 0, s->symbol, 0, 0)) + if (! ieee_write_expression (abfd, (bfd_vma) 0, s->symbol, 0, 0)) return false; } @@ -2370,10 +2379,7 @@ do_with_relocs (abfd, s) /* Output a stream of bytes */ if (! ieee_write_int (abfd, run)) return false; - if (bfd_write ((PTR) (stream + current_byte_index), - 1, - run, - abfd) + if (bfd_bwrite ((PTR) (stream + current_byte_index), run, abfd) != run) return false; current_byte_index += run; @@ -2421,10 +2427,7 @@ do_with_relocs (abfd, s) /* Output a stream of bytes */ if (! ieee_write_int (abfd, run)) return false; - if (bfd_write ((PTR) (stream + current_byte_index), - 1, - run, - abfd) + if (bfd_bwrite ((PTR) (stream + current_byte_index), run, abfd) != run) return false; current_byte_index += run; @@ -2486,7 +2489,7 @@ do_with_relocs (abfd, s) if (! ieee_write_expression (abfd, r->addend + ov, *(r->sym_ptr_ptr), r->howto->pc_relative, - s->index)) + (unsigned) s->index)) return false; } else @@ -2494,15 +2497,15 @@ do_with_relocs (abfd, s) if (! ieee_write_expression (abfd, r->addend + ov, (asymbol *) NULL, r->howto->pc_relative, - s->index)) + (unsigned) s->index)) return false; } if (number_of_maus_in_address != bfd_get_reloc_size (r->howto)) { - if (! ieee_write_int (abfd, - bfd_get_reloc_size (r->howto))) + bfd_vma rsize = bfd_get_reloc_size (r->howto); + if (! ieee_write_int (abfd, rsize)) return false; } if (! ieee_write_byte (abfd, @@ -2549,7 +2552,7 @@ do_as_repeat (abfd, s) } else { - if (! ieee_write_expression (abfd, 0, s->symbol, 0, 0)) + if (! ieee_write_expression (abfd, (bfd_vma) 0, s->symbol, 0, 0)) return false; } @@ -2610,6 +2613,8 @@ static boolean ieee_mkobject (abfd) bfd *abfd; { + bfd_size_type amt; + output_ptr_start = NULL; output_ptr = NULL; output_ptr_end = NULL; @@ -2619,25 +2624,26 @@ ieee_mkobject (abfd) input_bfd = NULL; output_bfd = NULL; output_buffer = 0; - abfd->tdata.ieee_data = (ieee_data_type *) bfd_zalloc (abfd, sizeof (ieee_data_type)); + amt = sizeof (ieee_data_type); + abfd->tdata.ieee_data = (ieee_data_type *) bfd_zalloc (abfd, amt); return abfd->tdata.ieee_data ? true : false; } static void fill () { + bfd_size_type amt = input_ptr_end - input_ptr_start; /* FIXME: Check return value. I'm not sure whether it needs to read the entire buffer or not. */ - bfd_read ((PTR) input_ptr_start, 1, input_ptr_end - input_ptr_start, input_bfd); + bfd_bread ((PTR) input_ptr_start, amt, input_bfd); input_ptr = input_ptr_start; } static void flush () { - if (bfd_write ((PTR) (output_ptr_start), 1, output_ptr - output_ptr_start, - output_bfd) - != (bfd_size_type) (output_ptr - output_ptr_start)) + bfd_size_type amt = output_ptr - output_ptr_start; + if (bfd_bwrite ((PTR) (output_ptr_start), amt, output_bfd) != amt) abort (); output_ptr = output_ptr_start; output_buffer++; @@ -2712,7 +2718,7 @@ copy_expression () { int stack[10]; int *tos = stack; - int value = 0; + int value; while (1) { switch (THIS ()) @@ -2766,16 +2772,13 @@ copy_expression () } *tos++ = THIS (); NEXT (); - value = 0; break; case 0xa5: /* PLUS anything */ - { - int value = *(--tos); - value += *(--tos); - *tos++ = value; - NEXT (); - } + value = *(--tos); + value += *(--tos); + *tos++ = value; + NEXT (); break; case VAR ('R'): { @@ -2788,17 +2791,11 @@ copy_expression () NEXT (); ieee = IEEE_DATA (input_bfd); s = ieee->section_table[section_number]; + value = 0; if (s->output_section) - { - value = s->output_section->lma; - } - else - { - value = 0; - } + value = s->output_section->lma; value += s->output_offset; *tos++ = value; - value = 0; } break; case 0x90: @@ -2807,11 +2804,9 @@ copy_expression () write_int (*(--tos)); OUT (0x90); return; - } } } - } /* Drop the int in the buffer, and copy a null into the gap, which we @@ -3279,7 +3274,7 @@ relocate_debug (output, input) input_bfd = input; /* FIXME: Check return value. I'm not sure whether it needs to read the entire buffer or not. */ - bfd_read ((PTR) input_ptr_start, 1, IBS, input); + bfd_bread ((PTR) input_ptr_start, (bfd_size_type) IBS, input); block (); } @@ -3292,13 +3287,13 @@ ieee_write_debug_part (abfd) { ieee_data_type *ieee = IEEE_DATA (abfd); bfd_chain_type *chain = ieee->chain_root; - unsigned char output_buffer[OBS]; + unsigned char obuff[OBS]; boolean some_debug = false; file_ptr here = bfd_tell (abfd); - output_ptr_start = output_ptr = output_buffer; - output_ptr_end = output_buffer + OBS; - output_ptr = output_buffer; + output_ptr_start = output_ptr = obuff; + output_ptr_end = obuff + OBS; + output_ptr = obuff; output_bfd = abfd; if (chain == (bfd_chain_type *) NULL) @@ -3315,7 +3310,7 @@ ieee_write_debug_part (abfd) } ieee->w.r.debug_information_part = here; - if (bfd_write (s->contents, 1, s->_raw_size, abfd) != s->_raw_size) + if (bfd_bwrite (s->contents, s->_raw_size, abfd) != s->_raw_size) return false; } else @@ -3327,8 +3322,7 @@ ieee_write_debug_part (abfd) if (entry_ieee->w.r.debug_information_part) { if (bfd_seek (entry, entry_ieee->w.r.debug_information_part, - SEEK_SET) - != 0) + SEEK_SET) != 0) return false; relocate_debug (abfd, entry); } @@ -3395,7 +3389,8 @@ init_for_output (abfd) continue; if (s->_raw_size != 0) { - ieee_per_section (s)->data = (bfd_byte *) (bfd_alloc (abfd, s->_raw_size)); + bfd_size_type size = s->_raw_size; + ieee_per_section (s)->data = (bfd_byte *) (bfd_alloc (abfd, size)); if (!ieee_per_section (s)->data) return false; } @@ -3420,14 +3415,14 @@ ieee_set_section_contents (abfd, section { if (section->contents == NULL) { - section->contents = ((unsigned char *) - bfd_alloc (abfd, section->_raw_size)); + bfd_size_type size = section->_raw_size; + section->contents = (unsigned char *) bfd_alloc (abfd, size); if (section->contents == NULL) return false; } /* bfd_set_section_contents has already checked that everything is within range. */ - memcpy (section->contents + offset, location, count); + memcpy (section->contents + offset, location, (size_t) count); return true; } @@ -3468,7 +3463,7 @@ ieee_write_external_part (abfd) { /* This must be a symbol reference .. */ if (! ieee_write_byte (abfd, ieee_external_reference_enum) - || ! ieee_write_int (abfd, reference_index) + || ! ieee_write_int (abfd, (bfd_vma) reference_index) || ! ieee_write_id (abfd, p->name)) return false; p->value = reference_index; @@ -3479,11 +3474,11 @@ ieee_write_external_part (abfd) { /* This is a weak reference */ if (! ieee_write_byte (abfd, ieee_external_reference_enum) - || ! ieee_write_int (abfd, reference_index) + || ! ieee_write_int (abfd, (bfd_vma) reference_index) || ! ieee_write_id (abfd, p->name) || ! ieee_write_byte (abfd, ieee_weak_external_reference_enum) - || ! ieee_write_int (abfd, reference_index) + || ! ieee_write_int (abfd, (bfd_vma) reference_index) || ! ieee_write_int (abfd, p->value)) return false; p->value = reference_index; @@ -3495,10 +3490,10 @@ ieee_write_external_part (abfd) /* This must be a symbol definition */ if (! ieee_write_byte (abfd, ieee_external_symbol_enum) - || ! ieee_write_int (abfd, public_index) + || ! ieee_write_int (abfd, (bfd_vma) public_index) || ! ieee_write_id (abfd, p->name) || ! ieee_write_2bytes (abfd, ieee_attribute_record_enum) - || ! ieee_write_int (abfd, public_index) + || ! ieee_write_int (abfd, (bfd_vma) public_index) || ! ieee_write_byte (abfd, 15) /* instruction address */ || ! ieee_write_byte (abfd, 19) /* static symbol */ || ! ieee_write_byte (abfd, 1)) /* one of them */ @@ -3506,7 +3501,7 @@ ieee_write_external_part (abfd) /* Write out the value */ if (! ieee_write_2bytes (abfd, ieee_value_record_enum) - || ! ieee_write_int (abfd, public_index)) + || ! ieee_write_int (abfd, (bfd_vma) public_index)) return false; if (! bfd_is_abs_section (p->section)) { @@ -3722,7 +3717,8 @@ ieee_write_object_contents (abfd) return false; ieee->w.r.extension_record = bfd_tell (abfd); - if (bfd_write ((char *) exten, 1, sizeof (exten), abfd) != sizeof (exten)) + if (bfd_bwrite ((char *) exten, (bfd_size_type) sizeof (exten), abfd) + != sizeof (exten)) return false; if (abfd->flags & EXEC_P) { @@ -3736,7 +3732,8 @@ ieee_write_object_contents (abfd) } ieee->w.r.environmental_record = bfd_tell (abfd); - if (bfd_write ((char *) envi, 1, sizeof (envi), abfd) != sizeof (envi)) + if (bfd_bwrite ((char *) envi, (bfd_size_type) sizeof (envi), abfd) + != sizeof (envi)) return false; /* The HP emulator database requires a timestamp in the file. */ @@ -3750,12 +3747,12 @@ ieee_write_object_contents (abfd) || ! ieee_write_byte (abfd, 0x21) || ! ieee_write_byte (abfd, 0) || ! ieee_write_byte (abfd, 50) - || ! ieee_write_int (abfd, t->tm_year + 1900) - || ! ieee_write_int (abfd, t->tm_mon + 1) - || ! ieee_write_int (abfd, t->tm_mday) - || ! ieee_write_int (abfd, t->tm_hour) - || ! ieee_write_int (abfd, t->tm_min) - || ! ieee_write_int (abfd, t->tm_sec)) + || ! ieee_write_int (abfd, (bfd_vma) (t->tm_year + 1900)) + || ! ieee_write_int (abfd, (bfd_vma) (t->tm_mon + 1)) + || ! ieee_write_int (abfd, (bfd_vma) t->tm_mday) + || ! ieee_write_int (abfd, (bfd_vma) t->tm_hour) + || ! ieee_write_int (abfd, (bfd_vma) t->tm_min) + || ! ieee_write_int (abfd, (bfd_vma) t->tm_sec)) return false; } @@ -3797,7 +3794,7 @@ ieee_write_object_contents (abfd) { if (! ieee_write_2bytes (abfd, ieee_assign_value_to_variable_enum) || ! ieee_write_byte (abfd, (bfd_byte) i) - || ! ieee_write_int5_out (abfd, ieee->w.offset[i])) + || ! ieee_write_int5_out (abfd, (bfd_vma) ieee->w.offset[i])) return false; } @@ -3814,8 +3811,8 @@ static asymbol * ieee_make_empty_symbol (abfd) bfd *abfd; { - ieee_symbol_type *new = - (ieee_symbol_type *) bfd_zalloc (abfd, sizeof (ieee_symbol_type)); + bfd_size_type amt = sizeof (ieee_symbol_type); + ieee_symbol_type *new = (ieee_symbol_type *) bfd_zalloc (abfd, amt); if (!new) return NULL; new->symbol.the_bfd = abfd; @@ -3957,7 +3954,8 @@ ieee_bfd_debug_info_accumulate (abfd, se /* Add to chain */ { - bfd_chain_type *n = (bfd_chain_type *) bfd_alloc (abfd, sizeof (bfd_chain_type)); + 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; @@ -4094,6 +4092,6 @@ const bfd_target ieee_vec = BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), NULL, - + (PTR) 0 }; diff -uprN binutils-2.11.90.0.31/bfd/ihex.c binutils-2.11.92.0.5/bfd/ihex.c --- binutils-2.11.90.0.31/bfd/ihex.c Sat May 12 00:05:32 2001 +++ binutils-2.11.92.0.5/bfd/ihex.c Mon Oct 1 15:25:21 2001 @@ -1,5 +1,6 @@ /* BFD back-end for Intel Hex objects. - Copyright 1995, 1996, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright 1995, 1996, 1998, 1999, 2000, 2001 + Free Software Foundation, Inc. Written by Ian Lance Taylor of Cygnus Support . This file is part of BFD, the Binary File Descriptor library. @@ -122,8 +123,7 @@ The MRI compiler uses this, which is a r #include "sysdep.h" #include "libbfd.h" #include "libiberty.h" - -#include +#include "safe-ctype.h" static void ihex_init PARAMS ((void)); static boolean ihex_mkobject PARAMS ((bfd *)); @@ -137,7 +137,7 @@ static boolean ihex_get_section_contents static boolean ihex_set_section_contents PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); static boolean ihex_write_record - PARAMS ((bfd *, bfd_size_type, bfd_vma, unsigned int, bfd_byte *)); + PARAMS ((bfd *, size_t, unsigned int, unsigned int, bfd_byte *)); static boolean ihex_write_object_contents PARAMS ((bfd *)); static asymbol *ihex_make_empty_symbol PARAMS ((bfd *)); static boolean ihex_set_arch_mach @@ -197,9 +197,9 @@ ihex_mkobject (abfd) if (abfd->tdata.ihex_data == NULL) { struct ihex_data_struct *tdata; + bfd_size_type amt = sizeof (struct ihex_data_struct); - tdata = ((struct ihex_data_struct *) - bfd_alloc (abfd, sizeof (struct ihex_data_struct))); + tdata = (struct ihex_data_struct *) bfd_alloc (abfd, amt); if (tdata == NULL) return false; abfd->tdata.ihex_data = tdata; @@ -220,7 +220,7 @@ ihex_get_byte (abfd, errorptr) { bfd_byte c; - if (bfd_read (&c, 1, 1, abfd) != 1) + if (bfd_bread (&c, (bfd_size_type) 1, abfd) != 1) { if (bfd_get_error () != bfd_error_file_truncated) *errorptr = true; @@ -248,7 +248,7 @@ ihex_bad_byte (abfd, lineno, c, error) { char buf[10]; - if (! isprint (c)) + if (! ISPRINT (c)) sprintf (buf, "\\%03o", (unsigned int) c); else { @@ -257,7 +257,7 @@ ihex_bad_byte (abfd, lineno, c, error) } (*_bfd_error_handler) (_("%s:%d: unexpected character `%s' in Intel Hex file\n"), - bfd_get_filename (abfd), lineno, buf); + bfd_archive_filename (abfd), lineno, buf); bfd_set_error (bfd_error_bad_value); } } @@ -272,7 +272,7 @@ ihex_scan (abfd) bfd_vma segbase; bfd_vma extbase; asection *sec; - int lineno; + unsigned int lineno; boolean error; bfd_byte *buf = NULL; size_t bufsize; @@ -320,7 +320,7 @@ ihex_scan (abfd) /* Read the header bytes. */ - if (bfd_read (hdr, 1, 8, abfd) != 8) + if (bfd_bread (hdr, (bfd_size_type) 8, abfd) != 8) goto error_return; for (i = 0; i < 8; i++) @@ -341,13 +341,13 @@ ihex_scan (abfd) chars = len * 2 + 2; if (chars >= bufsize) { - buf = (bfd_byte *) bfd_realloc (buf, chars); + buf = (bfd_byte *) bfd_realloc (buf, (bfd_size_type) chars); if (buf == NULL) goto error_return; bufsize = chars; } - if (bfd_read (buf, 1, chars, abfd) != chars) + if (bfd_bread (buf, (bfd_size_type) chars, abfd) != chars) goto error_return; for (i = 0; i < chars; i++) @@ -366,8 +366,8 @@ ihex_scan (abfd) if (((- chksum) & 0xff) != (unsigned int) HEX2 (buf + 2 * i)) { (*_bfd_error_handler) - (_("%s:%d: bad checksum in Intel Hex file (expected %u, found %u)"), - bfd_get_filename (abfd), lineno, + (_("%s:%u: bad checksum in Intel Hex file (expected %u, found %u)"), + bfd_archive_filename (abfd), lineno, (- chksum) & 0xff, (unsigned int) HEX2 (buf + 2 * i)); bfd_set_error (bfd_error_bad_value); goto error_return; @@ -388,9 +388,11 @@ ihex_scan (abfd) { char secbuf[20]; char *secname; + bfd_size_type amt; sprintf (secbuf, ".sec%d", bfd_count_sections (abfd) + 1); - secname = (char *) bfd_alloc (abfd, strlen (secbuf) + 1); + amt = strlen (secbuf) + 1; + secname = (char *) bfd_alloc (abfd, amt); if (secname == NULL) goto error_return; strcpy (secname, secbuf); @@ -418,8 +420,8 @@ ihex_scan (abfd) if (len != 2) { (*_bfd_error_handler) - (_("%s:%d: bad extended address record length in Intel Hex file"), - bfd_get_filename (abfd), lineno); + (_("%s:%u: bad extended address record length in Intel Hex file"), + bfd_archive_filename (abfd), lineno); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -435,8 +437,8 @@ ihex_scan (abfd) if (len != 4) { (*_bfd_error_handler) - (_("%s:%d: bad extended start address length in Intel Hex file"), - bfd_get_filename (abfd), lineno); + (_("%s:%u: bad extended start address length in Intel Hex file"), + bfd_archive_filename (abfd), lineno); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -452,8 +454,8 @@ ihex_scan (abfd) if (len != 2) { (*_bfd_error_handler) - (_("%s:%d: bad extended linear address record length in Intel Hex file"), - bfd_get_filename (abfd), lineno); + (_("%s:%u: bad extended linear address record length in Intel Hex file"), + bfd_archive_filename (abfd), lineno); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -469,8 +471,8 @@ ihex_scan (abfd) if (len != 2 && len != 4) { (*_bfd_error_handler) - (_("%s:%d: bad extended linear start address length in Intel Hex file"), - bfd_get_filename (abfd), lineno); + (_("%s:%u: bad extended linear start address length in Intel Hex file"), + bfd_archive_filename (abfd), lineno); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -486,8 +488,8 @@ ihex_scan (abfd) default: (*_bfd_error_handler) - (_("%s:%d: unrecognized ihex type %u in Intel Hex file\n"), - bfd_get_filename (abfd), lineno, type); + (_("%s:%u: unrecognized ihex type %u in Intel Hex file\n"), + bfd_archive_filename (abfd), lineno, type); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -522,7 +524,7 @@ ihex_object_p (abfd) if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) return NULL; - if (bfd_read (b, 1, 9, abfd) != 9) + if (bfd_bread (b, (bfd_size_type) 9, abfd) != 9) { if (bfd_get_error () == bfd_error_file_truncated) bfd_set_error (bfd_error_wrong_format); @@ -595,7 +597,7 @@ ihex_read_section (abfd, section, conten know the exact format. */ BFD_ASSERT (c == ':'); - if (bfd_read (hdr, 1, 8, abfd) != 8) + if (bfd_bread (hdr, (bfd_size_type) 8, abfd) != 8) goto error_return; len = HEX2 (hdr); @@ -607,20 +609,20 @@ ihex_read_section (abfd, section, conten { (*_bfd_error_handler) (_("%s: internal error in ihex_read_section"), - bfd_get_filename (abfd)); + bfd_archive_filename (abfd)); bfd_set_error (bfd_error_bad_value); goto error_return; } if (len * 2 > bufsize) { - buf = (bfd_byte *) bfd_realloc (buf, len * 2); + buf = (bfd_byte *) bfd_realloc (buf, (bfd_size_type) len * 2); if (buf == NULL) goto error_return; bufsize = len * 2; } - if (bfd_read (buf, 1, len * 2, abfd) != len * 2) + if (bfd_bread (buf, (bfd_size_type) len * 2, abfd) != len * 2) goto error_return; for (i = 0; i < len; i++) @@ -634,7 +636,7 @@ ihex_read_section (abfd, section, conten } /* Skip the checksum. */ - if (bfd_read (buf, 1, 2, abfd) != 2) + if (bfd_bread (buf, (bfd_size_type) 2, abfd) != 2) goto error_return; } @@ -642,7 +644,7 @@ ihex_read_section (abfd, section, conten { (*_bfd_error_handler) (_("%s: bad section length in ihex_read_section"), - bfd_get_filename (abfd)); + bfd_archive_filename (abfd)); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -696,14 +698,15 @@ ihex_set_section_contents (abfd, section struct ihex_data_list *n; bfd_byte *data; struct ihex_data_struct *tdata; + bfd_size_type amt; if (count == 0 || (section->flags & SEC_ALLOC) == 0 || (section->flags & SEC_LOAD) == 0) return true; - n = ((struct ihex_data_list *) - bfd_alloc (abfd, sizeof (struct ihex_data_list))); + amt = sizeof (struct ihex_data_list); + n = (struct ihex_data_list *) bfd_alloc (abfd, amt); if (n == NULL) return false; @@ -748,8 +751,8 @@ ihex_set_section_contents (abfd, section static boolean ihex_write_record (abfd, count, addr, type, data) bfd *abfd; - bfd_size_type count; - bfd_vma addr; + size_t count; + unsigned int addr; unsigned int type; bfd_byte *data; { @@ -758,6 +761,7 @@ ihex_write_record (abfd, count, addr, ty char *p; unsigned int chksum; unsigned int i; + size_t total; #define TOHEX(buf, v) \ ((buf)[0] = digs[((v) >> 4) & 0xf], (buf)[1] = digs[(v) & 0xf]) @@ -780,7 +784,8 @@ ihex_write_record (abfd, count, addr, ty p[2] = '\r'; p[3] = '\n'; - if (bfd_write (buf, 1, 9 + count * 2 + 4, abfd) != 9 + count * 2 + 4) + total = 9 + count * 2 + 4; + if (bfd_bwrite (buf, (bfd_size_type) total, abfd) != total) return false; return true; @@ -809,10 +814,11 @@ ihex_write_object_contents (abfd) count = l->size; while (count > 0) { - bfd_size_type now; + size_t now; + unsigned int rec_addr; now = count; - if (now > CHUNK) + if (count > CHUNK) now = CHUNK; if (where > segbase + extbase + 0xffff) @@ -867,8 +873,8 @@ ihex_write_object_contents (abfd) } } - if (! ihex_write_record (abfd, now, where - (extbase + segbase), - 0, p)) + rec_addr = where - (extbase + segbase); + if (! ihex_write_record (abfd, now, rec_addr, 0, p)) return false; where += now; @@ -919,7 +925,7 @@ ihex_make_empty_symbol (abfd) { asymbol *new; - new = (asymbol *) bfd_zalloc (abfd, sizeof (asymbol)); + new = (asymbol *) bfd_zalloc (abfd, (bfd_size_type) sizeof (asymbol)); if (new != NULL) new->the_bfd = abfd; return new; @@ -1039,6 +1045,6 @@ const bfd_target ihex_vec = BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), NULL, - + (PTR) 0 }; diff -uprN binutils-2.11.90.0.31/bfd/irix-core.c binutils-2.11.92.0.5/bfd/irix-core.c --- binutils-2.11.90.0.31/bfd/irix-core.c Fri Mar 9 11:16:01 2001 +++ binutils-2.11.92.0.5/bfd/irix-core.c Mon Oct 1 15:25:21 2001 @@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suit #include -struct sgi_core_struct +struct sgi_core_struct { int sig; char cmd[CORE_NAMESIZE]; @@ -41,11 +41,11 @@ struct sgi_core_struct #define core_command(bfd) (core_hdr(bfd)->cmd) static asection *make_bfd_asection - PARAMS ((bfd *, CONST char *, flagword, bfd_size_type, bfd_vma, file_ptr)); + PARAMS ((bfd *, const char *, flagword, bfd_size_type, bfd_vma, file_ptr)); static const bfd_target *irix_core_core_file_p PARAMS ((bfd *)); static char *irix_core_core_file_failing_command PARAMS ((bfd *)); static int irix_core_core_file_failing_signal PARAMS ((bfd *)); -static boolean irix_core_core_file_matches_executable_p +static boolean irix_core_core_file_matches_executable_p PARAMS ((bfd *, bfd *)); static asymbol *irix_core_make_empty_symbol PARAMS ((bfd *)); static void swap_abort PARAMS ((void)); @@ -53,7 +53,7 @@ static void swap_abort PARAMS ((void)); static asection * make_bfd_asection (abfd, name, flags, _raw_size, vma, filepos) bfd *abfd; - CONST char *name; + const char *name; flagword flags; bfd_size_type _raw_size; bfd_vma vma; @@ -83,8 +83,9 @@ irix_core_core_file_p (abfd) char *secname; struct coreout coreout; struct idesc *idg, *idf, *ids; + bfd_size_type amt; - val = bfd_read ((PTR)&coreout, 1, sizeof coreout, abfd); + val = bfd_bread ((PTR) &coreout, (bfd_size_type) sizeof coreout, abfd); if (val != sizeof coreout) { if (bfd_get_error () != bfd_error_system_call) @@ -99,7 +100,8 @@ irix_core_core_file_p (abfd) || coreout.c_version != CORE_VERSION1) return 0; - core_hdr (abfd) = (struct sgi_core_struct *) bfd_zalloc (abfd, sizeof (struct sgi_core_struct)); + amt = sizeof (struct sgi_core_struct); + core_hdr (abfd) = (struct sgi_core_struct *) bfd_zalloc (abfd, amt); if (!core_hdr (abfd)) return NULL; @@ -113,7 +115,7 @@ irix_core_core_file_p (abfd) { struct vmap vmap; - val = bfd_read ((PTR)&vmap, 1, sizeof vmap, abfd); + val = bfd_bread ((PTR) &vmap, (bfd_size_type) sizeof vmap, abfd); if (val != sizeof vmap) break; @@ -165,7 +167,7 @@ irix_core_core_file_p (abfd) idg->i_len + idf->i_len + ids->i_len, 0, idg->i_offset); - + /* OK, we believe you. You're a core file (sure, sure). */ bfd_default_set_arch_mach (abfd, bfd_arch_mips, 0); @@ -197,7 +199,8 @@ static asymbol * irix_core_make_empty_symbol (abfd) bfd *abfd; { - asymbol *new = (asymbol *) bfd_zalloc (abfd, sizeof (asymbol)); + bfd_size_type amt = sizeof (asymbol); + asymbol *new = (asymbol *) bfd_zalloc (abfd, amt); if (new) new->the_bfd = abfd; return new; @@ -260,7 +263,7 @@ const bfd_target irix_core_vec = bfd_false, bfd_false, bfd_false, bfd_false }, - + BFD_JUMP_TABLE_GENERIC (_bfd_generic), BFD_JUMP_TABLE_COPY (_bfd_generic), BFD_JUMP_TABLE_CORE (irix_core), @@ -272,7 +275,7 @@ const bfd_target irix_core_vec = BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), NULL, - + (PTR) 0 /* backend_data */ }; diff -uprN binutils-2.11.90.0.31/bfd/libaout.h binutils-2.11.92.0.5/bfd/libaout.h --- binutils-2.11.90.0.31/bfd/libaout.h Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/libaout.h Thu Oct 4 14:35:43 2001 @@ -29,41 +29,91 @@ Foundation, Inc., 59 Temple Place - Suit #include "bfdlink.h" +/* Macros for accessing components in an aout header. Saves cluttering + the source with (bfd_vma) and (bfd_byte *) casts. */ + +#define H_PUT_64(abfd, val, where) \ + bfd_h_put_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) + +#define H_PUT_32(abfd, val, where) \ + bfd_h_put_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) + +#define H_PUT_16(abfd, val, where) \ + bfd_h_put_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) + +#define H_PUT_8 bfd_h_put_8 + +#define H_PUT_S64(abfd, val, where) \ + bfd_h_put_signed_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) + +#define H_PUT_S32(abfd, val, where) \ + bfd_h_put_signed_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) + +#define H_PUT_S16(abfd, val, where) \ + bfd_h_put_signed_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) + +#define H_PUT_S8 bfd_h_put_signed_8 + +#define H_GET_64(abfd, where) \ + bfd_h_get_64 ((abfd), (bfd_byte *) (where)) + +#define H_GET_32(abfd, where) \ + bfd_h_get_32 ((abfd), (bfd_byte *) (where)) + +#define H_GET_16(abfd, where) \ + bfd_h_get_16 ((abfd), (bfd_byte *) (where)) + +#define H_GET_8 bfd_h_get_8 + +#define H_GET_S64(abfd, where) \ + bfd_h_get_signed_64 ((abfd), (bfd_byte *) (where)) + +#define H_GET_S32(abfd, where) \ + bfd_h_get_signed_32 ((abfd), (bfd_byte *) (where)) + +#define H_GET_S16(abfd, where) \ + bfd_h_get_signed_16 ((abfd), (bfd_byte *) (where)) + +#define H_GET_S8 bfd_h_get_signed_8 + /* Parameterize the a.out code based on whether it is being built for a 32-bit architecture or a 64-bit architecture. */ +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ #if ARCH_SIZE==64 -#define GET_WORD bfd_h_get_64 -#define GET_SWORD bfd_h_get_signed_64 -#define GET_MAGIC bfd_h_get_32 -#define PUT_WORD bfd_h_put_64 -#define PUT_MAGIC bfd_h_put_32 +#define GET_WORD H_GET_64 +#define GET_SWORD H_GET_S64 +#define GET_MAGIC H_GET_32 +#define PUT_WORD H_PUT_64 +#define PUT_MAGIC H_PUT_32 #ifndef NAME -#define NAME(x,y) CAT3(x,_64_,y) +#define NAME(x,y) CONCAT3 (x,_64_,y) #endif -#define JNAME(x) CAT(x,_64) +#define JNAME(x) CONCAT2 (x,_64) #define BYTES_IN_WORD 8 #else #if ARCH_SIZE==16 -#define GET_WORD bfd_h_get_16 -#define GET_SWORD bfd_h_get_signed_16 -#define GET_MAGIC bfd_h_get_16 -#define PUT_WORD bfd_h_put_16 -#define PUT_MAGIC bfd_h_put_16 +#define GET_WORD H_GET_16 +#define GET_SWORD H_GET_S16 +#define GET_MAGIC H_GET_16 +#define PUT_WORD H_PUT_16 +#define PUT_MAGIC H_PUT_16 #ifndef NAME -#define NAME(x,y) CAT3(x,_16_,y) +#define NAME(x,y) CONCAT3 (x,_16_,y) #endif -#define JNAME(x) CAT(x,_16) +#define JNAME(x) CONCAT2 (x,_16) #define BYTES_IN_WORD 2 #else /* ARCH_SIZE == 32 */ -#define GET_WORD bfd_h_get_32 -#define GET_SWORD bfd_h_get_signed_32 -#define GET_MAGIC bfd_h_get_32 -#define PUT_WORD bfd_h_put_32 -#define PUT_MAGIC bfd_h_put_32 +#define GET_WORD H_GET_32 +#define GET_SWORD H_GET_S32 +#define GET_MAGIC H_GET_32 +#define PUT_WORD H_PUT_32 +#define PUT_MAGIC H_PUT_32 #ifndef NAME -#define NAME(x,y) CAT3(x,_32_,y) +#define NAME(x,y) CONCAT3 (x,_32_,y) #endif -#define JNAME(x) CAT(x,_32) +#define JNAME(x) CONCAT2 (x,_32) #define BYTES_IN_WORD 4 #endif /* ARCH_SIZE==32 */ #endif /* ARCH_SIZE==64 */ @@ -143,7 +193,8 @@ struct aout_backend_data /* Callback for setting the page and segment sizes, if they can't be trivially determined from the architecture. */ - boolean (*set_sizes) PARAMS ((bfd *)); + boolean (*set_sizes) + PARAMS ((bfd *)); /* zmagic files only. For go32, the length of the exec header contributes to the size of the text section in the file for alignment purposes but @@ -152,44 +203,43 @@ struct aout_backend_data /* Callback from the add symbols phase of the linker code to handle a dynamic object. */ - boolean (*add_dynamic_symbols) PARAMS ((bfd *, struct bfd_link_info *, - struct external_nlist **, - bfd_size_type *, char **)); + boolean (*add_dynamic_symbols) + PARAMS ((bfd *, struct bfd_link_info *, struct external_nlist **, + bfd_size_type *, char **)); /* Callback from the add symbols phase of the linker code to handle adding a single symbol to the global linker hash table. */ - boolean (*add_one_symbol) PARAMS ((struct bfd_link_info *, bfd *, - const char *, flagword, asection *, - bfd_vma, const char *, boolean, - boolean, - struct bfd_link_hash_entry **)); + boolean (*add_one_symbol) + PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword, + asection *, bfd_vma, const char *, boolean, boolean, + struct bfd_link_hash_entry **)); /* Called to handle linking a dynamic object. */ - boolean (*link_dynamic_object) PARAMS ((struct bfd_link_info *, bfd *)); + boolean (*link_dynamic_object) + PARAMS ((struct bfd_link_info *, bfd *)); /* Called for each global symbol being written out by the linker. This should write out the dynamic symbol information. */ - boolean (*write_dynamic_symbol) PARAMS ((bfd *, struct bfd_link_info *, - struct aout_link_hash_entry *)); + boolean (*write_dynamic_symbol) + PARAMS ((bfd *, struct bfd_link_info *, struct aout_link_hash_entry *)); /* If this callback is not NULL, the linker calls it for each reloc. RELOC is a pointer to the unswapped reloc. If *SKIP is set to true, the reloc will be skipped. *RELOCATION may be changed to change the effects of the relocation. */ - boolean (*check_dynamic_reloc) PARAMS ((struct bfd_link_info *info, - bfd *input_bfd, - asection *input_section, - struct aout_link_hash_entry *h, - PTR reloc, bfd_byte *contents, - boolean *skip, - bfd_vma *relocation)); + boolean (*check_dynamic_reloc) + PARAMS ((struct bfd_link_info *info, bfd *input_bfd, + asection *input_section, struct aout_link_hash_entry *h, + PTR reloc, bfd_byte *contents, boolean *skip, + bfd_vma *relocation)); /* Called at the end of a link to finish up any dynamic linking information. */ - boolean (*finish_dynamic_link) PARAMS ((bfd *, struct bfd_link_info *)); + boolean (*finish_dynamic_link) + PARAMS ((bfd *, struct bfd_link_info *)); }; #define aout_backend_info(abfd) \ - ((CONST struct aout_backend_data *)((abfd)->xvec->backend_data)) + ((const struct aout_backend_data *)((abfd)->xvec->backend_data)) /* This is the layout in memory of a "struct exec" while we process it. All 'lengths' are given as a number of bytes. @@ -216,7 +266,7 @@ struct internal_exec char a_relaxable; /* Enough info for linker relax */ }; -/* Magic number is written +/* Magic number is written < MSB > 3130292827262524232221201918171615141312111009080706050403020100 < FLAGS >< MACHINE TYPE >< MAGIC NUMBER > @@ -325,7 +375,7 @@ typedef struct aout_symbol { struct aoutdata { struct internal_exec *hdr; /* exec file header */ aout_symbol_type *symbols; /* symtab for input bfd */ - + /* For ease, we do this */ asection *textsec; asection *datasec; @@ -440,148 +490,126 @@ struct aout_section_data_struct /* Prototype declarations for functions defined in aoutx.h */ -boolean -NAME(aout,squirt_out_relocs) PARAMS ((bfd *abfd, asection *section)); +extern boolean NAME(aout,squirt_out_relocs) + PARAMS ((bfd *, asection *)); -boolean -NAME(aout,make_sections) PARAMS ((bfd *)); +extern boolean NAME(aout,make_sections) + PARAMS ((bfd *)); -const bfd_target * -NAME(aout,some_aout_object_p) PARAMS ((bfd *abfd, - struct internal_exec *execp, - const bfd_target *(*callback)(bfd *))); +extern const bfd_target * NAME(aout,some_aout_object_p) + PARAMS ((bfd *, struct internal_exec *, const bfd_target *(*) (bfd *))); -boolean -NAME(aout,mkobject) PARAMS ((bfd *abfd)); +extern boolean NAME(aout,mkobject) + PARAMS ((bfd *)); -enum machine_type -NAME(aout,machine_type) PARAMS ((enum bfd_architecture arch, - unsigned long machine, - boolean *unknown)); +extern enum machine_type NAME(aout,machine_type) + PARAMS ((enum bfd_architecture, unsigned long, boolean *)); -boolean -NAME(aout,set_arch_mach) PARAMS ((bfd *abfd, enum bfd_architecture arch, - unsigned long machine)); +extern boolean NAME(aout,set_arch_mach) + PARAMS ((bfd *, enum bfd_architecture, unsigned long)); -boolean -NAME(aout,new_section_hook) PARAMS ((bfd *abfd, asection *newsect)); +extern boolean NAME(aout,new_section_hook) + PARAMS ((bfd *, asection *)); -boolean -NAME(aout,set_section_contents) PARAMS ((bfd *abfd, sec_ptr section, - PTR location, file_ptr offset, bfd_size_type count)); +extern boolean NAME(aout,set_section_contents) + PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type)); -asymbol * -NAME(aout,make_empty_symbol) PARAMS ((bfd *abfd)); +extern asymbol * NAME(aout,make_empty_symbol) + PARAMS ((bfd *)); -boolean -NAME(aout,translate_symbol_table) PARAMS ((bfd *, aout_symbol_type *, - struct external_nlist *, - bfd_size_type, char *, - bfd_size_type, - boolean dynamic)); +extern boolean NAME(aout,translate_symbol_table) + PARAMS ((bfd *, aout_symbol_type *, struct external_nlist *, bfd_size_type, + char *, bfd_size_type, boolean)); -boolean -NAME(aout,slurp_symbol_table) PARAMS ((bfd *abfd)); +extern boolean NAME(aout,slurp_symbol_table) + PARAMS ((bfd *)); -boolean -NAME(aout,write_syms) PARAMS ((bfd *abfd)); +extern boolean NAME(aout,write_syms) + PARAMS ((bfd *)); -void -NAME(aout,reclaim_symbol_table) PARAMS ((bfd *abfd)); +extern void NAME(aout,reclaim_symbol_table) + PARAMS ((bfd *)); -long -NAME(aout,get_symtab_upper_bound) PARAMS ((bfd *abfd)); +extern long NAME(aout,get_symtab_upper_bound) + PARAMS ((bfd *)); -long -NAME(aout,get_symtab) PARAMS ((bfd *abfd, asymbol **location)); +extern long NAME(aout,get_symtab) + PARAMS ((bfd *, asymbol **)); -void -NAME(aout,swap_ext_reloc_in) PARAMS ((bfd *, struct reloc_ext_external *, - arelent *, asymbol **, bfd_size_type)); -void -NAME(aout,swap_std_reloc_in) PARAMS ((bfd *, struct reloc_std_external *, - arelent *, asymbol **, bfd_size_type)); +extern void NAME(aout,swap_ext_reloc_in) + PARAMS ((bfd *, struct reloc_ext_external *, arelent *, asymbol **, + bfd_size_type)); +extern void NAME(aout,swap_std_reloc_in) + PARAMS ((bfd *, struct reloc_std_external *, arelent *, asymbol **, + bfd_size_type)); -reloc_howto_type * -NAME(aout,reloc_type_lookup) PARAMS ((bfd *abfd, - bfd_reloc_code_real_type code)); +extern reloc_howto_type * NAME(aout,reloc_type_lookup) + PARAMS ((bfd *, bfd_reloc_code_real_type)); -boolean -NAME(aout,slurp_reloc_table) PARAMS ((bfd *abfd, sec_ptr asect, - asymbol **symbols)); +extern boolean NAME(aout,slurp_reloc_table) + PARAMS ((bfd *, sec_ptr, asymbol **)); -long -NAME(aout,canonicalize_reloc) PARAMS ((bfd *abfd, sec_ptr section, - arelent **relptr, asymbol **symbols)); +extern long NAME(aout,canonicalize_reloc) + PARAMS ((bfd *, sec_ptr, arelent **, asymbol **)); -long -NAME(aout,get_reloc_upper_bound) PARAMS ((bfd *abfd, sec_ptr asect)); +extern long NAME(aout,get_reloc_upper_bound) + PARAMS ((bfd *, sec_ptr)); -void -NAME(aout,reclaim_reloc) PARAMS ((bfd *ignore_abfd, sec_ptr ignore)); +extern void NAME(aout,reclaim_reloc) + PARAMS ((bfd *, sec_ptr)); -alent * -NAME(aout,get_lineno) PARAMS ((bfd *ignore_abfd, asymbol *ignore_symbol)); +extern alent * NAME(aout,get_lineno) + PARAMS ((bfd *, asymbol *)); -void -NAME(aout,print_symbol) PARAMS ((bfd *ignore_abfd, PTR file, - asymbol *symbol, bfd_print_symbol_type how)); +extern void NAME(aout,print_symbol) + PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type)); -void -NAME(aout,get_symbol_info) PARAMS ((bfd *ignore_abfd, - asymbol *symbol, symbol_info *ret)); +extern void NAME(aout,get_symbol_info) + PARAMS ((bfd *, asymbol *, symbol_info *)); -boolean -NAME(aout,find_nearest_line) PARAMS ((bfd *abfd, asection *section, - asymbol **symbols, bfd_vma offset, CONST char **filename_ptr, - CONST char **functionname_ptr, unsigned int *line_ptr)); +extern boolean NAME(aout,find_nearest_line) + PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, + const char **, unsigned int *)); -long -NAME(aout,read_minisymbols) PARAMS ((bfd *, boolean, PTR *, unsigned int *)); +extern long NAME(aout,read_minisymbols) + PARAMS ((bfd *, boolean, PTR *, unsigned int *)); -asymbol * -NAME(aout,minisymbol_to_symbol) PARAMS ((bfd *, boolean, const PTR, - asymbol *)); +extern asymbol * NAME(aout,minisymbol_to_symbol) + PARAMS ((bfd *, boolean, const PTR, asymbol *)); -int -NAME(aout,sizeof_headers) PARAMS ((bfd *abfd, boolean exec)); +extern int NAME(aout,sizeof_headers) + PARAMS ((bfd *, boolean)); -boolean -NAME(aout,adjust_sizes_and_vmas) PARAMS ((bfd *abfd, - bfd_size_type *text_size, file_ptr *text_end)); +extern boolean NAME(aout,adjust_sizes_and_vmas) + PARAMS ((bfd *, bfd_size_type *, file_ptr *)); -void -NAME(aout,swap_exec_header_in) PARAMS ((bfd *abfd, - struct external_exec *raw_bytes, struct internal_exec *execp)); +extern void NAME(aout,swap_exec_header_in) + PARAMS ((bfd *, struct external_exec *, struct internal_exec *)); -void -NAME(aout,swap_exec_header_out) PARAMS ((bfd *abfd, - struct internal_exec *execp, struct external_exec *raw_bytes)); +extern void NAME(aout,swap_exec_header_out) + PARAMS ((bfd *, struct internal_exec *, struct external_exec *)); -struct bfd_hash_entry * -NAME(aout,link_hash_newfunc) +extern struct bfd_hash_entry * NAME(aout,link_hash_newfunc) PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); -boolean -NAME(aout,link_hash_table_init) - PARAMS ((struct aout_link_hash_table *, bfd *, - struct bfd_hash_entry *(*) (struct bfd_hash_entry *, - struct bfd_hash_table *, - const char *))); - -struct bfd_link_hash_table * -NAME(aout,link_hash_table_create) PARAMS ((bfd *)); - -boolean -NAME(aout,link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *)); - -boolean -NAME(aout,final_link) PARAMS ((bfd *, struct bfd_link_info *, - void (*) (bfd *, file_ptr *, file_ptr *, - file_ptr *))); +extern boolean NAME(aout,link_hash_table_init) + PARAMS ((struct aout_link_hash_table *, bfd *, + struct bfd_hash_entry *(*) (struct bfd_hash_entry *, + struct bfd_hash_table *, + const char *))); + +extern struct bfd_link_hash_table * NAME(aout,link_hash_table_create) + PARAMS ((bfd *)); + +extern boolean NAME(aout,link_add_symbols) + PARAMS ((bfd *, struct bfd_link_info *)); + +extern boolean NAME(aout,final_link) + PARAMS ((bfd *, struct bfd_link_info *, + void (*) (bfd *, file_ptr *, file_ptr *, file_ptr *))); -boolean -NAME(aout,bfd_free_cached_info) PARAMS ((bfd *)); +extern boolean NAME(aout,bfd_free_cached_info) + PARAMS ((bfd *)); /* A.out uses the generic versions of these routines... */ @@ -615,31 +643,32 @@ NAME(aout,bfd_free_cached_info) PARAMS ( obj_reloc_entry_size (abfd)); \ NAME(aout,swap_exec_header_out) (abfd, execp, &exec_bytes); \ \ - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) return false; \ - if (bfd_write ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd) \ - != EXEC_BYTES_SIZE) \ + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 \ + || bfd_bwrite ((PTR) &exec_bytes, (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_outsymbols (abfd) != (asymbol **) NULL \ && bfd_get_symcount (abfd) != 0) \ { \ - if (bfd_seek (abfd, (file_ptr)(N_SYMOFF(*execp)), SEEK_SET) != 0) \ + if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*execp)), SEEK_SET) != 0)\ return false; \ \ - if (! NAME(aout,write_syms)(abfd)) return false; \ + if (! NAME(aout,write_syms) (abfd)) \ + return false; \ } \ \ - if (bfd_seek (abfd, (file_ptr)(N_TRELOFF(*execp)), SEEK_SET) != 0) \ + if (bfd_seek (abfd, (file_ptr) (N_TRELOFF(*execp)), SEEK_SET) != 0) \ return false; \ if (!NAME(aout,squirt_out_relocs) (abfd, obj_textsec (abfd))) \ return false; \ \ - if (bfd_seek (abfd, (file_ptr)(N_DRELOFF(*execp)), SEEK_SET) != 0) \ + if (bfd_seek (abfd, (file_ptr) (N_DRELOFF(*execp)), SEEK_SET) != 0) \ return false; \ - if (!NAME(aout,squirt_out_relocs)(abfd, obj_datasec (abfd))) \ + if (!NAME(aout,squirt_out_relocs) (abfd, obj_datasec (abfd))) \ return false; \ - } + } #endif #endif /* ! defined (LIBAOUT_H) */ diff -uprN binutils-2.11.90.0.31/bfd/libbfd-in.h binutils-2.11.92.0.5/bfd/libbfd-in.h --- binutils-2.11.90.0.31/bfd/libbfd-in.h Sat May 12 00:05:32 2001 +++ binutils-2.11.92.0.5/bfd/libbfd-in.h Mon Oct 1 15:25:21 2001 @@ -5,10 +5,6 @@ Free Software Foundation, Inc. Written by Cygnus Support. -** NOTE: libbfd.h is a GENERATED file. Don't change it; instead, -** change libbfd-in.h or the other BFD source files processed to -** generate this file. - This file is part of BFD, the Binary File Descriptor library. This program is free software; you can redistribute it and/or modify @@ -29,9 +25,9 @@ Foundation, Inc., 59 Temple Place - Suit E.g. align to an 8-byte boundary with argument of 8. Take care never to wrap around if the address is within boundary-1 of the end of the address space. */ -#define BFD_ALIGN(this, boundary) \ - ((((bfd_vma) (this) + (boundary) - 1) >= (bfd_vma) (this)) \ - ? (((bfd_vma) (this) + ((boundary) - 1)) & (~((boundary)-1))) \ +#define BFD_ALIGN(this, boundary) \ + ((((bfd_vma) (this) + (boundary) - 1) >= (bfd_vma) (this)) \ + ? (((bfd_vma) (this) + ((boundary) - 1)) & ~ (bfd_vma) ((boundary)-1)) \ : ~ (bfd_vma) 0) /* If you want to read and write large blocks, you might want to do it @@ -87,20 +83,20 @@ struct areltdata { #define arelt_size(bfd) (((struct areltdata *)((bfd)->arelt_data))->parsed_size) -extern PTR bfd_malloc PARAMS ((size_t)); -extern PTR bfd_realloc PARAMS ((PTR, size_t)); -extern PTR bfd_zmalloc PARAMS ((size_t)); +extern PTR bfd_malloc PARAMS ((bfd_size_type)); +extern PTR bfd_realloc PARAMS ((PTR, bfd_size_type)); +extern PTR bfd_zmalloc PARAMS ((bfd_size_type)); extern bfd_error_handler_type _bfd_error_handler; /* These routines allocate and free things on the BFD's objalloc. */ -extern PTR bfd_alloc PARAMS ((bfd *, size_t)); -extern PTR bfd_zalloc PARAMS ((bfd *, size_t)); +extern PTR bfd_alloc PARAMS ((bfd *, bfd_size_type)); +extern PTR bfd_zalloc PARAMS ((bfd *, bfd_size_type)); extern void bfd_release PARAMS ((bfd *, PTR)); bfd * _bfd_create_empty_archive_element_shell PARAMS ((bfd *obfd)); -bfd * _bfd_look_for_bfd_in_cache PARAMS ((bfd *arch_bfd, file_ptr index)); +bfd * _bfd_look_for_bfd_in_cache PARAMS ((bfd *, file_ptr)); boolean _bfd_add_bfd_to_archive_cache PARAMS ((bfd *, file_ptr, bfd *)); boolean _bfd_generic_mkarchive PARAMS ((bfd *abfd)); const bfd_target *bfd_generic_archive_p PARAMS ((bfd *abfd)); @@ -162,8 +158,7 @@ int bfd_generic_stat_arch_elt PARAMS ((b #define _bfd_generic_new_section_hook \ ((boolean (*) PARAMS ((bfd *, asection *))) bfd_true) extern boolean _bfd_generic_get_section_contents - PARAMS ((bfd *, asection *, PTR location, file_ptr offset, - bfd_size_type count)); + PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); extern boolean _bfd_generic_get_section_contents_in_window PARAMS ((bfd *, asection *, bfd_window *, file_ptr, bfd_size_type)); @@ -440,7 +435,7 @@ extern unsigned int _bfd_count_link_orde /* Final link relocation routine. */ extern bfd_reloc_status_type _bfd_final_link_relocate PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *, - bfd_vma address, bfd_vma value, bfd_vma addend)); + bfd_vma, bfd_vma, bfd_vma)); /* Relocate a particular location by a howto and a value. */ extern bfd_reloc_status_type _bfd_relocate_contents diff -uprN binutils-2.11.90.0.31/bfd/libbfd.c binutils-2.11.92.0.5/bfd/libbfd.c --- binutils-2.11.90.0.31/bfd/libbfd.c Thu May 24 21:23:03 2001 +++ binutils-2.11.92.0.5/bfd/libbfd.c Mon Oct 1 15:25:21 2001 @@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suit #define getpagesize() 2048 #endif -static int real_read PARAMS ((PTR, size_t, size_t, FILE *)); +static size_t real_read PARAMS ((PTR, size_t, size_t, FILE *)); /* SECTION @@ -153,13 +153,20 @@ _bfd_dummy_target (ignore_abfd) PTR bfd_malloc (size) - size_t size; + bfd_size_type size; { PTR ptr; - ptr = (PTR) malloc (size); - if (ptr == NULL && size != 0) + if (size != (size_t) size) + { + bfd_set_error (bfd_error_no_memory); + return NULL; + } + + ptr = (PTR) malloc ((size_t) size); + if (ptr == NULL && (size_t) size != 0) bfd_set_error (bfd_error_no_memory); + return ptr; } @@ -168,16 +175,22 @@ bfd_malloc (size) PTR bfd_realloc (ptr, size) PTR ptr; - size_t size; + bfd_size_type size; { PTR ret; + if (size != (size_t) size) + { + bfd_set_error (bfd_error_no_memory); + return NULL; + } + if (ptr == NULL) - ret = malloc (size); + ret = malloc ((size_t) size); else - ret = realloc (ptr, size); + ret = realloc (ptr, (size_t) size); - if (ret == NULL) + if (ret == NULL && (size_t) size != 0) bfd_set_error (bfd_error_no_memory); return ret; @@ -187,18 +200,24 @@ bfd_realloc (ptr, size) PTR bfd_zmalloc (size) - size_t size; + bfd_size_type size; { PTR ptr; - ptr = (PTR) malloc (size); + if (size != (size_t) size) + { + bfd_set_error (bfd_error_no_memory); + return NULL; + } + + ptr = (PTR) malloc ((size_t) size); - if (size != 0) + if ((size_t) size != 0) { if (ptr == NULL) bfd_set_error (bfd_error_no_memory); else - memset (ptr, 0, size); + memset (ptr, 0, (size_t) size); } return ptr; @@ -213,8 +232,8 @@ bfd_zmalloc (size) contents (0 for non-archive elements). For archive entries this is the first octet in the file, NOT the beginning of the archive header. */ -static int -real_read (where, a,b, file) +static size_t +real_read (where, a, b, file) PTR where; size_t a; size_t b; @@ -242,17 +261,15 @@ real_read (where, a,b, file) #endif } -/* Return value is amount read (FIXME: how are errors and end of file dealt - with? We never call bfd_set_error, which is probably a mistake). */ +/* Return value is amount read. */ bfd_size_type -bfd_read (ptr, size, nitems, abfd) +bfd_bread (ptr, size, abfd) PTR ptr; bfd_size_type size; - bfd_size_type nitems; bfd *abfd; { - int nread; + size_t nread; if ((abfd->flags & BFD_IN_MEMORY) != 0) { @@ -260,7 +277,7 @@ bfd_read (ptr, size, nitems, abfd) bfd_size_type get; bim = (struct bfd_in_memory *) abfd->iostream; - get = size * nitems; + get = size; if (abfd->where + get > bim->size) { if (bim->size < (bfd_size_type) abfd->where) @@ -269,13 +286,13 @@ bfd_read (ptr, size, nitems, abfd) get = bim->size - abfd->where; bfd_set_error (bfd_error_file_truncated); } - memcpy (ptr, bim->buffer + abfd->where, get); + memcpy (ptr, bim->buffer + abfd->where, (size_t) get); abfd->where += get; return get; } - nread = real_read (ptr, 1, (size_t) (size*nitems), bfd_cache_lookup(abfd)); - if (nread > 0) + nread = real_read (ptr, 1, (size_t) size, bfd_cache_lookup (abfd)); + if (nread != (size_t) -1) abfd->where += nread; /* Set bfd_error if we did not read as much data as we expected. @@ -285,7 +302,7 @@ bfd_read (ptr, size, nitems, abfd) A BFD backend may wish to override bfd_error_file_truncated to provide something more useful (eg. no_symbols or wrong_format). */ - if (nread != (int) (size * nitems)) + if (nread != size) { if (ferror (bfd_cache_lookup (abfd))) bfd_set_error (bfd_error_system_call); @@ -386,7 +403,7 @@ bfd_get_file_window (abfd, offset, size, { static size_t pagesize; bfd_window_internal *i = windowp->i; - size_t size_to_alloc = size; + bfd_size_type size_to_alloc = size; if (debug_windows) fprintf (stderr, "bfd_get_file_window (%p, %6ld, %6ld, %p<%p,%lx,%p>, %d)", @@ -402,7 +419,9 @@ bfd_get_file_window (abfd, offset, size, if (i == 0) { - windowp->i = i = (bfd_window_internal *) bfd_zmalloc (sizeof (bfd_window_internal)); + i = ((bfd_window_internal *) + bfd_zmalloc ((bfd_size_type) sizeof (bfd_window_internal))); + windowp->i = i; if (i == 0) return false; i->data = 0; @@ -497,12 +516,11 @@ bfd_get_file_window (abfd, offset, size, { if (size_to_alloc == 0) return true; - bfd_set_error (bfd_error_no_memory); return false; } if (bfd_seek (abfd, offset, SEEK_SET) != 0) return false; - i->size = bfd_read (i->data, size, 1, abfd); + i->size = bfd_bread (i->data, size, abfd); if (i->size != size) return false; i->mapped = 0; @@ -523,24 +541,25 @@ bfd_get_file_window (abfd, offset, size, #endif /* USE_MMAP */ bfd_size_type -bfd_write (ptr, size, nitems, abfd) - CONST PTR ptr; +bfd_bwrite (ptr, size, abfd) + const PTR ptr; bfd_size_type size; - bfd_size_type nitems; bfd *abfd; { - long nwrote; + size_t nwrote; if ((abfd->flags & BFD_IN_MEMORY) != 0) { struct bfd_in_memory *bim = (struct bfd_in_memory *) (abfd->iostream); - size *= nitems; + size = (size_t) size; if (abfd->where + size > bim->size) { - long newsize, oldsize = (bim->size + 127) & ~127; + bfd_size_type newsize, oldsize; + + oldsize = (bim->size + 127) & ~(bfd_size_type) 127; bim->size = abfd->where + size; /* Round up to cut down on memory fragmentation */ - newsize = (bim->size + 127) & ~127; + newsize = (bim->size + 127) & ~(bfd_size_type) 127; if (newsize > oldsize) { bim->buffer = bfd_realloc (bim->buffer, newsize); @@ -551,20 +570,18 @@ bfd_write (ptr, size, nitems, abfd) } } } - memcpy (bim->buffer + abfd->where, ptr, size); + memcpy (bim->buffer + abfd->where, ptr, (size_t) size); abfd->where += size; return size; } - nwrote = fwrite (ptr, 1, (size_t) (size * nitems), - bfd_cache_lookup (abfd)); - if (nwrote > 0) + nwrote = fwrite (ptr, 1, (size_t) size, bfd_cache_lookup (abfd)); + if (nwrote != (size_t) -1) abfd->where += nwrote; - if ((bfd_size_type) nwrote != size * nitems) + if (nwrote != size) { #ifdef ENOSPC - if (nwrote >= 0) - errno = ENOSPC; + errno = ENOSPC; #endif bfd_set_error (bfd_error_system_call); } @@ -576,7 +593,7 @@ INTERNAL_FUNCTION bfd_write_bigendian_4byte_int SYNOPSIS - void bfd_write_bigendian_4byte_int(bfd *abfd, int i); + void bfd_write_bigendian_4byte_int (bfd *, unsigned int); DESCRIPTION Write a 4 byte integer @var{i} to the output BFD @var{abfd}, in big @@ -587,15 +604,15 @@ DESCRIPTION void bfd_write_bigendian_4byte_int (abfd, i) bfd *abfd; - int i; + unsigned int i; { bfd_byte buffer[4]; - bfd_putb32(i, buffer); - if (bfd_write((PTR)buffer, 4, 1, abfd) != 4) + bfd_putb32 ((bfd_vma) i, buffer); + if (bfd_bwrite ((PTR) buffer, (bfd_size_type) 4, abfd) != 4) abort (); } -long +bfd_vma bfd_tell (abfd) bfd *abfd; { @@ -604,7 +621,7 @@ bfd_tell (abfd) if ((abfd->flags & BFD_IN_MEMORY) != 0) return abfd->where; - ptr = ftell (bfd_cache_lookup(abfd)); + ptr = ftell (bfd_cache_lookup (abfd)); if (abfd->my_archive) ptr -= abfd->origin; @@ -657,7 +674,7 @@ bfd_seek (abfd, position, direction) { int result; FILE *f; - file_ptr file_position; + long file_position; /* For the time being, a BFD may not seek to it's end. The problem is that we don't easily have a way to recognize the end of an element in an archive. */ @@ -678,22 +695,22 @@ bfd_seek (abfd, position, direction) else abfd->where += position; - if ((bfd_size_type) abfd->where > bim->size) + if (abfd->where > bim->size) { if ((abfd->direction == write_direction) || (abfd->direction == both_direction)) { - long newsize, oldsize = (bim->size + 127) & ~127; + bfd_size_type newsize, oldsize; + oldsize = (bim->size + 127) & ~(bfd_size_type) 127; bim->size = abfd->where; /* Round up to cut down on memory fragmentation */ - newsize = (bim->size + 127) & ~127; + newsize = (bim->size + 127) & ~(bfd_size_type) 127; if (newsize > oldsize) { bim->buffer = bfd_realloc (bim->buffer, newsize); if (bim->buffer == 0) { bim->size = 0; - bfd_set_error (bfd_error_no_memory); return -1; } } @@ -724,7 +741,7 @@ bfd_seek (abfd, position, direction) if (where_am_i_now != abfd->where) abort (); #endif - if (direction == SEEK_SET && position == abfd->where) + if (direction == SEEK_SET && (bfd_vma) position == abfd->where) return 0; } else @@ -819,9 +836,9 @@ DESCRIPTION .#define bfd_put_signed_8 \ . bfd_put_8 .#define bfd_get_8(abfd, ptr) \ -. (*(unsigned char *) (ptr)) +. (*(unsigned char *) (ptr) & 0xff) .#define bfd_get_signed_8(abfd, ptr) \ -. ((*(unsigned char *) (ptr) ^ 0x80) - 0x80) +. (((*(unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80) . .#define bfd_put_16(abfd, val, ptr) \ . BFD_SEND(abfd, bfd_putx16, ((val),(ptr))) @@ -851,14 +868,14 @@ DESCRIPTION . BFD_SEND(abfd, bfd_getx_signed_64, (ptr)) . .#define bfd_get(bits, abfd, ptr) \ -. ((bits) == 8 ? bfd_get_8 (abfd, ptr) \ +. ( (bits) == 8 ? (bfd_vma) bfd_get_8 (abfd, ptr) \ . : (bits) == 16 ? bfd_get_16 (abfd, ptr) \ . : (bits) == 32 ? bfd_get_32 (abfd, ptr) \ . : (bits) == 64 ? bfd_get_64 (abfd, ptr) \ . : (abort (), (bfd_vma) - 1)) . .#define bfd_put(bits, abfd, val, ptr) \ -. ((bits) == 8 ? bfd_put_8 (abfd, val, ptr) \ +. ( (bits) == 8 ? bfd_put_8 (abfd, val, ptr) \ . : (bits) == 16 ? bfd_put_16 (abfd, val, ptr) \ . : (bits) == 32 ? bfd_put_32 (abfd, val, ptr) \ . : (bits) == 64 ? bfd_put_64 (abfd, val, ptr) \ @@ -873,7 +890,7 @@ FUNCTION DESCRIPTION These macros have the same function as their <> - bretheren, except that they are used for removing information + brethren, except that they are used for removing information for the header records of object files. Believe it or not, some object files keep their header records in big endian order and their data in little endian order. @@ -881,42 +898,89 @@ DESCRIPTION .{* Byte swapping macros for file header data. *} . .#define bfd_h_put_8(abfd, val, ptr) \ -. bfd_put_8 (abfd, val, ptr) +. bfd_put_8 (abfd, val, ptr) .#define bfd_h_put_signed_8(abfd, val, ptr) \ -. bfd_put_8 (abfd, val, ptr) +. bfd_put_8 (abfd, val, ptr) .#define bfd_h_get_8(abfd, ptr) \ -. bfd_get_8 (abfd, ptr) +. bfd_get_8 (abfd, ptr) .#define bfd_h_get_signed_8(abfd, ptr) \ -. bfd_get_signed_8 (abfd, ptr) +. bfd_get_signed_8 (abfd, ptr) . .#define bfd_h_put_16(abfd, val, ptr) \ -. BFD_SEND(abfd, bfd_h_putx16,(val,ptr)) +. BFD_SEND (abfd, bfd_h_putx16, (val, ptr)) .#define bfd_h_put_signed_16 \ -. bfd_h_put_16 +. bfd_h_put_16 .#define bfd_h_get_16(abfd, ptr) \ -. BFD_SEND(abfd, bfd_h_getx16,(ptr)) +. BFD_SEND (abfd, bfd_h_getx16, (ptr)) .#define bfd_h_get_signed_16(abfd, ptr) \ -. BFD_SEND(abfd, bfd_h_getx_signed_16, (ptr)) +. BFD_SEND (abfd, bfd_h_getx_signed_16, (ptr)) . .#define bfd_h_put_32(abfd, val, ptr) \ -. BFD_SEND(abfd, bfd_h_putx32,(val,ptr)) +. BFD_SEND (abfd, bfd_h_putx32, (val, ptr)) .#define bfd_h_put_signed_32 \ -. bfd_h_put_32 +. bfd_h_put_32 .#define bfd_h_get_32(abfd, ptr) \ -. BFD_SEND(abfd, bfd_h_getx32,(ptr)) +. BFD_SEND (abfd, bfd_h_getx32, (ptr)) .#define bfd_h_get_signed_32(abfd, ptr) \ -. BFD_SEND(abfd, bfd_h_getx_signed_32, (ptr)) +. BFD_SEND (abfd, bfd_h_getx_signed_32, (ptr)) . .#define bfd_h_put_64(abfd, val, ptr) \ -. BFD_SEND(abfd, bfd_h_putx64,(val, ptr)) +. BFD_SEND (abfd, bfd_h_putx64, (val, ptr)) .#define bfd_h_put_signed_64 \ -. bfd_h_put_64 +. bfd_h_put_64 .#define bfd_h_get_64(abfd, ptr) \ -. BFD_SEND(abfd, bfd_h_getx64,(ptr)) +. BFD_SEND (abfd, bfd_h_getx64, (ptr)) .#define bfd_h_get_signed_64(abfd, ptr) \ -. BFD_SEND(abfd, bfd_h_getx_signed_64, (ptr)) +. BFD_SEND (abfd, bfd_h_getx_signed_64, (ptr)) . -*/ +.{* Refinements on the above, which should eventually go away. Save +. cluttering the source with (bfd_vma) and (bfd_byte *) casts. *} +. +.#define H_PUT_64(abfd, val, where) \ +. bfd_h_put_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) +. +.#define H_PUT_32(abfd, val, where) \ +. bfd_h_put_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) +. +.#define H_PUT_16(abfd, val, where) \ +. bfd_h_put_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) +. +.#define H_PUT_8 bfd_h_put_8 +. +.#define H_PUT_S64(abfd, val, where) \ +. bfd_h_put_signed_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) +. +.#define H_PUT_S32(abfd, val, where) \ +. bfd_h_put_signed_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) +. +.#define H_PUT_S16(abfd, val, where) \ +. bfd_h_put_signed_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where)) +. +.#define H_PUT_S8 bfd_h_put_signed_8 +. +.#define H_GET_64(abfd, where) \ +. bfd_h_get_64 ((abfd), (bfd_byte *) (where)) +. +.#define H_GET_32(abfd, where) \ +. bfd_h_get_32 ((abfd), (bfd_byte *) (where)) +. +.#define H_GET_16(abfd, where) \ +. bfd_h_get_16 ((abfd), (bfd_byte *) (where)) +. +.#define H_GET_8 bfd_h_get_8 +. +.#define H_GET_S64(abfd, where) \ +. bfd_h_get_signed_64 ((abfd), (bfd_byte *) (where)) +. +.#define H_GET_S32(abfd, where) \ +. bfd_h_get_signed_32 ((abfd), (bfd_byte *) (where)) +. +.#define H_GET_S16(abfd, where) \ +. bfd_h_get_signed_16 ((abfd), (bfd_byte *) (where)) +. +.#define H_GET_S8 bfd_h_get_signed_8 +. +.*/ /* Sign extension to bfd_signed_vma. */ #define COERCE16(x) (((bfd_signed_vma) (x) ^ 0x8000) - 0x8000) @@ -1240,14 +1304,14 @@ _bfd_generic_get_section_contents (abfd, if (count == 0) return true; - if ((bfd_size_type) (offset + count) > section->_raw_size) + if (offset + count > section->_raw_size) { bfd_set_error (bfd_error_invalid_operation); return false; } if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0 - || bfd_read (location, (bfd_size_type) 1, count, abfd) != count) + || bfd_bread (location, count, abfd) != count) return false; return true; @@ -1272,10 +1336,11 @@ _bfd_generic_get_section_contents_in_win /* @@ FIXME : If the internal window has a refcount of 1 and was allocated with malloc instead of mmap, just reuse it. */ bfd_free_window (w); - w->i = (bfd_window_internal *) bfd_zmalloc (sizeof (bfd_window_internal)); + w->i = ((bfd_window_internal *) + bfd_zmalloc ((bfd_size_type) sizeof (bfd_window_internal))); if (w->i == NULL) return false; - w->i->data = (PTR) bfd_malloc ((size_t) count); + w->i->data = (PTR) bfd_malloc (count); if (w->i->data == NULL) { free (w->i); @@ -1288,7 +1353,7 @@ _bfd_generic_get_section_contents_in_win w->data = w->i->data; return bfd_get_section_contents (abfd, section, w->data, offset, count); } - if ((bfd_size_type) (offset+count) > section->_raw_size + if (offset + count > section->_raw_size || (bfd_get_file_window (abfd, section->filepos + offset, count, w, true) == false)) return false; @@ -1313,8 +1378,8 @@ _bfd_generic_set_section_contents (abfd, if (count == 0) return true; - if (bfd_seek (abfd, (file_ptr) (section->filepos + offset), SEEK_SET) == -1 - || bfd_write (location, (bfd_size_type) 1, count, abfd) != count) + if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0 + || bfd_bwrite (location, count, abfd) != count) return false; return true; @@ -1325,11 +1390,11 @@ INTERNAL_FUNCTION bfd_log2 SYNOPSIS - unsigned int bfd_log2(bfd_vma x); + unsigned int bfd_log2 (bfd_vma x); DESCRIPTION Return the log base 2 of the value supplied, rounded up. E.g., an - @var{x} of 1025 returns 11. + @var{x} of 1025 returns 11. A @var{x} of 0 returns 0. */ unsigned int @@ -1372,7 +1437,7 @@ _bfd_generic_verify_endian_match (ibfd, else msg = _("%s: compiled for a little endian system and target is big endian"); - (*_bfd_error_handler) (msg, bfd_get_filename (ibfd)); + (*_bfd_error_handler) (msg, bfd_archive_filename (ibfd)); bfd_set_error (bfd_error_wrong_format); return false; @@ -1380,3 +1445,26 @@ _bfd_generic_verify_endian_match (ibfd, return true; } + +/* Give a warning at runtime if someone compiles code which calls + old routines. */ +void +warn_deprecated (what, file, line, func) + const char *what; + const char *file; + int line; + const char *func; +{ + /* Poor man's tracking of functions we've already warned about. */ + static size_t mask = 0; + + if (~(size_t) func & ~mask) + { + fprintf (stderr, _("Deprecated %s called"), what); + if (func) + fprintf (stderr, _(" at %s line %d in %s\n"), file, line, func); + else + fprintf (stderr, "\n"); + mask |= ~(size_t) func; + } +} diff -uprN binutils-2.11.90.0.31/bfd/libbfd.h binutils-2.11.92.0.5/bfd/libbfd.h --- binutils-2.11.90.0.31/bfd/libbfd.h Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/bfd/libbfd.h Mon Oct 1 15:25:21 2001 @@ -1,3 +1,8 @@ +/* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically + generated from "libbfd-in.h", "init.c", "libbfd.c", "cache.c", + "reloc.c", "archures.c" and "elf.c". + Run "make headers" in your build bfd/ to regenerate. */ + /* libbfd.h -- Declarations used by bfd library *implementation*. (This include file is not for users of the library.) Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, @@ -5,10 +10,6 @@ Free Software Foundation, Inc. Written by Cygnus Support. -** NOTE: libbfd.h is a GENERATED file. Don't change it; instead, -** change libbfd-in.h or the other BFD source files processed to -** generate this file. - This file is part of BFD, the Binary File Descriptor library. This program is free software; you can redistribute it and/or modify @@ -29,9 +30,9 @@ Foundation, Inc., 59 Temple Place - Suit E.g. align to an 8-byte boundary with argument of 8. Take care never to wrap around if the address is within boundary-1 of the end of the address space. */ -#define BFD_ALIGN(this, boundary) \ - ((((bfd_vma) (this) + (boundary) - 1) >= (bfd_vma) (this)) \ - ? (((bfd_vma) (this) + ((boundary) - 1)) & (~((boundary)-1))) \ +#define BFD_ALIGN(this, boundary) \ + ((((bfd_vma) (this) + (boundary) - 1) >= (bfd_vma) (this)) \ + ? (((bfd_vma) (this) + ((boundary) - 1)) & ~ (bfd_vma) ((boundary)-1)) \ : ~ (bfd_vma) 0) /* If you want to read and write large blocks, you might want to do it @@ -87,20 +88,20 @@ struct areltdata { #define arelt_size(bfd) (((struct areltdata *)((bfd)->arelt_data))->parsed_size) -extern PTR bfd_malloc PARAMS ((size_t)); -extern PTR bfd_realloc PARAMS ((PTR, size_t)); -extern PTR bfd_zmalloc PARAMS ((size_t)); +extern PTR bfd_malloc PARAMS ((bfd_size_type)); +extern PTR bfd_realloc PARAMS ((PTR, bfd_size_type)); +extern PTR bfd_zmalloc PARAMS ((bfd_size_type)); extern bfd_error_handler_type _bfd_error_handler; /* These routines allocate and free things on the BFD's objalloc. */ -extern PTR bfd_alloc PARAMS ((bfd *, size_t)); -extern PTR bfd_zalloc PARAMS ((bfd *, size_t)); +extern PTR bfd_alloc PARAMS ((bfd *, bfd_size_type)); +extern PTR bfd_zalloc PARAMS ((bfd *, bfd_size_type)); extern void bfd_release PARAMS ((bfd *, PTR)); bfd * _bfd_create_empty_archive_element_shell PARAMS ((bfd *obfd)); -bfd * _bfd_look_for_bfd_in_cache PARAMS ((bfd *arch_bfd, file_ptr index)); +bfd * _bfd_look_for_bfd_in_cache PARAMS ((bfd *, file_ptr)); boolean _bfd_add_bfd_to_archive_cache PARAMS ((bfd *, file_ptr, bfd *)); boolean _bfd_generic_mkarchive PARAMS ((bfd *abfd)); const bfd_target *bfd_generic_archive_p PARAMS ((bfd *abfd)); @@ -162,8 +163,7 @@ int bfd_generic_stat_arch_elt PARAMS ((b #define _bfd_generic_new_section_hook \ ((boolean (*) PARAMS ((bfd *, asection *))) bfd_true) extern boolean _bfd_generic_get_section_contents - PARAMS ((bfd *, asection *, PTR location, file_ptr offset, - bfd_size_type count)); + PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); extern boolean _bfd_generic_get_section_contents_in_window PARAMS ((bfd *, asection *, bfd_window *, file_ptr, bfd_size_type)); @@ -440,7 +440,7 @@ extern unsigned int _bfd_count_link_orde /* Final link relocation routine. */ extern bfd_reloc_status_type _bfd_final_link_relocate PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *, - bfd_vma address, bfd_vma value, bfd_vma addend)); + bfd_vma, bfd_vma, bfd_vma)); /* Relocate a particular location by a howto and a value. */ extern bfd_reloc_status_type _bfd_relocate_contents @@ -578,7 +578,7 @@ extern boolean _bfd_sh_align_load_span /* And more follows */ void -bfd_write_bigendian_4byte_int PARAMS ((bfd *abfd, int i)); +bfd_write_bigendian_4byte_int PARAMS ((bfd *, unsigned int)); unsigned int bfd_log2 PARAMS ((bfd_vma x)); @@ -706,16 +706,11 @@ static const char *const bfd_reloc_code_ "BFD_RELOC_ALPHA_LITERAL", "BFD_RELOC_ALPHA_ELF_LITERAL", "BFD_RELOC_ALPHA_LITUSE", - "BFD_RELOC_ALPHA_USER_LITERAL", - "BFD_RELOC_ALPHA_USER_LITUSE_BASE", - "BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF", - "BFD_RELOC_ALPHA_USER_LITUSE_JSR", - "BFD_RELOC_ALPHA_USER_GPDISP", - "BFD_RELOC_ALPHA_USER_GPRELHIGH", - "BFD_RELOC_ALPHA_USER_GPRELLOW", "BFD_RELOC_ALPHA_HINT", "BFD_RELOC_ALPHA_LINKAGE", "BFD_RELOC_ALPHA_CODEADDR", + "BFD_RELOC_ALPHA_GPREL_HI16", + "BFD_RELOC_ALPHA_GPREL_LO16", "BFD_RELOC_MIPS_JMP", "BFD_RELOC_MIPS16_JMP", "BFD_RELOC_MIPS16_GPREL", @@ -821,7 +816,7 @@ static const char *const bfd_reloc_code_ "BFD_RELOC_PPC64_TOC16_HI", "BFD_RELOC_PPC64_TOC16_HA", "BFD_RELOC_PPC64_TOC", - "BFD_RELOC_PPC64_PLTGOT16 ", + "BFD_RELOC_PPC64_PLTGOT16", "BFD_RELOC_PPC64_PLTGOT16_LO", "BFD_RELOC_PPC64_PLTGOT16_HI", "BFD_RELOC_PPC64_PLTGOT16_HA", diff -uprN binutils-2.11.90.0.31/bfd/libcoff-in.h binutils-2.11.92.0.5/bfd/libcoff-in.h --- binutils-2.11.90.0.31/bfd/libcoff-in.h Thu May 24 21:23:03 2001 +++ binutils-2.11.92.0.5/bfd/libcoff-in.h Mon Oct 1 15:25:21 2001 @@ -4,9 +4,6 @@ Free Software Foundation, Inc. Written by Cygnus Support. -** NOTE: libcoff.h is a GENERATED file. Don't change it; instead, -** change libcoff-in.h or coffcode.h. - This file is part of BFD, the Binary File Descriptor library. This program is free software; you can redistribute it and/or modify @@ -302,50 +299,64 @@ struct coff_link_hash_table #define coff_hash_table(p) ((struct coff_link_hash_table *) ((p)->hash)) /* Functions in coffgen.c. */ -extern const bfd_target *coff_object_p PARAMS ((bfd *)); -extern struct sec *coff_section_from_bfd_index PARAMS ((bfd *, int)); -extern long coff_get_symtab_upper_bound PARAMS ((bfd *)); -extern long coff_get_symtab PARAMS ((bfd *, asymbol **)); -extern int coff_count_linenumbers PARAMS ((bfd *)); -extern struct coff_symbol_struct *coff_symbol_from PARAMS ((bfd *, asymbol *)); -extern boolean coff_renumber_symbols PARAMS ((bfd *, int *)); -extern void coff_mangle_symbols PARAMS ((bfd *)); -extern boolean coff_write_symbols PARAMS ((bfd *)); -extern boolean coff_write_linenumbers PARAMS ((bfd *)); -extern alent *coff_get_lineno PARAMS ((bfd *, asymbol *)); -extern asymbol *coff_section_symbol PARAMS ((bfd *, char *)); -extern boolean _bfd_coff_get_external_symbols PARAMS ((bfd *)); -extern const char *_bfd_coff_read_string_table PARAMS ((bfd *)); -extern boolean _bfd_coff_free_symbols PARAMS ((bfd *)); -extern struct coff_ptr_struct *coff_get_normalized_symtab PARAMS ((bfd *)); -extern long coff_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr)); -extern asymbol *coff_make_empty_symbol PARAMS ((bfd *)); -extern void coff_print_symbol PARAMS ((bfd *, PTR filep, asymbol *, - bfd_print_symbol_type how)); -extern void coff_get_symbol_info PARAMS ((bfd *, asymbol *, - symbol_info *ret)); -extern boolean _bfd_coff_is_local_label_name PARAMS ((bfd *, const char *)); -extern asymbol *coff_bfd_make_debug_symbol PARAMS ((bfd *, PTR, - unsigned long)); -extern boolean coff_find_nearest_line PARAMS ((bfd *, - asection *, - asymbol **, - bfd_vma offset, - CONST char **filename_ptr, - CONST char **functionname_ptr, - unsigned int *line_ptr)); -extern int coff_sizeof_headers PARAMS ((bfd *, boolean reloc)); +extern const bfd_target *coff_object_p + PARAMS ((bfd *)); +extern struct sec *coff_section_from_bfd_index + PARAMS ((bfd *, int)); +extern long coff_get_symtab_upper_bound + PARAMS ((bfd *)); +extern long coff_get_symtab + PARAMS ((bfd *, asymbol **)); +extern int coff_count_linenumbers + PARAMS ((bfd *)); +extern struct coff_symbol_struct *coff_symbol_from + PARAMS ((bfd *, asymbol *)); +extern boolean coff_renumber_symbols + PARAMS ((bfd *, int *)); +extern void coff_mangle_symbols + PARAMS ((bfd *)); +extern boolean coff_write_symbols + PARAMS ((bfd *)); +extern boolean coff_write_linenumbers + PARAMS ((bfd *)); +extern alent *coff_get_lineno + PARAMS ((bfd *, asymbol *)); +extern asymbol *coff_section_symbol + PARAMS ((bfd *, char *)); +extern boolean _bfd_coff_get_external_symbols + PARAMS ((bfd *)); +extern const char *_bfd_coff_read_string_table + PARAMS ((bfd *)); +extern boolean _bfd_coff_free_symbols + PARAMS ((bfd *)); +extern struct coff_ptr_struct *coff_get_normalized_symtab + PARAMS ((bfd *)); +extern long coff_get_reloc_upper_bound + PARAMS ((bfd *, sec_ptr)); +extern asymbol *coff_make_empty_symbol + PARAMS ((bfd *)); +extern void coff_print_symbol + PARAMS ((bfd *, PTR filep, asymbol *, bfd_print_symbol_type)); +extern void coff_get_symbol_info + PARAMS ((bfd *, asymbol *, symbol_info *ret)); +extern boolean _bfd_coff_is_local_label_name + PARAMS ((bfd *, const char *)); +extern asymbol *coff_bfd_make_debug_symbol + PARAMS ((bfd *, PTR, unsigned long)); +extern boolean coff_find_nearest_line + PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, + const char **, unsigned int *)); +extern int coff_sizeof_headers + PARAMS ((bfd *, boolean)); extern boolean bfd_coff_reloc16_relax_section PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *)); extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, - bfd_byte *, boolean relocateable, asymbol **)); -extern bfd_vma bfd_coff_reloc16_get_value PARAMS ((arelent *, - struct bfd_link_info *, - asection *)); -extern void bfd_perform_slip PARAMS ((bfd *abfd, unsigned int slip, - asection *input_section, - bfd_vma val)); + bfd_byte *, boolean, asymbol **)); +extern bfd_vma bfd_coff_reloc16_get_value + PARAMS ((arelent *, struct bfd_link_info *, asection *)); +extern void bfd_perform_slip + PARAMS ((bfd *, unsigned int, asection *, bfd_vma)); /* Functions and types in cofflink.c. */ @@ -559,10 +570,12 @@ extern boolean _bfd_coff_reloc_link_orde /* Functions in xcofflink.c. */ -extern long _bfd_xcoff_get_dynamic_symtab_upper_bound PARAMS ((bfd *)); +extern long _bfd_xcoff_get_dynamic_symtab_upper_bound + PARAMS ((bfd *)); extern long _bfd_xcoff_canonicalize_dynamic_symtab PARAMS ((bfd *, asymbol **)); -extern long _bfd_xcoff_get_dynamic_reloc_upper_bound PARAMS ((bfd *)); +extern long _bfd_xcoff_get_dynamic_reloc_upper_bound + PARAMS ((bfd *)); extern long _bfd_xcoff_canonicalize_dynamic_reloc PARAMS ((bfd *, arelent **, asymbol **)); extern struct bfd_link_hash_table *_bfd_xcoff_bfd_link_hash_table_create @@ -578,7 +591,8 @@ extern boolean _bfd_ppc_xcoff_relocate_s /* Functions in coff-ppc.c. FIXME: These are called be pe.em in the linker, and so should start with bfd and be declared in bfd.h. */ -extern boolean ppc_allocate_toc_section PARAMS ((struct bfd_link_info *)); +extern boolean ppc_allocate_toc_section + PARAMS ((struct bfd_link_info *)); extern boolean ppc_process_before_allocation PARAMS ((bfd *, struct bfd_link_info *)); diff -uprN binutils-2.11.90.0.31/bfd/libcoff.h binutils-2.11.92.0.5/bfd/libcoff.h --- binutils-2.11.90.0.31/bfd/libcoff.h Tue Jun 19 11:57:33 2001 +++ binutils-2.11.92.0.5/bfd/libcoff.h Mon Oct 1 15:25:21 2001 @@ -1,12 +1,13 @@ +/* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically + generated from "libcoff-in.h" and "coffcode.h". + Run "make headers" in your build bfd/ to regenerate. */ + /* BFD COFF object file private structure. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Written by Cygnus Support. -** NOTE: libcoff.h is a GENERATED file. Don't change it; instead, -** change libcoff-in.h or coffcode.h. - This file is part of BFD, the Binary File Descriptor library. This program is free software; you can redistribute it and/or modify @@ -302,50 +303,64 @@ struct coff_link_hash_table #define coff_hash_table(p) ((struct coff_link_hash_table *) ((p)->hash)) /* Functions in coffgen.c. */ -extern const bfd_target *coff_object_p PARAMS ((bfd *)); -extern struct sec *coff_section_from_bfd_index PARAMS ((bfd *, int)); -extern long coff_get_symtab_upper_bound PARAMS ((bfd *)); -extern long coff_get_symtab PARAMS ((bfd *, asymbol **)); -extern int coff_count_linenumbers PARAMS ((bfd *)); -extern struct coff_symbol_struct *coff_symbol_from PARAMS ((bfd *, asymbol *)); -extern boolean coff_renumber_symbols PARAMS ((bfd *, int *)); -extern void coff_mangle_symbols PARAMS ((bfd *)); -extern boolean coff_write_symbols PARAMS ((bfd *)); -extern boolean coff_write_linenumbers PARAMS ((bfd *)); -extern alent *coff_get_lineno PARAMS ((bfd *, asymbol *)); -extern asymbol *coff_section_symbol PARAMS ((bfd *, char *)); -extern boolean _bfd_coff_get_external_symbols PARAMS ((bfd *)); -extern const char *_bfd_coff_read_string_table PARAMS ((bfd *)); -extern boolean _bfd_coff_free_symbols PARAMS ((bfd *)); -extern struct coff_ptr_struct *coff_get_normalized_symtab PARAMS ((bfd *)); -extern long coff_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr)); -extern asymbol *coff_make_empty_symbol PARAMS ((bfd *)); -extern void coff_print_symbol PARAMS ((bfd *, PTR filep, asymbol *, - bfd_print_symbol_type how)); -extern void coff_get_symbol_info PARAMS ((bfd *, asymbol *, - symbol_info *ret)); -extern boolean _bfd_coff_is_local_label_name PARAMS ((bfd *, const char *)); -extern asymbol *coff_bfd_make_debug_symbol PARAMS ((bfd *, PTR, - unsigned long)); -extern boolean coff_find_nearest_line PARAMS ((bfd *, - asection *, - asymbol **, - bfd_vma offset, - CONST char **filename_ptr, - CONST char **functionname_ptr, - unsigned int *line_ptr)); -extern int coff_sizeof_headers PARAMS ((bfd *, boolean reloc)); +extern const bfd_target *coff_object_p + PARAMS ((bfd *)); +extern struct sec *coff_section_from_bfd_index + PARAMS ((bfd *, int)); +extern long coff_get_symtab_upper_bound + PARAMS ((bfd *)); +extern long coff_get_symtab + PARAMS ((bfd *, asymbol **)); +extern int coff_count_linenumbers + PARAMS ((bfd *)); +extern struct coff_symbol_struct *coff_symbol_from + PARAMS ((bfd *, asymbol *)); +extern boolean coff_renumber_symbols + PARAMS ((bfd *, int *)); +extern void coff_mangle_symbols + PARAMS ((bfd *)); +extern boolean coff_write_symbols + PARAMS ((bfd *)); +extern boolean coff_write_linenumbers + PARAMS ((bfd *)); +extern alent *coff_get_lineno + PARAMS ((bfd *, asymbol *)); +extern asymbol *coff_section_symbol + PARAMS ((bfd *, char *)); +extern boolean _bfd_coff_get_external_symbols + PARAMS ((bfd *)); +extern const char *_bfd_coff_read_string_table + PARAMS ((bfd *)); +extern boolean _bfd_coff_free_symbols + PARAMS ((bfd *)); +extern struct coff_ptr_struct *coff_get_normalized_symtab + PARAMS ((bfd *)); +extern long coff_get_reloc_upper_bound + PARAMS ((bfd *, sec_ptr)); +extern asymbol *coff_make_empty_symbol + PARAMS ((bfd *)); +extern void coff_print_symbol + PARAMS ((bfd *, PTR filep, asymbol *, bfd_print_symbol_type)); +extern void coff_get_symbol_info + PARAMS ((bfd *, asymbol *, symbol_info *ret)); +extern boolean _bfd_coff_is_local_label_name + PARAMS ((bfd *, const char *)); +extern asymbol *coff_bfd_make_debug_symbol + PARAMS ((bfd *, PTR, unsigned long)); +extern boolean coff_find_nearest_line + PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, + const char **, unsigned int *)); +extern int coff_sizeof_headers + PARAMS ((bfd *, boolean)); extern boolean bfd_coff_reloc16_relax_section PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *)); extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, - bfd_byte *, boolean relocateable, asymbol **)); -extern bfd_vma bfd_coff_reloc16_get_value PARAMS ((arelent *, - struct bfd_link_info *, - asection *)); -extern void bfd_perform_slip PARAMS ((bfd *abfd, unsigned int slip, - asection *input_section, - bfd_vma val)); + bfd_byte *, boolean, asymbol **)); +extern bfd_vma bfd_coff_reloc16_get_value + PARAMS ((arelent *, struct bfd_link_info *, asection *)); +extern void bfd_perform_slip + PARAMS ((bfd *, unsigned int, asection *, bfd_vma)); /* Functions and types in cofflink.c. */ @@ -559,10 +574,12 @@ extern boolean _bfd_coff_reloc_link_orde /* Functions in xcofflink.c. */ -extern long _bfd_xcoff_get_dynamic_symtab_upper_bound PARAMS ((bfd *)); +extern long _bfd_xcoff_get_dynamic_symtab_upper_bound + PARAMS ((bfd *)); extern long _bfd_xcoff_canonicalize_dynamic_symtab PARAMS ((bfd *, asymbol **)); -extern long _bfd_xcoff_get_dynamic_reloc_upper_bound PARAMS ((bfd *)); +extern long _bfd_xcoff_get_dynamic_reloc_upper_bound + PARAMS ((bfd *)); extern long _bfd_xcoff_canonicalize_dynamic_reloc PARAMS ((bfd *, arelent **, asymbol **)); extern struct bfd_link_hash_table *_bfd_xcoff_bfd_link_hash_table_create @@ -578,7 +595,8 @@ extern boolean _bfd_ppc_xcoff_relocate_s /* Functions in coff-ppc.c. FIXME: These are called be pe.em in the linker, and so should start with bfd and be declared in bfd.h. */ -extern boolean ppc_allocate_toc_section PARAMS ((struct bfd_link_info *)); +extern boolean ppc_allocate_toc_section + PARAMS ((struct bfd_link_info *)); extern boolean ppc_process_before_allocation PARAMS ((bfd *, struct bfd_link_info *)); @@ -586,39 +604,37 @@ extern boolean ppc_process_before_alloca typedef struct coff_ptr_struct { - - /* Remembers the offset from the first symbol in the file for - this symbol. Generated by coff_renumber_symbols. */ -unsigned int offset; - - /* Should the value of this symbol be renumbered. Used for - XCOFF C_BSTAT symbols. Set by coff_slurp_symbol_table. */ -unsigned int fix_value : 1; - - /* Should the tag field of this symbol be renumbered. - Created by coff_pointerize_aux. */ -unsigned int fix_tag : 1; - - /* Should the endidx field of this symbol be renumbered. - Created by coff_pointerize_aux. */ -unsigned int fix_end : 1; - - /* Should the x_csect.x_scnlen field be renumbered. - Created by coff_pointerize_aux. */ -unsigned int fix_scnlen : 1; - - /* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the - index into the line number entries. Set by - coff_slurp_symbol_table. */ -unsigned int fix_line : 1; - - /* The container for the symbol structure as read and translated - from the file. */ - -union { - union internal_auxent auxent; - struct internal_syment syment; - } u; + /* Remembers the offset from the first symbol in the file for + this symbol. Generated by coff_renumber_symbols. */ + unsigned int offset; + + /* Should the value of this symbol be renumbered. Used for + XCOFF C_BSTAT symbols. Set by coff_slurp_symbol_table. */ + unsigned int fix_value : 1; + + /* Should the tag field of this symbol be renumbered. + Created by coff_pointerize_aux. */ + unsigned int fix_tag : 1; + + /* Should the endidx field of this symbol be renumbered. + Created by coff_pointerize_aux. */ + unsigned int fix_end : 1; + + /* Should the x_csect.x_scnlen field be renumbered. + Created by coff_pointerize_aux. */ + unsigned int fix_scnlen : 1; + + /* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the + index into the line number entries. Set by coff_slurp_symbol_table. */ + unsigned int fix_line : 1; + + /* The container for the symbol structure as read and translated + from the file. */ + union + { + union internal_auxent auxent; + struct internal_syment syment; + } u; } combined_entry_type; @@ -626,17 +642,17 @@ union { typedef struct coff_symbol_struct { - /* The actual symbol which the rest of BFD works with */ -asymbol symbol; + /* The actual symbol which the rest of BFD works with */ + asymbol symbol; - /* A pointer to the hidden information for this symbol */ -combined_entry_type *native; + /* A pointer to the hidden information for this symbol */ + combined_entry_type *native; - /* A pointer to the linenumber information for this symbol */ -struct lineno_cache_entry *lineno; + /* A pointer to the linenumber information for this symbol */ + struct lineno_cache_entry *lineno; - /* Have the line numbers been relocated yet ? */ -boolean done_lineno; + /* Have the line numbers been relocated yet ? */ + boolean done_lineno; } coff_symbol_type; /* COFF symbol classifications. */ @@ -656,228 +672,166 @@ enum coff_symbol_classification typedef struct { - void (*_bfd_coff_swap_aux_in) PARAMS (( - bfd *abfd, - PTR ext, - int type, - int class, - int indaux, - int numaux, - PTR in)); - - void (*_bfd_coff_swap_sym_in) PARAMS (( - bfd *abfd , - PTR ext, - PTR in)); - - void (*_bfd_coff_swap_lineno_in) PARAMS (( - bfd *abfd, - PTR ext, - PTR in)); - - unsigned int (*_bfd_coff_swap_aux_out) PARAMS (( - bfd *abfd, - PTR in, - int type, - int class, - int indaux, - int numaux, - PTR ext)); - - unsigned int (*_bfd_coff_swap_sym_out) PARAMS (( - bfd *abfd, - PTR in, - PTR ext)); - - unsigned int (*_bfd_coff_swap_lineno_out) PARAMS (( - bfd *abfd, - PTR in, - PTR ext)); - - unsigned int (*_bfd_coff_swap_reloc_out) PARAMS (( - bfd *abfd, - PTR src, - PTR dst)); - - unsigned int (*_bfd_coff_swap_filehdr_out) PARAMS (( - bfd *abfd, - PTR in, - PTR out)); - - unsigned int (*_bfd_coff_swap_aouthdr_out) PARAMS (( - bfd *abfd, - PTR in, - PTR out)); - - unsigned int (*_bfd_coff_swap_scnhdr_out) PARAMS (( - bfd *abfd, - PTR in, - PTR out)); - - unsigned int _bfd_filhsz; - unsigned int _bfd_aoutsz; - unsigned int _bfd_scnhsz; - unsigned int _bfd_symesz; - unsigned int _bfd_auxesz; - unsigned int _bfd_relsz; - unsigned int _bfd_linesz; - unsigned int _bfd_filnmlen; - boolean _bfd_coff_long_filenames; - boolean _bfd_coff_long_section_names; - unsigned int _bfd_coff_default_section_alignment_power; - boolean _bfd_coff_force_symnames_in_strings; - unsigned int _bfd_coff_debug_string_prefix_length; - void (*_bfd_coff_swap_filehdr_in) PARAMS (( - bfd *abfd, - PTR ext, - PTR in)); - void (*_bfd_coff_swap_aouthdr_in) PARAMS (( - bfd *abfd, - PTR ext, - PTR in)); - void (*_bfd_coff_swap_scnhdr_in) PARAMS (( - bfd *abfd, - PTR ext, - PTR in)); - void (*_bfd_coff_swap_reloc_in) PARAMS (( - bfd *abfd, - PTR ext, - PTR in)); - boolean (*_bfd_coff_bad_format_hook) PARAMS (( - bfd *abfd, - PTR internal_filehdr)); - boolean (*_bfd_coff_set_arch_mach_hook) PARAMS (( - bfd *abfd, - PTR internal_filehdr)); - PTR (*_bfd_coff_mkobject_hook) PARAMS (( - bfd *abfd, - PTR internal_filehdr, - PTR internal_aouthdr)); - boolean (*_bfd_styp_to_sec_flags_hook) PARAMS (( - bfd *abfd, - PTR internal_scnhdr, - const char *name, - asection *section, - flagword *flags_ptr)); - void (*_bfd_set_alignment_hook) PARAMS (( - bfd *abfd, - asection *sec, - PTR internal_scnhdr)); - boolean (*_bfd_coff_slurp_symbol_table) PARAMS (( - bfd *abfd)); - boolean (*_bfd_coff_symname_in_debug) PARAMS (( - bfd *abfd, - struct internal_syment *sym)); - boolean (*_bfd_coff_pointerize_aux_hook) PARAMS (( - bfd *abfd, - combined_entry_type *table_base, - combined_entry_type *symbol, - unsigned int indaux, - combined_entry_type *aux)); - boolean (*_bfd_coff_print_aux) PARAMS (( - bfd *abfd, - FILE *file, - combined_entry_type *table_base, - combined_entry_type *symbol, - combined_entry_type *aux, - unsigned int indaux)); - void (*_bfd_coff_reloc16_extra_cases) PARAMS (( - bfd *abfd, - struct bfd_link_info *link_info, - struct bfd_link_order *link_order, - arelent *reloc, - bfd_byte *data, - unsigned int *src_ptr, - unsigned int *dst_ptr)); - int (*_bfd_coff_reloc16_estimate) PARAMS (( - bfd *abfd, - asection *input_section, - arelent *r, - unsigned int shrink, - struct bfd_link_info *link_info)); - enum coff_symbol_classification (*_bfd_coff_classify_symbol) PARAMS (( - bfd *abfd, - struct internal_syment *)); - boolean (*_bfd_coff_compute_section_file_positions) PARAMS (( - bfd *abfd)); - boolean (*_bfd_coff_start_final_link) PARAMS (( - bfd *output_bfd, - struct bfd_link_info *info)); - boolean (*_bfd_coff_relocate_section) PARAMS (( - bfd *output_bfd, - struct bfd_link_info *info, - bfd *input_bfd, - asection *input_section, - bfd_byte *contents, - struct internal_reloc *relocs, - struct internal_syment *syms, - asection **sections)); - reloc_howto_type *(*_bfd_coff_rtype_to_howto) PARAMS (( - bfd *abfd, - asection *sec, - struct internal_reloc *rel, - struct coff_link_hash_entry *h, - struct internal_syment *sym, - bfd_vma *addendp)); - boolean (*_bfd_coff_adjust_symndx) PARAMS (( - bfd *obfd, - struct bfd_link_info *info, - bfd *ibfd, - asection *sec, - struct internal_reloc *reloc, - boolean *adjustedp)); - boolean (*_bfd_coff_link_add_one_symbol) PARAMS (( - struct bfd_link_info *info, - bfd *abfd, - const char *name, - flagword flags, - asection *section, - bfd_vma value, - const char *string, - boolean copy, - boolean collect, - struct bfd_link_hash_entry **hashp)); - - boolean (*_bfd_coff_link_output_has_begun) PARAMS (( - bfd * abfd, - struct coff_final_link_info * pfinfo)); - boolean (*_bfd_coff_final_link_postscript) PARAMS (( - bfd * abfd, - struct coff_final_link_info * pfinfo)); + void (*_bfd_coff_swap_aux_in) + PARAMS ((bfd *, PTR, int, int, int, int, PTR)); + + void (*_bfd_coff_swap_sym_in) + PARAMS ((bfd *, PTR, PTR)); + + void (*_bfd_coff_swap_lineno_in) + PARAMS ((bfd *, PTR, PTR)); + + unsigned int (*_bfd_coff_swap_aux_out) + PARAMS ((bfd *, PTR, int, int, int, int, PTR)); + + unsigned int (*_bfd_coff_swap_sym_out) + PARAMS ((bfd *, PTR, PTR)); + + unsigned int (*_bfd_coff_swap_lineno_out) + PARAMS ((bfd *, PTR, PTR)); + + unsigned int (*_bfd_coff_swap_reloc_out) + PARAMS ((bfd *, PTR, PTR)); + + unsigned int (*_bfd_coff_swap_filehdr_out) + PARAMS ((bfd *, PTR, PTR)); + + unsigned int (*_bfd_coff_swap_aouthdr_out) + PARAMS ((bfd *, PTR, PTR)); + + unsigned int (*_bfd_coff_swap_scnhdr_out) + PARAMS ((bfd *, PTR, PTR)); + + unsigned int _bfd_filhsz; + unsigned int _bfd_aoutsz; + unsigned int _bfd_scnhsz; + unsigned int _bfd_symesz; + unsigned int _bfd_auxesz; + unsigned int _bfd_relsz; + unsigned int _bfd_linesz; + unsigned int _bfd_filnmlen; + boolean _bfd_coff_long_filenames; + boolean _bfd_coff_long_section_names; + unsigned int _bfd_coff_default_section_alignment_power; + boolean _bfd_coff_force_symnames_in_strings; + unsigned int _bfd_coff_debug_string_prefix_length; + + void (*_bfd_coff_swap_filehdr_in) + PARAMS ((bfd *, PTR, PTR)); + + void (*_bfd_coff_swap_aouthdr_in) + PARAMS ((bfd *, PTR, PTR)); + + void (*_bfd_coff_swap_scnhdr_in) + PARAMS ((bfd *, PTR, PTR)); + + void (*_bfd_coff_swap_reloc_in) + PARAMS ((bfd *abfd, PTR, PTR)); + + boolean (*_bfd_coff_bad_format_hook) + PARAMS ((bfd *, PTR)); + + boolean (*_bfd_coff_set_arch_mach_hook) + PARAMS ((bfd *, PTR)); + + PTR (*_bfd_coff_mkobject_hook) + PARAMS ((bfd *, PTR, PTR)); + + boolean (*_bfd_styp_to_sec_flags_hook) + PARAMS ((bfd *, PTR, const char *, asection *, flagword *)); + + void (*_bfd_set_alignment_hook) + PARAMS ((bfd *, asection *, PTR)); + + boolean (*_bfd_coff_slurp_symbol_table) + PARAMS ((bfd *)); + + boolean (*_bfd_coff_symname_in_debug) + PARAMS ((bfd *, struct internal_syment *)); + + boolean (*_bfd_coff_pointerize_aux_hook) + PARAMS ((bfd *, combined_entry_type *, combined_entry_type *, + unsigned int, combined_entry_type *)); + + boolean (*_bfd_coff_print_aux) + PARAMS ((bfd *, FILE *, combined_entry_type *, combined_entry_type *, + combined_entry_type *, unsigned int)); + + void (*_bfd_coff_reloc16_extra_cases) + PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *, + bfd_byte *, unsigned int *, unsigned int *)); + + int (*_bfd_coff_reloc16_estimate) + PARAMS ((bfd *, asection *, arelent *, unsigned int, + struct bfd_link_info *)); + + enum coff_symbol_classification (*_bfd_coff_classify_symbol) + PARAMS ((bfd *, struct internal_syment *)); + + boolean (*_bfd_coff_compute_section_file_positions) + PARAMS ((bfd *)); + + boolean (*_bfd_coff_start_final_link) + PARAMS ((bfd *, struct bfd_link_info *)); + + boolean (*_bfd_coff_relocate_section) + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + struct internal_reloc *, struct internal_syment *, asection **)); + + reloc_howto_type *(*_bfd_coff_rtype_to_howto) + PARAMS ((bfd *, asection *, struct internal_reloc *, + struct coff_link_hash_entry *, struct internal_syment *, + bfd_vma *)); + + boolean (*_bfd_coff_adjust_symndx)\ + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, + struct internal_reloc *, boolean *)); + + boolean (*_bfd_coff_link_add_one_symbol) + PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword, + asection *, bfd_vma, const char *, boolean, boolean, + struct bfd_link_hash_entry **)); + + boolean (*_bfd_coff_link_output_has_begun) + PARAMS ((bfd *, struct coff_final_link_info *)); + + boolean (*_bfd_coff_final_link_postscript) + PARAMS ((bfd *, struct coff_final_link_info *)); } bfd_coff_backend_data; -#define coff_backend_info(abfd) ((bfd_coff_backend_data *) (abfd)->xvec->backend_data) +#define coff_backend_info(abfd) \ + ((bfd_coff_backend_data *) (abfd)->xvec->backend_data) #define bfd_coff_swap_aux_in(a,e,t,c,ind,num,i) \ - ((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i)) + ((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i)) #define bfd_coff_swap_sym_in(a,e,i) \ - ((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i)) + ((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i)) #define bfd_coff_swap_lineno_in(a,e,i) \ - ((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i)) + ((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i)) #define bfd_coff_swap_reloc_out(abfd, i, o) \ - ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o)) + ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o)) #define bfd_coff_swap_lineno_out(abfd, i, o) \ - ((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o)) + ((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o)) #define bfd_coff_swap_aux_out(a,i,t,c,ind,num,o) \ - ((coff_backend_info (a)->_bfd_coff_swap_aux_out) (a,i,t,c,ind,num,o)) + ((coff_backend_info (a)->_bfd_coff_swap_aux_out) (a,i,t,c,ind,num,o)) #define bfd_coff_swap_sym_out(abfd, i,o) \ - ((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o)) + ((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o)) #define bfd_coff_swap_scnhdr_out(abfd, i,o) \ - ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o)) + ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o)) #define bfd_coff_swap_filehdr_out(abfd, i,o) \ - ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o)) + ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o)) #define bfd_coff_swap_aouthdr_out(abfd, i,o) \ - ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o)) + ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o)) #define bfd_coff_filhsz(abfd) (coff_backend_info (abfd)->_bfd_filhsz) #define bfd_coff_aoutsz(abfd) (coff_backend_info (abfd)->_bfd_aoutsz) @@ -887,88 +841,89 @@ typedef struct #define bfd_coff_relsz(abfd) (coff_backend_info (abfd)->_bfd_relsz) #define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz) #define bfd_coff_filnmlen(abfd) (coff_backend_info (abfd)->_bfd_filnmlen) -#define bfd_coff_long_filenames(abfd) (coff_backend_info (abfd)->_bfd_coff_long_filenames) +#define bfd_coff_long_filenames(abfd) \ + (coff_backend_info (abfd)->_bfd_coff_long_filenames) #define bfd_coff_long_section_names(abfd) \ - (coff_backend_info (abfd)->_bfd_coff_long_section_names) + (coff_backend_info (abfd)->_bfd_coff_long_section_names) #define bfd_coff_default_section_alignment_power(abfd) \ - (coff_backend_info (abfd)->_bfd_coff_default_section_alignment_power) + (coff_backend_info (abfd)->_bfd_coff_default_section_alignment_power) #define bfd_coff_swap_filehdr_in(abfd, i,o) \ - ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o)) + ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o)) #define bfd_coff_swap_aouthdr_in(abfd, i,o) \ - ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o)) + ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o)) #define bfd_coff_swap_scnhdr_in(abfd, i,o) \ - ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o)) + ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o)) #define bfd_coff_swap_reloc_in(abfd, i, o) \ - ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_in) (abfd, i, o)) + ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_in) (abfd, i, o)) #define bfd_coff_bad_format_hook(abfd, filehdr) \ - ((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr)) + ((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr)) #define bfd_coff_set_arch_mach_hook(abfd, filehdr)\ - ((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr)) + ((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr)) #define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\ - ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook) (abfd, filehdr, aouthdr)) + ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook) (abfd, filehdr, aouthdr)) #define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name, section, flags_ptr)\ - ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook)\ - (abfd, scnhdr, name, section, flags_ptr)) + ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook)\ + (abfd, scnhdr, name, section, flags_ptr)) #define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\ - ((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr)) + ((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr)) #define bfd_coff_slurp_symbol_table(abfd)\ - ((coff_backend_info (abfd)->_bfd_coff_slurp_symbol_table) (abfd)) + ((coff_backend_info (abfd)->_bfd_coff_slurp_symbol_table) (abfd)) #define bfd_coff_symname_in_debug(abfd, sym)\ - ((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym)) + ((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym)) #define bfd_coff_force_symnames_in_strings(abfd)\ - (coff_backend_info (abfd)->_bfd_coff_force_symnames_in_strings) + (coff_backend_info (abfd)->_bfd_coff_force_symnames_in_strings) #define bfd_coff_debug_string_prefix_length(abfd)\ - (coff_backend_info (abfd)->_bfd_coff_debug_string_prefix_length) + (coff_backend_info (abfd)->_bfd_coff_debug_string_prefix_length) #define bfd_coff_print_aux(abfd, file, base, symbol, aux, indaux)\ - ((coff_backend_info (abfd)->_bfd_coff_print_aux)\ - (abfd, file, base, symbol, aux, indaux)) + ((coff_backend_info (abfd)->_bfd_coff_print_aux)\ + (abfd, file, base, symbol, aux, indaux)) #define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)\ - ((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\ - (abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)) + ((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\ + (abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)) #define bfd_coff_reloc16_estimate(abfd, section, reloc, shrink, link_info)\ - ((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\ - (abfd, section, reloc, shrink, link_info)) + ((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\ + (abfd, section, reloc, shrink, link_info)) #define bfd_coff_classify_symbol(abfd, sym)\ - ((coff_backend_info (abfd)->_bfd_coff_classify_symbol)\ - (abfd, sym)) + ((coff_backend_info (abfd)->_bfd_coff_classify_symbol)\ + (abfd, sym)) #define bfd_coff_compute_section_file_positions(abfd)\ - ((coff_backend_info (abfd)->_bfd_coff_compute_section_file_positions)\ - (abfd)) + ((coff_backend_info (abfd)->_bfd_coff_compute_section_file_positions)\ + (abfd)) #define bfd_coff_start_final_link(obfd, info)\ - ((coff_backend_info (obfd)->_bfd_coff_start_final_link)\ - (obfd, info)) + ((coff_backend_info (obfd)->_bfd_coff_start_final_link)\ + (obfd, info)) #define bfd_coff_relocate_section(obfd,info,ibfd,o,con,rel,isyms,secs)\ - ((coff_backend_info (ibfd)->_bfd_coff_relocate_section)\ - (obfd, info, ibfd, o, con, rel, isyms, secs)) + ((coff_backend_info (ibfd)->_bfd_coff_relocate_section)\ + (obfd, info, ibfd, o, con, rel, isyms, secs)) #define bfd_coff_rtype_to_howto(abfd, sec, rel, h, sym, addendp)\ - ((coff_backend_info (abfd)->_bfd_coff_rtype_to_howto)\ - (abfd, sec, rel, h, sym, addendp)) + ((coff_backend_info (abfd)->_bfd_coff_rtype_to_howto)\ + (abfd, sec, rel, h, sym, addendp)) #define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\ - ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\ - (obfd, info, ibfd, sec, rel, adjustedp)) + ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\ + (obfd, info, ibfd, sec, rel, adjustedp)) #define bfd_coff_link_add_one_symbol(info,abfd,name,flags,section,value,string,cp,coll,hashp)\ - ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\ - (info, abfd, name, flags, section, value, string, cp, coll, hashp)) + ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\ + (info, abfd, name, flags, section, value, string, cp, coll, hashp)) #define bfd_coff_link_output_has_begun(a,p) \ - ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a,p)) + ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a,p)) #define bfd_coff_final_link_postscript(a,p) \ - ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a,p)) + ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a,p)) diff -uprN binutils-2.11.90.0.31/bfd/libecoff.h binutils-2.11.92.0.5/bfd/libecoff.h --- binutils-2.11.90.0.31/bfd/libecoff.h Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/bfd/libecoff.h Mon Oct 1 15:25:21 2001 @@ -1,5 +1,6 @@ /* BFD ECOFF object file private structure. - Copyright 1993, 1994, 1995, 1996, 1999 Free Software Foundation, Inc. + Copyright 1993, 1994, 1995, 1996, 1999, 2001 + Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -320,7 +321,7 @@ extern long _bfd_ecoff_canonicalize_relo /* ecoff_bfd_reloc_type_lookup defined by backend. */ extern boolean _bfd_ecoff_set_arch_mach - PARAMS ((bfd *, enum bfd_architecture, unsigned long machine)); + PARAMS ((bfd *, enum bfd_architecture, unsigned long)); extern boolean _bfd_ecoff_set_section_contents PARAMS ((bfd *, asection *, PTR location, file_ptr, bfd_size_type)); diff -uprN binutils-2.11.90.0.31/bfd/libieee.h binutils-2.11.92.0.5/bfd/libieee.h --- binutils-2.11.90.0.31/bfd/libieee.h Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/bfd/libieee.h Mon Oct 1 15:25:21 2001 @@ -29,7 +29,7 @@ typedef struct ct { struct ct *next; } bfd_chain_type; -typedef struct ieee_symbol +typedef struct ieee_symbol { asymbol symbol; struct ieee_symbol *next; @@ -61,7 +61,7 @@ typedef struct ieee_per_section } ieee_per_section_type; #define ieee_per_section(x) ((ieee_per_section_type *)((x)->used_by_bfd)) - + typedef struct { unsigned char *input_p; unsigned char *first_byte; @@ -73,7 +73,7 @@ typedef struct ieee_data_struct { common_header_type h; boolean read_symbols; - boolean read_data; + boolean read_data; file_ptr output_cursor; /* Map of section indexes to section ptrs */ asection **section_table; @@ -81,31 +81,31 @@ typedef struct ieee_data_struct ieee_address_descriptor_type ad; ieee_module_begin_type mb; ieee_w_variable_type w; - + unsigned int section_count; - + unsigned int map_idx; /* List of GLOBAL EXPORT symbols */ ieee_symbol_type *external_symbols; /* List of UNDEFINED symbols */ ieee_symbol_type *external_reference; - + /* When the symbols have been canonicalized, they are in a * special order, we remember various bases here.. */ unsigned int external_symbol_max_index; unsigned int external_symbol_min_index; unsigned int external_symbol_count; int external_symbol_base_offset; - + unsigned int external_reference_max_index; unsigned int external_reference_min_index; unsigned int external_reference_count; int external_reference_base_offset; - + boolean symbol_table_full; - + boolean done_debug; @@ -119,11 +119,11 @@ typedef struct { bfd *abfd; } ieee_ar_obstack_type; -typedef struct ieee_ar_data_struct +typedef struct ieee_ar_data_struct { common_header_type h; ieee_ar_obstack_type *elements; - + unsigned int element_index ; unsigned int element_count; diff -uprN binutils-2.11.90.0.31/bfd/libnlm.h binutils-2.11.92.0.5/bfd/libnlm.h --- binutils-2.11.90.0.31/bfd/libnlm.h Fri Mar 9 11:16:02 2001 +++ binutils-2.11.92.0.5/bfd/libnlm.h Mon Oct 1 15:25:21 2001 @@ -1,5 +1,5 @@ /* BFD back-end data structures for NLM (NetWare Loadable Modules) files. - Copyright 1993, 1994 Free Software Foundation, Inc. + Copyright 1993, 1994, 2001 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -161,7 +161,7 @@ struct nlm_backend_data /* Architecture. */ enum bfd_architecture arch; /* Machine. */ - long mach; + unsigned int mach; /* Some NLM formats do not use the uninitialized data section, so all uninitialized data must be put into the regular data section instead. */ @@ -169,7 +169,7 @@ struct nlm_backend_data /* Some NLM formats have a prefix on the file. If this function is not NULL, it will be called by nlm_object_p. It should return true if this file could match this format, and it should leave - the BFD such that a bfd_read will pick up the fixed header. */ + the BFD such that a bfd_bread will pick up the fixed header. */ boolean (*nlm_backend_object_p) PARAMS ((bfd *)); /* Write out the prefix. This function may be NULL. This must write out the same number of bytes as is in the field diff -uprN binutils-2.11.90.0.31/bfd/libpei.h binutils-2.11.92.0.5/bfd/libpei.h --- binutils-2.11.90.0.31/bfd/libpei.h Fri Mar 9 11:16:02 2001 +++ binutils-2.11.92.0.5/bfd/libpei.h Mon Oct 1 15:25:21 2001 @@ -58,153 +58,167 @@ PE/PEI rearrangement (and code added): D #ifndef GET_FCN_LNNOPTR #define GET_FCN_LNNOPTR(abfd, ext) \ - bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr) + H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr) #endif #ifndef GET_FCN_ENDNDX -#define GET_FCN_ENDNDX(abfd, ext) \ - bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx) +#define GET_FCN_ENDNDX(abfd, ext) \ + H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_endndx) #endif #ifndef PUT_FCN_LNNOPTR -#define PUT_FCN_LNNOPTR(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr) +#define PUT_FCN_LNNOPTR(abfd, in, ext) \ + H_PUT_32(abfd, in, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr) #endif #ifndef PUT_FCN_ENDNDX -#define PUT_FCN_ENDNDX(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx) +#define PUT_FCN_ENDNDX(abfd, in, ext) \ + H_PUT_32(abfd, in, ext->x_sym.x_fcnary.x_fcn.x_endndx) #endif #ifndef GET_LNSZ_LNNO -#define GET_LNSZ_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_lnno) +#define GET_LNSZ_LNNO(abfd, ext) \ + H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_lnno) #endif #ifndef GET_LNSZ_SIZE -#define GET_LNSZ_SIZE(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_size) +#define GET_LNSZ_SIZE(abfd, ext) \ + H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_size) #endif #ifndef PUT_LNSZ_LNNO -#define PUT_LNSZ_LNNO(abfd, in, ext) bfd_h_put_16(abfd, in, (bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_lnno) +#define PUT_LNSZ_LNNO(abfd, in, ext) \ + H_PUT_16(abfd, in, ext->x_sym.x_misc.x_lnsz.x_lnno) #endif #ifndef PUT_LNSZ_SIZE -#define PUT_LNSZ_SIZE(abfd, in, ext) bfd_h_put_16(abfd, in, (bfd_byte*) ext->x_sym.x_misc.x_lnsz.x_size) +#define PUT_LNSZ_SIZE(abfd, in, ext) \ + H_PUT_16(abfd, in, ext->x_sym.x_misc.x_lnsz.x_size) #endif #ifndef GET_SCN_SCNLEN -#define GET_SCN_SCNLEN(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_scn.x_scnlen) +#define GET_SCN_SCNLEN(abfd, ext) \ + H_GET_32 (abfd, ext->x_scn.x_scnlen) #endif #ifndef GET_SCN_NRELOC -#define GET_SCN_NRELOC(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *)ext->x_scn.x_nreloc) +#define GET_SCN_NRELOC(abfd, ext) \ + H_GET_16 (abfd, ext->x_scn.x_nreloc) #endif #ifndef GET_SCN_NLINNO -#define GET_SCN_NLINNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *)ext->x_scn.x_nlinno) +#define GET_SCN_NLINNO(abfd, ext) \ + H_GET_16 (abfd, ext->x_scn.x_nlinno) #endif #ifndef PUT_SCN_SCNLEN -#define PUT_SCN_SCNLEN(abfd,in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_scn.x_scnlen) +#define PUT_SCN_SCNLEN(abfd, in, ext) \ + H_PUT_32(abfd, in, ext->x_scn.x_scnlen) #endif #ifndef PUT_SCN_NRELOC -#define PUT_SCN_NRELOC(abfd,in, ext) bfd_h_put_16(abfd, in, (bfd_byte *)ext->x_scn.x_nreloc) +#define PUT_SCN_NRELOC(abfd, in, ext) \ + H_PUT_16(abfd, in, ext->x_scn.x_nreloc) #endif #ifndef PUT_SCN_NLINNO -#define PUT_SCN_NLINNO(abfd,in, ext) bfd_h_put_16(abfd,in, (bfd_byte *) ext->x_scn.x_nlinno) +#define PUT_SCN_NLINNO(abfd, in, ext) \ + H_PUT_16(abfd,in, ext->x_scn.x_nlinno) #endif #ifndef GET_LINENO_LNNO -#define GET_LINENO_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) (ext->l_lnno)); +#define GET_LINENO_LNNO(abfd, ext) \ + H_GET_16 (abfd, ext->l_lnno); #endif #ifndef PUT_LINENO_LNNO -#define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_16(abfd,val, (bfd_byte *) (ext->l_lnno)); +#define PUT_LINENO_LNNO(abfd, val, ext) \ + H_PUT_16(abfd,val, ext->l_lnno); #endif /* The f_symptr field in the filehdr is sometimes 64 bits. */ #ifndef GET_FILEHDR_SYMPTR -#define GET_FILEHDR_SYMPTR bfd_h_get_32 +#define GET_FILEHDR_SYMPTR H_GET_32 #endif #ifndef PUT_FILEHDR_SYMPTR -#define PUT_FILEHDR_SYMPTR bfd_h_put_32 +#define PUT_FILEHDR_SYMPTR H_PUT_32 #endif /* Some fields in the aouthdr are sometimes 64 bits. */ #ifndef GET_AOUTHDR_TSIZE -#define GET_AOUTHDR_TSIZE bfd_h_get_32 +#define GET_AOUTHDR_TSIZE H_GET_32 #endif #ifndef PUT_AOUTHDR_TSIZE -#define PUT_AOUTHDR_TSIZE bfd_h_put_32 +#define PUT_AOUTHDR_TSIZE H_PUT_32 #endif #ifndef GET_AOUTHDR_DSIZE -#define GET_AOUTHDR_DSIZE bfd_h_get_32 +#define GET_AOUTHDR_DSIZE H_GET_32 #endif #ifndef PUT_AOUTHDR_DSIZE -#define PUT_AOUTHDR_DSIZE bfd_h_put_32 +#define PUT_AOUTHDR_DSIZE H_PUT_32 #endif #ifndef GET_AOUTHDR_BSIZE -#define GET_AOUTHDR_BSIZE bfd_h_get_32 +#define GET_AOUTHDR_BSIZE H_GET_32 #endif #ifndef PUT_AOUTHDR_BSIZE -#define PUT_AOUTHDR_BSIZE bfd_h_put_32 +#define PUT_AOUTHDR_BSIZE H_PUT_32 #endif #ifndef GET_AOUTHDR_ENTRY -#define GET_AOUTHDR_ENTRY bfd_h_get_32 +#define GET_AOUTHDR_ENTRY H_GET_32 #endif #ifndef PUT_AOUTHDR_ENTRY -#define PUT_AOUTHDR_ENTRY bfd_h_put_32 +#define PUT_AOUTHDR_ENTRY H_PUT_32 #endif #ifndef GET_AOUTHDR_TEXT_START -#define GET_AOUTHDR_TEXT_START bfd_h_get_32 +#define GET_AOUTHDR_TEXT_START H_GET_32 #endif #ifndef PUT_AOUTHDR_TEXT_START -#define PUT_AOUTHDR_TEXT_START bfd_h_put_32 +#define PUT_AOUTHDR_TEXT_START H_PUT_32 #endif #ifndef GET_AOUTHDR_DATA_START -#define GET_AOUTHDR_DATA_START bfd_h_get_32 +#define GET_AOUTHDR_DATA_START H_GET_32 #endif #ifndef PUT_AOUTHDR_DATA_START -#define PUT_AOUTHDR_DATA_START bfd_h_put_32 +#define PUT_AOUTHDR_DATA_START H_PUT_32 #endif /* Some fields in the scnhdr are sometimes 64 bits. */ #ifndef GET_SCNHDR_PADDR -#define GET_SCNHDR_PADDR bfd_h_get_32 +#define GET_SCNHDR_PADDR H_GET_32 #endif #ifndef PUT_SCNHDR_PADDR -#define PUT_SCNHDR_PADDR bfd_h_put_32 +#define PUT_SCNHDR_PADDR H_PUT_32 #endif #ifndef GET_SCNHDR_VADDR -#define GET_SCNHDR_VADDR bfd_h_get_32 +#define GET_SCNHDR_VADDR H_GET_32 #endif #ifndef PUT_SCNHDR_VADDR -#define PUT_SCNHDR_VADDR bfd_h_put_32 +#define PUT_SCNHDR_VADDR H_PUT_32 #endif #ifndef GET_SCNHDR_SIZE -#define GET_SCNHDR_SIZE bfd_h_get_32 +#define GET_SCNHDR_SIZE H_GET_32 #endif #ifndef PUT_SCNHDR_SIZE -#define PUT_SCNHDR_SIZE bfd_h_put_32 +#define PUT_SCNHDR_SIZE H_PUT_32 #endif #ifndef GET_SCNHDR_SCNPTR -#define GET_SCNHDR_SCNPTR bfd_h_get_32 +#define GET_SCNHDR_SCNPTR H_GET_32 #endif #ifndef PUT_SCNHDR_SCNPTR -#define PUT_SCNHDR_SCNPTR bfd_h_put_32 +#define PUT_SCNHDR_SCNPTR H_PUT_32 #endif #ifndef GET_SCNHDR_RELPTR -#define GET_SCNHDR_RELPTR bfd_h_get_32 +#define GET_SCNHDR_RELPTR H_GET_32 #endif #ifndef PUT_SCNHDR_RELPTR -#define PUT_SCNHDR_RELPTR bfd_h_put_32 +#define PUT_SCNHDR_RELPTR H_PUT_32 #endif #ifndef GET_SCNHDR_LNNOPTR -#define GET_SCNHDR_LNNOPTR bfd_h_get_32 +#define GET_SCNHDR_LNNOPTR H_GET_32 #endif #ifndef PUT_SCNHDR_LNNOPTR -#define PUT_SCNHDR_LNNOPTR bfd_h_put_32 +#define PUT_SCNHDR_LNNOPTR H_PUT_32 #endif #ifdef COFF_WITH_pep -#define GET_OPTHDR_IMAGE_BASE bfd_h_get_64 -#define PUT_OPTHDR_IMAGE_BASE bfd_h_put_64 -#define GET_OPTHDR_SIZE_OF_STACK_RESERVE bfd_h_get_64 -#define PUT_OPTHDR_SIZE_OF_STACK_RESERVE bfd_h_put_64 -#define GET_OPTHDR_SIZE_OF_STACK_COMMIT bfd_h_get_64 -#define PUT_OPTHDR_SIZE_OF_STACK_COMMIT bfd_h_put_64 -#define GET_OPTHDR_SIZE_OF_HEAP_RESERVE bfd_h_get_64 -#define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE bfd_h_put_64 -#define GET_OPTHDR_SIZE_OF_HEAP_COMMIT bfd_h_get_64 -#define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT bfd_h_put_64 +#define GET_OPTHDR_IMAGE_BASE H_GET_64 +#define PUT_OPTHDR_IMAGE_BASE H_PUT_64 +#define GET_OPTHDR_SIZE_OF_STACK_RESERVE H_GET_64 +#define PUT_OPTHDR_SIZE_OF_STACK_RESERVE H_PUT_64 +#define GET_OPTHDR_SIZE_OF_STACK_COMMIT H_GET_64 +#define PUT_OPTHDR_SIZE_OF_STACK_COMMIT H_PUT_64 +#define GET_OPTHDR_SIZE_OF_HEAP_RESERVE H_GET_64 +#define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE H_PUT_64 +#define GET_OPTHDR_SIZE_OF_HEAP_COMMIT H_GET_64 +#define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT H_PUT_64 #define GET_PDATA_ENTRY bfd_get_64 #define _bfd_XX_bfd_copy_private_bfd_data_common _bfd_pep_bfd_copy_private_bfd_data_common @@ -227,16 +241,16 @@ PE/PEI rearrangement (and code added): D #else /* !COFF_WITH_pep */ -#define GET_OPTHDR_IMAGE_BASE bfd_h_get_32 -#define PUT_OPTHDR_IMAGE_BASE bfd_h_put_32 -#define GET_OPTHDR_SIZE_OF_STACK_RESERVE bfd_h_get_32 -#define PUT_OPTHDR_SIZE_OF_STACK_RESERVE bfd_h_put_32 -#define GET_OPTHDR_SIZE_OF_STACK_COMMIT bfd_h_get_32 -#define PUT_OPTHDR_SIZE_OF_STACK_COMMIT bfd_h_put_32 -#define GET_OPTHDR_SIZE_OF_HEAP_RESERVE bfd_h_get_32 -#define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE bfd_h_put_32 -#define GET_OPTHDR_SIZE_OF_HEAP_COMMIT bfd_h_get_32 -#define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT bfd_h_put_32 +#define GET_OPTHDR_IMAGE_BASE H_GET_32 +#define PUT_OPTHDR_IMAGE_BASE H_PUT_32 +#define GET_OPTHDR_SIZE_OF_STACK_RESERVE H_GET_32 +#define PUT_OPTHDR_SIZE_OF_STACK_RESERVE H_PUT_32 +#define GET_OPTHDR_SIZE_OF_STACK_COMMIT H_GET_32 +#define PUT_OPTHDR_SIZE_OF_STACK_COMMIT H_PUT_32 +#define GET_OPTHDR_SIZE_OF_HEAP_RESERVE H_GET_32 +#define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE H_PUT_32 +#define GET_OPTHDR_SIZE_OF_HEAP_COMMIT H_GET_32 +#define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT H_PUT_32 #define GET_PDATA_ENTRY bfd_get_32 #define _bfd_XX_bfd_copy_private_bfd_data_common _bfd_pe_bfd_copy_private_bfd_data_common diff -uprN binutils-2.11.90.0.31/bfd/libxcoff.h binutils-2.11.92.0.5/bfd/libxcoff.h --- binutils-2.11.90.0.31/bfd/libxcoff.h Fri Aug 10 14:08:01 2001 +++ binutils-2.11.92.0.5/bfd/libxcoff.h Mon Oct 1 15:25:21 2001 @@ -28,14 +28,14 @@ Foundation, Inc., 59 Temple Place - Suit struct xcoff_backend_data_rec { - /* - * COFF backend information. Must be the first field. + /* + * COFF backend information. Must be the first field. * This is where the std coff swap table goes */ bfd_coff_backend_data coff; /* Magic number */ - unsigned short _xcoff_magic_number; + unsigned short _xcoff_magic_number; /* Architecture and machine for coff_set_arch_mach_hook */ enum bfd_architecture _xcoff_architecture; @@ -50,7 +50,7 @@ struct xcoff_backend_data_rec void (* _xcoff_swap_ldrel_out)(bfd *, const struct internal_ldrel *, PTR); /* size of the the external struct */ - unsigned int _xcoff_ldhdrsz; + unsigned int _xcoff_ldhdrsz; unsigned int _xcoff_ldsymsz; unsigned int _xcoff_ldrelsz; @@ -60,9 +60,9 @@ struct xcoff_backend_data_rec /* size of the small aout file header */ unsigned int _xcoff_small_aout_header_size; - /* - * version - * loader version + /* + * version + * loader version * 1 : xcoff32 * 2 : xcoff64 */ @@ -72,7 +72,7 @@ struct xcoff_backend_data_rec struct internal_syment *, const char *); - boolean (* _xcoff_put_ldsymbol_name)(bfd *, struct xcoff_loader_info *, + boolean (* _xcoff_put_ldsymbol_name)(bfd *, struct xcoff_loader_info *, struct internal_ldsym *, const char *); @@ -80,34 +80,34 @@ struct xcoff_backend_data_rec asection * (* _xcoff_create_csect_from_smclas) (bfd *, union internal_auxent *, const char *); - /* - * line_no and reloc overflow + /* + * line_no and reloc overflow * 32 overflows to another section when the line_no or reloc count go - * over 0xffff. 64 does not overflow. + * over 0xffff. 64 does not overflow. */ boolean (*_xcoff_is_lineno_count_overflow)(bfd *, bfd_vma); boolean (*_xcoff_is_reloc_count_overflow)(bfd *, bfd_vma); - /* + /* * .loader symbol table offset * 32 is after the .loader header * 64 is offset in .loader header - * + * * Similar for the reloc table */ bfd_vma (*_xcoff_loader_symbol_offset)(bfd *, struct internal_ldhdr *); bfd_vma (*_xcoff_loader_reloc_offset)(bfd *, struct internal_ldhdr *); - /* - * Global linkage - * + /* + * Global linkage + * * The first word of global linkage code must be be modified by - * filling in the correct TOC offset. + * filling in the correct TOC offset. */ unsigned long *_xcoff_glink_code; - /* + /* * Size of the global link code in bytes of the xcoff_glink_code table */ unsigned long _xcoff_glink_size; @@ -218,19 +218,19 @@ extern boolean _bfd_xcoff_bfd_link_add_s PARAMS ((bfd *, struct bfd_link_info *)); extern boolean _bfd_xcoff_bfd_final_link PARAMS ((bfd *, struct bfd_link_info *)); -extern boolean _bfd_xcoff_slurp_symbol_table +extern boolean _bfd_xcoff_slurp_symbol_table PARAMS ((bfd *)); -extern long _bfd_xcoff_get_symbol_table +extern long _bfd_xcoff_get_symbol_table PARAMS ((bfd *, asymbol **)); -extern asymbol *_bfd_xcoff_make_empty_symbol +extern asymbol *_bfd_xcoff_make_empty_symbol PARAMS ((bfd *)); -extern long _bfd_xcoff_get_symbol_table_upper_bound +extern long _bfd_xcoff_get_symbol_table_upper_bound PARAMS ((bfd *)); -extern void _bfd_xcoff_print_symbol +extern void _bfd_xcoff_print_symbol PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type)); -extern void _bfd_xcoff_get_symbol_info +extern void _bfd_xcoff_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *)); -extern long _bfd_xcoff_canonicalize_reloc +extern long _bfd_xcoff_canonicalize_reloc PARAMS((bfd *, sec_ptr, arelent **, asymbol **)); extern reloc_howto_type *_bfd_xcoff_rtype_to_howto PARAMS ((bfd *, asection *, struct internal_reloc *, @@ -248,10 +248,9 @@ extern boolean bfd_xcoff_link_record_set bfd_size_type)); extern boolean bfd_xcoff_import_symbol PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, - bfd_vma, const char *, const char *, const char *)); + bfd_vma, const char *, const char *, const char *, unsigned int)); extern boolean bfd_xcoff_export_symbol - PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, - boolean)); + PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *)); extern boolean bfd_xcoff_link_count_reloc PARAMS ((bfd *, struct bfd_link_info *, const char *)); extern boolean bfd_xcoff_record_link_assignment @@ -260,7 +259,7 @@ extern boolean bfd_xcoff_size_dynamic_se PARAMS ((bfd *, struct bfd_link_info *, const char *, const char *, unsigned long, unsigned long, unsigned long, boolean, int, boolean, boolean, struct sec **)); -extern boolean xcoff_slurp_reloc_table +extern boolean xcoff_slurp_reloc_table PARAMS ((bfd *, asection *, asymbol **)); #endif /* LIBXCOFF_H */ diff -uprN binutils-2.11.90.0.31/bfd/linker.c binutils-2.11.92.0.5/bfd/linker.c --- binutils-2.11.90.0.31/bfd/linker.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/linker.c Mon Oct 1 15:25:21 2001 @@ -445,28 +445,27 @@ _bfd_link_hash_newfunc (entry, table, st struct bfd_hash_table *table; const char *string; { - struct bfd_link_hash_entry *ret = (struct bfd_link_hash_entry *) entry; - /* Allocate the structure if it has not already been allocated by a subclass. */ - if (ret == (struct bfd_link_hash_entry *) NULL) - ret = ((struct bfd_link_hash_entry *) - bfd_hash_allocate (table, sizeof (struct bfd_link_hash_entry))); - if (ret == (struct bfd_link_hash_entry *) NULL) - return NULL; + if (entry == NULL) + { + entry = bfd_hash_allocate (table, sizeof (struct bfd_link_hash_entry)); + if (entry == NULL) + return entry; + } /* Call the allocation method of the superclass. */ - ret = ((struct bfd_link_hash_entry *) - bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string)); - - if (ret) + entry = bfd_hash_newfunc (entry, table, string); + if (entry) { + struct bfd_link_hash_entry *h = (struct bfd_link_hash_entry *) entry; + /* Initialize the local fields. */ - ret->type = bfd_link_hash_new; - ret->next = NULL; + h->type = bfd_link_hash_new; + h->next = NULL; } - return (struct bfd_hash_entry *) ret; + return entry; } /* Initialize a link hash table. The BFD argument is the one @@ -528,6 +527,8 @@ bfd_wrapped_link_hash_lookup (abfd, info boolean copy; boolean follow; { + bfd_size_type amt; + if (info->wrap_hash != NULL) { const char *l; @@ -547,7 +548,8 @@ bfd_wrapped_link_hash_lookup (abfd, info /* This symbol is being wrapped. We want to replace all references to SYM with references to __wrap_SYM. */ - n = (char *) bfd_malloc (strlen (l) + sizeof WRAP + 1); + amt = strlen (l) + sizeof WRAP + 1; + n = (char *) bfd_malloc (amt); if (n == NULL) return NULL; @@ -578,7 +580,8 @@ bfd_wrapped_link_hash_lookup (abfd, info wrapped. We want to replace all references to __real_SYM with references to SYM. */ - n = (char *) bfd_malloc (strlen (l + sizeof REAL - 1) + 2); + amt = strlen (l + sizeof REAL - 1) + 2; + n = (char *) bfd_malloc (amt); if (n == NULL) return NULL; @@ -638,30 +641,29 @@ _bfd_generic_link_hash_newfunc (entry, t struct bfd_hash_table *table; const char *string; { - struct generic_link_hash_entry *ret = - (struct generic_link_hash_entry *) entry; - /* Allocate the structure if it has not already been allocated by a subclass. */ - if (ret == (struct generic_link_hash_entry *) NULL) - ret = ((struct generic_link_hash_entry *) - bfd_hash_allocate (table, sizeof (struct generic_link_hash_entry))); - if (ret == (struct generic_link_hash_entry *) NULL) - return NULL; + if (entry == NULL) + { + entry = bfd_hash_allocate (table, + sizeof (struct generic_link_hash_entry)); + if (entry == NULL) + return entry; + } /* Call the allocation method of the superclass. */ - ret = ((struct generic_link_hash_entry *) - _bfd_link_hash_newfunc ((struct bfd_hash_entry *) ret, - table, string)); - - if (ret) + entry = _bfd_link_hash_newfunc (entry, table, string); + if (entry) { + struct generic_link_hash_entry *ret; + /* Set local fields. */ + ret = (struct generic_link_hash_entry *) entry; ret->written = false; ret->sym = NULL; } - return (struct bfd_hash_entry *) ret; + return entry; } /* Create an generic link hash table. */ @@ -671,9 +673,9 @@ _bfd_generic_link_hash_table_create (abf bfd *abfd; { struct generic_link_hash_table *ret; + bfd_size_type amt = sizeof (struct generic_link_hash_table); - ret = ((struct generic_link_hash_table *) - bfd_alloc (abfd, sizeof (struct generic_link_hash_table))); + ret = (struct generic_link_hash_table *) bfd_alloc (abfd, amt); if (ret == NULL) return (struct bfd_link_hash_table *) NULL; if (! _bfd_link_hash_table_init (&ret->root, abfd, @@ -704,7 +706,8 @@ generic_link_read_symbols (abfd) symsize = bfd_get_symtab_upper_bound (abfd); if (symsize < 0) return false; - bfd_get_outsymbols (abfd) = (asymbol **) bfd_alloc (abfd, symsize); + bfd_get_outsymbols (abfd) = + (asymbol **) bfd_alloc (abfd, (bfd_size_type) symsize); if (bfd_get_outsymbols (abfd) == NULL && symsize != 0) return false; symcount = bfd_canonicalize_symtab (abfd, bfd_get_outsymbols (abfd)); @@ -781,12 +784,14 @@ generic_link_add_object_symbols (abfd, i struct bfd_link_info *info; boolean collect; { + bfd_size_type symcount; + struct symbol_cache_entry **outsyms; + if (! generic_link_read_symbols (abfd)) return false; - return generic_link_add_symbol_list (abfd, info, - _bfd_generic_link_get_symcount (abfd), - _bfd_generic_link_get_symbols (abfd), - collect); + symcount = _bfd_generic_link_get_symcount (abfd); + outsyms = _bfd_generic_link_get_symbols (abfd); + return generic_link_add_symbol_list (abfd, info, symcount, outsyms, collect); } /* We build a hash table of all symbols defined in an archive. */ @@ -797,7 +802,7 @@ generic_link_add_object_symbols (abfd, i struct archive_list { struct archive_list *next; - int indx; + unsigned int indx; }; /* An entry in an archive hash table. */ @@ -926,7 +931,7 @@ _bfd_generic_link_add_archive_symbols (a register carsym *arsym; int pass; struct archive_hash_table arsym_hash; - int indx; + unsigned int indx; struct bfd_link_hash_entry **pundef; if (! bfd_has_map (abfd)) @@ -1005,11 +1010,12 @@ _bfd_generic_link_add_archive_symbols (a arh = archive_hash_lookup (&arsym_hash, h->root.string, false, false); if (arh == (struct archive_hash_entry *) NULL) { - /* If we haven't found the exact symbol we're looking for, + /* If we haven't found the exact symbol we're looking for, let's look for its import thunk */ if (info->pei386_auto_import) { - char *buf = (char *) bfd_malloc (strlen (h->root.string) + 10); + bfd_size_type amt = strlen (h->root.string) + 10; + char *buf = (char *) bfd_malloc (amt); if (buf == NULL) return false; @@ -1411,7 +1417,7 @@ static const enum link_action link_actio /* UNDEFW_ROW */ {WEAK, NOACT, NOACT, REF, REF, NOACT, REFC, WARNC }, /* DEF_ROW */ {DEF, DEF, DEF, MDEF, DEF, CDEF, MDEF, CYCLE }, /* DEFW_ROW */ {DEFW, DEFW, DEFW, NOACT, NOACT, NOACT, NOACT, CYCLE }, - /* COMMON_ROW */ {COM, COM, COM, CREF, CREF, BIG, REFC, WARNC }, + /* COMMON_ROW */ {COM, COM, COM, CREF, COM, BIG, REFC, WARNC }, /* INDR_ROW */ {IND, IND, IND, MDEF, IND, CIND, MIND, CYCLE }, /* WARN_ROW */ {MWARN, WARN, WARN, CWARN, CWARN, WARN, CWARN, MWARN }, /* SET_ROW */ {SET, SET, SET, SET, SET, SET, CYCLE, CYCLE } @@ -1840,8 +1846,8 @@ _bfd_generic_link_add_one_symbol (info, && inh->u.i.link == h) { (*_bfd_error_handler) - (_("%s: indirect symbol `%s' to `%s' is a loop"), - bfd_get_filename (abfd), name, string); + (_("%s: indirect symbol `%s' to `%s' is a loop"), + bfd_archive_filename (abfd), name, string); bfd_set_error (bfd_error_invalid_operation); return false; } @@ -2039,7 +2045,7 @@ _bfd_generic_final_link (abfd, info) input_section); if (relsize < 0) return false; - relocs = (arelent **) bfd_malloc ((size_t) relsize); + relocs = (arelent **) bfd_malloc ((bfd_size_type) relsize); if (!relocs && relsize != 0) return false; symbols = _bfd_generic_link_get_symbols (input_bfd); @@ -2057,10 +2063,11 @@ _bfd_generic_final_link (abfd, info) } if (o->reloc_count > 0) { - o->orelocation = ((arelent **) - bfd_alloc (abfd, - (o->reloc_count - * sizeof (arelent *)))); + bfd_size_type amt; + + amt = o->reloc_count; + amt *= sizeof (arelent *); + o->orelocation = (arelent **) bfd_alloc (abfd, amt); if (!o->orelocation) return false; o->flags |= SEC_RELOC; @@ -2113,13 +2120,15 @@ generic_add_output_symbol (output_bfd, p if (bfd_get_symcount (output_bfd) >= *psymalloc) { asymbol **newsyms; + bfd_size_type amt; if (*psymalloc == 0) *psymalloc = 124; else *psymalloc *= 2; - newsyms = (asymbol **) bfd_realloc (bfd_get_outsymbols (output_bfd), - *psymalloc * sizeof (asymbol *)); + amt = *psymalloc; + amt *= sizeof (asymbol *); + newsyms = (asymbol **) bfd_realloc (bfd_get_outsymbols (output_bfd), amt); if (newsyms == (asymbol **) NULL) return false; bfd_get_outsymbols (output_bfd) = newsyms; @@ -2499,7 +2508,7 @@ _bfd_generic_reloc_link_order (abfd, inf if (sec->orelocation == (arelent **) NULL) abort (); - r = (arelent *) bfd_alloc (abfd, sizeof (arelent)); + r = (arelent *) bfd_alloc (abfd, (bfd_size_type) sizeof (arelent)); if (r == (arelent *) NULL) return false; @@ -2545,13 +2554,15 @@ _bfd_generic_reloc_link_order (abfd, inf bfd_reloc_status_type rstat; bfd_byte *buf; boolean ok; + file_ptr loc; size = bfd_get_reloc_size (r->howto); buf = (bfd_byte *) bfd_zmalloc (size); if (buf == (bfd_byte *) NULL) return false; rstat = _bfd_relocate_contents (r->howto, abfd, - link_order->u.reloc.p->addend, buf); + (bfd_vma) link_order->u.reloc.p->addend, + buf); switch (rstat) { case bfd_reloc_ok: @@ -2573,10 +2584,9 @@ _bfd_generic_reloc_link_order (abfd, inf } break; } - ok = bfd_set_section_contents (abfd, sec, (PTR) buf, - (file_ptr) - (link_order->offset * - bfd_octets_per_byte (abfd)), size); + loc = link_order->offset * bfd_octets_per_byte (abfd); + ok = bfd_set_section_contents (abfd, sec, (PTR) buf, loc, + (bfd_size_type) size); free (buf); if (! ok) return false; @@ -2597,10 +2607,8 @@ bfd_new_link_order (abfd, section) bfd *abfd; asection *section; { - struct bfd_link_order *new; - - new = ((struct bfd_link_order *) - bfd_alloc (abfd, sizeof (struct bfd_link_order))); + bfd_size_type amt = sizeof (struct bfd_link_order); + struct bfd_link_order *new = (struct bfd_link_order *) bfd_alloc (abfd, amt); if (!new) return NULL; @@ -2629,6 +2637,8 @@ _bfd_default_link_order (abfd, info, sec asection *sec; struct bfd_link_order *link_order; { + file_ptr loc; + switch (link_order->type) { case bfd_undefined_link_order: @@ -2642,12 +2652,10 @@ _bfd_default_link_order (abfd, info, sec case bfd_fill_link_order: return default_fill_link_order (abfd, info, sec, link_order); case bfd_data_link_order: + loc = link_order->offset * bfd_octets_per_byte (abfd); return bfd_set_section_contents (abfd, sec, (PTR) link_order->u.data.contents, - (file_ptr) - (link_order->offset * - bfd_octets_per_byte (abfd)), - link_order->size); + loc, link_order->size); } } @@ -2660,7 +2668,7 @@ default_fill_link_order (abfd, info, sec asection *sec; struct bfd_link_order *link_order; { - size_t size; + bfd_size_type size; unsigned char *space; size_t i; unsigned int fill; @@ -2669,7 +2677,7 @@ default_fill_link_order (abfd, info, sec BFD_ASSERT ((sec->flags & SEC_HAS_CONTENTS) != 0); - size = (size_t) link_order->size; + size = link_order->size; if (size == 0) return true; @@ -2687,8 +2695,8 @@ default_fill_link_order (abfd, info, sec for (i = 3; i < size; i += 4) space[i] = fill; - loc = (file_ptr) (link_order->offset * bfd_octets_per_byte (abfd)); - result = bfd_set_section_contents (abfd, sec, space, loc, link_order->size); + loc = link_order->offset * bfd_octets_per_byte (abfd); + result = bfd_set_section_contents (abfd, sec, space, loc, size); free (space); return result; @@ -2709,6 +2717,8 @@ default_indirect_link_order (output_bfd, bfd *input_bfd; bfd_byte *contents = NULL; bfd_byte *new_contents; + bfd_size_type sec_size; + file_ptr loc; BFD_ASSERT ((output_section->flags & SEC_HAS_CONTENTS) != 0); @@ -2792,9 +2802,9 @@ default_indirect_link_order (output_bfd, } /* Get and relocate the section contents. */ - contents = ((bfd_byte *) - bfd_malloc (bfd_section_size (input_bfd, input_section))); - if (contents == NULL && bfd_section_size (input_bfd, input_section) != 0) + sec_size = bfd_section_size (input_bfd, input_section); + contents = ((bfd_byte *) bfd_malloc (sec_size)); + if (contents == NULL && sec_size != 0) goto error_return; new_contents = (bfd_get_relocated_section_contents (output_bfd, info, link_order, contents, info->relocateable, @@ -2803,12 +2813,9 @@ default_indirect_link_order (output_bfd, goto error_return; /* Output the section contents. */ + loc = link_order->offset * bfd_octets_per_byte (output_bfd); if (! bfd_set_section_contents (output_bfd, output_section, - (PTR) new_contents, - (file_ptr) - (link_order->offset * - bfd_octets_per_byte (output_bfd)), - link_order->size)) + (PTR) new_contents, loc, link_order->size)) goto error_return; if (contents != NULL) diff -uprN binutils-2.11.90.0.31/bfd/lynx-core.c binutils-2.11.92.0.5/bfd/lynx-core.c --- binutils-2.11.90.0.31/bfd/lynx-core.c Fri Mar 9 11:16:02 2001 +++ binutils-2.11.92.0.5/bfd/lynx-core.c Mon Oct 1 15:25:21 2001 @@ -55,7 +55,7 @@ struct lynx_core_struct static asection * make_bfd_asection (abfd, name, flags, _raw_size, vma, filepos) bfd *abfd; - CONST char *name; + const char *name; flagword flags; bfd_size_type _raw_size; bfd_vma vma; @@ -64,7 +64,7 @@ make_bfd_asection (abfd, name, flags, _r asection *asect; char *newname; - newname = bfd_alloc (abfd, strlen (name) + 1); + newname = bfd_alloc (abfd, (bfd_size_type) strlen (name) + 1); if (!newname) return NULL; @@ -87,13 +87,13 @@ const bfd_target * lynx_core_file_p (abfd) bfd *abfd; { - int val; int secnum; struct pssentry pss; - size_t tcontext_size; + bfd_size_type tcontext_size; core_st_t *threadp; int pagesize; asection *newsect; + bfd_size_type amt; pagesize = getpagesize (); /* Serious cross-target issue here... This really needs to come from a system-specific @@ -101,11 +101,11 @@ lynx_core_file_p (abfd) /* Get the pss entry from the core file */ - if (bfd_seek (abfd, 0, SEEK_SET) != 0) + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) return NULL; - val = bfd_read ((void *)&pss, 1, sizeof pss, abfd); - if (val != sizeof pss) + amt = sizeof pss; + if (bfd_bread ((void *) &pss, amt, abfd) != amt) { /* Too small to be a core file */ if (bfd_get_error () != bfd_error_system_call) @@ -113,8 +113,8 @@ lynx_core_file_p (abfd) return NULL; } - core_hdr (abfd) = (struct lynx_core_struct *) - bfd_zalloc (abfd, sizeof (struct lynx_core_struct)); + amt = sizeof (struct lynx_core_struct); + core_hdr (abfd) = (struct lynx_core_struct *) bfd_zalloc (abfd, amt); if (!core_hdr (abfd)) return NULL; @@ -127,18 +127,16 @@ lynx_core_file_p (abfd) /* Allocate space for the thread contexts */ - threadp = (core_st_t *)bfd_alloc (abfd, tcontext_size); + threadp = (core_st_t *) bfd_alloc (abfd, tcontext_size); if (!threadp) return NULL; /* Save thread contexts */ - if (bfd_seek (abfd, pagesize, SEEK_SET) != 0) + if (bfd_seek (abfd, (file_ptr) pagesize, SEEK_SET) != 0) return NULL; - val = bfd_read ((void *)threadp, pss.threadcnt, sizeof (core_st_t), abfd); - - if (val != tcontext_size) + if (bfd_bread ((void *) threadp, tcontext_size, abfd) != tcontext_size) { /* Probably too small to be a core file */ if (bfd_get_error () != bfd_error_system_call) diff -uprN binutils-2.11.90.0.31/bfd/m68k4knetbsd.c binutils-2.11.92.0.5/bfd/m68k4knetbsd.c --- binutils-2.11.90.0.31/bfd/m68k4knetbsd.c Fri Mar 9 11:16:02 2001 +++ binutils-2.11.92.0.5/bfd/m68k4knetbsd.c Thu Oct 4 14:35:43 2001 @@ -1,5 +1,6 @@ /* BFD back-end for NetBSD/m68k a.out-ish binaries. - Copyright 1990, 1991, 1992, 1995, 1998 Free Software Foundation, Inc. + Copyright 1990, 1991, 1992, 1995, 1998, 2001 + Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -25,7 +26,11 @@ Foundation, Inc., 59 Temple Place - Suit #define DEFAULT_ARCH bfd_arch_m68k #define DEFAULT_MID M_68K4K_NETBSD -#define MY(OP) CAT(m68k4knetbsd_,OP) +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (m68k4knetbsd_,OP) + /* This needs to start with a.out so GDB knows it is an a.out variant. */ #define TARGETNAME "a.out-m68k4k-netbsd" diff -uprN binutils-2.11.90.0.31/bfd/m68klinux.c binutils-2.11.92.0.5/bfd/m68klinux.c --- binutils-2.11.90.0.31/bfd/m68klinux.c Fri Mar 9 11:16:03 2001 +++ binutils-2.11.92.0.5/bfd/m68klinux.c Thu Oct 4 14:35:43 2001 @@ -1,5 +1,5 @@ /* BFD back-end for linux flavored m68k a.out binaries. - Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000 + Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -37,7 +37,11 @@ Foundation, Inc., 59 Temple Place - Suit #define TARGET_IS_BIG_ENDIAN_P #define DEFAULT_ARCH bfd_arch_m68k -#define MY(OP) CAT(m68klinux_,OP) + +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (m68klinux_,OP) #define TARGETNAME "a.out-m68k-linux" extern const bfd_target MY(vec); @@ -224,9 +228,9 @@ linux_link_hash_table_create (abfd) bfd *abfd; { struct linux_link_hash_table *ret; + bfd_size_type amt = sizeof (struct linux_link_hash_table); - ret = ((struct linux_link_hash_table *) - bfd_alloc (abfd, sizeof (struct linux_link_hash_table))); + ret = (struct linux_link_hash_table *) bfd_alloc (abfd, amt); if (ret == (struct linux_link_hash_table *) NULL) { bfd_set_error (bfd_error_no_memory); @@ -409,7 +413,8 @@ linux_add_one_symbol (info, abfd, name, if (! (_bfd_generic_link_add_one_symbol (info, linux_hash_table (info)->dynobj, SHARABLE_CONFLICTS, - BSF_GLOBAL | BSF_CONSTRUCTOR, s, 0, NULL, false, false, NULL))) + BSF_GLOBAL | BSF_CONSTRUCTOR, s, (bfd_vma) 0, NULL, + false, false, NULL))) return false; } @@ -448,7 +453,7 @@ linux_tally_symbols (h, data) name = h->root.root.root.string + sizeof NEEDS_SHRLIB - 1; p = strrchr (name, '_'); if (p != NULL) - alloc = (char *) bfd_malloc (strlen (name) + 1); + alloc = (char *) bfd_malloc ((bfd_size_type) strlen (name) + 1); if (p == NULL || alloc == NULL) (*_bfd_error_handler) (_("Output file requires shared library `%s'\n"), @@ -591,7 +596,8 @@ bfd_m68klinux_size_dynamic_sections (out ".linux-dynamic"); if (s != NULL) { - s->_raw_size = 8 + linux_hash_table (info)->fixup_count * 8; + s->_raw_size = linux_hash_table (info)->fixup_count + 1; + s->_raw_size *= 8; s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size); if (s->contents == NULL) { @@ -637,7 +643,8 @@ linux_finish_dynamic_link (output_bfd, i #endif fixup_table = s->contents; - bfd_put_32 (output_bfd, linux_hash_table (info)->fixup_count, fixup_table); + bfd_put_32 (output_bfd, (bfd_vma) linux_hash_table (info)->fixup_count, + fixup_table); fixup_table += 4; /* Fill in fixup table. */ @@ -666,14 +673,14 @@ linux_finish_dynamic_link (output_bfd, i if (f->jump) { - bfd_put_32 (output_bfd, new_addr, fixup_table); + bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table); fixup_table += 4; bfd_put_32 (output_bfd, f->value + 2, fixup_table); fixup_table += 4; } else { - bfd_put_32 (output_bfd, new_addr, fixup_table); + bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table); fixup_table += 4; bfd_put_32 (output_bfd, f->value, fixup_table); fixup_table += 4; @@ -684,9 +691,9 @@ linux_finish_dynamic_link (output_bfd, i if (linux_hash_table (info)->local_builtins != 0) { /* Special marker so we know to switch to the other type of fixup */ - bfd_put_32 (output_bfd, 0, fixup_table); + bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table); fixup_table += 4; - bfd_put_32 (output_bfd, 0, fixup_table); + bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table); fixup_table += 4; ++fixups_written; for (f = linux_hash_table (info)->fixup_list; f != NULL; f = f->next) @@ -712,7 +719,7 @@ linux_finish_dynamic_link (output_bfd, i new_addr, f->value); #endif - bfd_put_32 (output_bfd, new_addr, fixup_table); + bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table); fixup_table += 4; bfd_put_32 (output_bfd, f->value, fixup_table); fixup_table += 4; @@ -725,9 +732,9 @@ linux_finish_dynamic_link (output_bfd, i (*_bfd_error_handler) (_("Warning: fixup count mismatch\n")); while (linux_hash_table (info)->fixup_count > fixups_written) { - bfd_put_32 (output_bfd, 0, fixup_table); + bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table); fixup_table += 4; - bfd_put_32 (output_bfd, 0, fixup_table); + bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table); fixup_table += 4; ++fixups_written; } @@ -749,16 +756,16 @@ linux_finish_dynamic_link (output_bfd, i printf ("Builtin fixup table at %x\n", new_addr); #endif - bfd_put_32 (output_bfd, new_addr, fixup_table); + bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table); } else - bfd_put_32 (output_bfd, 0, fixup_table); + bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table); - if (bfd_seek (output_bfd, os->filepos + s->output_offset, SEEK_SET) != 0) + if (bfd_seek (output_bfd, (file_ptr) (os->filepos + s->output_offset), + SEEK_SET) != 0) return false; - if (bfd_write ((PTR) s->contents, 1, s->_raw_size, output_bfd) - != s->_raw_size) + if (bfd_bwrite ((PTR) s->contents, s->_raw_size, output_bfd) != s->_raw_size) return false; return true; diff -uprN binutils-2.11.90.0.31/bfd/m68klynx.c binutils-2.11.92.0.5/bfd/m68klynx.c --- binutils-2.11.90.0.31/bfd/m68klynx.c Fri Mar 9 11:16:03 2001 +++ binutils-2.11.92.0.5/bfd/m68klynx.c Thu Oct 4 14:35:43 2001 @@ -1,5 +1,5 @@ /* BFD back-end for m68k binaries under LynxOS. - Copyright 1990, 1991, 1992, 1993, 1994, 1995 + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 2001 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -26,7 +26,10 @@ Foundation, Inc., 59 Temple Place - Suit #define SEGMENT_SIZE TARGET_PAGE_SIZE #define DEFAULT_ARCH bfd_arch_m68k -#define MY(OP) CAT(m68klynx_aout_,OP) +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (m68klynx_aout_,OP) #define TARGETNAME "a.out-m68k-lynx" #include "bfd.h" diff -uprN binutils-2.11.90.0.31/bfd/m68knetbsd.c binutils-2.11.92.0.5/bfd/m68knetbsd.c --- binutils-2.11.90.0.31/bfd/m68knetbsd.c Fri Mar 9 11:16:03 2001 +++ binutils-2.11.92.0.5/bfd/m68knetbsd.c Thu Oct 4 14:35:43 2001 @@ -1,5 +1,5 @@ /* BFD back-end for NetBSD/m68k a.out-ish binaries. - Copyright 1990, 1991, 1992, 1994, 1995, 1997, 1998, 2000 + Copyright 1990, 1991, 1992, 1994, 1995, 1997, 1998, 2000, 2001 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -28,7 +28,11 @@ Foundation, Inc., 59 Temple Place - Suit #define DEFAULT_ARCH bfd_arch_m68k #define DEFAULT_MID M_68K_NETBSD -#define MY(OP) CAT(m68knetbsd_,OP) +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (m68knetbsd_,OP) + /* This needs to start with a.out so GDB knows it is an a.out variant. */ #define TARGETNAME "a.out-m68k-netbsd" diff -uprN binutils-2.11.90.0.31/bfd/m88kmach3.c binutils-2.11.92.0.5/bfd/m88kmach3.c --- binutils-2.11.90.0.31/bfd/m88kmach3.c Fri Mar 9 11:16:03 2001 +++ binutils-2.11.92.0.5/bfd/m88kmach3.c Thu Oct 4 14:35:43 2001 @@ -1,5 +1,6 @@ /* BFD back-end for Motorola m88k a.out (Mach 3) binaries. - Copyright 1990, 1991, 1993, 1994, 1995 Free Software Foundation, Inc. + Copyright 1990, 1991, 1993, 1994, 1995, 2001 + Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -32,7 +33,11 @@ Foundation, Inc., 59 Temple Place - Suit #include "libaout.h" #define DEFAULT_ARCH bfd_arch_m88k -#define MY(OP) CAT(m88kmach3_,OP) + +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (m88kmach3_,OP) #define TARGETNAME "a.out-m88k-mach3" #include "aout-target.h" diff -uprN binutils-2.11.90.0.31/bfd/merge.c binutils-2.11.92.0.5/bfd/merge.c --- binutils-2.11.90.0.31/bfd/merge.c Fri Aug 10 14:08:01 2001 +++ binutils-2.11.92.0.5/bfd/merge.c Mon Oct 1 15:25:21 2001 @@ -26,8 +26,6 @@ Foundation, Inc., 59 Temple Place - Suit #include "libbfd.h" #include "hashtab.h" -#include - struct sec_merge_sec_info; /* An entry in the section merge hash table. */ @@ -202,7 +200,7 @@ sec_merge_hash_lookup (table, string, al } hash ^= hash >> 2; len += table->entsize; - } + } else { for (i = 0; i < table->entsize; ++i) @@ -262,9 +260,9 @@ sec_merge_init (entsize, strings) boolean strings; { struct sec_merge_hash *table; + bfd_size_type amt = sizeof (struct sec_merge_hash); - table = ((struct sec_merge_hash *) - bfd_malloc (sizeof (struct sec_merge_hash))); + table = (struct sec_merge_hash *) bfd_malloc (amt); if (table == NULL) return NULL; @@ -325,7 +323,7 @@ sec_merge_emit (abfd, entry) int alignment_power = bfd_get_section_alignment (abfd, sec->output_section); if (alignment_power) - pad = bfd_zmalloc (1 << alignment_power); + pad = bfd_zmalloc ((bfd_size_type) 1 << alignment_power); for (; entry != NULL && entry->secinfo == secinfo; entry = entry->next) { @@ -336,7 +334,7 @@ sec_merge_emit (abfd, entry) if (len) { len = entry->alignment - len; - if (bfd_write ((PTR) pad, 1, len, abfd) != len) + if (bfd_bwrite ((PTR) pad, (bfd_size_type) len, abfd) != len) break; off += len; } @@ -344,7 +342,7 @@ sec_merge_emit (abfd, entry) str = entry->root.string; len = entry->len; - if (bfd_write ((PTR) str, 1, len, abfd) != len) + if (bfd_bwrite ((PTR) str, (bfd_size_type) len, abfd) != len) break; off += len; @@ -369,6 +367,7 @@ _bfd_merge_section (abfd, psinfo, sec, p struct sec_merge_info *sinfo; struct sec_merge_sec_info *secinfo; unsigned int align; + bfd_size_type amt; if (sec->_raw_size == 0 || (sec->flags & SEC_EXCLUDE) @@ -417,7 +416,7 @@ _bfd_merge_section (abfd, psinfo, sec, p { /* Initialize the information we need to keep track of. */ sinfo = (struct sec_merge_info *) - bfd_alloc (abfd, sizeof (struct sec_merge_info)); + bfd_alloc (abfd, (bfd_size_type) sizeof (struct sec_merge_info)); if (sinfo == NULL) goto error_return; sinfo->next = (struct sec_merge_info *) *psinfo; @@ -431,8 +430,8 @@ _bfd_merge_section (abfd, psinfo, sec, p /* Read the section from abfd. */ - *psecinfo = bfd_alloc (abfd, sizeof (struct sec_merge_sec_info) - + sec->_raw_size - 1); + amt = sizeof (struct sec_merge_sec_info) + sec->_raw_size - 1; + *psecinfo = bfd_alloc (abfd, amt); if (*psecinfo == NULL) goto error_return; @@ -450,8 +449,8 @@ _bfd_merge_section (abfd, psinfo, sec, p secinfo->htab = sinfo->htab; secinfo->first = NULL; - if (! bfd_get_section_contents (sec->owner, sec, secinfo->contents, 0, - sec->_raw_size)) + if (! bfd_get_section_contents (sec->owner, sec, secinfo->contents, + (bfd_vma) 0, sec->_raw_size)) goto error_return; return true; @@ -470,7 +469,7 @@ cmplengthentry (a, b) { struct sec_merge_hash_entry * A = *(struct sec_merge_hash_entry **) a; struct sec_merge_hash_entry * B = *(struct sec_merge_hash_entry **) b; - + if (A->len < B->len) return 1; else if (A->len > B->len) @@ -556,16 +555,16 @@ record_section (sinfo, secinfo) align = bfd_get_section_alignment (sec->owner, sec); end = secinfo->contents + sec->_raw_size; nul = false; - mask = ((bfd_vma)1 << align) - 1; + mask = ((bfd_vma) 1 << align) - 1; if (sec->flags & SEC_STRINGS) { - for (p = secinfo->contents; p < end;) + for (p = secinfo->contents; p < end; ) { eltalign = p - secinfo->contents; eltalign = ((eltalign ^ (eltalign - 1)) + 1) >> 1; if (!eltalign || eltalign > mask) eltalign = mask + 1; - entry = sec_merge_add (sinfo->htab, p, eltalign, secinfo); + entry = sec_merge_add (sinfo->htab, p, (unsigned) eltalign, secinfo); if (! entry) goto error_return; p += entry->len; @@ -576,8 +575,8 @@ record_section (sinfo, secinfo) if (!nul && !((p - secinfo->contents) & mask)) { nul = true; - entry = sec_merge_add (sinfo->htab, "", mask + 1, - secinfo); + entry = sec_merge_add (sinfo->htab, "", + (unsigned) mask + 1, secinfo); if (! entry) goto error_return; } @@ -596,8 +595,8 @@ record_section (sinfo, secinfo) if (!nul && !((p - secinfo->contents) & mask)) { nul = true; - entry = sec_merge_add (sinfo->htab, p, mask + 1, - secinfo); + entry = sec_merge_add (sinfo->htab, p, + (unsigned) mask + 1, secinfo); if (! entry) goto error_return; } @@ -633,12 +632,12 @@ merge_strings (sinfo) struct sec_merge_hash_entry **array, **a, **end, *e; struct sec_merge_sec_info *secinfo; htab_t lasttab = NULL, last4tab = NULL; - bfd_size_type size; + bfd_size_type size, amt; /* Now sort the strings by length, longest first. */ - array = (struct sec_merge_hash_entry **) - malloc (sinfo->htab->size - * sizeof (struct sec_merge_hash_entry *)); + array = NULL; + amt = sinfo->htab->size * sizeof (struct sec_merge_hash_entry *); + array = (struct sec_merge_hash_entry **) bfd_malloc (amt); if (array == NULL) goto alloc_failure; @@ -648,11 +647,11 @@ merge_strings (sinfo) sinfo->htab->size = a - array; - qsort (array, sinfo->htab->size, sizeof (struct sec_merge_hash_entry *), - cmplengthentry); + qsort (array, (size_t) sinfo->htab->size, + sizeof (struct sec_merge_hash_entry *), cmplengthentry); - last4tab = htab_create (sinfo->htab->size * 4, NULL, last4_eq, NULL); - lasttab = htab_create (sinfo->htab->size * 4, NULL, last_eq, NULL); + last4tab = htab_create ((size_t) sinfo->htab->size * 4, NULL, last4_eq, NULL); + lasttab = htab_create ((size_t) sinfo->htab->size * 4, NULL, last_eq, NULL); if (lasttab == NULL || last4tab == NULL) goto alloc_failure; @@ -850,15 +849,15 @@ _bfd_write_merged_section (output_bfd, s PTR psecinfo; { struct sec_merge_sec_info *secinfo; + file_ptr pos; secinfo = (struct sec_merge_sec_info *) psecinfo; if (!secinfo->first) return true; - if (bfd_seek (output_bfd, - (sec->output_section->filepos + sec->output_offset), - SEEK_SET) != 0) + pos = sec->output_section->filepos + sec->output_offset; + if (bfd_seek (output_bfd, pos, SEEK_SET) != 0) return false; if (! sec_merge_emit (output_bfd, secinfo->first)) @@ -888,9 +887,11 @@ _bfd_merged_section_offset (output_bfd, if (offset + addend >= sec->_raw_size) { if (offset + addend > sec->_raw_size) - (*_bfd_error_handler) (_("%s: access beyond end of merged section (%ld + %ld)"), - bfd_get_filename (sec->owner), (long)offset, - (long) addend); + { + (*_bfd_error_handler) + (_("%s: access beyond end of merged section (%ld + %ld)"), + bfd_get_filename (sec->owner), (long) offset, (long) addend); + } return (secinfo->first ? sec->_cooked_size : 0); } diff -uprN binutils-2.11.90.0.31/bfd/mipsbsd.c binutils-2.11.92.0.5/bfd/mipsbsd.c --- binutils-2.11.90.0.31/bfd/mipsbsd.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/mipsbsd.c Thu Oct 4 14:35:43 2001 @@ -36,7 +36,10 @@ Foundation, Inc., 59 Temple Place - Suit || (mtype) == M_MIPS1 || (mtype) == M_MIPS2) #define MY_symbol_leading_char '\0' -#define MY(OP) CAT(mipsbsd_,OP) +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (mipsbsd_,OP) #include "bfd.h" #include "sysdep.h" @@ -46,13 +49,13 @@ Foundation, Inc., 59 Temple Place - Suit #define SET_ARCH_MACH(ABFD, EXEC) \ MY(set_arch_mach) (ABFD, N_MACHTYPE (EXEC)); \ MY(choose_reloc_size) (ABFD); -static void MY(set_arch_mach) PARAMS ((bfd *abfd, int machtype)); +static void MY(set_arch_mach) PARAMS ((bfd *abfd, unsigned long machtype)); static void MY(choose_reloc_size) PARAMS ((bfd *abfd)); #define MY_write_object_contents MY(write_object_contents) static boolean MY(write_object_contents) PARAMS ((bfd *abfd)); -/* We can't use MY(x) here because it leads to a recursive call to CAT +/* We can't use MY(x) here because it leads to a recursive call to CONCAT2 when expanded inside JUMP_TABLE. */ #define MY_bfd_reloc_type_lookup mipsbsd_reloc_howto_type_lookup #define MY_canonicalize_reloc mipsbsd_canonicalize_reloc @@ -67,18 +70,21 @@ static boolean MY(write_object_contents) #include "aout-target.h" -static bfd_reloc_status_type mips_fix_jmp_addr PARAMS ((bfd *, arelent *, struct symbol_cache_entry *, PTR, asection *, bfd *)); -static reloc_howto_type * MY(reloc_howto_type_lookup) PARAMS ((bfd *, bfd_reloc_code_real_type)); +static bfd_reloc_status_type mips_fix_jmp_addr + PARAMS ((bfd *, arelent *, struct symbol_cache_entry *, PTR, asection *, + bfd *, char **)); +static reloc_howto_type *MY(reloc_howto_type_lookup) + PARAMS ((bfd *, bfd_reloc_code_real_type)); long MY(canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **, asymbol **)); static void MY(set_arch_mach) (abfd, machtype) bfd *abfd; - int machtype; + unsigned long machtype; { enum bfd_architecture arch; - long machine; + unsigned int machine; /* Determine the architecture and machine type of the object file. */ switch (machtype) @@ -194,13 +200,15 @@ MY (write_object_contents) (abfd) program counter, then we need to signal an error. */ static bfd_reloc_status_type -mips_fix_jmp_addr (abfd,reloc_entry,symbol,data,input_section,output_bfd) +mips_fix_jmp_addr (abfd, reloc_entry, symbol, data, input_section, output_bfd, + error_message) bfd *abfd ATTRIBUTE_UNUSED; arelent *reloc_entry; struct symbol_cache_entry *symbol; PTR data ATTRIBUTE_UNUSED; asection *input_section; bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; { bfd_vma relocation, pc; @@ -378,7 +386,7 @@ MY(canonicalize_reloc) (abfd, section, r return section->reloc_count; } -static CONST struct aout_backend_data MY(backend_data) = { +static const struct aout_backend_data MY(backend_data) = { 0, /* zmagic contiguous */ 1, /* text incl header */ 0, /* entry is text address */ diff -uprN binutils-2.11.90.0.31/bfd/netbsd-core.c binutils-2.11.92.0.5/bfd/netbsd-core.c --- binutils-2.11.90.0.31/bfd/netbsd-core.c Fri Mar 9 11:16:03 2001 +++ binutils-2.11.92.0.5/bfd/netbsd-core.c Mon Oct 1 15:25:21 2001 @@ -1,5 +1,5 @@ /* BFD back end for NetBSD style core files - Copyright 1988, 1989, 1991, 1992, 1993, 1996, 1998, 1999, 2000 + Copyright 1988, 1989, 1991, 1992, 1993, 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Written by Paul Kranenburg, EUR @@ -39,12 +39,12 @@ struct netbsd_core_struct { /* forward declarations */ -static const bfd_target * netbsd_core_file_p PARAMS ((bfd *abfd)); -static char * netbsd_core_file_failing_command PARAMS ((bfd *abfd)); -static int netbsd_core_file_failing_signal PARAMS ((bfd *abfd)); -static boolean netbsd_core_file_matches_executable_p - PARAMS ((bfd *core_bfd, bfd *exec_bfd)); -static void swap_abort PARAMS ((void)); +static const bfd_target *netbsd_core_file_p PARAMS ((bfd *abfd)); +static char *netbsd_core_file_failing_command PARAMS ((bfd *abfd)); +static int netbsd_core_file_failing_signal PARAMS ((bfd *abfd)); +static boolean netbsd_core_file_matches_executable_p + PARAMS ((bfd *core_bfd, bfd *exec_bfd)); +static void swap_abort PARAMS ((void)); /* Handle NetBSD-style core dump file. */ @@ -54,117 +54,132 @@ netbsd_core_file_p (abfd) bfd *abfd; { - int i, val, offset; - asection *asect, *asect2; - struct core core; - struct coreseg coreseg; - - val = bfd_read ((void *)&core, 1, sizeof core, abfd); - if (val != sizeof core) { - /* Too small to be a core file */ - bfd_set_error(bfd_error_wrong_format); - return 0; + int i, val; + file_ptr offset; + asection *asect, *asect2; + struct core core; + struct coreseg coreseg; + bfd_size_type amt = sizeof core; + + val = bfd_bread ((void *) &core, amt, abfd); + if (val != sizeof core) + { + /* Too small to be a core file */ + bfd_set_error (bfd_error_wrong_format); + return 0; + } + + if (CORE_GETMAGIC (core) != COREMAGIC) + { + bfd_set_error (bfd_error_wrong_format); + return 0; + } + + amt = sizeof (struct netbsd_core_struct); + rawptr = (struct netbsd_core_struct *) bfd_zalloc (abfd, amt); + if (rawptr == NULL) + { + bfd_set_error (bfd_error_no_memory); + return 0; + } + + rawptr->core = core; + abfd->tdata.netbsd_core_data = rawptr; + + offset = core.c_hdrsize; + for (i = 0; i < core.c_nseg; i++) + { + + if (bfd_seek (abfd, offset, SEEK_SET) != 0) + goto punt; + + val = bfd_bread ((void *) &coreseg, (bfd_size_type) sizeof coreseg, abfd); + if (val != sizeof coreseg) + { + bfd_set_error (bfd_error_file_truncated); + goto punt; } - - if (CORE_GETMAGIC(core) != COREMAGIC) { - bfd_set_error(bfd_error_wrong_format); - return 0; - } - - rawptr = (struct netbsd_core_struct *) - bfd_zalloc (abfd, sizeof (struct netbsd_core_struct)); - if (rawptr == NULL) { - bfd_set_error(bfd_error_no_memory); - return 0; + if (CORE_GETMAGIC (coreseg) != CORESEGMAGIC) + { + bfd_set_error (bfd_error_wrong_format); + goto punt; } - rawptr->core = core; - abfd->tdata.netbsd_core_data = rawptr; + offset += core.c_seghdrsize; - offset = core.c_hdrsize; - for (i = 0; i < core.c_nseg; i++) { - - if (bfd_seek (abfd, offset, SEEK_SET) != 0) - goto punt; + amt = sizeof (asection); + asect = (asection *) bfd_zalloc (abfd, amt); + if (asect == NULL) + { + bfd_set_error (bfd_error_no_memory); + goto punt; + } - val = bfd_read ((void *)&coreseg, 1, sizeof coreseg, abfd); - if (val != sizeof coreseg) { - bfd_set_error(bfd_error_file_truncated); - goto punt; - } - if (CORE_GETMAGIC(coreseg) != CORESEGMAGIC) { - bfd_set_error(bfd_error_wrong_format); - goto punt; - } - - offset += core.c_seghdrsize; - - asect = (asection *) bfd_zalloc (abfd, sizeof (asection)); - if (asect == NULL) { - bfd_set_error(bfd_error_no_memory); - goto punt; - } - - asect->_raw_size = coreseg.c_size; - asect->vma = coreseg.c_addr; - asect->filepos = offset; - asect->alignment_power = 2; - asect->next = abfd->sections; - abfd->sections = asect; - abfd->section_count++; - offset += coreseg.c_size; - - switch (CORE_GETFLAG(coreseg)) { - case CORE_CPU: - asect->name = ".reg"; - asect->flags = SEC_ALLOC + SEC_HAS_CONTENTS; + asect->_raw_size = coreseg.c_size; + asect->vma = coreseg.c_addr; + asect->filepos = offset; + asect->alignment_power = 2; + asect->next = abfd->sections; + abfd->sections = asect; + abfd->section_count++; + offset += coreseg.c_size; + + switch (CORE_GETFLAG(coreseg)) + { + case CORE_CPU: + asect->name = ".reg"; + asect->flags = SEC_ALLOC + SEC_HAS_CONTENTS; #ifdef CORE_FPU_OFFSET - /* Hackish... */ - asect->_raw_size = CORE_FPU_OFFSET; - asect2 = (asection *)bfd_zalloc (abfd, - sizeof (asection)); - if (asect2 == NULL) { - bfd_set_error(bfd_error_no_memory); - goto punt; - } - asect2->_raw_size = coreseg.c_size - CORE_FPU_OFFSET; - asect2->vma = 0; - asect2->filepos = asect->filepos + CORE_FPU_OFFSET; - asect2->alignment_power = 2; - asect2->next = abfd->sections; - asect2->name = ".reg2"; - asect2->flags = SEC_ALLOC + SEC_HAS_CONTENTS; - abfd->sections = asect2; - abfd->section_count++; + /* Hackish... */ + asect->_raw_size = CORE_FPU_OFFSET; + amt = sizeof (asection); + asect2 = (asection *) bfd_zalloc (abfd, amt); + if (asect2 == NULL) + { + bfd_set_error (bfd_error_no_memory); + goto punt; + } + asect2->_raw_size = coreseg.c_size - CORE_FPU_OFFSET; + asect2->vma = 0; + asect2->filepos = asect->filepos + CORE_FPU_OFFSET; + asect2->alignment_power = 2; + asect2->next = abfd->sections; + asect2->name = ".reg2"; + asect2->flags = SEC_ALLOC + SEC_HAS_CONTENTS; + abfd->sections = asect2; + abfd->section_count++; #endif - break; - case CORE_DATA: - asect->name = ".data"; - asect->flags = SEC_ALLOC+SEC_LOAD+SEC_HAS_CONTENTS; - break; - case CORE_STACK: - asect->name = ".stack"; - asect->flags = SEC_ALLOC+SEC_LOAD+SEC_HAS_CONTENTS; - break; - } + break; + case CORE_DATA: + asect->name = ".data"; + asect->flags = SEC_ALLOC+SEC_LOAD+SEC_HAS_CONTENTS; + break; + case CORE_STACK: + asect->name = ".stack"; + asect->flags = SEC_ALLOC+SEC_LOAD+SEC_HAS_CONTENTS; + break; } + } - /* OK, we believe you. You're a core file (sure, sure). */ - return abfd->xvec; + /* OK, we believe you. You're a core file (sure, sure). */ + return abfd->xvec; -punt: { - asection *anext; - for (asect = abfd->sections; asect; asect = anext) { - anext = asect->next; - free((void *)asect); - } - } - free ((void *)rawptr); - abfd->tdata.netbsd_core_data = NULL; - abfd->sections = NULL; - abfd->section_count = 0; - return 0; + punt: + { + asection *anext; + for (asect = abfd->sections; asect; asect = anext) + { + anext = asect->next; + free ((void *) asect); + } + } + + free ((void *) rawptr); + abfd->tdata.netbsd_core_data = NULL; + abfd->sections = NULL; + abfd->section_count = 0; + return 0; } static char* @@ -187,7 +202,8 @@ netbsd_core_file_failing_signal (abfd) /* ARGSUSED */ static boolean netbsd_core_file_matches_executable_p (core_bfd, exec_bfd) - bfd *core_bfd, *exec_bfd; + bfd *core_bfd ATTRIBUTE_UNUSED; + bfd *exec_bfd ATTRIBUTE_UNUSED; { return true; /* FIXME, We have no way of telling at this point */ } diff -uprN binutils-2.11.90.0.31/bfd/newsos3.c binutils-2.11.92.0.5/bfd/newsos3.c --- binutils-2.11.90.0.31/bfd/newsos3.c Fri Mar 9 11:16:03 2001 +++ binutils-2.11.92.0.5/bfd/newsos3.c Thu Oct 4 14:35:43 2001 @@ -1,5 +1,6 @@ /* BFD back-end for NewsOS3 (Sony, 68k) binaries. - Copyright 1990, 1991, 1994, 1995, 2000 Free Software Foundation, Inc. + Copyright 1990, 1991, 1994, 1995, 2000, 2001 + Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -21,7 +22,11 @@ Foundation, Inc., 59 Temple Place - Suit #define SEGMENT_SIZE TARGET_PAGE_SIZE #define TEXT_START_ADDR 0 #define BYTES_IN_WORD 4 -#define MY(OP) CAT(newsos3_,OP) + +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (newsos3_,OP) #define TARGETNAME "a.out-newsos3" #define ENTRY_CAN_BE_ZERO #define N_SHARED_LIB(x) 0 /* Avoids warning when compiled with -Wall. */ diff -uprN binutils-2.11.90.0.31/bfd/nlm.c binutils-2.11.92.0.5/bfd/nlm.c --- binutils-2.11.90.0.31/bfd/nlm.c Fri Mar 9 11:16:03 2001 +++ binutils-2.11.92.0.5/bfd/nlm.c Mon Oct 1 15:25:21 2001 @@ -1,5 +1,5 @@ /* NLM (NetWare Loadable Module) executable support for BFD. - Copyright 1993, 1994 Free Software Foundation, Inc. + Copyright 1993, 1994, 2001 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -29,8 +29,8 @@ boolean nlm_mkobject (abfd) bfd * abfd; { - nlm_tdata (abfd) = - (struct nlm_obj_tdata *) bfd_zalloc (abfd, sizeof (struct nlm_obj_tdata)); + bfd_size_type amt = sizeof (struct nlm_obj_tdata); + nlm_tdata (abfd) = (struct nlm_obj_tdata *) bfd_zalloc (abfd, amt); if (nlm_tdata (abfd) == NULL) return (false); diff -uprN binutils-2.11.90.0.31/bfd/nlm32-alpha.c binutils-2.11.92.0.5/bfd/nlm32-alpha.c --- binutils-2.11.90.0.31/bfd/nlm32-alpha.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/bfd/nlm32-alpha.c Mon Oct 1 15:25:21 2001 @@ -61,18 +61,18 @@ nlm_alpha_backend_object_p (abfd) bfd *abfd; { struct nlm32_alpha_external_prefix_header s; - bfd_size_type size; + file_ptr size; - if (bfd_read ((PTR) &s, sizeof s, 1, abfd) != sizeof s) + if (bfd_bread ((PTR) &s, (bfd_size_type) sizeof s, abfd) != sizeof s) return false; - if (bfd_h_get_32 (abfd, s.magic) != NLM32_ALPHA_MAGIC) + if (H_GET_32 (abfd, s.magic) != NLM32_ALPHA_MAGIC) return false; /* FIXME: Should we check the format number? */ /* Skip to the end of the header. */ - size = bfd_h_get_32 (abfd, s.size); + size = H_GET_32 (abfd, s.size); if (bfd_seek (abfd, size, SEEK_SET) != 0) return false; @@ -88,10 +88,10 @@ nlm_alpha_write_prefix (abfd) struct nlm32_alpha_external_prefix_header s; memset (&s, 0, sizeof s); - bfd_h_put_32 (abfd, (bfd_vma) NLM32_ALPHA_MAGIC, s.magic); - bfd_h_put_32 (abfd, (bfd_vma) 2, s.format); - bfd_h_put_32 (abfd, (bfd_vma) sizeof s, s.size); - if (bfd_write ((PTR) &s, sizeof s, 1, abfd) != sizeof s) + H_PUT_32 (abfd, NLM32_ALPHA_MAGIC, s.magic); + H_PUT_32 (abfd, 2, s.format); + H_PUT_32 (abfd, sizeof s, s.size); + if (bfd_bwrite ((PTR) &s, (bfd_size_type) sizeof s, abfd) != sizeof s) return false; return true; } @@ -421,12 +421,12 @@ nlm_alpha_read_reloc (abfd, sym, secp, r asection *code_sec, *data_sec; /* Read the reloc from the file. */ - if (bfd_read (&ext, sizeof ext, 1, abfd) != sizeof ext) + if (bfd_bread (&ext, (bfd_size_type) sizeof ext, abfd) != sizeof ext) return false; /* Swap in the reloc information. */ - r_vaddr = bfd_h_get_64 (abfd, (bfd_byte *) ext.r_vaddr); - r_symndx = bfd_h_get_32 (abfd, (bfd_byte *) ext.r_symndx); + r_vaddr = H_GET_64 (abfd, ext.r_vaddr); + r_symndx = H_GET_32 (abfd, ext.r_symndx); BFD_ASSERT (bfd_little_endian (abfd)); @@ -624,26 +624,28 @@ nlm_alpha_read_import (abfd, sym) bfd_byte temp[NLM_TARGET_LONG_SIZE]; /* temporary 32-bit value */ unsigned char symlength; /* length of symbol name */ char *name; + bfd_size_type amt; - if (bfd_read ((PTR) &symlength, sizeof (symlength), 1, abfd) + if (bfd_bread ((PTR) &symlength, (bfd_size_type) sizeof (symlength), abfd) != sizeof (symlength)) return false; sym -> symbol.the_bfd = abfd; - name = bfd_alloc (abfd, symlength + 1); + name = bfd_alloc (abfd, (bfd_size_type) symlength + 1); if (name == NULL) return false; - if (bfd_read (name, symlength, 1, abfd) != symlength) + if (bfd_bread (name, (bfd_size_type) symlength, abfd) != symlength) return false; name[symlength] = '\0'; sym -> symbol.name = name; sym -> symbol.flags = 0; sym -> symbol.value = 0; sym -> symbol.section = bfd_und_section_ptr; - if (bfd_read ((PTR) temp, sizeof (temp), 1, abfd) != sizeof (temp)) + if (bfd_bread ((PTR) temp, (bfd_size_type) sizeof (temp), abfd) + != sizeof (temp)) return false; - rcount = bfd_h_get_32 (abfd, temp); - nlm_relocs = ((struct nlm_relent *) - bfd_alloc (abfd, rcount * sizeof (struct nlm_relent))); + rcount = H_GET_32 (abfd, temp); + amt = rcount * sizeof (struct nlm_relent); + nlm_relocs = (struct nlm_relent *) bfd_alloc (abfd, amt); if (!nlm_relocs) return false; sym -> relocs = nlm_relocs; @@ -750,8 +752,8 @@ nlm_alpha_write_import (abfd, sec, rel) } /* Swap out the relocation fields. */ - bfd_h_put_64 (abfd, r_vaddr, (bfd_byte *) ext.r_vaddr); - bfd_h_put_32 (abfd, r_symndx, (bfd_byte *) ext.r_symndx); + H_PUT_64 (abfd, r_vaddr, ext.r_vaddr); + H_PUT_32 (abfd, r_symndx, ext.r_symndx); BFD_ASSERT (bfd_little_endian (abfd)); @@ -765,7 +767,7 @@ nlm_alpha_write_import (abfd, sec, rel) & RELOC_BITS3_SIZE_LITTLE); /* Write out the relocation. */ - if (bfd_write (&ext, sizeof ext, 1, abfd) != sizeof ext) + if (bfd_bwrite (&ext, (bfd_size_type) sizeof ext, abfd) != sizeof ext) return false; return true; @@ -828,12 +830,13 @@ nlm_alpha_write_external (abfd, count, s arelent r; len = strlen (sym->name); - if ((bfd_write (&len, sizeof (bfd_byte), 1, abfd) != sizeof (bfd_byte)) - || bfd_write (sym->name, len, 1, abfd) != len) + if ((bfd_bwrite (&len, (bfd_size_type) sizeof (bfd_byte), abfd) + != sizeof (bfd_byte)) + || bfd_bwrite (sym->name, (bfd_size_type) len, abfd) != len) return false; bfd_put_32 (abfd, count + 2, temp); - if (bfd_write (temp, sizeof (temp), 1, abfd) != sizeof (temp)) + if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp)) return false; /* The first two relocs for each external symbol are the .lita diff -uprN binutils-2.11.90.0.31/bfd/nlm32-i386.c binutils-2.11.92.0.5/bfd/nlm32-i386.c --- binutils-2.11.90.0.31/bfd/nlm32-i386.c Fri Mar 9 11:16:03 2001 +++ binutils-2.11.92.0.5/bfd/nlm32-i386.c Mon Oct 1 15:25:21 2001 @@ -1,5 +1,5 @@ /* Support for 32-bit i386 NLM (NetWare Loadable Module) - Copyright 1993, 1994, 2000 Free Software Foundation, Inc. + Copyright 1993, 1994, 2000, 2001 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -86,7 +86,7 @@ nlm_i386_read_reloc (abfd, sym, secp, re bfd_vma val; const char *name; - if (bfd_read (temp, sizeof (temp), 1, abfd) != sizeof (temp)) + if (bfd_bread (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp)) return false; val = bfd_get_32 (abfd, temp); @@ -228,7 +228,7 @@ nlm_i386_write_import (abfd, sec, rel) } bfd_put_32 (abfd, val, temp); - if (bfd_write (temp, sizeof (temp), 1, abfd) != sizeof (temp)) + if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp)) return false; return true; @@ -350,23 +350,24 @@ nlm_i386_read_import (abfd, sym) unsigned char symlength; /* length of symbol name */ char *name; - if (bfd_read ((PTR) &symlength, sizeof (symlength), 1, abfd) + if (bfd_bread ((PTR) &symlength, (bfd_size_type) sizeof (symlength), abfd) != sizeof (symlength)) return false; sym -> symbol.the_bfd = abfd; - name = bfd_alloc (abfd, symlength + 1); + name = bfd_alloc (abfd, (bfd_size_type) symlength + 1); if (name == NULL) return false; - if (bfd_read (name, symlength, 1, abfd) != symlength) + if (bfd_bread (name, (bfd_size_type) symlength, abfd) != symlength) return false; name[symlength] = '\0'; sym -> symbol.name = name; sym -> symbol.flags = 0; sym -> symbol.value = 0; sym -> symbol.section = bfd_und_section_ptr; - if (bfd_read ((PTR) temp, sizeof (temp), 1, abfd) != sizeof (temp)) + if (bfd_bread ((PTR) temp, (bfd_size_type) sizeof (temp), abfd) + != sizeof (temp)) return false; - rcount = bfd_h_get_32 (abfd, temp); + rcount = H_GET_32 (abfd, temp); nlm_relocs = ((struct nlm_relent *) bfd_alloc (abfd, rcount * sizeof (struct nlm_relent))); if (!nlm_relocs) @@ -402,12 +403,13 @@ nlm_i386_write_external (abfd, count, sy unsigned char temp[NLM_TARGET_LONG_SIZE]; len = strlen (sym->name); - if ((bfd_write (&len, sizeof (bfd_byte), 1, abfd) != sizeof (bfd_byte)) - || bfd_write (sym->name, len, 1, abfd) != len) + if ((bfd_bwrite (&len, (bfd_size_type) sizeof (bfd_byte), abfd) + != sizeof (bfd_byte)) + || bfd_bwrite (sym->name, (bfd_size_type) len, abfd) != len) return false; bfd_put_32 (abfd, count, temp); - if (bfd_write (temp, sizeof (temp), 1, abfd) != sizeof (temp)) + if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp)) return false; for (i = 0; i < count; i++) diff -uprN binutils-2.11.90.0.31/bfd/nlm32-ppc.c binutils-2.11.92.0.5/bfd/nlm32-ppc.c --- binutils-2.11.90.0.31/bfd/nlm32-ppc.c Fri Mar 9 11:16:03 2001 +++ binutils-2.11.92.0.5/bfd/nlm32-ppc.c Mon Oct 1 15:25:21 2001 @@ -1,5 +1,5 @@ /* Support for 32-bit PowerPC NLM (NetWare Loadable Module) - Copyright 1994, 1995, 2000 Free Software Foundation, Inc. + Copyright 1994, 1995, 2000, 2001 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -76,11 +76,11 @@ nlm_powerpc_backend_object_p (abfd) { struct nlm32_powerpc_external_prefix_header s; - if (bfd_read ((PTR) &s, sizeof s, 1, abfd) != sizeof s) + if (bfd_bread ((PTR) &s, (bfd_size_type) sizeof s, abfd) != sizeof s) return false; if (memcmp (s.signature, NLM32_POWERPC_SIGNATURE, sizeof s.signature) != 0 - || bfd_h_get_32 (abfd, s.headerVersion) != NLM32_POWERPC_HEADER_VERSION) + || H_GET_32 (abfd, s.headerVersion) != NLM32_POWERPC_HEADER_VERSION) return false; return true; @@ -96,12 +96,12 @@ nlm_powerpc_write_prefix (abfd) memset (&s, 0, sizeof s); memcpy (s.signature, NLM32_POWERPC_SIGNATURE, sizeof s.signature); - bfd_h_put_32 (abfd, (bfd_vma) NLM32_POWERPC_HEADER_VERSION, s.headerVersion); - bfd_h_put_32 (abfd, (bfd_vma) 0, s.origins); + H_PUT_32 (abfd, NLM32_POWERPC_HEADER_VERSION, s.headerVersion); + H_PUT_32 (abfd, 0, s.origins); /* FIXME: What should we do about the date? */ - if (bfd_write ((PTR) &s, sizeof s, 1, abfd) != sizeof s) + if (bfd_bwrite ((PTR) &s, (bfd_size_type) sizeof s, abfd) != sizeof s) return false; return true; @@ -141,7 +141,7 @@ nlm_powerpc_read_reloc (abfd, sym, secp, bfd_vma val; const char *name; - if (bfd_read (temp, sizeof (temp), 1, abfd) != sizeof (temp)) + if (bfd_bread (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp)) return false; val = bfd_get_32 (abfd, temp); @@ -561,14 +561,14 @@ nlm_powerpc_read_reloc (abfd, sym, secp, asection *code_sec, *data_sec, *bss_sec; /* Read the reloc from the file. */ - if (bfd_read (&ext, sizeof ext, 1, abfd) != sizeof ext) + if (bfd_bread (&ext, (bfd_size_type) sizeof ext, abfd) != sizeof ext) return false; /* Swap in the fields. */ - l_vaddr = bfd_h_get_32 (abfd, ext.l_vaddr); - l_symndx = bfd_h_get_32 (abfd, ext.l_symndx); - l_rtype = bfd_h_get_16 (abfd, ext.l_rtype); - l_rsecnm = bfd_h_get_16 (abfd, ext.l_rsecnm); + l_vaddr = H_GET_32 (abfd, ext.l_vaddr); + l_symndx = H_GET_32 (abfd, ext.l_symndx); + l_rtype = H_GET_16 (abfd, ext.l_rtype); + l_rsecnm = H_GET_16 (abfd, ext.l_rsecnm); /* Get the sections now, for convenience. */ code_sec = bfd_get_section_by_name (abfd, NLM_CODE_NAME); @@ -661,23 +661,24 @@ nlm_powerpc_read_import (abfd, sym) unsigned char symlength; /* length of symbol name */ char *name; - if (bfd_read ((PTR) &symlength, sizeof (symlength), 1, abfd) + if (bfd_bread ((PTR) &symlength, (bfd_size_type) sizeof (symlength), abfd) != sizeof (symlength)) return (false); sym -> symbol.the_bfd = abfd; - name = bfd_alloc (abfd, symlength + 1); + name = bfd_alloc (abfd, (bfd_size_type) symlength + 1); if (name == NULL) return false; - if (bfd_read (name, symlength, 1, abfd) != symlength) + if (bfd_bread (name, (bfd_size_type) symlength, abfd) != symlength) return (false); name[symlength] = '\0'; sym -> symbol.name = name; sym -> symbol.flags = 0; sym -> symbol.value = 0; sym -> symbol.section = bfd_und_section_ptr; - if (bfd_read ((PTR) temp, sizeof (temp), 1, abfd) != sizeof (temp)) + if (bfd_bread ((PTR) temp, (bfd_size_type) sizeof (temp), abfd) + != sizeof (temp)) return (false); - rcount = bfd_h_get_32 (abfd, temp); + rcount = H_GET_32 (abfd, temp); nlm_relocs = ((struct nlm_relent *) bfd_alloc (abfd, rcount * sizeof (struct nlm_relent))); if (nlm_relocs == (struct nlm_relent *) NULL) @@ -762,7 +763,7 @@ nlm_powerpc_write_import (abfd, sec, rel } bfd_put_32 (abfd, val, temp); - if (bfd_write (temp, sizeof (temp), 1, abfd) != sizeof (temp)) + if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp)) return false; return true; @@ -818,7 +819,7 @@ nlm_powerpc_write_reloc (abfd, sec, rel, } } - bfd_h_put_32 (abfd, (bfd_vma) l_symndx, ext.l_symndx); + H_PUT_32 (abfd, l_symndx, ext.l_symndx); for (howto = nlm_powerpc_howto_table; howto < nlm_powerpc_howto_table + HOWTO_COUNT; @@ -849,7 +850,7 @@ nlm_powerpc_write_reloc (abfd, sec, rel, if (howto->complain_on_overflow == complain_overflow_signed) l_rtype |= 0x8000; l_rtype |= (howto->bitsize - 1) << 8; - bfd_h_put_16 (abfd, (bfd_vma) l_rtype, ext.l_rtype); + H_PUT_16 (abfd, l_rtype, ext.l_rtype); address = rel->address; @@ -866,10 +867,10 @@ nlm_powerpc_write_reloc (abfd, sec, rel, return false; } - bfd_h_put_16 (abfd, (bfd_vma) l_rsecnm, ext.l_rsecnm); - bfd_h_put_32 (abfd, (bfd_vma) address, ext.l_vaddr); + H_PUT_16 (abfd, l_rsecnm, ext.l_rsecnm); + H_PUT_32 (abfd, address, ext.l_vaddr); - if (bfd_write (&ext, sizeof ext, 1, abfd) != sizeof ext) + if (bfd_bwrite (&ext, (bfd_size_type) sizeof ext, abfd) != sizeof ext) return false; return true; @@ -907,12 +908,13 @@ nlm_powerpc_write_external (abfd, count, #endif len = strlen (sym->name); - if ((bfd_write (&len, sizeof (bfd_byte), 1, abfd) != sizeof (bfd_byte)) - || bfd_write (sym->name, len, 1, abfd) != len) + if ((bfd_bwrite (&len, (bfd_size_type) sizeof (bfd_byte), abfd) + != sizeof (bfd_byte)) + || bfd_bwrite (sym->name, (bfd_size_type) len, abfd) != len) return false; bfd_put_32 (abfd, count, temp); - if (bfd_write (temp, sizeof (temp), 1, abfd) != sizeof (temp)) + if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp)) return false; for (i = 0; i < count; i++) diff -uprN binutils-2.11.90.0.31/bfd/nlm32-sparc.c binutils-2.11.92.0.5/bfd/nlm32-sparc.c --- binutils-2.11.90.0.31/bfd/nlm32-sparc.c Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/bfd/nlm32-sparc.c Mon Oct 1 15:25:21 2001 @@ -62,7 +62,7 @@ enum reloc_type }; #if 0 -static CONST char *CONST reloc_type_names[] = +static const char *const reloc_type_names[] = { "R_SPARC_NONE", "R_SPARC_8", "R_SPARC_16", "R_SPARC_32", @@ -131,7 +131,7 @@ nlm_sparc_read_reloc (abfd, sym, secp, r struct nlm32_sparc_reloc_ext tmp_reloc; asection *code_sec, *data_sec; - if (bfd_read (&tmp_reloc, 12, 1, abfd) != 12) + if (bfd_bread (&tmp_reloc, (bfd_size_type) 12, abfd) != 12) return false; code_sec = bfd_get_section_by_name (abfd, NLM_CODE_NAME); @@ -224,7 +224,7 @@ nlm_sparc_write_reloc (abfd, sec, rel) bfd_put_32 (abfd, rel->addend, tmp_reloc.addend); bfd_put_8 (abfd, (short) (rel->howto->type), tmp_reloc.type); - if (bfd_write (&tmp_reloc, 12, 1, abfd) != 12) + if (bfd_bwrite (&tmp_reloc, (bfd_size_type) 12, abfd) != 12) return false; return true; @@ -259,24 +259,24 @@ nlm_sparc_read_import (abfd, sym) /* First, read in the number of relocation entries for this symbol. */ - if (bfd_read ((PTR) temp, 4, 1, abfd) != 4) + if (bfd_bread ((PTR) temp, (bfd_size_type) 4, abfd) != 4) return false; rcount = bfd_get_32 (abfd, temp); /* Next, read in the length of the symbol. */ - if (bfd_read ((PTR) &symlength, sizeof (symlength), 1, abfd) + if (bfd_bread ((PTR) &symlength, (bfd_size_type) sizeof (symlength), abfd) != sizeof (symlength)) return false; sym -> symbol.the_bfd = abfd; - name = bfd_alloc (abfd, symlength + 1); + name = bfd_alloc (abfd, (bfd_size_type) symlength + 1); if (name == NULL) return false; /* Then read in the symbol. */ - if (bfd_read (name, symlength, 1, abfd) != symlength) + if (bfd_bread (name, (bfd_size_type) symlength, abfd) != symlength) return false; name[symlength] = '\0'; sym -> symbol.name = name; @@ -337,10 +337,10 @@ nlm_sparc_write_import (abfd, sec, rel) __FUNCTION__, base + (*rel->sym_ptr_ptr)->value); #endif bfd_put_32 (abfd, base + (*rel->sym_ptr_ptr)->value, temp); - if (bfd_write ((PTR)temp, 4, 1, abfd) != 4) + if (bfd_bwrite ((PTR) temp, (bfd_size_type) 4, abfd) != 4) return false; - bfd_put_32 (abfd, 1, temp); - if (bfd_write ((PTR)temp, 4, 1, abfd) != 4) + bfd_put_32 (abfd, (bfd_vma) 1, temp); + if (bfd_bwrite ((PTR) temp, (bfd_size_type) 4, abfd) != 4) return false; if (nlm_sparc_write_reloc (abfd, sec, rel) == false) return false; @@ -361,12 +361,13 @@ nlm_sparc_write_external (abfd, count, s unsigned char temp[NLM_TARGET_LONG_SIZE]; bfd_put_32 (abfd, count, temp); - if (bfd_write (temp, sizeof (temp), 1, abfd) != sizeof (temp)) + if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp)) return false; len = strlen (sym->name); - if ((bfd_write (&len, sizeof (bfd_byte), 1, abfd) != sizeof (bfd_byte)) - || bfd_write (sym->name, len, 1, abfd) != len) + if ((bfd_bwrite (&len, (bfd_size_type) sizeof (bfd_byte), abfd) + != sizeof (bfd_byte)) + || bfd_bwrite (sym->name, (bfd_size_type) len, abfd) != len) return false; for (i = 0; i < count; i++) @@ -395,9 +396,9 @@ nlm_sparc_write_export (abfd, sym, value bfd_put_32 (abfd, value, temp); len = strlen (sym->name); - if (bfd_write (temp, 4, 1, abfd) != 4 - || bfd_write (&len, 1, 1, abfd) != 1 - || bfd_write (sym->name, len, 1, abfd) != len) + if (bfd_bwrite (temp, (bfd_size_type) 4, abfd) != 4 + || bfd_bwrite (&len, (bfd_size_type) 1, abfd) != 1 + || bfd_bwrite (sym->name, (bfd_size_type) len, abfd) != len) return false; return true; diff -uprN binutils-2.11.90.0.31/bfd/nlmcode.h binutils-2.11.92.0.5/bfd/nlmcode.h --- binutils-2.11.90.0.31/bfd/nlmcode.h Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/nlmcode.h Mon Oct 1 15:25:21 2001 @@ -1,5 +1,6 @@ /* NLM (NetWare Loadable Module) executable support for BFD. - Copyright 1993, 1994, 1995, 1998, 2000 Free Software Foundation, Inc. + Copyright 1993, 1994, 1995, 1998, 2000, 2001 + Free Software Foundation, Inc. Written by Fred Fish @ Cygnus Support, using ELF support as the template. @@ -82,12 +83,12 @@ static int nlm_external_reloc_compare /* Should perhaps use put_offset, put_word, etc. For now, the two versions can be handled by explicitly specifying 32 bits or "the long type". */ #if ARCH_SIZE == 64 -#define put_word bfd_h_put_64 -#define get_word bfd_h_get_64 +#define put_word H_PUT_64 +#define get_word H_GET_64 #endif #if ARCH_SIZE == 32 -#define put_word bfd_h_put_32 -#define get_word bfd_h_get_32 +#define put_word H_PUT_32 +#define get_word H_GET_32 #endif const bfd_target * @@ -101,6 +102,7 @@ nlm_object_p (abfd) struct nlm_obj_tdata *new_tdata = NULL; const char *signature; enum bfd_architecture arch; + bfd_size_type amt; /* Some NLM formats have a prefix before the standard NLM fixed header. */ @@ -113,12 +115,12 @@ nlm_object_p (abfd) /* Read in the fixed length portion of the NLM header in external format. */ - x_fxdhdr = (PTR) bfd_malloc ((size_t) nlm_fixed_header_size (abfd)); + amt = nlm_fixed_header_size (abfd); + x_fxdhdr = (PTR) bfd_malloc (amt); if (x_fxdhdr == NULL) goto got_no_match; - if (bfd_read ((PTR) x_fxdhdr, nlm_fixed_header_size (abfd), 1, abfd) != - nlm_fixed_header_size (abfd)) + if (bfd_bread ((PTR) x_fxdhdr, amt, abfd) != amt) { if (bfd_get_error () != bfd_error_system_call) goto got_wrong_format_error; @@ -129,8 +131,8 @@ nlm_object_p (abfd) /* Allocate an instance of the nlm_obj_tdata structure and hook it up to the tdata pointer in the bfd. */ - new_tdata = ((struct nlm_obj_tdata *) - bfd_zalloc (abfd, sizeof (struct nlm_obj_tdata))); + amt = sizeof (struct nlm_obj_tdata); + new_tdata = (struct nlm_obj_tdata *) bfd_zalloc (abfd, amt); if (new_tdata == NULL) goto got_no_match; @@ -238,14 +240,14 @@ add_bfd_section (abfd, name, offset, siz newsect = bfd_make_section (abfd, name); if (newsect == NULL) { - return (false); + return false; } newsect->vma = 0; /* NLM's are relocatable. */ newsect->_raw_size = size; newsect->filepos = offset; newsect->flags = flags; - newsect->alignment_power = bfd_log2 (0); /* FIXME */ - return (true); + newsect->alignment_power = bfd_log2 ((bfd_vma) 0); /* FIXME */ + return true; } /* Read and swap in the variable length header. All the fields must @@ -256,66 +258,62 @@ nlm_swap_variable_header_in (abfd) bfd *abfd; { unsigned char temp[NLM_TARGET_LONG_SIZE]; + bfd_size_type amt; /* Read the description length and text members. */ - if (bfd_read ((PTR) & nlm_variable_header (abfd)->descriptionLength, - sizeof (nlm_variable_header (abfd)->descriptionLength), - 1, abfd) != - sizeof (nlm_variable_header (abfd)->descriptionLength)) - return (false); - if (bfd_read ((PTR) nlm_variable_header (abfd)->descriptionText, - nlm_variable_header (abfd)->descriptionLength + 1, - 1, abfd) != - (bfd_size_type) nlm_variable_header (abfd)->descriptionLength + 1) - return (false); + amt = sizeof (nlm_variable_header (abfd)->descriptionLength); + if (bfd_bread ((PTR) &nlm_variable_header (abfd)->descriptionLength, + amt, abfd) != amt) + return false; + amt = nlm_variable_header (abfd)->descriptionLength + 1; + if (bfd_bread ((PTR) nlm_variable_header (abfd)->descriptionText, + amt, abfd) != amt) + return false; /* Read and convert the stackSize field. */ - if (bfd_read ((PTR) temp, sizeof (temp), 1, abfd) != sizeof (temp)) - return (false); + amt = sizeof (temp); + if (bfd_bread ((PTR) temp, amt, abfd) != amt) + return false; nlm_variable_header (abfd)->stackSize = get_word (abfd, (bfd_byte *) temp); /* Read and convert the reserved field. */ - if (bfd_read ((PTR) temp, sizeof (temp), 1, abfd) != sizeof (temp)) - return (false); + amt = sizeof (temp); + if (bfd_bread ((PTR) temp, amt, abfd) != amt) + return false; nlm_variable_header (abfd)->reserved = get_word (abfd, (bfd_byte *) temp); /* Read the oldThreadName field. This field is a fixed length string. */ - if (bfd_read ((PTR) nlm_variable_header (abfd)->oldThreadName, - sizeof (nlm_variable_header (abfd)->oldThreadName), - 1, abfd) != - sizeof (nlm_variable_header (abfd)->oldThreadName)) - return (false); + amt = sizeof (nlm_variable_header (abfd)->oldThreadName); + if (bfd_bread ((PTR) nlm_variable_header (abfd)->oldThreadName, + amt, abfd) != amt) + return false; /* Read the screen name length and text members. */ - if (bfd_read ((PTR) & nlm_variable_header (abfd)->screenNameLength, - sizeof (nlm_variable_header (abfd)->screenNameLength), - 1, abfd) != - sizeof (nlm_variable_header (abfd)->screenNameLength)) - return (false); - if (bfd_read ((PTR) nlm_variable_header (abfd)->screenName, - nlm_variable_header (abfd)->screenNameLength + 1, - 1, abfd) != - (bfd_size_type) nlm_variable_header (abfd)->screenNameLength + 1) - return (false); + amt = sizeof (nlm_variable_header (abfd)->screenNameLength); + if (bfd_bread ((PTR) & nlm_variable_header (abfd)->screenNameLength, + amt, abfd) != amt) + return false; + amt = nlm_variable_header (abfd)->screenNameLength + 1; + if (bfd_bread ((PTR) nlm_variable_header (abfd)->screenName, + amt, abfd) != amt) + return false; /* Read the thread name length and text members. */ - if (bfd_read ((PTR) & nlm_variable_header (abfd)->threadNameLength, - sizeof (nlm_variable_header (abfd)->threadNameLength), - 1, abfd) != - sizeof (nlm_variable_header (abfd)->threadNameLength)) - return (false); - if (bfd_read ((PTR) nlm_variable_header (abfd)->threadName, - nlm_variable_header (abfd)->threadNameLength + 1, - 1, abfd) != - (bfd_size_type) nlm_variable_header (abfd)->threadNameLength + 1) - return (false); - return (true); + amt = sizeof (nlm_variable_header (abfd)->threadNameLength); + if (bfd_bread ((PTR) & nlm_variable_header (abfd)->threadNameLength, + amt, abfd) != amt) + return false; + amt = nlm_variable_header (abfd)->threadNameLength + 1; + if (bfd_bread ((PTR) nlm_variable_header (abfd)->threadName, + amt, abfd) != amt) + return false; + return true; } /* Swap and write out the variable length header. All the fields must @@ -326,68 +324,64 @@ nlm_swap_variable_header_out (abfd) bfd *abfd; { unsigned char temp[NLM_TARGET_LONG_SIZE]; + bfd_size_type amt; /* Write the description length and text members. */ - if (bfd_write ((PTR) & nlm_variable_header (abfd)->descriptionLength, - sizeof (nlm_variable_header (abfd)->descriptionLength), - 1, abfd) != - sizeof (nlm_variable_header (abfd)->descriptionLength)) - return (false); - if (bfd_write ((PTR) nlm_variable_header (abfd)->descriptionText, - nlm_variable_header (abfd)->descriptionLength + 1, - 1, abfd) != - (bfd_size_type) nlm_variable_header (abfd)->descriptionLength + 1) - return (false); + amt = sizeof (nlm_variable_header (abfd)->descriptionLength); + if (bfd_bwrite ((PTR) & nlm_variable_header (abfd)->descriptionLength, amt, + abfd) != amt) + return false; + amt = nlm_variable_header (abfd)->descriptionLength + 1; + if (bfd_bwrite ((PTR) nlm_variable_header (abfd)->descriptionText, amt, + abfd) != amt) + return false; /* Convert and write the stackSize field. */ put_word (abfd, (bfd_vma) nlm_variable_header (abfd)->stackSize, (bfd_byte *) temp); - if (bfd_write ((PTR) temp, sizeof (temp), 1, abfd) != sizeof (temp)) - return (false); + amt = sizeof (temp); + if (bfd_bwrite ((PTR) temp, amt, abfd) != amt) + return false; /* Convert and write the reserved field. */ put_word (abfd, (bfd_vma) nlm_variable_header (abfd)->reserved, (bfd_byte *) temp); - if (bfd_write ((PTR) temp, sizeof (temp), 1, abfd) != sizeof (temp)) - return (false); + amt = sizeof (temp); + if (bfd_bwrite ((PTR) temp, amt, abfd) != amt) + return false; /* Write the oldThreadName field. This field is a fixed length string. */ - if (bfd_write ((PTR) nlm_variable_header (abfd)->oldThreadName, - sizeof (nlm_variable_header (abfd)->oldThreadName), - 1, abfd) != - sizeof (nlm_variable_header (abfd)->oldThreadName)) - return (false); + amt = sizeof (nlm_variable_header (abfd)->oldThreadName); + if (bfd_bwrite ((PTR) nlm_variable_header (abfd)->oldThreadName, amt, + abfd) != amt) + return false; /* Write the screen name length and text members. */ - if (bfd_write ((PTR) & nlm_variable_header (abfd)->screenNameLength, - sizeof (nlm_variable_header (abfd)->screenNameLength), - 1, abfd) != - sizeof (nlm_variable_header (abfd)->screenNameLength)) - return (false); - if (bfd_write ((PTR) nlm_variable_header (abfd)->screenName, - nlm_variable_header (abfd)->screenNameLength + 1, - 1, abfd) != - (bfd_size_type) nlm_variable_header (abfd)->screenNameLength + 1) - return (false); + amt = sizeof (nlm_variable_header (abfd)->screenNameLength); + if (bfd_bwrite ((PTR) & nlm_variable_header (abfd)->screenNameLength, amt, + abfd) != amt) + return false; + amt = nlm_variable_header (abfd)->screenNameLength + 1; + if (bfd_bwrite ((PTR) nlm_variable_header (abfd)->screenName, amt, + abfd) != amt) + return false; /* Write the thread name length and text members. */ - if (bfd_write ((PTR) & nlm_variable_header (abfd)->threadNameLength, - sizeof (nlm_variable_header (abfd)->threadNameLength), - 1, abfd) != - sizeof (nlm_variable_header (abfd)->threadNameLength)) - return (false); - if (bfd_write ((PTR) nlm_variable_header (abfd)->threadName, - nlm_variable_header (abfd)->threadNameLength + 1, - 1, abfd) != - (bfd_size_type) nlm_variable_header (abfd)->threadNameLength + 1) - return (false); - return (true); + amt = sizeof (nlm_variable_header (abfd)->threadNameLength); + if (bfd_bwrite ((PTR) & nlm_variable_header (abfd)->threadNameLength, amt, + abfd) != amt) + return false; + amt = nlm_variable_header (abfd)->threadNameLength + 1; + if (bfd_bwrite ((PTR) nlm_variable_header (abfd)->threadName, amt, + abfd) != amt) + return false; + return true; } /* Read and swap in the contents of all the auxiliary headers. Because of @@ -404,21 +398,24 @@ nlm_swap_auxiliary_headers_in (abfd) bfd *abfd; { char tempstr[16]; - long position; + file_ptr position; + bfd_size_type amt; for (;;) { position = bfd_tell (abfd); - if (bfd_read ((PTR) tempstr, sizeof (tempstr), 1, abfd) != - sizeof (tempstr)) - return (false); - if (bfd_seek (abfd, position, SEEK_SET) == -1) - return (false); + amt = sizeof (tempstr); + if (bfd_bread ((PTR) tempstr, amt, abfd) != amt) + return false; + if (bfd_seek (abfd, position, SEEK_SET) != 0) + return false; if (strncmp (tempstr, "VeRsIoN#", 8) == 0) { Nlm_External_Version_Header thdr; - if (bfd_read ((PTR) & thdr, sizeof (thdr), 1, abfd) != sizeof (thdr)) - return (false); + + amt = sizeof (thdr); + if (bfd_bread ((PTR) &thdr, amt, abfd) != amt) + return false; memcpy (nlm_version_header (abfd)->stamp, thdr.stamp, sizeof (thdr.stamp)); nlm_version_header (abfd)->majorVersion = @@ -437,8 +434,10 @@ nlm_swap_auxiliary_headers_in (abfd) else if (strncmp (tempstr, "MeSsAgEs", 8) == 0) { Nlm_External_Extended_Header thdr; - if (bfd_read ((PTR) & thdr, sizeof (thdr), 1, abfd) != sizeof (thdr)) - return (false); + + amt = sizeof (thdr); + if (bfd_bread ((PTR) &thdr, amt, abfd) != amt) + return false; memcpy (nlm_extended_header (abfd)->stamp, thdr.stamp, sizeof (thdr.stamp)); nlm_extended_header (abfd)->languageID = @@ -502,22 +501,19 @@ nlm_swap_auxiliary_headers_in (abfd) } else if (strncmp (tempstr, "CoPyRiGhT=", 10) == 0) { - if (bfd_read ((PTR) nlm_copyright_header (abfd)->stamp, - sizeof (nlm_copyright_header (abfd)->stamp), - 1, abfd) - != sizeof (nlm_copyright_header (abfd)->stamp)) - return (false); - if (bfd_read ((PTR) & (nlm_copyright_header (abfd) - ->copyrightMessageLength), - 1, 1, abfd) != 1) - return (false); + amt = sizeof (nlm_copyright_header (abfd)->stamp); + if (bfd_bread ((PTR) nlm_copyright_header (abfd)->stamp, + amt, abfd) != amt) + return false; + if (bfd_bread ((PTR) &(nlm_copyright_header (abfd) + ->copyrightMessageLength), + (bfd_size_type) 1, abfd) != 1) + return false; /* The copyright message is a variable length string. */ - if (bfd_read ((PTR) nlm_copyright_header (abfd)->copyrightMessage, - nlm_copyright_header (abfd)->copyrightMessageLength + 1, - 1, abfd) != - ((bfd_size_type) - nlm_copyright_header (abfd)->copyrightMessageLength + 1)) - return (false); + amt = nlm_copyright_header (abfd)->copyrightMessageLength + 1; + if (bfd_bread ((PTR) nlm_copyright_header (abfd)->copyrightMessage, + amt, abfd) != amt) + return false; } else if (strncmp (tempstr, "CuStHeAd", 8) == 0) { @@ -529,12 +525,12 @@ nlm_swap_auxiliary_headers_in (abfd) PTR hdr; /* Read the stamp ("CuStHeAd"). */ - if (bfd_read ((PTR) thdr.stamp, 1, sizeof (thdr.stamp), abfd) - != sizeof (thdr.stamp)) + amt = sizeof (thdr.stamp); + if (bfd_bread ((PTR) thdr.stamp, amt, abfd) != amt) return false; /* Read the length of this custom header. */ - if (bfd_read ((PTR) thdr.length, 1, sizeof (thdr.length), abfd) - != sizeof (thdr.length)) + amt = sizeof (thdr.length); + if (bfd_bread ((PTR) thdr.length, amt, abfd) != amt) return false; hdrLength = get_word (abfd, (bfd_byte *) thdr.length); /* Read further fields if we have them. */ @@ -542,9 +538,8 @@ nlm_swap_auxiliary_headers_in (abfd) dataOffset = 0; else { - if (bfd_read ((PTR) thdr.dataOffset, 1, - sizeof (thdr.dataOffset), abfd) - != sizeof (thdr.dataOffset)) + amt = sizeof (thdr.dataOffset); + if (bfd_bread ((PTR) thdr.dataOffset, amt, abfd) != amt) return false; dataOffset = get_word (abfd, (bfd_byte *) thdr.dataOffset); } @@ -552,9 +547,8 @@ nlm_swap_auxiliary_headers_in (abfd) dataLength = 0; else { - if (bfd_read ((PTR) thdr.dataLength, 1, - sizeof (thdr.dataLength), abfd) - != sizeof (thdr.dataLength)) + amt = sizeof (thdr.dataLength); + if (bfd_bread ((PTR) thdr.dataLength, amt, abfd) != amt) return false; dataLength = get_word (abfd, (bfd_byte *) thdr.dataLength); } @@ -562,8 +556,8 @@ nlm_swap_auxiliary_headers_in (abfd) memset (dataStamp, 0, sizeof (dataStamp)); else { - if (bfd_read ((PTR) dataStamp, 1, sizeof (dataStamp), abfd) - != sizeof (dataStamp)) + amt = sizeof (dataStamp); + if (bfd_bread ((PTR) dataStamp, amt, abfd) != amt) return false; } @@ -579,7 +573,7 @@ nlm_swap_auxiliary_headers_in (abfd) hdr = bfd_alloc (abfd, hdrLength); if (hdr == NULL) return false; - if (bfd_read (hdr, 1, hdrLength, abfd) != hdrLength) + if (bfd_bread (hdr, hdrLength, abfd) != hdrLength) return false; } @@ -600,7 +594,7 @@ nlm_swap_auxiliary_headers_in (abfd) contents = (bfd_byte *) bfd_alloc (abfd, dataLength); if (contents == NULL) return false; - if (bfd_read (contents, 1, dataLength, abfd) != dataLength) + if (bfd_bread (contents, dataLength, abfd) != dataLength) return false; if (bfd_seek (abfd, pos, SEEK_SET) != 0) return false; @@ -638,11 +632,11 @@ nlm_swap_auxiliary_headers_in (abfd) name = (char *) p; l = strlen (name) + 1; - l = (l + 3) &~ 3; + l = (l + 3) &~ (size_t) 3; p += l; - filepos = bfd_h_get_32 (abfd, p); + filepos = H_GET_32 (abfd, p); p += 4; - size = bfd_h_get_32 (abfd, p); + size = H_GET_32 (abfd, p); p += 4; newsec = bfd_make_section_anyway (abfd, name); @@ -673,7 +667,7 @@ nlm_swap_auxiliary_headers_in (abfd) break; } } - return (true); + return true; } /* Return whether there is a non-zero byte in a memory block. */ @@ -699,6 +693,8 @@ static boolean nlm_swap_auxiliary_headers_out (abfd) bfd *abfd; { + bfd_size_type amt; + /* Write out the version header if there is one. */ if (find_nonzero ((PTR) nlm_version_header (abfd), sizeof (Nlm_Internal_Version_Header))) @@ -718,7 +714,8 @@ nlm_swap_auxiliary_headers_out (abfd) (bfd_byte *) thdr.month); put_word (abfd, (bfd_vma) nlm_version_header (abfd)->day, (bfd_byte *) thdr.day); - if (bfd_write ((PTR) & thdr, sizeof (thdr), 1, abfd) != sizeof (thdr)) + if (bfd_bwrite ((PTR) &thdr, (bfd_size_type) sizeof (thdr), abfd) + != sizeof (thdr)) return false; } @@ -816,7 +813,8 @@ nlm_swap_auxiliary_headers_out (abfd) put_word (abfd, (bfd_vma) nlm_extended_header (abfd)->reserved5, (bfd_byte *) thdr.reserved5); - if (bfd_write ((PTR) & thdr, sizeof (thdr), 1, abfd) != sizeof (thdr)) + if (bfd_bwrite ((PTR) &thdr, (bfd_size_type) sizeof (thdr), abfd) + != sizeof (thdr)) return false; } @@ -827,19 +825,18 @@ nlm_swap_auxiliary_headers_out (abfd) Nlm_External_Copyright_Header thdr; memcpy (thdr.stamp, "CoPyRiGhT=", 10); - if (bfd_write ((PTR) thdr.stamp, sizeof (thdr.stamp), 1, abfd) - != sizeof (thdr.stamp)) + amt = sizeof (thdr.stamp); + if (bfd_bwrite ((PTR) thdr.stamp, amt, abfd) != amt) return false; thdr.copyrightMessageLength[0] = nlm_copyright_header (abfd)->copyrightMessageLength; - if (bfd_write ((PTR) thdr.copyrightMessageLength, 1, 1, abfd) != 1) + amt = 1; + if (bfd_bwrite ((PTR) thdr.copyrightMessageLength, amt, abfd) != amt) return false; /* The copyright message is a variable length string. */ - if (bfd_write ((PTR) nlm_copyright_header (abfd)->copyrightMessage, - nlm_copyright_header (abfd)->copyrightMessageLength + 1, - 1, abfd) != - ((bfd_size_type) - nlm_copyright_header (abfd)->copyrightMessageLength + 1)) + amt = nlm_copyright_header (abfd)->copyrightMessageLength + 1; + if (bfd_bwrite ((PTR) nlm_copyright_header (abfd)->copyrightMessage, + amt, abfd) != amt) return false; } @@ -864,20 +861,19 @@ nlm_swap_auxiliary_headers_out (abfd) if (! ds) { BFD_ASSERT (nlm_custom_header (abfd)->hdrLength == 0); - if (bfd_write ((PTR) &thdr, 1, - sizeof (thdr) - sizeof (thdr.dataStamp), abfd) - != sizeof (thdr) - sizeof (thdr.dataStamp)) + amt = sizeof (thdr) - sizeof (thdr.dataStamp); + if (bfd_bwrite ((PTR) &thdr, amt, abfd) != amt) return false; } else { memcpy (thdr.dataStamp, nlm_custom_header (abfd)->dataStamp, sizeof (thdr.dataStamp)); - if (bfd_write ((PTR) &thdr, sizeof (thdr), 1, abfd) != sizeof (thdr)) + amt = sizeof (thdr); + if (bfd_bwrite ((PTR) &thdr, amt, abfd) != amt) return false; - if (bfd_write (nlm_custom_header (abfd)->hdr, 1, - nlm_custom_header (abfd)->hdrLength, abfd) - != nlm_custom_header (abfd)->hdrLength) + amt = nlm_custom_header (abfd)->hdrLength; + if (bfd_bwrite (nlm_custom_header (abfd)->hdr, amt, abfd) != amt) return false; } } @@ -896,7 +892,8 @@ nlm_swap_auxiliary_headers_out (abfd) put_word (abfd, (bfd_vma) nlm_cygnus_ext_header (abfd)->length, (bfd_byte *) thdr.dataLength); memcpy (thdr.dataStamp, "CyGnUsEx", 8); - if (bfd_write ((PTR) &thdr, sizeof (thdr), 1, abfd) != sizeof (thdr)) + amt = sizeof (thdr); + if (bfd_bwrite ((PTR) &thdr, amt, abfd) != amt) return false; } @@ -958,9 +955,9 @@ asymbol * nlm_make_empty_symbol (abfd) bfd *abfd; { - nlm_symbol_type *new; + bfd_size_type amt = sizeof (nlm_symbol_type); + nlm_symbol_type *new = (nlm_symbol_type *) bfd_zalloc (abfd, amt); - new = (nlm_symbol_type *) bfd_zalloc (abfd, sizeof (nlm_symbol_type)); if (new) new->symbol.the_bfd = abfd; return &new->symbol; @@ -1037,9 +1034,10 @@ nlm_slurp_symbol_table (abfd) bfd_byte temp[NLM_TARGET_LONG_SIZE]; /* Symbol offsets read into here */ boolean (*read_import_func) PARAMS ((bfd *, nlm_symbol_type *)); boolean (*set_public_section_func) PARAMS ((bfd *, nlm_symbol_type *)); + bfd_size_type amt; if (nlm_get_symbols (abfd) != NULL) - return (true); + return true; /* Read each raw NLM symbol, using the information to create a canonical bfd symbol table entry. @@ -1056,14 +1054,14 @@ nlm_slurp_symbol_table (abfd) + i_fxdhdrp->numberOfExternalReferences); if (totsymcount == 0) { - return (true); + return true; } - if (bfd_seek (abfd, i_fxdhdrp->publicsOffset, SEEK_SET) == -1) - return (false); + if (bfd_seek (abfd, i_fxdhdrp->publicsOffset, SEEK_SET) != 0) + return false; - sym = ((nlm_symbol_type *) - bfd_zalloc (abfd, totsymcount * sizeof (nlm_symbol_type))); + amt = totsymcount * sizeof (nlm_symbol_type); + sym = ((nlm_symbol_type *) bfd_zalloc (abfd, amt)); if (!sym) return false; nlm_set_symbols (abfd, sym); @@ -1076,20 +1074,21 @@ nlm_slurp_symbol_table (abfd) symcount = i_fxdhdrp->numberOfPublics; while (abfd->symcount < symcount) { - if (bfd_read ((PTR) & symlength, sizeof (symlength), 1, abfd) - != sizeof (symlength)) - return (false); + amt = sizeof (symlength); + if (bfd_bread ((PTR) &symlength, amt, abfd) != amt) + return false; + amt = symlength; sym->symbol.the_bfd = abfd; - sym->symbol.name = bfd_alloc (abfd, symlength + 1); + sym->symbol.name = bfd_alloc (abfd, amt + 1); if (!sym->symbol.name) return false; - if (bfd_read ((PTR) sym->symbol.name, symlength, 1, abfd) - != symlength) - return (false); + if (bfd_bread ((PTR) sym->symbol.name, amt, abfd) != amt) + return false; /* Cast away const. */ ((char *) (sym->symbol.name))[symlength] = '\0'; - if (bfd_read ((PTR) temp, sizeof (temp), 1, abfd) != sizeof (temp)) - return (false); + amt = sizeof (temp); + if (bfd_bread ((PTR) temp, amt, abfd) != amt) + return false; sym->symbol.flags = BSF_GLOBAL | BSF_EXPORT; sym->symbol.value = get_word (abfd, temp); if (set_public_section_func) @@ -1123,25 +1122,28 @@ nlm_slurp_symbol_table (abfd) if (i_fxdhdrp->numberOfDebugRecords > 0) { - if (bfd_seek (abfd, i_fxdhdrp->debugInfoOffset, SEEK_SET) == -1) - return (false); + if (bfd_seek (abfd, i_fxdhdrp->debugInfoOffset, SEEK_SET) != 0) + return false; symcount += i_fxdhdrp->numberOfDebugRecords; while (abfd->symcount < symcount) { - if ((bfd_read ((PTR) & symtype, sizeof (symtype), 1, abfd) - != sizeof (symtype)) - || bfd_read ((PTR) temp, sizeof (temp), 1, abfd) != sizeof (temp) - || (bfd_read ((PTR) & symlength, sizeof (symlength), 1, abfd) - != sizeof (symlength))) + amt = sizeof (symtype); + if (bfd_bread ((PTR) &symtype, amt, abfd) != amt) + return false; + amt = sizeof (temp); + if (bfd_bread ((PTR) temp, amt, abfd) != amt) + return false; + amt = sizeof (symlength); + if (bfd_bread ((PTR) &symlength, amt, abfd) != amt) return false; + amt = symlength; sym->symbol.the_bfd = abfd; - sym->symbol.name = bfd_alloc (abfd, symlength + 1); + sym->symbol.name = bfd_alloc (abfd, amt + 1); if (!sym->symbol.name) return false; - if (bfd_read ((PTR) sym->symbol.name, symlength, 1, abfd) - != symlength) - return (false); + if (bfd_bread ((PTR) sym->symbol.name, amt, abfd) != amt) + return false; /* Cast away const. */ ((char *) (sym->symbol.name))[symlength] = '\0'; sym->symbol.flags = BSF_LOCAL; @@ -1173,9 +1175,8 @@ nlm_slurp_symbol_table (abfd) read_import_func = nlm_read_import_func (abfd); if (read_import_func != NULL) { - if (bfd_seek (abfd, i_fxdhdrp->externalReferencesOffset, SEEK_SET) - == -1) - return (false); + if (bfd_seek (abfd, i_fxdhdrp->externalReferencesOffset, SEEK_SET) != 0) + return false; symcount += i_fxdhdrp->numberOfExternalReferences; while (abfd->symcount < symcount) @@ -1187,7 +1188,7 @@ nlm_slurp_symbol_table (abfd) } } - return (true); + return true; } /* Get the relocs for an NLM file. There are two types of relocs. @@ -1209,7 +1210,7 @@ nlm_slurp_reloc_fixups (abfd) { boolean (*read_func) PARAMS ((bfd *, nlm_symbol_type *, asection **, arelent *)); - bfd_size_type count; + bfd_size_type count, amt; arelent *rels; asection **secs; @@ -1224,8 +1225,10 @@ nlm_slurp_reloc_fixups (abfd) return false; count = nlm_fixed_header (abfd)->numberOfRelocationFixups; - rels = (arelent *) bfd_alloc (abfd, count * sizeof (arelent)); - secs = (asection **) bfd_alloc (abfd, count * sizeof (asection *)); + amt = count * sizeof (arelent); + rels = (arelent *) bfd_alloc (abfd, amt); + amt = count * sizeof (asection *); + secs = (asection **) bfd_alloc (abfd, amt); if ((rels == NULL || secs == NULL) && count != 0) return false; nlm_relocation_fixups (abfd) = rels; @@ -1609,8 +1612,8 @@ nlm_set_section_contents (abfd, section, } } - if (bfd_seek (abfd, (file_ptr) (section->filepos + offset), SEEK_SET) != 0 - || bfd_write (location, 1, count, abfd) != count) + if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0 + || bfd_bwrite (location, count, abfd) != count) return false; return true; @@ -1679,9 +1682,11 @@ nlm_write_object_contents (abfd) file_ptr last; boolean (*write_prefix_func) PARAMS ((bfd *)); unsigned char *fixed_header = NULL; + file_ptr pos; + bfd_size_type amt; fixed_header = ((unsigned char *) - bfd_malloc ((size_t) nlm_fixed_header_size (abfd))); + bfd_malloc (nlm_fixed_header_size (abfd))); if (fixed_header == NULL) goto error_return; @@ -1690,9 +1695,8 @@ nlm_write_object_contents (abfd) goto error_return; /* Write out the variable length headers. */ - if (bfd_seek (abfd, - nlm_optional_prefix_size (abfd) + nlm_fixed_header_size (abfd), - SEEK_SET) != 0) + pos = nlm_optional_prefix_size (abfd) + nlm_fixed_header_size (abfd); + if (bfd_seek (abfd, pos, SEEK_SET) != 0) goto error_return; if (nlm_swap_variable_header_out (abfd) == false || nlm_swap_auxiliary_headers_out (abfd) == false) @@ -1703,7 +1707,7 @@ nlm_write_object_contents (abfd) /* A weak check on whether the section file positions were reasonable. */ - if (bfd_tell (abfd) > nlm_fixed_header (abfd)->codeImageOffset) + if (bfd_tell (abfd) > (ufile_ptr) nlm_fixed_header (abfd)->codeImageOffset) { bfd_set_error (bfd_error_invalid_operation); goto error_return; @@ -1769,10 +1773,8 @@ nlm_write_object_contents (abfd) are output as a symbol name followed by all the relocs for that symbol, so we must first gather together all the relocs against external symbols and sort them. */ - external_relocs = - (struct reloc_and_sec *) bfd_alloc (abfd, - (external_reloc_count - * sizeof (struct reloc_and_sec))); + amt = external_reloc_count * sizeof (struct reloc_and_sec); + external_relocs = (struct reloc_and_sec *) bfd_alloc (abfd, amt); if (external_relocs == (struct reloc_and_sec *) NULL) goto error_return; i = 0; @@ -1906,13 +1908,14 @@ nlm_write_object_contents (abfd) else { len = strlen (sym->name); - if ((bfd_write (&len, sizeof (bfd_byte), 1, abfd) + if ((bfd_bwrite (&len, (bfd_size_type) sizeof (bfd_byte), abfd) != sizeof (bfd_byte)) - || bfd_write (sym->name, len, 1, abfd) != len) + || bfd_bwrite (sym->name, (bfd_size_type) len, abfd) != len) goto error_return; put_word (abfd, offset, temp); - if (bfd_write (temp, sizeof (temp), 1, abfd) != sizeof (temp)) + if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), abfd) + != sizeof (temp)) goto error_return; } } @@ -1971,18 +1974,19 @@ nlm_write_object_contents (abfd) type = 2; /* The type is 0 for data, 1 for code, 2 for absolute. */ - if (bfd_write (&type, sizeof (bfd_byte), 1, abfd) + if (bfd_bwrite (&type, (bfd_size_type) sizeof (bfd_byte), abfd) != sizeof (bfd_byte)) goto error_return; put_word (abfd, offset, temp); - if (bfd_write (temp, sizeof (temp), 1, abfd) != sizeof (temp)) + if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), abfd) + != sizeof (temp)) goto error_return; len = strlen (sym->name); - if ((bfd_write (&len, sizeof (bfd_byte), 1, abfd) + if ((bfd_bwrite (&len, (bfd_size_type) sizeof (bfd_byte), abfd) != sizeof (bfd_byte)) - || bfd_write (sym->name, len, 1, abfd) != len) + || bfd_bwrite (sym->name, (bfd_size_type) len, abfd) != len) goto error_return; } nlm_fixed_header (abfd)->numberOfDebugRecords = c; @@ -2026,7 +2030,7 @@ nlm_write_object_contents (abfd) nlm_fixed_header (abfd)->checkUnloadProcedureOffset -= nlm_get_text_low (abfd); - if (bfd_seek (abfd, 0, SEEK_SET) != 0) + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) goto error_return; write_prefix_func = nlm_write_prefix_func (abfd); @@ -2040,7 +2044,7 @@ nlm_write_object_contents (abfd) == nlm_optional_prefix_size (abfd)); nlm_swap_fixed_header_out (abfd, nlm_fixed_header (abfd), fixed_header); - if (bfd_write (fixed_header, nlm_fixed_header_size (abfd), 1, abfd) + if (bfd_bwrite (fixed_header, nlm_fixed_header_size (abfd), abfd) != nlm_fixed_header_size (abfd)) goto error_return; diff -uprN binutils-2.11.90.0.31/bfd/nlmswap.h binutils-2.11.92.0.5/bfd/nlmswap.h --- binutils-2.11.90.0.31/bfd/nlmswap.h Fri Mar 9 11:16:04 2001 +++ binutils-2.11.92.0.5/bfd/nlmswap.h Mon Oct 1 15:25:21 2001 @@ -1,5 +1,5 @@ /* NLM (NetWare Loadable Module) swapping routines for BFD. - Copyright 1993, 2000 Free Software Foundation, Inc. + Copyright 1993, 2000, 2001 Free Software Foundation, Inc. Written by Fred Fish @ Cygnus Support, using ELF support as the template. @@ -48,51 +48,51 @@ nlm_swap_fixed_header_in (abfd, realsrc, memcpy (dst->signature, src->signature, NLM_SIGNATURE_SIZE); memcpy (dst->moduleName, src->moduleName, NLM_MODULE_NAME_SIZE); dst->version = - bfd_h_get_32 (abfd, (bfd_byte *) src->version); + H_GET_32 (abfd, src->version); dst->codeImageOffset = - bfd_h_get_32 (abfd, (bfd_byte *) src->codeImageOffset); + H_GET_32 (abfd, src->codeImageOffset); dst->codeImageSize = - bfd_h_get_32 (abfd, (bfd_byte *) src->codeImageSize); + H_GET_32 (abfd, src->codeImageSize); dst->dataImageOffset = - bfd_h_get_32 (abfd, (bfd_byte *) src->dataImageOffset); + H_GET_32 (abfd, src->dataImageOffset); dst->dataImageSize = - bfd_h_get_32 (abfd, (bfd_byte *) src->dataImageSize); + H_GET_32 (abfd, src->dataImageSize); dst->uninitializedDataSize = - bfd_h_get_32 (abfd, (bfd_byte *) src->uninitializedDataSize); + H_GET_32 (abfd, src->uninitializedDataSize); dst->customDataOffset = - bfd_h_get_32 (abfd, (bfd_byte *) src->customDataOffset); + H_GET_32 (abfd, src->customDataOffset); dst->customDataSize = - bfd_h_get_32 (abfd, (bfd_byte *) src->customDataSize); + H_GET_32 (abfd, src->customDataSize); dst->moduleDependencyOffset = - bfd_h_get_32 (abfd, (bfd_byte *) src->moduleDependencyOffset); + H_GET_32 (abfd, src->moduleDependencyOffset); dst->numberOfModuleDependencies = - bfd_h_get_32 (abfd, (bfd_byte *) src->numberOfModuleDependencies); + H_GET_32 (abfd, src->numberOfModuleDependencies); dst->relocationFixupOffset = - bfd_h_get_32 (abfd, (bfd_byte *) src->relocationFixupOffset); + H_GET_32 (abfd, src->relocationFixupOffset); dst->numberOfRelocationFixups = - bfd_h_get_32 (abfd, (bfd_byte *) src->numberOfRelocationFixups); + H_GET_32 (abfd, src->numberOfRelocationFixups); dst->externalReferencesOffset = - bfd_h_get_32 (abfd, (bfd_byte *) src->externalReferencesOffset); + H_GET_32 (abfd, src->externalReferencesOffset); dst->numberOfExternalReferences = - bfd_h_get_32 (abfd, (bfd_byte *) src->numberOfExternalReferences); + H_GET_32 (abfd, src->numberOfExternalReferences); dst->publicsOffset = - bfd_h_get_32 (abfd, (bfd_byte *) src->publicsOffset); + H_GET_32 (abfd, src->publicsOffset); dst->numberOfPublics = - bfd_h_get_32 (abfd, (bfd_byte *) src->numberOfPublics); + H_GET_32 (abfd, src->numberOfPublics); dst->debugInfoOffset = - bfd_h_get_32 (abfd, (bfd_byte *) src->debugInfoOffset); + H_GET_32 (abfd, src->debugInfoOffset); dst->numberOfDebugRecords = - bfd_h_get_32 (abfd, (bfd_byte *) src->numberOfDebugRecords); + H_GET_32 (abfd, src->numberOfDebugRecords); dst->codeStartOffset = - bfd_h_get_32 (abfd, (bfd_byte *) src->codeStartOffset); + H_GET_32 (abfd, src->codeStartOffset); dst->exitProcedureOffset = - bfd_h_get_32 (abfd, (bfd_byte *) src->exitProcedureOffset); + H_GET_32 (abfd, src->exitProcedureOffset); dst->checkUnloadProcedureOffset = - bfd_h_get_32 (abfd, (bfd_byte *) src->checkUnloadProcedureOffset); + H_GET_32 (abfd, src->checkUnloadProcedureOffset); dst->moduleType = - bfd_h_get_32 (abfd, (bfd_byte *) src->moduleType); + H_GET_32 (abfd, src->moduleType); dst->flags = - bfd_h_get_32 (abfd, (bfd_byte *) src->flags); + H_GET_32 (abfd, src->flags); } /* Translate an NLM fixed length file header in internal format into @@ -108,50 +108,50 @@ nlm_swap_fixed_header_out (abfd, src, re memset (dst, 0, sizeof *dst); memcpy (dst->signature, src->signature, NLM_SIGNATURE_SIZE); memcpy (dst->moduleName, src->moduleName, NLM_MODULE_NAME_SIZE); - bfd_h_put_32 (abfd, (bfd_vma) src->version, - (bfd_byte *) dst->version); - bfd_h_put_32 (abfd, (bfd_vma) src->codeImageOffset, - (bfd_byte *) dst->codeImageOffset); - bfd_h_put_32 (abfd, (bfd_vma) src->codeImageSize, - (bfd_byte *) dst->codeImageSize); - bfd_h_put_32 (abfd, (bfd_vma) src->dataImageOffset, - (bfd_byte *) dst->dataImageOffset); - bfd_h_put_32 (abfd, (bfd_vma) src->dataImageSize, - (bfd_byte *) dst->dataImageSize); - bfd_h_put_32 (abfd, (bfd_vma) src->uninitializedDataSize, - (bfd_byte *) dst->uninitializedDataSize); - bfd_h_put_32 (abfd, (bfd_vma) src->customDataOffset, - (bfd_byte *) dst->customDataOffset); - bfd_h_put_32 (abfd, (bfd_vma) src->customDataSize, - (bfd_byte *) dst->customDataSize); - bfd_h_put_32 (abfd, (bfd_vma) src->moduleDependencyOffset, - (bfd_byte *) dst->moduleDependencyOffset); - bfd_h_put_32 (abfd, (bfd_vma) src->numberOfModuleDependencies, - (bfd_byte *) dst->numberOfModuleDependencies); - bfd_h_put_32 (abfd, (bfd_vma) src->relocationFixupOffset, - (bfd_byte *) dst->relocationFixupOffset); - bfd_h_put_32 (abfd, (bfd_vma) src->numberOfRelocationFixups, - (bfd_byte *) dst->numberOfRelocationFixups); - bfd_h_put_32 (abfd, (bfd_vma) src->externalReferencesOffset, - (bfd_byte *) dst->externalReferencesOffset); - bfd_h_put_32 (abfd, (bfd_vma) src->numberOfExternalReferences, - (bfd_byte *) dst->numberOfExternalReferences); - bfd_h_put_32 (abfd, (bfd_vma) src->publicsOffset, - (bfd_byte *) dst->publicsOffset); - bfd_h_put_32 (abfd, (bfd_vma) src->numberOfPublics, - (bfd_byte *) dst->numberOfPublics); - bfd_h_put_32 (abfd, (bfd_vma) src->debugInfoOffset, - (bfd_byte *) dst->debugInfoOffset); - bfd_h_put_32 (abfd, (bfd_vma) src->numberOfDebugRecords, - (bfd_byte *) dst->numberOfDebugRecords); - bfd_h_put_32 (abfd, (bfd_vma) src->codeStartOffset, - (bfd_byte *) dst->codeStartOffset); - bfd_h_put_32 (abfd, (bfd_vma) src->exitProcedureOffset, - (bfd_byte *) dst->exitProcedureOffset); - bfd_h_put_32 (abfd, (bfd_vma) src->checkUnloadProcedureOffset, - (bfd_byte *) dst->checkUnloadProcedureOffset); - bfd_h_put_32 (abfd, (bfd_vma) src->moduleType, - (bfd_byte *) dst->moduleType); - bfd_h_put_32 (abfd, (bfd_vma) src->flags, - (bfd_byte *) dst->flags); + H_PUT_32 (abfd, src->version, + dst->version); + H_PUT_32 (abfd, src->codeImageOffset, + dst->codeImageOffset); + H_PUT_32 (abfd, src->codeImageSize, + dst->codeImageSize); + H_PUT_32 (abfd, src->dataImageOffset, + dst->dataImageOffset); + H_PUT_32 (abfd, src->dataImageSize, + dst->dataImageSize); + H_PUT_32 (abfd, src->uninitializedDataSize, + dst->uninitializedDataSize); + H_PUT_32 (abfd, src->customDataOffset, + dst->customDataOffset); + H_PUT_32 (abfd, src->customDataSize, + dst->customDataSize); + H_PUT_32 (abfd, src->moduleDependencyOffset, + dst->moduleDependencyOffset); + H_PUT_32 (abfd, src->numberOfModuleDependencies, + dst->numberOfModuleDependencies); + H_PUT_32 (abfd, src->relocationFixupOffset, + dst->relocationFixupOffset); + H_PUT_32 (abfd, src->numberOfRelocationFixups, + dst->numberOfRelocationFixups); + H_PUT_32 (abfd, src->externalReferencesOffset, + dst->externalReferencesOffset); + H_PUT_32 (abfd, src->numberOfExternalReferences, + dst->numberOfExternalReferences); + H_PUT_32 (abfd, src->publicsOffset, + dst->publicsOffset); + H_PUT_32 (abfd, src->numberOfPublics, + dst->numberOfPublics); + H_PUT_32 (abfd, src->debugInfoOffset, + dst->debugInfoOffset); + H_PUT_32 (abfd, src->numberOfDebugRecords, + dst->numberOfDebugRecords); + H_PUT_32 (abfd, src->codeStartOffset, + dst->codeStartOffset); + H_PUT_32 (abfd, src->exitProcedureOffset, + dst->exitProcedureOffset); + H_PUT_32 (abfd, src->checkUnloadProcedureOffset, + dst->checkUnloadProcedureOffset); + H_PUT_32 (abfd, src->moduleType, + dst->moduleType); + H_PUT_32 (abfd, src->flags, + dst->flags); } diff -uprN binutils-2.11.90.0.31/bfd/ns32k.h binutils-2.11.92.0.5/bfd/ns32k.h --- binutils-2.11.90.0.31/bfd/ns32k.h Thu Jun 3 11:01:54 1999 +++ binutils-2.11.92.0.5/bfd/ns32k.h Mon Oct 1 15:25:21 2001 @@ -1,5 +1,5 @@ /* Header file for ns32k routines. - Copyright 1996 Free Software Foundation, Inc. + Copyright 1996, 2001 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -23,17 +23,17 @@ extern bfd_reloc_status_type _bfd_ns32k_ extern bfd_reloc_status_type _bfd_do_ns32k_reloc_contents PARAMS ((reloc_howto_type *, bfd *, bfd_vma, bfd_byte *, - long (*) PARAMS ((bfd_byte *, long, long)), - int (*) PARAMS ((long, bfd_byte *, long, long)))); + bfd_vma (*) (bfd_byte *, int), + int (*) (bfd_vma, bfd_byte *, int))); extern bfd_reloc_status_type _bfd_ns32k_final_link_relocate PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *, bfd_vma, bfd_vma, bfd_vma)); -extern long _bfd_ns32k_get_displacement PARAMS ((bfd_byte *, long, long)); -extern long _bfd_ns32k_get_immediate PARAMS ((bfd_byte *, long, long)); -extern int _bfd_ns32k_put_displacement PARAMS ((long, bfd_byte *, long, long)); -extern int _bfd_ns32k_put_immediate PARAMS ((long, bfd_byte *, long, long)); +extern bfd_vma _bfd_ns32k_get_displacement PARAMS ((bfd_byte *, int)); +extern bfd_vma _bfd_ns32k_get_immediate PARAMS ((bfd_byte *, int)); +extern int _bfd_ns32k_put_displacement PARAMS ((bfd_vma, bfd_byte *, int)); +extern int _bfd_ns32k_put_immediate PARAMS ((bfd_vma, bfd_byte *, int)); extern bfd_reloc_status_type _bfd_ns32k_reloc_disp PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); diff -uprN binutils-2.11.90.0.31/bfd/ns32knetbsd.c binutils-2.11.92.0.5/bfd/ns32knetbsd.c --- binutils-2.11.90.0.31/bfd/ns32knetbsd.c Fri Mar 9 11:16:04 2001 +++ binutils-2.11.92.0.5/bfd/ns32knetbsd.c Thu Oct 4 14:35:43 2001 @@ -1,5 +1,5 @@ /* BFD back-end for NetBSD/ns32k a.out-ish binaries. - Copyright 1990, 1991, 1992, 1994, 1995, 1998, 2000 + Copyright 1990, 1991, 1992, 1994, 1995, 1998, 2000, 2001 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -27,9 +27,12 @@ Foundation, Inc., 59 Temple Place - Suit #define DEFAULT_ARCH bfd_arch_ns32k #define DEFAULT_MID M_532_NETBSD -#define MY(OP) CAT(pc532netbsd_,OP) +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (pc532netbsd_,OP) -#define NAME(x,y) CAT3(ns32kaout,_32_,y) +#define NAME(x,y) CONCAT3 (ns32kaout,_32_,y) /* This needs to start with a.out so GDB knows it is an a.out variant. */ #define TARGETNAME "a.out-ns32k-netbsd" diff -uprN binutils-2.11.90.0.31/bfd/oasys.c binutils-2.11.92.0.5/bfd/oasys.c --- binutils-2.11.90.0.31/bfd/oasys.c Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/bfd/oasys.c Mon Oct 1 15:25:21 2001 @@ -22,18 +22,16 @@ #define UNDERSCORE_HACK 1 #include "bfd.h" #include "sysdep.h" -#include +#include "safe-ctype.h" #include "libbfd.h" #include "oasys.h" #include "liboasys.h" -static boolean oasys_read_record PARAMS ((bfd *, - oasys_record_union_type *)); +static boolean oasys_slurp_section_data PARAMS ((bfd * const)); +static boolean oasys_read_record PARAMS ((bfd *, oasys_record_union_type *)); static boolean oasys_write_sections PARAMS ((bfd *)); -static boolean oasys_write_record PARAMS ((bfd *, - oasys_record_enum_type, - oasys_record_union_type *, - size_t)); +static boolean oasys_write_record + PARAMS ((bfd *, oasys_record_enum_type, oasys_record_union_type *, size_t)); static boolean oasys_write_syms PARAMS ((bfd *)); static boolean oasys_write_header PARAMS ((bfd *)); static boolean oasys_write_end PARAMS ((bfd *)); @@ -45,7 +43,8 @@ static const bfd_target *oasys_archive_p static boolean oasys_mkobject PARAMS ((bfd *)); static const bfd_target *oasys_object_p PARAMS ((bfd *)); static void oasys_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *)); -static void oasys_print_symbol PARAMS ((bfd *, void *, asymbol *, bfd_print_symbol_type)); +static void oasys_print_symbol + PARAMS ((bfd *, void *, asymbol *, bfd_print_symbol_type)); static boolean oasys_new_section_hook PARAMS ((bfd *, asection *)); static long int oasys_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr)); static boolean oasys_get_section_contents @@ -57,34 +56,35 @@ static boolean oasys_set_section_content static asymbol *oasys_make_empty_symbol PARAMS ((bfd *)); static bfd *oasys_openr_next_archived_file PARAMS ((bfd *, bfd *)); static boolean oasys_find_nearest_line - PARAMS ((bfd *, asection *, asymbol **, bfd_vma, char **, char **, unsigned int *)); + PARAMS ((bfd *, asection *, asymbol **, bfd_vma, + const char **, const char **, unsigned int *)); static int oasys_generic_stat_arch_elt PARAMS ((bfd *, struct stat *)); static int oasys_sizeof_headers PARAMS ((bfd *, boolean)); long oasys_get_symtab PARAMS ((bfd *, asymbol **)); -long oasys_canonicalize_reloc PARAMS ((bfd *, sec_ptr, arelent **, asymbol **)); +long oasys_canonicalize_reloc + PARAMS ((bfd *, sec_ptr, arelent **, asymbol **)); /* Read in all the section data and relocation stuff too. */ -PROTO (static boolean, oasys_slurp_section_data, (bfd * CONST abfd)); static boolean oasys_read_record (abfd, record) bfd *abfd; oasys_record_union_type *record; { - if (bfd_read ((PTR) record, 1, sizeof (record->header), abfd) - != sizeof (record->header)) + bfd_size_type amt = sizeof (record->header); + if (bfd_bread ((PTR) record, amt, abfd) != amt) return false; - if ((size_t) record->header.length <= (size_t) sizeof (record->header)) + amt = record->header.length - sizeof (record->header); + if ((long) amt <= 0) return true; - if (bfd_read ((PTR) (((char *) record) + sizeof (record->header)), - 1, record->header.length - sizeof (record->header), - abfd) - != record->header.length - sizeof (record->header)) + if (bfd_bread ((PTR) ((char *) record + sizeof (record->header)), amt, abfd) + != amt) return false; return true; } + static size_t oasys_string_length (record) oasys_record_union_type *record; @@ -111,7 +111,7 @@ moving in, and the defined symbols at th static boolean oasys_slurp_symbol_table (abfd) - bfd *CONST abfd; + bfd *const abfd; { oasys_record_union_type record; oasys_data_type *data = OASYS_DATA (abfd); @@ -119,22 +119,24 @@ oasys_slurp_symbol_table (abfd) asymbol *dest_defined; asymbol *dest; char *string_ptr; - + bfd_size_type amt; if (data->symbols != (asymbol *) NULL) { return true; } /* Buy enough memory for all the symbols and all the names */ - data->symbols = - (asymbol *) bfd_alloc (abfd, sizeof (asymbol) * abfd->symcount); + amt = abfd->symcount; + amt *= sizeof (asymbol); + data->symbols = (asymbol *) bfd_alloc (abfd, amt); + + amt = data->symbol_string_length; #ifdef UNDERSCORE_HACK /* buy 1 more char for each symbol to keep the underscore in*/ - data->strings = bfd_alloc (abfd, data->symbol_string_length + - abfd->symcount); -#else - data->strings = bfd_alloc (abfd, data->symbol_string_length); + amt += abfd->symcount; #endif + data->strings = bfd_alloc (abfd, amt); + if (!data->symbols || !data->strings) return false; @@ -191,7 +193,7 @@ oasys_slurp_symbol_table (abfd) } break; case RELOCATION_TYPE_UND: - dest = data->symbols + bfd_h_get_16 (abfd, record.symbol.refno); + dest = data->symbols + H_GET_16 (abfd, record.symbol.refno); dest->section = bfd_und_section_ptr; break; case RELOCATION_TYPE_COM: @@ -210,7 +212,7 @@ oasys_slurp_symbol_table (abfd) dest->name = string_ptr; dest->the_bfd = abfd; dest->udata.p = (PTR) NULL; - dest->value = bfd_h_get_32 (abfd, record.symbol.value); + dest->value = H_GET_32 (abfd, record.symbol.value); #ifdef UNDERSCORE_HACK if (record.symbol.name[0] != '_') @@ -235,7 +237,7 @@ oasys_slurp_symbol_table (abfd) static long oasys_get_symtab_upper_bound (abfd) - bfd *CONST abfd; + bfd *const abfd; { if (! oasys_slurp_symbol_table (abfd)) return -1; @@ -277,24 +279,25 @@ oasys_archive_p (abfd) oasys_extarchive_header_type header_ext; unsigned int i; file_ptr filepos; + bfd_size_type amt; - if (bfd_seek (abfd, (file_ptr) 0, false) != 0 - || (bfd_read ((PTR) & header_ext, 1, sizeof (header_ext), abfd) - != sizeof (header_ext))) + amt = sizeof (header_ext); + if (bfd_seek (abfd, (file_ptr) 0, 0) != 0 + || bfd_bread ((PTR) &header_ext, amt, abfd) != amt) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); return NULL; } - header.version = bfd_h_get_32 (abfd, header_ext.version); - header.mod_count = bfd_h_get_32 (abfd, header_ext.mod_count); - header.mod_tbl_offset = bfd_h_get_32 (abfd, header_ext.mod_tbl_offset); - header.sym_tbl_size = bfd_h_get_32 (abfd, header_ext.sym_tbl_size); - header.sym_count = bfd_h_get_32 (abfd, header_ext.sym_count); - header.sym_tbl_offset = bfd_h_get_32 (abfd, header_ext.sym_tbl_offset); - header.xref_count = bfd_h_get_32 (abfd, header_ext.xref_count); - header.xref_lst_offset = bfd_h_get_32 (abfd, header_ext.xref_lst_offset); + header.version = H_GET_32 (abfd, header_ext.version); + header.mod_count = H_GET_32 (abfd, header_ext.mod_count); + header.mod_tbl_offset = H_GET_32 (abfd, header_ext.mod_tbl_offset); + header.sym_tbl_size = H_GET_32 (abfd, header_ext.sym_tbl_size); + header.sym_count = H_GET_32 (abfd, header_ext.sym_count); + header.sym_tbl_offset = H_GET_32 (abfd, header_ext.sym_tbl_offset); + header.xref_count = H_GET_32 (abfd, header_ext.xref_count); + header.xref_lst_offset = H_GET_32 (abfd, header_ext.xref_lst_offset); /* There isn't a magic number in an Oasys archive, so the best we @@ -313,14 +316,17 @@ oasys_archive_p (abfd) the headers. */ { - oasys_ar_data_type *ar = - (oasys_ar_data_type *) bfd_alloc (abfd, sizeof (oasys_ar_data_type)); - - oasys_module_info_type *module = - (oasys_module_info_type *) - bfd_alloc (abfd, sizeof (oasys_module_info_type) * header.mod_count); + oasys_ar_data_type *ar; + oasys_module_info_type *module; oasys_module_table_type record; + amt = sizeof (oasys_ar_data_type); + ar = (oasys_ar_data_type *) bfd_alloc (abfd, amt); + + amt = header.mod_count; + amt *= sizeof (oasys_module_info_type); + module = (oasys_module_info_type *) bfd_alloc (abfd, amt); + if (!ar || !module) return NULL; @@ -339,18 +345,19 @@ oasys_archive_p (abfd) if (0) { oasys_extmodule_table_type_a_type record_ext; - if (bfd_read ((PTR) & record_ext, 1, sizeof (record_ext), abfd) - != sizeof (record_ext)) + + amt = sizeof (record_ext); + if (bfd_bread ((PTR) &record_ext, amt, abfd) != amt) return NULL; - record.mod_size = bfd_h_get_32 (abfd, record_ext.mod_size); - record.file_offset = bfd_h_get_32 (abfd, record_ext.file_offset); + record.mod_size = H_GET_32 (abfd, record_ext.mod_size); + record.file_offset = H_GET_32 (abfd, record_ext.file_offset); - record.dep_count = bfd_h_get_32 (abfd, record_ext.dep_count); - record.depee_count = bfd_h_get_32 (abfd, record_ext.depee_count); - record.sect_count = bfd_h_get_32 (abfd, record_ext.sect_count); + record.dep_count = H_GET_32 (abfd, record_ext.dep_count); + record.depee_count = H_GET_32 (abfd, record_ext.depee_count); + record.sect_count = H_GET_32 (abfd, record_ext.sect_count); - module[i].name = bfd_alloc (abfd, 33); + module[i].name = bfd_alloc (abfd, (bfd_size_type) 33); if (!module[i].name) return NULL; @@ -364,39 +371,36 @@ oasys_archive_p (abfd) else { oasys_extmodule_table_type_b_type record_ext; - if (bfd_read ((PTR) & record_ext, 1, sizeof (record_ext), abfd) - != sizeof (record_ext)) + + amt = sizeof (record_ext); + if (bfd_bread ((PTR) &record_ext, amt, abfd) != amt) return NULL; - record.mod_size = bfd_h_get_32 (abfd, record_ext.mod_size); - record.file_offset = bfd_h_get_32 (abfd, record_ext.file_offset); + record.mod_size = H_GET_32 (abfd, record_ext.mod_size); + record.file_offset = H_GET_32 (abfd, record_ext.file_offset); - record.dep_count = bfd_h_get_32 (abfd, record_ext.dep_count); - record.depee_count = bfd_h_get_32 (abfd, record_ext.depee_count); - record.sect_count = bfd_h_get_32 (abfd, record_ext.sect_count); - record.module_name_size = bfd_h_get_32 (abfd, record_ext.mod_name_length); + record.dep_count = H_GET_32 (abfd, record_ext.dep_count); + record.depee_count = H_GET_32 (abfd, record_ext.depee_count); + record.sect_count = H_GET_32 (abfd, record_ext.sect_count); + record.module_name_size = H_GET_32 (abfd, + record_ext.mod_name_length); - module[i].name = bfd_alloc (abfd, record.module_name_size + 1); + amt = record.module_name_size; + module[i].name = bfd_alloc (abfd, amt + 1); if (!module[i].name) return NULL; - if (bfd_read ((PTR) module[i].name, 1, record.module_name_size, - abfd) - != record.module_name_size) + if (bfd_bread ((PTR) module[i].name, amt, abfd) != amt) return NULL; module[i].name[record.module_name_size] = 0; - filepos += - sizeof (record_ext) + - record.dep_count * 4 + - record.module_name_size + 1; - + filepos += (sizeof (record_ext) + + record.dep_count * 4 + + record.module_name_size + 1); } - module[i].size = record.mod_size; module[i].pos = record.file_offset; module[i].abfd = 0; } - } return abfd->xvec; } @@ -405,8 +409,8 @@ static boolean oasys_mkobject (abfd) bfd *abfd; { - - abfd->tdata.oasys_obj_data = (oasys_data_type *) bfd_alloc (abfd, sizeof (oasys_data_type)); + bfd_size_type amt = sizeof (oasys_data_type); + abfd->tdata.oasys_obj_data = (oasys_data_type *) bfd_alloc (abfd, amt); return abfd->tdata.oasys_obj_data ? true : false; } @@ -463,7 +467,7 @@ oasys_object_p (abfd) { goto fail; } - buffer = bfd_alloc (abfd, 3); + buffer = bfd_alloc (abfd, (bfd_size_type) 3); if (!buffer) goto fail; section_number = record.section.relb & RELOCATION_SECT_BITS; @@ -480,8 +484,8 @@ oasys_object_p (abfd) BFD_FAIL (); } - s->_raw_size = bfd_h_get_32 (abfd, record.section.value); - s->vma = bfd_h_get_32 (abfd, record.section.vma); + s->_raw_size = H_GET_32 (abfd, record.section.value); + s->vma = H_GET_32 (abfd, record.section.vma); s->flags = 0; had_usefull = true; } @@ -555,8 +559,8 @@ oasys_print_symbol (abfd, afile, symbol, break; case bfd_print_symbol_all: { - CONST char *section_name = symbol->section == (asection *) NULL ? - (CONST char *) "*abs" : symbol->section->name; + const char *section_name = symbol->section == (asection *) NULL ? + (const char *) "*abs" : symbol->section->name; bfd_print_symbol_vandf (abfd, (PTR) file, symbol); @@ -583,15 +587,14 @@ static reloc_howto_type howto_table[] = /* Read in all the section data and relocation stuff too */ static boolean oasys_slurp_section_data (abfd) - bfd *CONST abfd; + bfd *const abfd; { oasys_record_union_type record; oasys_data_type *data = OASYS_DATA (abfd); boolean loop = true; - oasys_per_section_type *per; - asection *s; + bfd_size_type amt; /* See if the data has been slurped already .. */ for (s = abfd->sections; s != (asection *) NULL; s = s->next) @@ -634,14 +637,15 @@ oasys_slurp_section_data (abfd) per->data = (bfd_byte *) bfd_zalloc (abfd, section->_raw_size); if (!per->data) return false; - per->reloc_tail_ptr = (oasys_reloc_type **) & (section->relocation); + per->reloc_tail_ptr + = (oasys_reloc_type **) §ion->relocation; per->had_vma = false; per->initialized = true; section->reloc_count = 0; section->flags = SEC_ALLOC; } - dst_offset = bfd_h_get_32 (abfd, record.data.addr); + dst_offset = H_GET_32 (abfd, record.data.addr); if (per->had_vma == false) { /* Take the first vma we see as the base */ @@ -695,10 +699,11 @@ oasys_slurp_section_data (abfd) case RELOCATION_TYPE_REL: { /* Relocate the item relative to the section */ - oasys_reloc_type *r = - (oasys_reloc_type *) - bfd_alloc (abfd, - sizeof (oasys_reloc_type)); + oasys_reloc_type *r; + + amt = sizeof (oasys_reloc_type); + r = (oasys_reloc_type *) bfd_alloc (abfd, + amt); if (!r) return false; *(per->reloc_tail_ptr) = r; @@ -739,10 +744,11 @@ oasys_slurp_section_data (abfd) case RELOCATION_TYPE_UND: { - oasys_reloc_type *r = - (oasys_reloc_type *) - bfd_alloc (abfd, - sizeof (oasys_reloc_type)); + oasys_reloc_type *r; + + amt = sizeof (oasys_reloc_type); + r = (oasys_reloc_type *) bfd_alloc (abfd, + amt); if (!r) return false; *(per->reloc_tail_ptr) = r; @@ -808,7 +814,7 @@ oasys_new_section_hook (abfd, newsect) asection *newsect; { newsect->used_by_bfd = (PTR) - bfd_alloc (abfd, sizeof (oasys_per_section_type)); + bfd_alloc (abfd, (bfd_size_type) sizeof (oasys_per_section_type)); if (!newsect->used_by_bfd) return false; oasys_per_section (newsect)->data = (bfd_byte *) NULL; @@ -846,11 +852,11 @@ oasys_get_section_contents (abfd, sectio oasys_slurp_section_data (abfd); if (p->initialized == false) { - (void) memset (location, 0, (int) count); + (void) memset (location, 0, (size_t) count); } else { - (void) memcpy (location, (PTR) (p->data + offset), (int) count); + (void) memcpy (location, (PTR) (p->data + offset), (size_t) count); } return true; } @@ -913,7 +919,7 @@ oasys_write_record (abfd, type, record, checksum += *ptr++; } record->header.check_sum = 0xff & (-checksum); - if (bfd_write ((PTR) record, 1, size, abfd) != size) + if (bfd_bwrite ((PTR) record, (bfd_size_type) size, abfd) != size) return false; return true; } @@ -931,28 +937,28 @@ oasys_write_syms (abfd) { oasys_symbol_record_type symbol; - asymbol *CONST g = generic[count]; + asymbol *const g = generic[count]; - CONST char *src = g->name; + const char *src = g->name; char *dst = symbol.name; unsigned int l = 0; if (bfd_is_com_section (g->section)) { symbol.relb = RELOCATION_TYPE_COM; - bfd_h_put_16 (abfd, index, symbol.refno); + H_PUT_16 (abfd, index, symbol.refno); index++; } else if (bfd_is_abs_section (g->section)) { symbol.relb = RELOCATION_TYPE_ABS; - bfd_h_put_16 (abfd, 0, symbol.refno); + H_PUT_16 (abfd, 0, symbol.refno); } else if (bfd_is_und_section (g->section)) { symbol.relb = RELOCATION_TYPE_UND; - bfd_h_put_16 (abfd, index, symbol.refno); + H_PUT_16 (abfd, index, symbol.refno); /* Overload the value field with the output index number */ index++; } @@ -974,7 +980,7 @@ oasys_write_syms (abfd) { symbol.relb = RELOCATION_TYPE_REL | g->section->output_section->target_index; } - bfd_h_put_16 (abfd, 0, symbol.refno); + H_PUT_16 (abfd, 0, symbol.refno); } #ifdef UNDERSCORE_HACK if (src[l] == '_') @@ -986,7 +992,7 @@ oasys_write_syms (abfd) l++; } - bfd_h_put_32 (abfd, g->value, symbol.value); + H_PUT_32 (abfd, g->value, symbol.value); if (g->flags & BSF_LOCAL) @@ -1024,7 +1030,7 @@ oasys_write_sections (abfd) for (s = abfd->sections; s != (asection *) NULL; s = s->next) { - if (!isdigit ((unsigned char) s->name[0])) + if (!ISDIGIT (s->name[0])) { (*_bfd_error_handler) (_("%s: can not represent section `%s' in oasys"), @@ -1033,8 +1039,8 @@ oasys_write_sections (abfd) return false; } out.relb = RELOCATION_TYPE_REL | s->target_index; - bfd_h_put_32 (abfd, s->_cooked_size, out.value); - bfd_h_put_32 (abfd, s->vma, out.vma); + H_PUT_32 (abfd, s->_cooked_size, out.value); + H_PUT_32 (abfd, s->vma, out.vma); if (! oasys_write_record (abfd, oasys_record_is_section_enum, @@ -1083,23 +1089,23 @@ oasys_write_end (abfd) oasys_end_record_type end; unsigned char null = 0; end.relb = RELOCATION_TYPE_ABS; - bfd_h_put_32 (abfd, abfd->start_address, end.entry); - bfd_h_put_16 (abfd, 0, end.fill); + H_PUT_32 (abfd, abfd->start_address, end.entry); + H_PUT_16 (abfd, 0, end.fill); end.zero = 0; if (! oasys_write_record (abfd, oasys_record_is_end_enum, (oasys_record_union_type *) & end, sizeof (end))) return false; - if (bfd_write ((PTR) & null, 1, 1, abfd) != 1) + if (bfd_bwrite ((PTR) &null, (bfd_size_type) 1, abfd) != 1) return false; return true; } static int comp (ap, bp) - CONST PTR ap; - CONST PTR bp; + const PTR ap; + const PTR bp; { arelent *a = *((arelent **) ap); arelent *b = *((arelent **) bp); @@ -1148,8 +1154,8 @@ oasys_write_data (abfd) *mod = 0; - bfd_h_put_32 (abfd, s->vma + current_byte_index, - processed_data.addr); + H_PUT_32 (abfd, s->vma + current_byte_index, + processed_data.addr); /* Don't start a relocation unless you're sure you can finish it within the same data record. The worst case relocation is a @@ -1221,16 +1227,16 @@ oasys_write_data (abfd) else #endif { - asymbol *p = *(r->sym_ptr_ptr); + asymbol *sym = *(r->sym_ptr_ptr); /* If this symbol has a section attached, then it has already been resolved. Change from a symbol ref to a section ref */ - if (p->section != (asection *) NULL) + if (sym->section != (asection *) NULL) { rel_byte |= RELOCATION_TYPE_REL; rel_byte |= - p->section->output_section->target_index; + sym->section->output_section->target_index; *dst++ = rel_byte; } else @@ -1242,8 +1248,8 @@ oasys_write_data (abfd) into the symbol index in the table when the symbol table was written */ - *dst++ = p->value >> 8; - *dst++ = p->value; + *dst++ = sym->value >> 8; + *dst++ = sym->value; } } #define ADVANCE { if (++i >= 8) { i = 0; mod = dst++; *mod = 0; } current_byte_index++; } @@ -1283,11 +1289,10 @@ oasys_write_data (abfd) --dst; } - if (! oasys_write_record (abfd, - oasys_record_is_data_enum, - ((oasys_record_union_type *) - & processed_data), - dst - (bfd_byte *) & processed_data)) + if (! (oasys_write_record + (abfd, oasys_record_is_data_enum, + ((oasys_record_union_type *) &processed_data), + (size_t) (dst - (bfd_byte *) &processed_data)))) return false; } } @@ -1357,9 +1362,8 @@ static asymbol * oasys_make_empty_symbol (abfd) bfd *abfd; { - - oasys_symbol_type *new = - (oasys_symbol_type *) bfd_zalloc (abfd, sizeof (oasys_symbol_type)); + bfd_size_type amt = sizeof (oasys_symbol_type); + oasys_symbol_type *new = (oasys_symbol_type *) bfd_zalloc (abfd, amt); if (!new) return NULL; new->symbol.the_bfd = abfd; @@ -1410,19 +1414,14 @@ oasys_openr_next_archived_file (arch, pr } static boolean -oasys_find_nearest_line (abfd, - section, - symbols, - offset, - filename_ptr, - functionname_ptr, - line_ptr) +oasys_find_nearest_line (abfd, section, symbols, offset, + filename_ptr, functionname_ptr, line_ptr) bfd *abfd ATTRIBUTE_UNUSED; asection *section ATTRIBUTE_UNUSED; asymbol **symbols ATTRIBUTE_UNUSED; bfd_vma offset ATTRIBUTE_UNUSED; - char **filename_ptr ATTRIBUTE_UNUSED; - char **functionname_ptr ATTRIBUTE_UNUSED; + const char **filename_ptr ATTRIBUTE_UNUSED; + const char **functionname_ptr ATTRIBUTE_UNUSED; unsigned int *line_ptr ATTRIBUTE_UNUSED; { return false; @@ -1547,6 +1546,6 @@ const bfd_target oasys_vec = BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), NULL, - + (PTR) 0 }; diff -uprN binutils-2.11.90.0.31/bfd/opncls.c binutils-2.11.92.0.5/bfd/opncls.c --- binutils-2.11.90.0.31/bfd/opncls.c Fri Mar 9 11:16:04 2001 +++ binutils-2.11.92.0.5/bfd/opncls.c Mon Oct 1 15:25:21 2001 @@ -49,7 +49,7 @@ _bfd_new_bfd () { bfd *nbfd; - nbfd = (bfd *) bfd_zmalloc (sizeof (bfd)); + nbfd = (bfd *) bfd_zmalloc ((bfd_size_type) sizeof (bfd)); if (nbfd == NULL) return NULL; @@ -68,7 +68,7 @@ _bfd_new_bfd () nbfd->sections = (asection *) NULL; nbfd->format = bfd_unknown; nbfd->my_archive = (bfd *) NULL; - nbfd->origin = 0; + nbfd->origin = 0; nbfd->opened_once = false; nbfd->output_has_begun = false; nbfd->section_count = 0; @@ -107,7 +107,7 @@ FUNCTION bfd_openr SYNOPSIS - bfd *bfd_openr(CONST char *filename, CONST char *target); + bfd *bfd_openr(const char *filename, const char *target); DESCRIPTION Open the file @var{filename} (using <>) with the target @@ -122,8 +122,8 @@ DESCRIPTION bfd * bfd_openr (filename, target) - CONST char *filename; - CONST char *target; + const char *filename; + const char *target; { bfd *nbfd; const bfd_target *target_vec; @@ -169,7 +169,7 @@ FUNCTION bfd_fdopenr SYNOPSIS - bfd *bfd_fdopenr(CONST char *filename, CONST char *target, int fd); + bfd *bfd_fdopenr(const char *filename, const char *target, int fd); DESCRIPTION <> is to <> much like <> is to <>. @@ -192,8 +192,8 @@ DESCRIPTION bfd * bfd_fdopenr (filename, target, fd) - CONST char *filename; - CONST char *target; + const char *filename; + const char *target; int fd; { bfd *nbfd; @@ -307,7 +307,7 @@ bfd_openstreamr (filename, target, strea nbfd->iostream = (PTR) stream; nbfd->filename = filename; nbfd->direction = read_direction; - + if (! bfd_cache_init (nbfd)) { objalloc_free ((struct objalloc *) nbfd->memory); @@ -328,7 +328,7 @@ FUNCTION bfd_openw SYNOPSIS - bfd *bfd_openw(CONST char *filename, CONST char *target); + bfd *bfd_openw(const char *filename, const char *target); DESCRIPTION Create a BFD, associated with file @var{filename}, using the @@ -340,8 +340,8 @@ DESCRIPTION bfd * bfd_openw (filename, target) - CONST char *filename; - CONST char *target; + const char *filename; + const char *target; { bfd *nbfd; const bfd_target *target_vec; @@ -429,7 +429,7 @@ bfd_close (abfd) if (stat (abfd->filename, &buf) == 0) { - int mask = umask (0); + unsigned int mask = umask (0); umask (mask); chmod (abfd->filename, (0777 @@ -484,7 +484,7 @@ bfd_close_all_done (abfd) if (stat (abfd->filename, &buf) == 0) { - int mask = umask (0); + unsigned int mask = umask (0); umask (mask); chmod (abfd->filename, (0777 @@ -503,7 +503,7 @@ FUNCTION bfd_create SYNOPSIS - bfd *bfd_create(CONST char *filename, bfd *templ); + bfd *bfd_create(const char *filename, bfd *templ); DESCRIPTION Create a new BFD in the manner of @@ -515,7 +515,7 @@ DESCRIPTION bfd * bfd_create (filename, templ) - CONST char *filename; + const char *filename; bfd *templ; { bfd *nbfd; @@ -560,9 +560,10 @@ bfd_make_writable(abfd) return false; } - bim = (struct bfd_in_memory *) bfd_malloc (sizeof (struct bfd_in_memory)); + bim = ((struct bfd_in_memory *) + bfd_malloc ((bfd_size_type) sizeof (struct bfd_in_memory))); abfd->iostream = (PTR) bim; - /* bfd_write will grow these as needed */ + /* bfd_bwrite will grow these as needed */ bim->size = 0; bim->buffer = 0; @@ -613,7 +614,7 @@ bfd_make_readable(abfd) abfd->sections = (asection *) NULL; abfd->format = bfd_unknown; abfd->my_archive = (bfd *) NULL; - abfd->origin = 0; + abfd->origin = 0; abfd->opened_once = false; abfd->output_has_begun = false; abfd->section_count = 0; @@ -650,10 +651,16 @@ DESCRIPTION PTR bfd_alloc (abfd, size) bfd *abfd; - size_t size; + bfd_size_type size; { PTR ret; + if (size != (unsigned long) size) + { + bfd_set_error (bfd_error_no_memory); + return NULL; + } + ret = objalloc_alloc (abfd->memory, (unsigned long) size); if (ret == NULL) bfd_set_error (bfd_error_no_memory); @@ -663,13 +670,13 @@ bfd_alloc (abfd, size) PTR bfd_zalloc (abfd, size) bfd *abfd; - size_t size; + bfd_size_type size; { PTR res; res = bfd_alloc (abfd, size); if (res) - memset (res, 0, size); + memset (res, 0, (size_t) size); return res; } diff -uprN binutils-2.11.90.0.31/bfd/osf-core.c binutils-2.11.92.0.5/bfd/osf-core.c --- binutils-2.11.90.0.31/bfd/osf-core.c Fri Mar 9 11:16:04 2001 +++ binutils-2.11.92.0.5/bfd/osf-core.c Mon Oct 1 15:25:21 2001 @@ -1,5 +1,6 @@ /* BFD back-end for OSF/1 core files. - Copyright 1993, 1994, 1995, 1998, 1999 Free Software Foundation, Inc. + Copyright 1993, 1994, 1995, 1998, 1999, 2001 + Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -30,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suit /* forward declarations */ static asection * -make_bfd_asection PARAMS ((bfd *, CONST char *, flagword, bfd_size_type, +make_bfd_asection PARAMS ((bfd *, const char *, flagword, bfd_size_type, bfd_vma, file_ptr)); static asymbol * osf_core_make_empty_symbol PARAMS ((bfd *)); @@ -47,7 +48,7 @@ swap_abort PARAMS ((void)); /* These are stored in the bfd's tdata */ -struct osf_core_struct +struct osf_core_struct { int sig; char cmd[MAXCOMLEN + 1]; @@ -60,7 +61,7 @@ struct osf_core_struct static asection * make_bfd_asection (abfd, name, flags, _raw_size, vma, filepos) bfd *abfd; - CONST char *name; + const char *name; flagword flags; bfd_size_type _raw_size; bfd_vma vma; @@ -85,7 +86,9 @@ static asymbol * osf_core_make_empty_symbol (abfd) bfd *abfd; { - asymbol *new = (asymbol *) bfd_zalloc (abfd, sizeof (asymbol)); + asymbol *new; + + new = (asymbol *) bfd_zalloc (abfd, (bfd_size_type) sizeof (asymbol)); if (new) new->the_bfd = abfd; return new; @@ -99,8 +102,10 @@ osf_core_core_file_p (abfd) int i; char *secname; struct core_filehdr core_header; + bfd_size_type amt; - val = bfd_read ((PTR)&core_header, 1, sizeof core_header, abfd); + amt = sizeof core_header; + val = bfd_bread ((PTR) &core_header, amt, abfd); if (val != sizeof core_header) return NULL; @@ -108,7 +113,7 @@ osf_core_core_file_p (abfd) return NULL; core_hdr (abfd) = (struct osf_core_struct *) - bfd_zalloc (abfd, sizeof (struct osf_core_struct)); + bfd_zalloc (abfd, (bfd_size_type) sizeof (struct osf_core_struct)); if (!core_hdr (abfd)) return NULL; @@ -120,7 +125,8 @@ osf_core_core_file_p (abfd) struct core_scnhdr core_scnhdr; flagword flags; - val = bfd_read ((PTR)&core_scnhdr, 1, sizeof core_scnhdr, abfd); + amt = sizeof core_scnhdr; + val = bfd_bread ((PTR) &core_scnhdr, amt, abfd); if (val != sizeof core_scnhdr) break; @@ -178,7 +184,8 @@ osf_core_core_file_failing_signal (abfd) /* ARGSUSED */ static boolean osf_core_core_file_matches_executable_p (core_bfd, exec_bfd) - bfd *core_bfd, *exec_bfd; + bfd *core_bfd ATTRIBUTE_UNUSED; + bfd *exec_bfd ATTRIBUTE_UNUSED; { return true; /* FIXME, We have no way of telling at this point */ } @@ -239,7 +246,7 @@ const bfd_target osf_core_vec = bfd_false, bfd_false, bfd_false, bfd_false }, - + BFD_JUMP_TABLE_GENERIC (_bfd_generic), BFD_JUMP_TABLE_COPY (_bfd_generic), BFD_JUMP_TABLE_CORE (osf_core), @@ -251,6 +258,6 @@ const bfd_target osf_core_vec = BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), NULL, - + (PTR) 0 /* backend_data */ }; diff -uprN binutils-2.11.90.0.31/bfd/pc532-mach.c binutils-2.11.92.0.5/bfd/pc532-mach.c --- binutils-2.11.90.0.31/bfd/pc532-mach.c Fri Mar 9 11:16:04 2001 +++ binutils-2.11.92.0.5/bfd/pc532-mach.c Thu Oct 4 14:35:43 2001 @@ -50,10 +50,13 @@ Foundation, Inc., 59 Temple Place - Suit #define SEGMENT_SIZE TARGET_PAGE_SIZE #define DEFAULT_ARCH bfd_arch_ns32k -#define MY(OP) CAT(pc532machaout_,OP) +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (pc532machaout_,OP) /* Must be the same as aout-ns32k.c */ -#define NAME(x,y) CAT3(ns32kaout,_32_,y) +#define NAME(x,y) CONCAT3 (ns32kaout,_32_,y) #define TARGETNAME "a.out-pc532-mach" @@ -63,8 +66,6 @@ Foundation, Inc., 59 Temple Place - Suit #include "libbfd.h" #include "aout/aout64.h" -/* We can`t use the MYNS macro here for cpp reasons too subtle for me -- IWD */ - #define MY_bfd_reloc_type_lookup ns32kaout_bfd_reloc_type_lookup /* libaout doesn't use NAME for these ... */ @@ -75,19 +76,15 @@ Foundation, Inc., 59 Temple Place - Suit #define MY_exec_header_not_counted 1 -#define MYNSX(OP) CAT(ns32kaout_,OP) -reloc_howto_type * -MYNSX(bfd_reloc_type_lookup) - PARAMS((bfd *abfd AND - bfd_reloc_code_real_type code)); - -boolean -MYNSX(write_object_contents) - PARAMS((bfd *abfd)); +reloc_howto_type *ns32kaout_bfd_reloc_type_lookup + PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); + +static boolean MY(write_object_contents) + PARAMS ((bfd *abfd)); static boolean MY(write_object_contents) (abfd) -bfd *abfd; + bfd *abfd; { struct external_exec exec_bytes; struct internal_exec *execp = exec_hdr (abfd); diff -uprN binutils-2.11.90.0.31/bfd/pdp11.c binutils-2.11.92.0.5/bfd/pdp11.c --- binutils-2.11.90.0.31/bfd/pdp11.c Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/bfd/pdp11.c Thu Oct 4 14:35:43 2001 @@ -27,7 +27,7 @@ * support for overlay object files (see 2.11 a.out(5)) * support for old and very old archives (see 2.11 ar(5), historical section) - + Search for TODO to find other areas needing more work. */ #define BYTES_IN_WORD 2 @@ -41,7 +41,11 @@ #define DEFAULT_ARCH bfd_arch_pdp11 #define DEFAULT_MID M_PDP11 -#define MY(OP) CAT(pdp11_aout_,OP) +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (pdp11_aout_,OP) + /* This needs to start with a.out so GDB knows it is an a.out variant. */ #define TARGETNAME "a.out-pdp11" @@ -176,7 +180,7 @@ const bfd_target MY(vec) = /* Alternative_target */ NULL, - + (PTR) MY_backend_data, }; @@ -304,9 +308,9 @@ DESCRIPTION #define KEEPIT udata.i #include /* For strchr and friends */ -#include #include "bfd.h" #include "sysdep.h" +#include "safe-ctype.h" #include "bfdlink.h" #include "libaout.h" @@ -449,7 +453,7 @@ pdp11_aout_write_headers (abfd, execp) if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) return false; - if (bfd_write ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd) + if (bfd_bwrite ((PTR) &exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, abfd) != EXEC_BYTES_SIZE) return false; @@ -458,28 +462,29 @@ pdp11_aout_write_headers (abfd, execp) if (bfd_get_outsymbols (abfd) != (asymbol **) NULL && bfd_get_symcount (abfd) != 0) { - if (bfd_seek (abfd, (file_ptr)(N_SYMOFF(*execp)), SEEK_SET) != 0) + if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*execp)), SEEK_SET) != 0) return false; - if (! NAME(aout,write_syms)(abfd)) return false; + if (! NAME(aout,write_syms) (abfd)) + return false; } if (obj_textsec (abfd)->reloc_count > 0 || obj_datasec (abfd)->reloc_count > 0) { - if (bfd_seek (abfd, (file_ptr)(N_TRELOFF(*execp)), SEEK_SET) != 0) + if (bfd_seek (abfd, (file_ptr) (N_TRELOFF(*execp)), SEEK_SET) != 0) return false; if (!NAME(aout,squirt_out_relocs) (abfd, obj_textsec (abfd))) return false; - if (bfd_seek (abfd, (file_ptr)(N_DRELOFF(*execp)), SEEK_SET) != 0) + if (bfd_seek (abfd, (file_ptr) (N_DRELOFF(*execp)), SEEK_SET) != 0) return false; - if (!NAME(aout,squirt_out_relocs)(abfd, obj_datasec (abfd))) + if (!NAME(aout,squirt_out_relocs) (abfd, obj_datasec (abfd))) return false; } return true; -} +} /* Write an object file. Section contents have already been written. We write the @@ -658,8 +663,9 @@ NAME(aout,some_aout_object_p) (abfd, exe { struct aout_data_struct *rawptr, *oldrawptr; const bfd_target *result; + bfd_size_type amt = sizeof (struct aout_data_struct); - rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, sizeof (struct aout_data_struct )); + rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, amt); if (rawptr == NULL) return 0; @@ -874,11 +880,12 @@ NAME(aout,mkobject) (abfd) bfd *abfd; { struct aout_data_struct *rawptr; + bfd_size_type amt = sizeof (struct aout_data_struct); 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 )); + rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, amt); if (rawptr == NULL) return false; @@ -997,7 +1004,7 @@ NAME(aout,machine_type) (arch, machine, case bfd_arch_vax: *unknown = false; break; - + default: arch_flags = M_UNKNOWN; } @@ -1123,9 +1130,9 @@ adjust_z_magic (abfd, execp) { bfd_size_type data_pad, text_pad; file_ptr text_end; - CONST struct aout_backend_data *abdp; + const struct aout_backend_data *abdp; int ztih; /* Nonzero if text includes exec header. */ - + abdp = aout_backend_info (abfd); /* Text. */ @@ -1194,7 +1201,7 @@ adjust_z_magic (abfd, execp) } obj_datasec (abfd)->filepos = (obj_textsec (abfd)->filepos + obj_textsec (abfd)->_raw_size); - + /* Fix up exec header while we're at it. */ execp->a_text = obj_textsec(abfd)->_raw_size; if (ztih && (!abdp || (abdp && !abdp->exec_header_not_counted))) @@ -1239,7 +1246,7 @@ adjust_n_magic (abfd, execp) file_ptr pos = adata(abfd).exec_bytes_size; bfd_vma vma = 0; int pad; - + /* Text. */ obj_textsec(abfd)->filepos = pos; if (!obj_textsec(abfd)->user_set_vma) @@ -1254,7 +1261,7 @@ adjust_n_magic (abfd, execp) if (!obj_datasec(abfd)->user_set_vma) obj_datasec(abfd)->vma = BFD_ALIGN (vma, adata(abfd).segment_size); vma = obj_datasec(abfd)->vma; - + /* Since BSS follows data immediately, see if it needs alignment. */ vma += obj_datasec(abfd)->_raw_size; pad = align_power (vma, obj_bsssec(abfd)->alignment_power) - vma; @@ -1451,7 +1458,7 @@ NAME(aout,set_section_contents) (abfd, s if (count != 0) { if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0 - || bfd_write (location, 1, count, abfd) != count) + || bfd_bwrite (location, count, abfd) != count) return false; } @@ -1481,13 +1488,12 @@ aout_get_external_symbols (abfd) /* We allocate using malloc to make the values easy to free later on. If we put them on the objalloc it might not be possible to free them. */ - syms = ((struct external_nlist *) - bfd_malloc ((size_t) count * EXTERNAL_NLIST_SIZE)); + syms = (struct external_nlist *) bfd_malloc (count * EXTERNAL_NLIST_SIZE); if (syms == (struct external_nlist *) NULL && count != 0) return false; if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0 - || (bfd_read (syms, 1, exec_hdr (abfd)->a_syms, abfd) + || (bfd_bread (syms, exec_hdr (abfd)->a_syms, abfd) != exec_hdr (abfd)->a_syms)) { free (syms); @@ -1498,7 +1504,7 @@ aout_get_external_symbols (abfd) obj_aout_external_syms (abfd) = syms; obj_aout_external_sym_count (abfd) = count; } - + if (obj_aout_external_strings (abfd) == NULL && exec_hdr (abfd)->a_syms != 0) { @@ -1508,10 +1514,10 @@ aout_get_external_symbols (abfd) /* Get the size of the strings. */ if (bfd_seek (abfd, obj_str_filepos (abfd), SEEK_SET) != 0 - || (bfd_read ((PTR) string_chars, BYTES_IN_LONG, 1, abfd) != - BYTES_IN_LONG)) + || (bfd_bread ((PTR) string_chars, (bfd_size_type) BYTES_IN_LONG, + abfd) != BYTES_IN_LONG)) return false; - stringsize = bfd_h_get_32 (abfd, string_chars); + stringsize = H_GET_32 (abfd, string_chars); #ifdef USE_MMAP if (bfd_get_file_window (abfd, obj_str_filepos (abfd), stringsize, @@ -1519,13 +1525,13 @@ aout_get_external_symbols (abfd) return false; strings = (char *) obj_aout_string_window (abfd).data; #else - strings = (char *) bfd_malloc ((size_t) stringsize + 1); + strings = (char *) bfd_malloc (stringsize + 1); if (strings == NULL) return false; /* Skip space for the string count in the buffer for convenience when using indexes. */ - if (bfd_read (strings + 4, 1, stringsize - 4, abfd) != stringsize - 4) + if (bfd_bread (strings + 4, stringsize - 4, abfd) != stringsize - 4) { free (strings); return false; @@ -1665,7 +1671,7 @@ translate_to_native_sym_flags (abfd, cac file. */ (*_bfd_error_handler) ("%s: can not represent section for symbol `%s' in a.out object file format", - bfd_get_filename (abfd), + bfd_archive_filename (abfd), cache_ptr->name != NULL ? cache_ptr->name : "*unknown*"); bfd_set_error (bfd_error_nonrepresentable_section); return false; @@ -1693,7 +1699,7 @@ translate_to_native_sym_flags (abfd, cac { (*_bfd_error_handler) ("%s: can not represent section `%s' in a.out object file format", - bfd_get_filename (abfd), bfd_get_section_name (abfd, sec)); + bfd_archive_filename (abfd), bfd_get_section_name (abfd, sec)); bfd_set_error (bfd_error_nonrepresentable_section); return false; } @@ -1752,8 +1758,8 @@ asymbol * NAME(aout,make_empty_symbol) (abfd) bfd *abfd; { - aout_symbol_type *new = - (aout_symbol_type *)bfd_zalloc (abfd, sizeof (aout_symbol_type)); + bfd_size_type amt = sizeof (aout_symbol_type); + aout_symbol_type *new = (aout_symbol_type *) bfd_zalloc (abfd, amt); if (!new) return NULL; new->symbol.the_bfd = abfd; @@ -1799,7 +1805,7 @@ NAME(aout,translate_symbol_table) (abfd, /* TODO: is 0 a safe value here? */ in->desc = 0; in->other = 0; - in->type = bfd_h_get_8 (abfd, ext->e_type); + in->type = H_GET_8 (abfd, ext->e_type); in->symbol.udata.p = NULL; if (! translate_from_native_sym_flags (abfd, in)) @@ -1822,7 +1828,7 @@ NAME(aout,slurp_symbol_table) (abfd) { struct external_nlist *old_external_syms; aout_symbol_type *cached; - size_t cached_size; + bfd_size_type cached_size; /* If there's no work to be done, don't do any */ if (obj_aout_symbols (abfd) != (aout_symbol_type *) NULL) @@ -1833,13 +1839,13 @@ NAME(aout,slurp_symbol_table) (abfd) if (! aout_get_external_symbols (abfd)) return false; - cached_size = (obj_aout_external_sym_count (abfd) - * sizeof (aout_symbol_type)); + cached_size = obj_aout_external_sym_count (abfd); + cached_size *= sizeof (aout_symbol_type); cached = (aout_symbol_type *) bfd_malloc (cached_size); if (cached == NULL && cached_size != 0) return false; if (cached_size != 0) - memset (cached, 0, cached_size); + memset (cached, 0, (size_t) cached_size); /* Convert from external symbol information to internal. */ if (! (NAME(aout,translate_symbol_table) @@ -1935,8 +1941,9 @@ emit_stringtab (abfd, tab) bfd_byte buffer[BYTES_IN_LONG]; /* The string table starts with the size. */ - bfd_h_put_32 (abfd, _bfd_stringtab_size (tab) + BYTES_IN_LONG, buffer); - if (bfd_write ((PTR) buffer, 1, BYTES_IN_LONG, abfd) != BYTES_IN_LONG) + H_PUT_32 (abfd, _bfd_stringtab_size (tab) + BYTES_IN_LONG, buffer); + if (bfd_bwrite ((PTR) buffer, (bfd_size_type) BYTES_IN_LONG, abfd) + != BYTES_IN_LONG) return false; return _bfd_stringtab_emit (abfd, tab); @@ -1960,24 +1967,24 @@ NAME(aout,write_syms) (abfd) bfd_size_type indx; struct external_nlist nsp; - PUT_WORD (abfd, 0, (bfd_byte *)nsp.e_unused); + PUT_WORD (abfd, 0, nsp.e_unused); indx = add_to_stringtab (abfd, strtab, g->name, false); if (indx == (bfd_size_type) -1) goto error_return; - PUT_WORD (abfd, indx, (bfd_byte *) nsp.e_strx); + PUT_WORD (abfd, indx, nsp.e_strx); if (bfd_asymbol_flavour(g) == abfd->xvec->flavour) - bfd_h_put_8 (abfd, aout_symbol(g)->type, nsp.e_type); + H_PUT_8 (abfd, aout_symbol(g)->type, nsp.e_type); else - bfd_h_put_8 (abfd, 0, nsp.e_type); + H_PUT_8 (abfd, 0, nsp.e_type); if (! translate_to_native_sym_flags (abfd, g, &nsp)) goto error_return; - bfd_h_put_8 (abfd, 0, nsp.e_ovly); + H_PUT_8 (abfd, 0, nsp.e_ovly); - if (bfd_write((PTR)&nsp,1,EXTERNAL_NLIST_SIZE, abfd) + if (bfd_bwrite ((PTR)&nsp, (bfd_size_type) EXTERNAL_NLIST_SIZE, abfd) != EXTERNAL_NLIST_SIZE) goto error_return; @@ -2135,7 +2142,7 @@ pdp11_aout_swap_reloc_out (abfd, g, natp cache_ptr->addend = ad; \ break; \ } \ - } + } void pdp11_aout_swap_reloc_in (abfd, bytes, cache_ptr, offset, @@ -2189,7 +2196,7 @@ NAME(aout,slurp_reloc_table) (abfd, asec asymbol **symbols; { struct pdp11_aout_reloc_external *rptr; - unsigned int count; + bfd_size_type count; bfd_size_type reloc_size; PTR relocs; arelent *reloc_cache; @@ -2220,11 +2227,11 @@ NAME(aout,slurp_reloc_table) (abfd, asec each_size = obj_reloc_entry_size (abfd); - relocs = bfd_malloc ((size_t) reloc_size); + relocs = bfd_malloc (reloc_size); if (relocs == NULL && reloc_size != 0) return false; - if (bfd_read (relocs, 1, reloc_size, abfd) != reloc_size) + if (bfd_bread (relocs, reloc_size, abfd) != reloc_size) { free (relocs); return false; @@ -2248,10 +2255,10 @@ NAME(aout,slurp_reloc_table) (abfd, asec count = real_count; } - reloc_cache = (arelent *) bfd_malloc ((size_t) (count * sizeof (arelent))); + reloc_cache = (arelent *) bfd_malloc (count * sizeof (arelent)); if (reloc_cache == NULL && count != 0) return false; - memset (reloc_cache, 0, count * sizeof (arelent)); + memset (reloc_cache, 0, (size_t) count * sizeof (arelent)); cache_ptr = reloc_cache; @@ -2264,14 +2271,15 @@ NAME(aout,slurp_reloc_table) (abfd, asec { rptr = (struct pdp11_aout_reloc_external *) - ((char *)rptr + RELOC_SIZE); - if ((char *)rptr >= (char *)relocs + reloc_size) + ((char *) rptr + RELOC_SIZE); + if ((char *) rptr >= (char *) relocs + reloc_size) goto done; } pdp11_aout_swap_reloc_in (abfd, rptr, cache_ptr, - (char *)rptr - (char *)relocs, - symbols, bfd_get_symcount (abfd)); + (bfd_size_type) ((char *) rptr - (char *) relocs), + symbols, + (bfd_size_type) bfd_get_symcount (abfd)); } done: /* Just in case, if rptr >= relocs + reloc_size should happen @@ -2296,7 +2304,7 @@ NAME(aout,squirt_out_relocs) (abfd, sect arelent **generic; unsigned char *native; unsigned int count = section->reloc_count; - size_t natsize; + bfd_size_type natsize; #if 0 /* If we're writing an .o file, we must write @@ -2311,7 +2319,7 @@ NAME(aout,squirt_out_relocs) (abfd, sect if (!native) return false; - memset ((PTR)native, 0, natsize); + memset ((PTR)native, 0, (size_t) natsize); generic = section->orelocation; if (generic != NULL) @@ -2328,14 +2336,13 @@ NAME(aout,squirt_out_relocs) (abfd, sect } } - if (bfd_write ((PTR) native, 1, natsize, abfd) != natsize) + if (bfd_bwrite ((PTR) native, natsize, abfd) != natsize) { - bfd_release(abfd, native); + bfd_release (abfd, native); return false; } bfd_release (abfd, native); - return true; } @@ -2393,7 +2400,7 @@ NAME(aout,get_reloc_upper_bound) (abfd, return -1; } - if (asect->flags & SEC_CONSTRUCTOR) + if (asect->flags & SEC_CONSTRUCTOR) return (sizeof (arelent *) * (asect->reloc_count+1)); if (asect == obj_datasec (abfd)) @@ -2487,7 +2494,7 @@ NAME(aout,print_symbol) (abfd, afile, sy break; case bfd_print_symbol_all: { - CONST char *section_name = symbol->section->name; + const char *section_name = symbol->section->name; bfd_print_symbol_vandf (abfd, (PTR)file, symbol); @@ -2588,16 +2595,16 @@ NAME(aout,find_nearest_line) asection *section; asymbol **symbols; bfd_vma offset; - CONST char **filename_ptr; - CONST char **functionname_ptr; + const char **filename_ptr; + const char **functionname_ptr; unsigned int *line_ptr; { /* Run down the file looking for the filename, function and linenumber */ asymbol **p; - CONST char *directory_name = NULL; - 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 *directory_name = NULL; + 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. */ bfd_vma low_line_vma = 0; bfd_vma low_func_vma = 0; asymbol *func = 0; @@ -2730,7 +2737,7 @@ NAME(aout,find_nearest_line) adata (abfd).line_buf = buf = NULL; else { - buf = (char *) bfd_malloc (filelen + funclen + 3); + buf = (char *) bfd_malloc ((bfd_size_type) filelen + funclen + 3); adata (abfd).line_buf = buf; if (buf == NULL) return false; @@ -2751,7 +2758,7 @@ NAME(aout,find_nearest_line) if (func) { const char *function = func->name; - char *p; + char *colon; /* The caller expects a symbol name. We actually have a function name, without the leading underscore. Put the @@ -2765,9 +2772,9 @@ NAME(aout,find_nearest_line) } /* Have to remove : stuff. */ - p = strchr (buf, ':'); - if (p != NULL) - *p = '\0'; + colon = strchr (buf, ':'); + if (colon != NULL) + *colon = '\0'; *functionname_ptr = buf; } @@ -2876,9 +2883,9 @@ NAME(aout,link_hash_table_create) (abfd) bfd *abfd; { struct aout_link_hash_table *ret; + bfd_size_type amt = sizeof (struct aout_link_hash_table); - ret = ((struct aout_link_hash_table *) - bfd_alloc (abfd, sizeof (struct aout_link_hash_table))); + ret = ((struct aout_link_hash_table *) bfd_alloc (abfd, amt)); if (ret == NULL) return (struct bfd_link_hash_table *) NULL; if (! NAME(aout,link_hash_table_init) (ret, abfd, @@ -3014,7 +3021,7 @@ aout_link_check_ar_symbols (abfd, info, strings = obj_aout_external_strings (abfd); for (; p < pend; p++) { - int type = bfd_h_get_8 (abfd, p->e_type); + int type = H_GET_8 (abfd, p->e_type); const char *name; struct bfd_link_hash_entry *h; @@ -3168,8 +3175,7 @@ aout_link_add_symbols (abfd, info) should be conditional on info->keep_memory. */ sym_hash = ((struct aout_link_hash_entry **) bfd_alloc (abfd, - ((size_t) sym_count - * sizeof (struct aout_link_hash_entry *)))); + sym_count * sizeof (struct aout_link_hash_entry *))); if (sym_hash == NULL && sym_count != 0) return false; obj_aout_sym_hashes (abfd) = sym_hash; @@ -3191,7 +3197,7 @@ aout_link_add_symbols (abfd, info) *sym_hash = NULL; - type = bfd_h_get_8 (abfd, p->e_type); + type = H_GET_8 (abfd, p->e_type); #if 0 /* not supported in PDP-11 a.out */ /* Ignore debugging symbols. */ @@ -3407,9 +3413,9 @@ NAME(aout,final_link) (abfd, info, callb boolean includes_hash_initialized = false; register bfd *sub; bfd_size_type trsize, drsize; - size_t max_contents_size; - size_t max_relocs_size; - size_t max_sym_count; + bfd_size_type max_contents_size; + bfd_size_type max_relocs_size; + bfd_size_type max_sym_count; bfd_size_type text_size; file_ptr text_end; register struct bfd_link_order *p; @@ -3713,11 +3719,11 @@ NAME(aout,final_link) (abfd, info, callb b = 0; if (bfd_seek (abfd, - (obj_datasec (abfd)->filepos - + exec_hdr (abfd)->a_data - - 1), + (file_ptr) (obj_datasec (abfd)->filepos + + exec_hdr (abfd)->a_data + - 1), SEEK_SET) != 0 - || bfd_write (&b, 1, 1, abfd) != 1) + || bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1) goto error_return; } @@ -3838,7 +3844,7 @@ aout_link_write_symbols (finfo, input_bf false, false) != NULL) && discard != discard_all) { - bfd_h_put_8 (output_bfd, N_TEXT, outsym->e_type); + H_PUT_8 (output_bfd, N_TEXT, outsym->e_type); strtab_index = add_to_stringtab (output_bfd, finfo->strtab, input_bfd->filename, false); if (strtab_index == (bfd_size_type) -1) @@ -3859,7 +3865,7 @@ aout_link_write_symbols (finfo, input_bf sym_end = sym + sym_count; sym_hash = obj_aout_sym_hashes (input_bfd); symbol_map = finfo->symbol_map; - memset (symbol_map, 0, sym_count * sizeof *symbol_map); + memset (symbol_map, 0, (size_t) sym_count * sizeof *symbol_map); for (; sym < sym_end; sym++, sym_hash++, symbol_map++) { const char *name; @@ -3882,7 +3888,7 @@ aout_link_write_symbols (finfo, input_bf we do copy the symbol over. */ *symbol_map = -1; - type = bfd_h_get_8 (input_bfd, sym->e_type); + type = H_GET_8 (input_bfd, sym->e_type); name = strings + GET_WORD (input_bfd, sym->e_strx); h = NULL; @@ -4153,7 +4159,7 @@ aout_link_write_symbols (finfo, input_bf { int incl_type; - incl_type = bfd_h_get_8 (input_bfd, incl_sym->e_type); + incl_type = H_GET_8 (input_bfd, incl_sym->e_type); if (incl_type == N_EINCL) { if (nest == 0) @@ -4174,7 +4180,7 @@ aout_link_write_symbols (finfo, input_bf { /* Skip the file number. */ ++s; - while (isdigit ((unsigned char) *s)) + while (ISDIGIT (*s)) ++s; --s; } @@ -4222,7 +4228,7 @@ aout_link_write_symbols (finfo, input_bf { int incl_type; - incl_type = bfd_h_get_8 (input_bfd, incl_sym->e_type); + incl_type = H_GET_8 (input_bfd, incl_sym->e_type); if (incl_type == N_EINCL) { if (nest == 0) @@ -4243,7 +4249,7 @@ aout_link_write_symbols (finfo, input_bf /* Copy this symbol into the list of symbols we are going to write out. */ - bfd_h_put_8 (output_bfd, type, outsym->e_type); + H_PUT_8 (output_bfd, type, outsym->e_type); copy = false; if (! finfo->info->keep_memory) { @@ -4269,17 +4275,15 @@ aout_link_write_symbols (finfo, input_bf /* Write out the output symbols we have just constructed. */ if (outsym > finfo->output_syms) { - bfd_size_type outsym_count; + bfd_size_type size; if (bfd_seek (output_bfd, finfo->symoff, SEEK_SET) != 0) return false; - outsym_count = outsym - finfo->output_syms; - if (bfd_write ((PTR) finfo->output_syms, - (bfd_size_type) EXTERNAL_NLIST_SIZE, - (bfd_size_type) outsym_count, output_bfd) - != outsym_count * EXTERNAL_NLIST_SIZE) + size = outsym - finfo->output_syms; + size *= EXTERNAL_NLIST_SIZE; + if (bfd_bwrite ((PTR) finfo->output_syms, size, output_bfd) != size) return false; - finfo->symoff += outsym_count * EXTERNAL_NLIST_SIZE; + finfo->symoff += size; } return true; @@ -4299,6 +4303,7 @@ aout_link_write_other_symbol (h, data) bfd_vma val; struct external_nlist outsym; bfd_size_type indx; + bfd_size_type amt; output_bfd = finfo->output_bfd; @@ -4375,7 +4380,7 @@ aout_link_write_other_symbol (h, data) return true; } - bfd_h_put_8 (output_bfd, type, outsym.e_type); + H_PUT_8 (output_bfd, type, outsym.e_type); indx = add_to_stringtab (output_bfd, finfo->strtab, h->root.root.string, false); if (indx == (bfd_size_type) -1) @@ -4386,15 +4391,15 @@ aout_link_write_other_symbol (h, data) PUT_WORD (output_bfd, indx, outsym.e_strx); PUT_WORD (output_bfd, val, outsym.e_value); + amt = EXTERNAL_NLIST_SIZE; if (bfd_seek (output_bfd, finfo->symoff, SEEK_SET) != 0 - || bfd_write ((PTR) &outsym, (bfd_size_type) EXTERNAL_NLIST_SIZE, - (bfd_size_type) 1, output_bfd) != EXTERNAL_NLIST_SIZE) + || bfd_bwrite ((PTR) &outsym, amt, output_bfd) != amt) { /* FIXME: No way to handle errors. */ abort (); } - finfo->symoff += EXTERNAL_NLIST_SIZE; + finfo->symoff += amt; h->indx = obj_aout_external_sym_count (output_bfd); ++obj_aout_external_sym_count (output_bfd); @@ -4432,7 +4437,7 @@ aout_link_input_section (finfo, input_bf if (rel_size > 0) { if (bfd_seek (input_bfd, input_section->rel_filepos, SEEK_SET) != 0 - || bfd_read (relocs, 1, rel_size, input_bfd) != rel_size) + || bfd_bread (relocs, rel_size, input_bfd) != rel_size) return false; } } @@ -4447,7 +4452,7 @@ aout_link_input_section (finfo, input_bf if (! bfd_set_section_contents (finfo->output_bfd, input_section->output_section, (PTR) finfo->contents, - input_section->output_offset, + (file_ptr) input_section->output_offset, input_size)) return false; @@ -4457,8 +4462,7 @@ aout_link_input_section (finfo, input_bf { if (bfd_seek (finfo->output_bfd, *reloff_ptr, SEEK_SET) != 0) return false; - if (bfd_write (relocs, (bfd_size_type) 1, rel_size, finfo->output_bfd) - != rel_size) + if (bfd_bwrite (relocs, rel_size, finfo->output_bfd) != rel_size) return false; *reloff_ptr += rel_size; @@ -4818,6 +4822,7 @@ aout_link_reloc_link_order (finfo, o, p) file_ptr *reloff_ptr; struct reloc_std_external srel; PTR rel_ptr; + bfd_size_type rel_size; pr = p->u.reloc.p; @@ -4979,14 +4984,12 @@ aout_link_reloc_link_order (finfo, o, p) return false; } + rel_size = obj_reloc_entry_size (finfo->output_bfd); if (bfd_seek (finfo->output_bfd, *reloff_ptr, SEEK_SET) != 0 - || (bfd_write (rel_ptr, (bfd_size_type) 1, - obj_reloc_entry_size (finfo->output_bfd), - finfo->output_bfd) - != obj_reloc_entry_size (finfo->output_bfd))) + || bfd_bwrite (rel_ptr, rel_size, finfo->output_bfd) != rel_size) return false; - *reloff_ptr += obj_reloc_entry_size (finfo->output_bfd); + *reloff_ptr += rel_size; /* Assert that the relocs have not run into the symbols, and that n the text relocs have not run into the data relocs. */ diff -uprN binutils-2.11.90.0.31/bfd/pe-mips.c binutils-2.11.92.0.5/bfd/pe-mips.c --- binutils-2.11.90.0.31/bfd/pe-mips.c Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/bfd/pe-mips.c Mon Oct 1 15:25:21 2001 @@ -153,7 +153,7 @@ coff_mips_reloc (abfd, reloc_entry, symb { short x = bfd_get_16 (abfd, addr); DOIT (x); - bfd_put_16 (abfd, x, addr); + bfd_put_16 (abfd, (bfd_vma) x, addr); } break; @@ -161,7 +161,7 @@ coff_mips_reloc (abfd, reloc_entry, symb { long x = bfd_get_32 (abfd, addr); DOIT (x); - bfd_put_32 (abfd, x, addr); + bfd_put_32 (abfd, (bfd_vma) x, addr); } break; @@ -567,10 +567,9 @@ mips_swap_reloc_in (abfd, src, dst) RELOC *reloc_src = (RELOC *) src; struct internal_reloc *reloc_dst = (struct internal_reloc *) dst; - reloc_dst->r_vaddr = bfd_h_get_32(abfd, (bfd_byte *)reloc_src->r_vaddr); - reloc_dst->r_symndx = - bfd_h_get_signed_32(abfd, (bfd_byte *) reloc_src->r_symndx); - reloc_dst->r_type = bfd_h_get_16(abfd, (bfd_byte *) reloc_src->r_type); + reloc_dst->r_vaddr = H_GET_32 (abfd, reloc_src->r_vaddr); + reloc_dst->r_symndx = H_GET_S32 (abfd, reloc_src->r_symndx); + reloc_dst->r_type = H_GET_16 (abfd, reloc_src->r_type); reloc_dst->r_size = 0; reloc_dst->r_extern = 0; reloc_dst->r_offset = 0; @@ -614,23 +613,18 @@ mips_swap_reloc_out (abfd, src, dst) the same address as a REFHI, we assume this is the matching PAIR reloc and output it accordingly. The symndx is really the low 16 bits of the addend */ - bfd_h_put_32 (abfd, reloc_src->r_vaddr, - (bfd_byte *) reloc_dst->r_vaddr); - bfd_h_put_32 (abfd, reloc_src->r_symndx, - (bfd_byte *) reloc_dst->r_symndx); - - bfd_h_put_16(abfd, MIPS_R_PAIR, (bfd_byte *) - reloc_dst->r_type); + H_PUT_32 (abfd, reloc_src->r_vaddr, reloc_dst->r_vaddr); + H_PUT_32 (abfd, reloc_src->r_symndx, reloc_dst->r_symndx); + H_PUT_16 (abfd, MIPS_R_PAIR, reloc_dst->r_type); return RELSZ; } break; } - bfd_h_put_32(abfd, reloc_src->r_vaddr, (bfd_byte *) reloc_dst->r_vaddr); - bfd_h_put_32(abfd, reloc_src->r_symndx, (bfd_byte *) reloc_dst->r_symndx); + H_PUT_32 (abfd, reloc_src->r_vaddr, reloc_dst->r_vaddr); + H_PUT_32 (abfd, reloc_src->r_symndx, reloc_dst->r_symndx); - bfd_h_put_16(abfd, reloc_src->r_type, (bfd_byte *) - reloc_dst->r_type); + H_PUT_16 (abfd, reloc_src->r_type, reloc_dst->r_type); return RELSZ; } @@ -663,7 +657,7 @@ coff_pe_mips_relocate_section (output_bf { (*_bfd_error_handler) (_("\ %s: `ld -r' not supported with PE MIPS objects\n"), - bfd_get_filename (input_bfd)); + bfd_archive_filename (input_bfd)); bfd_set_error (bfd_error_bad_value); return false; } @@ -798,7 +792,7 @@ coff_pe_mips_relocate_section (output_bf */ #define UI(x) (*_bfd_error_handler) (_("%s: unimplemented %s\n"), \ - bfd_get_filename (input_bfd), x); \ + bfd_archive_filename (input_bfd), x); \ bfd_set_error (bfd_error_bad_value); switch (rel->r_type) @@ -824,7 +818,7 @@ coff_pe_mips_relocate_section (output_bf if ((src & 0xf0000000) != (targ & 0xf0000000)) { (*_bfd_error_handler) (_("%s: jump too far away\n"), - bfd_get_filename (input_bfd)); + bfd_archive_filename (input_bfd)); bfd_set_error (bfd_error_bad_value); return false; } @@ -851,7 +845,7 @@ coff_pe_mips_relocate_section (output_bf break; default: (*_bfd_error_handler) (_("%s: bad pair/reflo after refhi\n"), - bfd_get_filename (input_bfd)); + bfd_archive_filename (input_bfd)); bfd_set_error (bfd_error_bad_value); return false; } diff -uprN binutils-2.11.90.0.31/bfd/peXXigen.c binutils-2.11.92.0.5/bfd/peXXigen.c --- binutils-2.11.90.0.31/bfd/peXXigen.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/bfd/peXXigen.c Mon Oct 1 15:25:21 2001 @@ -111,22 +111,21 @@ _bfd_XXi_swap_sym_in (abfd, ext1, in1) if (ext->e.e_name[0] == 0) { in->_n._n_n._n_zeroes = 0; - in->_n._n_n._n_offset = - bfd_h_get_32 (abfd, (bfd_byte *) ext->e.e.e_offset); + in->_n._n_n._n_offset = H_GET_32 (abfd, ext->e.e.e_offset); } else memcpy (in->_n._n_name, ext->e.e_name, SYMNMLEN); - in->n_value = bfd_h_get_32 (abfd, (bfd_byte *) ext->e_value); - in->n_scnum = bfd_h_get_16 (abfd, (bfd_byte *) ext->e_scnum); + in->n_value = H_GET_32 (abfd, ext->e_value); + in->n_scnum = H_GET_16 (abfd, ext->e_scnum); if (sizeof (ext->e_type) == 2) - in->n_type = bfd_h_get_16 (abfd, (bfd_byte *) ext->e_type); + in->n_type = H_GET_16 (abfd, ext->e_type); else - in->n_type = bfd_h_get_32 (abfd, (bfd_byte *) ext->e_type); + in->n_type = H_GET_32 (abfd, ext->e_type); - in->n_sclass = bfd_h_get_8 (abfd, ext->e_sclass); - in->n_numaux = bfd_h_get_8 (abfd, ext->e_numaux); + in->n_sclass = H_GET_8 (abfd, ext->e_sclass); + in->n_numaux = H_GET_8 (abfd, ext->e_numaux); #ifndef STRICT_PE_FORMAT /* This is for Gnu-created DLLs. */ @@ -184,7 +183,7 @@ _bfd_XXi_swap_sym_in (abfd, ext1, in1) if (unused_section_number <= sec->target_index) unused_section_number = sec->target_index + 1; - name = bfd_alloc (abfd, strlen (in->n_name) + 10); + name = bfd_alloc (abfd, (bfd_size_type) strlen (in->n_name) + 10); if (name == NULL) return; strcpy (name, in->n_name); @@ -232,22 +231,22 @@ _bfd_XXi_swap_sym_out (abfd, inp, extp) if (in->_n._n_name[0] == 0) { - bfd_h_put_32 (abfd, 0, (bfd_byte *) ext->e.e.e_zeroes); - bfd_h_put_32 (abfd, in->_n._n_n._n_offset, (bfd_byte *) ext->e.e.e_offset); + H_PUT_32 (abfd, 0, ext->e.e.e_zeroes); + H_PUT_32 (abfd, in->_n._n_n._n_offset, ext->e.e.e_offset); } else memcpy (ext->e.e_name, in->_n._n_name, SYMNMLEN); - bfd_h_put_32 (abfd, in->n_value, (bfd_byte *) ext->e_value); - bfd_h_put_16 (abfd, in->n_scnum, (bfd_byte *) ext->e_scnum); + H_PUT_32 (abfd, in->n_value, ext->e_value); + H_PUT_16 (abfd, in->n_scnum, ext->e_scnum); if (sizeof (ext->e_type) == 2) - bfd_h_put_16 (abfd, in->n_type, (bfd_byte *) ext->e_type); + H_PUT_16 (abfd, in->n_type, ext->e_type); else - bfd_h_put_32 (abfd, in->n_type, (bfd_byte *) ext->e_type); + H_PUT_32 (abfd, in->n_type, ext->e_type); - bfd_h_put_8 (abfd, in->n_sclass, ext->e_sclass); - bfd_h_put_8 (abfd, in->n_numaux, ext->e_numaux); + H_PUT_8 (abfd, in->n_sclass, ext->e_sclass); + H_PUT_8 (abfd, in->n_numaux, ext->e_numaux); return SYMESZ; } @@ -271,8 +270,7 @@ _bfd_XXi_swap_aux_in (abfd, ext1, type, if (ext->x_file.x_fname[0] == 0) { in->x_file.x_n.x_zeroes = 0; - in->x_file.x_n.x_offset = - bfd_h_get_32 (abfd, (bfd_byte *) ext->x_file.x_n.x_offset); + in->x_file.x_n.x_offset = H_GET_32 (abfd, ext->x_file.x_n.x_offset); } else memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN); @@ -286,19 +284,16 @@ _bfd_XXi_swap_aux_in (abfd, ext1, type, in->x_scn.x_scnlen = GET_SCN_SCNLEN (abfd, ext); in->x_scn.x_nreloc = GET_SCN_NRELOC (abfd, ext); in->x_scn.x_nlinno = GET_SCN_NLINNO (abfd, ext); - in->x_scn.x_checksum = - bfd_h_get_32 (abfd, (bfd_byte *) ext->x_scn.x_checksum); - in->x_scn.x_associated = - bfd_h_get_16 (abfd, (bfd_byte *) ext->x_scn.x_associated); - in->x_scn.x_comdat = - bfd_h_get_8 (abfd, (bfd_byte *) ext->x_scn.x_comdat); + in->x_scn.x_checksum = H_GET_32 (abfd, ext->x_scn.x_checksum); + in->x_scn.x_associated = H_GET_16 (abfd, ext->x_scn.x_associated); + in->x_scn.x_comdat = H_GET_8 (abfd, ext->x_scn.x_comdat); return; } break; } - in->x_sym.x_tagndx.l = bfd_h_get_32 (abfd, (bfd_byte *) ext->x_sym.x_tagndx); - in->x_sym.x_tvndx = bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_tvndx); + in->x_sym.x_tagndx.l = H_GET_32 (abfd, ext->x_sym.x_tagndx); + in->x_sym.x_tvndx = H_GET_16 (abfd, ext->x_sym.x_tvndx); if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class)) { @@ -308,19 +303,18 @@ _bfd_XXi_swap_aux_in (abfd, ext1, type, else { in->x_sym.x_fcnary.x_ary.x_dimen[0] = - bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[0]); + H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[0]); in->x_sym.x_fcnary.x_ary.x_dimen[1] = - bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[1]); + H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[1]); in->x_sym.x_fcnary.x_ary.x_dimen[2] = - bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[2]); + H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[2]); in->x_sym.x_fcnary.x_ary.x_dimen[3] = - bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[3]); + H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[3]); } if (ISFCN (type)) { - in->x_sym.x_misc.x_fsize = - bfd_h_get_32 (abfd, (bfd_byte *) ext->x_sym.x_misc.x_fsize); + in->x_sym.x_misc.x_fsize = H_GET_32 (abfd, ext->x_sym.x_misc.x_fsize); } else { @@ -348,10 +342,8 @@ _bfd_XXi_swap_aux_out (abfd, inp, type, case C_FILE: if (in->x_file.x_fname[0] == 0) { - bfd_h_put_32 (abfd, 0, (bfd_byte *) ext->x_file.x_n.x_zeroes); - bfd_h_put_32 (abfd, - in->x_file.x_n.x_offset, - (bfd_byte *) ext->x_file.x_n.x_offset); + H_PUT_32 (abfd, 0, ext->x_file.x_n.x_zeroes); + H_PUT_32 (abfd, in->x_file.x_n.x_offset, ext->x_file.x_n.x_offset); } else memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN); @@ -366,19 +358,16 @@ _bfd_XXi_swap_aux_out (abfd, inp, type, PUT_SCN_SCNLEN (abfd, in->x_scn.x_scnlen, ext); PUT_SCN_NRELOC (abfd, in->x_scn.x_nreloc, ext); PUT_SCN_NLINNO (abfd, in->x_scn.x_nlinno, ext); - bfd_h_put_32 (abfd, in->x_scn.x_checksum, - (bfd_byte *) ext->x_scn.x_checksum); - bfd_h_put_16 (abfd, in->x_scn.x_associated, - (bfd_byte *) ext->x_scn.x_associated); - bfd_h_put_8 (abfd, in->x_scn.x_comdat, - (bfd_byte *) ext->x_scn.x_comdat); + H_PUT_32 (abfd, in->x_scn.x_checksum, ext->x_scn.x_checksum); + H_PUT_16 (abfd, in->x_scn.x_associated, ext->x_scn.x_associated); + H_PUT_8 (abfd, in->x_scn.x_comdat, ext->x_scn.x_comdat); return AUXESZ; } break; } - bfd_h_put_32 (abfd, in->x_sym.x_tagndx.l, (bfd_byte *) ext->x_sym.x_tagndx); - bfd_h_put_16 (abfd, in->x_sym.x_tvndx, (bfd_byte *) ext->x_sym.x_tvndx); + H_PUT_32 (abfd, in->x_sym.x_tagndx.l, ext->x_sym.x_tagndx); + H_PUT_16 (abfd, in->x_sym.x_tvndx, ext->x_sym.x_tvndx); if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class)) { @@ -387,19 +376,18 @@ _bfd_XXi_swap_aux_out (abfd, inp, type, } else { - bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[0], - (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[0]); - bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[1], - (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[1]); - bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[2], - (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[2]); - bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[3], - (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[3]); + H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[0], + ext->x_sym.x_fcnary.x_ary.x_dimen[0]); + H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[1], + ext->x_sym.x_fcnary.x_ary.x_dimen[1]); + H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[2], + ext->x_sym.x_fcnary.x_ary.x_dimen[2]); + H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[3], + ext->x_sym.x_fcnary.x_ary.x_dimen[3]); } if (ISFCN (type)) - bfd_h_put_32 (abfd, in->x_sym.x_misc.x_fsize, - (bfd_byte *) ext->x_sym.x_misc.x_fsize); + H_PUT_32 (abfd, in->x_sym.x_misc.x_fsize, ext->x_sym.x_misc.x_fsize); else { PUT_LNSZ_LNNO (abfd, in->x_sym.x_misc.x_lnsz.x_lnno, ext); @@ -418,7 +406,7 @@ _bfd_XXi_swap_lineno_in (abfd, ext1, in1 LINENO *ext = (LINENO *) ext1; struct internal_lineno *in = (struct internal_lineno *) in1; - in->l_addr.l_symndx = bfd_h_get_32 (abfd, (bfd_byte *) ext->l_addr.l_symndx); + in->l_addr.l_symndx = H_GET_32 (abfd, ext->l_addr.l_symndx); in->l_lnno = GET_LINENO_LNNO (abfd, ext); } @@ -430,8 +418,7 @@ _bfd_XXi_swap_lineno_out (abfd, inp, out { struct internal_lineno *in = (struct internal_lineno *) inp; struct external_lineno *ext = (struct external_lineno *) outp; - bfd_h_put_32 (abfd, in->l_addr.l_symndx, (bfd_byte *) - ext->l_addr.l_symndx); + H_PUT_32 (abfd, in->l_addr.l_symndx, ext->l_addr.l_symndx); PUT_LINENO_LNNO (abfd, in->l_lnno, ext); return LINESZ; @@ -448,48 +435,48 @@ _bfd_XXi_swap_aouthdr_in (abfd, aouthdr_ AOUTHDR *aouthdr_ext = (AOUTHDR *) aouthdr_ext1; struct internal_aouthdr *aouthdr_int = (struct internal_aouthdr *)aouthdr_int1; - aouthdr_int->magic = bfd_h_get_16 (abfd, (bfd_byte *) aouthdr_ext->magic); - aouthdr_int->vstamp = bfd_h_get_16 (abfd, (bfd_byte *) aouthdr_ext->vstamp); - aouthdr_int->tsize = - GET_AOUTHDR_TSIZE (abfd, (bfd_byte *) aouthdr_ext->tsize); - aouthdr_int->dsize = - GET_AOUTHDR_DSIZE (abfd, (bfd_byte *) aouthdr_ext->dsize); - aouthdr_int->bsize = - GET_AOUTHDR_BSIZE (abfd, (bfd_byte *) aouthdr_ext->bsize); - aouthdr_int->entry = - GET_AOUTHDR_ENTRY (abfd, (bfd_byte *) aouthdr_ext->entry); + aouthdr_int->magic = H_GET_16 (abfd, aouthdr_ext->magic); + aouthdr_int->vstamp = H_GET_16 (abfd, aouthdr_ext->vstamp); + aouthdr_int->tsize = GET_AOUTHDR_TSIZE (abfd, aouthdr_ext->tsize); + aouthdr_int->dsize = GET_AOUTHDR_DSIZE (abfd, aouthdr_ext->dsize); + aouthdr_int->bsize = GET_AOUTHDR_BSIZE (abfd, aouthdr_ext->bsize); + aouthdr_int->entry = GET_AOUTHDR_ENTRY (abfd, aouthdr_ext->entry); aouthdr_int->text_start = - GET_AOUTHDR_TEXT_START (abfd, (bfd_byte *) aouthdr_ext->text_start); + GET_AOUTHDR_TEXT_START (abfd, aouthdr_ext->text_start); #ifndef COFF_WITH_pep /* PE32+ does not have data_start member! */ aouthdr_int->data_start = - GET_AOUTHDR_DATA_START (abfd, (bfd_byte *) aouthdr_ext->data_start); + GET_AOUTHDR_DATA_START (abfd, aouthdr_ext->data_start); #endif a = &aouthdr_int->pe; - a->ImageBase = GET_OPTHDR_IMAGE_BASE (abfd, (bfd_byte *) src->ImageBase); - a->SectionAlignment = bfd_h_get_32 (abfd, (bfd_byte *) src->SectionAlignment); - a->FileAlignment = bfd_h_get_32 (abfd, (bfd_byte *) src->FileAlignment); + a->ImageBase = GET_OPTHDR_IMAGE_BASE (abfd, src->ImageBase); + a->SectionAlignment = H_GET_32 (abfd, src->SectionAlignment); + a->FileAlignment = H_GET_32 (abfd, src->FileAlignment); a->MajorOperatingSystemVersion = - bfd_h_get_16 (abfd, (bfd_byte *) src->MajorOperatingSystemVersion); + H_GET_16 (abfd, src->MajorOperatingSystemVersion); a->MinorOperatingSystemVersion = - bfd_h_get_16 (abfd, (bfd_byte *) src->MinorOperatingSystemVersion); - a->MajorImageVersion = bfd_h_get_16 (abfd, (bfd_byte *) src->MajorImageVersion); - a->MinorImageVersion = bfd_h_get_16 (abfd, (bfd_byte *) src->MinorImageVersion); - a->MajorSubsystemVersion = bfd_h_get_16 (abfd, (bfd_byte *) src->MajorSubsystemVersion); - a->MinorSubsystemVersion = bfd_h_get_16 (abfd, (bfd_byte *) src->MinorSubsystemVersion); - a->Reserved1 = bfd_h_get_32 (abfd, (bfd_byte *) src->Reserved1); - a->SizeOfImage = bfd_h_get_32 (abfd, (bfd_byte *) src->SizeOfImage); - a->SizeOfHeaders = bfd_h_get_32 (abfd, (bfd_byte *) src->SizeOfHeaders); - a->CheckSum = bfd_h_get_32 (abfd, (bfd_byte *) src->CheckSum); - a->Subsystem = bfd_h_get_16 (abfd, (bfd_byte *) src->Subsystem); - a->DllCharacteristics = bfd_h_get_16 (abfd, (bfd_byte *) src->DllCharacteristics); - a->SizeOfStackReserve = GET_OPTHDR_SIZE_OF_STACK_RESERVE (abfd, (bfd_byte *) src->SizeOfStackReserve); - a->SizeOfStackCommit = GET_OPTHDR_SIZE_OF_STACK_COMMIT (abfd, (bfd_byte *) src->SizeOfStackCommit); - a->SizeOfHeapReserve = GET_OPTHDR_SIZE_OF_HEAP_RESERVE (abfd, (bfd_byte *) src->SizeOfHeapReserve); - a->SizeOfHeapCommit = GET_OPTHDR_SIZE_OF_HEAP_COMMIT (abfd, (bfd_byte *) src->SizeOfHeapCommit); - a->LoaderFlags = bfd_h_get_32 (abfd, (bfd_byte *) src->LoaderFlags); - a->NumberOfRvaAndSizes = bfd_h_get_32 (abfd, (bfd_byte *) src->NumberOfRvaAndSizes); + H_GET_16 (abfd, src->MinorOperatingSystemVersion); + a->MajorImageVersion = H_GET_16 (abfd, src->MajorImageVersion); + a->MinorImageVersion = H_GET_16 (abfd, src->MinorImageVersion); + a->MajorSubsystemVersion = H_GET_16 (abfd, src->MajorSubsystemVersion); + a->MinorSubsystemVersion = H_GET_16 (abfd, src->MinorSubsystemVersion); + a->Reserved1 = H_GET_32 (abfd, src->Reserved1); + a->SizeOfImage = H_GET_32 (abfd, src->SizeOfImage); + a->SizeOfHeaders = H_GET_32 (abfd, src->SizeOfHeaders); + a->CheckSum = H_GET_32 (abfd, src->CheckSum); + a->Subsystem = H_GET_16 (abfd, src->Subsystem); + a->DllCharacteristics = H_GET_16 (abfd, src->DllCharacteristics); + a->SizeOfStackReserve = + GET_OPTHDR_SIZE_OF_STACK_RESERVE (abfd, src->SizeOfStackReserve); + a->SizeOfStackCommit = + GET_OPTHDR_SIZE_OF_STACK_COMMIT (abfd, src->SizeOfStackCommit); + a->SizeOfHeapReserve = + GET_OPTHDR_SIZE_OF_HEAP_RESERVE (abfd, src->SizeOfHeapReserve); + a->SizeOfHeapCommit = + GET_OPTHDR_SIZE_OF_HEAP_COMMIT (abfd, src->SizeOfHeapCommit); + a->LoaderFlags = H_GET_32 (abfd, src->LoaderFlags); + a->NumberOfRvaAndSizes = H_GET_32 (abfd, src->NumberOfRvaAndSizes); { int idx; @@ -498,12 +485,12 @@ _bfd_XXi_swap_aouthdr_in (abfd, aouthdr_ { /* If data directory is empty, rva also should be 0. */ int size = - bfd_h_get_32 (abfd, (bfd_byte *) src->DataDirectory[idx][1]); + H_GET_32 (abfd, src->DataDirectory[idx][1]); a->DataDirectory[idx].Size = size; if (size) a->DataDirectory[idx].VirtualAddress = - bfd_h_get_32 (abfd, (bfd_byte *) src->DataDirectory[idx][0]); + H_GET_32 (abfd, src->DataDirectory[idx][0]); else a->DataDirectory[idx].VirtualAddress = 0; } @@ -687,80 +674,67 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out } extra->SizeOfHeaders = abfd->sections->filepos; - bfd_h_put_16 (abfd, aouthdr_in->magic, (bfd_byte *) aouthdr_out->standard.magic); + H_PUT_16 (abfd, aouthdr_in->magic, aouthdr_out->standard.magic); #define LINKER_VERSION 256 /* That is, 2.56 */ /* This piece of magic sets the "linker version" field to LINKER_VERSION. */ - bfd_h_put_16 (abfd, - LINKER_VERSION / 100 + (LINKER_VERSION % 100) * 256, - (bfd_byte *) aouthdr_out->standard.vstamp); - - PUT_AOUTHDR_TSIZE (abfd, aouthdr_in->tsize, (bfd_byte *) aouthdr_out->standard.tsize); - PUT_AOUTHDR_DSIZE (abfd, aouthdr_in->dsize, (bfd_byte *) aouthdr_out->standard.dsize); - PUT_AOUTHDR_BSIZE (abfd, aouthdr_in->bsize, (bfd_byte *) aouthdr_out->standard.bsize); - PUT_AOUTHDR_ENTRY (abfd, aouthdr_in->entry, (bfd_byte *) aouthdr_out->standard.entry); + H_PUT_16 (abfd, (LINKER_VERSION / 100 + (LINKER_VERSION % 100) * 256), + aouthdr_out->standard.vstamp); + + PUT_AOUTHDR_TSIZE (abfd, aouthdr_in->tsize, aouthdr_out->standard.tsize); + PUT_AOUTHDR_DSIZE (abfd, aouthdr_in->dsize, aouthdr_out->standard.dsize); + PUT_AOUTHDR_BSIZE (abfd, aouthdr_in->bsize, aouthdr_out->standard.bsize); + PUT_AOUTHDR_ENTRY (abfd, aouthdr_in->entry, aouthdr_out->standard.entry); PUT_AOUTHDR_TEXT_START (abfd, aouthdr_in->text_start, - (bfd_byte *) aouthdr_out->standard.text_start); + aouthdr_out->standard.text_start); #ifndef COFF_WITH_pep /* PE32+ does not have data_start member! */ PUT_AOUTHDR_DATA_START (abfd, aouthdr_in->data_start, - (bfd_byte *) aouthdr_out->standard.data_start); + aouthdr_out->standard.data_start); #endif - PUT_OPTHDR_IMAGE_BASE (abfd, extra->ImageBase, - (bfd_byte *) aouthdr_out->ImageBase); - bfd_h_put_32 (abfd, extra->SectionAlignment, - (bfd_byte *) aouthdr_out->SectionAlignment); - bfd_h_put_32 (abfd, extra->FileAlignment, - (bfd_byte *) aouthdr_out->FileAlignment); - bfd_h_put_16 (abfd, extra->MajorOperatingSystemVersion, - (bfd_byte *) aouthdr_out->MajorOperatingSystemVersion); - bfd_h_put_16 (abfd, extra->MinorOperatingSystemVersion, - (bfd_byte *) aouthdr_out->MinorOperatingSystemVersion); - bfd_h_put_16 (abfd, extra->MajorImageVersion, - (bfd_byte *) aouthdr_out->MajorImageVersion); - bfd_h_put_16 (abfd, extra->MinorImageVersion, - (bfd_byte *) aouthdr_out->MinorImageVersion); - bfd_h_put_16 (abfd, extra->MajorSubsystemVersion, - (bfd_byte *) aouthdr_out->MajorSubsystemVersion); - bfd_h_put_16 (abfd, extra->MinorSubsystemVersion, - (bfd_byte *) aouthdr_out->MinorSubsystemVersion); - bfd_h_put_32 (abfd, extra->Reserved1, - (bfd_byte *) aouthdr_out->Reserved1); - bfd_h_put_32 (abfd, extra->SizeOfImage, - (bfd_byte *) aouthdr_out->SizeOfImage); - bfd_h_put_32 (abfd, extra->SizeOfHeaders, - (bfd_byte *) aouthdr_out->SizeOfHeaders); - bfd_h_put_32 (abfd, extra->CheckSum, - (bfd_byte *) aouthdr_out->CheckSum); - bfd_h_put_16 (abfd, extra->Subsystem, - (bfd_byte *) aouthdr_out->Subsystem); - bfd_h_put_16 (abfd, extra->DllCharacteristics, - (bfd_byte *) aouthdr_out->DllCharacteristics); + PUT_OPTHDR_IMAGE_BASE (abfd, extra->ImageBase, aouthdr_out->ImageBase); + H_PUT_32 (abfd, extra->SectionAlignment, aouthdr_out->SectionAlignment); + H_PUT_32 (abfd, extra->FileAlignment, aouthdr_out->FileAlignment); + H_PUT_16 (abfd, extra->MajorOperatingSystemVersion, + aouthdr_out->MajorOperatingSystemVersion); + H_PUT_16 (abfd, extra->MinorOperatingSystemVersion, + aouthdr_out->MinorOperatingSystemVersion); + H_PUT_16 (abfd, extra->MajorImageVersion, aouthdr_out->MajorImageVersion); + H_PUT_16 (abfd, extra->MinorImageVersion, aouthdr_out->MinorImageVersion); + H_PUT_16 (abfd, extra->MajorSubsystemVersion, + aouthdr_out->MajorSubsystemVersion); + H_PUT_16 (abfd, extra->MinorSubsystemVersion, + aouthdr_out->MinorSubsystemVersion); + H_PUT_32 (abfd, extra->Reserved1, aouthdr_out->Reserved1); + H_PUT_32 (abfd, extra->SizeOfImage, aouthdr_out->SizeOfImage); + H_PUT_32 (abfd, extra->SizeOfHeaders, aouthdr_out->SizeOfHeaders); + H_PUT_32 (abfd, extra->CheckSum, aouthdr_out->CheckSum); + H_PUT_16 (abfd, extra->Subsystem, aouthdr_out->Subsystem); + H_PUT_16 (abfd, extra->DllCharacteristics, aouthdr_out->DllCharacteristics); PUT_OPTHDR_SIZE_OF_STACK_RESERVE (abfd, extra->SizeOfStackReserve, - (bfd_byte *) aouthdr_out->SizeOfStackReserve); + aouthdr_out->SizeOfStackReserve); PUT_OPTHDR_SIZE_OF_STACK_COMMIT (abfd, extra->SizeOfStackCommit, - (bfd_byte *) aouthdr_out->SizeOfStackCommit); + aouthdr_out->SizeOfStackCommit); PUT_OPTHDR_SIZE_OF_HEAP_RESERVE (abfd, extra->SizeOfHeapReserve, - (bfd_byte *) aouthdr_out->SizeOfHeapReserve); + aouthdr_out->SizeOfHeapReserve); PUT_OPTHDR_SIZE_OF_HEAP_COMMIT (abfd, extra->SizeOfHeapCommit, - (bfd_byte *) aouthdr_out->SizeOfHeapCommit); - bfd_h_put_32 (abfd, extra->LoaderFlags, - (bfd_byte *) aouthdr_out->LoaderFlags); - bfd_h_put_32 (abfd, extra->NumberOfRvaAndSizes, - (bfd_byte *) aouthdr_out->NumberOfRvaAndSizes); + aouthdr_out->SizeOfHeapCommit); + H_PUT_32 (abfd, extra->LoaderFlags, aouthdr_out->LoaderFlags); + H_PUT_32 (abfd, extra->NumberOfRvaAndSizes, + aouthdr_out->NumberOfRvaAndSizes); { int idx; for (idx = 0; idx < 16; idx++) { - bfd_h_put_32 (abfd, extra->DataDirectory[idx].VirtualAddress, - (bfd_byte *) aouthdr_out->DataDirectory[idx][0]); - bfd_h_put_32 (abfd, extra->DataDirectory[idx].Size, - (bfd_byte *) aouthdr_out->DataDirectory[idx][1]); + H_PUT_32 (abfd, extra->DataDirectory[idx].VirtualAddress, + aouthdr_out->DataDirectory[idx][0]); + H_PUT_32 (abfd, extra->DataDirectory[idx].Size, + aouthdr_out->DataDirectory[idx][1]); } } @@ -829,58 +803,51 @@ _bfd_XXi_only_swap_filehdr_out (abfd, in filehdr_in->pe.dos_message[15] = 0x0; filehdr_in->pe.nt_signature = NT_SIGNATURE; - bfd_h_put_16 (abfd, filehdr_in->f_magic, (bfd_byte *) filehdr_out->f_magic); - bfd_h_put_16 (abfd, filehdr_in->f_nscns, (bfd_byte *) filehdr_out->f_nscns); + H_PUT_16 (abfd, filehdr_in->f_magic, filehdr_out->f_magic); + H_PUT_16 (abfd, filehdr_in->f_nscns, filehdr_out->f_nscns); - bfd_h_put_32 (abfd, time (0), (bfd_byte *) filehdr_out->f_timdat); - PUT_FILEHDR_SYMPTR (abfd, (bfd_vma) filehdr_in->f_symptr, - (bfd_byte *) filehdr_out->f_symptr); - bfd_h_put_32 (abfd, filehdr_in->f_nsyms, (bfd_byte *) filehdr_out->f_nsyms); - bfd_h_put_16 (abfd, filehdr_in->f_opthdr, (bfd_byte *) filehdr_out->f_opthdr); - bfd_h_put_16 (abfd, filehdr_in->f_flags, (bfd_byte *) filehdr_out->f_flags); + H_PUT_32 (abfd, time (0), filehdr_out->f_timdat); + PUT_FILEHDR_SYMPTR (abfd, filehdr_in->f_symptr, + filehdr_out->f_symptr); + H_PUT_32 (abfd, filehdr_in->f_nsyms, filehdr_out->f_nsyms); + H_PUT_16 (abfd, filehdr_in->f_opthdr, filehdr_out->f_opthdr); + H_PUT_16 (abfd, filehdr_in->f_flags, filehdr_out->f_flags); /* Put in extra dos header stuff. This data remains essentially constant, it just has to be tacked on to the beginning of all exes for NT. */ - bfd_h_put_16 (abfd, filehdr_in->pe.e_magic, (bfd_byte *) filehdr_out->e_magic); - bfd_h_put_16 (abfd, filehdr_in->pe.e_cblp, (bfd_byte *) filehdr_out->e_cblp); - bfd_h_put_16 (abfd, filehdr_in->pe.e_cp, (bfd_byte *) filehdr_out->e_cp); - bfd_h_put_16 (abfd, filehdr_in->pe.e_crlc, (bfd_byte *) filehdr_out->e_crlc); - bfd_h_put_16 (abfd, filehdr_in->pe.e_cparhdr, - (bfd_byte *) filehdr_out->e_cparhdr); - bfd_h_put_16 (abfd, filehdr_in->pe.e_minalloc, - (bfd_byte *) filehdr_out->e_minalloc); - bfd_h_put_16 (abfd, filehdr_in->pe.e_maxalloc, - (bfd_byte *) filehdr_out->e_maxalloc); - bfd_h_put_16 (abfd, filehdr_in->pe.e_ss, (bfd_byte *) filehdr_out->e_ss); - bfd_h_put_16 (abfd, filehdr_in->pe.e_sp, (bfd_byte *) filehdr_out->e_sp); - bfd_h_put_16 (abfd, filehdr_in->pe.e_csum, (bfd_byte *) filehdr_out->e_csum); - bfd_h_put_16 (abfd, filehdr_in->pe.e_ip, (bfd_byte *) filehdr_out->e_ip); - bfd_h_put_16 (abfd, filehdr_in->pe.e_cs, (bfd_byte *) filehdr_out->e_cs); - bfd_h_put_16 (abfd, filehdr_in->pe.e_lfarlc, (bfd_byte *) filehdr_out->e_lfarlc); - bfd_h_put_16 (abfd, filehdr_in->pe.e_ovno, (bfd_byte *) filehdr_out->e_ovno); + H_PUT_16 (abfd, filehdr_in->pe.e_magic, filehdr_out->e_magic); + H_PUT_16 (abfd, filehdr_in->pe.e_cblp, filehdr_out->e_cblp); + H_PUT_16 (abfd, filehdr_in->pe.e_cp, filehdr_out->e_cp); + H_PUT_16 (abfd, filehdr_in->pe.e_crlc, filehdr_out->e_crlc); + H_PUT_16 (abfd, filehdr_in->pe.e_cparhdr, filehdr_out->e_cparhdr); + H_PUT_16 (abfd, filehdr_in->pe.e_minalloc, filehdr_out->e_minalloc); + H_PUT_16 (abfd, filehdr_in->pe.e_maxalloc, filehdr_out->e_maxalloc); + H_PUT_16 (abfd, filehdr_in->pe.e_ss, filehdr_out->e_ss); + H_PUT_16 (abfd, filehdr_in->pe.e_sp, filehdr_out->e_sp); + H_PUT_16 (abfd, filehdr_in->pe.e_csum, filehdr_out->e_csum); + H_PUT_16 (abfd, filehdr_in->pe.e_ip, filehdr_out->e_ip); + H_PUT_16 (abfd, filehdr_in->pe.e_cs, filehdr_out->e_cs); + H_PUT_16 (abfd, filehdr_in->pe.e_lfarlc, filehdr_out->e_lfarlc); + H_PUT_16 (abfd, filehdr_in->pe.e_ovno, filehdr_out->e_ovno); for (idx = 0; idx < 4; idx++) - bfd_h_put_16 (abfd, filehdr_in->pe.e_res[idx], - (bfd_byte *) filehdr_out->e_res[idx]); + H_PUT_16 (abfd, filehdr_in->pe.e_res[idx], filehdr_out->e_res[idx]); - bfd_h_put_16 (abfd, filehdr_in->pe.e_oemid, (bfd_byte *) filehdr_out->e_oemid); - bfd_h_put_16 (abfd, filehdr_in->pe.e_oeminfo, - (bfd_byte *) filehdr_out->e_oeminfo); + H_PUT_16 (abfd, filehdr_in->pe.e_oemid, filehdr_out->e_oemid); + H_PUT_16 (abfd, filehdr_in->pe.e_oeminfo, filehdr_out->e_oeminfo); for (idx = 0; idx < 10; idx++) - bfd_h_put_16 (abfd, filehdr_in->pe.e_res2[idx], - (bfd_byte *) filehdr_out->e_res2[idx]); + H_PUT_16 (abfd, filehdr_in->pe.e_res2[idx], filehdr_out->e_res2[idx]); - bfd_h_put_32 (abfd, filehdr_in->pe.e_lfanew, (bfd_byte *) filehdr_out->e_lfanew); + H_PUT_32 (abfd, filehdr_in->pe.e_lfanew, filehdr_out->e_lfanew); for (idx = 0; idx < 16; idx++) - bfd_h_put_32 (abfd, filehdr_in->pe.dos_message[idx], - (bfd_byte *) filehdr_out->dos_message[idx]); + H_PUT_32 (abfd, filehdr_in->pe.dos_message[idx], + filehdr_out->dos_message[idx]); /* Also put in the NT signature. */ - bfd_h_put_32 (abfd, filehdr_in->pe.nt_signature, - (bfd_byte *) filehdr_out->nt_signature); + H_PUT_32 (abfd, filehdr_in->pe.nt_signature, filehdr_out->nt_signature); return FILHSZ; } @@ -894,14 +861,13 @@ _bfd_XX_only_swap_filehdr_out (abfd, in, struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in; FILHDR *filehdr_out = (FILHDR *) out; - bfd_h_put_16 (abfd, filehdr_in->f_magic, (bfd_byte *) filehdr_out->f_magic); - bfd_h_put_16 (abfd, filehdr_in->f_nscns, (bfd_byte *) filehdr_out->f_nscns); - bfd_h_put_32 (abfd, filehdr_in->f_timdat, (bfd_byte *) filehdr_out->f_timdat); - PUT_FILEHDR_SYMPTR (abfd, (bfd_vma) filehdr_in->f_symptr, - (bfd_byte *) filehdr_out->f_symptr); - bfd_h_put_32 (abfd, filehdr_in->f_nsyms, (bfd_byte *) filehdr_out->f_nsyms); - bfd_h_put_16 (abfd, filehdr_in->f_opthdr, (bfd_byte *) filehdr_out->f_opthdr); - bfd_h_put_16 (abfd, filehdr_in->f_flags, (bfd_byte *) filehdr_out->f_flags); + H_PUT_16 (abfd, filehdr_in->f_magic, filehdr_out->f_magic); + H_PUT_16 (abfd, filehdr_in->f_nscns, filehdr_out->f_nscns); + H_PUT_32 (abfd, filehdr_in->f_timdat, filehdr_out->f_timdat); + PUT_FILEHDR_SYMPTR (abfd, filehdr_in->f_symptr, filehdr_out->f_symptr); + H_PUT_32 (abfd, filehdr_in->f_nsyms, filehdr_out->f_nsyms); + H_PUT_16 (abfd, filehdr_in->f_opthdr, filehdr_out->f_opthdr); + H_PUT_16 (abfd, filehdr_in->f_flags, filehdr_out->f_flags); return FILHSZ; } @@ -924,7 +890,7 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out) ((scnhdr_int->s_vaddr - pe_data (abfd)->pe_opthdr.ImageBase) & 0xffffffff), - (bfd_byte *) scnhdr_ext->s_vaddr); + scnhdr_ext->s_vaddr); /* NT wants the size data to be rounded up to the next NT_FILE_ALIGNMENT, but zero if it has no content (as in .bss, @@ -941,17 +907,17 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out) } PUT_SCNHDR_SIZE (abfd, ss, - (bfd_byte *) scnhdr_ext->s_size); + scnhdr_ext->s_size); /* s_paddr in PE is really the virtual size. */ - PUT_SCNHDR_PADDR (abfd, ps, (bfd_byte *) scnhdr_ext->s_paddr); + PUT_SCNHDR_PADDR (abfd, ps, scnhdr_ext->s_paddr); PUT_SCNHDR_SCNPTR (abfd, scnhdr_int->s_scnptr, - (bfd_byte *) scnhdr_ext->s_scnptr); + scnhdr_ext->s_scnptr); PUT_SCNHDR_RELPTR (abfd, scnhdr_int->s_relptr, - (bfd_byte *) scnhdr_ext->s_relptr); + scnhdr_ext->s_relptr); PUT_SCNHDR_LNNOPTR (abfd, scnhdr_int->s_lnnoptr, - (bfd_byte *) scnhdr_ext->s_lnnoptr); + scnhdr_ext->s_lnnoptr); /* Extra flags must be set when dealing with NT. All sections should also have the IMAGE_SCN_MEM_READ (0x40000000) flag set. In addition, the @@ -970,7 +936,7 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out) { int flags = scnhdr_int->s_flags; - bfd_h_put_32 (abfd, flags, (bfd_byte *) scnhdr_ext->s_flags); + H_PUT_32 (abfd, flags, scnhdr_ext->s_flags); } if (coff_data (abfd)->link_info @@ -986,42 +952,37 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out) executables, but the 17-th bit has been observed to be there. Overflow is not an issue: a 4G-line program will overflow a bunch of other fields long before this! */ - bfd_h_put_16 (abfd, scnhdr_int->s_nlnno & 0xffff, - (bfd_byte *) scnhdr_ext->s_nlnno); - bfd_h_put_16 (abfd, scnhdr_int->s_nlnno >> 16, - (bfd_byte *) scnhdr_ext->s_nreloc); + H_PUT_16 (abfd, (scnhdr_int->s_nlnno & 0xffff), scnhdr_ext->s_nlnno); + H_PUT_16 (abfd, (scnhdr_int->s_nlnno >> 16), scnhdr_ext->s_nreloc); } else { if (scnhdr_int->s_nlnno <= 0xffff) - bfd_h_put_16 (abfd, scnhdr_int->s_nlnno, - (bfd_byte *) scnhdr_ext->s_nlnno); + H_PUT_16 (abfd, scnhdr_int->s_nlnno, scnhdr_ext->s_nlnno); else { (*_bfd_error_handler) (_("%s: line number overflow: 0x%lx > 0xffff"), bfd_get_filename (abfd), scnhdr_int->s_nlnno); bfd_set_error (bfd_error_file_truncated); - bfd_h_put_16 (abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nlnno); + H_PUT_16 (abfd, 0xffff, scnhdr_ext->s_nlnno); ret = 0; } if (scnhdr_int->s_nreloc <= 0xffff) - bfd_h_put_16 (abfd, scnhdr_int->s_nreloc, - (bfd_byte *) scnhdr_ext->s_nreloc); + H_PUT_16 (abfd, scnhdr_int->s_nreloc, scnhdr_ext->s_nreloc); else { /* PE can deal with large #s of relocs, but not here. */ - bfd_h_put_16 (abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nreloc); + H_PUT_16 (abfd, 0xffff, scnhdr_ext->s_nreloc); scnhdr_int->s_flags |= IMAGE_SCN_LNK_NRELOC_OVFL; - bfd_h_put_32 (abfd, scnhdr_int->s_flags, - (bfd_byte *) scnhdr_ext->s_flags); + 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); - bfd_h_put_16 (abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nreloc); + H_PUT_16 (abfd, 0xffff, scnhdr_ext->s_nreloc); ret = 0; #endif } @@ -1074,6 +1035,7 @@ pe_print_idata (abfd, vfile) bfd_size_type datasize = 0; bfd_size_type dataoff; bfd_size_type i; + bfd_size_type amt; int onaline = 20; pe_data_type *pe = pe_data (abfd); @@ -1135,15 +1097,13 @@ pe_print_idata (abfd, vfile) bfd_byte *data = 0; int offset; - data = (bfd_byte *) bfd_malloc ((size_t) bfd_section_size (abfd, - rel_section)); - if (data == NULL && bfd_section_size (abfd, rel_section) != 0) + amt = bfd_section_size (abfd, rel_section); + data = (bfd_byte *) bfd_malloc (amt); + if (data == NULL && amt != 0) return false; - bfd_get_section_contents (abfd, - rel_section, - (PTR) data, 0, - bfd_section_size (abfd, rel_section)); + bfd_get_section_contents (abfd, rel_section, (PTR) data, (bfd_vma) 0, + amt); offset = abfd->start_address - rel_section->vma; @@ -1173,13 +1133,13 @@ pe_print_idata (abfd, vfile) fprintf (file, _(" Table Stamp Chain Name Thunk\n")); - data = (bfd_byte *) bfd_malloc (dataoff + datasize); + amt = dataoff + datasize; + data = (bfd_byte *) bfd_malloc (amt); if (data == NULL) return false; /* Read the whole section. Some of the fields might be before dataoff. */ - if (! bfd_get_section_contents (abfd, section, (PTR) data, - 0, dataoff + datasize)) + if (! bfd_get_section_contents (abfd, section, (PTR) data, (bfd_vma) 0, amt)) return false; adj = section->vma - extra->ImageBase; @@ -1397,8 +1357,8 @@ pe_print_edata (abfd, vfile) if (data == NULL) return false; - if (! bfd_get_section_contents (abfd, section, (PTR) data, dataoff, - datasize)) + if (! bfd_get_section_contents (abfd, section, (PTR) data, + (file_ptr) dataoff, datasize)) return false; /* Go get Export Directory Table. */ @@ -1585,18 +1545,16 @@ pe_print_pdata (abfd, vfile) _(" \t\tAddress Address Handler Data Address Mask\n")); #endif - if (bfd_section_size (abfd, section) == 0) + datasize = bfd_section_size (abfd, section); + if (datasize == 0) return true; - data = (bfd_byte *) bfd_malloc ((size_t) bfd_section_size (abfd, section)); - datasize = bfd_section_size (abfd, section); + data = (bfd_byte *) bfd_malloc (datasize); if (data == NULL && datasize != 0) return false; - bfd_get_section_contents (abfd, - section, - (PTR) data, 0, - bfd_section_size (abfd, section)); + bfd_get_section_contents (abfd, section, (PTR) data, (bfd_vma) 0, + datasize); start = 0; @@ -1699,7 +1657,7 @@ pe_print_reloc (abfd, vfile) FILE *file = (FILE *) vfile; bfd_byte *data = 0; asection *section = bfd_get_section_by_name (abfd, ".reloc"); - bfd_size_type datasize = 0; + bfd_size_type datasize; bfd_size_type i; bfd_size_type start, stop; @@ -1712,15 +1670,13 @@ pe_print_reloc (abfd, vfile) fprintf (file, _("\n\nPE File Base Relocations (interpreted .reloc section contents)\n")); - data = (bfd_byte *) bfd_malloc ((size_t) bfd_section_size (abfd, section)); datasize = bfd_section_size (abfd, section); + data = (bfd_byte *) bfd_malloc (datasize); if (data == NULL && datasize != 0) return false; - bfd_get_section_contents (abfd, - section, - (PTR) data, 0, - bfd_section_size (abfd, section)); + bfd_get_section_contents (abfd, section, (PTR) data, (bfd_vma) 0, + datasize); start = 0; @@ -1935,16 +1891,16 @@ _bfd_XX_bfd_copy_private_section_data (i { if (coff_section_data (obfd, osec) == NULL) { - osec->used_by_bfd = - (PTR) bfd_zalloc (obfd, sizeof (struct coff_section_tdata)); + bfd_size_type amt = sizeof (struct coff_section_tdata); + osec->used_by_bfd = (PTR) bfd_zalloc (obfd, amt); if (osec->used_by_bfd == NULL) return false; } if (pei_section_data (obfd, osec) == NULL) { - coff_section_data (obfd, osec)->tdata = - (PTR) bfd_zalloc (obfd, sizeof (struct pei_section_tdata)); + bfd_size_type amt = sizeof (struct pei_section_tdata); + coff_section_data (obfd, osec)->tdata = (PTR) bfd_zalloc (obfd, amt); if (coff_section_data (obfd, osec)->tdata == NULL) return false; } diff -uprN binutils-2.11.90.0.31/bfd/peicode.h binutils-2.11.92.0.5/bfd/peicode.h --- binutils-2.11.90.0.31/bfd/peicode.h Fri Jul 6 09:26:11 2001 +++ binutils-2.11.92.0.5/bfd/peicode.h Mon Oct 1 15:25:21 2001 @@ -139,7 +139,7 @@ static void pe_ILF_make_a_ static void pe_ILF_make_a_symbol PARAMS ((pe_ILF_vars *, const char *, const char *, asection_ptr, flagword)); static void pe_ILF_save_relocs PARAMS ((pe_ILF_vars *, asection_ptr)); static void pe_ILF_make_a_symbol_reloc PARAMS ((pe_ILF_vars *, bfd_vma, bfd_reloc_code_real_type, struct symbol_cache_entry **, unsigned int)); -static boolean pe_ILF_build_a_bfd PARAMS ((bfd *, unsigned short, bfd_byte *, bfd_byte *, unsigned int, unsigned int)); +static boolean pe_ILF_build_a_bfd PARAMS ((bfd *, unsigned int, bfd_byte *, bfd_byte *, unsigned int, unsigned int)); static const bfd_target * pe_ILF_object_p PARAMS ((bfd *)); static const bfd_target * pe_bfd_object_p PARAMS ((bfd *)); #endif /* COFF_IMAGE_WITH_PE */ @@ -156,14 +156,13 @@ coff_swap_reloc_in (abfd, src, dst) RELOC *reloc_src = (RELOC *) src; struct internal_reloc *reloc_dst = (struct internal_reloc *) dst; - reloc_dst->r_vaddr = bfd_h_get_32(abfd, (bfd_byte *)reloc_src->r_vaddr); - reloc_dst->r_symndx = bfd_h_get_signed_32(abfd, (bfd_byte *) reloc_src->r_symndx); + reloc_dst->r_vaddr = H_GET_32 (abfd, reloc_src->r_vaddr); + reloc_dst->r_symndx = H_GET_S32 (abfd, reloc_src->r_symndx); - reloc_dst->r_type = bfd_h_get_16(abfd, (bfd_byte *) reloc_src->r_type); + reloc_dst->r_type = H_GET_16 (abfd, reloc_src->r_type); #ifdef SWAP_IN_RELOC_OFFSET - reloc_dst->r_offset = SWAP_IN_RELOC_OFFSET(abfd, - (bfd_byte *) reloc_src->r_offset); + reloc_dst->r_offset = SWAP_IN_RELOC_OFFSET (abfd, reloc_src->r_offset); #endif } @@ -175,19 +174,16 @@ coff_swap_reloc_out (abfd, src, dst) { struct internal_reloc *reloc_src = (struct internal_reloc *)src; struct external_reloc *reloc_dst = (struct external_reloc *)dst; - bfd_h_put_32(abfd, reloc_src->r_vaddr, (bfd_byte *) reloc_dst->r_vaddr); - bfd_h_put_32(abfd, reloc_src->r_symndx, (bfd_byte *) reloc_dst->r_symndx); + H_PUT_32 (abfd, reloc_src->r_vaddr, reloc_dst->r_vaddr); + H_PUT_32 (abfd, reloc_src->r_symndx, reloc_dst->r_symndx); - bfd_h_put_16(abfd, reloc_src->r_type, (bfd_byte *) - reloc_dst->r_type); + H_PUT_16 (abfd, reloc_src->r_type, reloc_dst->r_type); #ifdef SWAP_OUT_RELOC_OFFSET - SWAP_OUT_RELOC_OFFSET(abfd, - reloc_src->r_offset, - (bfd_byte *) reloc_dst->r_offset); + SWAP_OUT_RELOC_OFFSET (abfd, reloc_src->r_offset, reloc_dst->r_offset); #endif #ifdef SWAP_OUT_RELOC_EXTRA - SWAP_OUT_RELOC_EXTRA(abfd,reloc_src, reloc_dst); + SWAP_OUT_RELOC_EXTRA(abfd, reloc_src, reloc_dst); #endif return RELSZ; } @@ -201,13 +197,13 @@ coff_swap_filehdr_in (abfd, src, dst) { FILHDR *filehdr_src = (FILHDR *) src; struct internal_filehdr *filehdr_dst = (struct internal_filehdr *) dst; - filehdr_dst->f_magic = bfd_h_get_16(abfd, (bfd_byte *) filehdr_src->f_magic); - filehdr_dst->f_nscns = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_nscns); - filehdr_dst->f_timdat = bfd_h_get_32(abfd, (bfd_byte *)filehdr_src-> f_timdat); - - filehdr_dst->f_nsyms = bfd_h_get_32(abfd, (bfd_byte *)filehdr_src-> f_nsyms); - filehdr_dst->f_flags = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_flags); - filehdr_dst->f_symptr = bfd_h_get_32 (abfd, (bfd_byte *) filehdr_src->f_symptr); + filehdr_dst->f_magic = H_GET_16 (abfd, filehdr_src->f_magic); + filehdr_dst->f_nscns = H_GET_16 (abfd, filehdr_src-> f_nscns); + filehdr_dst->f_timdat = H_GET_32 (abfd, filehdr_src-> f_timdat); + + filehdr_dst->f_nsyms = H_GET_32 (abfd, filehdr_src-> f_nsyms); + filehdr_dst->f_flags = H_GET_16 (abfd, filehdr_src-> f_flags); + filehdr_dst->f_symptr = H_GET_32 (abfd, filehdr_src->f_symptr); /* Other people's tools sometimes generate headers with an nsyms but a zero symptr. */ @@ -217,8 +213,7 @@ coff_swap_filehdr_in (abfd, src, dst) filehdr_dst->f_flags |= F_LSYMS; } - filehdr_dst->f_opthdr = bfd_h_get_16(abfd, - (bfd_byte *)filehdr_src-> f_opthdr); + filehdr_dst->f_opthdr = H_GET_16 (abfd, filehdr_src-> f_opthdr); } #ifdef COFF_IMAGE_WITH_PE @@ -237,33 +232,24 @@ coff_swap_scnhdr_in (abfd, ext, in) struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in; memcpy(scnhdr_int->s_name, scnhdr_ext->s_name, sizeof (scnhdr_int->s_name)); - scnhdr_int->s_vaddr = - GET_SCNHDR_VADDR (abfd, (bfd_byte *) scnhdr_ext->s_vaddr); - scnhdr_int->s_paddr = - GET_SCNHDR_PADDR (abfd, (bfd_byte *) scnhdr_ext->s_paddr); - scnhdr_int->s_size = - GET_SCNHDR_SIZE (abfd, (bfd_byte *) scnhdr_ext->s_size); - scnhdr_int->s_scnptr = - GET_SCNHDR_SCNPTR (abfd, (bfd_byte *) scnhdr_ext->s_scnptr); - scnhdr_int->s_relptr = - GET_SCNHDR_RELPTR (abfd, (bfd_byte *) scnhdr_ext->s_relptr); - scnhdr_int->s_lnnoptr = - GET_SCNHDR_LNNOPTR (abfd, (bfd_byte *) scnhdr_ext->s_lnnoptr); - scnhdr_int->s_flags = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_flags); + scnhdr_int->s_vaddr = GET_SCNHDR_VADDR (abfd, scnhdr_ext->s_vaddr); + scnhdr_int->s_paddr = GET_SCNHDR_PADDR (abfd, scnhdr_ext->s_paddr); + scnhdr_int->s_size = GET_SCNHDR_SIZE (abfd, scnhdr_ext->s_size); + scnhdr_int->s_scnptr = GET_SCNHDR_SCNPTR (abfd, scnhdr_ext->s_scnptr); + scnhdr_int->s_relptr = GET_SCNHDR_RELPTR (abfd, scnhdr_ext->s_relptr); + scnhdr_int->s_lnnoptr = GET_SCNHDR_LNNOPTR (abfd, scnhdr_ext->s_lnnoptr); + scnhdr_int->s_flags = H_GET_32 (abfd, scnhdr_ext->s_flags); /* MS handles overflow of line numbers by carrying into the reloc field (it appears). Since it's supposed to be zero for PE *IMAGE* format, that's safe. This is still a bit iffy. */ #ifdef COFF_IMAGE_WITH_PE - scnhdr_int->s_nlnno = - (bfd_h_get_16 (abfd, (bfd_byte *) scnhdr_ext->s_nlnno) - + (bfd_h_get_16 (abfd, (bfd_byte *) scnhdr_ext->s_nreloc) << 16)); + scnhdr_int->s_nlnno = (H_GET_16 (abfd, scnhdr_ext->s_nlnno) + + (H_GET_16 (abfd, scnhdr_ext->s_nreloc) << 16)); scnhdr_int->s_nreloc = 0; #else - scnhdr_int->s_nreloc = bfd_h_get_16 (abfd, - (bfd_byte *) scnhdr_ext->s_nreloc); - scnhdr_int->s_nlnno = bfd_h_get_16 (abfd, - (bfd_byte *) scnhdr_ext->s_nlnno); + scnhdr_int->s_nreloc = H_GET_16 (abfd, scnhdr_ext->s_nreloc); + scnhdr_int->s_nlnno = H_GET_16 (abfd, scnhdr_ext->s_nlnno); #endif if (scnhdr_int->s_vaddr != 0) @@ -292,8 +278,9 @@ pe_mkobject (abfd) bfd * abfd; { pe_data_type *pe; - abfd->tdata.pe_obj_data = - (struct pe_tdata *) bfd_zalloc (abfd, sizeof (pe_data_type)); + bfd_size_type amt = sizeof (pe_data_type); + + abfd->tdata.pe_obj_data = (struct pe_tdata *) bfd_zalloc (abfd, amt); if (abfd->tdata.pe_obj_data == 0) return false; @@ -541,7 +528,7 @@ pe_ILF_save_relocs (pe_ILF_vars * vars, vars->int_reltab += vars->relcount; vars->relcount = 0; - BFD_ASSERT ((bfd_byte *)vars->int_reltab < (bfd_byte *)vars->string_table); + BFD_ASSERT ((bfd_byte *) vars->int_reltab < (bfd_byte *) vars->string_table); } /* Create a global symbol and add it to the relevant tables. */ @@ -587,8 +574,9 @@ pe_ILF_make_a_symbol (pe_ILF_vars * var section = (asection_ptr) & bfd_und_section; /* Initialise the external symbol. */ - bfd_h_put_32 (vars->abfd, vars->string_ptr - vars->string_table, (bfd_byte *) esym->e.e.e_offset); - bfd_h_put_16 (vars->abfd, section->target_index, (bfd_byte *) esym->e_scnum); + H_PUT_32 (vars->abfd, vars->string_ptr - vars->string_table, + esym->e.e.e_offset); + H_PUT_16 (vars->abfd, section->target_index, esym->e_scnum); esym->e_sclass[0] = sclass; /* The following initialisations are unnecessary - the memory is @@ -666,7 +654,7 @@ pe_ILF_make_a_section (pe_ILF_vars * var /* Set the section size and contents. The actual contents are filled in by our parent. */ - bfd_set_section_size (vars->abfd, sec, size); + bfd_set_section_size (vars->abfd, sec, (bfd_size_type) size); sec->contents = vars->data; sec->target_index = vars->sec_index ++; @@ -767,7 +755,7 @@ static jump_table jtab[] = /* Build a full BFD from the information supplied in a ILF object. */ static boolean pe_ILF_build_a_bfd (bfd * abfd, - unsigned short magic, + unsigned int magic, bfd_byte * symbol_name, bfd_byte * source_dll, unsigned int ordinal, @@ -795,12 +783,12 @@ pe_ILF_build_a_bfd (bfd * abfd case IMPORT_CONST: /* XXX code yet to be written. */ _bfd_error_handler (_("%s: Unhandled import type; %x"), - bfd_get_filename (abfd), import_type); + bfd_archive_filename (abfd), import_type); return false; default: _bfd_error_handler (_("%s: Unrecognised import type; %x"), - bfd_get_filename (abfd), import_type); + bfd_archive_filename (abfd), import_type); return false; } @@ -814,7 +802,7 @@ pe_ILF_build_a_bfd (bfd * abfd default: _bfd_error_handler (_("%s: Unrecognised import name type; %x"), - bfd_get_filename (abfd), import_name_type); + bfd_archive_filename (abfd), import_name_type); return false; } @@ -825,7 +813,7 @@ pe_ILF_build_a_bfd (bfd * abfd We are going to construct the contents of the BFD in memory, so allocate all the space that we will need right now. */ - ptr = bfd_zalloc (abfd, ILF_DATA_SIZE); + ptr = bfd_zalloc (abfd, (bfd_size_type) ILF_DATA_SIZE); if (ptr == NULL) return false; @@ -933,11 +921,11 @@ pe_ILF_build_a_bfd (bfd * abfd if (import_name_type != IMPORT_ORDINAL) { - pe_ILF_make_a_reloc (& vars, 0, BFD_RELOC_RVA, id6); - pe_ILF_save_relocs (& vars, id4); + pe_ILF_make_a_reloc (&vars, (bfd_vma) 0, BFD_RELOC_RVA, id6); + pe_ILF_save_relocs (&vars, id4); - pe_ILF_make_a_reloc (& vars, 0, BFD_RELOC_RVA, id6); - pe_ILF_save_relocs (& vars, id5); + pe_ILF_make_a_reloc (&vars, (bfd_vma) 0, BFD_RELOC_RVA, id6); + pe_ILF_save_relocs (&vars, id5); } /* Create extra sections depending upon the type of import we are dealing with. */ @@ -976,16 +964,19 @@ pe_ILF_build_a_bfd (bfd * abfd #ifdef MIPS_ARCH_MAGIC_WINCE if (magic == MIPS_ARCH_MAGIC_WINCE) { - pe_ILF_make_a_symbol_reloc (& vars, 0, BFD_RELOC_HI16_S, - (struct symbol_cache_entry **) imp_sym, imp_index); - pe_ILF_make_a_reloc (& vars, 0, BFD_RELOC_LO16, text); - pe_ILF_make_a_symbol_reloc (& vars, 4, BFD_RELOC_LO16, - (struct symbol_cache_entry **) imp_sym, imp_index); + pe_ILF_make_a_symbol_reloc (&vars, (bfd_vma) 0, BFD_RELOC_HI16_S, + (struct symbol_cache_entry **) imp_sym, + imp_index); + pe_ILF_make_a_reloc (&vars, (bfd_vma) 0, BFD_RELOC_LO16, text); + pe_ILF_make_a_symbol_reloc (&vars, (bfd_vma) 4, BFD_RELOC_LO16, + (struct symbol_cache_entry **) imp_sym, + imp_index); } else #endif - pe_ILF_make_a_symbol_reloc (& vars, jtab[i].offset, BFD_RELOC_32, - (asymbol **) imp_sym, imp_index); + pe_ILF_make_a_symbol_reloc (&vars, (bfd_vma) jtab[i].offset, + BFD_RELOC_32, (asymbol **) imp_sym, + imp_index); pe_ILF_save_relocs (& vars, text); break; @@ -1006,7 +997,7 @@ pe_ILF_build_a_bfd (bfd * abfd internal_f.f_nsyms = 0; internal_f.f_flags = F_AR32WR | F_LNNO; /* XXX is this correct ? */ - if ( ! bfd_set_start_address (abfd, 0) + if ( ! bfd_set_start_address (abfd, (bfd_vma) 0) || ! bfd_coff_set_arch_mach_hook (abfd, & internal_f)) return false; @@ -1031,8 +1022,6 @@ pe_ILF_build_a_bfd (bfd * abfd /* Now create a symbol describing the imported value. */ switch (import_type) { - bfd_byte * ptr; - case IMPORT_CODE: pe_ILF_make_a_symbol (& vars, "", symbol_name, text, BSF_NOT_AT_END | BSF_FUNCTION); @@ -1087,23 +1076,23 @@ pe_ILF_object_p (bfd * abfd) bfd_byte * symbol_name; bfd_byte * source_dll; unsigned int machine; - unsigned long size; + bfd_size_type size; unsigned int ordinal; unsigned int types; - unsigned short magic; + unsigned int magic; /* Upon entry the first four buyes of the ILF header have already been read. Now read the rest of the header. */ - if (bfd_read (buffer, 1, 16, abfd) != 16) + if (bfd_bread (buffer, (bfd_size_type) 16, abfd) != 16) return NULL; ptr = buffer; /* We do not bother to check the version number. - version = bfd_h_get_16 (abfd, ptr); */ + version = H_GET_16 (abfd, ptr); */ ptr += 2; - machine = bfd_h_get_16 (abfd, ptr); + machine = H_GET_16 (abfd, ptr); ptr += 2; /* Check that the machine type is recognised. */ @@ -1171,7 +1160,7 @@ pe_ILF_object_p (bfd * abfd) _bfd_error_handler ( _("%s: Unrecognised machine type (0x%x) in Import Library Format archive"), - bfd_get_filename (abfd), machine); + bfd_archive_filename (abfd), machine); bfd_set_error (bfd_error_malformed_archive); return NULL; @@ -1183,33 +1172,33 @@ _("%s: Unrecognised machine type (0x%x) _bfd_error_handler ( _("%s: Recognised but unhandled machine type (0x%x) in Import Library Format archive"), - bfd_get_filename (abfd), machine); + bfd_archive_filename (abfd), machine); bfd_set_error (bfd_error_wrong_format); return NULL; } /* We do not bother to check the date. - date = bfd_h_get_32 (abfd, ptr); */ + date = H_GET_32 (abfd, ptr); */ ptr += 4; - size = bfd_h_get_32 (abfd, ptr); + size = H_GET_32 (abfd, ptr); ptr += 4; if (size == 0) { _bfd_error_handler (_("%s: size field is zero in Import Library Format header"), - bfd_get_filename (abfd)); + bfd_archive_filename (abfd)); bfd_set_error (bfd_error_malformed_archive); return NULL; } - ordinal = bfd_h_get_16 (abfd, ptr); + ordinal = H_GET_16 (abfd, ptr); ptr += 2; - types = bfd_h_get_16 (abfd, ptr); + types = H_GET_16 (abfd, ptr); /* ptr += 2; */ /* Now read in the two strings that follow. */ @@ -1217,7 +1206,7 @@ _("%s: Recognised but unhandled machine if (ptr == NULL) return NULL; - if (bfd_read (ptr, 1, size, abfd) != size) + if (bfd_bread (ptr, size, abfd) != size) return NULL; symbol_name = ptr; @@ -1228,7 +1217,7 @@ _("%s: Recognised but unhandled machine { _bfd_error_handler (_("%s: string not null terminated in ILF object file."), - bfd_get_filename (abfd)); + bfd_archive_filename (abfd)); bfd_set_error (bfd_error_malformed_archive); return NULL; @@ -1251,19 +1240,19 @@ pe_bfd_object_p (bfd * abfd) file_ptr offset; /* Detect if this a Microsoft Import Library Format element. */ - if (bfd_seek (abfd, 0x00, SEEK_SET) != 0 - || bfd_read (buffer, 1, 4, abfd) != 4) + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 + || bfd_bread (buffer, (bfd_size_type) 4, abfd) != 4) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); return NULL; } - if (bfd_h_get_32 (abfd, buffer) == 0xffff0000) + if (H_GET_32 (abfd, buffer) == 0xffff0000) return pe_ILF_object_p (abfd); - if (bfd_seek (abfd, 0x00, SEEK_SET) != 0 - || bfd_read (&dos_hdr, 1, sizeof (dos_hdr), abfd) + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 + || bfd_bread (&dos_hdr, (bfd_size_type) sizeof (dos_hdr), abfd) != sizeof (dos_hdr)) { if (bfd_get_error () != bfd_error_system_call) @@ -1281,24 +1270,23 @@ pe_bfd_object_p (bfd * abfd) correctly for a PEI file, check the e_magic number here, and, if it doesn't match, clobber the f_magic number so that we don't get a false match. */ - if (bfd_h_get_16 (abfd, (bfd_byte *) dos_hdr.e_magic) != DOSMAGIC) + if (H_GET_16 (abfd, dos_hdr.e_magic) != DOSMAGIC) { bfd_set_error (bfd_error_wrong_format); return NULL; } - offset = bfd_h_get_32 (abfd, (bfd_byte *) dos_hdr.e_lfanew); - if (bfd_seek (abfd, (file_ptr) offset, SEEK_SET) != 0 - || bfd_read (&image_hdr, 1, sizeof (image_hdr), abfd) - != sizeof (image_hdr)) + offset = H_GET_32 (abfd, dos_hdr.e_lfanew); + if (bfd_seek (abfd, offset, SEEK_SET) != 0 + || (bfd_bread (&image_hdr, (bfd_size_type) sizeof (image_hdr), abfd) + != sizeof (image_hdr))) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); return NULL; } - if (bfd_h_get_32 (abfd, (bfd_byte *) image_hdr.nt_signature) - != 0x4550) + if (H_GET_32 (abfd, image_hdr.nt_signature) != 0x4550) { bfd_set_error (bfd_error_wrong_format); return NULL; @@ -1307,10 +1295,7 @@ pe_bfd_object_p (bfd * abfd) /* Here is the hack. coff_object_p wants to read filhsz bytes to pick up the COFF header for PE, see "struct external_PEI_filehdr" in include/coff/pe.h. We adjust so that that will work. */ - if (bfd_seek (abfd, - (file_ptr) (offset - sizeof (dos_hdr)), - SEEK_SET) - != 0) + if (bfd_seek (abfd, (file_ptr) (offset - sizeof (dos_hdr)), SEEK_SET) != 0) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); diff -uprN binutils-2.11.90.0.31/bfd/po/SRC-POTFILES.in binutils-2.11.92.0.5/bfd/po/SRC-POTFILES.in --- binutils-2.11.90.0.31/bfd/po/SRC-POTFILES.in Tue Jun 19 11:57:33 2001 +++ binutils-2.11.92.0.5/bfd/po/SRC-POTFILES.in Thu Oct 4 14:35:43 2001 @@ -1,15 +1,15 @@ aix386-core.c -aout0.c -aout32.c -aout64.c aout-adobe.c aout-arm.c aout-cris.c -aoutf1.h aout-ns32k.c aout-sparcle.c aout-target.h aout-tic30.c +aout0.c +aout32.c +aout64.c +aoutf1.h aoutx.h archive.c archures.c @@ -22,21 +22,17 @@ cf-i386lynx.c cf-m68klynx.c cf-sparclynx.c cisco-core.c -coff64-rs6000.c coff-a29k.c coff-alpha.c coff-apollo.c coff-arm.c coff-aux.c -coffcode.h -coffgen.c coff-go32.c coff-h8300.c coff-h8500.c coff-i386.c coff-i860.c coff-i960.c -cofflink.c coff-m68k.c coff-m88k.c coff-mips.c @@ -45,7 +41,6 @@ coff-sh.c coff-sparc.c coff-stgo32.c coff-svm68k.c -coffswap.h coff-tic30.c coff-tic54x.c coff-tic80.c @@ -53,6 +48,11 @@ coff-u68k.c coff-w65.c coff-we32k.c coff-z8k.c +coff64-rs6000.c +coffcode.h +coffgen.c +cofflink.c +coffswap.h corefile.c cpu-a29k.c cpu-alpha.c @@ -105,15 +105,20 @@ ecofflink.c ecoffswap.h efi-app-ia32.c efi-app-ia64.c +elf-bfd.h +elf-hppa.h +elf-m10200.c +elf-m10300.c +elf.c elf32-arc.c elf32-arm.h elf32-avr.c -elf32.c elf32-cris.c elf32-d10v.c elf32-d30v.c elf32-fr30.c elf32-gen.c +elf32-h8300.c elf32-hppa.c elf32-hppa.h elf32-i370.c @@ -131,30 +136,27 @@ elf32-openrisc.c elf32-pj.c elf32-ppc.c elf32-s390.c -elf32-sh.c elf32-sh-lin.c +elf32-sh.c elf32-sparc.c elf32-v850.c +elf32.c elf64-alpha.c -elf64.c elf64-gen.c elf64-hppa.c elf64-hppa.h elf64-mips.c +elf64-ppc.c elf64-s390.c elf64-sparc.c elf64-x86-64.c +elf64.c elfarm-nabi.c elfarm-oabi.c -elf-bfd.h -elf.c elfcode.h elfcore.h -elf-hppa.h elflink.c elflink.h -elf-m10200.c -elf-m10300.c epoc-pe-arm.c epoc-pei-arm.c format.c @@ -201,16 +203,16 @@ merge.c mipsbsd.c netbsd.h newsos3.c +nlm-target.h +nlm.c nlm32-alpha.c -nlm32.c nlm32-i386.c nlm32-ppc.c nlm32-sparc.c +nlm32.c nlm64.c -nlm.c nlmcode.h nlmswap.h -nlm-target.h ns32k.h ns32knetbsd.c oasys.c @@ -220,20 +222,20 @@ pc532-mach.c pdp11.c pe-arm.c pe-i386.c +pe-mcore.c +pe-mips.c +pe-ppc.c +pe-sh.c pei-arm.c -peicode.h pei-i386.c pei-mcore.c pei-mips.c pei-ppc.c pei-sh.c -pe-mcore.c -pe-mips.c -pe-ppc.c -pe-sh.c +peicode.h ppcboot.c -reloc16.c reloc.c +reloc16.c riscix.c sco5-core.c section.c @@ -243,8 +245,8 @@ sparclinux.c sparclynx.c sparcnetbsd.c srec.c -stabs.c stab-syms.c +stabs.c sunos.c syms.c targets.c @@ -252,11 +254,12 @@ tekhex.c trad-core.c vaxnetbsd.c versados.c -vms.c +version.h vms-gsd.c -vms.h vms-hdr.c vms-misc.c vms-tir.c -xcofflink.c +vms.c +vms.h xcoff-target.h +xcofflink.c diff -uprN binutils-2.11.90.0.31/bfd/ppcboot.c binutils-2.11.92.0.5/bfd/ppcboot.c --- binutils-2.11.90.0.31/bfd/ppcboot.c Sat May 12 00:05:35 2001 +++ binutils-2.11.92.0.5/bfd/ppcboot.c Mon Oct 1 15:25:21 2001 @@ -32,8 +32,7 @@ Foundation, Inc., 59 Temple Place - Suit the file. objcopy cooperates by specially setting the start address to zero by default. */ -#include - +#include "safe-ctype.h" #include "bfd.h" #include "sysdep.h" #include "libbfd.h" @@ -114,7 +113,10 @@ ppcboot_mkobject (abfd) bfd *abfd; { if (!ppcboot_get_tdata (abfd)) - ppcboot_set_tdata (abfd, bfd_zalloc (abfd, sizeof (ppcboot_data_t))); + { + bfd_size_type amt = sizeof (ppcboot_data_t); + ppcboot_set_tdata (abfd, bfd_zalloc (abfd, amt)); + } return true; } @@ -172,7 +174,8 @@ ppcboot_object_p (abfd) return NULL; } - if (bfd_read ((PTR) &hdr, sizeof (hdr), 1, abfd) != sizeof (hdr)) + if (bfd_bread ((PTR) &hdr, (bfd_size_type) sizeof (hdr), abfd) + != sizeof (hdr)) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -216,7 +219,7 @@ ppcboot_object_p (abfd) tdata->sec = sec; memcpy ((PTR) &tdata->header, (PTR) &hdr, sizeof (ppcboot_hdr_t)); - ppcboot_set_arch_mach (abfd, bfd_arch_powerpc, 0); + ppcboot_set_arch_mach (abfd, bfd_arch_powerpc, 0L); return abfd->xvec; } @@ -235,8 +238,8 @@ ppcboot_get_section_contents (abfd, sect file_ptr offset; bfd_size_type count; { - if (bfd_seek (abfd, offset + sizeof (ppcboot_hdr_t), SEEK_SET) != 0 - || bfd_read (location, 1, count, abfd) != count) + if (bfd_seek (abfd, offset + (file_ptr) sizeof (ppcboot_hdr_t), SEEK_SET) != 0 + || bfd_bread (location, count, abfd) != count) return false; return true; } @@ -259,7 +262,7 @@ mangle_name (abfd, suffix) bfd *abfd; char *suffix; { - int size; + bfd_size_type size; char *buf; char *p; @@ -275,7 +278,7 @@ mangle_name (abfd, suffix) /* Change any non-alphanumeric characters to underscores. */ for (p = buf; *p; p++) - if (! isalnum ((unsigned char) *p)) + if (! ISALNUM (*p)) *p = '_'; return buf; @@ -292,8 +295,9 @@ ppcboot_get_symtab (abfd, alocation) asection *sec = ppcboot_get_tdata (abfd)->sec; asymbol *syms; unsigned int i; + bfd_size_type amt = PPCBOOT_SYMS * sizeof (asymbol); - syms = (asymbol *) bfd_alloc (abfd, PPCBOOT_SYMS * sizeof (asymbol)); + syms = (asymbol *) bfd_alloc (abfd, amt); if (syms == NULL) return false; @@ -335,7 +339,7 @@ static asymbol * ppcboot_make_empty_symbol (abfd) bfd *abfd; { - return (asymbol *) bfd_alloc (abfd, sizeof (asymbol)); + return (asymbol *) bfd_alloc (abfd, (bfd_size_type) sizeof (asymbol)); } diff -uprN binutils-2.11.90.0.31/bfd/ptrace-core.c binutils-2.11.92.0.5/bfd/ptrace-core.c --- binutils-2.11.90.0.31/bfd/ptrace-core.c Fri Mar 9 11:16:06 2001 +++ binutils-2.11.92.0.5/bfd/ptrace-core.c Mon Oct 1 15:25:21 2001 @@ -64,8 +64,9 @@ ptrace_unix_core_file_p (abfd) int val; struct ptrace_user u; struct trad_core_struct *rawptr; + bfd_size_type amt; - val = bfd_read ((void *)&u, 1, sizeof u, abfd); + val = bfd_bread ((void *)&u, (bfd_size_type) sizeof u, abfd); if (val != sizeof u || u.pt_magic != _BCS_PTRACE_MAGIC || u.pt_rev != _BCS_PTRACE_REV) { @@ -78,8 +79,8 @@ ptrace_unix_core_file_p (abfd) /* Allocate both the upage and the struct core_data at once, so a single free() will free them both. */ - rawptr = (struct trad_core_struct *) - bfd_zalloc (abfd, sizeof (struct trad_core_struct)); + amt = sizeof (struct trad_core_struct); + rawptr = (struct trad_core_struct *) bfd_zalloc (abfd, amt); if (rawptr == NULL) return 0; @@ -91,13 +92,14 @@ ptrace_unix_core_file_p (abfd) /* Create the sections. This is raunchy, but bfd_close wants to free them separately. */ - core_stacksec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection)); + amt = sizeof (asection); + core_stacksec (abfd) = (asection *) bfd_zalloc (abfd, amt); if (core_stacksec (abfd) == NULL) return NULL; - core_datasec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection)); + core_datasec (abfd) = (asection *) bfd_zalloc (abfd, amt); if (core_datasec (abfd) == NULL) return NULL; - core_regsec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection)); + core_regsec (abfd) = (asection *) bfd_zalloc (abfd, amt); if (core_regsec (abfd) == NULL) return NULL; diff -uprN binutils-2.11.90.0.31/bfd/reloc.c binutils-2.11.92.0.5/bfd/reloc.c --- binutils-2.11.90.0.31/bfd/reloc.c Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/bfd/reloc.c Mon Oct 1 15:25:21 2001 @@ -65,31 +65,31 @@ CODE_FRAGMENT . .typedef enum bfd_reloc_status .{ -. {* No errors detected *} +. {* No errors detected *} . bfd_reloc_ok, . -. {* The relocation was performed, but there was an overflow. *} +. {* The relocation was performed, but there was an overflow. *} . bfd_reloc_overflow, . -. {* The address to relocate was not within the section supplied. *} +. {* The address to relocate was not within the section supplied. *} . bfd_reloc_outofrange, . -. {* Used by special functions *} +. {* Used by special functions *} . bfd_reloc_continue, . -. {* Unsupported relocation size requested. *} +. {* Unsupported relocation size requested. *} . bfd_reloc_notsupported, . -. {* Unused *} +. {* Unused *} . bfd_reloc_other, . -. {* The symbol to relocate against was undefined. *} +. {* The symbol to relocate against was undefined. *} . bfd_reloc_undefined, . -. {* The relocation was performed, but may not be ok - presently -. generated only when linking i960 coff files with i960 b.out -. symbols. If this type is returned, the error_message argument -. to bfd_perform_relocation will be set. *} +. {* The relocation was performed, but may not be ok - presently +. generated only when linking i960 coff files with i960 b.out +. symbols. If this type is returned, the error_message argument +. to bfd_perform_relocation will be set. *} . bfd_reloc_dangerous . } . bfd_reloc_status_type; @@ -97,16 +97,16 @@ CODE_FRAGMENT . .typedef struct reloc_cache_entry .{ -. {* A pointer into the canonical table of pointers *} +. {* A pointer into the canonical table of pointers *} . struct symbol_cache_entry **sym_ptr_ptr; . -. {* offset in section *} +. {* offset in section *} . bfd_size_type address; . -. {* addend for relocation value *} +. {* addend for relocation value *} . bfd_vma addend; . -. {* Pointer to how to perform the required relocation *} +. {* Pointer to how to perform the required relocation *} . reloc_howto_type *howto; . .} arelent; @@ -250,19 +250,19 @@ CODE_FRAGMENT . .enum complain_overflow .{ -. {* Do not complain on overflow. *} +. {* Do not complain on overflow. *} . complain_overflow_dont, . -. {* Complain if the bitfield overflows, whether it is considered -. as signed or unsigned. *} +. {* Complain if the bitfield overflows, whether it is considered +. as signed or unsigned. *} . complain_overflow_bitfield, . -. {* Complain if the value overflows when considered as signed -. number. *} +. {* Complain if the value overflows when considered as signed +. number. *} . complain_overflow_signed, . -. {* Complain if the value overflows when considered as an -. unsigned number. *} +. {* Complain if the value overflows when considered as an +. unsigned number. *} . complain_overflow_unsigned .}; @@ -280,97 +280,91 @@ CODE_FRAGMENT . .struct reloc_howto_struct .{ -. {* The type field has mainly a documentary use - the back end can -. do what it wants with it, though normally the back end's -. external idea of what a reloc number is stored -. in this field. For example, a PC relative word relocation -. in a coff environment has the type 023 - because that's -. what the outside world calls a R_PCRWORD reloc. *} +. {* The type field has mainly a documentary use - the back end can +. do what it wants with it, though normally the back end's +. external idea of what a reloc number is stored +. in this field. For example, a PC relative word relocation +. in a coff environment has the type 023 - because that's +. what the outside world calls a R_PCRWORD reloc. *} . unsigned int type; . -. {* The value the final relocation is shifted right by. This drops -. unwanted data from the relocation. *} +. {* The value the final relocation is shifted right by. This drops +. unwanted data from the relocation. *} . unsigned int rightshift; . -. {* The size of the item to be relocated. This is *not* a -. power-of-two measure. To get the number of bytes operated -. on by a type of relocation, use bfd_get_reloc_size. *} +. {* The size of the item to be relocated. This is *not* a +. power-of-two measure. To get the number of bytes operated +. on by a type of relocation, use bfd_get_reloc_size. *} . int size; . -. {* The number of bits in the item to be relocated. This is used -. when doing overflow checking. *} +. {* The number of bits in the item to be relocated. This is used +. when doing overflow checking. *} . unsigned int bitsize; . -. {* Notes that the relocation is relative to the location in the -. data section of the addend. The relocation function will -. subtract from the relocation value the address of the location -. being relocated. *} +. {* Notes that the relocation is relative to the location in the +. data section of the addend. The relocation function will +. subtract from the relocation value the address of the location +. being relocated. *} . boolean pc_relative; . -. {* The bit position of the reloc value in the destination. -. The relocated value is left shifted by this amount. *} +. {* The bit position of the reloc value in the destination. +. The relocated value is left shifted by this amount. *} . unsigned int bitpos; . -. {* What type of overflow error should be checked for when -. relocating. *} +. {* What type of overflow error should be checked for when +. relocating. *} . enum complain_overflow complain_on_overflow; . -. {* If this field is non null, then the supplied function is -. called rather than the normal function. This allows really -. strange relocation methods to be accomodated (e.g., i960 callj -. instructions). *} +. {* If this field is non null, then the supplied function is +. called rather than the normal function. This allows really +. strange relocation methods to be accomodated (e.g., i960 callj +. instructions). *} . bfd_reloc_status_type (*special_function) -. PARAMS ((bfd *abfd, -. arelent *reloc_entry, -. struct symbol_cache_entry *symbol, -. PTR data, -. asection *input_section, -. bfd *output_bfd, -. char **error_message)); +. PARAMS ((bfd *, arelent *, struct symbol_cache_entry *, PTR, asection *, +. bfd *, char **)); . -. {* The textual name of the relocation type. *} +. {* The textual name of the relocation type. *} . char *name; . -. {* Some formats record a relocation addend in the section contents -. rather than with the relocation. For ELF formats this is the -. distinction between USE_REL and USE_RELA (though the code checks -. for USE_REL == 1/0). The value of this field is TRUE if the -. addend is recorded with the section contents; when performing a -. partial link (ld -r) the section contents (the data) will be -. modified. The value of this field is FALSE if addends are -. recorded with the relocation (in arelent.addend); when performing -. a partial link the relocation will be modified. -. All relocations for all ELF USE_RELA targets should set this field -. to FALSE (values of TRUE should be looked on with suspicion). -. However, the converse is not true: not all relocations of all ELF -. USE_REL targets set this field to TRUE. Why this is so is peculiar -. to each particular target. For relocs that aren't used in partial -. links (e.g. GOT stuff) it doesn't matter what this is set to. *} +. {* Some formats record a relocation addend in the section contents +. rather than with the relocation. For ELF formats this is the +. distinction between USE_REL and USE_RELA (though the code checks +. for USE_REL == 1/0). The value of this field is TRUE if the +. addend is recorded with the section contents; when performing a +. partial link (ld -r) the section contents (the data) will be +. modified. The value of this field is FALSE if addends are +. recorded with the relocation (in arelent.addend); when performing +. a partial link the relocation will be modified. +. All relocations for all ELF USE_RELA targets should set this field +. to FALSE (values of TRUE should be looked on with suspicion). +. However, the converse is not true: not all relocations of all ELF +. USE_REL targets set this field to TRUE. Why this is so is peculiar +. to each particular target. For relocs that aren't used in partial +. links (e.g. GOT stuff) it doesn't matter what this is set to. *} . boolean partial_inplace; . -. {* The src_mask selects which parts of the read in data -. are to be used in the relocation sum. E.g., if this was an 8 bit -. byte of data which we read and relocated, this would be -. 0x000000ff. When we have relocs which have an addend, such as -. sun4 extended relocs, the value in the offset part of a -. relocating field is garbage so we never use it. In this case -. the mask would be 0x00000000. *} +. {* The src_mask selects which parts of the read in data +. are to be used in the relocation sum. E.g., if this was an 8 bit +. byte of data which we read and relocated, this would be +. 0x000000ff. When we have relocs which have an addend, such as +. sun4 extended relocs, the value in the offset part of a +. relocating field is garbage so we never use it. In this case +. the mask would be 0x00000000. *} . bfd_vma src_mask; . -. {* The dst_mask selects which parts of the instruction are replaced -. into the instruction. In most cases src_mask == dst_mask, -. except in the above special case, where dst_mask would be -. 0x000000ff, and src_mask would be 0x00000000. *} +. {* The dst_mask selects which parts of the instruction are replaced +. into the instruction. In most cases src_mask == dst_mask, +. except in the above special case, where dst_mask would be +. 0x000000ff, and src_mask would be 0x00000000. *} . bfd_vma dst_mask; . -. {* When some formats create PC relative instructions, they leave -. the value of the pc of the place being relocated in the offset -. slot of the instruction, so that a PC relative relocation can -. be made just by adding in an ordinary offset (e.g., sun3 a.out). -. Some formats leave the displacement part of an instruction -. empty (e.g., m88k bcs); this flag signals the fact.*} +. {* When some formats create PC relative instructions, they leave +. the value of the pc of the place being relocated in the offset +. slot of the instruction, so that a PC relative relocation can +. be made just by adding in an ordinary offset (e.g., sun3 a.out). +. Some formats leave the displacement part of an instruction +. empty (e.g., m88k bcs); this flag signals the fact. *} . boolean pcrel_offset; -. .}; */ @@ -382,37 +376,43 @@ FUNCTION DESCRIPTION The HOWTO define is horrible and will go away. -.#define HOWTO(C, R,S,B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \ -. {(unsigned)C,R,S,B, P, BI, O,SF,NAME,INPLACE,MASKSRC,MASKDST,PC} +.#define HOWTO(C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \ +. { (unsigned) C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC } DESCRIPTION And will be replaced with the totally magic way. But for the moment, we are compatible, so do it this way. -.#define NEWHOWTO( FUNCTION, NAME,SIZE,REL,IN) HOWTO(0,0,SIZE,0,REL,0,complain_overflow_dont,FUNCTION, NAME,false,0,0,IN) +.#define NEWHOWTO(FUNCTION, NAME, SIZE, REL, IN) \ +. HOWTO (0, 0, SIZE, 0, REL, 0, complain_overflow_dont, FUNCTION, \ +. NAME, false, 0, 0, IN) . DESCRIPTION This is used to fill in an empty howto entry in an array. .#define EMPTY_HOWTO(C) \ -. HOWTO((C),0,0,0,false,0,complain_overflow_dont,NULL,NULL,false,0,0,false) +. HOWTO ((C), 0, 0, 0, false, 0, complain_overflow_dont, NULL, \ +. NULL, false, 0, 0, false) . DESCRIPTION Helper routine to turn a symbol into a relocation value. -.#define HOWTO_PREPARE(relocation, symbol) \ -. { \ -. if (symbol != (asymbol *)NULL) { \ -. if (bfd_is_com_section (symbol->section)) { \ -. relocation = 0; \ -. } \ -. else { \ -. relocation = symbol->value; \ -. } \ -. } \ -.} +.#define HOWTO_PREPARE(relocation, symbol) \ +. { \ +. if (symbol != (asymbol *) NULL) \ +. { \ +. if (bfd_is_com_section (symbol->section)) \ +. { \ +. relocation = 0; \ +. } \ +. else \ +. { \ +. relocation = symbol->value; \ +. } \ +. } \ +. } */ @@ -453,9 +453,10 @@ DESCRIPTION How relocs are tied together in an <>: -.typedef struct relent_chain { +.typedef struct relent_chain +.{ . arelent relent; -. struct relent_chain *next; +. struct relent_chain *next; .} arelent_chain; */ @@ -903,14 +904,14 @@ space consuming. For each target: { short x = bfd_get_16 (abfd, (bfd_byte *) data + octets); DOIT (x); - bfd_put_16 (abfd, x, (unsigned char *) data + octets); + bfd_put_16 (abfd, (bfd_vma) x, (unsigned char *) data + octets); } break; case 2: { long x = bfd_get_32 (abfd, (bfd_byte *) data + octets); DOIT (x); - bfd_put_32 (abfd, x, (bfd_byte *) data + octets); + bfd_put_32 (abfd, (bfd_vma) x, (bfd_byte *) data + octets); } break; case -2: @@ -918,7 +919,7 @@ space consuming. For each target: long x = bfd_get_32 (abfd, (bfd_byte *) data + octets); relocation = -relocation; DOIT (x); - bfd_put_32 (abfd, x, (bfd_byte *) data + octets); + bfd_put_32 (abfd, (bfd_vma) x, (bfd_byte *) data + octets); } break; @@ -927,7 +928,7 @@ space consuming. For each target: long x = bfd_get_16 (abfd, (bfd_byte *) data + octets); relocation = -relocation; DOIT (x); - bfd_put_16 (abfd, x, (bfd_byte *) data + octets); + bfd_put_16 (abfd, (bfd_vma) x, (bfd_byte *) data + octets); } break; @@ -1292,14 +1293,14 @@ space consuming. For each target: { short x = bfd_get_16 (abfd, (bfd_byte *) data); DOIT (x); - bfd_put_16 (abfd, x, (unsigned char *) data); + bfd_put_16 (abfd, (bfd_vma) x, (unsigned char *) data); } break; case 2: { long x = bfd_get_32 (abfd, (bfd_byte *) data); DOIT (x); - bfd_put_32 (abfd, x, (bfd_byte *) data); + bfd_put_32 (abfd, (bfd_vma) x, (bfd_byte *) data); } break; case -2: @@ -1307,7 +1308,7 @@ space consuming. For each target: long x = bfd_get_32 (abfd, (bfd_byte *) data); relocation = -relocation; DOIT (x); - bfd_put_32 (abfd, x, (bfd_byte *) data); + bfd_put_32 (abfd, (bfd_vma) x, (bfd_byte *) data); } break; @@ -1931,27 +1932,6 @@ ENUMDOC 2 - byte-manipulation (byte offset reg) 3 - jsr (target of branch) - The GNU linker currently doesn't do any of this optimizing. - -ENUM - BFD_RELOC_ALPHA_USER_LITERAL -ENUMX - BFD_RELOC_ALPHA_USER_LITUSE_BASE -ENUMX - BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF -ENUMX - BFD_RELOC_ALPHA_USER_LITUSE_JSR -ENUMX - BFD_RELOC_ALPHA_USER_GPDISP -ENUMX - BFD_RELOC_ALPHA_USER_GPRELHIGH -ENUMX - BFD_RELOC_ALPHA_USER_GPRELLOW -ENUMDOC - The BFD_RELOC_ALPHA_USER_* relocations are used by the assembler to - process the explicit !!sequence relocations, and are mapped - into the normal relocations at the end of processing. - ENUM BFD_RELOC_ALPHA_HINT ENUMDOC @@ -1972,6 +1952,14 @@ ENUMDOC which is filled by the linker. ENUM + BFD_RELOC_ALPHA_GPREL_HI16 +ENUMX + BFD_RELOC_ALPHA_GPREL_LO16 +ENUMDOC + The GPREL_HI/LO relocations together form a 32-bit offset from the + GP register. + +ENUM BFD_RELOC_MIPS_JMP ENUMDOC Bits 27..2 of the relocation address shifted right 2 bits; @@ -2237,7 +2225,7 @@ ENUMX ENUMX BFD_RELOC_PPC64_TOC ENUMX - BFD_RELOC_PPC64_PLTGOT16 + BFD_RELOC_PPC64_PLTGOT16 ENUMX BFD_RELOC_PPC64_PLTGOT16_LO ENUMX @@ -2887,7 +2875,7 @@ ENUM BFD_RELOC_390_GOTENT ENUMDOC 32 bit rel. offset to GOT entry. - + ENUM BFD_RELOC_VTABLE_INHERIT ENUMX @@ -3407,7 +3395,7 @@ bfd_generic_get_relocated_section_conten if (reloc_size < 0) goto error_return; - reloc_vector = (arelent **) bfd_malloc ((size_t) reloc_size); + reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size); if (reloc_vector == NULL && reloc_size != 0) goto error_return; @@ -3415,7 +3403,7 @@ bfd_generic_get_relocated_section_conten if (!bfd_get_section_contents (input_bfd, input_section, (PTR) data, - 0, + (bfd_vma) 0, input_section->_raw_size)) goto error_return; diff -uprN binutils-2.11.90.0.31/bfd/reloc16.c binutils-2.11.92.0.5/bfd/reloc16.c --- binutils-2.11.90.0.31/bfd/reloc16.c Fri Mar 9 11:38:00 2001 +++ binutils-2.11.92.0.5/bfd/reloc16.c Mon Oct 1 15:25:21 2001 @@ -1,5 +1,5 @@ /* 8 and 16 bit COFF relocation functions, for BFD. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000 + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001 Free Software Foundation, Inc. Written by Cygnus Support. @@ -137,17 +137,16 @@ bfd_perform_slip (abfd, slip, input_sect } boolean -bfd_coff_reloc16_relax_section (abfd, i, link_info, again) +bfd_coff_reloc16_relax_section (abfd, input_section, link_info, again) bfd *abfd; - asection *i; + asection *input_section; struct bfd_link_info *link_info; boolean *again; { /* Get enough memory to hold the stuff. */ - bfd *input_bfd = i->owner; - asection *input_section = i; - int *shrinks; - int shrink = 0; + bfd *input_bfd = input_section->owner; + unsigned *shrinks; + unsigned shrink = 0; long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section); arelent **reloc_vector = NULL; long reloc_count; @@ -159,7 +158,7 @@ bfd_coff_reloc16_relax_section (abfd, i, if (reloc_size < 0) return false; - reloc_vector = (arelent **) bfd_malloc (reloc_size); + reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size); if (!reloc_vector && reloc_size > 0) return false; @@ -191,11 +190,14 @@ bfd_coff_reloc16_relax_section (abfd, i, if (reloc_count > 0) { int another_pass = 0; + bfd_size_type amt; /* Allocate and initialize the shrinks array for this section. The last element is used as an accumlator of shrinks. */ - shrinks = (int *) bfd_malloc ((reloc_count + 1) * sizeof (int)); - memset (shrinks, 0, (reloc_count + 1) * sizeof (int)); + amt = reloc_count + 1; + amt *= sizeof (unsigned); + shrinks = (unsigned *) bfd_malloc (amt); + memset (shrinks, 0, (size_t) amt); /* Loop until nothing changes in this section. */ do { @@ -268,11 +270,11 @@ bfd_coff_reloc16_get_relocated_section_c if (!bfd_get_section_contents(input_bfd, input_section, data, - 0, + (bfd_vma) 0, input_section->_raw_size)) return NULL; - reloc_vector = (arelent **) bfd_malloc ((size_t) reloc_size); + reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size); if (!reloc_vector && reloc_size != 0) return NULL; diff -uprN binutils-2.11.90.0.31/bfd/riscix.c binutils-2.11.92.0.5/bfd/riscix.c --- binutils-2.11.90.0.31/bfd/riscix.c Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/bfd/riscix.c Thu Oct 4 14:35:43 2001 @@ -55,19 +55,23 @@ Foundation, Inc., 59 Temple Place - Suit #define N_SHARED_LIB(x) ((x).a_info & MF_USES_SL) /* Only a pure OMAGIC file has the minimal header */ -#define N_TXTOFF(x) \ - ((x).a_info == OMAGIC ? 32 \ - : (N_MAGIC(x) == ZMAGIC) ? TARGET_PAGE_SIZE \ - : 999) - -#define N_TXTADDR(x) \ - (N_MAGIC(x) != ZMAGIC ? 0 /* object file or NMAGIC */ \ +#define N_TXTOFF(x) \ + ((x).a_info == OMAGIC \ + ? 32 \ + : (N_MAGIC(x) == ZMAGIC \ + ? TARGET_PAGE_SIZE \ + : 999)) + +#define N_TXTADDR(x) \ + (N_MAGIC(x) != ZMAGIC \ + ? (bfd_vma) 0 /* object file or NMAGIC */ \ /* Programs with shared libs are loaded at the first page after all the \ text segments of the shared library programs. Without looking this \ up we can't know exactly what the address will be. A reasonable guess \ - is that a_entry will be in the first page of the executable. */ \ - : N_SHARED_LIB(x) ? ((x).a_entry & ~(TARGET_PAGE_SIZE - 1)) \ - : TEXT_START_ADDR) + is that a_entry will be in the first page of the executable. */ \ + : (N_SHARED_LIB(x) \ + ? ((x).a_entry & ~(bfd_vma) (TARGET_PAGE_SIZE - 1)) \ + : (bfd_vma) TEXT_START_ADDR)) #define N_SYMOFF(x) \ (N_TXTOFF (x) + (x).a_text + (x).a_data + (x).a_trsize + (x).a_drsize) @@ -79,7 +83,10 @@ Foundation, Inc., 59 Temple Place - Suit #define SEGMENT_SIZE TARGET_PAGE_SIZE #define DEFAULT_ARCH bfd_arch_arm -#define MY(OP) CAT(riscix_,OP) +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (riscix_,OP) #define TARGETNAME "a.out-riscix" #define N_BADMAG(x) ((((x).a_info & ~007200) != ZMAGIC) && \ (((x).a_info & ~006000) != OMAGIC) && \ @@ -90,47 +97,47 @@ Foundation, Inc., 59 Temple Place - Suit #include "sysdep.h" #include "libbfd.h" -#define WRITE_HEADERS(abfd, execp) \ - { \ - bfd_size_type text_size; /* dummy vars */ \ - file_ptr text_end; \ - if (adata(abfd).magic == undecided_magic) \ - NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end); \ - \ - execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE; \ - execp->a_entry = bfd_get_start_address (abfd); \ - \ - execp->a_trsize = ((obj_textsec (abfd)->reloc_count) * \ - obj_reloc_entry_size (abfd)); \ - execp->a_drsize = ((obj_datasec (abfd)->reloc_count) * \ - obj_reloc_entry_size (abfd)); \ - NAME(aout,swap_exec_header_out) (abfd, execp, &exec_bytes); \ - \ - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) return false; \ - if (bfd_write ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd) \ - != EXEC_BYTES_SIZE) \ - return false; \ - /* Now write out reloc info, followed by syms and strings */ \ - \ - if (bfd_get_outsymbols (abfd) != (asymbol **) NULL \ - && bfd_get_symcount (abfd) != 0) \ - { \ +#define WRITE_HEADERS(abfd, execp) \ + { \ + bfd_size_type text_size; /* dummy vars */ \ + file_ptr text_end; \ + if (adata(abfd).magic == undecided_magic) \ + NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end); \ + \ + execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE; \ + execp->a_entry = bfd_get_start_address (abfd); \ + \ + execp->a_trsize = ((obj_textsec (abfd)->reloc_count) * \ + obj_reloc_entry_size (abfd)); \ + execp->a_drsize = ((obj_datasec (abfd)->reloc_count) * \ + obj_reloc_entry_size (abfd)); \ + NAME(aout,swap_exec_header_out) (abfd, execp, &exec_bytes); \ + \ + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 \ + || bfd_bwrite ((PTR) &exec_bytes, (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_outsymbols (abfd) != (asymbol **) NULL \ + && bfd_get_symcount (abfd) != 0) \ + { \ if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*execp)), SEEK_SET) != 0) \ - return false; \ - \ - if (! NAME(aout,write_syms) (abfd)) return false; \ - \ + return false; \ + \ + if (! NAME(aout,write_syms) (abfd)) return false; \ + \ if (bfd_seek (abfd, (file_ptr) (N_TRELOFF(*execp)), SEEK_SET) != 0) \ - return false; \ - \ - if (! riscix_squirt_out_relocs (abfd, obj_textsec (abfd))) \ - return false; \ + return false; \ + \ + if (! riscix_squirt_out_relocs (abfd, obj_textsec (abfd))) \ + return false; \ if (bfd_seek (abfd, (file_ptr) (N_DRELOFF(*execp)), SEEK_SET) != 0) \ - return false; \ - \ - if (!NAME(aout,squirt_out_relocs) (abfd, obj_datasec (abfd))) \ - return false; \ - } \ + return false; \ + \ + if (!NAME(aout,squirt_out_relocs) (abfd, obj_datasec (abfd))) \ + return false; \ + } \ } #include "libaout.h" @@ -240,12 +247,12 @@ riscix_fix_pcrel_26 (abfd, reloc_entry, if ((relocation & ~ (bfd_vma) 0x03ffffff) != ~ (bfd_vma) 0x03ffffff) flag = bfd_reloc_overflow; } - else if (relocation & ~0x03ffffff) + else if (relocation & ~ (bfd_vma) 0x03ffffff) flag = bfd_reloc_overflow; target &= ~0x00ffffff; target |= (relocation >> 2) & 0x00ffffff; - bfd_put_32 (abfd, target, (bfd_byte *) data + addr); + bfd_put_32 (abfd, (bfd_vma) target, (bfd_byte *) data + addr); /* Now the ARM magic... Change the reloc type so that it is marked as done. Strictly this is only necessary if we are doing a partial relocation. */ @@ -399,12 +406,13 @@ riscix_squirt_out_relocs (abfd, section) size_t each_size; unsigned int count = section->reloc_count; - size_t natsize; + bfd_size_type natsize; if (count == 0) return true; each_size = obj_reloc_entry_size (abfd); - natsize = each_size * count; + natsize = each_size; + natsize *= count; native = (unsigned char *) bfd_zalloc (abfd, natsize); if (!native) return false; @@ -417,9 +425,9 @@ riscix_squirt_out_relocs (abfd, section) riscix_swap_std_reloc_out (abfd, *generic, (struct reloc_std_external *) natptr); - if ( bfd_write ((PTR) native, 1, natsize, abfd) != natsize) + if (bfd_bwrite ((PTR) native, natsize, abfd) != natsize) { - bfd_release(abfd, native); + bfd_release (abfd, native); return false; } @@ -488,9 +496,9 @@ riscix_some_aout_object_p (abfd, execp, { struct aout_data_struct *rawptr, *oldrawptr; const bfd_target *result; + bfd_size_type amt = sizeof (struct aout_data_struct); - rawptr = ((struct aout_data_struct *) - bfd_zalloc (abfd, sizeof (struct aout_data_struct ))); + rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, amt); if (rawptr == NULL) return 0; @@ -632,14 +640,15 @@ MY(object_p) (abfd) struct internal_exec exec; /* Cleaned-up exec header */ const bfd_target *target; - if (bfd_read ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd) - != EXEC_BYTES_SIZE) { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_wrong_format); - return 0; - } + if (bfd_bread ((PTR) &exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, abfd) + != EXEC_BYTES_SIZE) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return 0; + } - exec.a_info = bfd_h_get_32 (abfd, exec_bytes.e_info); + exec.a_info = H_GET_32 (abfd, exec_bytes.e_info); if (N_BADMAG (exec)) return 0; #ifdef MACHTYPE_OK diff -uprN binutils-2.11.90.0.31/bfd/rs6000-core.c binutils-2.11.92.0.5/bfd/rs6000-core.c --- binutils-2.11.90.0.31/bfd/rs6000-core.c Fri Mar 9 11:16:06 2001 +++ binutils-2.11.92.0.5/bfd/rs6000-core.c Mon Oct 1 15:25:21 2001 @@ -258,24 +258,28 @@ read_hdr (bfd *abfd, CoreHdr *core) { bfd_size_type size; - if (bfd_seek (abfd, 0, SEEK_SET) != 0) + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) return false; /* Read the leading portion that old and new core dump structures have in common. */ - if (bfd_read (core, CORE_COMMONSZ, 1, abfd) != CORE_COMMONSZ) + size = CORE_COMMONSZ; + if (bfd_bread (core, size, abfd) != size) return false; /* Read the trailing portion of the structure. */ - size = CORE_NEW (*core) ? sizeof (core->new) : sizeof (core->old) - - CORE_COMMONSZ; - return bfd_read ((char *) core + CORE_COMMONSZ, size, 1, abfd) == size; + if (CORE_NEW (*core)) + size = sizeof (core->new); + else + size = sizeof (core->old); + size -= CORE_COMMONSZ; + return bfd_bread ((char *) core + CORE_COMMONSZ, size, abfd) == size; } static asection * make_bfd_asection (abfd, name, flags, _raw_size, vma, filepos) bfd *abfd; - CONST char *name; + const char *name; flagword flags; bfd_size_type _raw_size; bfd_vma vma; @@ -424,7 +428,7 @@ rs6000coff_core_p (abfd) /* Allocate core file header. */ size = CORE_NEW (core) ? sizeof (core.new) : sizeof (core.old); - tmpptr = (char *) bfd_zalloc (abfd, size); + tmpptr = (char *) bfd_zalloc (abfd, (bfd_size_type) size); if (!tmpptr) return NULL; @@ -545,7 +549,7 @@ rs6000coff_core_p (abfd) { if (bfd_seek (abfd, c_loader, SEEK_SET) != 0) return NULL; - if (bfd_read (&ldinfo, size, 1, abfd) != size) + if (bfd_bread (&ldinfo, size, abfd) != size) return NULL; if (proc64) @@ -590,7 +594,7 @@ rs6000coff_core_p (abfd) bfd_vma vminfo_addr; size = CORE_NEW (core) ? sizeof (vminfo.new) : sizeof (vminfo.old); - if (bfd_read (&vminfo, size, 1, abfd) != size) + if (bfd_bread (&vminfo, size, abfd) != size) return NULL; if (CORE_NEW (core)) @@ -652,14 +656,14 @@ rs6000coff_core_file_matches_executable_ return false; alloc = 100; - path = bfd_malloc (alloc); + path = bfd_malloc ((bfd_size_type) alloc); if (path == NULL) return false; s = path; while (1) { - if (bfd_read (s, 1, 1, core_bfd) != 1) + if (bfd_bread (s, (bfd_size_type) 1, core_bfd) != 1) { free (path); return false; @@ -672,7 +676,7 @@ rs6000coff_core_file_matches_executable_ char *n; alloc *= 2; - n = bfd_realloc (path, alloc); + n = bfd_realloc (path, (bfd_size_type) alloc); if (n == NULL) { free (path); diff -uprN binutils-2.11.90.0.31/bfd/sco5-core.c binutils-2.11.92.0.5/bfd/sco5-core.c --- binutils-2.11.90.0.31/bfd/sco5-core.c Fri Mar 9 11:16:06 2001 +++ binutils-2.11.92.0.5/bfd/sco5-core.c Mon Oct 1 15:25:21 2001 @@ -1,5 +1,5 @@ /* BFD back end for SCO5 core files (U-area and raw sections) - Copyright 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Written by Jouke Numan This file is part of BFD, the Binary File Descriptor library. @@ -79,7 +79,9 @@ static asymbol * sco5_core_make_empty_symbol (abfd) bfd *abfd; { - asymbol *new = (asymbol *) bfd_zalloc (abfd, sizeof (asymbol)); + asymbol *new; + + new = (asymbol *) bfd_zalloc (abfd, (bfd_size_type) sizeof (asymbol)); if (new) new->the_bfd = abfd; return new; @@ -92,17 +94,17 @@ read_uarea(abfd, filepos) { struct sco5_core_struct *rawptr; + bfd_size_type amt = sizeof (struct sco5_core_struct); - rawptr = ((struct sco5_core_struct *) - bfd_zmalloc (sizeof (struct sco5_core_struct))); + rawptr = (struct sco5_core_struct *) bfd_zmalloc (amt); if (rawptr == NULL) return NULL; abfd->tdata.sco5_core_data = rawptr; - if ((bfd_seek (abfd, filepos, SEEK_SET) != 0) - || (bfd_read ((void *)&rawptr->u, 1, sizeof rawptr->u, abfd) - != sizeof rawptr->u)) + if (bfd_seek (abfd, (file_ptr) filepos, SEEK_SET) != 0 + || bfd_bread ((void *) &rawptr->u, (bfd_size_type) sizeof rawptr->u, + abfd) != sizeof rawptr->u) { bfd_set_error (bfd_error_wrong_format); return NULL; @@ -150,9 +152,10 @@ sco5_core_file_p (abfd) coresize = statbuf.st_size; } /* Last long in core is sizeof struct coreoffsets, read it */ - if ((bfd_seek (abfd, coresize-sizeof coffset_siz, SEEK_SET) != 0) - || (bfd_read ((void *)&coffset_siz, 1, sizeof coffset_siz, abfd) - != sizeof coffset_siz) ) + if ((bfd_seek (abfd, (file_ptr) (coresize - sizeof coffset_siz), + SEEK_SET) != 0) + || bfd_bread ((void *) &coffset_siz, (bfd_size_type) sizeof coffset_siz, + abfd) != sizeof coffset_siz) { bfd_set_error (bfd_error_wrong_format); return NULL; @@ -160,8 +163,8 @@ sco5_core_file_p (abfd) /* Use it to seek start of coreoffsets region, read it and determine validity */ - if ((bfd_seek (abfd, coresize-coffset_siz, SEEK_SET) != 0) - || (bfd_read ((void *)&coffsets, 1, sizeof coffsets, abfd) + if ((bfd_seek (abfd, (file_ptr) (coresize - coffset_siz), SEEK_SET) != 0) + || (bfd_bread ((void *) &coffsets, (bfd_size_type) sizeof coffsets, abfd) != sizeof coffsets) || ((coffsets.u_info != 1) && (coffsets.u_info != C_VERSION))) { @@ -207,13 +210,15 @@ sco5_core_file_p (abfd) coresecthead and check its validity */ if ((bfd_seek (abfd, - coresize - coffset_siz - 2 * sizeof coffset_siz, + (file_ptr) (coresize - coffset_siz - 2 * sizeof coffset_siz), SEEK_SET) != 0) - || (bfd_read ((void *)&nsecs, 1, sizeof nsecs, abfd) != sizeof nsecs) - || (bfd_read ((void *)&cheadoffs, 1, sizeof cheadoffs, abfd) - != sizeof cheadoffs) - || (bfd_seek (abfd, cheadoffs, SEEK_SET) != 0) - || (bfd_read ((void *)&chead, 1, sizeof chead, abfd) != sizeof chead) + || (bfd_bread ((void *) &nsecs, (bfd_size_type) sizeof nsecs, abfd) + != sizeof nsecs) + || (bfd_bread ((void *) &cheadoffs, (bfd_size_type) sizeof cheadoffs, + abfd) != sizeof cheadoffs) + || (bfd_seek (abfd, (file_ptr) cheadoffs, SEEK_SET) != 0) + || (bfd_bread ((void *) &chead, (bfd_size_type) sizeof chead, abfd) + != sizeof chead) || (chead.cs_stype != CORES_OFFSETS) || (chead.cs_x.csx_magic != COREMAGIC_NUMBER)) { @@ -227,8 +232,9 @@ sco5_core_file_p (abfd) nsecs--; /* We've seen CORES_OFFSETS already */ for (; nsecs; nsecs--) { - if ((bfd_seek (abfd, chead.cs_hseek, SEEK_SET) != 0) - || bfd_read ((void *)&chead, 1, sizeof chead, abfd) != sizeof chead) + if ((bfd_seek (abfd, (file_ptr) chead.cs_hseek, SEEK_SET) != 0) + || (bfd_bread ((void *) &chead, (bfd_size_type) sizeof chead, abfd) + != sizeof chead)) { bfd_set_error (bfd_error_wrong_format); return NULL; @@ -351,7 +357,8 @@ sco5_core_file_failing_signal (ignore_ab /* ARGSUSED */ boolean sco5_core_file_matches_executable_p (core_bfd, exec_bfd) - bfd *core_bfd, *exec_bfd; + bfd *core_bfd ATTRIBUTE_UNUSED; + bfd *exec_bfd ATTRIBUTE_UNUSED; { return true; /* FIXME, We have no way of telling at this point */ } diff -uprN binutils-2.11.90.0.31/bfd/section.c binutils-2.11.92.0.5/bfd/section.c --- binutils-2.11.90.0.31/bfd/section.c Sun Jun 3 16:58:25 2001 +++ binutils-2.11.92.0.5/bfd/section.c Mon Oct 1 15:25:21 2001 @@ -205,9 +205,11 @@ CODE_FRAGMENT . some relocation information too. *} .#define SEC_RELOC 0x004 . -.#if 0 {* Obsolete ? *} -.#define SEC_BALIGN 0x008 -.#endif +. {* ELF reserves 4 processor specific bits and 8 operating system +. specific bits in sh_flags; at present we can get away with just +. one in communicating between the assembler and BFD, but this +. isn't a good long-term solution. *} +.#define SEC_ARCH_BIT_0 0x008 . . {* A signal to the OS that the section contains read only data. *} .#define SEC_READONLY 0x010 @@ -483,10 +485,6 @@ CODE_FRAGMENT . . struct bfd_comdat_info *comdat; . -. {* Points to the kept section if this section is a link-once section, -. and is discarded. *} -. struct sec *kept_section; -. . {* When a section is being output, this value changes as more . linenumbers are written out. *} . @@ -597,8 +595,8 @@ static const asymbol global_syms[] = /* line_filepos, userdata, contents, lineno, lineno_count, */ \ 0, NULL, NULL, NULL, 0, \ \ - /* entsize, comdat, kept_section, moving_line_filepos, */ \ - 0, NULL, NULL, 0, \ + /* entsize, comdat, moving_line_filepos, */ \ + 0, NULL, 0, \ \ /* target_index, used_by_bfd, constructor_chain, owner, */ \ 0, NULL, NULL, NULL, \ @@ -689,7 +687,7 @@ bfd_get_unique_section_name (abfd, templ char *sname; len = strlen (templat); - sname = bfd_malloc (len + 8); + sname = bfd_malloc ((bfd_size_type) len + 8); if (sname == NULL) return NULL; strcpy (sname, templat); @@ -788,7 +786,7 @@ bfd_make_section_anyway (abfd, name) sect = sect->next; } - newsect = (asection *) bfd_zalloc (abfd, sizeof (asection)); + newsect = (asection *) bfd_zalloc (abfd, (bfd_size_type) sizeof (asection)); if (newsect == NULL) return NULL; @@ -805,7 +803,6 @@ bfd_make_section_anyway (abfd, name) newsect->line_filepos = 0; newsect->owner = abfd; newsect->comdat = NULL; - newsect->kept_section = NULL; /* Create a symbol whos only job is to point to this section. This is useful for things like relocs which are relative to the base of a @@ -1013,12 +1010,9 @@ FUNCTION bfd_set_section_contents SYNOPSIS - boolean bfd_set_section_contents - (bfd *abfd, - asection *section, - PTR data, - file_ptr offset, - bfd_size_type count); + boolean bfd_set_section_contents (bfd *abfd, asection *section, + PTR data, file_ptr offset, + bfd_size_type count); DESCRIPTION Sets the contents of the section @var{section} in BFD @@ -1059,17 +1053,15 @@ bfd_set_section_contents (abfd, section, return (false); } - if (offset < 0) + sz = bfd_get_section_size_now (abfd, section); + if ((bfd_size_type) offset > sz + || count > sz + || offset + count > sz + || count != (size_t) count) { - bad_val: bfd_set_error (bfd_error_bad_value); return false; } - sz = bfd_get_section_size_now (abfd, section); - if ((bfd_size_type) offset > sz - || count > sz - || offset + count > sz) - goto bad_val; switch (abfd->direction) { @@ -1092,7 +1084,7 @@ bfd_set_section_contents (abfd, section, /* Record a copy of the data in memory if desired. */ if (section->contents && location != section->contents + offset) - memcpy (section->contents + offset, location, count); + memcpy (section->contents + offset, location, (size_t) count); if (BFD_SEND (abfd, _bfd_set_section_contents, (abfd, section, location, offset, count))) @@ -1109,9 +1101,9 @@ FUNCTION bfd_get_section_contents SYNOPSIS - boolean bfd_get_section_contents - (bfd *abfd, asection *section, PTR location, - file_ptr offset, bfd_size_type count); + boolean bfd_get_section_contents (bfd *abfd, asection *section, + PTR location, file_ptr offset, + bfd_size_type count); DESCRIPTION Read data from @var{section} in BFD @var{abfd} @@ -1138,21 +1130,21 @@ bfd_get_section_contents (abfd, section, if (section->flags & SEC_CONSTRUCTOR) { - memset (location, 0, (unsigned) count); + memset (location, 0, (size_t) count); return true; } - if (offset < 0) + /* Even if reloc_done is true, this function reads unrelocated + contents, so we want the raw size. */ + sz = section->_raw_size; + if ((bfd_size_type) offset > sz + || count > sz + || offset + count > sz + || count != (size_t) count) { - bad_val: bfd_set_error (bfd_error_bad_value); return false; } - /* Even if reloc_done is true, this function reads unrelocated - contents, so we want the raw size. */ - sz = section->_raw_size; - if ((bfd_size_type) offset > sz || count > sz || offset + count > sz) - goto bad_val; if (count == 0) /* Don't bother. */ @@ -1160,7 +1152,7 @@ bfd_get_section_contents (abfd, section, if ((section->flags & SEC_HAS_CONTENTS) == 0) { - memset (location, 0, (unsigned) count); + memset (location, 0, (size_t) count); return true; } @@ -1179,7 +1171,8 @@ FUNCTION bfd_copy_private_section_data SYNOPSIS - boolean bfd_copy_private_section_data(bfd *ibfd, asection *isec, bfd *obfd, asection *osec); + boolean bfd_copy_private_section_data (bfd *ibfd, asection *isec, + bfd *obfd, asection *osec); DESCRIPTION Copy private section information from @var{isec} in the BFD diff -uprN binutils-2.11.90.0.31/bfd/som.c binutils-2.11.92.0.5/bfd/som.c --- binutils-2.11.90.0.31/bfd/som.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/som.c Mon Oct 1 15:25:21 2001 @@ -31,12 +31,12 @@ #include "libbfd.h" #include "som.h" +#include "safe-ctype.h" #include #include #include #include -#include /* Magic not defined in standard HP-UX header files until 8.0 */ @@ -102,7 +102,7 @@ /* Generic alignment macro. */ #define SOM_ALIGN(val, alignment) \ - (((val) + (alignment) - 1) & ~((alignment) - 1)) + (((val) + (alignment) - 1) &~ ((unsigned long) (alignment) - 1)) /* SOM allows any one of the four previous relocations to be reused with a "R_PREV_FIXUP" relocation entry. Since R_PREV_FIXUP @@ -190,8 +190,8 @@ static boolean som_set_arch_mach PARAMS unsigned long)); static boolean som_find_nearest_line PARAMS ((bfd *, asection *, asymbol **, bfd_vma, - CONST char **, - CONST char **, + const char **, + const char **, unsigned int *)); static void som_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *)); static asection * bfd_section_from_som_symbol PARAMS ((bfd *, @@ -214,7 +214,8 @@ static unsigned char * try_prev_fixup PA static unsigned char * som_reloc_skip PARAMS ((bfd *, unsigned int, unsigned char *, unsigned int *, struct reloc_queue *)); -static unsigned char * som_reloc_addend PARAMS ((bfd *, int, unsigned char *, +static unsigned char * som_reloc_addend PARAMS ((bfd *, bfd_vma, + unsigned char *, unsigned int *, struct reloc_queue *)); static unsigned char * som_reloc_call PARAMS ((bfd *, unsigned char *, @@ -383,315 +384,315 @@ struct fixup_format { static const struct fixup_format som_fixup_formats[256] = { /* R_NO_RELOCATION */ - 0, "LD1+4*=", /* 0x00 */ - 1, "LD1+4*=", /* 0x01 */ - 2, "LD1+4*=", /* 0x02 */ - 3, "LD1+4*=", /* 0x03 */ - 4, "LD1+4*=", /* 0x04 */ - 5, "LD1+4*=", /* 0x05 */ - 6, "LD1+4*=", /* 0x06 */ - 7, "LD1+4*=", /* 0x07 */ - 8, "LD1+4*=", /* 0x08 */ - 9, "LD1+4*=", /* 0x09 */ - 10, "LD1+4*=", /* 0x0a */ - 11, "LD1+4*=", /* 0x0b */ - 12, "LD1+4*=", /* 0x0c */ - 13, "LD1+4*=", /* 0x0d */ - 14, "LD1+4*=", /* 0x0e */ - 15, "LD1+4*=", /* 0x0f */ - 16, "LD1+4*=", /* 0x10 */ - 17, "LD1+4*=", /* 0x11 */ - 18, "LD1+4*=", /* 0x12 */ - 19, "LD1+4*=", /* 0x13 */ - 20, "LD1+4*=", /* 0x14 */ - 21, "LD1+4*=", /* 0x15 */ - 22, "LD1+4*=", /* 0x16 */ - 23, "LD1+4*=", /* 0x17 */ - 0, "LD8= 0x1000000) { @@ -1234,7 +1235,7 @@ som_reloc_skip (abfd, skip, p, subspace_ else { bfd_put_8 (abfd, R_NO_RELOCATION + 28 + (((skip >> 2) - 1) >> 16), p); - bfd_put_16 (abfd, (skip >> 2) - 1, p + 1); + bfd_put_16 (abfd, (bfd_vma) (skip >> 2) - 1, p + 1); p = try_prev_fixup (abfd, subspace_reloc_sizep, p, 3, queue); } } @@ -1243,7 +1244,7 @@ som_reloc_skip (abfd, skip, p, subspace_ { bfd_put_8 (abfd, R_NO_RELOCATION + 31, p); bfd_put_8 (abfd, (skip - 1) >> 16, p + 1); - bfd_put_16 (abfd, skip - 1, p + 2); + bfd_put_16 (abfd, (bfd_vma) skip - 1, p + 2); p = try_prev_fixup (abfd, subspace_reloc_sizep, p, 4, queue); } return p; @@ -1257,24 +1258,24 @@ som_reloc_skip (abfd, skip, p, subspace_ static unsigned char * som_reloc_addend (abfd, addend, p, subspace_reloc_sizep, queue) bfd *abfd; - int addend; + bfd_vma addend; unsigned char *p; unsigned int *subspace_reloc_sizep; struct reloc_queue *queue; { - if ((unsigned) (addend) + 0x80 < 0x100) + if (addend + 0x80 < 0x100) { bfd_put_8 (abfd, R_DATA_OVERRIDE + 1, p); bfd_put_8 (abfd, addend, p + 1); p = try_prev_fixup (abfd, subspace_reloc_sizep, p, 2, queue); } - else if ((unsigned) (addend) + 0x8000 < 0x10000) + else if (addend + 0x8000 < 0x10000) { bfd_put_8 (abfd, R_DATA_OVERRIDE + 2, p); bfd_put_16 (abfd, addend, p + 1); p = try_prev_fixup (abfd, subspace_reloc_sizep, p, 3, queue); } - else if ((unsigned) (addend) + 0x800000 < 0x1000000) + else if (addend + 0x800000 < 0x1000000) { bfd_put_8 (abfd, R_DATA_OVERRIDE + 3, p); bfd_put_8 (abfd, addend >> 16, p + 1); @@ -1395,7 +1396,7 @@ som_reloc_call (abfd, p, subspace_reloc_ else { bfd_put_8 (abfd, sym_num >> 16, p + 2); - bfd_put_16 (abfd, sym_num, p + 3); + bfd_put_16 (abfd, (bfd_vma) sym_num, p + 3); p = try_prev_fixup (abfd, subspace_reloc_sizep, p, 5, queue); } } @@ -1453,8 +1454,8 @@ hppa_som_gen_reloc_type (abfd, base_type { int *final_type, **final_types; - final_types = (int **) bfd_alloc (abfd, sizeof (int *) * 6); - final_type = (int *) bfd_alloc (abfd, sizeof (int)); + final_types = (int **) bfd_alloc (abfd, (bfd_size_type) sizeof (int *) * 6); + final_type = (int *) bfd_alloc (abfd, (bfd_size_type) sizeof (int)); if (!final_types || !final_type) return NULL; @@ -1478,7 +1479,7 @@ hppa_som_gen_reloc_type (abfd, base_type case e_tsel: case e_ltsel: case e_rtsel: - final_types[0] = (int *) bfd_alloc (abfd, sizeof (int)); + final_types[0] = (int *) bfd_alloc (abfd, (bfd_size_type) sizeof (int)); if (!final_types[0]) return NULL; if (field == e_tsel) @@ -1494,7 +1495,7 @@ hppa_som_gen_reloc_type (abfd, base_type case e_lssel: case e_rssel: - final_types[0] = (int *) bfd_alloc (abfd, sizeof (int)); + final_types[0] = (int *) bfd_alloc (abfd, (bfd_size_type) sizeof (int)); if (!final_types[0]) return NULL; *final_types[0] = R_S_MODE; @@ -1505,7 +1506,7 @@ hppa_som_gen_reloc_type (abfd, base_type case e_lsel: case e_rsel: - final_types[0] = (int *) bfd_alloc (abfd, sizeof (int)); + final_types[0] = (int *) bfd_alloc (abfd, (bfd_size_type) sizeof (int)); if (!final_types[0]) return NULL; *final_types[0] = R_N_MODE; @@ -1516,7 +1517,7 @@ hppa_som_gen_reloc_type (abfd, base_type case e_ldsel: case e_rdsel: - final_types[0] = (int *) bfd_alloc (abfd, sizeof (int)); + final_types[0] = (int *) bfd_alloc (abfd, (bfd_size_type) sizeof (int)); if (!final_types[0]) return NULL; *final_types[0] = R_D_MODE; @@ -1527,7 +1528,7 @@ hppa_som_gen_reloc_type (abfd, base_type case e_lrsel: case e_rrsel: - final_types[0] = (int *) bfd_alloc (abfd, sizeof (int)); + final_types[0] = (int *) bfd_alloc (abfd, (bfd_size_type) sizeof (int)); if (!final_types[0]) return NULL; *final_types[0] = R_R_MODE; @@ -1537,7 +1538,7 @@ hppa_som_gen_reloc_type (abfd, base_type break; case e_nsel: - final_types[0] = (int *) bfd_alloc (abfd, sizeof (int)); + final_types[0] = (int *) bfd_alloc (abfd, (bfd_size_type) sizeof (int)); if (!final_types[0]) return NULL; *final_types[0] = R_N1SEL; @@ -1548,11 +1549,11 @@ hppa_som_gen_reloc_type (abfd, base_type case e_nlsel: case e_nlrsel: - final_types[0] = (int *) bfd_alloc (abfd, sizeof (int)); + final_types[0] = (int *) bfd_alloc (abfd, (bfd_size_type) sizeof (int)); if (!final_types[0]) return NULL; *final_types[0] = R_N0SEL; - final_types[1] = (int *) bfd_alloc (abfd, sizeof (int)); + final_types[1] = (int *) bfd_alloc (abfd, (bfd_size_type) sizeof (int)); if (!final_types[1]) return NULL; if (field == e_nlsel) @@ -1571,10 +1572,11 @@ hppa_som_gen_reloc_type (abfd, base_type /* The difference of two symbols needs *very* special handling. */ if (sym_diff) { - final_types[0] = (int *) bfd_alloc (abfd, sizeof (int)); - final_types[1] = (int *) bfd_alloc (abfd, sizeof (int)); - final_types[2] = (int *) bfd_alloc (abfd, sizeof (int)); - final_types[3] = (int *) bfd_alloc (abfd, sizeof (int)); + bfd_size_type amt = sizeof (int); + final_types[0] = (int *) bfd_alloc (abfd, amt); + final_types[1] = (int *) bfd_alloc (abfd, amt); + final_types[2] = (int *) bfd_alloc (abfd, amt); + final_types[3] = (int *) bfd_alloc (abfd, amt); if (!final_types[0] || !final_types[1] || !final_types[2]) return NULL; if (field == e_fsel) @@ -1651,10 +1653,11 @@ hppa_som_gen_reloc_type (abfd, base_type /* The difference of two symbols needs *very* special handling. */ if (sym_diff) { - final_types[0] = (int *) bfd_alloc (abfd, sizeof (int)); - final_types[1] = (int *) bfd_alloc (abfd, sizeof (int)); - final_types[2] = (int *) bfd_alloc (abfd, sizeof (int)); - final_types[3] = (int *) bfd_alloc (abfd, sizeof (int)); + bfd_size_type amt = sizeof (int); + final_types[0] = (int *) bfd_alloc (abfd, amt); + final_types[1] = (int *) bfd_alloc (abfd, amt); + final_types[2] = (int *) bfd_alloc (abfd, amt); + final_types[3] = (int *) bfd_alloc (abfd, amt); if (!final_types[0] || !final_types[1] || !final_types[2]) return NULL; if (field == e_fsel) @@ -1688,7 +1691,8 @@ hppa_som_gen_reloc_type (abfd, base_type /* If we have short and long pcrel modes, then generate the proper mode selector, then the pcrel relocation. Redundant selectors will be eliminted as the relocs are sized and emitted. */ - final_types[0] = (int *) bfd_alloc (abfd, sizeof (int)); + bfd_size_type amt = sizeof (int); + final_types[0] = (int *) bfd_alloc (abfd, amt); if (!final_types[0]) return NULL; if (format == 17) @@ -1773,7 +1777,7 @@ som_object_setup (abfd, file_hdrp, aux_h /* Allocate space to hold the saved exec header information. */ obj_som_exec_data (abfd) = (struct som_exec_data *) - bfd_zalloc (abfd, sizeof (struct som_exec_data)); + bfd_zalloc (abfd, (bfd_size_type) sizeof (struct som_exec_data)); if (obj_som_exec_data (abfd) == NULL) return NULL; @@ -1846,18 +1850,19 @@ setup_sections (abfd, file_hdr, current_ unsigned int space_index, i; unsigned int total_subspaces = 0; asection **subspace_sections, *section; + bfd_size_type amt; /* First, read in space names. */ - space_strings = bfd_malloc (file_hdr->space_strings_size); - if (!space_strings && file_hdr->space_strings_size != 0) + amt = file_hdr->space_strings_size; + space_strings = bfd_malloc (amt); + if (!space_strings && amt != 0) goto error_return; if (bfd_seek (abfd, current_offset + file_hdr->space_strings_location, - SEEK_SET) < 0) + SEEK_SET) != 0) goto error_return; - if (bfd_read (space_strings, 1, file_hdr->space_strings_size, abfd) - != file_hdr->space_strings_size) + if (bfd_bread (space_strings, amt, abfd) != amt) goto error_return; /* Loop over all of the space dictionaries, building up sections. */ @@ -1873,16 +1878,18 @@ setup_sections (abfd, file_hdr, current_ if (bfd_seek (abfd, (current_offset + file_hdr->space_location + space_index * sizeof space), - SEEK_SET) < 0) + SEEK_SET) != 0) goto error_return; - if (bfd_read (&space, 1, sizeof space, abfd) != sizeof space) + amt = sizeof space; + if (bfd_bread (&space, amt, abfd) != amt) goto error_return; /* Setup the space name string. */ space.name.n_name = space.name.n_strx + space_strings; /* Make a section out of it. */ - newname = bfd_alloc (abfd, strlen (space.name.n_name) + 1); + amt = strlen (space.name.n_name) + 1; + newname = bfd_alloc (abfd, amt); if (!newname) goto error_return; strcpy (newname, space.name.n_name); @@ -1908,15 +1915,16 @@ setup_sections (abfd, file_hdr, current_ if (bfd_seek (abfd, (current_offset + file_hdr->subspace_location + space.subspace_index * sizeof subspace), - SEEK_SET) < 0) + SEEK_SET) != 0) goto error_return; - if (bfd_read (&subspace, 1, sizeof subspace, abfd) != sizeof subspace) + amt = sizeof subspace; + if (bfd_bread (&subspace, amt, abfd) != amt) goto error_return; /* Seek back to the start of the subspaces for loop below. */ if (bfd_seek (abfd, (current_offset + file_hdr->subspace_location + space.subspace_index * sizeof subspace), - SEEK_SET) < 0) + SEEK_SET) != 0) goto error_return; /* Setup the start address and file loc from the first subspace @@ -1924,7 +1932,7 @@ setup_sections (abfd, file_hdr, current_ space_asect->vma = subspace.subspace_start; space_asect->filepos = subspace.file_loc_init_value + current_offset; space_asect->alignment_power = log2 (subspace.alignment); - if (space_asect->alignment_power == -1) + if (space_asect->alignment_power == (unsigned) -1) goto error_return; /* Initialize save_subspace so we can reliably determine if this @@ -1938,14 +1946,15 @@ setup_sections (abfd, file_hdr, current_ asection *subspace_asect; /* Read in the next subspace. */ - if (bfd_read (&subspace, 1, sizeof subspace, abfd) - != sizeof subspace) + amt = sizeof subspace; + if (bfd_bread (&subspace, amt, abfd) != amt) goto error_return; /* Setup the subspace name string. */ subspace.name.n_name = subspace.name.n_strx + space_strings; - newname = bfd_alloc (abfd, strlen (subspace.name.n_name) + 1); + amt = strlen (subspace.name.n_name) + 1; + newname = bfd_alloc (abfd, amt); if (!newname) goto error_return; strcpy (newname, subspace.name.n_name); @@ -2036,7 +2045,7 @@ setup_sections (abfd, file_hdr, current_ = subspace.fixup_request_quantity; /* We can not determine this yet. When we read in the relocation table the correct value will be filled in. */ - subspace_asect->reloc_count = -1; + subspace_asect->reloc_count = (unsigned) -1; } /* Update save_subspace if appropriate. */ @@ -2049,7 +2058,7 @@ setup_sections (abfd, file_hdr, current_ subspace_asect->filepos = (subspace.file_loc_init_value + current_offset); subspace_asect->alignment_power = log2 (subspace.alignment); - if (subspace_asect->alignment_power == -1) + if (subspace_asect->alignment_power == (unsigned) -1) goto error_return; } @@ -2074,8 +2083,9 @@ setup_sections (abfd, file_hdr, current_ } /* Now that we've read in all the subspace records, we need to assign a target index to each subspace. */ - subspace_sections = (asection **) bfd_malloc (total_subspaces - * sizeof (asection *)); + amt = total_subspaces; + amt *= sizeof (asection *); + subspace_sections = (asection **) bfd_malloc (amt); if (subspace_sections == NULL) goto error_return; @@ -2123,9 +2133,11 @@ som_object_p (abfd) unsigned long current_offset = 0; struct lst_header lst_header; struct som_entry som_entry; + bfd_size_type amt; #define ENTRY_SIZE sizeof (struct som_entry) - if (bfd_read ((PTR) & file_hdr, 1, FILE_HDR_SIZE, abfd) != FILE_HDR_SIZE) + amt = FILE_HDR_SIZE; + if (bfd_bread ((PTR) &file_hdr, amt, abfd) != amt) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -2159,14 +2171,15 @@ som_object_p (abfd) case EXECLIBMAGIC: /* Read the lst header and determine where the SOM directory begins. */ - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) < 0) + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); return 0; } - if (bfd_read ((PTR) & lst_header, 1, SLSTHDR, abfd) != SLSTHDR) + amt = SLSTHDR; + if (bfd_bread ((PTR) &lst_header, amt, abfd) != amt) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -2175,14 +2188,15 @@ som_object_p (abfd) /* Position to and read the first directory entry. */ - if (bfd_seek (abfd, lst_header.dir_loc, SEEK_SET) < 0) + if (bfd_seek (abfd, lst_header.dir_loc, SEEK_SET) != 0) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); return 0; } - if (bfd_read ((PTR) & som_entry, 1, ENTRY_SIZE, abfd) != ENTRY_SIZE) + amt = ENTRY_SIZE; + if (bfd_bread ((PTR) &som_entry, amt, abfd) != amt) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -2191,7 +2205,7 @@ som_object_p (abfd) /* Now position to the first SOM. */ - if (bfd_seek (abfd, som_entry.location, SEEK_SET) < 0) + if (bfd_seek (abfd, som_entry.location, SEEK_SET) != 0) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -2201,8 +2215,8 @@ som_object_p (abfd) current_offset = som_entry.location; /* And finally, re-read the som header. */ - - if (bfd_read ((PTR) & file_hdr, 1, FILE_HDR_SIZE, abfd) != FILE_HDR_SIZE) + amt = FILE_HDR_SIZE; + if (bfd_bread ((PTR) &file_hdr, amt, abfd) != amt) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -2230,7 +2244,8 @@ som_object_p (abfd) memset (&aux_hdr, 0, sizeof (struct som_exec_auxhdr)); if (file_hdr.aux_header_size != 0) { - if (bfd_read ((PTR) & aux_hdr, 1, AUX_HDR_SIZE, abfd) != AUX_HDR_SIZE) + amt = AUX_HDR_SIZE; + if (bfd_bread ((PTR) &aux_hdr, amt, abfd) != amt) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -2257,7 +2272,7 @@ som_mkobject (abfd) { /* Allocate memory to hold backend information. */ abfd->tdata.som_data = (struct som_data_struct *) - bfd_zalloc (abfd, sizeof (struct som_data_struct)); + bfd_zalloc (abfd, (bfd_size_type) sizeof (struct som_data_struct)); if (abfd->tdata.som_data == NULL) return false; return true; @@ -2273,9 +2288,10 @@ som_prep_headers (abfd) { struct header *file_hdr; asection *section; + bfd_size_type amt = sizeof (struct header); /* Make and attach a file header to the BFD. */ - file_hdr = (struct header *) bfd_zalloc (abfd, sizeof (struct header)); + file_hdr = (struct header *) bfd_zalloc (abfd, amt); if (file_hdr == NULL) return false; obj_som_file_hdr (abfd) = file_hdr; @@ -2284,8 +2300,9 @@ som_prep_headers (abfd) { /* Make and attach an exec header to the BFD. */ - obj_som_exec_hdr (abfd) = (struct som_exec_auxhdr *) - bfd_zalloc (abfd, sizeof (struct som_exec_auxhdr)); + amt = sizeof (struct som_exec_auxhdr); + obj_som_exec_hdr (abfd) = + (struct som_exec_auxhdr *) bfd_zalloc (abfd, amt); if (obj_som_exec_hdr (abfd) == NULL) return false; @@ -2330,9 +2347,9 @@ som_prep_headers (abfd) if (som_is_space (section)) { /* Allocate space for the space dictionary. */ + amt = sizeof (struct space_dictionary_record); som_section_data (section)->space_dict = - (struct space_dictionary_record *) - bfd_zalloc (abfd, sizeof (struct space_dictionary_record)); + (struct space_dictionary_record *) bfd_zalloc (abfd, amt); if (som_section_data (section)->space_dict == NULL) return false; /* Set space attributes. Note most attributes of SOM spaces @@ -2353,9 +2370,9 @@ som_prep_headers (abfd) else { /* Allocate space for the subspace dictionary. */ - som_section_data (section)->subspace_dict - = (struct subspace_dictionary_record *) - bfd_zalloc (abfd, sizeof (struct subspace_dictionary_record)); + amt = sizeof (struct subspace_dictionary_record); + som_section_data (section)->subspace_dict = + (struct subspace_dictionary_record *) bfd_zalloc (abfd, amt); if (som_section_data (section)->subspace_dict == NULL) return false; @@ -2546,9 +2563,10 @@ som_prep_for_fixups (abfd, syms, num_sym asymbol **syms; unsigned long num_syms; { - int i; + unsigned long i; asection *section; asymbol **sorted_syms; + bfd_size_type amt; /* Most SOM relocations involving a symbol have a length which is dependent on the index of the symbol. So symbols which are @@ -2574,16 +2592,16 @@ som_prep_for_fixups (abfd, syms, num_sym of how often a given symbol is used in a relocation. */ for (section = abfd->sections; section != NULL; section = section->next) { - int i; + int j; /* Does this section have any relocations? */ - if (section->reloc_count <= 0) + if ((int) section->reloc_count <= 0) continue; /* Walk through each relocation for this section. */ - for (i = 1; i < section->reloc_count; i++) + for (j = 1; j < (int) section->reloc_count; j++) { - arelent *reloc = section->orelocation[i]; + arelent *reloc = section->orelocation[j]; int scale; /* A relocation against a symbol in the *ABS* section really @@ -2620,7 +2638,9 @@ som_prep_for_fixups (abfd, syms, num_sym /* Sort a copy of the symbol table, rather than the canonical output symbol table. */ - sorted_syms = (asymbol **) bfd_zalloc (abfd, num_syms * sizeof (asymbol *)); + amt = num_syms; + amt *= sizeof (asymbol *); + sorted_syms = (asymbol **) bfd_zalloc (abfd, amt); memcpy (sorted_syms, syms, num_syms * sizeof (asymbol *)); qsort (sorted_syms, num_syms, sizeof (asymbol *), compare_syms); obj_som_sorted_syms (abfd) = sorted_syms; @@ -2653,6 +2673,7 @@ som_write_fixups (abfd, current_offset, unsigned int subspace_reloc_size = 0; unsigned int num_spaces = obj_som_file_hdr (abfd)->space_total; asection *section = abfd->sections; + bfd_size_type amt; memset (tmp_space, 0, SOM_TMP_BUFSIZE); p = tmp_space; @@ -2677,7 +2698,8 @@ som_write_fixups (abfd, current_offset, subsection != NULL; subsection = subsection->next) { - int reloc_offset, current_rounding_mode; + int reloc_offset; + unsigned int current_rounding_mode; #ifndef NO_PCREL_MODES int current_call_mode; #endif @@ -2705,7 +2727,7 @@ som_write_fixups (abfd, current_offset, each subspace. Seek to the start of the relocation stream for this subspace in preparation for writing out its fixup stream. */ - if (bfd_seek (abfd, current_offset + total_reloc_size, SEEK_SET) < 0) + if (bfd_seek (abfd, current_offset + total_reloc_size, SEEK_SET) != 0) return false; /* Buffer space has already been allocated. Just perform some @@ -2743,8 +2765,8 @@ som_write_fixups (abfd, current_offset, upper limit, but leave lots of space for growth). */ if (p - tmp_space + 100 > SOM_TMP_BUFSIZE) { - if (bfd_write ((PTR) tmp_space, p - tmp_space, 1, abfd) - != p - tmp_space) + amt = p - tmp_space; + if (bfd_bwrite ((PTR) tmp_space, amt, abfd) != amt) return false; p = tmp_space; @@ -2827,7 +2849,7 @@ som_write_fixups (abfd, current_offset, { bfd_put_8 (abfd, bfd_reloc->howto->type + 33, p); bfd_put_8 (abfd, sym_num >> 16, p + 1); - bfd_put_16 (abfd, sym_num, p + 2); + bfd_put_16 (abfd, (bfd_vma) sym_num, p + 2); p = try_prev_fixup (abfd, &subspace_reloc_size, p, 4, reloc_queue); } @@ -2856,7 +2878,7 @@ som_write_fixups (abfd, current_offset, { bfd_put_8 (abfd, bfd_reloc->howto->type + 1, p); bfd_put_8 (abfd, sym_num >> 16, p + 1); - bfd_put_16 (abfd, sym_num, p + 2); + bfd_put_16 (abfd, (bfd_vma) sym_num, p + 2); p = try_prev_fixup (abfd, &subspace_reloc_size, p, 4, reloc_queue); } @@ -2866,7 +2888,7 @@ som_write_fixups (abfd, current_offset, case R_ENTRY: { - int tmp; + unsigned int tmp; arelent *tmp_reloc = NULL; bfd_put_8 (abfd, R_ENTRY, p); @@ -2978,7 +3000,7 @@ som_write_fixups (abfd, current_offset, bfd_put_8 (abfd, bfd_reloc->howto->type, p); bfd_put_8 (abfd, 0x80, p + 1); bfd_put_8 (abfd, sym_num >> 16, p + 2); - bfd_put_16 (abfd, sym_num, p + 3); + bfd_put_16 (abfd, (bfd_vma) sym_num, p + 3); p = try_prev_fixup (abfd, &subspace_reloc_size, p, 5, reloc_queue); break; @@ -3011,8 +3033,8 @@ som_write_fixups (abfd, current_offset, p, &subspace_reloc_size, reloc_queue); /* Scribble out the relocations. */ - if (bfd_write ((PTR) tmp_space, p - tmp_space, 1, abfd) - != p - tmp_space) + amt = p - tmp_space; + if (bfd_bwrite ((PTR) tmp_space, amt, abfd) != amt) return false; p = tmp_space; @@ -3041,10 +3063,11 @@ som_write_space_strings (abfd, current_o unsigned char *p = tmp_space; unsigned int strings_size = 0; asection *section; + bfd_size_type amt; /* Seek to the start of the space strings in preparation for writing them out. */ - if (bfd_seek (abfd, current_offset, SEEK_SET) < 0) + if (bfd_seek (abfd, (file_ptr) current_offset, SEEK_SET) != 0) return false; /* Walk through all the spaces and subspaces (order is not important) @@ -3068,8 +3091,8 @@ som_write_space_strings (abfd, current_o if (p - tmp_space + 5 + length > tmp_space_size) { /* Flush buffer before refilling or reallocating. */ - if (bfd_write ((PTR) &tmp_space[0], p - tmp_space, 1, abfd) - != p - tmp_space) + amt = p - tmp_space; + if (bfd_bwrite ((PTR) &tmp_space[0], amt, abfd) != amt) return false; /* Reallocate if now empty buffer still too small. */ @@ -3093,7 +3116,7 @@ som_write_space_strings (abfd, current_o /* First element in a string table entry is the length of the string. Alignment issues are already handled. */ - bfd_put_32 (abfd, length, p); + bfd_put_32 (abfd, (bfd_vma) length, p); p += 4; strings_size += 4; @@ -3119,7 +3142,8 @@ som_write_space_strings (abfd, current_o /* Done with the space/subspace strings. Write out any information contained in a partial block. */ - if (bfd_write ((PTR) &tmp_space[0], p - tmp_space, 1, abfd) != p - tmp_space) + amt = p - tmp_space; + if (bfd_bwrite ((PTR) &tmp_space[0], amt, abfd) != amt) return false; *string_sizep = strings_size; return true; @@ -3147,6 +3171,7 @@ som_write_symbol_strings (abfd, current_ unsigned int strings_size = 0; unsigned char *comp[4]; + bfd_size_type amt; /* This gets a bit gruesome because of the compilation unit. The strings within the compilation unit are part of the symbol @@ -3164,7 +3189,7 @@ som_write_symbol_strings (abfd, current_ /* Seek to the start of the space strings in preparation for writing them out. */ - if (bfd_seek (abfd, current_offset, SEEK_SET) < 0) + if (bfd_seek (abfd, (file_ptr) current_offset, SEEK_SET) != 0) return false; if (compilation_unit) @@ -3179,8 +3204,8 @@ som_write_symbol_strings (abfd, current_ if (p - tmp_space + 5 + length > tmp_space_size) { /* Flush buffer before refilling or reallocating. */ - if (bfd_write ((PTR) &tmp_space[0], p - tmp_space, 1, abfd) - != p - tmp_space) + amt = p - tmp_space; + if (bfd_bwrite ((PTR) &tmp_space[0], amt, abfd) != amt) return false; /* Reallocate if now empty buffer still too small. */ @@ -3200,7 +3225,7 @@ som_write_symbol_strings (abfd, current_ the string. This must always be 4 byte aligned. This is also an appropriate time to fill in the string index field in the symbol table entry. */ - bfd_put_32 (abfd, length, p); + bfd_put_32 (abfd, (bfd_vma) length, p); strings_size += 4; p += 4; @@ -3248,8 +3273,8 @@ som_write_symbol_strings (abfd, current_ if (p - tmp_space + 5 + length > tmp_space_size) { /* Flush buffer before refilling or reallocating. */ - if (bfd_write ((PTR) &tmp_space[0], p - tmp_space, 1, abfd) - != p - tmp_space) + amt = p - tmp_space; + if (bfd_bwrite ((PTR) &tmp_space[0], amt, abfd) != amt) return false; /* Reallocate if now empty buffer still too small. */ @@ -3268,7 +3293,7 @@ som_write_symbol_strings (abfd, current_ string. This must always be 4 byte aligned. This is also an appropriate time to fill in the string index field in the symbol table entry. */ - bfd_put_32 (abfd, length, p); + bfd_put_32 (abfd, (bfd_vma) length, p); strings_size += 4; p += 4; @@ -3289,7 +3314,8 @@ som_write_symbol_strings (abfd, current_ } /* Scribble out any partial block. */ - if (bfd_write ((PTR) &tmp_space[0], p - tmp_space, 1, abfd) != p - tmp_space) + amt = p - tmp_space; + if (bfd_bwrite ((PTR) &tmp_space[0], amt, abfd) != amt) return false; *string_sizep = strings_size; @@ -3343,47 +3369,47 @@ som_begin_writing (abfd) } if (obj_som_version_hdr (abfd) != NULL) { - unsigned int len; + bfd_size_type len; - if (bfd_seek (abfd, current_offset, SEEK_SET) < 0) + if (bfd_seek (abfd, (file_ptr) current_offset, SEEK_SET) != 0) return false; /* Write the aux_id structure and the string length. */ len = sizeof (struct aux_id) + sizeof (unsigned int); obj_som_file_hdr (abfd)->aux_header_size += len; current_offset += len; - if (bfd_write ((PTR) obj_som_version_hdr (abfd), len, 1, abfd) != len) + if (bfd_bwrite ((PTR) obj_som_version_hdr (abfd), len, abfd) != len) return false; /* Write the version string. */ len = obj_som_version_hdr (abfd)->header_id.length - sizeof (int); obj_som_file_hdr (abfd)->aux_header_size += len; current_offset += len; - if (bfd_write ((PTR) obj_som_version_hdr (abfd)->user_string, - len, 1, abfd) != len) + if (bfd_bwrite ((PTR) obj_som_version_hdr (abfd)->user_string, len, abfd) + != len) return false; } if (obj_som_copyright_hdr (abfd) != NULL) { - unsigned int len; + bfd_size_type len; - if (bfd_seek (abfd, current_offset, SEEK_SET) < 0) + if (bfd_seek (abfd, (file_ptr) current_offset, SEEK_SET) != 0) return false; /* Write the aux_id structure and the string length. */ len = sizeof (struct aux_id) + sizeof (unsigned int); obj_som_file_hdr (abfd)->aux_header_size += len; current_offset += len; - if (bfd_write ((PTR) obj_som_copyright_hdr (abfd), len, 1, abfd) != len) + if (bfd_bwrite ((PTR) obj_som_copyright_hdr (abfd), len, abfd) != len) return false; /* Write the copyright string. */ len = obj_som_copyright_hdr (abfd)->header_id.length - sizeof (int); obj_som_file_hdr (abfd)->aux_header_size += len; current_offset += len; - if (bfd_write ((PTR) obj_som_copyright_hdr (abfd)->copyright, - len, 1, abfd) != len) + if (bfd_bwrite ((PTR) obj_som_copyright_hdr (abfd)->copyright, len, abfd) + != len) return false; } @@ -3628,9 +3654,9 @@ som_begin_writing (abfd) zeros are filled in. Ugh. */ if (abfd->flags & (EXEC_P | DYNAMIC)) current_offset = SOM_ALIGN (current_offset, PA_PAGESIZE); - if (bfd_seek (abfd, current_offset - 1, SEEK_SET) < 0) + if (bfd_seek (abfd, (file_ptr) current_offset - 1, SEEK_SET) != 0) return false; - if (bfd_write ((PTR) "", 1, 1, abfd) != 1) + if (bfd_bwrite ((PTR) "", (bfd_size_type) 1, abfd) != 1) return false; obj_som_file_hdr (abfd)->unloadable_sp_size @@ -3660,6 +3686,7 @@ som_finish_writing (abfd) asection *section; unsigned long current_offset; unsigned int total_reloc_size; + bfd_size_type amt; /* Next is the symbol table. These are fixed length records. @@ -3735,7 +3762,7 @@ som_finish_writing (abfd) /* Seek to the start of the subspace dictionary records. */ location = obj_som_file_hdr (abfd)->subspace_location; - if (bfd_seek (abfd, location, SEEK_SET) < 0) + if (bfd_seek (abfd, location, SEEK_SET) != 0) return false; section = abfd->sections; @@ -3783,9 +3810,9 @@ som_finish_writing (abfd) som_section_data (subsection)->subspace_dict->space_index = i; /* Dump the current subspace header. */ - if (bfd_write ((PTR) som_section_data (subsection)->subspace_dict, - sizeof (struct subspace_dictionary_record), 1, abfd) - != sizeof (struct subspace_dictionary_record)) + amt = sizeof (struct subspace_dictionary_record); + if (bfd_bwrite ((PTR) som_section_data (subsection)->subspace_dict, + amt, abfd) != amt) return false; } /* Goto the next section. */ @@ -3839,9 +3866,9 @@ som_finish_writing (abfd) som_section_data (subsection)->subspace_dict->space_index = i; /* Dump this subspace header. */ - if (bfd_write ((PTR) som_section_data (subsection)->subspace_dict, - sizeof (struct subspace_dictionary_record), 1, abfd) - != sizeof (struct subspace_dictionary_record)) + amt = sizeof (struct subspace_dictionary_record); + if (bfd_bwrite ((PTR) som_section_data (subsection)->subspace_dict, + amt, abfd) != amt) return false; } /* Goto the next section. */ @@ -3854,7 +3881,7 @@ som_finish_writing (abfd) Seek to the right location and start writing the space dictionary records. */ location = obj_som_file_hdr (abfd)->space_location; - if (bfd_seek (abfd, location, SEEK_SET) < 0) + if (bfd_seek (abfd, location, SEEK_SET) != 0) return false; section = abfd->sections; @@ -3865,9 +3892,9 @@ som_finish_writing (abfd) section = section->next; /* Dump its header. */ - if (bfd_write ((PTR) som_section_data (section)->space_dict, - sizeof (struct space_dictionary_record), 1, abfd) - != sizeof (struct space_dictionary_record)) + amt = sizeof (struct space_dictionary_record); + if (bfd_bwrite ((PTR) som_section_data (section)->space_dict, + amt, abfd) != amt) return false; /* Goto the next section. */ @@ -3878,11 +3905,11 @@ som_finish_writing (abfd) if (obj_som_compilation_unit (abfd)) { location = obj_som_file_hdr (abfd)->compiler_location; - if (bfd_seek (abfd, location, SEEK_SET) < 0) + if (bfd_seek (abfd, location, SEEK_SET) != 0) return false; - if (bfd_write ((PTR) obj_som_compilation_unit (abfd), - COMPUNITSZ, 1, abfd) != COMPUNITSZ) + amt = COMPUNITSZ; + if (bfd_bwrite ((PTR) obj_som_compilation_unit (abfd), amt, abfd) != amt) return false; } @@ -3903,11 +3930,10 @@ som_finish_writing (abfd) /* Only thing left to do is write out the file header. It is always at location zero. Seek there and write it. */ - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) < 0) + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) return false; - if (bfd_write ((PTR) obj_som_file_hdr (abfd), - sizeof (struct header), 1, abfd) - != sizeof (struct header)) + amt = sizeof (struct header); + if (bfd_bwrite ((PTR) obj_som_file_hdr (abfd), amt, abfd) != amt) return false; /* Now write the exec header. */ @@ -3941,11 +3967,11 @@ som_finish_writing (abfd) } if (bfd_seek (abfd, obj_som_file_hdr (abfd)->aux_header_location, - SEEK_SET) < 0) + SEEK_SET) != 0) return false; - if (bfd_write ((PTR) exec_header, AUX_HDR_SIZE, 1, abfd) - != AUX_HDR_SIZE) + amt = AUX_HDR_SIZE; + if (bfd_bwrite ((PTR) exec_header, amt, abfd) != amt) return false; } return true; @@ -4100,15 +4126,17 @@ som_build_and_write_symbol_table (abfd) file_ptr symtab_location = obj_som_file_hdr (abfd)->symbol_location; asymbol **bfd_syms = obj_som_sorted_syms (abfd); struct symbol_dictionary_record *som_symtab = NULL; - int i, symtab_size; + unsigned int i; + bfd_size_type symtab_size; /* Compute total symbol table size and allocate a chunk of memory to hold the symbol table as we build it. */ - symtab_size = num_syms * sizeof (struct symbol_dictionary_record); + symtab_size = num_syms; + symtab_size *= sizeof (struct symbol_dictionary_record); som_symtab = (struct symbol_dictionary_record *) bfd_malloc (symtab_size); if (som_symtab == NULL && symtab_size != 0) goto error_return; - memset (som_symtab, 0, symtab_size); + memset (som_symtab, 0, (size_t) symtab_size); /* Walk over each symbol. */ for (i = 0; i < num_syms; i++) @@ -4138,7 +4166,7 @@ som_build_and_write_symbol_table (abfd) if (bfd_seek (abfd, symtab_location, SEEK_SET) != 0) return false; - if (bfd_write ((PTR) som_symtab, symtab_size, 1, abfd) != symtab_size) + if (bfd_bwrite ((PTR) som_symtab, symtab_size, abfd) != symtab_size) goto error_return; if (som_symtab != NULL) @@ -4177,6 +4205,7 @@ som_slurp_string_table (abfd) bfd *abfd; { char *stringtab; + bfd_size_type amt; /* Use the saved version if its available. */ if (obj_som_stringtab (abfd) != NULL) @@ -4192,16 +4221,16 @@ som_slurp_string_table (abfd) } /* Allocate and read in the string table. */ - stringtab = bfd_malloc (obj_som_stringtab_size (abfd)); + amt = obj_som_stringtab_size (abfd); + stringtab = bfd_malloc (amt); if (stringtab == NULL) return false; memset (stringtab, 0, obj_som_stringtab_size (abfd)); - if (bfd_seek (abfd, obj_som_str_filepos (abfd), SEEK_SET) < 0) + if (bfd_seek (abfd, obj_som_str_filepos (abfd), SEEK_SET) != 0) return false; - if (bfd_read (stringtab, obj_som_stringtab_size (abfd), 1, abfd) - != obj_som_stringtab_size (abfd)) + if (bfd_bread (stringtab, amt, abfd) != amt) return false; /* Save our results and return success. */ @@ -4282,6 +4311,7 @@ som_slurp_symbol_table (abfd) char *stringtab; struct symbol_dictionary_record *buf = NULL, *bufp, *endbufp; som_symbol_type *sym, *symbase; + bfd_size_type amt; /* Return saved value if it exists. */ if (obj_som_symtab (abfd) != NULL) @@ -4296,20 +4326,22 @@ som_slurp_symbol_table (abfd) stringtab = obj_som_stringtab (abfd); - symbase = ((som_symbol_type *) - bfd_malloc (symbol_count * sizeof (som_symbol_type))); + amt = symbol_count; + amt *= sizeof (som_symbol_type); + symbase = (som_symbol_type *) bfd_malloc (amt); if (symbase == NULL) goto error_return; memset (symbase, 0, symbol_count * sizeof (som_symbol_type)); /* Read in the external SOM representation. */ - buf = bfd_malloc (symbol_count * symsize); - if (buf == NULL && symbol_count * symsize != 0) + amt = symbol_count; + amt *= symsize; + buf = bfd_malloc (amt); + if (buf == NULL && amt != 0) goto error_return; - if (bfd_seek (abfd, obj_som_sym_filepos (abfd), SEEK_SET) < 0) + if (bfd_seek (abfd, obj_som_sym_filepos (abfd), SEEK_SET) != 0) goto error_return; - if (bfd_read (buf, symbol_count * symsize, 1, abfd) - != symbol_count * symsize) + if (bfd_bread (buf, amt, abfd) != amt) goto error_return; /* Iterate over all the symbols and internalize them. */ @@ -4487,8 +4519,8 @@ static asymbol * som_make_empty_symbol (abfd) bfd *abfd; { - som_symbol_type *new = - (som_symbol_type *) bfd_zalloc (abfd, sizeof (som_symbol_type)); + bfd_size_type amt = sizeof (som_symbol_type); + som_symbol_type *new = (som_symbol_type *) bfd_zalloc (abfd, amt); if (new == NULL) return 0; new->symbol.the_bfd = abfd; @@ -4518,7 +4550,7 @@ som_print_symbol (abfd, afile, symbol, h break; case bfd_print_symbol_all: { - CONST char *section_name; + const char *section_name; section_name = symbol->section ? symbol->section->name : "(*none*)"; bfd_print_symbol_vandf (abfd, (PTR) file, symbol); fprintf (file, " %s\t%s", section_name, symbol->name); @@ -4640,13 +4672,13 @@ som_set_reloc_info (fixup, end, internal c = *cp++; /* If this is a variable, push it on the stack. */ - if (isupper (c)) + if (ISUPPER (c)) push (var (c)); /* If this is a lower case letter, then it represents additional data from the fixup stream to be pushed onto the stack. */ - else if (islower (c)) + else if (ISLOWER (c)) { int bits = (c - 'a') * 8; for (v = 0; c > 'a'; --c) @@ -4657,10 +4689,10 @@ som_set_reloc_info (fixup, end, internal } /* A decimal constant. Push it on the stack. */ - else if (isdigit (c)) + else if (ISDIGIT (c)) { v = c - '0'; - while (isdigit (*cp)) + while (ISDIGIT (*cp)) v = (v * 10) + (*cp++ - '0'); push (v); } @@ -4849,13 +4881,13 @@ som_set_reloc_info (fixup, end, internal day if the need arises. */ section->contents = bfd_malloc (section->_raw_size); if (section->contents == NULL) - return -1; + return (unsigned) -1; deallocate_contents = 1; bfd_get_section_contents (section->owner, section, section->contents, - 0, + (bfd_vma) 0, section->_raw_size); } else if (rptr->addend == 0) @@ -4903,6 +4935,7 @@ som_slurp_reloc_table (abfd, section, sy unsigned int fixup_stream_size; arelent *internal_relocs; unsigned int num_relocs; + bfd_size_type amt; fixup_stream_size = som_section_data (section)->reloc_size; /* If there were no relocations, then there is nothing to do. */ @@ -4911,9 +4944,10 @@ som_slurp_reloc_table (abfd, section, sy /* If reloc_count is -1, then the relocation stream has not been parsed. We must do so now to know how many relocations exist. */ - if (section->reloc_count == -1) + if (section->reloc_count == (unsigned) -1) { - external_relocs = (char *) bfd_malloc (fixup_stream_size); + amt = fixup_stream_size; + external_relocs = (char *) bfd_malloc (amt); if (external_relocs == (char *) NULL) return false; /* Read in the external forms. */ @@ -4922,8 +4956,7 @@ som_slurp_reloc_table (abfd, section, sy SEEK_SET) != 0) return false; - if (bfd_read (external_relocs, 1, fixup_stream_size, abfd) - != fixup_stream_size) + if (bfd_bread (external_relocs, amt, abfd) != amt) return false; /* Let callers know how many relocations found. @@ -4946,8 +4979,9 @@ som_slurp_reloc_table (abfd, section, sy if (section->relocation != (arelent *) NULL) return true; - internal_relocs = (arelent *) - bfd_zalloc (abfd, (num_relocs * sizeof (arelent))); + amt = num_relocs; + amt *= sizeof (arelent); + internal_relocs = (arelent *) bfd_zalloc (abfd, (amt)); if (internal_relocs == (arelent *) NULL) return false; @@ -5019,8 +5053,8 @@ som_new_section_hook (abfd, newsect) bfd *abfd; asection *newsect; { - newsect->used_by_bfd = - (PTR) bfd_zalloc (abfd, sizeof (struct som_section_data_struct)); + bfd_size_type amt = sizeof (struct som_section_data_struct); + newsect->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); if (!newsect->used_by_bfd) return false; newsect->alignment_power = 3; @@ -5065,15 +5099,17 @@ som_bfd_copy_private_section_data (ibfd, bfd *obfd; asection *osection; { + bfd_size_type amt; + /* One day we may try to grok other private data. */ if (ibfd->xvec->flavour != bfd_target_som_flavour || obfd->xvec->flavour != bfd_target_som_flavour || (!som_is_space (isection) && !som_is_subspace (isection))) return true; + amt = sizeof (struct som_copyable_section_data_struct); som_section_data (osection)->copy_data = - (struct som_copyable_section_data_struct *) - bfd_zalloc (obfd, sizeof (struct som_copyable_section_data_struct)); + (struct som_copyable_section_data_struct *) bfd_zalloc (obfd, amt); if (som_section_data (osection)->copy_data == NULL) return false; @@ -5103,7 +5139,7 @@ som_bfd_copy_private_bfd_data (ibfd, obf /* Allocate some memory to hold the data we need. */ obj_som_exec_data (obfd) = (struct som_exec_data *) - bfd_zalloc (obfd, sizeof (struct som_exec_data)); + bfd_zalloc (obfd, (bfd_size_type) sizeof (struct som_exec_data)); if (obj_som_exec_data (obfd) == NULL) return false; @@ -5128,10 +5164,10 @@ bfd_som_set_section_attributes (section, /* Allocate memory to hold the magic information. */ if (som_section_data (section)->copy_data == NULL) { + bfd_size_type amt = sizeof (struct som_copyable_section_data_struct); som_section_data (section)->copy_data = - (struct som_copyable_section_data_struct *) - bfd_zalloc (section->owner, - sizeof (struct som_copyable_section_data_struct)); + (struct som_copyable_section_data_struct *) bfd_zalloc (section->owner, + amt); if (som_section_data (section)->copy_data == NULL) return false; } @@ -5158,10 +5194,10 @@ bfd_som_set_subsection_attributes (secti /* Allocate memory to hold the magic information. */ if (som_section_data (section)->copy_data == NULL) { + bfd_size_type amt = sizeof (struct som_copyable_section_data_struct); som_section_data (section)->copy_data = - (struct som_copyable_section_data_struct *) - bfd_zalloc (section->owner, - sizeof (struct som_copyable_section_data_struct)); + (struct som_copyable_section_data_struct *) bfd_zalloc (section->owner, + amt); if (som_section_data (section)->copy_data == NULL) return false; } @@ -5195,16 +5231,18 @@ bfd_som_attach_aux_hdr (abfd, type, stri int type; char *string; { + bfd_size_type amt; + if (type == VERSION_AUX_ID) { - int len = strlen (string); + size_t len = strlen (string); int pad = 0; if (len % 4) pad = (4 - (len % 4)); - obj_som_version_hdr (abfd) = (struct user_string_aux_hdr *) - bfd_zalloc (abfd, sizeof (struct aux_id) - + sizeof (unsigned int) + len + pad); + amt = sizeof (struct aux_id) + sizeof (unsigned int) + len + pad; + obj_som_version_hdr (abfd) = + (struct user_string_aux_hdr *) bfd_zalloc (abfd, amt); if (!obj_som_version_hdr (abfd)) return false; obj_som_version_hdr (abfd)->header_id.type = VERSION_AUX_ID; @@ -5220,9 +5258,9 @@ bfd_som_attach_aux_hdr (abfd, type, stri if (len % 4) pad = (4 - (len % 4)); - obj_som_copyright_hdr (abfd) = (struct copyright_aux_hdr *) - bfd_zalloc (abfd, sizeof (struct aux_id) - + sizeof (unsigned int) + len + pad); + amt = sizeof (struct aux_id) + sizeof (unsigned int) + len + pad; + obj_som_copyright_hdr (abfd) = + (struct copyright_aux_hdr *) bfd_zalloc (abfd, amt); if (!obj_som_copyright_hdr (abfd)) return false; obj_som_copyright_hdr (abfd)->header_id.type = COPYRIGHT_AUX_ID; @@ -5246,14 +5284,14 @@ bfd_som_attach_compilation_unit (abfd, n const char *product_id; const char *version_id; { - COMPUNIT *n = (COMPUNIT *) bfd_zalloc (abfd, COMPUNITSZ); + COMPUNIT *n = (COMPUNIT *) bfd_zalloc (abfd, (bfd_size_type) COMPUNITSZ); if (n == NULL) return false; #define STRDUP(f) \ if (f != NULL) \ { \ - n->f.n_name = bfd_alloc (abfd, strlen (f) + 1); \ + n->f.n_name = bfd_alloc (abfd, (bfd_size_type) strlen (f) + 1); \ if (n->f.n_name == NULL) \ return false; \ strcpy (n->f.n_name, f); \ @@ -5282,8 +5320,8 @@ som_get_section_contents (abfd, section, if (count == 0 || ((section->flags & SEC_HAS_CONTENTS) == 0)) return true; if ((bfd_size_type) (offset+count) > section->_raw_size - || bfd_seek (abfd, (file_ptr) (section->filepos + offset), SEEK_SET) == -1 - || bfd_read (location, (bfd_size_type) 1, count, abfd) != count) + || bfd_seek (abfd, (file_ptr) (section->filepos + offset), SEEK_SET) != 0 + || bfd_bread (location, count, abfd) != count) return (false); /* on error */ return (true); } @@ -5316,10 +5354,10 @@ som_set_section_contents (abfd, section, /* Seek to the proper offset within the object file and write the data. */ offset += som_section_data (section)->subspace_dict->file_loc_init_value; - if (bfd_seek (abfd, offset, SEEK_SET) == -1) + if (bfd_seek (abfd, offset, SEEK_SET) != 0) return false; - if (bfd_write ((PTR) location, 1, count, abfd) != count) + if (bfd_bwrite ((PTR) location, count, abfd) != count) return false; return true; } @@ -5341,8 +5379,8 @@ som_find_nearest_line (abfd, section, sy asection *section ATTRIBUTE_UNUSED; asymbol **symbols ATTRIBUTE_UNUSED; bfd_vma offset ATTRIBUTE_UNUSED; - CONST char **filename_ptr ATTRIBUTE_UNUSED; - CONST char **functionname_ptr ATTRIBUTE_UNUSED; + const char **filename_ptr ATTRIBUTE_UNUSED; + const char **functionname_ptr ATTRIBUTE_UNUSED; unsigned int *line_ptr ATTRIBUTE_UNUSED; { return (false); @@ -5400,7 +5438,7 @@ som_decode_symclass (symbol) else return '?'; if (symbol->flags & BSF_GLOBAL) - c = toupper (c); + c = TOUPPER (c); return c; } @@ -5431,11 +5469,12 @@ som_bfd_count_ar_symbols (abfd, lst_head { unsigned int i; unsigned int *hash_table = NULL; + bfd_size_type amt; file_ptr lst_filepos = bfd_tell (abfd) - sizeof (struct lst_header); - hash_table = - (unsigned int *) bfd_malloc (lst_header->hash_size - * sizeof (unsigned int)); + amt = lst_header->hash_size; + amt *= sizeof (unsigned int); + hash_table = (unsigned int *) bfd_malloc (amt); if (hash_table == NULL && lst_header->hash_size != 0) goto error_return; @@ -5444,8 +5483,7 @@ som_bfd_count_ar_symbols (abfd, lst_head /* Read in the hash table. The has table is an array of 32bit file offsets which point to the hash chains. */ - if (bfd_read ((PTR) hash_table, lst_header->hash_size, 4, abfd) - != lst_header->hash_size * 4) + if (bfd_bread ((PTR) hash_table, amt, abfd) != amt) goto error_return; /* Walk each chain counting the number of symbols found on that particular @@ -5459,12 +5497,12 @@ som_bfd_count_ar_symbols (abfd, lst_head continue; /* Seek to the first symbol in this hash chain. */ - if (bfd_seek (abfd, lst_filepos + hash_table[i], SEEK_SET) < 0) + if (bfd_seek (abfd, lst_filepos + hash_table[i], SEEK_SET) != 0) goto error_return; /* Read in this symbol and update the counter. */ - if (bfd_read ((PTR) & lst_symbol, 1, sizeof (lst_symbol), abfd) - != sizeof (lst_symbol)) + amt = sizeof (lst_symbol); + if (bfd_bread ((PTR) &lst_symbol, amt, abfd) != amt) goto error_return; (*count)++; @@ -5475,12 +5513,12 @@ som_bfd_count_ar_symbols (abfd, lst_head /* Seek to the next symbol. */ if (bfd_seek (abfd, lst_filepos + lst_symbol.next_entry, SEEK_SET) - < 0) + != 0) goto error_return; /* Read the symbol in and update the counter. */ - if (bfd_read ((PTR) & lst_symbol, 1, sizeof (lst_symbol), abfd) - != sizeof (lst_symbol)) + amt = sizeof (lst_symbol); + if (bfd_bread ((PTR) &lst_symbol, amt, abfd) != amt) goto error_return; (*count)++; @@ -5509,34 +5547,32 @@ som_bfd_fill_in_ar_symbols (abfd, lst_he carsym *set = syms[0]; unsigned int *hash_table = NULL; struct som_entry *som_dict = NULL; + bfd_size_type amt; file_ptr lst_filepos = bfd_tell (abfd) - sizeof (struct lst_header); - hash_table = - (unsigned int *) bfd_malloc (lst_header->hash_size - * sizeof (unsigned int)); + amt = lst_header->hash_size; + amt *= sizeof (unsigned int); + hash_table = (unsigned int *) bfd_malloc (amt); if (hash_table == NULL && lst_header->hash_size != 0) goto error_return; - som_dict = - (struct som_entry *) bfd_malloc (lst_header->module_count - * sizeof (struct som_entry)); - if (som_dict == NULL && lst_header->module_count != 0) - goto error_return; - /* Read in the hash table. The has table is an array of 32bit file offsets which point to the hash chains. */ - if (bfd_read ((PTR) hash_table, lst_header->hash_size, 4, abfd) - != lst_header->hash_size * 4) + if (bfd_bread ((PTR) hash_table, amt, abfd) != amt) goto error_return; /* Seek to and read in the SOM dictionary. We will need this to fill in the carsym's filepos field. */ - if (bfd_seek (abfd, lst_filepos + lst_header->dir_loc, SEEK_SET) < 0) + if (bfd_seek (abfd, lst_filepos + lst_header->dir_loc, SEEK_SET) != 0) + goto error_return; + + amt = lst_header->module_count; + amt *= sizeof (struct som_entry); + som_dict = (struct som_entry *) bfd_malloc (amt); + if (som_dict == NULL && lst_header->module_count != 0) goto error_return; - if (bfd_read ((PTR) som_dict, lst_header->module_count, - sizeof (struct som_entry), abfd) - != lst_header->module_count * sizeof (struct som_entry)) + if (bfd_bread ((PTR) som_dict, amt, abfd) != amt) goto error_return; /* Walk each chain filling in the carsyms as we go along. */ @@ -5549,11 +5585,11 @@ som_bfd_fill_in_ar_symbols (abfd, lst_he continue; /* Seek to and read the first symbol on the chain. */ - if (bfd_seek (abfd, lst_filepos + hash_table[i], SEEK_SET) < 0) + if (bfd_seek (abfd, lst_filepos + hash_table[i], SEEK_SET) != 0) goto error_return; - if (bfd_read ((PTR) & lst_symbol, 1, sizeof (lst_symbol), abfd) - != sizeof (lst_symbol)) + amt = sizeof (lst_symbol); + if (bfd_bread ((PTR) &lst_symbol, amt, abfd) != amt) goto error_return; /* Get the name of the symbol, first get the length which is stored @@ -5564,17 +5600,17 @@ som_bfd_fill_in_ar_symbols (abfd, lst_he index can point *anywhere* in the archive to save space, so just using the string table would not be safe. */ if (bfd_seek (abfd, lst_filepos + lst_header->string_loc - + lst_symbol.name.n_strx - 4, SEEK_SET) < 0) + + lst_symbol.name.n_strx - 4, SEEK_SET) != 0) goto error_return; - if (bfd_read (&len, 1, 4, abfd) != 4) + if (bfd_bread (&len, (bfd_size_type) 4, abfd) != 4) goto error_return; /* Allocate space for the name and null terminate it too. */ - set->name = bfd_zalloc (abfd, len + 1); + set->name = bfd_zalloc (abfd, (bfd_size_type) len + 1); if (!set->name) goto error_return; - if (bfd_read (set->name, 1, len, abfd) != len) + if (bfd_bread (set->name, (bfd_size_type) len, abfd) != len) goto error_return; set->name[len] = 0; @@ -5591,27 +5627,28 @@ som_bfd_fill_in_ar_symbols (abfd, lst_he while (lst_symbol.next_entry) { /* Seek to the next symbol and read it in. */ - if (bfd_seek (abfd, lst_filepos + lst_symbol.next_entry, SEEK_SET) <0) + if (bfd_seek (abfd, lst_filepos + lst_symbol.next_entry, SEEK_SET) + != 0) goto error_return; - if (bfd_read ((PTR) & lst_symbol, 1, sizeof (lst_symbol), abfd) - != sizeof (lst_symbol)) + amt = sizeof (lst_symbol); + if (bfd_bread ((PTR) &lst_symbol, amt, abfd) != amt) goto error_return; /* Seek to the name length & string and read them in. */ if (bfd_seek (abfd, lst_filepos + lst_header->string_loc - + lst_symbol.name.n_strx - 4, SEEK_SET) < 0) + + lst_symbol.name.n_strx - 4, SEEK_SET) != 0) goto error_return; - if (bfd_read (&len, 1, 4, abfd) != 4) + if (bfd_bread (&len, (bfd_size_type) 4, abfd) != 4) goto error_return; /* Allocate space for the name and null terminate it too. */ - set->name = bfd_zalloc (abfd, len + 1); + set->name = bfd_zalloc (abfd, (bfd_size_type) len + 1); if (!set->name) goto error_return; - if (bfd_read (set->name, 1, len, abfd) != len) + if (bfd_bread (set->name, (bfd_size_type) len, abfd) != len) goto error_return; set->name[len] = 0; @@ -5651,7 +5688,8 @@ som_slurp_armap (abfd) unsigned int parsed_size; struct artdata *ardata = bfd_ardata (abfd); char nextname[17]; - int i = bfd_read ((PTR) nextname, 1, 16, abfd); + bfd_size_type amt = 16; + int i = bfd_bread ((PTR) nextname, amt, abfd); /* Special cases. */ if (i == 0) @@ -5659,7 +5697,7 @@ som_slurp_armap (abfd) if (i != 16) return false; - if (bfd_seek (abfd, (file_ptr) - 16, SEEK_CUR) < 0) + if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0) return false; /* For archives without .o files there is no symbol table. */ @@ -5670,8 +5708,8 @@ som_slurp_armap (abfd) } /* Read in and sanity check the archive header. */ - if (bfd_read ((PTR) &ar_header, 1, sizeof (struct ar_hdr), abfd) - != sizeof (struct ar_hdr)) + amt = sizeof (struct ar_hdr); + if (bfd_bread ((PTR) &ar_header, amt, abfd) != amt) return false; if (strncmp (ar_header.ar_fmag, ARFMAG, 2)) @@ -5694,8 +5732,8 @@ som_slurp_armap (abfd) /* Read in the library symbol table. We'll make heavy use of this in just a minute. */ - if (bfd_read ((PTR) & lst_header, 1, sizeof (struct lst_header), abfd) - != sizeof (struct lst_header)) + amt = sizeof (struct lst_header); + if (bfd_bread ((PTR) &lst_header, amt, abfd) != amt) return false; /* Sanity check. */ @@ -5711,15 +5749,15 @@ som_slurp_armap (abfd) return false; /* Get back to the start of the library symbol table. */ - if (bfd_seek (abfd, ardata->first_file_filepos - parsed_size - + sizeof (struct lst_header), SEEK_SET) < 0) + if (bfd_seek (abfd, (ardata->first_file_filepos - parsed_size + + sizeof (struct lst_header)), SEEK_SET) != 0) return false; /* Initializae the cache and allocate space for the library symbols. */ ardata->cache = 0; - ardata->symdefs = (carsym *) bfd_alloc (abfd, - (ardata->symdef_count - * sizeof (carsym))); + amt = ardata->symdef_count; + amt *= sizeof (carsym); + ardata->symdefs = (carsym *) bfd_alloc (abfd, amt); if (!ardata->symdefs) return false; @@ -5730,7 +5768,7 @@ som_slurp_armap (abfd) /* Seek back to the "first" file in the archive. Note the "first" file may be the extended name table. */ - if (bfd_seek (abfd, ardata->first_file_filepos, SEEK_SET) < 0) + if (bfd_seek (abfd, ardata->first_file_filepos, SEEK_SET) != 0) return false; /* Notify the generic archive code that we have a symbol map. */ @@ -5849,20 +5887,23 @@ som_bfd_ar_write_symbol_stuff (abfd, nsy struct som_entry *som_dict = NULL; struct lst_symbol_record **last_hash_entry = NULL; unsigned int curr_som_offset, som_index = 0; + bfd_size_type amt; - hash_table = - (unsigned int *) bfd_malloc (lst.hash_size * sizeof (unsigned int)); + amt = lst.hash_size; + amt *= sizeof (unsigned int); + hash_table = (unsigned int *) bfd_malloc (amt); if (hash_table == NULL && lst.hash_size != 0) goto error_return; - som_dict = - (struct som_entry *) bfd_malloc (lst.module_count - * sizeof (struct som_entry)); + + amt = lst.module_count; + amt *= sizeof (struct som_entry); + som_dict = (struct som_entry *) bfd_malloc (amt); if (som_dict == NULL && lst.module_count != 0) goto error_return; - last_hash_entry = - ((struct lst_symbol_record **) - bfd_malloc (lst.hash_size * sizeof (struct lst_symbol_record *))); + amt = lst.hash_size; + amt *= sizeof (struct lst_symbol_record *); + last_hash_entry = ((struct lst_symbol_record **) bfd_malloc (amt)); if (last_hash_entry == NULL && lst.hash_size != 0) goto error_return; @@ -5900,10 +5941,12 @@ som_bfd_ar_write_symbol_stuff (abfd, nsy curr_som_offset = (curr_som_offset + 0x1) & ~0x1; /* FIXME should be done with buffers just like everything else... */ - lst_syms = bfd_malloc (nsyms * sizeof (struct lst_symbol_record)); + amt = nsyms; + amt *= sizeof (struct lst_symbol_record); + lst_syms = bfd_malloc (amt); if (lst_syms == NULL && nsyms != 0) goto error_return; - strings = bfd_malloc (string_size); + strings = bfd_malloc ((bfd_size_type) string_size); if (strings == NULL && string_size != 0) goto error_return; @@ -6037,29 +6080,29 @@ som_bfd_ar_write_symbol_stuff (abfd, nsy /* A particular object in the archive may have an odd length; the linker requires objects begin on an even boundary. So round up the current offset as necessary. */ - curr_som_offset = (curr_som_offset + 0x1) & ~0x1; + curr_som_offset = (curr_som_offset + 0x1) &~ (unsigned) 1; curr_bfd = curr_bfd->next; som_index++; } /* Now scribble out the hash table. */ - if (bfd_write ((PTR) hash_table, lst.hash_size, 4, abfd) - != lst.hash_size * 4) + amt = lst.hash_size * 4; + if (bfd_bwrite ((PTR) hash_table, amt, abfd) != amt) goto error_return; /* Then the SOM dictionary. */ - if (bfd_write ((PTR) som_dict, lst.module_count, - sizeof (struct som_entry), abfd) - != lst.module_count * sizeof (struct som_entry)) + amt = lst.module_count * sizeof (struct som_entry); + if (bfd_bwrite ((PTR) som_dict, amt, abfd) != amt) goto error_return; /* The library symbols. */ - if (bfd_write ((PTR) lst_syms, nsyms, sizeof (struct lst_symbol_record), abfd) - != nsyms * sizeof (struct lst_symbol_record)) + amt = nsyms * sizeof (struct lst_symbol_record); + if (bfd_bwrite ((PTR) lst_syms, amt, abfd) != amt) goto error_return; /* And finally the strings. */ - if (bfd_write ((PTR) strings, string_size, 1, abfd) != string_size) + amt = string_size; + if (bfd_bwrite ((PTR) strings, amt, abfd) != amt) goto error_return; if (hash_table != NULL) @@ -6107,6 +6150,7 @@ som_write_armap (abfd, elength, map, orl struct ar_hdr hdr; struct lst_header lst; int *p; + bfd_size_type amt; /* We'll use this for the archive's date and mode later. */ if (stat (abfd->filename, &statbuf) != 0) @@ -6199,18 +6243,17 @@ som_write_armap (abfd, elength, map, orl (((char *) (&hdr))[i]) = ' '; /* Scribble out the ar header. */ - if (bfd_write ((PTR) &hdr, 1, sizeof (struct ar_hdr), abfd) - != sizeof (struct ar_hdr)) + amt = sizeof (struct ar_hdr); + if (bfd_bwrite ((PTR) &hdr, amt, abfd) != amt) return false; /* Now scribble out the lst header. */ - if (bfd_write ((PTR) &lst, 1, sizeof (struct lst_header), abfd) - != sizeof (struct lst_header)) + amt = sizeof (struct lst_header); + if (bfd_bwrite ((PTR) &lst, amt, abfd) != amt) return false; /* Build and write the armap. */ - if (som_bfd_ar_write_symbol_stuff (abfd, nsyms, stringsize, lst, elength) - == false) + if (!som_bfd_ar_write_symbol_stuff (abfd, nsyms, stringsize, lst, elength)) return false; /* Done. */ @@ -6236,7 +6279,7 @@ som_bfd_free_cached_info (abfd) for (o = abfd->sections; o != (asection *) NULL; o = o->next) { /* Free the native relocations. */ - o->reloc_count = -1; + o->reloc_count = (unsigned) -1; FREE (som_section_data (o)->reloc_stream); /* Free the generic relocations. */ FREE (o->relocation); diff -uprN binutils-2.11.90.0.31/bfd/sparclinux.c binutils-2.11.92.0.5/bfd/sparclinux.c --- binutils-2.11.90.0.31/bfd/sparclinux.c Fri Mar 9 11:16:07 2001 +++ binutils-2.11.92.0.5/bfd/sparclinux.c Thu Oct 4 14:35:43 2001 @@ -1,5 +1,5 @@ /* BFD back-end for linux flavored sparc a.out binaries. - Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2000 + Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2001 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -37,7 +37,10 @@ USA. */ #include "libaout.h" /* BFD a.out internal data structures */ #define DEFAULT_ARCH bfd_arch_sparc -#define MY(OP) CAT(sparclinux_,OP) +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (sparclinux_,OP) #define TARGETNAME "a.out-sparc-linux" extern const bfd_target MY(vec); @@ -225,9 +228,9 @@ linux_link_hash_table_create (abfd) bfd *abfd; { struct linux_link_hash_table *ret; + bfd_size_type amt = sizeof (struct linux_link_hash_table); - ret = ((struct linux_link_hash_table *) - bfd_alloc (abfd, sizeof (struct linux_link_hash_table))); + ret = (struct linux_link_hash_table *) bfd_alloc (abfd, amt); if (ret == (struct linux_link_hash_table *) NULL) return (struct bfd_link_hash_table *) NULL; if (! NAME(aout,link_hash_table_init) (&ret->root, abfd, @@ -407,7 +410,8 @@ linux_add_one_symbol (info, abfd, name, if (! (_bfd_generic_link_add_one_symbol (info, linux_hash_table (info)->dynobj, SHARABLE_CONFLICTS, - BSF_GLOBAL | BSF_CONSTRUCTOR, s, 0, NULL, false, false, NULL))) + BSF_GLOBAL | BSF_CONSTRUCTOR, s, (bfd_vma) 0, NULL, + false, false, NULL))) return false; } @@ -446,7 +450,7 @@ linux_tally_symbols (h, data) name = h->root.root.root.string + sizeof NEEDS_SHRLIB - 1; p = strrchr (name, '_'); if (p != NULL) - alloc = (char *) bfd_malloc (strlen (name) + 1); + alloc = (char *) bfd_malloc ((bfd_size_type) strlen (name) + 1); if (p == NULL || alloc == NULL) (*_bfd_error_handler) (_("Output file requires shared library `%s'\n"), @@ -590,7 +594,8 @@ bfd_sparclinux_size_dynamic_sections (ou ".linux-dynamic"); if (s != NULL) { - s->_raw_size = 8 + linux_hash_table (info)->fixup_count * 8; + s->_raw_size = linux_hash_table (info)->fixup_count + 1; + s->_raw_size *= 8; s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size); if (s->contents == NULL) return false; @@ -633,7 +638,8 @@ linux_finish_dynamic_link (output_bfd, i #endif fixup_table = s->contents; - bfd_put_32 (output_bfd, linux_hash_table (info)->fixup_count, fixup_table); + bfd_put_32 (output_bfd, + (bfd_vma) linux_hash_table (info)->fixup_count, fixup_table); fixup_table += 4; /* Fill in fixup table. */ @@ -664,14 +670,14 @@ linux_finish_dynamic_link (output_bfd, i { /* Relative address */ new_addr = new_addr - (f->value + 5); - bfd_put_32 (output_bfd, new_addr, fixup_table); + bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table); fixup_table += 4; bfd_put_32 (output_bfd, f->value + 1, fixup_table); fixup_table += 4; } else { - bfd_put_32 (output_bfd, new_addr, fixup_table); + bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table); fixup_table += 4; bfd_put_32 (output_bfd, f->value, fixup_table); fixup_table += 4; @@ -682,9 +688,9 @@ linux_finish_dynamic_link (output_bfd, i if (linux_hash_table (info)->local_builtins != 0) { /* Special marker so we know to switch to the other type of fixup */ - bfd_put_32 (output_bfd, 0, fixup_table); + bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table); fixup_table += 4; - bfd_put_32 (output_bfd, 0, fixup_table); + bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table); fixup_table += 4; ++fixups_written; for (f = linux_hash_table (info)->fixup_list; f != NULL; f = f->next) @@ -710,7 +716,7 @@ linux_finish_dynamic_link (output_bfd, i new_addr, f->value); #endif - bfd_put_32 (output_bfd, new_addr, fixup_table); + bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table); fixup_table += 4; bfd_put_32 (output_bfd, f->value, fixup_table); fixup_table += 4; @@ -723,9 +729,9 @@ linux_finish_dynamic_link (output_bfd, i (*_bfd_error_handler) (_("Warning: fixup count mismatch\n")); while (linux_hash_table (info)->fixup_count > fixups_written) { - bfd_put_32 (output_bfd, 0, fixup_table); + bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table); fixup_table += 4; - bfd_put_32 (output_bfd, 0, fixup_table); + bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table); fixup_table += 4; ++fixups_written; } @@ -747,15 +753,16 @@ linux_finish_dynamic_link (output_bfd, i printf ("Builtin fixup table at %x\n", new_addr); #endif - bfd_put_32 (output_bfd, new_addr, fixup_table); + bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table); } else - bfd_put_32 (output_bfd, 0, fixup_table); + bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table); - if (bfd_seek (output_bfd, os->filepos + s->output_offset, SEEK_SET) != 0) + if (bfd_seek (output_bfd, (file_ptr) (os->filepos + s->output_offset), + SEEK_SET) != 0) return false; - if (bfd_write ((PTR) s->contents, 1, s->_raw_size, output_bfd) + if (bfd_bwrite ((PTR) s->contents, s->_raw_size, output_bfd) != s->_raw_size) return false; diff -uprN binutils-2.11.90.0.31/bfd/sparclynx.c binutils-2.11.92.0.5/bfd/sparclynx.c --- binutils-2.11.90.0.31/bfd/sparclynx.c Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/bfd/sparclynx.c Thu Oct 4 14:35:43 2001 @@ -29,7 +29,10 @@ Foundation, Inc., 59 Temple Place - Suit #endif -#define MY(OP) CAT (sparclynx_aout_,OP) +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (sparclynx_aout_,OP) #define TARGETNAME "a.out-sparc-lynx" #include "bfd.h" @@ -43,7 +46,7 @@ Foundation, Inc., 59 Temple Place - Suit #include "aout/stab_gnu.h" #include "aout/ar.h" -void NAME (lynx,set_arch_mach) PARAMS ((bfd *, int)); +void NAME (lynx,set_arch_mach) PARAMS ((bfd *, unsigned long)); static void choose_reloc_size PARAMS ((bfd *)); static boolean NAME (aout,sparclynx_write_object_contents) PARAMS ((bfd *)); @@ -78,11 +81,11 @@ static boolean NAME (aout,sparclynx_writ void NAME(lynx,set_arch_mach) (abfd, machtype) bfd *abfd; - int machtype; + unsigned long machtype; { /* Determine the architecture and machine type of the object file. */ enum bfd_architecture arch; - long machine; + unsigned long machine; switch (machtype) { @@ -228,7 +231,7 @@ sparclynx_set_sizes (abfd) } } -static CONST struct aout_backend_data sparclynx_aout_backend = +static const struct aout_backend_data sparclynx_aout_backend = { 0, 1, 0, 1, 0, sparclynx_set_sizes, 0, 0, /* add_dynamic_symbols */ diff -uprN binutils-2.11.90.0.31/bfd/sparcnetbsd.c binutils-2.11.92.0.5/bfd/sparcnetbsd.c --- binutils-2.11.90.0.31/bfd/sparcnetbsd.c Fri Mar 9 11:16:08 2001 +++ binutils-2.11.92.0.5/bfd/sparcnetbsd.c Thu Oct 4 14:35:43 2001 @@ -1,5 +1,5 @@ /* BFD back-end for NetBSD/sparc a.out-ish binaries. - Copyright 1990, 1991, 1992, 1994, 1995, 1997, 1998, 2000 + Copyright 1990, 1991, 1992, 1994, 1995, 1997, 1998, 2000, 2001 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -28,7 +28,11 @@ Foundation, Inc., 59 Temple Place - Suit #define DEFAULT_ARCH bfd_arch_sparc #define DEFAULT_MID M_SPARC_NETBSD -#define MY(OP) CAT(sparcnetbsd_,OP) +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (sparcnetbsd_,OP) + /* This needs to start with a.out so GDB knows it is an a.out variant. */ #define TARGETNAME "a.out-sparc-netbsd" diff -uprN binutils-2.11.90.0.31/bfd/srec.c binutils-2.11.92.0.5/bfd/srec.c --- binutils-2.11.90.0.31/bfd/srec.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/srec.c Mon Oct 1 15:25:21 2001 @@ -1,6 +1,6 @@ /* BFD back-end for s-record objects. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000 + 2000, 2001 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support . @@ -108,7 +108,7 @@ DESCRIPTION #include "sysdep.h" #include "libbfd.h" #include "libiberty.h" -#include +#include "safe-ctype.h" static void srec_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *)); static void srec_print_symbol @@ -122,7 +122,7 @@ static const bfd_target *srec_object_p P static const bfd_target *symbolsrec_object_p PARAMS ((bfd *)); static boolean srec_read_section PARAMS ((bfd *, asection *, bfd_byte *)); -static boolean srec_write_record PARAMS ((bfd *, int, bfd_vma, +static boolean srec_write_record PARAMS ((bfd *, unsigned int, bfd_vma, const bfd_byte *, const bfd_byte *)); static boolean srec_write_header PARAMS ((bfd *)); @@ -144,7 +144,7 @@ static long srec_get_symtab PARAMS ((bfd /* Macros for converting between hex and binary. */ -static CONST char digs[] = "0123456789ABCDEF"; +static const char digs[] = "0123456789ABCDEF"; #define NIBBLE(x) hex_value(x) #define HEX(buffer) ((NIBBLE((buffer)[0])<<4) + NIBBLE((buffer)[1])) @@ -235,7 +235,8 @@ srec_mkobject (abfd) if (abfd->tdata.srec_data == NULL) { - tdata_type *tdata = (tdata_type *) bfd_alloc (abfd, sizeof (tdata_type)); + bfd_size_type amt = sizeof (tdata_type); + tdata_type *tdata = (tdata_type *) bfd_alloc (abfd, amt); if (tdata == NULL) return false; abfd->tdata.srec_data = tdata; @@ -260,7 +261,7 @@ srec_get_byte (abfd, errorptr) { bfd_byte c; - if (bfd_read (&c, 1, 1, abfd) != 1) + if (bfd_bread (&c, (bfd_size_type) 1, abfd) != 1) { if (bfd_get_error () != bfd_error_file_truncated) *errorptr = true; @@ -290,7 +291,7 @@ srec_bad_byte (abfd, lineno, c, error) { char buf[10]; - if (! isprint (c)) + if (! ISPRINT (c)) sprintf (buf, "\\%03o", (unsigned int) c); else { @@ -299,7 +300,7 @@ srec_bad_byte (abfd, lineno, c, error) } (*_bfd_error_handler) (_("%s:%d: Unexpected character `%s' in S-record file\n"), - bfd_get_filename (abfd), lineno, buf); + bfd_archive_filename (abfd), lineno, buf); bfd_set_error (bfd_error_bad_value); } } @@ -313,8 +314,9 @@ srec_new_symbol (abfd, name, val) bfd_vma val; { struct srec_symbol *n; + bfd_size_type amt = sizeof (struct srec_symbol); - n = (struct srec_symbol *) bfd_alloc (abfd, sizeof (struct srec_symbol)); + n = (struct srec_symbol *) bfd_alloc (abfd, amt); if (n == NULL) return false; @@ -389,7 +391,7 @@ srec_scan (abfd) case ' ': do { - unsigned int alc; + bfd_size_type alc; char *p, *symname; bfd_vma symval; @@ -416,9 +418,9 @@ srec_scan (abfd) *p++ = c; while ((c = srec_get_byte (abfd, &error)) != EOF - && ! isspace (c)) + && ! ISSPACE (c)) { - if ((unsigned int) (p - symbuf) >= alc) + if ((bfd_size_type) (p - symbuf) >= alc) { char *n; @@ -440,7 +442,7 @@ srec_scan (abfd) } *p++ = '\0'; - symname = bfd_alloc (abfd, p - symbuf); + symname = bfd_alloc (abfd, (bfd_size_type) (p - symbuf)); if (symname == NULL) goto error_return; strcpy (symname, symbuf); @@ -503,7 +505,7 @@ srec_scan (abfd) pos = bfd_tell (abfd) - 1; - if (bfd_read (hdr, 1, 3, abfd) != 3) + if (bfd_bread (hdr, (bfd_size_type) 3, abfd) != 3) goto error_return; if (! ISHEX (hdr[1]) || ! ISHEX (hdr[2])) @@ -521,13 +523,13 @@ srec_scan (abfd) { if (buf != NULL) free (buf); - buf = (bfd_byte *) bfd_malloc (bytes * 2); + buf = (bfd_byte *) bfd_malloc ((bfd_size_type) bytes * 2); if (buf == NULL) goto error_return; bufsize = bytes * 2; } - if (bfd_read (buf, 1, bytes * 2, abfd) != bytes * 2) + if (bfd_bread (buf, (bfd_size_type) bytes * 2, abfd) != bytes * 2) goto error_return; /* Ignore the checksum byte. */ @@ -572,9 +574,11 @@ srec_scan (abfd) { char secbuf[20]; char *secname; + bfd_size_type amt; sprintf (secbuf, ".sec%d", bfd_count_sections (abfd) + 1); - secname = (char *) bfd_alloc (abfd, strlen (secbuf) + 1); + amt = strlen (secbuf) + 1; + secname = (char *) bfd_alloc (abfd, amt); strcpy (secname, secbuf); sec = bfd_make_section (abfd, secname); if (sec == NULL) @@ -642,7 +646,7 @@ srec_object_p (abfd) srec_init (); if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 - || bfd_read (b, 1, 4, abfd) != 4) + || bfd_bread (b, (bfd_size_type) 4, abfd) != 4) return NULL; if (b[0] != 'S' || !ISHEX (b[1]) || !ISHEX (b[2]) || !ISHEX (b[3])) @@ -672,7 +676,7 @@ symbolsrec_object_p (abfd) srec_init (); if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 - || bfd_read (b, 1, 2, abfd) != 2) + || bfd_bread (b, (bfd_size_type) 2, abfd) != 2) return NULL; if (b[0] != '$' || b[1] != '$') @@ -722,7 +726,7 @@ srec_read_section (abfd, section, conten ought to know the exact format. */ BFD_ASSERT (c == 'S'); - if (bfd_read (hdr, 1, 3, abfd) != 3) + if (bfd_bread (hdr, (bfd_size_type) 3, abfd) != 3) goto error_return; BFD_ASSERT (ISHEX (hdr[1]) && ISHEX (hdr[2])); @@ -733,13 +737,13 @@ srec_read_section (abfd, section, conten { if (buf != NULL) free (buf); - buf = (bfd_byte *) bfd_malloc (bytes * 2); + buf = (bfd_byte *) bfd_malloc ((bfd_size_type) bytes * 2); if (buf == NULL) goto error_return; bufsize = bytes * 2; } - if (bfd_read (buf, 1, bytes * 2, abfd) != bytes * 2) + if (bfd_bread (buf, (bfd_size_type) bytes * 2, abfd) != bytes * 2) goto error_return; address = 0; @@ -821,8 +825,7 @@ srec_get_section_contents (abfd, section if (section->used_by_bfd == NULL) { section->used_by_bfd = bfd_alloc (abfd, section->_raw_size); - if (section->used_by_bfd == NULL - && section->_raw_size != 0) + if (section->used_by_bfd == NULL && section->_raw_size != 0) return false; if (! srec_read_section (abfd, section, section->used_by_bfd)) @@ -865,7 +868,7 @@ srec_set_section_contents (abfd, section register srec_data_list_type *entry; entry = ((srec_data_list_type *) - bfd_alloc (abfd, sizeof (srec_data_list_type))); + bfd_alloc (abfd, (bfd_size_type) sizeof (srec_data_list_type))); if (entry == NULL) return false; @@ -873,7 +876,9 @@ srec_set_section_contents (abfd, section && (section->flags & SEC_ALLOC) && (section->flags & SEC_LOAD)) { - bfd_byte *data = (bfd_byte *) bfd_alloc (abfd, bytes_to_do); + bfd_byte *data; + + data = (bfd_byte *) bfd_alloc (abfd, bytes_to_do); if (data == NULL) return false; memcpy ((PTR) data, location, (size_t) bytes_to_do); @@ -927,14 +932,14 @@ srec_set_section_contents (abfd, section static boolean srec_write_record (abfd, type, address, data, end) bfd *abfd; - int type; + unsigned int type; bfd_vma address; const bfd_byte *data; const bfd_byte *end; { char buffer[MAXCHUNK]; unsigned int check_sum = 0; - CONST bfd_byte *src = data; + const bfd_byte *src = data; char *dst = buffer; char *length; bfd_size_type wrlen; @@ -981,7 +986,7 @@ srec_write_record (abfd, type, address, *dst++ = '\r'; *dst++ = '\n'; wrlen = dst - buffer; - if (bfd_write ((PTR) buffer, 1, wrlen, abfd) != wrlen) + if (bfd_bwrite ((PTR) buffer, wrlen, abfd) != wrlen) return false; return true; } @@ -998,7 +1003,7 @@ srec_write_header (abfd) for (i = 0; i < 40 && abfd->filename[i]; i++) *dst++ = abfd->filename[i]; - return srec_write_record (abfd, 0, 0, buffer, dst); + return srec_write_record (abfd, 0, (bfd_vma) 0, buffer, dst); } static boolean @@ -1056,12 +1061,12 @@ srec_write_symbols (abfd) if (count) { - size_t len; + bfd_size_type len; asymbol **table = bfd_get_outsymbols (abfd); sprintf (buffer, "$$ %s\r\n", abfd->filename); len = strlen (buffer); - if (bfd_write (buffer, len, 1, abfd) != len) + if (bfd_bwrite (buffer, len, abfd) != len) return false; for (i = 0; i < count; i++) @@ -1071,7 +1076,6 @@ srec_write_symbols (abfd) && (s->flags & BSF_DEBUGGING) == 0) { /* Just dump out non debug symbols. */ - bfd_size_type l; char buf2[40], *p; sprintf_vma (buf2, @@ -1081,14 +1085,14 @@ srec_write_symbols (abfd) while (p[0] == '0' && p[1] != 0) p++; sprintf (buffer, " %s $%s\r\n", s->name, p); - l = strlen (buffer); - if (bfd_write (buffer, l, 1, abfd) != l) + len = strlen (buffer); + if (bfd_bwrite (buffer, len, abfd) != len) return false; } } sprintf (buffer, "$$ \r\n"); len = strlen (buffer); - if (bfd_write (buffer, len, 1, abfd) != len) + if (bfd_bwrite (buffer, len, abfd) != len) return false; } @@ -1150,7 +1154,9 @@ static asymbol * srec_make_empty_symbol (abfd) bfd *abfd; { - asymbol *new = (asymbol *) bfd_zalloc (abfd, sizeof (asymbol)); + asymbol *new; + + new = (asymbol *) bfd_zalloc (abfd, (bfd_size_type) sizeof (asymbol)); if (new) new->the_bfd = abfd; return new; @@ -1172,7 +1178,7 @@ srec_get_symtab (abfd, alocation) bfd *abfd; asymbol **alocation; { - unsigned int symcount = bfd_get_symcount (abfd); + bfd_size_type symcount = bfd_get_symcount (abfd); asymbol *csymbols; unsigned int i; diff -uprN binutils-2.11.90.0.31/bfd/stabs.c binutils-2.11.92.0.5/bfd/stabs.c --- binutils-2.11.90.0.31/bfd/stabs.c Fri Mar 9 11:16:08 2001 +++ binutils-2.11.92.0.5/bfd/stabs.c Mon Oct 1 15:25:21 2001 @@ -1,5 +1,6 @@ /* Stabs in sections linking support. - Copyright 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright 1996, 1997, 1998, 1999, 2000, 2001 + Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -25,8 +26,7 @@ Foundation, Inc., 59 Temple Place - Suit #include "sysdep.h" #include "libbfd.h" #include "aout/stab_gnu.h" - -#include +#include "safe-ctype.h" /* Stabs entries use a 12 byte format: 4 byte string table index @@ -178,7 +178,7 @@ _bfd_link_section_stabs (abfd, psinfo, s { boolean first; struct stab_info *sinfo; - bfd_size_type count; + bfd_size_type count, amt; struct stab_section_info *secinfo; bfd_byte *stabbuf = NULL; bfd_byte *stabstrbuf = NULL; @@ -223,7 +223,8 @@ _bfd_link_section_stabs (abfd, psinfo, s { /* Initialize the stabs information we need to keep track of. */ first = true; - *psinfo = (PTR) bfd_alloc (abfd, sizeof (struct stab_info)); + amt = sizeof (struct stab_info); + *psinfo = (PTR) bfd_alloc (abfd, amt); if (*psinfo == NULL) goto error_return; sinfo = (struct stab_info *) *psinfo; @@ -247,16 +248,16 @@ _bfd_link_section_stabs (abfd, psinfo, s count = stabsec->_raw_size / STABSIZE; - *psecinfo = bfd_alloc (abfd, - (sizeof (struct stab_section_info) - + (count - 1) * sizeof (bfd_size_type))); + amt = sizeof (struct stab_section_info); + amt += (count - 1) * sizeof (bfd_size_type); + *psecinfo = bfd_alloc (abfd, amt); if (*psecinfo == NULL) goto error_return; secinfo = (struct stab_section_info *) *psecinfo; secinfo->excls = NULL; secinfo->cumulative_skips = NULL; - memset (secinfo->stridxs, 0, count * sizeof (bfd_size_type)); + memset (secinfo->stridxs, 0, (size_t) count * sizeof (bfd_size_type)); /* Read the stabs information from abfd. */ @@ -265,9 +266,9 @@ _bfd_link_section_stabs (abfd, psinfo, s if (stabbuf == NULL || stabstrbuf == NULL) goto error_return; - if (! bfd_get_section_contents (abfd, stabsec, stabbuf, 0, + if (! bfd_get_section_contents (abfd, stabsec, stabbuf, (bfd_vma) 0, stabsec->_raw_size) - || ! bfd_get_section_contents (abfd, stabstrsec, stabstrbuf, 0, + || ! bfd_get_section_contents (abfd, stabstrsec, stabstrbuf, (bfd_vma) 0, stabstrsec->_raw_size)) goto error_return; @@ -362,7 +363,7 @@ _bfd_link_section_stabs (abfd, psinfo, s { /* Skip the file number. */ ++str; - while (isdigit ((unsigned char) *str)) + while (ISDIGIT (*str)) ++str; --str; } @@ -383,7 +384,8 @@ _bfd_link_section_stabs (abfd, psinfo, s /* Record this symbol, so that we can set the value correctly. */ - ne = (struct stab_excl_list *) bfd_alloc (abfd, sizeof *ne); + amt = sizeof *ne; + ne = (struct stab_excl_list *) bfd_alloc (abfd, amt); if (ne == NULL) goto error_return; ne->offset = sym - stabbuf; @@ -471,8 +473,8 @@ _bfd_link_section_stabs (abfd, psinfo, s bfd_size_type i, offset; bfd_size_type *pskips; - secinfo->cumulative_skips = - (bfd_size_type *) bfd_alloc (abfd, count * sizeof (bfd_size_type)); + amt = count * sizeof (bfd_size_type); + secinfo->cumulative_skips = (bfd_size_type *) bfd_alloc (abfd, amt); if (secinfo->cumulative_skips == NULL) goto error_return; @@ -522,7 +524,8 @@ _bfd_write_section_stabs (output_bfd, ps if (secinfo == NULL) return bfd_set_section_contents (output_bfd, stabsec->output_section, - contents, stabsec->output_offset, + contents, + (file_ptr) stabsec->output_offset, stabsec->_raw_size); /* Handle each N_BINCL entry. */ @@ -571,7 +574,7 @@ _bfd_write_section_stabs (output_bfd, ps BFD_ASSERT ((bfd_size_type) (tosym - contents) == stabsec->_cooked_size); return bfd_set_section_contents (output_bfd, stabsec->output_section, - contents, stabsec->output_offset, + contents, (file_ptr) stabsec->output_offset, stabsec->_cooked_size); } @@ -600,8 +603,8 @@ _bfd_write_stab_strings (output_bfd, psi <= sinfo->stabstr->output_section->_raw_size); if (bfd_seek (output_bfd, - (sinfo->stabstr->output_section->filepos - + sinfo->stabstr->output_offset), + (file_ptr) (sinfo->stabstr->output_section->filepos + + sinfo->stabstr->output_offset), SEEK_SET) != 0) return false; diff -uprN binutils-2.11.90.0.31/bfd/sunos.c binutils-2.11.92.0.5/bfd/sunos.c --- binutils-2.11.90.0.31/bfd/sunos.c Fri Mar 9 11:16:08 2001 +++ binutils-2.11.92.0.5/bfd/sunos.c Thu Oct 4 14:35:43 2001 @@ -1,5 +1,5 @@ /* BFD backend for SunOS binaries. - Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 2000 + Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc. Written by Cygnus Support. @@ -20,7 +20,11 @@ along with this program; if not, write t Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define TARGETNAME "a.out-sunos-big" -#define MY(OP) CAT(sunos_big_,OP) + +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (sunos_big_,OP) #include "bfd.h" #include "bfdlink.h" @@ -142,6 +146,7 @@ sunos_read_dynamic_info (abfd) struct external_sun4_dynamic dyninfo; unsigned long dynver; struct external_sun4_dynamic_link linkinfo; + bfd_size_type amt; if (obj_aout_dynamic_info (abfd) != (PTR) NULL) return true; @@ -152,8 +157,8 @@ sunos_read_dynamic_info (abfd) return false; } - info = ((struct sunos_dynamic_info *) - bfd_zalloc (abfd, sizeof (struct sunos_dynamic_info))); + amt = sizeof (struct sunos_dynamic_info); + info = (struct sunos_dynamic_info *) bfd_zalloc (abfd, amt); if (!info) return false; info->valid = false; @@ -174,7 +179,8 @@ sunos_read_dynamic_info (abfd) if ((abfd->flags & DYNAMIC) == 0) return true; if (! bfd_get_section_contents (abfd, obj_datasec (abfd), (PTR) &dyninfo, - (file_ptr) 0, sizeof dyninfo)) + (file_ptr) 0, + (bfd_size_type) sizeof dyninfo)) return true; dynver = GET_WORD (abfd, dyninfo.ld_version); @@ -195,7 +201,8 @@ sunos_read_dynamic_info (abfd) /* This executable appears to be dynamically linked in a way that we can understand. */ - if (! bfd_get_section_contents (abfd, dynsec, (PTR) &linkinfo, dynoff, + if (! bfd_get_section_contents (abfd, dynsec, (PTR) &linkinfo, + (file_ptr) dynoff, (bfd_size_type) sizeof linkinfo)) return true; @@ -277,6 +284,7 @@ sunos_slurp_dynamic_symtab (abfd) bfd *abfd; { struct sunos_dynamic_info *info; + bfd_size_type amt; /* Get the general dynamic information. */ if (obj_aout_dynamic_info (abfd) == NULL) @@ -295,16 +303,12 @@ sunos_slurp_dynamic_symtab (abfd) /* Get the dynamic nlist structures. */ if (info->dynsym == (struct external_nlist *) NULL) { - info->dynsym = ((struct external_nlist *) - bfd_alloc (abfd, - (info->dynsym_count - * EXTERNAL_NLIST_SIZE))); + amt = (bfd_size_type) info->dynsym_count * EXTERNAL_NLIST_SIZE; + info->dynsym = (struct external_nlist *) bfd_alloc (abfd, amt); if (info->dynsym == NULL && info->dynsym_count != 0) return false; - if (bfd_seek (abfd, info->dyninfo.ld_stab, SEEK_SET) != 0 - || (bfd_read ((PTR) info->dynsym, info->dynsym_count, - EXTERNAL_NLIST_SIZE, abfd) - != info->dynsym_count * EXTERNAL_NLIST_SIZE)) + if (bfd_seek (abfd, (file_ptr) info->dyninfo.ld_stab, SEEK_SET) != 0 + || bfd_bread ((PTR) info->dynsym, amt, abfd) != amt) { if (info->dynsym != NULL) { @@ -318,13 +322,12 @@ sunos_slurp_dynamic_symtab (abfd) /* Get the dynamic strings. */ if (info->dynstr == (char *) NULL) { - info->dynstr = (char *) bfd_alloc (abfd, info->dyninfo.ld_symb_size); + amt = info->dyninfo.ld_symb_size; + info->dynstr = (char *) bfd_alloc (abfd, amt); if (info->dynstr == NULL && info->dyninfo.ld_symb_size != 0) return false; - if (bfd_seek (abfd, info->dyninfo.ld_symbols, SEEK_SET) != 0 - || (bfd_read ((PTR) info->dynstr, 1, info->dyninfo.ld_symb_size, - abfd) - != info->dyninfo.ld_symb_size)) + if (bfd_seek (abfd, (file_ptr) info->dyninfo.ld_symbols, SEEK_SET) != 0 + || bfd_bread ((PTR) info->dynstr, amt, abfd) != amt) { if (info->dynstr != NULL) { @@ -367,8 +370,8 @@ sunos_canonicalize_dynamic_symtab (abfd, table = (bfd_byte *) bfd_malloc (table_size); if (table == NULL && table_size != 0) abort (); - if (bfd_seek (abfd, info->dyninfo.ld_hash, SEEK_SET) != 0 - || bfd_read ((PTR) table, 1, table_size, abfd) != table_size) + if (bfd_seek (abfd, (file_ptr) info->dyninfo.ld_hash, SEEK_SET) != 0 + || bfd_bread ((PTR) table, table_size, abfd) != table_size) abort (); for (i = 0; i < info->dynsym_count; i++) { @@ -398,18 +401,18 @@ sunos_canonicalize_dynamic_symtab (abfd, structures. */ if (info->canonical_dynsym == (aout_symbol_type *) NULL) { - info->canonical_dynsym = ((aout_symbol_type *) - bfd_alloc (abfd, - (info->dynsym_count - * sizeof (aout_symbol_type)))); + bfd_size_type size; + bfd_size_type strsize = info->dyninfo.ld_symb_size; + + size = (bfd_size_type) info->dynsym_count * sizeof (aout_symbol_type); + info->canonical_dynsym = (aout_symbol_type *) bfd_alloc (abfd, size); if (info->canonical_dynsym == NULL && info->dynsym_count != 0) return -1; if (! aout_32_translate_symbol_table (abfd, info->canonical_dynsym, - info->dynsym, info->dynsym_count, - info->dynstr, - info->dyninfo.ld_symb_size, - true)) + info->dynsym, + (bfd_size_type) info->dynsym_count, + info->dynstr, strsize, true)) { if (info->canonical_dynsym != NULL) { @@ -459,6 +462,7 @@ sunos_canonicalize_dynamic_reloc (abfd, { struct sunos_dynamic_info *info; unsigned long i; + bfd_size_type size; /* Get the general dynamic information. */ if (obj_aout_dynamic_info (abfd) == (PTR) NULL) @@ -477,15 +481,12 @@ sunos_canonicalize_dynamic_reloc (abfd, /* Get the dynamic reloc information. */ if (info->dynrel == NULL) { - info->dynrel = (PTR) bfd_alloc (abfd, - (info->dynrel_count - * obj_reloc_entry_size (abfd))); - if (info->dynrel == NULL && info->dynrel_count != 0) + size = (bfd_size_type) info->dynrel_count * obj_reloc_entry_size (abfd); + info->dynrel = (PTR) bfd_alloc (abfd, size); + if (info->dynrel == NULL && size != 0) return -1; - if (bfd_seek (abfd, info->dyninfo.ld_rel, SEEK_SET) != 0 - || (bfd_read ((PTR) info->dynrel, info->dynrel_count, - obj_reloc_entry_size (abfd), abfd) - != info->dynrel_count * obj_reloc_entry_size (abfd))) + if (bfd_seek (abfd, (file_ptr) info->dyninfo.ld_rel, SEEK_SET) != 0 + || bfd_bread ((PTR) info->dynrel, size, abfd) != size) { if (info->dynrel != NULL) { @@ -502,10 +503,8 @@ sunos_canonicalize_dynamic_reloc (abfd, { arelent *to; - info->canonical_dynrel = ((arelent *) - bfd_alloc (abfd, - (info->dynrel_count - * sizeof (arelent)))); + size = (bfd_size_type) info->dynrel_count * sizeof (arelent); + info->canonical_dynrel = (arelent *) bfd_alloc (abfd, size); if (info->canonical_dynrel == NULL && info->dynrel_count != 0) return -1; @@ -520,7 +519,7 @@ sunos_canonicalize_dynamic_reloc (abfd, pend = p + info->dynrel_count; for (; p < pend; p++, to++) NAME(aout,swap_ext_reloc_in) (abfd, p, to, syms, - info->dynsym_count); + (bfd_size_type) info->dynsym_count); } else { @@ -531,7 +530,7 @@ sunos_canonicalize_dynamic_reloc (abfd, pend = p + info->dynrel_count; for (; p < pend; p++, to++) NAME(aout,swap_std_reloc_in) (abfd, p, to, syms, - info->dynsym_count); + (bfd_size_type) info->dynsym_count); } } @@ -564,21 +563,21 @@ static const bfd_byte sparc_plt_first_en }; /* save %sp, -96, %sp */ -#define SPARC_PLT_ENTRY_WORD0 0x9de3bfa0 +#define SPARC_PLT_ENTRY_WORD0 ((bfd_vma) 0x9de3bfa0) /* call; address filled in later. */ -#define SPARC_PLT_ENTRY_WORD1 0x40000000 +#define SPARC_PLT_ENTRY_WORD1 ((bfd_vma) 0x40000000) /* sethi; reloc index filled in later. */ -#define SPARC_PLT_ENTRY_WORD2 0x01000000 +#define SPARC_PLT_ENTRY_WORD2 ((bfd_vma) 0x01000000) /* This sequence is used when for the jump table entry to a defined symbol in a complete executable. It is used when linking PIC compiled code which is not being put into a shared library. */ /* sethi
, %g1 */ -#define SPARC_PLT_PIC_WORD0 0x03000000 +#define SPARC_PLT_PIC_WORD0 ((bfd_vma) 0x03000000) /* jmp %g1 +
*/ -#define SPARC_PLT_PIC_WORD1 0x81c06000 +#define SPARC_PLT_PIC_WORD1 ((bfd_vma) 0x81c06000) /* nop */ -#define SPARC_PLT_PIC_WORD2 0x01000000 +#define SPARC_PLT_PIC_WORD2 ((bfd_vma) 0x01000000) /* An m68k procedure linkage table entry is 8 bytes. The first entry in the table is a jump which is filled in the by the runtime @@ -598,7 +597,7 @@ static const bfd_byte m68k_plt_first_ent }; /* bsrl */ -#define M68K_PLT_ENTRY_WORD0 (0x61ff) +#define M68K_PLT_ENTRY_WORD0 ((bfd_vma) 0x61ff) /* Remaining words filled in later. */ /* An entry in the SunOS linker hash table. */ @@ -715,9 +714,9 @@ sunos_link_hash_table_create (abfd) bfd *abfd; { struct sunos_link_hash_table *ret; + bfd_size_type amt = sizeof (struct sunos_link_hash_table); - ret = ((struct sunos_link_hash_table *) - bfd_alloc (abfd, sizeof (struct sunos_link_hash_table))); + ret = (struct sunos_link_hash_table *) bfd_alloc (abfd, amt); if (ret == (struct sunos_link_hash_table *) NULL) return (struct bfd_link_hash_table *) NULL; if (! NAME(aout,link_hash_table_init) (&ret->root, abfd, @@ -875,7 +874,6 @@ sunos_add_dynamic_symbols (abfd, info, s bfd_size_type *sym_countp; char **stringsp; { - asection *s; bfd *dynobj; struct sunos_dynamic_info *dinfo; unsigned long need; @@ -938,7 +936,7 @@ sunos_add_dynamic_symbols (abfd, info, s /* The .need section holds the list of names of shared objets which must be included at runtime. The address of this section is put in the ld_need field. */ - s = bfd_make_section (dynobj, ".need"); + asection *s = bfd_make_section (dynobj, ".need"); if (s == NULL || ! bfd_set_section_flags (dynobj, s, (SEC_ALLOC @@ -955,7 +953,7 @@ sunos_add_dynamic_symbols (abfd, info, s /* The .rules section holds the path to search for shared objects. The address of this section is put in the ld_rules field. */ - s = bfd_make_section (dynobj, ".rules"); + asection *s = bfd_make_section (dynobj, ".rules"); if (s == NULL || ! bfd_set_section_flags (dynobj, s, (SEC_ALLOC @@ -985,12 +983,12 @@ sunos_add_dynamic_symbols (abfd, info, s unsigned short major_vno, minor_vno; struct bfd_link_needed_list *needed, **pp; char *namebuf, *p; - size_t alc; + bfd_size_type alc; bfd_byte b; char *namecopy; - if (bfd_seek (abfd, need, SEEK_SET) != 0 - || bfd_read (buf, 1, 16, abfd) != 16) + if (bfd_seek (abfd, (file_ptr) need, SEEK_SET) != 0 + || bfd_bread (buf, (bfd_size_type) 16, abfd) != 16) return false; /* For the format of an ld_need entry, see aout/sun4.h. We @@ -998,12 +996,12 @@ sunos_add_dynamic_symbols (abfd, info, s name = bfd_get_32 (abfd, buf); flags = bfd_get_32 (abfd, buf + 4); - major_vno = (unsigned short)bfd_get_16 (abfd, buf + 8); - minor_vno = (unsigned short)bfd_get_16 (abfd, buf + 10); + major_vno = (unsigned short) bfd_get_16 (abfd, buf + 8); + minor_vno = (unsigned short) bfd_get_16 (abfd, buf + 10); need = bfd_get_32 (abfd, buf + 12); - needed = ((struct bfd_link_needed_list *) - bfd_alloc (abfd, sizeof (struct bfd_link_needed_list))); + alc = sizeof (struct bfd_link_needed_list); + needed = (struct bfd_link_needed_list *) bfd_alloc (abfd, alc); if (needed == NULL) return false; needed->by = abfd; @@ -1020,7 +1018,7 @@ sunos_add_dynamic_symbols (abfd, info, s *p++ = '-'; *p++ = 'l'; } - if (bfd_seek (abfd, name, SEEK_SET) != 0) + if (bfd_seek (abfd, (file_ptr) name, SEEK_SET) != 0) { free (namebuf); return false; @@ -1028,13 +1026,13 @@ sunos_add_dynamic_symbols (abfd, info, s do { - if (bfd_read (&b, 1, 1, abfd) != 1) + if (bfd_bread (&b, (bfd_size_type) 1, abfd) != 1) { free (namebuf); return false; } - if ((size_t) (p - namebuf) >= alc) + if ((bfd_size_type) (p - namebuf) >= alc) { char *n; @@ -1085,7 +1083,7 @@ sunos_add_dynamic_symbols (abfd, info, s strcat (p, minbuf); } - namecopy = bfd_alloc (abfd, strlen (namebuf) + 1); + namecopy = bfd_alloc (abfd, (bfd_size_type) strlen (namebuf) + 1); if (namecopy == NULL) { free (namebuf); @@ -1322,11 +1320,11 @@ bfd_sunos_size_dynamic_sections (output_ asection **srulesptr; { bfd *dynobj; - size_t dynsymcount; + bfd_size_type dynsymcount; struct sunos_link_hash_entry *h; asection *s; size_t bucketcount; - size_t hashalloc; + bfd_size_type hashalloc; size_t i; bfd *sub; @@ -1442,7 +1440,7 @@ bfd_sunos_size_dynamic_sections (output_ s->contents = (bfd_byte *) bfd_alloc (dynobj, hashalloc); if (s->contents == NULL && dynsymcount > 0) return false; - memset (s->contents, 0, hashalloc); + memset (s->contents, 0, (size_t) hashalloc); for (i = 0; i < bucketcount; i++) PUT_WORD (output_bfd, (bfd_vma) -1, s->contents + i * HASH_ENTRY_SIZE); s->_raw_size = bucketcount * HASH_ENTRY_SIZE; @@ -1470,7 +1468,7 @@ bfd_sunos_size_dynamic_sections (output_ add = 8 - (s->_raw_size & 7); contents = (bfd_byte *) bfd_realloc (s->contents, - (size_t) (s->_raw_size + add)); + s->_raw_size + add); if (contents == NULL) return false; memset (contents + s->_raw_size, 0, (size_t) add); @@ -1544,19 +1542,19 @@ sunos_scan_relocs (info, abfd, sec, rel_ return true; if (! info->keep_memory) - relocs = free_relocs = bfd_malloc ((size_t) rel_size); + relocs = free_relocs = bfd_malloc (rel_size); else { struct aout_section_data_struct *n; + bfd_size_type amt = sizeof (struct aout_section_data_struct); - n = ((struct aout_section_data_struct *) - bfd_alloc (abfd, sizeof (struct aout_section_data_struct))); + n = (struct aout_section_data_struct *) bfd_alloc (abfd, amt); if (n == NULL) relocs = NULL; else { set_aout_section_data (sec, n); - relocs = bfd_malloc ((size_t) rel_size); + relocs = bfd_malloc (rel_size); aout_section_data (sec)->relocs = relocs; } } @@ -1564,7 +1562,7 @@ sunos_scan_relocs (info, abfd, sec, rel_ return false; if (bfd_seek (abfd, sec->rel_filepos, SEEK_SET) != 0 - || bfd_read (relocs, 1, rel_size, abfd) != rel_size) + || bfd_bread (relocs, rel_size, abfd) != rel_size) goto error_return; if (obj_reloc_entry_size (abfd) == RELOC_STD_SIZE) @@ -1777,6 +1775,7 @@ sunos_scan_ext_relocs (info, abfd, sec, asection *splt = NULL; asection *sgot = NULL; asection *srel = NULL; + bfd_size_type amt; /* We only know how to handle SPARC plt entries. */ if (bfd_get_arch (abfd) != bfd_arch_sparc) @@ -1868,10 +1867,10 @@ sunos_scan_ext_relocs (info, abfd, sec, if (adata (abfd).local_got_offsets == NULL) { + amt = bfd_get_symcount (abfd); + amt *= sizeof (bfd_vma); adata (abfd).local_got_offsets = - (bfd_vma *) bfd_zalloc (abfd, - (bfd_get_symcount (abfd) - * sizeof (bfd_vma))); + (bfd_vma *) bfd_zalloc (abfd, amt); if (adata (abfd).local_got_offsets == NULL) return false; } @@ -2201,7 +2200,6 @@ sunos_write_dynamic_symbol (output_bfd, bfd *dynobj; asection *splt; bfd_byte *p; - asection *s; bfd_vma r_address; dynobj = sunos_hash_table (info)->dynobj; @@ -2230,8 +2228,6 @@ sunos_write_dynamic_symbol (output_bfd, } else { - bfd_vma val; - val = (h->root.root.u.def.section->output_section->vma + h->root.root.u.def.section->output_offset + h->root.root.u.def.value); @@ -2250,7 +2246,7 @@ sunos_write_dynamic_symbol (output_bfd, abort (); bfd_put_16 (output_bfd, M68K_PLT_ENTRY_WORD0, p); bfd_put_32 (output_bfd, (- (h->plt_offset + 2)), p + 2); - bfd_put_16 (output_bfd, s->reloc_count, p + 6); + bfd_put_16 (output_bfd, (bfd_vma) s->reloc_count, p + 6); r_address += 2; break; @@ -2399,13 +2395,13 @@ sunos_write_dynamic_symbol (output_bfd, outsym = ((struct external_nlist *) (s->contents + h->dynindx * EXTERNAL_NLIST_SIZE)); - bfd_h_put_8 (output_bfd, type, outsym->e_type); - bfd_h_put_8 (output_bfd, 0, outsym->e_other); + H_PUT_8 (output_bfd, type, outsym->e_type); + H_PUT_8 (output_bfd, 0, outsym->e_other); /* FIXME: The native linker doesn't use 0 for desc. It seems to use one less than the desc value in the shared library, although that seems unlikely. */ - bfd_h_put_16 (output_bfd, 0, outsym->e_desc); + H_PUT_16 (output_bfd, 0, outsym->e_desc); PUT_WORD (output_bfd, h->dynstr_index, outsym->e_strx); PUT_WORD (output_bfd, val, outsym->e_value); @@ -2668,7 +2664,7 @@ sunos_check_dynamic_reloc (info, input_b } *relocationp = (sgot->vma - + (*got_offsetp &~ 1) + + (*got_offsetp &~ (bfd_vma) 1) - sunos_hash_table (info)->got_base); /* There is nothing else to do for a base relative reloc. */ @@ -2845,7 +2841,8 @@ sunos_finish_dynamic_link (abfd, info) BFD_ASSERT (o->output_section != NULL && o->output_section->owner == abfd); if (! bfd_set_section_contents (abfd, o->output_section, - o->contents, o->output_offset, + o->contents, + (file_ptr) o->output_offset, o->_raw_size)) return false; } @@ -2855,6 +2852,7 @@ sunos_finish_dynamic_link (abfd, info) { struct external_sun4_dynamic esd; struct external_sun4_dynamic_link esdl; + file_ptr pos; /* Finish up the dynamic link information. */ PUT_WORD (dynobj, (bfd_vma) 3, esd.ld_version); @@ -2869,7 +2867,8 @@ sunos_finish_dynamic_link (abfd, info) esd.ld); if (! bfd_set_section_contents (abfd, sdyn->output_section, &esd, - sdyn->output_offset, sizeof esd)) + (file_ptr) sdyn->output_offset, + (bfd_size_type) sizeof esd)) return false; PUT_WORD (dynobj, (bfd_vma) 0, esdl.ld_loaded); @@ -2934,11 +2933,10 @@ sunos_finish_dynamic_link (abfd, info) BFD_ALIGN (obj_textsec (abfd)->_raw_size, 0x2000), esdl.ld_text); + pos = sdyn->output_offset; + pos += sizeof esd + EXTERNAL_SUN4_DYNAMIC_DEBUGGER_SIZE; if (! bfd_set_section_contents (abfd, sdyn->output_section, &esdl, - (sdyn->output_offset - + sizeof esd - + EXTERNAL_SUN4_DYNAMIC_DEBUGGER_SIZE), - sizeof esdl)) + pos, (bfd_size_type) sizeof esdl)) return false; abfd->flags |= DYNAMIC; diff -uprN binutils-2.11.90.0.31/bfd/syms.c binutils-2.11.92.0.5/bfd/syms.c --- binutils-2.11.90.0.31/bfd/syms.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/syms.c Mon Oct 1 15:25:21 2001 @@ -197,7 +197,7 @@ CODE_FRAGMENT . . {* The text of the symbol. The name is left alone, and not copied; the . application may not alter it. *} -. CONST char *name; +. const char *name; . . {* The value of the symbol. This really should be a union of a . numeric value with a pointer, since some flags indicate that @@ -308,6 +308,7 @@ CODE_FRAGMENT #include "bfd.h" #include "sysdep.h" #include "libbfd.h" +#include "safe-ctype.h" #include "bfdlink.h" #include "aout/stab_gnu.h" @@ -508,14 +509,14 @@ DESCRIPTION struct section_to_type { - CONST char *section; + const char *section; char type; }; /* Map section names to POSIX/BSD single-character symbol types. This table is probably incomplete. It is sorted for convenience of adding entries. Since it is so short, a linear search is used. */ -static CONST struct section_to_type stt[] = +static const struct section_to_type stt[] = { {"*DEBUG*", 'N'}, {".bss", 'b'}, @@ -547,7 +548,7 @@ static char coff_section_type (s) const char *s; { - CONST struct section_to_type *t; + const struct section_to_type *t; for (t = &stt[0]; t->section; t++) if (!strncmp (s, t->section, strlen (t->section))) @@ -556,13 +557,6 @@ coff_section_type (s) return '?'; } -#ifndef islower -#define islower(c) ((c) >= 'a' && (c) <= 'z') -#endif -#ifndef toupper -#define toupper(c) (islower(c) ? ((c) & ~0x20) : (c)) -#endif - /* FUNCTION bfd_decode_symclass @@ -617,7 +611,7 @@ bfd_decode_symclass (symbol) else return '?'; if (symbol->flags & BSF_GLOBAL) - c = toupper (c); + c = TOUPPER (c); return c; /* We don't have to handle these cases just yet, but we will soon: @@ -722,7 +716,7 @@ _bfd_generic_read_minisymbols (abfd, dyn if (storage < 0) goto error_return; - syms = (asymbol **) bfd_malloc ((size_t) storage); + syms = (asymbol **) bfd_malloc ((bfd_size_type) storage); if (syms == NULL) goto error_return; @@ -852,7 +846,8 @@ _bfd_stab_section_find_nearest_line (abf bfd_byte *last_stab = NULL; bfd_size_type stroff; struct indexentry *indexentry; - char *directory_name, *file_name; + char *file_name; + char *directory_name; int saw_fun; *pfound = false; @@ -898,11 +893,10 @@ _bfd_stab_section_find_nearest_line (abf arelent **reloc_vector; int i; char *name; - char *file_name; - char *directory_name; char *function_name; + bfd_size_type amt = sizeof *info; - info = (struct stab_find_info *) bfd_zalloc (abfd, sizeof *info); + info = (struct stab_find_info *) bfd_zalloc (abfd, amt); if (info == NULL) return false; @@ -929,10 +923,10 @@ _bfd_stab_section_find_nearest_line (abf if (info->stabs == NULL || info->strs == NULL) return false; - if (! bfd_get_section_contents (abfd, info->stabsec, info->stabs, 0, - stabsize) - || ! bfd_get_section_contents (abfd, info->strsec, info->strs, 0, - strsize)) + if (! bfd_get_section_contents (abfd, info->stabsec, info->stabs, + (bfd_vma) 0, stabsize) + || ! bfd_get_section_contents (abfd, info->strsec, info->strs, + (bfd_vma) 0, strsize)) return false; /* If this is a relocateable object file, we have to relocate @@ -942,7 +936,7 @@ _bfd_stab_section_find_nearest_line (abf reloc_size = bfd_get_reloc_upper_bound (abfd, info->stabsec); if (reloc_size < 0) return false; - reloc_vector = (arelent **) bfd_malloc (reloc_size); + reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size); if (reloc_vector == NULL && reloc_size != 0) return false; reloc_count = bfd_canonicalize_reloc (abfd, info->stabsec, reloc_vector, @@ -983,7 +977,7 @@ _bfd_stab_section_find_nearest_line (abf val &= r->howto->src_mask; sym = *r->sym_ptr_ptr; val += sym->value + sym->section->vma + r->addend; - bfd_put_32 (abfd, val, info->stabs + r->address); + bfd_put_32 (abfd, (bfd_vma) val, info->stabs + r->address); } } @@ -1033,10 +1027,9 @@ _bfd_stab_section_find_nearest_line (abf return true; ++info->indextablesize; - info->indextable = ((struct indexentry *) - bfd_alloc (abfd, - (sizeof (struct indexentry) - * info->indextablesize))); + amt = info->indextablesize; + amt *= sizeof (struct indexentry); + info->indextable = (struct indexentry *) bfd_alloc (abfd, amt); if (info->indextable == NULL) return false; @@ -1154,7 +1147,8 @@ _bfd_stab_section_find_nearest_line (abf ++i; info->indextablesize = i; - qsort (info->indextable, i, sizeof (struct indexentry), cmpindexentry); + qsort (info->indextable, (size_t) i, sizeof (struct indexentry), + cmpindexentry); *pinfo = (PTR) info; } @@ -1276,9 +1270,8 @@ _bfd_stab_section_find_nearest_line (abf { if (info->filename != NULL) free (info->filename); - info->filename = (char *) bfd_malloc (dirlen + - strlen (file_name) - + 1); + info->filename = (char *) bfd_malloc ((bfd_size_type) dirlen + + strlen (file_name) + 1); if (info->filename == NULL) return false; strcpy (info->filename, directory_name); diff -uprN binutils-2.11.90.0.31/bfd/targets.c binutils-2.11.92.0.5/bfd/targets.c --- binutils-2.11.90.0.31/bfd/targets.c Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/bfd/targets.c Thu Oct 4 14:35:43 2001 @@ -208,27 +208,27 @@ Entries for byte swapping for data. Thes entry points, since they don't take a BFD asthe first argument. Certain other handlers could do the same. -. bfd_vma (*bfd_getx64) PARAMS ((const bfd_byte *)); +. bfd_vma (*bfd_getx64) PARAMS ((const bfd_byte *)); . bfd_signed_vma (*bfd_getx_signed_64) PARAMS ((const bfd_byte *)); -. void (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *)); -. bfd_vma (*bfd_getx32) PARAMS ((const bfd_byte *)); +. void (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *)); +. bfd_vma (*bfd_getx32) PARAMS ((const bfd_byte *)); . bfd_signed_vma (*bfd_getx_signed_32) PARAMS ((const bfd_byte *)); -. void (*bfd_putx32) PARAMS ((bfd_vma, bfd_byte *)); -. bfd_vma (*bfd_getx16) PARAMS ((const bfd_byte *)); +. void (*bfd_putx32) PARAMS ((bfd_vma, bfd_byte *)); +. bfd_vma (*bfd_getx16) PARAMS ((const bfd_byte *)); . bfd_signed_vma (*bfd_getx_signed_16) PARAMS ((const bfd_byte *)); -. void (*bfd_putx16) PARAMS ((bfd_vma, bfd_byte *)); +. void (*bfd_putx16) PARAMS ((bfd_vma, bfd_byte *)); Byte swapping for the headers -. bfd_vma (*bfd_h_getx64) PARAMS ((const bfd_byte *)); +. bfd_vma (*bfd_h_getx64) PARAMS ((const bfd_byte *)); . bfd_signed_vma (*bfd_h_getx_signed_64) PARAMS ((const bfd_byte *)); -. void (*bfd_h_putx64) PARAMS ((bfd_vma, bfd_byte *)); -. bfd_vma (*bfd_h_getx32) PARAMS ((const bfd_byte *)); +. void (*bfd_h_putx64) PARAMS ((bfd_vma, bfd_byte *)); +. bfd_vma (*bfd_h_getx32) PARAMS ((const bfd_byte *)); . bfd_signed_vma (*bfd_h_getx_signed_32) PARAMS ((const bfd_byte *)); -. void (*bfd_h_putx32) PARAMS ((bfd_vma, bfd_byte *)); -. bfd_vma (*bfd_h_getx16) PARAMS ((const bfd_byte *)); +. void (*bfd_h_putx32) PARAMS ((bfd_vma, bfd_byte *)); +. bfd_vma (*bfd_h_getx16) PARAMS ((const bfd_byte *)); . bfd_signed_vma (*bfd_h_getx_signed_16) PARAMS ((const bfd_byte *)); -. void (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *)); +. void (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *)); Format dependent routines: these are vectors of entry points within the target vector structure, one for each format to check. @@ -239,229 +239,223 @@ Check the format of a file being read. Set the format of a file being written. -. boolean (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *)); +. boolean (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *)); Write cached information into a file being written, at <>. -. boolean (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *)); +. boolean (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *)); The general target vector. These vectors are initialized using the BFD_JUMP_TABLE macros. . . {* Generic entry points. *} -.#define BFD_JUMP_TABLE_GENERIC(NAME)\ -.CAT(NAME,_close_and_cleanup),\ -.CAT(NAME,_bfd_free_cached_info),\ -.CAT(NAME,_new_section_hook),\ -.CAT(NAME,_get_section_contents),\ -.CAT(NAME,_get_section_contents_in_window) +Do not "beautify" the CONCAT* macro args. Traditional C will not +remove whitespace added here, and thus will fail to concatenate +the tokens. +.#define BFD_JUMP_TABLE_GENERIC(NAME) \ +.CONCAT2 (NAME,_close_and_cleanup), \ +.CONCAT2 (NAME,_bfd_free_cached_info), \ +.CONCAT2 (NAME,_new_section_hook), \ +.CONCAT2 (NAME,_get_section_contents), \ +.CONCAT2 (NAME,_get_section_contents_in_window) . . {* Called when the BFD is being closed to do any necessary cleanup. *} -. boolean (*_close_and_cleanup) PARAMS ((bfd *)); +. boolean (*_close_and_cleanup) PARAMS ((bfd *)); . {* Ask the BFD to free all cached information. *} -. boolean (*_bfd_free_cached_info) PARAMS ((bfd *)); +. boolean (*_bfd_free_cached_info) PARAMS ((bfd *)); . {* Called when a new section is created. *} -. boolean (*_new_section_hook) PARAMS ((bfd *, sec_ptr)); +. boolean (*_new_section_hook) PARAMS ((bfd *, sec_ptr)); . {* Read the contents of a section. *} -. boolean (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR, -. file_ptr, bfd_size_type)); -. boolean (*_bfd_get_section_contents_in_window) -. PARAMS ((bfd *, sec_ptr, bfd_window *, -. file_ptr, bfd_size_type)); +. boolean (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR, +. file_ptr, bfd_size_type)); +. boolean (*_bfd_get_section_contents_in_window) +. PARAMS ((bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type)); . . {* Entry points to copy private data. *} -.#define BFD_JUMP_TABLE_COPY(NAME)\ -.CAT(NAME,_bfd_copy_private_bfd_data),\ -.CAT(NAME,_bfd_merge_private_bfd_data),\ -.CAT(NAME,_bfd_copy_private_section_data),\ -.CAT(NAME,_bfd_copy_private_symbol_data),\ -.CAT(NAME,_bfd_set_private_flags),\ -.CAT(NAME,_bfd_print_private_bfd_data)\ +.#define BFD_JUMP_TABLE_COPY(NAME) \ +.CONCAT2 (NAME,_bfd_copy_private_bfd_data), \ +.CONCAT2 (NAME,_bfd_merge_private_bfd_data), \ +.CONCAT2 (NAME,_bfd_copy_private_section_data), \ +.CONCAT2 (NAME,_bfd_copy_private_symbol_data), \ +.CONCAT2 (NAME,_bfd_set_private_flags), \ +.CONCAT2 (NAME,_bfd_print_private_bfd_data) \ . {* Called to copy BFD general private data from one object file . to another. *} -. boolean (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *)); +. boolean (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *)); . {* Called to merge BFD general private data from one object file . to a common output file when linking. *} -. boolean (*_bfd_merge_private_bfd_data) PARAMS ((bfd *, bfd *)); +. boolean (*_bfd_merge_private_bfd_data) PARAMS ((bfd *, bfd *)); . {* Called to copy BFD private section data from one object file . to another. *} -. boolean (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr, -. bfd *, sec_ptr)); +. boolean (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr, +. bfd *, sec_ptr)); . {* Called to copy BFD private symbol data from one symbol . to another. *} -. boolean (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *, -. bfd *, asymbol *)); +. boolean (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *, +. bfd *, asymbol *)); . {* Called to set private backend flags *} -. boolean (*_bfd_set_private_flags) PARAMS ((bfd *, flagword)); +. boolean (*_bfd_set_private_flags) PARAMS ((bfd *, flagword)); . . {* Called to print private BFD data *} -. boolean (*_bfd_print_private_bfd_data) PARAMS ((bfd *, PTR)); +. boolean (*_bfd_print_private_bfd_data) PARAMS ((bfd *, PTR)); . . {* Core file entry points. *} -.#define BFD_JUMP_TABLE_CORE(NAME)\ -.CAT(NAME,_core_file_failing_command),\ -.CAT(NAME,_core_file_failing_signal),\ -.CAT(NAME,_core_file_matches_executable_p) +.#define BFD_JUMP_TABLE_CORE(NAME) \ +.CONCAT2 (NAME,_core_file_failing_command), \ +.CONCAT2 (NAME,_core_file_failing_signal), \ +.CONCAT2 (NAME,_core_file_matches_executable_p) . char * (*_core_file_failing_command) PARAMS ((bfd *)); . int (*_core_file_failing_signal) PARAMS ((bfd *)); . boolean (*_core_file_matches_executable_p) PARAMS ((bfd *, bfd *)); . . {* Archive entry points. *} -.#define BFD_JUMP_TABLE_ARCHIVE(NAME)\ -.CAT(NAME,_slurp_armap),\ -.CAT(NAME,_slurp_extended_name_table),\ -.CAT(NAME,_construct_extended_name_table),\ -.CAT(NAME,_truncate_arname),\ -.CAT(NAME,_write_armap),\ -.CAT(NAME,_read_ar_hdr),\ -.CAT(NAME,_openr_next_archived_file),\ -.CAT(NAME,_get_elt_at_index),\ -.CAT(NAME,_generic_stat_arch_elt),\ -.CAT(NAME,_update_armap_timestamp) +.#define BFD_JUMP_TABLE_ARCHIVE(NAME) \ +.CONCAT2 (NAME,_slurp_armap), \ +.CONCAT2 (NAME,_slurp_extended_name_table), \ +.CONCAT2 (NAME,_construct_extended_name_table), \ +.CONCAT2 (NAME,_truncate_arname), \ +.CONCAT2 (NAME,_write_armap), \ +.CONCAT2 (NAME,_read_ar_hdr), \ +.CONCAT2 (NAME,_openr_next_archived_file), \ +.CONCAT2 (NAME,_get_elt_at_index), \ +.CONCAT2 (NAME,_generic_stat_arch_elt), \ +.CONCAT2 (NAME,_update_armap_timestamp) . boolean (*_bfd_slurp_armap) PARAMS ((bfd *)); . boolean (*_bfd_slurp_extended_name_table) PARAMS ((bfd *)); . boolean (*_bfd_construct_extended_name_table) -. PARAMS ((bfd *, char **, bfd_size_type *, const char **)); -. void (*_bfd_truncate_arname) PARAMS ((bfd *, CONST char *, char *)); -. boolean (*write_armap) PARAMS ((bfd *arch, -. unsigned int elength, -. struct orl *map, -. unsigned int orl_count, -. int stridx)); -. PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *)); -. bfd * (*openr_next_archived_file) PARAMS ((bfd *arch, bfd *prev)); +. PARAMS ((bfd *, char **, bfd_size_type *, const char **)); +. void (*_bfd_truncate_arname) PARAMS ((bfd *, const char *, char *)); +. boolean (*write_armap) +. PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int)); +. PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *)); +. bfd * (*openr_next_archived_file) PARAMS ((bfd *, bfd *)); .#define bfd_get_elt_at_index(b,i) BFD_SEND(b, _bfd_get_elt_at_index, (b,i)) . bfd * (*_bfd_get_elt_at_index) PARAMS ((bfd *, symindex)); . int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *)); . boolean (*_bfd_update_armap_timestamp) PARAMS ((bfd *)); . . {* Entry points used for symbols. *} -.#define BFD_JUMP_TABLE_SYMBOLS(NAME)\ -.CAT(NAME,_get_symtab_upper_bound),\ -.CAT(NAME,_get_symtab),\ -.CAT(NAME,_make_empty_symbol),\ -.CAT(NAME,_print_symbol),\ -.CAT(NAME,_get_symbol_info),\ -.CAT(NAME,_bfd_is_local_label_name),\ -.CAT(NAME,_get_lineno),\ -.CAT(NAME,_find_nearest_line),\ -.CAT(NAME,_bfd_make_debug_symbol),\ -.CAT(NAME,_read_minisymbols),\ -.CAT(NAME,_minisymbol_to_symbol) -. long (*_bfd_get_symtab_upper_bound) PARAMS ((bfd *)); -. long (*_bfd_canonicalize_symtab) PARAMS ((bfd *, -. struct symbol_cache_entry **)); -. struct symbol_cache_entry * -. (*_bfd_make_empty_symbol) PARAMS ((bfd *)); -. void (*_bfd_print_symbol) PARAMS ((bfd *, PTR, -. struct symbol_cache_entry *, -. bfd_print_symbol_type)); +.#define BFD_JUMP_TABLE_SYMBOLS(NAME) \ +.CONCAT2 (NAME,_get_symtab_upper_bound), \ +.CONCAT2 (NAME,_get_symtab), \ +.CONCAT2 (NAME,_make_empty_symbol), \ +.CONCAT2 (NAME,_print_symbol), \ +.CONCAT2 (NAME,_get_symbol_info), \ +.CONCAT2 (NAME,_bfd_is_local_label_name), \ +.CONCAT2 (NAME,_get_lineno), \ +.CONCAT2 (NAME,_find_nearest_line), \ +.CONCAT2 (NAME,_bfd_make_debug_symbol), \ +.CONCAT2 (NAME,_read_minisymbols), \ +.CONCAT2 (NAME,_minisymbol_to_symbol) +. long (*_bfd_get_symtab_upper_bound) PARAMS ((bfd *)); +. long (*_bfd_canonicalize_symtab) PARAMS ((bfd *, +. struct symbol_cache_entry **)); +. struct symbol_cache_entry * +. (*_bfd_make_empty_symbol) PARAMS ((bfd *)); +. void (*_bfd_print_symbol) PARAMS ((bfd *, PTR, +. struct symbol_cache_entry *, +. bfd_print_symbol_type)); .#define bfd_print_symbol(b,p,s,e) BFD_SEND(b, _bfd_print_symbol, (b,p,s,e)) -. void (*_bfd_get_symbol_info) PARAMS ((bfd *, -. struct symbol_cache_entry *, -. symbol_info *)); +. void (*_bfd_get_symbol_info) PARAMS ((bfd *, +. struct symbol_cache_entry *, +. symbol_info *)); .#define bfd_get_symbol_info(b,p,e) BFD_SEND(b, _bfd_get_symbol_info, (b,p,e)) -. boolean (*_bfd_is_local_label_name) PARAMS ((bfd *, const char *)); +. boolean (*_bfd_is_local_label_name) PARAMS ((bfd *, const char *)); . -. alent * (*_get_lineno) PARAMS ((bfd *, struct symbol_cache_entry *)); -. boolean (*_bfd_find_nearest_line) PARAMS ((bfd *abfd, -. struct sec *section, struct symbol_cache_entry **symbols, -. bfd_vma offset, CONST char **file, CONST char **func, -. unsigned int *line)); +. alent * (*_get_lineno) PARAMS ((bfd *, struct symbol_cache_entry *)); +. boolean (*_bfd_find_nearest_line) +. PARAMS ((bfd *, struct sec *, struct symbol_cache_entry **, bfd_vma, +. const char **, const char **, unsigned int *)); . {* Back-door to allow format-aware applications to create debug symbols . while using BFD for everything else. Currently used by the assembler . when creating COFF files. *} -. asymbol * (*_bfd_make_debug_symbol) PARAMS (( -. bfd *abfd, -. void *ptr, -. unsigned long size)); +. asymbol *(*_bfd_make_debug_symbol) PARAMS ((bfd *, void *, +. unsigned long size)); .#define bfd_read_minisymbols(b, d, m, s) \ . BFD_SEND (b, _read_minisymbols, (b, d, m, s)) -. long (*_read_minisymbols) PARAMS ((bfd *, boolean, PTR *, -. unsigned int *)); +. long (*_read_minisymbols) PARAMS ((bfd *, boolean, PTR *, +. unsigned int *)); .#define bfd_minisymbol_to_symbol(b, d, m, f) \ . BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f)) . asymbol *(*_minisymbol_to_symbol) PARAMS ((bfd *, boolean, const PTR, . asymbol *)); . . {* Routines for relocs. *} -.#define BFD_JUMP_TABLE_RELOCS(NAME)\ -.CAT(NAME,_get_reloc_upper_bound),\ -.CAT(NAME,_canonicalize_reloc),\ -.CAT(NAME,_bfd_reloc_type_lookup) -. long (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr)); -. long (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **, -. struct symbol_cache_entry **)); +.#define BFD_JUMP_TABLE_RELOCS(NAME) \ +.CONCAT2 (NAME,_get_reloc_upper_bound), \ +.CONCAT2 (NAME,_canonicalize_reloc), \ +.CONCAT2 (NAME,_bfd_reloc_type_lookup) +. long (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr)); +. long (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **, +. struct symbol_cache_entry **)); . {* See documentation on reloc types. *} . reloc_howto_type * -. (*reloc_type_lookup) PARAMS ((bfd *abfd, -. bfd_reloc_code_real_type code)); +. (*reloc_type_lookup) PARAMS ((bfd *, bfd_reloc_code_real_type)); . . {* Routines used when writing an object file. *} -.#define BFD_JUMP_TABLE_WRITE(NAME)\ -.CAT(NAME,_set_arch_mach),\ -.CAT(NAME,_set_section_contents) -. boolean (*_bfd_set_arch_mach) PARAMS ((bfd *, enum bfd_architecture, -. unsigned long)); -. boolean (*_bfd_set_section_contents) PARAMS ((bfd *, sec_ptr, PTR, -. file_ptr, bfd_size_type)); +.#define BFD_JUMP_TABLE_WRITE(NAME) \ +.CONCAT2 (NAME,_set_arch_mach), \ +.CONCAT2 (NAME,_set_section_contents) +. boolean (*_bfd_set_arch_mach) PARAMS ((bfd *, enum bfd_architecture, +. unsigned long)); +. boolean (*_bfd_set_section_contents) PARAMS ((bfd *, sec_ptr, PTR, +. file_ptr, bfd_size_type)); . . {* Routines used by the linker. *} -.#define BFD_JUMP_TABLE_LINK(NAME)\ -.CAT(NAME,_sizeof_headers),\ -.CAT(NAME,_bfd_get_relocated_section_contents),\ -.CAT(NAME,_bfd_relax_section),\ -.CAT(NAME,_bfd_link_hash_table_create),\ -.CAT(NAME,_bfd_link_add_symbols),\ -.CAT(NAME,_bfd_final_link),\ -.CAT(NAME,_bfd_link_split_section),\ -.CAT(NAME,_bfd_gc_sections),\ -.CAT(NAME,_bfd_merge_sections) -. int (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean)); -. bfd_byte * (*_bfd_get_relocated_section_contents) PARAMS ((bfd *, -. struct bfd_link_info *, struct bfd_link_order *, -. bfd_byte *data, boolean relocateable, -. struct symbol_cache_entry **)); +.#define BFD_JUMP_TABLE_LINK(NAME) \ +.CONCAT2 (NAME,_sizeof_headers), \ +.CONCAT2 (NAME,_bfd_get_relocated_section_contents), \ +.CONCAT2 (NAME,_bfd_relax_section), \ +.CONCAT2 (NAME,_bfd_link_hash_table_create), \ +.CONCAT2 (NAME,_bfd_link_add_symbols), \ +.CONCAT2 (NAME,_bfd_final_link), \ +.CONCAT2 (NAME,_bfd_link_split_section), \ +.CONCAT2 (NAME,_bfd_gc_sections), \ +.CONCAT2 (NAME,_bfd_merge_sections) +. int (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean)); +. bfd_byte *(*_bfd_get_relocated_section_contents) +. PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, +. bfd_byte *, boolean, struct symbol_cache_entry **)); . -. boolean (*_bfd_relax_section) PARAMS ((bfd *, struct sec *, -. struct bfd_link_info *, boolean *again)); +. boolean (*_bfd_relax_section) +. PARAMS ((bfd *, struct sec *, struct bfd_link_info *, boolean *)); . . {* Create a hash table for the linker. Different backends store . different information in this table. *} . struct bfd_link_hash_table *(*_bfd_link_hash_table_create) PARAMS ((bfd *)); . . {* Add symbols from this object file into the hash table. *} -. boolean (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *)); +. boolean (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *)); . . {* Do a link based on the link_order structures attached to each . section of the BFD. *} -. boolean (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *)); +. boolean (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *)); . . {* Should this section be split up into smaller pieces during linking. *} -. boolean (*_bfd_link_split_section) PARAMS ((bfd *, struct sec *)); +. boolean (*_bfd_link_split_section) PARAMS ((bfd *, struct sec *)); . . {* Remove sections that are not referenced from the output. *} -. boolean (*_bfd_gc_sections) PARAMS ((bfd *, struct bfd_link_info *)); +. boolean (*_bfd_gc_sections) PARAMS ((bfd *, struct bfd_link_info *)); . . {* Attempt to merge SEC_MERGE sections. *} -. boolean (*_bfd_merge_sections) PARAMS ((bfd *, struct bfd_link_info *)); +. boolean (*_bfd_merge_sections) PARAMS ((bfd *, struct bfd_link_info *)); . . {* Routines to handle dynamic symbols and relocs. *} -.#define BFD_JUMP_TABLE_DYNAMIC(NAME)\ -.CAT(NAME,_get_dynamic_symtab_upper_bound),\ -.CAT(NAME,_canonicalize_dynamic_symtab),\ -.CAT(NAME,_get_dynamic_reloc_upper_bound),\ -.CAT(NAME,_canonicalize_dynamic_reloc) +.#define BFD_JUMP_TABLE_DYNAMIC(NAME) \ +.CONCAT2 (NAME,_get_dynamic_symtab_upper_bound), \ +.CONCAT2 (NAME,_canonicalize_dynamic_symtab), \ +.CONCAT2 (NAME,_get_dynamic_reloc_upper_bound), \ +.CONCAT2 (NAME,_canonicalize_dynamic_reloc) . {* Get the amount of memory required to hold the dynamic symbols. *} -. long (*_bfd_get_dynamic_symtab_upper_bound) PARAMS ((bfd *)); +. long (*_bfd_get_dynamic_symtab_upper_bound) PARAMS ((bfd *)); . {* Read in the dynamic symbols. *} -. long (*_bfd_canonicalize_dynamic_symtab) +. long (*_bfd_canonicalize_dynamic_symtab) . PARAMS ((bfd *, struct symbol_cache_entry **)); . {* Get the amount of memory required to hold the dynamic relocs. *} -. long (*_bfd_get_dynamic_reloc_upper_bound) PARAMS ((bfd *)); +. long (*_bfd_get_dynamic_reloc_upper_bound) PARAMS ((bfd *)); . {* Read in the dynamic relocs. *} -. long (*_bfd_canonicalize_dynamic_reloc) +. long (*_bfd_canonicalize_dynamic_reloc) . PARAMS ((bfd *, arelent **, struct symbol_cache_entry **)); . @@ -570,12 +564,12 @@ extern const bfd_target bfd_elf64_ia64_b extern const bfd_target bfd_elf64_ia64_little_vec; extern const bfd_target bfd_elf64_little_generic_vec; extern const bfd_target bfd_elf64_littlemips_vec; -extern const bfd_target bfd_elf64_tradbigmips_vec; -extern const bfd_target bfd_elf64_tradlittlemips_vec; extern const bfd_target bfd_elf64_powerpc_vec; extern const bfd_target bfd_elf64_powerpcle_vec; extern const bfd_target bfd_elf64_s390_vec; extern const bfd_target bfd_elf64_sparc_vec; +extern const bfd_target bfd_elf64_tradbigmips_vec; +extern const bfd_target bfd_elf64_tradlittlemips_vec; extern const bfd_target bfd_elf64_x86_64_vec; extern const bfd_target bfd_powerpc_pe_vec; extern const bfd_target bfd_powerpc_pei_vec; @@ -657,7 +651,6 @@ extern const bfd_target sparclynx_aout_v extern const bfd_target sparclynx_coff_vec; extern const bfd_target sparcnetbsd_vec; extern const bfd_target sunos_big_vec; -extern const bfd_target tekhex_vec; extern const bfd_target tic30_aout_vec; extern const bfd_target tic30_coff_vec; extern const bfd_target tic54x_coff0_beh_vec; @@ -675,28 +668,25 @@ extern const bfd_target w65_vec; extern const bfd_target we32kcoff_vec; extern const bfd_target z8kcoff_vec; -/* srec is always included. */ +/* These are always included. */ extern const bfd_target srec_vec; extern const bfd_target symbolsrec_vec; - -/* binary is always included. */ +extern const bfd_target tekhex_vec; extern const bfd_target binary_vec; - -/* ihex is always included. */ extern const bfd_target ihex_vec; /* All of the xvecs for core files. */ extern const bfd_target aix386_core_vec; extern const bfd_target cisco_core_big_vec; extern const bfd_target cisco_core_little_vec; -extern const bfd_target hpux_core_vec; extern const bfd_target hppabsd_core_vec; +extern const bfd_target hpux_core_vec; extern const bfd_target irix_core_vec; extern const bfd_target netbsd_core_vec; extern const bfd_target osf_core_vec; +extern const bfd_target ptrace_core_vec; extern const bfd_target sco5_core_vec; extern const bfd_target trad_core_vec; -extern const bfd_target ptrace_core_vec; static const bfd_target * const _bfd_target_vector[] = { @@ -717,134 +707,144 @@ static const bfd_target * const _bfd_tar it wasn't omitted by mistake. */ &a29kcoff_big_vec, &a_out_adobe_vec, -#if 0 /* No one seems to use this. */ + &aout0_big_vec, +#if 0 + /* We have no way of distinguishing these from other a.out variants */ + &aout_arm_big_vec, + &aout_arm_little_vec, + /* No one seems to use this. */ &aout_mips_big_vec, #endif &aout_mips_little_vec, +#if 0 + &apollocoff_vec, +#endif + &arm_epoc_pe_big_vec, + &arm_epoc_pe_little_vec, + &arm_epoc_pei_big_vec, + &arm_epoc_pei_little_vec, + &armcoff_big_vec, + &armcoff_little_vec, + &armnetbsd_vec, + &armpe_big_vec, + &armpe_little_vec, + &armpei_big_vec, + &armpei_little_vec, &b_out_vec_big_host, &b_out_vec_little_host, - &bfd_efi_app_ia32_vec, #ifdef BFD64 &bfd_efi_app_ia64_vec, #endif + &bfd_elf32_avr_vec, /* This, and other vectors, may not be used in any *.mt configuration. But that does not mean they are unnecessary. If configured with --enable-targets=all, objdump or gdb should be able to examine the file even if we don't recognize the machine type. */ &bfd_elf32_big_generic_vec, -#ifdef BFD64 - &bfd_elf64_alpha_vec, - &bfd_elf64_hppa_vec, - &bfd_elf64_hppa_linux_vec, - &bfd_elf64_ia64_aix_little_vec, - &bfd_elf64_ia64_aix_big_vec, - &bfd_elf64_ia64_little_vec, - &bfd_elf64_ia64_big_vec, -#endif - &bfd_elf32_avr_vec, &bfd_elf32_bigarc_vec, - &bfd_elf32_bigarm_vec, - &bfd_elf32_bigarm_oabi_vec, + &bfd_elf32_bigarm_oabi_vec, + &bfd_elf32_bigarm_vec, &bfd_elf32_bigmips_vec, -#ifdef BFD64 - &bfd_elf64_bigmips_vec, -#endif &bfd_elf32_cris_vec, - &bfd_elf32_us_cris_vec, &bfd_elf32_d10v_vec, &bfd_elf32_d30v_vec, - &bfd_elf32_hppa_vec, + &bfd_elf32_fr30_vec, &bfd_elf32_hppa_linux_vec, + &bfd_elf32_hppa_vec, &bfd_elf32_i370_vec, &bfd_elf32_i386_vec, -#ifdef BFD64 - &bfd_elf64_x86_64_vec, -#endif - &bfd_elf32_i860_vec, &bfd_elf32_i860_little_vec, + &bfd_elf32_i860_vec, &bfd_elf32_i960_vec, +#if 0 + &bfd_elf32_ia64_big_vec, +#endif &bfd_elf32_little_generic_vec, &bfd_elf32_littlearc_vec, - &bfd_elf32_littlearm_vec, - &bfd_elf32_littlearm_oabi_vec, + &bfd_elf32_littlearm_oabi_vec, + &bfd_elf32_littlearm_vec, &bfd_elf32_littlemips_vec, -#ifdef BFD64 - &bfd_elf64_littlemips_vec, -#endif &bfd_elf32_m32r_vec, - &bfd_elf32_mn10200_vec, - &bfd_elf32_mn10300_vec, &bfd_elf32_m68hc11_vec, &bfd_elf32_m68hc12_vec, &bfd_elf32_m68k_vec, &bfd_elf32_m88k_vec, + &bfd_elf32_mcore_big_vec, + &bfd_elf32_mcore_little_vec, + &bfd_elf32_mn10200_vec, + &bfd_elf32_mn10300_vec, &bfd_elf32_openrisc_vec, &bfd_elf32_pj_vec, &bfd_elf32_pjl_vec, &bfd_elf32_powerpc_vec, &bfd_elf32_powerpcle_vec, -#ifdef BFD64 - &bfd_elf64_powerpc_vec, - &bfd_elf64_powerpcle_vec, -#endif + &bfd_elf32_s390_vec, + &bfd_elf32_sh_vec, + &bfd_elf32_shblin_vec, + &bfd_elf32_shl_vec, + &bfd_elf32_shlin_vec, &bfd_elf32_sparc_vec, - &bfd_elf32_v850_vec, - &bfd_elf32_fr30_vec, - &bfd_elf32_mcore_big_vec, - &bfd_elf32_mcore_little_vec, &bfd_elf32_tradbigmips_vec, &bfd_elf32_tradlittlemips_vec, + &bfd_elf32_us_cris_vec, + &bfd_elf32_v850_vec, #ifdef BFD64 - &bfd_elf64_tradbigmips_vec, - &bfd_elf64_tradlittlemips_vec, - /* No one seems to use this. */ + &bfd_elf64_alpha_vec, &bfd_elf64_big_generic_vec, + &bfd_elf64_bigmips_vec, + &bfd_elf64_hppa_linux_vec, + &bfd_elf64_hppa_vec, + &bfd_elf64_ia64_aix_big_vec, + &bfd_elf64_ia64_aix_little_vec, + &bfd_elf64_ia64_big_vec, + &bfd_elf64_ia64_little_vec, &bfd_elf64_little_generic_vec, -#endif + &bfd_elf64_littlemips_vec, + &bfd_elf64_powerpc_vec, + &bfd_elf64_powerpcle_vec, + &bfd_elf64_s390_vec, #if 0 &bfd_elf64_sparc_vec, #endif - /* We don't include cisco_core_*_vec. Although it has a magic number, - the magic number isn't at the beginning of the file, and thus - might spuriously match other kinds of files. */ - - &cris_aout_vec, + &bfd_elf64_tradbigmips_vec, + &bfd_elf64_tradlittlemips_vec, + &bfd_elf64_x86_64_vec, +#endif + &bfd_powerpc_pe_vec, + &bfd_powerpc_pei_vec, + &bfd_powerpcle_pe_vec, + &bfd_powerpcle_pei_vec, + &cris_aout_vec, #ifdef BFD64 &demo_64_vec, /* Only compiled if host has long-long support */ #endif &ecoff_big_vec, - &ecoff_little_vec, &ecoff_biglittle_vec, + &ecoff_little_vec, #ifdef BFD64 &ecoffalpha_little_vec, #endif + &go32coff_vec, + &go32stubbedcoff_vec, &h8300coff_vec, &h8500coff_vec, #if 0 /* Since a.out files lack decent magic numbers, no way to recognize which kind of a.out file it is. */ &host_aout_vec, -#endif -#if 0 /* Clashes with sunos_big_vec magic no. */ + /* Clashes with sunos_big_vec magic no. */ &hp300bsd_vec, #endif &hp300hpux_vec, -#if defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF) - &som_vec, -#endif &i386aout_vec, &i386bsd_vec, &i386coff_vec, +#if 0 + &i386dynix_vec, +#endif &i386freebsd_vec, - &i860coff_vec, - &bfd_powerpc_pe_vec, - &bfd_powerpcle_pe_vec, - &bfd_powerpc_pei_vec, - &bfd_powerpcle_pei_vec, - &go32coff_vec, - &go32stubbedcoff_vec, #if 0 /* Since a.out files lack decent magic numbers, no way to recognize which kind of a.out file it is. */ @@ -861,20 +861,14 @@ static const bfd_target * const _bfd_tar &i386os9k_vec, &i386pe_vec, &i386pei_vec, - &armcoff_little_vec, - &armcoff_big_vec, - &armnetbsd_vec, - &armpe_little_vec, - &armpe_big_vec, - &armpei_little_vec, - &armpei_big_vec, - &arm_epoc_pe_little_vec, - &arm_epoc_pe_big_vec, - &arm_epoc_pei_little_vec, - &arm_epoc_pei_big_vec, + &i860coff_vec, &icoff_big_vec, &icoff_little_vec, &ieee_vec, +#if 0 + &m68k4knetbsd_vec, + &m68kaux_coff_vec, +#endif &m68kcoff_vec, &m68kcoffun_vec, #if 0 @@ -892,13 +886,15 @@ static const bfd_target * const _bfd_tar &mcore_pe_little_vec, &mcore_pei_big_vec, &mcore_pei_little_vec, + &mipslpe_vec, + &mipslpei_vec, &newsos3_vec, - &nlm32_i386_vec, - &nlm32_sparc_vec, #ifdef BFD64 &nlm32_alpha_vec, #endif - &pc532netbsd_vec, + &nlm32_i386_vec, + &nlm32_powerpc_vec, + &nlm32_sparc_vec, #if 0 /* We have no oasys tools anymore, so we can't test any of this anymore. If you want to test the stuff yourself, go ahead... @@ -908,41 +904,45 @@ static const bfd_target * const _bfd_tar &oasys_vec, #endif &pc532machaout_vec, + &pc532netbsd_vec, &pdp11_aout_vec, #if 0 - /* We have no way of distinguishing these from other a.out variants */ - &aout_arm_big_vec, - &aout_arm_little_vec, - &riscix_vec, -#endif -#if 0 /* This has the same magic number as RS/6000. */ &pmac_xcoff_vec, #endif - &rs6000coff_vec, + &ppcboot_vec, +#if 0 + /* We have no way of distinguishing these from other a.out variants */ + &riscix_vec, +#endif #ifdef BFD64 &rs6000coff64_vec, #endif - &ppcboot_vec, - &shcoff_vec, - &shlcoff_vec, + &rs6000coff_vec, &shcoff_small_vec, + &shcoff_vec, &shlcoff_small_vec, + &shlcoff_vec, + &shlpe_vec, + &shlpei_vec, +#if defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF) + &som_vec, +#endif + &sparccoff_vec, &sparcle_aout_vec, &sparclinux_vec, &sparclynx_aout_vec, &sparclynx_coff_vec, &sparcnetbsd_vec, &sunos_big_vec, - &aout0_big_vec, &tic30_aout_vec, &tic30_coff_vec, - &tic54x_coff0_vec, &tic54x_coff0_beh_vec, - &tic54x_coff1_vec, + &tic54x_coff0_vec, &tic54x_coff1_beh_vec, - &tic54x_coff2_vec, + &tic54x_coff1_vec, &tic54x_coff2_beh_vec, + &tic54x_coff2_vec, &tic80coff_vec, &vaxnetbsd_vec, &versados_vec, @@ -950,12 +950,9 @@ static const bfd_target * const _bfd_tar &vms_alpha_vec, #endif &vms_vax_vec, + &w65_vec, &we32kcoff_vec, &z8kcoff_vec, - &bfd_elf32_s390_vec, -#ifdef BFD64 - &bfd_elf64_s390_vec, -#endif #endif /* not SELECT_VECS */ /* Always support S-records, for convenience. */ @@ -973,12 +970,19 @@ static const bfd_target * const _bfd_tar #ifdef AIX386_CORE &aix386_core_vec, #endif -#ifdef HPUX_CORE - &hpux_core_vec, +#if 0 + /* We don't include cisco_core_*_vec. Although it has a magic number, + the magic number isn't at the beginning of the file, and thus + might spuriously match other kinds of files. */ + &cisco_core_big_vec, + &cisco_core_little_vec, #endif #ifdef HPPABSD_CORE &hppabsd_core_vec, #endif +#ifdef HPUX_CORE + &hpux_core_vec, +#endif #ifdef IRIX_CORE &irix_core_vec, #endif @@ -988,17 +992,16 @@ static const bfd_target * const _bfd_tar #ifdef OSF_CORE &osf_core_vec, #endif +#ifdef PTRACE_CORE + &ptrace_core_vec, +#endif #ifdef SCO5_CORE &sco5_core_vec, #endif -#ifdef TRAD_CORE +#ifdef TRAD_CORE &trad_core_vec, #endif -#ifdef PTRACE_CORE - &ptrace_core_vec, -#endif - NULL /* end of list marker */ }; const bfd_target * const *bfd_target_vector = _bfd_target_vector; @@ -1105,7 +1108,7 @@ FUNCTION bfd_find_target SYNOPSIS - const bfd_target *bfd_find_target(CONST char *target_name, bfd *abfd); + const bfd_target *bfd_find_target(const char *target_name, bfd *abfd); DESCRIPTION Return a pointer to the transfer vector for the object target @@ -1171,19 +1174,20 @@ const char ** bfd_target_list () { int vec_length= 0; + bfd_size_type amt; #if defined (HOST_HPPAHPUX) && ! defined (__STDC__) /* The native compiler on the HP9000/700 has a bug which causes it to loop endlessly when compiling this file. This avoids it. */ volatile #endif - const bfd_target * const *target; - CONST char **name_list, **name_ptr; + const bfd_target * const *target; + const char **name_list, **name_ptr; for (target = &bfd_target_vector[0]; *target != NULL; target++) vec_length++; - name_ptr = name_list = (CONST char **) - bfd_zmalloc ((vec_length + 1) * sizeof (char **)); + amt = (vec_length + 1) * sizeof (char **); + name_ptr = name_list = (const char **) bfd_zmalloc (amt); if (name_list == NULL) return NULL; diff -uprN binutils-2.11.90.0.31/bfd/tekhex.c binutils-2.11.92.0.5/bfd/tekhex.c --- binutils-2.11.90.0.31/bfd/tekhex.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/tekhex.c Mon Oct 1 15:25:21 2001 @@ -1,5 +1,5 @@ /* BFD backend for Extended Tektronix Hex Format objects. - Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000 + Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support . @@ -107,7 +107,7 @@ static asymbol *tekhex_make_empty_symbol static int tekhex_sizeof_headers PARAMS ((bfd *, boolean)); static boolean tekhex_write_object_contents PARAMS ((bfd *)); static void out PARAMS ((bfd *, int, char *, char *)); -static void writesym PARAMS ((char **, CONST char *)); +static void writesym PARAMS ((char **, const char *)); static void writevalue PARAMS ((char **, bfd_vma)); static boolean tekhex_set_section_contents PARAMS ((bfd*, sec_ptr, PTR, file_ptr, bfd_size_type)); @@ -354,11 +354,11 @@ find_chunk (abfd, vma) } if (!d) { - char *sname = bfd_alloc (abfd, 12); + char *sname = bfd_alloc (abfd, (bfd_size_type) 12); /* No chunk for this address, so make one up */ - d = (struct data_struct *) - bfd_alloc (abfd, sizeof (struct data_struct)); + d = ((struct data_struct *) + bfd_alloc (abfd, (bfd_size_type) sizeof (struct data_struct))); if (!sname || !d) return NULL; @@ -394,7 +394,7 @@ first_phase (abfd, type, src) char *src; { asection *section = bfd_abs_section_ptr; - int len; + unsigned int len; char sym[17]; /* A symbol can only be 16chars long */ switch (type) @@ -419,7 +419,7 @@ first_phase (abfd, type, src) section = bfd_get_section_by_name (abfd, sym); if (section == (asection *) NULL) { - char *n = bfd_alloc (abfd, len + 1); + char *n = bfd_alloc (abfd, (bfd_size_type) len + 1); if (!n) abort (); /* FIXME */ @@ -445,10 +445,10 @@ first_phase (abfd, type, src) case '8': /* Symbols, add to section */ { + bfd_size_type amt = sizeof (tekhex_symbol_type); tekhex_symbol_type *new = - (tekhex_symbol_type *) bfd_alloc (abfd, - sizeof (tekhex_symbol_type)); - char type = (*src); + (tekhex_symbol_type *) bfd_alloc (abfd, amt); + char stype = (*src); if (!new) abort (); /* FIXME */ @@ -459,12 +459,12 @@ first_phase (abfd, type, src) new->prev = abfd->tdata.tekhex_data->symbols; abfd->tdata.tekhex_data->symbols = new; len = getsym (sym, &src); - new->symbol.name = bfd_alloc (abfd, len + 1); + new->symbol.name = bfd_alloc (abfd, (bfd_size_type) len + 1); if (!new->symbol.name) abort (); /* FIXME */ memcpy ((char *) (new->symbol.name), sym, len + 1); new->symbol.section = section; - if (type <= '4') + if (stype <= '4') new->symbol.flags = (BSF_GLOBAL | BSF_EXPORT); else new->symbol.flags = BSF_LOCAL; @@ -496,17 +496,17 @@ pass_over (abfd, func) char type; /* Find first '%' */ - eof = (boolean) (bfd_read (src, 1, 1, abfd) != 1); + eof = (boolean) (bfd_bread (src, (bfd_size_type) 1, abfd) != 1); while (*src != '%' && !eof) { - eof = (boolean) (bfd_read (src, 1, 1, abfd) != 1); + eof = (boolean) (bfd_bread (src, (bfd_size_type) 1, abfd) != 1); } if (eof) break; src++; /* Fetch the type and the length and the checksum */ - if (bfd_read (src, 1, 5, abfd) != 5) + if (bfd_bread (src, (bfd_size_type) 5, abfd) != 5) abort (); /* FIXME */ type = src[2]; @@ -516,7 +516,7 @@ pass_over (abfd, func) chars_on_line = HEX (src) - 5; /* Already read five char */ - if (bfd_read (src, 1, chars_on_line, abfd) != chars_on_line) + if (bfd_bread (src, (bfd_size_type) chars_on_line, abfd) != chars_on_line) abort (); /* FIXME */ src[chars_on_line] = 0; /* put a null at the end */ @@ -555,8 +555,9 @@ static boolean tekhex_mkobject (abfd) bfd *abfd; { - tdata_type *tdata = (tdata_type *) bfd_alloc (abfd, sizeof (tdata_type)); + tdata_type *tdata; + tdata = (tdata_type *) bfd_alloc (abfd, (bfd_size_type) sizeof (tdata_type)); if (!tdata) return false; abfd->tdata.tekhex_data = tdata; @@ -580,7 +581,7 @@ tekhex_object_p (abfd) tekhex_init (); if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 - || bfd_read (b, 1, 4, abfd) != 4) + || bfd_bread (b, (bfd_size_type) 4, abfd) != 4) return NULL; if (b[0] != '%' || !ISHEX (b[1]) || !ISHEX (b[2]) || !ISHEX (b[3])) @@ -597,7 +598,7 @@ move_section_contents (abfd, section, lo bfd *abfd; asection *section; PTR locationp; - file_ptr offset ATTRIBUTE_UNUSED; + file_ptr offset; bfd_size_type count; boolean get; { @@ -606,10 +607,11 @@ move_section_contents (abfd, section, lo bfd_vma prev_number = 1; /* Nothing can have this as a high bit*/ struct data_struct *d = (struct data_struct *) NULL; + BFD_ASSERT (offset == 0); for (addr = section->vma; count != 0; count--, addr++) { - - bfd_vma chunk_number = addr & ~CHUNK_MASK; /* Get high bits of address */ + /* Get high bits of address. */ + bfd_vma chunk_number = addr & ~(bfd_vma) CHUNK_MASK; bfd_vma low_bits = addr & CHUNK_MASK; if (chunk_number != prev_number) @@ -689,7 +691,7 @@ tekhex_set_section_contents (abfd, secti { if (s->flags & SEC_LOAD) { - for (vma = s->vma & ~CHUNK_MASK; + for (vma = s->vma & ~(bfd_vma) CHUNK_MASK; vma < s->vma + s->_raw_size; vma += CHUNK_MASK) find_chunk (abfd, vma); @@ -699,7 +701,8 @@ tekhex_set_section_contents (abfd, secti } if (section->flags & (SEC_LOAD | SEC_ALLOC)) { - move_section_contents (abfd, section, locationp, offset, bytes_to_do, false); + move_section_contents (abfd, section, locationp, offset, bytes_to_do, + false); return true; } else @@ -740,7 +743,7 @@ writevalue (dst, value) static void writesym (dst, sym) char **dst; - CONST char *sym; + const char *sym; { char *p = *dst; int len = (sym ? strlen (sym) : 0); @@ -797,11 +800,11 @@ out (abfd, type, start, end) sum += sum_block[(unsigned char) front[2]]; sum += sum_block[(unsigned char) front[3]]; /* type */ TOHEX (front + 4, sum); - if (bfd_write (front, 1, 6, abfd) != 6) + if (bfd_bwrite (front, (bfd_size_type) 6, abfd) != 6) abort (); end[0] = '\n'; wrlen = end - start + 1; - if (bfd_write (start, 1, wrlen, abfd) != wrlen) + if (bfd_bwrite (start, wrlen, abfd) != wrlen) abort (); } @@ -826,7 +829,7 @@ tekhex_write_object_contents (abfd) { int low; - CONST int span = 32; + const int span = 32; int addr; /* Write it in blocks of 32 bytes */ @@ -876,10 +879,10 @@ tekhex_write_object_contents (abfd) if (section_code != '?') { /* do not include debug symbols */ - asymbol *s = *p; + asymbol *sym = *p; char *dst = buffer; - writesym (&dst, s->section->name); + writesym (&dst, sym->section->name); switch (section_code) { @@ -911,15 +914,15 @@ tekhex_write_object_contents (abfd) return false; } - writesym (&dst, s->name); - writevalue (&dst, s->value + s->section->vma); + writesym (&dst, sym->name); + writevalue (&dst, sym->value + sym->section->vma); out (abfd, '3', buffer, dst); } } } /* And the terminator */ - if (bfd_write ("%0781010\n", 1, 9, abfd) != 9) + if (bfd_bwrite ("%0781010\n", (bfd_size_type) 9, abfd) != 9) abort (); return true; } @@ -937,8 +940,8 @@ static asymbol * tekhex_make_empty_symbol (abfd) bfd *abfd; { - tekhex_symbol_type *new = - (tekhex_symbol_type *) bfd_zalloc (abfd, sizeof (struct tekhex_symbol_struct)); + bfd_size_type amt = sizeof (struct tekhex_symbol_struct); + tekhex_symbol_type *new = (tekhex_symbol_type *) bfd_zalloc (abfd, amt); if (!new) return NULL; @@ -975,7 +978,7 @@ tekhex_print_symbol (abfd, filep, symbol case bfd_print_symbol_all: { - CONST char *section_name = symbol->section->name; + const char *section_name = symbol->section->name; bfd_print_symbol_vandf (abfd, (PTR) file, symbol); diff -uprN binutils-2.11.90.0.31/bfd/trad-core.c binutils-2.11.92.0.5/bfd/trad-core.c --- binutils-2.11.90.0.31/bfd/trad-core.c Fri Mar 9 11:16:09 2001 +++ binutils-2.11.92.0.5/bfd/trad-core.c Mon Oct 1 15:25:21 2001 @@ -1,6 +1,6 @@ /* BFD back end for traditional Unix core files (U-area and raw sections) Copyright 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, - 2000 + 2000, 2001 Free Software Foundation, Inc. Written by John Gilmore of Cygnus Support. @@ -80,14 +80,15 @@ trad_unix_core_file_p (abfd) int val; struct user u; struct trad_core_struct *rawptr; + bfd_size_type amt; #ifdef TRAD_CORE_USER_OFFSET /* If defined, this macro is the file position of the user struct. */ - if (bfd_seek (abfd, TRAD_CORE_USER_OFFSET, SEEK_SET) != 0) + if (bfd_seek (abfd, (file_ptr) TRAD_CORE_USER_OFFSET, SEEK_SET) != 0) return 0; #endif - val = bfd_read ((void *)&u, 1, sizeof u, abfd); + val = bfd_bread ((void *) &u, (bfd_size_type) sizeof u, abfd); if (val != sizeof u) { /* Too small to be a core file */ @@ -149,8 +150,8 @@ trad_unix_core_file_p (abfd) /* Allocate both the upage and the struct core_data at once, so a single free() will free them both. */ - rawptr = (struct trad_core_struct *) - bfd_zmalloc (sizeof (struct trad_core_struct)); + amt = sizeof (struct trad_core_struct); + rawptr = (struct trad_core_struct *) bfd_zmalloc (amt); if (rawptr == NULL) return 0; @@ -161,13 +162,16 @@ trad_unix_core_file_p (abfd) /* Create the sections. This is raunchy, but bfd_close wants to free them separately. */ - core_stacksec(abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection)); + amt = sizeof (asection); + core_stacksec(abfd) = (asection *) bfd_zalloc (abfd, amt); if (core_stacksec (abfd) == NULL) return NULL; - core_datasec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection)); + amt = sizeof (asection); + core_datasec (abfd) = (asection *) bfd_zalloc (abfd, amt); if (core_datasec (abfd) == NULL) return NULL; - core_regsec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection)); + amt = sizeof (asection); + core_regsec (abfd) = (asection *) bfd_zalloc (abfd, amt); if (core_regsec (abfd) == NULL) return NULL; diff -uprN binutils-2.11.90.0.31/bfd/vaxnetbsd.c binutils-2.11.92.0.5/bfd/vaxnetbsd.c --- binutils-2.11.90.0.31/bfd/vaxnetbsd.c Fri Mar 9 11:16:09 2001 +++ binutils-2.11.92.0.5/bfd/vaxnetbsd.c Thu Oct 4 14:35:43 2001 @@ -1,5 +1,5 @@ /* BFD back-end for NetBSD/VAX a.out-ish binaries. - Copyright 1998, 2000 Free Software Foundation, Inc. + Copyright 1998, 2000, 2001 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -26,7 +26,11 @@ Foundation, Inc., 59 Temple Place - Suit #define DEFAULT_ARCH bfd_arch_vax #define DEFAULT_MID M_VAX_NETBSD -#define MY(OP) CAT(vaxnetbsd_,OP) +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (vaxnetbsd_,OP) + /* This needs to start with a.out so GDB knows it is an a.out variant. */ #define TARGETNAME "a.out-vax-netbsd" diff -uprN binutils-2.11.90.0.31/bfd/versados.c binutils-2.11.92.0.5/bfd/versados.c --- binutils-2.11.90.0.31/bfd/versados.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/versados.c Mon Oct 1 15:25:21 2001 @@ -47,7 +47,7 @@ static boolean versados_mkobject PARAMS static boolean versados_scan PARAMS ((bfd *)); static const bfd_target *versados_object_p PARAMS ((bfd *)); static asymbol *versados_new_symbol PARAMS ((bfd *, int, const char *, bfd_vma, asection *)); -static char *new_symbol_string PARAMS ((bfd *, char *)); +static char *new_symbol_string PARAMS ((bfd *, const char *)); static const bfd_target *versados_object_p PARAMS ((bfd *)); static boolean versados_pass_2 PARAMS ((bfd *)); static boolean versados_get_section_contents @@ -58,6 +58,14 @@ static int versados_sizeof_headers PARAM static asymbol *versados_make_empty_symbol PARAMS ((bfd *)); static long int versados_get_symtab_upper_bound PARAMS ((bfd *)); static long int versados_get_symtab PARAMS ((bfd *, asymbol **)); +static void versados_get_symbol_info + PARAMS ((bfd *, asymbol *, symbol_info *)); +static void versados_print_symbol + PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type)); +static long versados_get_reloc_upper_bound + PARAMS ((bfd *, sec_ptr)); +static long versados_canonicalize_reloc + PARAMS ((bfd *, sec_ptr, arelent **, asymbol **)); #define VHEADER '1' #define VESTDEF '2' @@ -170,7 +178,8 @@ versados_mkobject (abfd) { if (abfd->tdata.versados_data == NULL) { - tdata_type *tdata = (tdata_type *) bfd_alloc (abfd, sizeof (tdata_type)); + bfd_size_type amt = sizeof (tdata_type); + tdata_type *tdata = (tdata_type *) bfd_alloc (abfd, amt); if (tdata == NULL) return false; abfd->tdata.versados_data = tdata; @@ -208,8 +217,9 @@ get_record (abfd, ptr) bfd *abfd; union ext_any *ptr; { - bfd_read (&ptr->size, 1, 1, abfd); - if (bfd_read ((char *) ptr + 1, 1, ptr->size, abfd) != ptr->size) + if (bfd_bread (&ptr->size, (bfd_size_type) 1, abfd) != 1 + || (bfd_bread ((char *) ptr + 1, (bfd_size_type) ptr->size, abfd) + != ptr->size)) return 0; return 1; } @@ -243,7 +253,7 @@ get_10 (pp, name) static char * new_symbol_string (abfd, name) bfd *abfd; - char *name; + const char *name; { char *n = VDATA (abfd)->strings; strcpy (VDATA (abfd)->strings, name); @@ -294,8 +304,8 @@ process_esd (abfd, esd, pass) int esidx; asymbol *s; char *n = new_symbol_string (abfd, name); - s = versados_new_symbol (abfd, snum, n, 0, - &bfd_und_section); + s = versados_new_symbol (abfd, snum, n, (bfd_vma) 0, + bfd_und_section_ptr); esidx = VDATA (abfd)->es_done++; RDATA (abfd, esidx - ES_BASE) = s; } @@ -318,7 +328,7 @@ process_esd (abfd, esd, pass) case ESD_XDEF_IN_SEC: { int snum = VDATA (abfd)->def_idx++; - long val; + bfd_vma val; get_10 (&ptr, name); val = get_4 (&ptr); if (pass == 1) @@ -330,7 +340,8 @@ process_esd (abfd, esd, pass) { asymbol *s; char *n = new_symbol_string (abfd, name); - s = versados_new_symbol (abfd, snum + VDATA (abfd)->nrefs, n, val, sec); + s = versados_new_symbol (abfd, snum + VDATA (abfd)->nrefs, n, + val, sec); s->flags |= BSF_GLOBAL; } } @@ -399,7 +410,7 @@ process_otr (abfd, otr, pass) int need_contents = 0; unsigned int dst_idx = esdid->pc; - for (shift = (1 << 31); shift && srcp < endp; shift >>= 1) + for (shift = ((unsigned long) 1 << 31); shift && srcp < endp; shift >>= 1) { if (bits & shift) { @@ -472,8 +483,10 @@ process_otr (abfd, otr, pass) EDATA (abfd, otr->esdid - 1).pc = dst_idx; if (!contents && need_contents) - esdid->contents = (unsigned char *) bfd_alloc (abfd, esdid->section->_raw_size); - + { + bfd_size_type size = esdid->section->_raw_size; + esdid->contents = (unsigned char *) bfd_alloc (abfd, size); + } } static boolean @@ -484,6 +497,7 @@ versados_scan (abfd) int i; int j; int nsecs = 0; + bfd_size_type amt; VDATA (abfd)->stringlen = 0; VDATA (abfd)->nrefs = 0; @@ -527,8 +541,8 @@ versados_scan (abfd) struct esdid *esdid = &EDATA (abfd, i); if (esdid->section) { - esdid->section->relocation - = (arelent *) bfd_alloc (abfd, sizeof (arelent) * esdid->relocs); + amt = (bfd_size_type) esdid->relocs * sizeof (arelent); + esdid->section->relocation = (arelent *) bfd_alloc (abfd, amt); esdid->pc = 0; @@ -549,10 +563,12 @@ versados_scan (abfd) abfd->symcount += nsecs; - VDATA (abfd)->symbols = (asymbol *) bfd_alloc (abfd, - sizeof (asymbol) * (abfd->symcount)); + amt = abfd->symcount; + amt *= sizeof (asymbol); + VDATA (abfd)->symbols = (asymbol *) bfd_alloc (abfd, amt); - VDATA (abfd)->strings = bfd_alloc (abfd, VDATA (abfd)->stringlen); + amt = VDATA (abfd)->stringlen; + VDATA (abfd)->strings = bfd_alloc (abfd, amt); if ((VDATA (abfd)->symbols == NULL && abfd->symcount > 0) || (VDATA (abfd)->strings == NULL && VDATA (abfd)->stringlen > 0)) @@ -600,14 +616,14 @@ versados_object_p (abfd) if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) return NULL; - if (bfd_read (&len, 1, 1, abfd) != 1) + if (bfd_bread (&len, (bfd_size_type) 1, abfd) != 1) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); return NULL; } - if (bfd_read (&ext.type, 1, len, abfd) != len) + if (bfd_bread (&ext.type, (bfd_size_type) len, abfd) != len) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -642,7 +658,7 @@ versados_pass_2 (abfd) if (VDATA (abfd)->pass_2_done) return 1; - if (bfd_seek (abfd, 0, SEEK_SET) != 0) + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) return 0; VDATA (abfd)->es_done = ES_BASE; @@ -711,7 +727,9 @@ static asymbol * versados_make_empty_symbol (abfd) bfd *abfd; { - asymbol *new = (asymbol *) bfd_zalloc (abfd, sizeof (asymbol)); + asymbol *new; + + new = (asymbol *) bfd_zalloc (abfd, (bfd_size_type) sizeof (asymbol)); if (new) new->the_bfd = abfd; return new; @@ -751,7 +769,7 @@ versados_get_symtab (abfd, alocation) return symcount; } -void +static void versados_get_symbol_info (ignore_abfd, symbol, ret) bfd *ignore_abfd ATTRIBUTE_UNUSED; asymbol *symbol; @@ -760,7 +778,7 @@ versados_get_symbol_info (ignore_abfd, s bfd_symbol_info (symbol, ret); } -void +static void versados_print_symbol (abfd, afile, symbol, how) bfd *abfd; PTR afile; @@ -782,7 +800,7 @@ versados_print_symbol (abfd, afile, symb } } -long +static long versados_get_reloc_upper_bound (abfd, asect) bfd *abfd ATTRIBUTE_UNUSED; sec_ptr asect; @@ -790,7 +808,7 @@ versados_get_reloc_upper_bound (abfd, as return (asect->reloc_count + 1) * sizeof (arelent *); } -long +static long versados_canonicalize_reloc (abfd, section, relptr, symbols) bfd *abfd; sec_ptr section; diff -uprN binutils-2.11.90.0.31/bfd/version.h binutils-2.11.92.0.5/bfd/version.h --- binutils-2.11.90.0.31/bfd/version.h Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/bfd/version.h Fri Oct 5 14:11:21 2001 @@ -0,0 +1 @@ +#define BFD_VERSION_DATE 20011005 diff -uprN binutils-2.11.90.0.31/bfd/vms-gsd.c binutils-2.11.92.0.5/bfd/vms-gsd.c --- binutils-2.11.90.0.31/bfd/vms-gsd.c Fri Mar 9 11:16:09 2001 +++ binutils-2.11.92.0.5/bfd/vms-gsd.c Mon Oct 1 15:25:21 2001 @@ -1,6 +1,6 @@ /* vms-gsd.c -- BFD back-end for VAX (openVMS/VAX) and EVAX (openVMS/Alpha) files. - Copyright 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. go and read the openVMS linker manual (esp. appendix B) if you don't know what's going on here :-) @@ -21,8 +21,6 @@ You should have received a copy of the G along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include - #include "bfd.h" #include "sysdep.h" #include "bfdlink.h" @@ -139,14 +137,17 @@ static struct sec_flags_struct evax_sect (SEC_IN_MEMORY|SEC_DATA|SEC_HAS_CONTENTS|SEC_ALLOC|SEC_LOAD) } }; +static flagword vms_secflag_by_name PARAMS ((bfd *, struct sec_flags_struct *, char *, int)); +static flagword vms_esecflag_by_name PARAMS ((struct sec_flags_struct *, char *, int)); + /* Retrieve bfd section flags by name and size */ static flagword -vms_secflag_by_name (abfd, section_flags, name, size) +vms_secflag_by_name (abfd, section_flags, name, hassize) bfd *abfd; struct sec_flags_struct *section_flags; char *name; - int size; + int hassize; { int i = 0; @@ -156,14 +157,14 @@ vms_secflag_by_name (abfd, section_flags strcasecmp (name, section_flags[i].name): strcmp (name, section_flags[i].name)) == 0) { - if (size > 0) + if (hassize) return section_flags[i].flags_hassize; else return section_flags[i].flags_always; } i++; } - if (size > 0) + if (hassize) return section_flags[i].flags_hassize; return section_flags[i].flags_always; } @@ -171,10 +172,10 @@ vms_secflag_by_name (abfd, section_flags /* Retrieve vms section flags by name and size */ static flagword -vms_esecflag_by_name (section_flags, name, size) +vms_esecflag_by_name (section_flags, name, hassize) struct sec_flags_struct *section_flags; char *name; - int size; + int hassize; { int i = 0; @@ -182,14 +183,14 @@ vms_esecflag_by_name (section_flags, nam { if (strcmp (name, section_flags[i].name) == 0) { - if (size > 0) + if (hassize) return section_flags[i].vflags_hassize; else return section_flags[i].vflags_always; } i++; } - if (size > 0) + if (hassize) return section_flags[i].vflags_hassize; return section_flags[i].vflags_always; } @@ -287,16 +288,16 @@ _bfd_vms_slurp_gsd (abfd, objtype) switch (objtype) { - case EOBJ_S_C_EGSD: - PRIV(vms_rec) += 8; /* skip type, size, l_temp */ - PRIV(rec_size) -= 8; - break; - case OBJ_S_C_GSD: - PRIV(vms_rec) += 1; - PRIV(rec_size) -= 1; - break; - default: - return -1; + case EOBJ_S_C_EGSD: + PRIV(vms_rec) += 8; /* skip type, size, l_temp */ + PRIV(rec_size) -= 8; + break; + case OBJ_S_C_GSD: + PRIV(vms_rec) += 1; + PRIV(rec_size) -= 1; + break; + default: + return -1; } /* calculate base address for each section */ @@ -356,8 +357,9 @@ _bfd_vms_slurp_gsd (abfd, objtype) return -1; } old_flags = bfd_getl16 (vms_rec + 2); - section->_raw_size = bfd_getl32(vms_rec + 4); /* allocation */ - new_flags = vms_secflag_by_name (abfd, vax_section_flags, name, section->_raw_size); + section->_raw_size = bfd_getl32 (vms_rec + 4); /* allocation */ + new_flags = vms_secflag_by_name (abfd, vax_section_flags, name, + section->_raw_size > 0); if (old_flags & EGPS_S_V_REL) new_flags |= SEC_RELOC; if (old_flags & GPS_S_M_OVR) @@ -411,7 +413,8 @@ _bfd_vms_slurp_gsd (abfd, objtype) else if (section->_raw_size > old_section->_raw_size) { section->contents = ((unsigned char *) - bfd_realloc (old_section->contents, section->_raw_size)); + bfd_realloc (old_section->contents, + section->_raw_size)); if (section->contents == NULL) { bfd_set_error (bfd_error_no_memory); @@ -422,13 +425,13 @@ _bfd_vms_slurp_gsd (abfd, objtype) else { section->contents = ((unsigned char *) - bfd_malloc (section->_raw_size)); + bfd_malloc (section->_raw_size)); if (section->contents == NULL) { bfd_set_error (bfd_error_no_memory); return -1; } - memset (section->contents, 0, (size_t)section->_raw_size); + memset (section->contents, 0, (size_t) section->_raw_size); } section->_cooked_size = section->_raw_size; #if VMS_DEBUG @@ -453,7 +456,7 @@ _bfd_vms_slurp_gsd (abfd, objtype) case GSD_S_C_SYM: case GSD_S_C_SYMW: { - int name_offset, value_offset; + int name_offset = 0, value_offset = 0; /* * symbol specification (definition or reference) @@ -470,30 +473,30 @@ _bfd_vms_slurp_gsd (abfd, objtype) switch (gsd_type) { - case GSD_S_C_EPM: - name_offset = 11; - value_offset = 5; - new_flags |= BSF_FUNCTION; - break; - case GSD_S_C_EPMW: - name_offset = 12; - value_offset = 6; - new_flags |= BSF_FUNCTION; - break; - case GSD_S_C_SYM: - if (old_flags & GSY_S_M_DEF) /* symbol definition */ - name_offset = 9; - else - name_offset = 4; - value_offset = 5; - break; - case GSD_S_C_SYMW: - if (old_flags & GSY_S_M_DEF) /* symbol definition */ - name_offset = 10; - else - name_offset = 5; - value_offset = 6; - break; + case GSD_S_C_EPM: + name_offset = 11; + value_offset = 5; + new_flags |= BSF_FUNCTION; + break; + case GSD_S_C_EPMW: + name_offset = 12; + value_offset = 6; + new_flags |= BSF_FUNCTION; + break; + case GSD_S_C_SYM: + if (old_flags & GSY_S_M_DEF) /* symbol definition */ + name_offset = 9; + else + name_offset = 4; + value_offset = 5; + break; + case GSD_S_C_SYMW: + if (old_flags & GSY_S_M_DEF) /* symbol definition */ + name_offset = 10; + else + name_offset = 5; + value_offset = 6; + break; } /* save symbol in vms_symbol_table */ @@ -601,7 +604,8 @@ _bfd_vms_slurp_gsd (abfd, objtype) return -1; old_flags = bfd_getl16 (vms_rec + 6); section->_raw_size = bfd_getl32 (vms_rec + 8); /* allocation */ - new_flags = vms_secflag_by_name (abfd, evax_section_flags, name, (int) section->_raw_size); + new_flags = vms_secflag_by_name (abfd, evax_section_flags, name, + section->_raw_size > 0); if (old_flags & EGPS_S_V_REL) new_flags |= SEC_RELOC; if (!bfd_set_section_flags (abfd, section, new_flags)) @@ -818,10 +822,11 @@ _bfd_vms_write_gsd (abfd, objtype) } else { - new_flags = vms_esecflag_by_name (evax_section_flags, sname, section->_raw_size); + new_flags = vms_esecflag_by_name (evax_section_flags, sname, + section->_raw_size > 0); } _bfd_vms_output_short (abfd, new_flags); - _bfd_vms_output_long (abfd, section->_raw_size); + _bfd_vms_output_long (abfd, (unsigned long) section->_raw_size); _bfd_vms_output_counted (abfd, sname); _bfd_vms_output_flush (abfd); @@ -839,6 +844,7 @@ _bfd_vms_write_gsd (abfd, objtype) for (symnum = 0; symnum < abfd->symcount; symnum++) { + char *hash; symbol = abfd->outsymbols[symnum]; if (*(symbol->name) == '_') @@ -890,27 +896,26 @@ _bfd_vms_write_gsd (abfd, objtype) } _bfd_vms_output_short (abfd, new_flags); - if (old_flags & (BSF_GLOBAL|BSF_WEAK)) /* symbol definition */ + if (old_flags & (BSF_GLOBAL | BSF_WEAK)) /* symbol definition */ { + uquad code_address = 0; + unsigned long ca_psindx = 0; + unsigned long psindx; + if (old_flags & BSF_FUNCTION) { - _bfd_vms_output_quad (abfd, symbol->value); - _bfd_vms_output_quad (abfd, - ((asymbol *) (symbol->udata.p))->value); - _bfd_vms_output_long (abfd, - (((asymbol *) (symbol->udata.p)) - ->section->index)); - _bfd_vms_output_long (abfd, symbol->section->index); - } - else - { - _bfd_vms_output_quad (abfd, symbol->value); /* L_VALUE */ - _bfd_vms_output_quad (abfd, 0); /* L_CODE_ADDRESS */ - _bfd_vms_output_long (abfd, 0); /* L_CA_PSINDX */ - _bfd_vms_output_long (abfd, symbol->section->index);/* L_PSINDX */ + code_address = ((asymbol *) (symbol->udata.p))->value; + ca_psindx = ((asymbol *) (symbol->udata.p))->section->index; } + psindx = symbol->section->index; + + _bfd_vms_output_quad (abfd, symbol->value); + _bfd_vms_output_quad (abfd, code_address); + _bfd_vms_output_long (abfd, ca_psindx); + _bfd_vms_output_long (abfd, psindx); } - _bfd_vms_output_counted (abfd, _bfd_vms_length_hash_symbol (abfd, symbol->name, EOBJ_S_C_SYMSIZ)); + hash = _bfd_vms_length_hash_symbol (abfd, symbol->name, EOBJ_S_C_SYMSIZ); + _bfd_vms_output_counted (abfd, hash); _bfd_vms_output_flush (abfd); diff -uprN binutils-2.11.90.0.31/bfd/vms-hdr.c binutils-2.11.92.0.5/bfd/vms-hdr.c --- binutils-2.11.90.0.31/bfd/vms-hdr.c Fri Mar 9 11:16:09 2001 +++ binutils-2.11.92.0.5/bfd/vms-hdr.c Thu Oct 4 14:35:43 2001 @@ -1,6 +1,6 @@ /* vms-hdr.c -- BFD back-end for VMS/VAX (openVMS/VAX) and EVAX (openVMS/Alpha) files. - Copyright 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. HDR record handling functions EMH record handling functions @@ -24,11 +24,10 @@ You should have received a copy of the G along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include - #include "bfd.h" #include "sysdep.h" #include "bfdlink.h" +#include "safe-ctype.h" #include "libbfd.h" #include "vms.h" @@ -36,6 +35,10 @@ Foundation, Inc., 59 Temple Place - Suit #ifdef HAVE_ALLOCA_H #include #endif + +static unsigned char *get_vms_time_string PARAMS ((void)); + + /*---------------------------------------------------------------------------*/ /* Read & process emh record @@ -299,8 +302,7 @@ _bfd_vms_write_hdr (abfd, objtype) fptr = fout; while (*fptr != 0) { - if (islower (*fptr)) - *fptr = toupper (*fptr); + *fptr = TOUPPER (*fptr); fptr++; if ((*fptr == ';') || ((fptr - fout) > 31)) @@ -311,7 +313,7 @@ _bfd_vms_write_hdr (abfd, objtype) else _bfd_vms_output_counted (abfd, "NONAME"); - _bfd_vms_output_counted (abfd, BFD_VERSION); + _bfd_vms_output_counted (abfd, BFD_VERSION_STRING); _bfd_vms_output_dump (abfd, get_vms_time_string (), 17); _bfd_vms_output_fill (abfd, 0, 17); _bfd_vms_output_flush (abfd); @@ -343,7 +345,8 @@ _bfd_vms_write_hdr (abfd, objtype) continue; } - _bfd_vms_output_dump (abfd, (unsigned char *)symbol->name, strlen (symbol->name)); + _bfd_vms_output_dump (abfd, (unsigned char *) symbol->name, + (int) strlen (symbol->name)); if (had_case) break; had_file = 1; diff -uprN binutils-2.11.90.0.31/bfd/vms-misc.c binutils-2.11.92.0.5/bfd/vms-misc.c --- binutils-2.11.90.0.31/bfd/vms-misc.c Fri Mar 9 11:38:01 2001 +++ binutils-2.11.92.0.5/bfd/vms-misc.c Mon Oct 1 15:25:21 2001 @@ -30,6 +30,10 @@ Foundation, Inc., 59 Temple Place - Suit #include "vms.h" +static vms_section *add_new_contents PARAMS ((bfd *, sec_ptr)); +static int hash_string PARAMS ((const char *)); +static asymbol *new_symbol PARAMS ((bfd *, char *)); + /*-----------------------------------------------------------------------------*/ #if VMS_DEBUG /* debug functions */ @@ -330,7 +334,7 @@ _bfd_vms_get_record (abfd) if (bfd_tell (abfd) & 1) { - if (bfd_read (PRIV (vms_buf), 1, 1, abfd) != 1) + if (bfd_bread (PRIV (vms_buf), (bfd_size_type) 1, abfd) != 1) { bfd_set_error (bfd_error_file_truncated); return 0; @@ -340,7 +344,7 @@ _bfd_vms_get_record (abfd) /* read the record header on Alpha. */ if ((test_len != 0) - && (bfd_read (PRIV (vms_buf), 1, test_len, abfd) + && (bfd_bread (PRIV (vms_buf), (bfd_size_type) test_len, abfd) != (bfd_size_type) test_len)) { bfd_set_error (bfd_error_file_truncated); @@ -366,7 +370,8 @@ _bfd_vms_get_record (abfd) if (PRIV (is_vax)) { - PRIV (rec_length) = bfd_read (vms_buf, 1, PRIV (buf_size), abfd); + PRIV (rec_length) = bfd_bread (vms_buf, (bfd_size_type) PRIV (buf_size), + abfd); if (PRIV (rec_length) <= 0) { bfd_set_error (bfd_error_file_truncated); @@ -399,7 +404,8 @@ _bfd_vms_get_record (abfd) if (PRIV (rec_length) > PRIV (buf_size)) { - PRIV (vms_buf) = (unsigned char *) realloc (vms_buf, PRIV (rec_length)); + PRIV (vms_buf) = ((unsigned char *) + realloc (vms_buf, (size_t) PRIV (rec_length))); vms_buf = PRIV (vms_buf); if (vms_buf == 0) { @@ -414,9 +420,9 @@ _bfd_vms_get_record (abfd) remaining = PRIV (rec_length) - test_len + test_start; #if VMS_DEBUG - vms_debug (10, "bfd_read remaining %d\n", remaining); + vms_debug (10, "bfd_bread remaining %d\n", remaining); #endif - if (bfd_read (vms_buf + test_len, 1, remaining, abfd) != + if (bfd_bread (vms_buf + test_len, (bfd_size_type) remaining, abfd) != (bfd_size_type) remaining) { bfd_set_error (bfd_error_file_truncated); @@ -426,7 +432,7 @@ _bfd_vms_get_record (abfd) } #if VMS_DEBUG - vms_debug (11, "bfd_read rec_length %d\n", PRIV (rec_length)); + vms_debug (11, "bfd_bread rec_length %d\n", PRIV (rec_length)); #endif return PRIV (rec_length); @@ -487,11 +493,11 @@ _bfd_vms_save_sized_string (str, size) unsigned char *str; int size; { - char *newstr = bfd_malloc (size + 1); + char *newstr = bfd_malloc ((bfd_size_type) size + 1); if (newstr == NULL) return 0; - strncpy (newstr, (char *)str, size); + strncpy (newstr, (char *) str, (size_t) size); newstr[size] = 0; return newstr; @@ -587,11 +593,11 @@ add_new_contents (abfd, section) if (sptr != NULL) return sptr; - newptr = (vms_section *) bfd_malloc (sizeof (vms_section)); + newptr = (vms_section *) bfd_malloc ((bfd_size_type) sizeof (vms_section)); if (newptr == (vms_section *) NULL) return NULL; - newptr->contents = (unsigned char *) bfd_alloc (abfd, (int)section->_raw_size); - if (newptr->contents == (unsigned char *)NULL) + newptr->contents = (unsigned char *) bfd_alloc (abfd, section->_raw_size); + if (newptr->contents == (unsigned char *) NULL) return NULL; newptr->offset = 0; newptr->size = section->_raw_size; @@ -661,7 +667,7 @@ _bfd_vms_output_begin (abfd, rectype, re rechead); #endif - _bfd_vms_output_short (abfd,rectype); + _bfd_vms_output_short (abfd, (unsigned int) rectype); /* save current output position to fill in lenght later */ @@ -673,10 +679,10 @@ _bfd_vms_output_begin (abfd, rectype, re PRIV (length_pos)); #endif - _bfd_vms_output_short (abfd,0); /* placeholder for length */ + _bfd_vms_output_short (abfd, 0); /* placeholder for length */ if (rechead != -1) - _bfd_vms_output_short (abfd,rechead); + _bfd_vms_output_short (abfd, (unsigned int) rechead); return; } @@ -776,15 +782,16 @@ _bfd_vms_output_flush (abfd) /* put length to buffer */ PRIV (output_size) = PRIV (length_pos); - _bfd_vms_output_short (abfd, (unsigned int)length); + _bfd_vms_output_short (abfd, (unsigned int) length); if (PRIV (push_level) == 0) { #ifndef VMS /* write length first, see FF_FOREIGN in the input routines */ - fwrite (PRIV (output_buf)+2, 2, 1, (FILE *)abfd->iostream); + fwrite (PRIV (output_buf) + 2, 2, 1, (FILE *) abfd->iostream); #endif - fwrite (PRIV (output_buf), real_size, 1, (FILE *)abfd->iostream); + fwrite (PRIV (output_buf), (size_t) real_size, 1, + (FILE *) abfd->iostream); PRIV (output_size) = 0; } @@ -855,7 +862,8 @@ _bfd_vms_output_short (abfd, value) vms_debug (6, "_bfd_vms_output_short (%04x)\n", value); #endif - bfd_put_16 (abfd, value & 0xffff, PRIV (output_buf) + PRIV (output_size)); + bfd_put_16 (abfd, (bfd_vma) value & 0xffff, + PRIV (output_buf) + PRIV (output_size)); PRIV (output_size) += 2; return; } @@ -871,7 +879,7 @@ _bfd_vms_output_long (abfd, value) vms_debug (6, "_bfd_vms_output_long (%08lx)\n", value); #endif - bfd_put_32 (abfd, value, PRIV (output_buf) + PRIV (output_size)); + bfd_put_32 (abfd, (bfd_vma) value, PRIV (output_buf) + PRIV (output_size)); PRIV (output_size) += 4; return; } @@ -916,7 +924,7 @@ int len; (*_bfd_error_handler) (_("_bfd_vms_output_counted called with too many bytes")); return; } - _bfd_vms_output_byte (abfd, len & 0xff); + _bfd_vms_output_byte (abfd, (unsigned int) len & 0xff); _bfd_vms_output_dump (abfd, (unsigned char *)value, len); } @@ -935,7 +943,7 @@ _bfd_vms_output_dump (abfd, data, length if (length == 0) return; - memcpy (PRIV (output_buf) + PRIV (output_size), data, length); + memcpy (PRIV (output_buf) + PRIV (output_size), data, (size_t) length); PRIV (output_size) += length; return; @@ -955,7 +963,7 @@ _bfd_vms_output_fill (abfd, value, count if (count == 0) return; - memset (PRIV (output_buf) + PRIV (output_size), value, count); + memset (PRIV (output_buf) + PRIV (output_size), value, (size_t) count); PRIV (output_size) += count; return; @@ -1027,7 +1035,7 @@ _bfd_vms_length_hash_symbol (abfd, in, m i = maxlen; } - strncpy (out, in, i); + strncpy (out, in, (size_t) i); in += i; out += i; diff -uprN binutils-2.11.90.0.31/bfd/vms-tir.c binutils-2.11.92.0.5/bfd/vms-tir.c --- binutils-2.11.90.0.31/bfd/vms-tir.c Fri Mar 9 11:16:09 2001 +++ binutils-2.11.92.0.5/bfd/vms-tir.c Mon Oct 1 15:25:21 2001 @@ -1,6 +1,6 @@ /* vms-tir.c -- BFD back-end for VAX (openVMS/VAX) and EVAX (openVMS/Alpha) files. - Copyright 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. TIR record handling functions ETIR record handling functions @@ -33,8 +33,6 @@ Foundation, Inc., 59 Temple Place - Suit qw quadword (8 byte, 64 bit) da data stream */ -#include - #include "bfd.h" #include "sysdep.h" #include "bfdlink.h" @@ -49,6 +47,17 @@ static void image_write_b PARAMS ((bfd * static void image_write_w PARAMS ((bfd *abfd, unsigned int value)); static void image_write_l PARAMS ((bfd *abfd, unsigned long value)); static void image_write_q PARAMS ((bfd *abfd, uquad value)); +static int check_section PARAMS ((bfd *, int)); +static boolean etir_sta PARAMS ((bfd *, int, unsigned char *)); +static boolean etir_sto PARAMS ((bfd *, int, unsigned char *)); +static boolean etir_opr PARAMS ((bfd *, int, unsigned char *)); +static boolean etir_ctl PARAMS ((bfd *, int, unsigned char *)); +static boolean etir_stc PARAMS ((bfd *, int, unsigned char *)); +static asection *new_section PARAMS ((bfd *, int)); +static int alloc_section PARAMS ((bfd *, unsigned int)); +static int etir_cmd PARAMS ((bfd *, int, unsigned char *)); +static int analyze_tir PARAMS ((bfd *, unsigned char *, unsigned int)); +static int analyze_etir PARAMS ((bfd *, unsigned char *, unsigned int)); /*-----------------------------------------------------------------------------*/ @@ -57,19 +66,20 @@ check_section (abfd, size) bfd *abfd; int size; { - int offset; + bfd_size_type offset; - offset = PRIV(image_ptr) - PRIV(image_section)->contents; - if ((bfd_size_type) (offset + size) > PRIV(image_section)->_raw_size) + offset = PRIV (image_ptr) - PRIV (image_section)->contents; + if (offset + size > PRIV (image_section)->_raw_size) { - PRIV(image_section)->contents = bfd_realloc (PRIV(image_section)->contents, offset + size); - if (PRIV(image_section)->contents == 0) + PRIV (image_section)->contents + = bfd_realloc (PRIV (image_section)->contents, offset + size); + if (PRIV (image_section)->contents == 0) { (*_bfd_error_handler) (_("No Mem !")); return -1; } - PRIV(image_section)->_raw_size = offset + size; - PRIV(image_ptr) = PRIV(image_section)->contents + offset; + PRIV (image_section)->_raw_size = offset + size; + PRIV (image_ptr) = PRIV (image_section)->contents + offset; } return 0; @@ -87,11 +97,11 @@ image_set_ptr (abfd, psect, offset) { #if VMS_DEBUG _bfd_vms_debug (4, "image_set_ptr (%d=%s, %d)\n", - psect, PRIV(sections)[psect]->name, offset); + psect, PRIV (sections)[psect]->name, offset); #endif - PRIV(image_ptr) = PRIV(sections)[psect]->contents + offset; - PRIV(image_section) = PRIV(sections)[psect]; + PRIV (image_ptr) = PRIV (sections)[psect]->contents + offset; + PRIV (image_section) = PRIV (sections)[psect]; return; } @@ -106,7 +116,7 @@ image_inc_ptr (abfd, offset) _bfd_vms_debug (4, "image_inc_ptr (%d)\n", offset); #endif - PRIV(image_ptr) += offset; + PRIV (image_ptr) += offset; return; } @@ -121,15 +131,16 @@ image_dump (abfd, ptr, size, offset) int offset ATTRIBUTE_UNUSED; { #if VMS_DEBUG - _bfd_vms_debug (8, "image_dump from (%p, %d) to (%p)\n", ptr, size, PRIV(image_ptr)); + _bfd_vms_debug (8, "image_dump from (%p, %d) to (%p)\n", ptr, size, + PRIV (image_ptr)); _bfd_hexdump (9, ptr, size, offset); #endif - if (PRIV(is_vax) && check_section (abfd, size)) + if (PRIV (is_vax) && check_section (abfd, size)) return; while (size-- > 0) - *PRIV(image_ptr)++ = *ptr++; + *PRIV (image_ptr)++ = *ptr++; return; } @@ -141,13 +152,13 @@ image_write_b (abfd, value) unsigned int value; { #if VMS_DEBUG - _bfd_vms_debug (6, "image_write_b(%02x)\n", (int)value); + _bfd_vms_debug (6, "image_write_b(%02x)\n", (int) value); #endif - if (PRIV(is_vax) && check_section (abfd, 1)) + if (PRIV (is_vax) && check_section (abfd, 1)) return; - *PRIV(image_ptr)++ = (value & 0xff); + *PRIV (image_ptr)++ = (value & 0xff); return; } @@ -159,14 +170,14 @@ image_write_w (abfd, value) unsigned int value; { #if VMS_DEBUG - _bfd_vms_debug (6, "image_write_w(%04x)\n", (int)value); + _bfd_vms_debug (6, "image_write_w(%04x)\n", (int) value); #endif - if (PRIV(is_vax) && check_section (abfd, 2)) + if (PRIV (is_vax) && check_section (abfd, 2)) return; - bfd_putl16 (value, PRIV(image_ptr)); - PRIV(image_ptr) += 2; + bfd_putl16 ((bfd_vma) value, PRIV (image_ptr)); + PRIV (image_ptr) += 2; return; } @@ -182,11 +193,11 @@ image_write_l (abfd, value) _bfd_vms_debug (6, "image_write_l (%08lx)\n", value); #endif - if (PRIV(is_vax) && check_section (abfd, 4)) + if (PRIV (is_vax) && check_section (abfd, 4)) return; - bfd_putl32 (value, PRIV(image_ptr)); - PRIV(image_ptr) += 4; + bfd_putl32 ((bfd_vma) value, PRIV (image_ptr)); + PRIV (image_ptr) += 4; return; } @@ -202,11 +213,11 @@ image_write_q (abfd, value) _bfd_vms_debug (6, "image_write_q (%016lx)\n", value); #endif - if (PRIV(is_vax) && check_section (abfd, 8)) + if (PRIV (is_vax) && check_section (abfd, 8)) return; - bfd_putl64 (value, PRIV(image_ptr)); - PRIV(image_ptr) += 8; + bfd_putl64 (value, PRIV (image_ptr)); + PRIV (image_ptr) += 8; return; } @@ -232,7 +243,7 @@ etir_sta (abfd, cmd, ptr) #if VMS_DEBUG _bfd_vms_debug (5, "etir_sta %d/%x\n", cmd, cmd); - _bfd_hexdump (8, ptr, 16, (int)ptr); + _bfd_hexdump (8, ptr, 16, (int) ptr); #endif switch (cmd) @@ -240,87 +251,87 @@ etir_sta (abfd, cmd, ptr) /* stack */ /* stack global - arg: cs symbol name + arg: cs symbol name - stack 32 bit value of symbol (high bits set to 0) */ + stack 32 bit value of symbol (high bits set to 0) */ - case ETIR_S_C_STA_GBL: - { - char *name; - vms_symbol_entry *entry; + case ETIR_S_C_STA_GBL: + { + char *name; + vms_symbol_entry *entry; - name = _bfd_vms_save_counted_string (ptr); - entry = (vms_symbol_entry *) - bfd_hash_lookup (PRIV(vms_symbol_table), name, false, false); - if (entry == (vms_symbol_entry *)NULL) - { + name = _bfd_vms_save_counted_string (ptr); + entry = (vms_symbol_entry *) + bfd_hash_lookup (PRIV (vms_symbol_table), name, false, false); + if (entry == (vms_symbol_entry *) NULL) + { #if VMS_DEBUG - _bfd_vms_debug (3, "ETIR_S_C_STA_GBL: no symbol \"%s\"\n", name); + _bfd_vms_debug (3, "ETIR_S_C_STA_GBL: no symbol \"%s\"\n", name); #endif - _bfd_vms_push (abfd, (uquad)0, -1); - } - else - { - _bfd_vms_push (abfd, (uquad) (entry->symbol->value), -1); - } - } + _bfd_vms_push (abfd, (uquad) 0, -1); + } + else + { + _bfd_vms_push (abfd, (uquad) (entry->symbol->value), -1); + } + } break; - /* stack longword - arg: lw value + /* stack longword + arg: lw value - stack 32 bit value, sign extend to 64 bit */ + stack 32 bit value, sign extend to 64 bit */ - case ETIR_S_C_STA_LW: - _bfd_vms_push (abfd, (uquad)bfd_getl32 (ptr), -1); + case ETIR_S_C_STA_LW: + _bfd_vms_push (abfd, (uquad) bfd_getl32 (ptr), -1); break; - /* stack global - arg: qw value + /* stack global + arg: qw value - stack 64 bit value of symbol */ + stack 64 bit value of symbol */ - case ETIR_S_C_STA_QW: - _bfd_vms_push (abfd, (uquad)bfd_getl64(ptr), -1); + case ETIR_S_C_STA_QW: + _bfd_vms_push (abfd, (uquad) bfd_getl64 (ptr), -1); break; - /* stack psect base plus quadword offset - arg: lw section index - qw signed quadword offset (low 32 bits) + /* stack psect base plus quadword offset + arg: lw section index + qw signed quadword offset (low 32 bits) - stack qw argument and section index - (see ETIR_S_C_STO_OFF, ETIR_S_C_CTL_SETRB) */ + stack qw argument and section index + (see ETIR_S_C_STO_OFF, ETIR_S_C_CTL_SETRB) */ - case ETIR_S_C_STA_PQ: - { - uquad dummy; - unsigned int psect; + case ETIR_S_C_STA_PQ: + { + uquad dummy; + unsigned int psect; - psect = bfd_getl32 (ptr); - if (psect >= PRIV(section_count)) - { - (*_bfd_error_handler) (_("Bad section index in ETIR_S_C_STA_PQ")); - bfd_set_error (bfd_error_bad_value); - return false; - } - dummy = bfd_getl64 (ptr+4); - _bfd_vms_push (abfd, dummy, psect); - } + psect = bfd_getl32 (ptr); + if (psect >= PRIV (section_count)) + { + (*_bfd_error_handler) (_("Bad section index in ETIR_S_C_STA_PQ")); + bfd_set_error (bfd_error_bad_value); + return false; + } + dummy = bfd_getl64 (ptr+4); + _bfd_vms_push (abfd, dummy, (int) psect); + } break; - /* all not supported */ + /* all not supported */ - case ETIR_S_C_STA_LI: - case ETIR_S_C_STA_MOD: - case ETIR_S_C_STA_CKARG: + case ETIR_S_C_STA_LI: + case ETIR_S_C_STA_MOD: + case ETIR_S_C_STA_CKARG: - (*_bfd_error_handler) (_("Unsupported STA cmd %d"), cmd); - return false; + (*_bfd_error_handler) (_("Unsupported STA cmd %d"), cmd); + return false; break; - default: - (*_bfd_error_handler) (_("Reserved STA cmd %d"), cmd); - return false; + default: + (*_bfd_error_handler) (_("Reserved STA cmd %d"), cmd); + return false; break; } #if VMS_DEBUG @@ -350,7 +361,7 @@ etir_sto (abfd, cmd, ptr) #if VMS_DEBUG _bfd_vms_debug (5, "etir_sto %d/%x\n", cmd, cmd); - _bfd_hexdump (8, ptr, 16, (int)ptr); + _bfd_hexdump (8, ptr, 16, (int) ptr); #endif switch (cmd) @@ -365,7 +376,8 @@ etir_sto (abfd, cmd, ptr) if (is_share) /* FIXME */ (*_bfd_error_handler) ("ETIR_S_C_STO_B: byte fixups not supported"); #endif - image_write_b (abfd, dummy & 0xff); /* FIXME: check top bits */ + /* FIXME: check top bits */ + image_write_b (abfd, (unsigned int) dummy & 0xff); break; /* store word: pop stack, write word @@ -377,7 +389,8 @@ etir_sto (abfd, cmd, ptr) if (is_share) /* FIXME */ (*_bfd_error_handler) ("ETIR_S_C_STO_B: word fixups not supported"); #endif - image_write_w (abfd, dummy & 0xffff); /* FIXME: check top bits */ + /* FIXME: check top bits */ + image_write_w (abfd, (unsigned int) dummy & 0xffff); break; /* store longword: pop stack, write longword @@ -385,8 +398,9 @@ etir_sto (abfd, cmd, ptr) case ETIR_S_C_STO_LW: dummy = _bfd_vms_pop (abfd, &psect); - dummy += (PRIV(sections)[psect])->vma; - image_write_l (abfd, dummy & 0xffffffff);/* FIXME: check top bits */ + dummy += (PRIV (sections)[psect])->vma; + /* FIXME: check top bits */ + image_write_l (abfd, (unsigned int) dummy & 0xffffffff); break; /* store quadword: pop stack, write quadword @@ -394,7 +408,7 @@ etir_sto (abfd, cmd, ptr) case ETIR_S_C_STO_QW: dummy = _bfd_vms_pop (abfd, &psect); - dummy += (PRIV(sections)[psect])->vma; + dummy += (PRIV (sections)[psect])->vma; image_write_q (abfd, dummy); /* FIXME: check top bits */ break; @@ -404,11 +418,11 @@ etir_sto (abfd, cmd, ptr) case ETIR_S_C_STO_IMMR: { - unsigned long size; + int size; size = bfd_getl32 (ptr); - dummy = (unsigned long)_bfd_vms_pop (abfd, NULL); - while (dummy-- > 0L) + dummy = (unsigned long) _bfd_vms_pop (abfd, NULL); + while (dummy-- > 0) image_dump (abfd, ptr+4, size, 0); } break; @@ -422,8 +436,9 @@ etir_sto (abfd, cmd, ptr) char *name; name = _bfd_vms_save_counted_string (ptr); - entry = (vms_symbol_entry *)bfd_hash_lookup (PRIV(vms_symbol_table), name, false, false); - if (entry == (vms_symbol_entry *)NULL) + entry = (vms_symbol_entry *) bfd_hash_lookup (PRIV (vms_symbol_table), + name, false, false); + if (entry == (vms_symbol_entry *) NULL) { (*_bfd_error_handler) (_("ETIR_S_C_STO_GBL: no symbol \"%s\""), name); @@ -443,8 +458,9 @@ etir_sto (abfd, cmd, ptr) char *name; name = _bfd_vms_save_counted_string (ptr); - entry = (vms_symbol_entry *) bfd_hash_lookup (PRIV(vms_symbol_table), name, false, false); - if (entry == (vms_symbol_entry *)NULL) + entry = (vms_symbol_entry *) bfd_hash_lookup (PRIV (vms_symbol_table), + name, false, false); + if (entry == (vms_symbol_entry *) NULL) { (*_bfd_error_handler) (_("ETIR_S_C_STO_CA: no symbol \"%s\""), name); @@ -462,16 +478,16 @@ etir_sto (abfd, cmd, ptr) (*_bfd_error_handler) (_("ETIR_S_C_STO_RB/AB: Not supported")); break; - /* store offset to psect: pop stack, add low 32 bits to base of psect - arg: - */ + /* store offset to psect: pop stack, add low 32 bits to base of psect + arg: - */ case ETIR_S_C_STO_OFF: { uquad q; - int psect; + int psect1; - q = _bfd_vms_pop (abfd, &psect); - q += (PRIV(sections)[psect])->vma; + q = _bfd_vms_pop (abfd, &psect1); + q += (PRIV (sections)[psect1])->vma; image_write_q (abfd, q); } break; @@ -489,8 +505,9 @@ etir_sto (abfd, cmd, ptr) } break; - /* this code is 'reserved to digital' according to the openVMS linker manual, - however it is generated by the DEC C compiler and defined in the include file. + /* this code is 'reserved to digital' according to the openVMS + linker manual, however it is generated by the DEC C compiler + and defined in the include file. FIXME, since the following is just a guess store global longword: store 32bit value of symbol arg: cs symbol name */ @@ -501,13 +518,14 @@ etir_sto (abfd, cmd, ptr) char *name; name = _bfd_vms_save_counted_string (ptr); - entry = (vms_symbol_entry *)bfd_hash_lookup (PRIV(vms_symbol_table), name, false, false); - if (entry == (vms_symbol_entry *)NULL) + entry = (vms_symbol_entry *) bfd_hash_lookup (PRIV (vms_symbol_table), + name, false, false); + if (entry == (vms_symbol_entry *) NULL) { #if VMS_DEBUG _bfd_vms_debug (3, "ETIR_S_C_STO_GBL_LW: no symbol \"%s\"\n", name); #endif - image_write_l (abfd, (unsigned long)0); /* FIXME, reloc */ + image_write_l (abfd, (unsigned long) 0); /* FIXME, reloc */ } else image_write_l (abfd, (unsigned long) (entry->symbol->value)); /* FIXME, reloc */ @@ -520,13 +538,13 @@ etir_sto (abfd, cmd, ptr) (*_bfd_error_handler) (_("ETIR_S_C_STO_LP_PSB: Not supported")); break; - /* */ + /* */ case ETIR_S_C_STO_HINT_GBL: (*_bfd_error_handler) (_("ETIR_S_C_STO_HINT_GBL: not implemented")); break; - /* */ + /* */ case ETIR_S_C_STO_HINT_PS: (*_bfd_error_handler) (_("ETIR_S_C_STO_HINT_PS: not implemented")); @@ -557,7 +575,7 @@ etir_opr (abfd, cmd, ptr) #if VMS_DEBUG _bfd_vms_debug (5, "etir_opr %d/%x\n", cmd, cmd); - _bfd_hexdump (8, ptr, 16, (int)ptr); + _bfd_hexdump (8, ptr, 16, (int) ptr); #endif switch (cmd) @@ -572,34 +590,34 @@ etir_opr (abfd, cmd, ptr) /* add */ case ETIR_S_C_OPR_ADD: - op1 = (long)_bfd_vms_pop (abfd, NULL); - op2 = (long)_bfd_vms_pop (abfd, NULL); + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); _bfd_vms_push (abfd, (uquad) (op1 + op2), -1); break; /* subtract */ case ETIR_S_C_OPR_SUB: - op1 = (long)_bfd_vms_pop (abfd, NULL); - op2 = (long)_bfd_vms_pop (abfd, NULL); + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); _bfd_vms_push (abfd, (uquad) (op2 - op1), -1); break; /* multiply */ case ETIR_S_C_OPR_MUL: - op1 = (long)_bfd_vms_pop (abfd, NULL); - op2 = (long)_bfd_vms_pop (abfd, NULL); + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); _bfd_vms_push (abfd, (uquad) (op1 * op2), -1); break; /* divide */ case ETIR_S_C_OPR_DIV: - op1 = (long)_bfd_vms_pop (abfd, NULL); - op2 = (long)_bfd_vms_pop (abfd, NULL); + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); if (op2 == 0) - _bfd_vms_push (abfd, (uquad)0L, -1); + _bfd_vms_push (abfd, (uquad) 0, -1); else _bfd_vms_push (abfd, (uquad) (op2 / op1), -1); break; @@ -607,58 +625,58 @@ etir_opr (abfd, cmd, ptr) /* logical and */ case ETIR_S_C_OPR_AND: - op1 = (long)_bfd_vms_pop (abfd, NULL); - op2 = (long)_bfd_vms_pop (abfd, NULL); + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); _bfd_vms_push (abfd, (uquad) (op1 & op2), -1); break; /* logical inclusive or */ case ETIR_S_C_OPR_IOR: - op1 = (long)_bfd_vms_pop (abfd, NULL); - op2 = (long)_bfd_vms_pop (abfd, NULL); + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); _bfd_vms_push (abfd, (uquad) (op1 | op2), -1); break; /* logical exclusive or */ case ETIR_S_C_OPR_EOR: - op1 = (long)_bfd_vms_pop (abfd, NULL); - op2 = (long)_bfd_vms_pop (abfd, NULL); + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); _bfd_vms_push (abfd, (uquad) (op1 ^ op2), -1); break; /* negate */ case ETIR_S_C_OPR_NEG: - op1 = (long)_bfd_vms_pop (abfd, NULL); + op1 = (long) _bfd_vms_pop (abfd, NULL); _bfd_vms_push (abfd, (uquad) (-op1), -1); break; /* complement */ case ETIR_S_C_OPR_COM: - op1 = (long)_bfd_vms_pop (abfd, NULL); + op1 = (long) _bfd_vms_pop (abfd, NULL); _bfd_vms_push (abfd, (uquad) (op1 ^ -1L), -1); break; /* insert field */ case ETIR_S_C_OPR_INSV: - (void)_bfd_vms_pop (abfd, NULL); + (void) _bfd_vms_pop (abfd, NULL); (*_bfd_error_handler) (_("ETIR_S_C_OPR_INSV: Not supported")); break; - /* arithmetic shift */ + /* arithmetic shift */ case ETIR_S_C_OPR_ASH: - op1 = (long)_bfd_vms_pop (abfd, NULL); - op2 = (long)_bfd_vms_pop (abfd, NULL); + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); if (op2 < 0) /* shift right */ op1 >>= -op2; else /* shift left */ op1 <<= op2; - _bfd_vms_push (abfd, (uquad)op1, -1); + _bfd_vms_push (abfd, (uquad) op1, -1); break; /* unsigned shift */ @@ -676,13 +694,13 @@ etir_opr (abfd, cmd, ptr) /* select */ case ETIR_S_C_OPR_SEL: - if ((long)_bfd_vms_pop (abfd, NULL) & 0x01L) - (void)_bfd_vms_pop (abfd, NULL); + if ((long) _bfd_vms_pop (abfd, NULL) & 0x01L) + (void) _bfd_vms_pop (abfd, NULL); else { - op1 = (long)_bfd_vms_pop (abfd, NULL); - (void)_bfd_vms_pop (abfd, NULL); - _bfd_vms_push (abfd, (uquad)op1, -1); + op1 = (long) _bfd_vms_pop (abfd, NULL); + (void) _bfd_vms_pop (abfd, NULL); + _bfd_vms_push (abfd, (uquad) op1, -1); } break; @@ -721,7 +739,7 @@ etir_ctl (abfd, cmd, ptr) #if VMS_DEBUG _bfd_vms_debug (5, "etir_ctl %d/%x\n", cmd, cmd); - _bfd_hexdump (8, ptr, 16, (int)ptr); + _bfd_hexdump (8, ptr, 16, (int) ptr); #endif switch (cmd) @@ -786,7 +804,7 @@ etir_stc (abfd, cmd, ptr) #if VMS_DEBUG _bfd_vms_debug (5, "etir_stc %d/%x\n", cmd, cmd); - _bfd_hexdump (8, ptr, 16, (int)ptr); + _bfd_hexdump (8, ptr, 16, (int) ptr); #endif switch (cmd) @@ -805,7 +823,7 @@ etir_stc (abfd, cmd, ptr) da signature */ case ETIR_S_C_STC_LP_PSB: - image_inc_ptr (abfd, 16); /* skip entry,procval */ + image_inc_ptr (abfd, (uquad) 16); /* skip entry,procval */ break; /* 202 Store-conditional Address at global address @@ -882,7 +900,10 @@ etir_stc (abfd, cmd, ptr) arg: */ case ETIR_S_C_STC_NBH_PS: -/* FIXME (*_bfd_error_handler) ("ETIR_S_C_STC_xx: (%d) not supported", cmd); */ + /* FIXME */ +#if 0 + (*_bfd_error_handler) ("ETIR_S_C_STC_xx: (%d) not supported", cmd); +#endif break; default: @@ -908,12 +929,12 @@ new_section (abfd, idx) #endif sprintf (sname, SECTION_NAME_TEMPLATE, idx); - name = bfd_malloc (strlen (sname) + 1); + name = bfd_malloc ((bfd_size_type) strlen (sname) + 1); if (name == 0) return 0; strcpy (name, sname); - section = bfd_malloc (sizeof (asection)); + section = bfd_malloc ((bfd_size_type) sizeof (asection)); if (section == 0) { #if VMS_DEBUG @@ -937,21 +958,25 @@ alloc_section (abfd, idx) bfd *abfd; unsigned int idx; { + bfd_size_type amt; + #if VMS_DEBUG _bfd_vms_debug (4, "alloc_section %d\n", idx); #endif - PRIV(sections) = ((asection **) - bfd_realloc (PRIV(sections), (idx+1) * sizeof (asection *))); - if (PRIV(sections) == 0) + amt = idx + 1; + amt *= sizeof (asection *); + PRIV (sections) = (asection **) bfd_realloc (PRIV (sections), amt); + if (PRIV (sections) == 0) return -1; - while (PRIV(section_count) <= idx) + while (PRIV (section_count) <= idx) { - PRIV(sections)[PRIV(section_count)] = new_section (abfd, PRIV(section_count)); - if (PRIV(sections)[PRIV(section_count)] == 0) + PRIV (sections)[PRIV (section_count)] + = new_section (abfd, (int) PRIV (section_count)); + if (PRIV (sections)[PRIV (section_count)] == 0) return -1; - PRIV(section_count)++; + PRIV (section_count)++; } return 0; @@ -979,302 +1004,304 @@ tir_sta (bfd *abfd, unsigned char *ptr) switch (cmd) { - /* stack */ - case TIR_S_C_STA_GBL: - /* - * stack global - * arg: cs symbol name - * - * stack 32 bit value of symbol (high bits set to 0) - */ - { - char *name; - vms_symbol_entry *entry; + /* stack */ + case TIR_S_C_STA_GBL: + /* + * stack global + * arg: cs symbol name + * + * stack 32 bit value of symbol (high bits set to 0) + */ + { + char *name; + vms_symbol_entry *entry; - name = _bfd_vms_save_counted_string (ptr); + name = _bfd_vms_save_counted_string (ptr); - entry = _bfd_vms_enter_symbol (abfd, name); - if (entry == (vms_symbol_entry *)NULL) - return 0; + entry = _bfd_vms_enter_symbol (abfd, name); + if (entry == (vms_symbol_entry *) NULL) + return 0; - _bfd_vms_push (abfd, (unsigned long) (entry->symbol->value), -1); - ptr += *ptr + 1; - } + _bfd_vms_push (abfd, (uquad) (entry->symbol->value), -1); + ptr += *ptr + 1; + } break; - case TIR_S_C_STA_SB: - /* - * stack signed byte - * arg: by value - * - * stack byte value, sign extend to 32 bit - */ - _bfd_vms_push (abfd, (long)*ptr++, -1); - break; - - case TIR_S_C_STA_SW: - /* - * stack signed short word - * arg: sh value - * - * stack 16 bit value, sign extend to 32 bit - */ - _bfd_vms_push (abfd, (long)bfd_getl16(ptr), -1); - ptr += 2; - break; + case TIR_S_C_STA_SB: + /* + * stack signed byte + * arg: by value + * + * stack byte value, sign extend to 32 bit + */ + _bfd_vms_push (abfd, (uquad) *ptr++, -1); + break; + + case TIR_S_C_STA_SW: + /* + * stack signed short word + * arg: sh value + * + * stack 16 bit value, sign extend to 32 bit + */ + _bfd_vms_push (abfd, (uquad) bfd_getl16 (ptr), -1); + ptr += 2; + break; + + case TIR_S_C_STA_LW: + /* + * stack signed longword + * arg: lw value + * + * stack 32 bit value + */ + _bfd_vms_push (abfd, (uquad) bfd_getl32 (ptr), -1); + ptr += 4; + break; + + case TIR_S_C_STA_PB: + case TIR_S_C_STA_WPB: + /* + * stack psect base plus byte offset (word index) + * arg: by section index + * (sh section index) + * by signed byte offset + * + */ + { + unsigned long dummy; + unsigned int psect; - case TIR_S_C_STA_LW: - /* - * stack signed longword - * arg: lw value - * - * stack 32 bit value - */ - _bfd_vms_push (abfd, (long)bfd_getl32 (ptr), -1); - ptr += 4; - break; - - case TIR_S_C_STA_PB: - case TIR_S_C_STA_WPB: - /* - * stack psect base plus byte offset (word index) - * arg: by section index - * (sh section index) - * by signed byte offset - * - */ - { - unsigned long dummy; - unsigned int psect; + if (cmd == TIR_S_C_STA_PB) + psect = *ptr++; + else + { + psect = bfd_getl16 (ptr); + ptr += 2; + } - if (cmd == TIR_S_C_STA_PB) - psect = *ptr++; - else - { - psect = bfd_getl16(ptr); - ptr += 2; - } + if (psect >= PRIV (section_count)) + { + alloc_section (abfd, psect); + } - if (psect >= PRIV(section_count)) - { - alloc_section (abfd, psect); - } + dummy = (long) *ptr++; + dummy += (PRIV (sections)[psect])->vma; + _bfd_vms_push (abfd, (uquad) dummy, (int) psect); + } + break; - dummy = (long)*ptr++; - dummy += (PRIV(sections)[psect])->vma; - _bfd_vms_push (abfd, dummy, psect); - } - break; - - case TIR_S_C_STA_PW: - case TIR_S_C_STA_WPW: - /* - * stack psect base plus word offset (word index) - * arg: by section index - * (sh section index) - * sh signed short offset - * - */ - { - unsigned long dummy; - unsigned int psect; + case TIR_S_C_STA_PW: + case TIR_S_C_STA_WPW: + /* + * stack psect base plus word offset (word index) + * arg: by section index + * (sh section index) + * sh signed short offset + * + */ + { + unsigned long dummy; + unsigned int psect; - if (cmd == TIR_S_C_STA_PW) - psect = *ptr++; - else - { - psect = bfd_getl16(ptr); - ptr += 2; - } + if (cmd == TIR_S_C_STA_PW) + psect = *ptr++; + else + { + psect = bfd_getl16 (ptr); + ptr += 2; + } - if (psect >= PRIV(section_count)) - { - alloc_section (abfd, psect); - } + if (psect >= PRIV (section_count)) + { + alloc_section (abfd, psect); + } - dummy = bfd_getl16(ptr); ptr+=2; - dummy += (PRIV(sections)[psect])->vma; - _bfd_vms_push (abfd, dummy, psect); - } - break; - - case TIR_S_C_STA_PL: - case TIR_S_C_STA_WPL: - /* - * stack psect base plus long offset (word index) - * arg: by section index - * (sh section index) - * lw signed longword offset - * - */ - { - unsigned long dummy; - unsigned int psect; + dummy = bfd_getl16 (ptr); ptr+=2; + dummy += (PRIV (sections)[psect])->vma; + _bfd_vms_push (abfd, (uquad) dummy, (int) psect); + } + break; - if (cmd == TIR_S_C_STA_PL) - psect = *ptr++; - else - { - psect = bfd_getl16(ptr); - ptr += 2; - } + case TIR_S_C_STA_PL: + case TIR_S_C_STA_WPL: + /* + * stack psect base plus long offset (word index) + * arg: by section index + * (sh section index) + * lw signed longword offset + * + */ + { + unsigned long dummy; + unsigned int psect; - if (psect >= PRIV(section_count)) - { - alloc_section (abfd, psect); - } + if (cmd == TIR_S_C_STA_PL) + psect = *ptr++; + else + { + psect = bfd_getl16 (ptr); + ptr += 2; + } - dummy = bfd_getl32 (ptr); ptr += 4; - dummy += (PRIV(sections)[psect])->vma; - _bfd_vms_push (abfd, dummy, psect); - } - break; - - case TIR_S_C_STA_UB: - /* - * stack unsigned byte - * arg: by value - * - * stack byte value - */ - _bfd_vms_push (abfd, (unsigned long)*ptr++, -1); - break; - - case TIR_S_C_STA_UW: - /* - * stack unsigned short word - * arg: sh value - * - * stack 16 bit value - */ - _bfd_vms_push (abfd, (unsigned long)bfd_getl16(ptr), -1); - ptr += 2; + if (psect >= PRIV (section_count)) + { + alloc_section (abfd, psect); + } + + dummy = bfd_getl32 (ptr); ptr += 4; + dummy += (PRIV (sections)[psect])->vma; + _bfd_vms_push (abfd, (uquad) dummy, (int) psect); + } break; - case TIR_S_C_STA_BFI: - /* - * stack byte from image - * arg: - - * - */ - /*FALLTHRU*/ - case TIR_S_C_STA_WFI: - /* - * stack byte from image - * arg: - - * - */ - /*FALLTHRU*/ - case TIR_S_C_STA_LFI: - /* - * stack byte from image - * arg: - - * - */ - (*_bfd_error_handler) (_("Stack-from-image not implemented")); - return NULL; - - case TIR_S_C_STA_EPM: - /* - * stack entry point mask - * arg: cs symbol name - * - * stack (unsigned) entry point mask of symbol - * err if symbol is no entry point - */ - { - char *name; - vms_symbol_entry *entry; + case TIR_S_C_STA_UB: + /* + * stack unsigned byte + * arg: by value + * + * stack byte value + */ + _bfd_vms_push (abfd, (uquad) *ptr++, -1); + break; + + case TIR_S_C_STA_UW: + /* + * stack unsigned short word + * arg: sh value + * + * stack 16 bit value + */ + _bfd_vms_push (abfd, (uquad) bfd_getl16 (ptr), -1); + ptr += 2; + break; + + case TIR_S_C_STA_BFI: + /* + * stack byte from image + * arg: - + * + */ + /*FALLTHRU*/ + case TIR_S_C_STA_WFI: + /* + * stack byte from image + * arg: - + * + */ + /*FALLTHRU*/ + case TIR_S_C_STA_LFI: + /* + * stack byte from image + * arg: - + * + */ + (*_bfd_error_handler) (_("Stack-from-image not implemented")); + return NULL; + + case TIR_S_C_STA_EPM: + /* + * stack entry point mask + * arg: cs symbol name + * + * stack (unsigned) entry point mask of symbol + * err if symbol is no entry point + */ + { + char *name; + vms_symbol_entry *entry; - name = _bfd_vms_save_counted_string (ptr); - entry = _bfd_vms_enter_symbol (abfd, name); - if (entry == (vms_symbol_entry *)NULL) - return 0; - - (*_bfd_error_handler) (_("Stack-entry-mask not fully implemented")); - _bfd_vms_push (abfd, 0L, -1); - ptr += *ptr + 1; - } + name = _bfd_vms_save_counted_string (ptr); + entry = _bfd_vms_enter_symbol (abfd, name); + if (entry == (vms_symbol_entry *) NULL) + return 0; + + (*_bfd_error_handler) (_("Stack-entry-mask not fully implemented")); + _bfd_vms_push (abfd, (uquad) 0, -1); + ptr += *ptr + 1; + } break; - case TIR_S_C_STA_CKARG: - /* - * compare procedure argument - * arg: cs symbol name - * by argument index - * da argument descriptor - * - * compare argument descriptor with symbol argument (ARG$V_PASSMECH) - * and stack TRUE (args match) or FALSE (args dont match) value - */ - (*_bfd_error_handler) (_("PASSMECH not fully implemented")); - _bfd_vms_push (abfd, 1L, -1); - break; + case TIR_S_C_STA_CKARG: + /* + * compare procedure argument + * arg: cs symbol name + * by argument index + * da argument descriptor + * + * compare argument descriptor with symbol argument (ARG$V_PASSMECH) + * and stack TRUE (args match) or FALSE (args dont match) value + */ + (*_bfd_error_handler) (_("PASSMECH not fully implemented")); + _bfd_vms_push (abfd, (uquad) 1, -1); + break; + + case TIR_S_C_STA_LSY: + /* + * stack local symbol value + * arg: sh environment index + * cs symbol name + */ + { + int envidx; + char *name; + vms_symbol_entry *entry; - case TIR_S_C_STA_LSY: - /* - * stack local symbol value - * arg: sh environment index - * cs symbol name - */ - { - int envidx; - char *name; - vms_symbol_entry *entry; - - envidx = bfd_getl16(ptr); ptr += 2; - name = _bfd_vms_save_counted_string (ptr); - entry = _bfd_vms_enter_symbol (abfd, name); - if (entry == (vms_symbol_entry *)NULL) - return 0; - (*_bfd_error_handler) (_("Stack-local-symbol not fully implemented")); - _bfd_vms_push (abfd, 0L, -1); - ptr += *ptr + 1; - } + envidx = bfd_getl16 (ptr); + ptr += 2; + name = _bfd_vms_save_counted_string (ptr); + entry = _bfd_vms_enter_symbol (abfd, name); + if (entry == (vms_symbol_entry *) NULL) + return 0; + (*_bfd_error_handler) (_("Stack-local-symbol not fully implemented")); + _bfd_vms_push (abfd, (uquad) 0, -1); + ptr += *ptr + 1; + } break; - case TIR_S_C_STA_LIT: - /* - * stack literal - * arg: by literal index - * - * stack literal - */ - ptr++; - _bfd_vms_push (abfd, 0L, -1); - (*_bfd_error_handler) (_("Stack-literal not fully implemented")); - break; + case TIR_S_C_STA_LIT: + /* + * stack literal + * arg: by literal index + * + * stack literal + */ + ptr++; + _bfd_vms_push (abfd, (uquad) 0, -1); + (*_bfd_error_handler) (_("Stack-literal not fully implemented")); + break; + + case TIR_S_C_STA_LEPM: + /* + * stack local symbol entry point mask + * arg: sh environment index + * cs symbol name + * + * stack (unsigned) entry point mask of symbol + * err if symbol is no entry point + */ + { + int envidx; + char *name; + vms_symbol_entry *entry; - case TIR_S_C_STA_LEPM: - /* - * stack local symbol entry point mask - * arg: sh environment index - * cs symbol name - * - * stack (unsigned) entry point mask of symbol - * err if symbol is no entry point - */ - { - int envidx; - char *name; - vms_symbol_entry *entry; - - envidx = bfd_getl16(ptr); ptr += 2; - name = _bfd_vms_save_counted_string (ptr); - entry = _bfd_vms_enter_symbol (abfd, name); - if (entry == (vms_symbol_entry *)NULL) - return 0; - (*_bfd_error_handler) (_("Stack-local-symbol-entry-point-mask not fully implemented")); - _bfd_vms_push (abfd, 0L, -1); - ptr += *ptr + 1; - } + envidx = bfd_getl16 (ptr); + ptr += 2; + name = _bfd_vms_save_counted_string (ptr); + entry = _bfd_vms_enter_symbol (abfd, name); + if (entry == (vms_symbol_entry *) NULL) + return 0; + (*_bfd_error_handler) (_("Stack-local-symbol-entry-point-mask not fully implemented")); + _bfd_vms_push (abfd, (uquad) 0, -1); + ptr += *ptr + 1; + } break; - default: - (*_bfd_error_handler) (_("Reserved STA cmd %d"), ptr[-1]); - return NULL; + default: + (*_bfd_error_handler) (_("Reserved STA cmd %d"), ptr[-1]); + return NULL; break; - } + } return ptr; } @@ -1303,149 +1330,149 @@ tir_sto (bfd *abfd, unsigned char *ptr) switch (*ptr++) { - case TIR_S_C_STO_SB: - /* - * store signed byte: pop stack, write byte - * arg: - - */ - dummy = _bfd_vms_pop (abfd, &psect); - image_write_b (abfd, dummy & 0xff); /* FIXME: check top bits */ - break; - - case TIR_S_C_STO_SW: - /* - * store signed word: pop stack, write word - * arg: - - */ - dummy = _bfd_vms_pop (abfd, &psect); - image_write_w (abfd, dummy & 0xffff); /* FIXME: check top bits */ - break; - - case TIR_S_C_STO_LW: - /* - * store longword: pop stack, write longword - * arg: - - */ - dummy = _bfd_vms_pop (abfd, &psect); - image_write_l (abfd, dummy & 0xffffffff);/* FIXME: check top bits */ - break; - - case TIR_S_C_STO_BD: - /* - * store byte displaced: pop stack, sub lc+1, write byte - * arg: - - */ - dummy = _bfd_vms_pop (abfd, &psect); - dummy -= ((PRIV(sections)[psect])->vma + 1); - image_write_b (abfd, dummy & 0xff);/* FIXME: check top bits */ - break; - - case TIR_S_C_STO_WD: - /* - * store word displaced: pop stack, sub lc+2, write word - * arg: - - */ - dummy = _bfd_vms_pop (abfd, &psect); - dummy -= ((PRIV(sections)[psect])->vma + 2); - image_write_w (abfd, dummy & 0xffff);/* FIXME: check top bits */ - break; - case TIR_S_C_STO_LD: - /* - * store long displaced: pop stack, sub lc+4, write long - * arg: - - */ - dummy = _bfd_vms_pop (abfd, &psect); - dummy -= ((PRIV(sections)[psect])->vma + 4); - image_write_l (abfd, dummy & 0xffffffff);/* FIXME: check top bits */ - break; - case TIR_S_C_STO_LI: - /* - * store short literal: pop stack, write byte - * arg: - - */ - dummy = _bfd_vms_pop (abfd, &psect); - image_write_b (abfd, dummy & 0xff);/* FIXME: check top bits */ - break; - case TIR_S_C_STO_PIDR: - /* - * store position independent data reference: pop stack, write longword - * arg: - - * FIXME: incomplete ! - */ - dummy = _bfd_vms_pop (abfd, &psect); - image_write_l (abfd, dummy & 0xffffffff); - break; - case TIR_S_C_STO_PICR: - /* - * store position independent code reference: pop stack, write longword - * arg: - - * FIXME: incomplete ! - */ - dummy = _bfd_vms_pop (abfd, &psect); - image_write_b (abfd, 0x9f); - image_write_l (abfd, dummy & 0xffffffff); - break; - case TIR_S_C_STO_RIVB: - /* - * store repeated immediate variable bytes - * 1-byte count n field followed by n bytes of data - * pop stack, write n bytes times - */ - size = *ptr++; - dummy = (unsigned long)_bfd_vms_pop (abfd, NULL); - while (dummy-- > 0L) - image_dump (abfd, ptr, size, 0); - ptr += size; - break; - case TIR_S_C_STO_B: - /* - * store byte from top longword - */ - dummy = (unsigned long)_bfd_vms_pop (abfd, NULL); + case TIR_S_C_STO_SB: + /* + * store signed byte: pop stack, write byte + * arg: - + */ + dummy = _bfd_vms_pop (abfd, &psect); + image_write_b (abfd, dummy & 0xff); /* FIXME: check top bits */ + break; + + case TIR_S_C_STO_SW: + /* + * store signed word: pop stack, write word + * arg: - + */ + dummy = _bfd_vms_pop (abfd, &psect); + image_write_w (abfd, dummy & 0xffff); /* FIXME: check top bits */ + break; + + case TIR_S_C_STO_LW: + /* + * store longword: pop stack, write longword + * arg: - + */ + dummy = _bfd_vms_pop (abfd, &psect); + image_write_l (abfd, dummy & 0xffffffff); /* FIXME: check top bits */ + break; + + case TIR_S_C_STO_BD: + /* + * store byte displaced: pop stack, sub lc+1, write byte + * arg: - + */ + dummy = _bfd_vms_pop (abfd, &psect); + dummy -= ((PRIV (sections)[psect])->vma + 1); + image_write_b (abfd, dummy & 0xff);/* FIXME: check top bits */ + break; + + case TIR_S_C_STO_WD: + /* + * store word displaced: pop stack, sub lc+2, write word + * arg: - + */ + dummy = _bfd_vms_pop (abfd, &psect); + dummy -= ((PRIV (sections)[psect])->vma + 2); + image_write_w (abfd, dummy & 0xffff);/* FIXME: check top bits */ + break; + case TIR_S_C_STO_LD: + /* + * store long displaced: pop stack, sub lc+4, write long + * arg: - + */ + dummy = _bfd_vms_pop (abfd, &psect); + dummy -= ((PRIV (sections)[psect])->vma + 4); + image_write_l (abfd, dummy & 0xffffffff);/* FIXME: check top bits */ + break; + case TIR_S_C_STO_LI: + /* + * store short literal: pop stack, write byte + * arg: - + */ + dummy = _bfd_vms_pop (abfd, &psect); + image_write_b (abfd, dummy & 0xff);/* FIXME: check top bits */ + break; + case TIR_S_C_STO_PIDR: + /* + * store position independent data reference: pop stack, write longword + * arg: - + * FIXME: incomplete ! + */ + dummy = _bfd_vms_pop (abfd, &psect); + image_write_l (abfd, dummy & 0xffffffff); + break; + case TIR_S_C_STO_PICR: + /* + * store position independent code reference: pop stack, write longword + * arg: - + * FIXME: incomplete ! + */ + dummy = _bfd_vms_pop (abfd, &psect); + image_write_b (abfd, 0x9f); + image_write_l (abfd, dummy & 0xffffffff); + break; + case TIR_S_C_STO_RIVB: + /* + * store repeated immediate variable bytes + * 1-byte count n field followed by n bytes of data + * pop stack, write n bytes times + */ + size = *ptr++; + dummy = (unsigned long) _bfd_vms_pop (abfd, NULL); + while (dummy-- > 0L) + image_dump (abfd, ptr, size, 0); + ptr += size; + break; + case TIR_S_C_STO_B: + /* + * store byte from top longword + */ + dummy = (unsigned long) _bfd_vms_pop (abfd, NULL); + image_write_b (abfd, dummy & 0xff); + break; + case TIR_S_C_STO_W: + /* + * store word from top longword + */ + dummy = (unsigned long) _bfd_vms_pop (abfd, NULL); + image_write_w (abfd, dummy & 0xffff); + break; + case TIR_S_C_STO_RB: + /* + * store repeated byte from top longword + */ + size = (unsigned long) _bfd_vms_pop (abfd, NULL); + dummy = (unsigned long) _bfd_vms_pop (abfd, NULL); + while (size-- > 0) image_write_b (abfd, dummy & 0xff); - break; - case TIR_S_C_STO_W: - /* - * store word from top longword - */ - dummy = (unsigned long)_bfd_vms_pop (abfd, NULL); + break; + case TIR_S_C_STO_RW: + /* + * store repeated word from top longword + */ + size = (unsigned long) _bfd_vms_pop (abfd, NULL); + dummy = (unsigned long) _bfd_vms_pop (abfd, NULL); + while (size-- > 0) image_write_w (abfd, dummy & 0xffff); - break; - case TIR_S_C_STO_RB: - /* - * store repeated byte from top longword - */ - size = (unsigned long)_bfd_vms_pop (abfd, NULL); - dummy = (unsigned long)_bfd_vms_pop (abfd, NULL); - while (size-- > 0) - image_write_b (abfd, dummy & 0xff); - break; - case TIR_S_C_STO_RW: - /* - * store repeated word from top longword - */ - size = (unsigned long)_bfd_vms_pop (abfd, NULL); - dummy = (unsigned long)_bfd_vms_pop (abfd, NULL); - while (size-- > 0) - image_write_w (abfd, dummy & 0xffff); - break; + break; - case TIR_S_C_STO_RSB: - case TIR_S_C_STO_RSW: - case TIR_S_C_STO_RL: - case TIR_S_C_STO_VPS: - case TIR_S_C_STO_USB: - case TIR_S_C_STO_USW: - case TIR_S_C_STO_RUB: - case TIR_S_C_STO_RUW: - case TIR_S_C_STO_PIRR: - (*_bfd_error_handler) (_("Unimplemented STO cmd %d"), ptr[-1]); + case TIR_S_C_STO_RSB: + case TIR_S_C_STO_RSW: + case TIR_S_C_STO_RL: + case TIR_S_C_STO_VPS: + case TIR_S_C_STO_USB: + case TIR_S_C_STO_USW: + case TIR_S_C_STO_RUB: + case TIR_S_C_STO_RUW: + case TIR_S_C_STO_PIRR: + (*_bfd_error_handler) (_("Unimplemented STO cmd %d"), ptr[-1]); break; - default: - (*_bfd_error_handler) (_("Reserved STO cmd %d"), ptr[-1]); + default: + (*_bfd_error_handler) (_("Reserved STO cmd %d"), ptr[-1]); break; - } + } return ptr; } @@ -1470,175 +1497,175 @@ tir_opr (bfd *abfd, unsigned char *ptr) switch (*ptr++) { - /* operation */ - case TIR_S_C_OPR_NOP: - /* - * no-op - */ - break; - - case TIR_S_C_OPR_ADD: - /* - * add - */ - op1 = (long)_bfd_vms_pop (abfd, NULL); - op2 = (long)_bfd_vms_pop (abfd, NULL); - _bfd_vms_push (abfd, (unsigned long) (op1 + op2), -1); - break; - - case TIR_S_C_OPR_SUB: - /* - * subtract - */ - op1 = (long)_bfd_vms_pop (abfd, NULL); - op2 = (long)_bfd_vms_pop (abfd, NULL); - _bfd_vms_push (abfd, (unsigned long) (op2 - op1), -1); - break; - - case TIR_S_C_OPR_MUL: - /* - * multiply - */ - op1 = (long)_bfd_vms_pop (abfd, NULL); - op2 = (long)_bfd_vms_pop (abfd, NULL); - _bfd_vms_push (abfd, (unsigned long) (op1 * op2), -1); - break; - - case TIR_S_C_OPR_DIV: - /* - * divide - */ - op1 = (long)_bfd_vms_pop (abfd, NULL); - op2 = (long)_bfd_vms_pop (abfd, NULL); - if (op2 == 0) - _bfd_vms_push (abfd, (unsigned long)0L, -1); - else - _bfd_vms_push (abfd, (unsigned long) (op2 / op1), -1); + /* operation */ + case TIR_S_C_OPR_NOP: + /* + * no-op + */ break; - case TIR_S_C_OPR_AND: - /* - * logical and - */ - op1 = (long)_bfd_vms_pop (abfd, NULL); - op2 = (long)_bfd_vms_pop (abfd, NULL); - _bfd_vms_push (abfd, (unsigned long) (op1 & op2), -1); - break; - - case TIR_S_C_OPR_IOR: - op1 = (long)_bfd_vms_pop (abfd, NULL); - /* - * logical inclusive or - */ - op2 = (long)_bfd_vms_pop (abfd, NULL); - _bfd_vms_push (abfd, (unsigned long) (op1 | op2), -1); - break; - - case TIR_S_C_OPR_EOR: - /* - * logical exclusive or - */ - op1 = (long)_bfd_vms_pop (abfd, NULL); - op2 = (long)_bfd_vms_pop (abfd, NULL); - _bfd_vms_push (abfd, (unsigned long) (op1 ^ op2), -1); - break; - - case TIR_S_C_OPR_NEG: - /* - * negate - */ - op1 = (long)_bfd_vms_pop (abfd, NULL); - _bfd_vms_push (abfd, (unsigned long) (-op1), -1); - break; - - case TIR_S_C_OPR_COM: - /* - * complement - */ - op1 = (long)_bfd_vms_pop (abfd, NULL); - _bfd_vms_push (abfd, (unsigned long) (op1 ^ -1L), -1); - break; - - case TIR_S_C_OPR_INSV: - /* - * insert field - */ - (void)_bfd_vms_pop (abfd, NULL); - (*_bfd_error_handler) ("TIR_S_C_OPR_INSV incomplete"); - break; - - case TIR_S_C_OPR_ASH: - /* - * arithmetic shift - */ - op1 = (long)_bfd_vms_pop (abfd, NULL); - op2 = (long)_bfd_vms_pop (abfd, NULL); - if (HIGHBIT(op1)) /* shift right */ - op2 >>= op1; - else /* shift left */ - op2 <<= op1; - _bfd_vms_push (abfd, (unsigned long)op2, -1); - (*_bfd_error_handler) (_("TIR_S_C_OPR_ASH incomplete")); - break; - - case TIR_S_C_OPR_USH: - /* - * unsigned shift - */ - op1 = (long)_bfd_vms_pop (abfd, NULL); - op2 = (long)_bfd_vms_pop (abfd, NULL); - if (HIGHBIT(op1)) /* shift right */ - op2 >>= op1; - else /* shift left */ - op2 <<= op1; - _bfd_vms_push (abfd, (unsigned long)op2, -1); - (*_bfd_error_handler) (_("TIR_S_C_OPR_USH incomplete")); - break; - - case TIR_S_C_OPR_ROT: - /* - * rotate - */ - op1 = (long)_bfd_vms_pop (abfd, NULL); - op2 = (long)_bfd_vms_pop (abfd, NULL); - if (HIGHBIT(0)) /* shift right */ - op2 >>= op1; - else /* shift left */ - op2 <<= op1; - _bfd_vms_push (abfd, (unsigned long)op2, -1); - (*_bfd_error_handler) (_("TIR_S_C_OPR_ROT incomplete")); - break; - - case TIR_S_C_OPR_SEL: - /* - * select - */ - if ((long)_bfd_vms_pop (abfd, NULL) & 0x01L) - (void)_bfd_vms_pop (abfd, NULL); - else - { - op1 = (long)_bfd_vms_pop (abfd, NULL); - (void)_bfd_vms_pop (abfd, NULL); - _bfd_vms_push (abfd, (unsigned long)op1, -1); - } + case TIR_S_C_OPR_ADD: + /* + * add + */ + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); + _bfd_vms_push (abfd, (uquad) (op1 + op2), -1); + break; + + case TIR_S_C_OPR_SUB: + /* + * subtract + */ + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); + _bfd_vms_push (abfd, (uquad) (op2 - op1), -1); + break; + + case TIR_S_C_OPR_MUL: + /* + * multiply + */ + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); + _bfd_vms_push (abfd, (uquad) (op1 * op2), -1); + break; + + case TIR_S_C_OPR_DIV: + /* + * divide + */ + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); + if (op2 == 0) + _bfd_vms_push (abfd, (uquad) 0, -1); + else + _bfd_vms_push (abfd, (uquad) (op2 / op1), -1); + break; + + case TIR_S_C_OPR_AND: + /* + * logical and + */ + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); + _bfd_vms_push (abfd, (uquad) (op1 & op2), -1); + break; + + case TIR_S_C_OPR_IOR: + op1 = (long) _bfd_vms_pop (abfd, NULL); + /* + * logical inclusive or + */ + op2 = (long) _bfd_vms_pop (abfd, NULL); + _bfd_vms_push (abfd, (uquad) (op1 | op2), -1); + break; + + case TIR_S_C_OPR_EOR: + /* + * logical exclusive or + */ + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); + _bfd_vms_push (abfd, (uquad) (op1 ^ op2), -1); + break; + + case TIR_S_C_OPR_NEG: + /* + * negate + */ + op1 = (long) _bfd_vms_pop (abfd, NULL); + _bfd_vms_push (abfd, (uquad) (-op1), -1); + break; + + case TIR_S_C_OPR_COM: + /* + * complement + */ + op1 = (long) _bfd_vms_pop (abfd, NULL); + _bfd_vms_push (abfd, (uquad) (op1 ^ -1L), -1); + break; + + case TIR_S_C_OPR_INSV: + /* + * insert field + */ + (void) _bfd_vms_pop (abfd, NULL); + (*_bfd_error_handler) ("TIR_S_C_OPR_INSV incomplete"); + break; + + case TIR_S_C_OPR_ASH: + /* + * arithmetic shift + */ + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); + if (HIGHBIT (op1)) /* shift right */ + op2 >>= op1; + else /* shift left */ + op2 <<= op1; + _bfd_vms_push (abfd, (uquad) op2, -1); + (*_bfd_error_handler) (_("TIR_S_C_OPR_ASH incomplete")); + break; + + case TIR_S_C_OPR_USH: + /* + * unsigned shift + */ + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); + if (HIGHBIT (op1)) /* shift right */ + op2 >>= op1; + else /* shift left */ + op2 <<= op1; + _bfd_vms_push (abfd, (uquad) op2, -1); + (*_bfd_error_handler) (_("TIR_S_C_OPR_USH incomplete")); + break; + + case TIR_S_C_OPR_ROT: + /* + * rotate + */ + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); + if (HIGHBIT (0)) /* shift right */ + op2 >>= op1; + else /* shift left */ + op2 <<= op1; + _bfd_vms_push (abfd, (uquad) op2, -1); + (*_bfd_error_handler) (_("TIR_S_C_OPR_ROT incomplete")); + break; + + case TIR_S_C_OPR_SEL: + /* + * select + */ + if ((long) _bfd_vms_pop (abfd, NULL) & 0x01L) + (void) _bfd_vms_pop (abfd, NULL); + else + { + op1 = (long) _bfd_vms_pop (abfd, NULL); + (void) _bfd_vms_pop (abfd, NULL); + _bfd_vms_push (abfd, (uquad) op1, -1); + } break; - case TIR_S_C_OPR_REDEF: - /* - * redefine symbol to current location - */ - (*_bfd_error_handler) (_("TIR_S_C_OPR_REDEF not supported")); - break; - - case TIR_S_C_OPR_DFLIT: - /* - * define a literal - */ - (*_bfd_error_handler) (_("TIR_S_C_OPR_DFLIT not supported")); + case TIR_S_C_OPR_REDEF: + /* + * redefine symbol to current location + */ + (*_bfd_error_handler) (_("TIR_S_C_OPR_REDEF not supported")); break; - default: - (*_bfd_error_handler) (_("Reserved OPR cmd %d"), ptr[-1]); + case TIR_S_C_OPR_DFLIT: + /* + * define a literal + */ + (*_bfd_error_handler) (_("TIR_S_C_OPR_DFLIT not supported")); + break; + + default: + (*_bfd_error_handler) (_("Reserved OPR cmd %d"), ptr[-1]); break; } @@ -1662,54 +1689,54 @@ tir_ctl (bfd *abfd, unsigned char *ptr) switch (*ptr++) { - case TIR_S_C_CTL_SETRB: - /* - * set relocation base: pop stack, set image location counter - * arg: - - */ - dummy = _bfd_vms_pop (abfd, &psect); - if (psect >= PRIV(section_count)) - { - alloc_section (abfd, psect); - } - image_set_ptr (abfd, psect, dummy); + case TIR_S_C_CTL_SETRB: + /* + * set relocation base: pop stack, set image location counter + * arg: - + */ + dummy = _bfd_vms_pop (abfd, &psect); + if (psect >= PRIV (section_count)) + { + alloc_section (abfd, psect); + } + image_set_ptr (abfd, (int) psect, (uquad) dummy); + break; + case TIR_S_C_CTL_AUGRB: + /* + * augment relocation base: increment image location counter by offset + * arg: lw offset value + */ + dummy = bfd_getl32 (ptr); + image_inc_ptr (abfd, (uquad) dummy); + break; + case TIR_S_C_CTL_DFLOC: + /* + * define location: pop index, save location counter under index + * arg: - + */ + dummy = _bfd_vms_pop (abfd, NULL); + (*_bfd_error_handler) (_("TIR_S_C_CTL_DFLOC not fully implemented")); break; - case TIR_S_C_CTL_AUGRB: - /* - * augment relocation base: increment image location counter by offset - * arg: lw offset value - */ - dummy = bfd_getl32 (ptr); - image_inc_ptr (abfd, dummy); - break; - case TIR_S_C_CTL_DFLOC: - /* - * define location: pop index, save location counter under index - * arg: - - */ - dummy = _bfd_vms_pop (abfd, NULL); - (*_bfd_error_handler) (_("TIR_S_C_CTL_DFLOC not fully implemented")); - break; - case TIR_S_C_CTL_STLOC: - /* - * set location: pop index, restore location counter from index - * arg: - - */ - dummy = _bfd_vms_pop (abfd, &psect); - (*_bfd_error_handler) (_("TIR_S_C_CTL_STLOC not fully implemented")); + case TIR_S_C_CTL_STLOC: + /* + * set location: pop index, restore location counter from index + * arg: - + */ + dummy = _bfd_vms_pop (abfd, &psect); + (*_bfd_error_handler) (_("TIR_S_C_CTL_STLOC not fully implemented")); break; case TIR_S_C_CTL_STKDL: - /* - * stack defined location: pop index, push location counter from index - * arg: - - */ - dummy = _bfd_vms_pop (abfd, &psect); - (*_bfd_error_handler) (_("TIR_S_C_CTL_STKDL not fully implemented")); + /* + * stack defined location: pop index, push location counter from index + * arg: - + */ + dummy = _bfd_vms_pop (abfd, &psect); + (*_bfd_error_handler) (_("TIR_S_C_CTL_STKDL not fully implemented")); break; default: - (*_bfd_error_handler) (_("Reserved CTL cmd %d"), ptr[-1]); - break; - } + (*_bfd_error_handler) (_("Reserved CTL cmd %d"), ptr[-1]); + break; + } return ptr; } @@ -1720,22 +1747,25 @@ tir_ctl (bfd *abfd, unsigned char *ptr) static unsigned char * tir_cmd (bfd *abfd, unsigned char *ptr) { - struct { + struct + { int mincod; int maxcod; unsigned char * (*explain) (bfd *, unsigned char *); - } tir_table[] = { - { 0, TIR_S_C_MAXSTACOD, tir_sta } - ,{ TIR_S_C_MINSTOCOD, TIR_S_C_MAXSTOCOD, tir_sto } - ,{ TIR_S_C_MINOPRCOD, TIR_S_C_MAXOPRCOD, tir_opr } - ,{ TIR_S_C_MINCTLCOD, TIR_S_C_MAXCTLCOD, tir_ctl } - ,{ -1, -1, NULL } + } + tir_table[] = + { + { 0, TIR_S_C_MAXSTACOD, tir_sta }, + { TIR_S_C_MINSTOCOD, TIR_S_C_MAXSTOCOD, tir_sto }, + { TIR_S_C_MINOPRCOD, TIR_S_C_MAXOPRCOD, tir_opr }, + { TIR_S_C_MINCTLCOD, TIR_S_C_MAXCTLCOD, tir_ctl }, + { -1, -1, NULL } }; int i = 0; #if VMS_DEBUG _bfd_vms_debug (4, "tir_cmd %d/%x\n", *ptr, *ptr); - _bfd_hexdump (8, ptr, 16, (int)ptr); + _bfd_hexdump (8, ptr, 16, (int) ptr); #endif if (*ptr & 0x80) /* store immediate */ @@ -1749,7 +1779,7 @@ tir_cmd (bfd *abfd, unsigned char *ptr) while (tir_table[i].mincod >= 0) { if ( (tir_table[i].mincod <= *ptr) - && (*ptr <= tir_table[i].maxcod)) + && (*ptr <= tir_table[i].maxcod)) { ptr = tir_table[i].explain (abfd, ptr); break; @@ -1774,11 +1804,14 @@ etir_cmd (abfd, cmd, ptr) int cmd; unsigned char *ptr; { - static struct { + static struct + { int mincod; int maxcod; - boolean (*explain) PARAMS((bfd *, int, unsigned char *)); - } etir_table[] = { + boolean (*explain) PARAMS ((bfd *, int, unsigned char *)); + } + etir_table[] = + { { ETIR_S_C_MINSTACOD, ETIR_S_C_MAXSTACOD, etir_sta }, { ETIR_S_C_MINSTOCOD, ETIR_S_C_MAXSTOCOD, etir_sto }, { ETIR_S_C_MINOPRCOD, ETIR_S_C_MAXOPRCOD, etir_opr }, @@ -1791,13 +1824,13 @@ etir_cmd (abfd, cmd, ptr) #if VMS_DEBUG _bfd_vms_debug (4, "etir_cmd %d/%x\n", cmd, cmd); - _bfd_hexdump (8, ptr, 16, (int)ptr); + _bfd_hexdump (8, ptr, 16, (int) ptr); #endif while (etir_table[i].mincod >= 0) { if ( (etir_table[i].mincod <= cmd) - && (cmd <= etir_table[i].maxcod)) + && (cmd <= etir_table[i].maxcod)) { if (!etir_table[i].explain (abfd, cmd, ptr)) return -1; @@ -1892,19 +1925,19 @@ _bfd_vms_slurp_tir (abfd, objtype) switch (objtype) { - case EOBJ_S_C_ETIR: - PRIV(vms_rec) += 4; /* skip type, size */ - PRIV(rec_size) -= 4; - result = analyze_etir (abfd, PRIV(vms_rec), PRIV(rec_size)); - break; - case OBJ_S_C_TIR: - PRIV(vms_rec) += 1; /* skip type */ - PRIV(rec_size) -= 1; - result = analyze_tir (abfd, PRIV(vms_rec), PRIV(rec_size)); - break; - default: - result = -1; - break; + case EOBJ_S_C_ETIR: + PRIV (vms_rec) += 4; /* skip type, size */ + PRIV (rec_size) -= 4; + result = analyze_etir (abfd, PRIV (vms_rec), (unsigned) PRIV (rec_size)); + break; + case OBJ_S_C_TIR: + PRIV (vms_rec) += 1; /* skip type */ + PRIV (rec_size) -= 1; + result = analyze_tir (abfd, PRIV (vms_rec), (unsigned) PRIV (rec_size)); + break; + default: + result = -1; + break; } return result; @@ -1987,7 +2020,7 @@ sto_imm (abfd, sptr, vaddr, index) #if VMS_DEBUG _bfd_vms_debug (8, "sto_imm %d bytes\n", sptr->size); - _bfd_hexdump (9, sptr->contents, (int)sptr->size, (int)vaddr); + _bfd_hexdump (9, sptr->contents, (int) sptr->size, (int) vaddr); #endif ssize = sptr->size; @@ -2014,7 +2047,7 @@ sto_imm (abfd, sptr, vaddr, index) #if VMS_DEBUG _bfd_vms_debug (10, "dumped %d bytes\n", size); - _bfd_hexdump (10, cptr, (int)size, (int)vaddr); + _bfd_hexdump (10, cptr, (int) size, (int) vaddr); #endif vaddr += size; @@ -2043,8 +2076,8 @@ start_etir_record (abfd, index, offset, } _bfd_vms_output_begin (abfd, ETIR_S_C_STA_PQ, -1); /* push start offset */ - _bfd_vms_output_long (abfd, (unsigned long)index); - _bfd_vms_output_quad (abfd, (uquad)offset); + _bfd_vms_output_long (abfd, (unsigned long) index); + _bfd_vms_output_quad (abfd, (uquad) offset); _bfd_vms_output_flush (abfd); _bfd_vms_output_begin (abfd, ETIR_S_C_CTL_SETRB, -1); /* start = pop () */ @@ -2080,7 +2113,7 @@ _bfd_vms_write_tir (abfd, objtype) _bfd_vms_output_alignment (abfd, 4); nextoffset = 0; - PRIV(vms_linkage_index) = 1; + PRIV (vms_linkage_index) = 1; /* dump all other sections */ @@ -2090,7 +2123,9 @@ _bfd_vms_write_tir (abfd, objtype) { #if VMS_DEBUG - _bfd_vms_debug (4, "writing %d. section '%s' (%d bytes)\n", section->index, section->name, (int) (section->_raw_size)); + _bfd_vms_debug (4, "writing %d. section '%s' (%d bytes)\n", + section->index, section->name, + (int) (section->_raw_size)); #endif if (section->flags & SEC_RELOC) @@ -2111,12 +2146,12 @@ _bfd_vms_write_tir (abfd, objtype) while (i-- > 0) { _bfd_vms_debug (4, "sym %s in sec %s, value %08lx, addr %08lx, off %08lx, len %d: %s\n", - (*(*rptr)->sym_ptr_ptr)->name, - (*(*rptr)->sym_ptr_ptr)->section->name, - (long) (*(*rptr)->sym_ptr_ptr)->value, - (*rptr)->address, (*rptr)->addend, - bfd_get_reloc_size((*rptr)->howto), - (*rptr)->howto->name); + (*(*rptr)->sym_ptr_ptr)->name, + (*(*rptr)->sym_ptr_ptr)->section->name, + (long) (*(*rptr)->sym_ptr_ptr)->value, + (*rptr)->address, (*rptr)->addend, + bfd_get_reloc_size ((*rptr)->howto), + (*rptr)->howto->name); rptr++; } } @@ -2124,7 +2159,7 @@ _bfd_vms_write_tir (abfd, objtype) } if ((section->flags & SEC_HAS_CONTENTS) - && (! bfd_is_com_section (section))) + && (! bfd_is_com_section (section))) { bfd_vma vaddr; /* virtual addr in section */ @@ -2140,10 +2175,10 @@ _bfd_vms_write_tir (abfd, objtype) start_etir_record (abfd, section->index, (uquad) sptr->offset, false); - while (sptr != NULL) /* one STA_PQ, CTL_SETRB per vms_section */ + while (sptr != NULL) /* one STA_PQ, CTL_SETRB per vms_section */ { - if (section->flags & SEC_RELOC) /* check for relocs */ + if (section->flags & SEC_RELOC) /* check for relocs */ { arelent **rptr = section->orelocation; int i = section->reloc_count; @@ -2151,10 +2186,10 @@ _bfd_vms_write_tir (abfd, objtype) { bfd_size_type addr = (*rptr)->address; bfd_size_type len = bfd_get_reloc_size ((*rptr)->howto); - if (sptr->offset < addr) /* sptr starts before reloc */ + if (sptr->offset < addr) /* sptr starts before reloc */ { bfd_size_type before = addr - sptr->offset; - if (sptr->size <= before) /* complete before */ + if (sptr->size <= before) /* complete before */ { sto_imm (abfd, sptr, vaddr, section->index); vaddr += sptr->size; @@ -2171,7 +2206,7 @@ _bfd_vms_write_tir (abfd, objtype) sptr->size = after; } } - else if (sptr->offset == addr) /* sptr starts at reloc */ + else if (sptr->offset == addr) /* sptr starts at reloc */ { asymbol *sym = *(*rptr)->sym_ptr_ptr; asection *sec = sym->section; @@ -2185,9 +2220,10 @@ _bfd_vms_write_tir (abfd, objtype) { if (bfd_is_und_section (sym->section)) { - if (_bfd_vms_output_check (abfd, - strlen((char *)sym->name)) - < 0) + int slen = strlen ((char *) sym->name); + char *hash; + + if (_bfd_vms_output_check (abfd, slen) < 0) { end_etir_record (abfd); start_etir_record (abfd, @@ -2195,10 +2231,11 @@ _bfd_vms_write_tir (abfd, objtype) vaddr, false); } _bfd_vms_output_begin (abfd, - ETIR_S_C_STO_GBL_LW, - -1); - _bfd_vms_output_counted (abfd, - _bfd_vms_length_hash_symbol (abfd, sym->name, EOBJ_S_C_SYMSIZ)); + ETIR_S_C_STO_GBL_LW, + -1); + hash = (_bfd_vms_length_hash_symbol + (abfd, sym->name, EOBJ_S_C_SYMSIZ)); + _bfd_vms_output_counted (abfd, hash); _bfd_vms_output_flush (abfd); } else if (bfd_is_abs_section (sym->section)) @@ -2211,14 +2248,14 @@ _bfd_vms_write_tir (abfd, objtype) vaddr, false); } _bfd_vms_output_begin (abfd, - ETIR_S_C_STA_LW, - -1); + ETIR_S_C_STA_LW, + -1); _bfd_vms_output_quad (abfd, - (uquad)sym->value); + (uquad) sym->value); _bfd_vms_output_flush (abfd); _bfd_vms_output_begin (abfd, - ETIR_S_C_STO_LW, - -1); + ETIR_S_C_STO_LW, + -1); _bfd_vms_output_flush (abfd); } else @@ -2231,17 +2268,17 @@ _bfd_vms_write_tir (abfd, objtype) vaddr, false); } _bfd_vms_output_begin (abfd, - ETIR_S_C_STA_PQ, - -1); + ETIR_S_C_STA_PQ, + -1); _bfd_vms_output_long (abfd, - (unsigned long) (sec->index)); + (unsigned long) (sec->index)); _bfd_vms_output_quad (abfd, - ((uquad) (*rptr)->addend - + (uquad)sym->value)); + ((uquad) (*rptr)->addend + + (uquad) sym->value)); _bfd_vms_output_flush (abfd); _bfd_vms_output_begin (abfd, - ETIR_S_C_STO_LW, - -1); + ETIR_S_C_STO_LW, + -1); _bfd_vms_output_flush (abfd); } } @@ -2251,9 +2288,9 @@ _bfd_vms_write_tir (abfd, objtype) { if (bfd_is_und_section (sym->section)) { - if (_bfd_vms_output_check (abfd, - strlen((char *)sym->name)) - < 0) + int slen = strlen ((char *) sym->name); + char *hash; + if (_bfd_vms_output_check (abfd, slen) < 0) { end_etir_record (abfd); start_etir_record (abfd, @@ -2261,10 +2298,11 @@ _bfd_vms_write_tir (abfd, objtype) vaddr, false); } _bfd_vms_output_begin (abfd, - ETIR_S_C_STO_GBL, - -1); - _bfd_vms_output_counted (abfd, - _bfd_vms_length_hash_symbol (abfd, sym->name, EOBJ_S_C_SYMSIZ)); + ETIR_S_C_STO_GBL, + -1); + hash = (_bfd_vms_length_hash_symbol + (abfd, sym->name, EOBJ_S_C_SYMSIZ)); + _bfd_vms_output_counted (abfd, hash); _bfd_vms_output_flush (abfd); } else if (bfd_is_abs_section (sym->section)) @@ -2277,14 +2315,14 @@ _bfd_vms_write_tir (abfd, objtype) vaddr, false); } _bfd_vms_output_begin (abfd, - ETIR_S_C_STA_QW, - -1); + ETIR_S_C_STA_QW, + -1); _bfd_vms_output_quad (abfd, - (uquad)sym->value); + (uquad) sym->value); _bfd_vms_output_flush (abfd); _bfd_vms_output_begin (abfd, - ETIR_S_C_STO_QW, - -1); + ETIR_S_C_STO_QW, + -1); _bfd_vms_output_flush (abfd); } else @@ -2297,17 +2335,17 @@ _bfd_vms_write_tir (abfd, objtype) vaddr, false); } _bfd_vms_output_begin (abfd, - ETIR_S_C_STA_PQ, - -1); + ETIR_S_C_STA_PQ, + -1); _bfd_vms_output_long (abfd, - (unsigned long) (sec->index)); + (unsigned long) (sec->index)); _bfd_vms_output_quad (abfd, - ((uquad) (*rptr)->addend - + (uquad)sym->value)); + ((uquad) (*rptr)->addend + + (uquad) sym->value)); _bfd_vms_output_flush (abfd); _bfd_vms_output_begin (abfd, - ETIR_S_C_STO_OFF, - -1); + ETIR_S_C_STO_OFF, + -1); _bfd_vms_output_flush (abfd); } } @@ -2316,23 +2354,31 @@ _bfd_vms_write_tir (abfd, objtype) case ALPHA_R_HINT: { int hint_size; + char *hash ATTRIBUTE_UNUSED; hint_size = sptr->size; 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); + 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_counted(abfd, _bfd_vms_length_hash_symbol (abfd, sym->name, EOBJ_S_C_SYMSIZ)); - vms_output_flush(abfd); + vms_output_flush (abfd); #endif } break; case ALPHA_R_LINKAGE: { + char *hash; + if (_bfd_vms_output_check (abfd, 64) < 0) { end_etir_record (abfd); @@ -2340,13 +2386,14 @@ _bfd_vms_write_tir (abfd, objtype) vaddr, false); } _bfd_vms_output_begin (abfd, - ETIR_S_C_STC_LP_PSB, - -1); + ETIR_S_C_STC_LP_PSB, + -1); _bfd_vms_output_long (abfd, - (unsigned long)PRIV(vms_linkage_index)); - PRIV(vms_linkage_index) += 2; - _bfd_vms_output_counted (abfd, - _bfd_vms_length_hash_symbol (abfd, sym->name, EOBJ_S_C_SYMSIZ)); + (unsigned long) PRIV (vms_linkage_index)); + PRIV (vms_linkage_index) += 2; + hash = (_bfd_vms_length_hash_symbol + (abfd, sym->name, EOBJ_S_C_SYMSIZ)); + _bfd_vms_output_counted (abfd, hash); _bfd_vms_output_byte (abfd, 0); _bfd_vms_output_flush (abfd); } @@ -2354,9 +2401,9 @@ _bfd_vms_write_tir (abfd, objtype) case ALPHA_R_CODEADDR: { - if (_bfd_vms_output_check (abfd, - strlen((char *)sym->name)) - < 0) + int slen = strlen ((char *) sym->name); + char *hash; + if (_bfd_vms_output_check (abfd, slen) < 0) { end_etir_record (abfd); start_etir_record (abfd, @@ -2364,10 +2411,11 @@ _bfd_vms_write_tir (abfd, objtype) vaddr, false); } _bfd_vms_output_begin (abfd, - ETIR_S_C_STO_CA, - -1); - _bfd_vms_output_counted (abfd, - _bfd_vms_length_hash_symbol (abfd, sym->name, EOBJ_S_C_SYMSIZ)); + ETIR_S_C_STO_CA, + -1); + hash = (_bfd_vms_length_hash_symbol + (abfd, sym->name, EOBJ_S_C_SYMSIZ)); + _bfd_vms_output_counted (abfd, hash); _bfd_vms_output_flush (abfd); } break; @@ -2393,24 +2441,25 @@ _bfd_vms_write_tir (abfd, objtype) rptr++; } } - else /* sptr starts after reloc */ + else /* sptr starts after reloc */ { - i--; /* check next reloc */ + i--; /* check next reloc */ rptr++; } - if (i==0) /* all reloc checked */ + if (i==0) /* all reloc checked */ { if (sptr->size > 0) { - sto_imm (abfd, sptr, vaddr, section->index); /* dump rest */ + /* dump rest */ + sto_imm (abfd, sptr, vaddr, section->index); vaddr += sptr->size; } break; } } /* for (;;) */ } /* if SEC_RELOC */ - else /* no relocs, just dump */ + else /* no relocs, just dump */ { sto_imm (abfd, sptr, vaddr, section->index); vaddr += sptr->size; @@ -2427,7 +2476,7 @@ _bfd_vms_write_tir (abfd, objtype) section = section->next; } - _bfd_vms_output_alignment(abfd, 2); + _bfd_vms_output_alignment (abfd, 2); return 0; } diff -uprN binutils-2.11.90.0.31/bfd/vms.c binutils-2.11.92.0.5/bfd/vms.c --- binutils-2.11.90.0.31/bfd/vms.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/bfd/vms.c Mon Oct 1 15:25:21 2001 @@ -63,7 +63,7 @@ static boolean vms_construct_extended_na PARAMS ((bfd *abfd, char **tabloc, bfd_size_type *tablen, const char **name)); static void vms_truncate_arname - PARAMS ((bfd *abfd, CONST char *pathname, char *arhdr)); + PARAMS ((bfd *abfd, const char *pathname, char *arhdr)); static boolean vms_write_armap PARAMS ((bfd *arch, unsigned int elength, struct orl *map, unsigned int orl_count, int stridx)); @@ -71,7 +71,7 @@ static PTR vms_read_ar_hdr PARAMS ((bfd static bfd *vms_get_elt_at_index PARAMS ((bfd *abfd, symindex index)); static bfd *vms_openr_next_archived_file PARAMS ((bfd *arch, bfd *prev)); static boolean vms_update_armap_timestamp PARAMS ((bfd *abfd)); -static int vms_generic_stat_arch_elt PARAMS ((bfd *abfd, struct stat *stat)); +static int vms_generic_stat_arch_elt PARAMS ((bfd *, struct stat *)); static long vms_get_symtab_upper_bound PARAMS ((bfd *abfd)); static long vms_get_symtab PARAMS ((bfd *abfd, asymbol **symbols)); static void vms_print_symbol @@ -232,14 +232,15 @@ vms_initialize (abfd) bfd *abfd; { int i; + bfd_size_type amt; if (abfd->tdata.any != 0) return true; - bfd_set_start_address (abfd, (bfd_vma)-1); + bfd_set_start_address (abfd, (bfd_vma) -1); - abfd->tdata.any = ((struct vms_private_data_struct*) - bfd_malloc (sizeof (struct vms_private_data_struct))); + amt = sizeof (struct vms_private_data_struct); + abfd->tdata.any = (struct vms_private_data_struct*) bfd_malloc (amt); if (abfd->tdata.any == 0) return false; @@ -255,8 +256,8 @@ vms_initialize (abfd) PRIV (fixup_done) = false; PRIV (sections) = NULL; - PRIV (stack) = ((struct stack_struct *) - bfd_malloc (sizeof (struct stack_struct) * STACKSIZE)); + amt = sizeof (struct stack_struct) * STACKSIZE; + PRIV (stack) = (struct stack_struct *) bfd_malloc (amt); if (PRIV (stack) == 0) { vms_init_no_mem1: @@ -266,8 +267,8 @@ vms_initialize (abfd) } PRIV (stackptr) = 0; - PRIV (vms_symbol_table) = ((struct bfd_hash_table *) - bfd_malloc (sizeof (struct bfd_hash_table))); + amt = sizeof (struct bfd_hash_table); + PRIV (vms_symbol_table) = (struct bfd_hash_table *) bfd_malloc (amt); if (PRIV (vms_symbol_table) == 0) { vms_init_no_mem2: @@ -279,9 +280,8 @@ vms_initialize (abfd) if (!bfd_hash_table_init (PRIV (vms_symbol_table), _bfd_vms_hash_newfunc)) return false; - PRIV (location_stack) = ((struct location_struct *) - bfd_malloc (sizeof (struct location_struct) - * LOCATION_SAVE_SIZE)); + amt = sizeof (struct location_struct) * LOCATION_SAVE_SIZE; + PRIV (location_stack) = (struct location_struct *) bfd_malloc (amt); if (PRIV (location_stack) == 0) { vms_init_no_mem3: @@ -401,7 +401,7 @@ vms_object_p (abfd) return 0; } - if (bfd_seek (abfd, 0L, SEEK_SET)) + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET)) { bfd_set_error (bfd_error_file_truncated); return 0; @@ -740,8 +740,9 @@ vms_new_section_hook (abfd, section) if (abfd->section_count > PRIV (section_count)) { - PRIV (sections) = ((asection **) - bfd_realloc (PRIV (sections), abfd->section_count * sizeof (asection *))); + bfd_size_type amt = abfd->section_count; + amt *= sizeof (asection *); + PRIV (sections) = (asection **) bfd_realloc (PRIV (sections), amt); if (PRIV (sections) == 0) return false; PRIV (section_count) = abfd->section_count; @@ -978,7 +979,7 @@ vms_construct_extended_name_table (abfd, static void vms_truncate_arname (abfd, pathname, arhdr) bfd *abfd ATTRIBUTE_UNUSED; - CONST char *pathname ATTRIBUTE_UNUSED; + const char *pathname ATTRIBUTE_UNUSED; char *arhdr ATTRIBUTE_UNUSED; { #if VMS_DEBUG @@ -1051,14 +1052,14 @@ vms_get_elt_at_index (abfd, index) -> bfd_generic_stat_arch_elt */ static int -vms_generic_stat_arch_elt (abfd, stat) +vms_generic_stat_arch_elt (abfd, st) bfd *abfd; - struct stat *stat; + struct stat *st; { #if VMS_DEBUG - vms_debug (1, "vms_generic_stat_arch_elt(%p, %p)\n", abfd, stat); + vms_debug (1, "vms_generic_stat_arch_elt(%p, %p)\n", abfd, st); #endif - return bfd_generic_stat_arch_elt(abfd, stat); + return bfd_generic_stat_arch_elt (abfd, st); } /* This is a new function in bfd 2.5 */ @@ -1147,7 +1148,9 @@ asymbol * _bfd_vms_make_empty_symbol (abfd) bfd *abfd; { - asymbol *symbol = (asymbol *)bfd_zalloc(abfd, sizeof (asymbol)); + asymbol *symbol; + + symbol = (asymbol *) bfd_zalloc(abfd, (bfd_size_type) sizeof (asymbol)); #if VMS_DEBUG vms_debug (1, "_bfd_vms_make_empty_symbol(%p)\n", abfd); @@ -1188,7 +1191,7 @@ vms_print_symbol (abfd, file, symbol, ho case bfd_print_symbol_all: { - CONST char *section_name = symbol->section->name; + const char *section_name = symbol->section->name; bfd_print_symbol_vandf (abfd, (PTR)file, symbol); @@ -1293,8 +1296,8 @@ vms_find_nearest_line (abfd, section, sy asection *section ATTRIBUTE_UNUSED; asymbol **symbols ATTRIBUTE_UNUSED; bfd_vma offset ATTRIBUTE_UNUSED; - CONST char **file ATTRIBUTE_UNUSED; - CONST char **func ATTRIBUTE_UNUSED; + const char **file ATTRIBUTE_UNUSED; + const char **func ATTRIBUTE_UNUSED; unsigned int *line ATTRIBUTE_UNUSED; { #if VMS_DEBUG diff -uprN binutils-2.11.90.0.31/bfd/vms.h binutils-2.11.92.0.5/bfd/vms.h --- binutils-2.11.90.0.31/bfd/vms.h Fri Mar 9 11:16:09 2001 +++ binutils-2.11.92.0.5/bfd/vms.h Mon Oct 1 15:25:21 2001 @@ -1,6 +1,7 @@ #undef vms /* vms.h -- Header file for VMS (Alpha and Vax) support. - Copyright 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright 1996, 1997, 1998, 1999, 2000, 2001 + Free Software Foundation, Inc. Written by Klaus K"ampf (kkaempf@rmi.de) diff -uprN binutils-2.11.90.0.31/bfd/xcofflink.c binutils-2.11.92.0.5/bfd/xcofflink.c --- binutils-2.11.90.0.31/bfd/xcofflink.c Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/bfd/xcofflink.c Mon Oct 1 15:25:21 2001 @@ -1,5 +1,5 @@ /* POWER/PowerPC XCOFF linker support. - Copyright 1995, 1996, 1997, 1998, 1999, 2000 + Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Written by Ian Lance Taylor , Cygnus Support. @@ -39,7 +39,8 @@ Foundation, Inc., 59 Temple Place - Suit /* The list of import files. */ -struct xcoff_import_file { +struct xcoff_import_file +{ /* The next entry in the list. */ struct xcoff_import_file *next; /* The path. */ @@ -53,7 +54,8 @@ struct xcoff_import_file { /* Information we keep for each section in the output file during the final link phase. */ -struct xcoff_link_section_info { +struct xcoff_link_section_info +{ /* The relocs to be output. */ struct internal_reloc *relocs; /* For each reloc against a global symbol whose index was not known @@ -72,7 +74,8 @@ struct xcoff_link_section_info { /* Information that we pass around while doing the final link step. */ -struct xcoff_final_link_info { +struct xcoff_final_link_info +{ /* General link information. */ struct bfd_link_info *info; /* Output BFD. */ @@ -159,16 +162,16 @@ xcoff_get_section_contents (abfd, sec) if (coff_section_data (abfd, sec) == NULL) { - sec->used_by_bfd = bfd_zalloc (abfd, - sizeof (struct coff_section_tdata)); + bfd_size_type amt = sizeof (struct coff_section_tdata); + sec->used_by_bfd = bfd_zalloc (abfd, amt); if (sec->used_by_bfd == NULL) return false; } if (coff_section_data (abfd, sec)->contents == NULL) { - coff_section_data (abfd, sec)->contents = - (bfd_byte *) bfd_malloc (sec->_raw_size); + coff_section_data (abfd, sec)->contents = ((bfd_byte *) + bfd_malloc (sec->_raw_size)); if (coff_section_data (abfd, sec)->contents == NULL) return false; @@ -272,7 +275,7 @@ _bfd_xcoff_canonicalize_dynamic_symtab ( { char *c; - c = bfd_alloc (abfd, SYMNMLEN + 1); + c = bfd_alloc (abfd, (bfd_size_type) SYMNMLEN + 1); if (c == NULL) return -1; memcpy (c, ldsym._l._l_name, SYMNMLEN); @@ -374,8 +377,8 @@ _bfd_xcoff_canonicalize_dynamic_reloc (a elrel = contents + bfd_xcoff_loader_reloc_offset(abfd, &ldhdr); elrelend = elrel + ldhdr.l_nreloc * bfd_xcoff_ldrelsz(abfd); - for (; elrel < elrelend; elrel += bfd_xcoff_ldrelsz(abfd), relbuf++, - prelocs++) + for (; elrel < elrelend; elrel += bfd_xcoff_ldrelsz(abfd), relbuf++, + prelocs++) { struct internal_ldrel ldrel; @@ -477,9 +480,9 @@ _bfd_xcoff_bfd_link_hash_table_create (a bfd *abfd; { struct xcoff_link_hash_table *ret; + bfd_size_type amt = sizeof (struct xcoff_link_hash_table); - ret = ((struct xcoff_link_hash_table *) - bfd_alloc (abfd, sizeof (struct xcoff_link_hash_table))); + ret = (struct xcoff_link_hash_table *) bfd_alloc (abfd, amt); if (ret == (struct xcoff_link_hash_table *) NULL) return (struct bfd_link_hash_table *) NULL; if (! _bfd_link_hash_table_init (&ret->root, abfd, xcoff_link_hash_newfunc)) @@ -731,7 +734,7 @@ xcoff_link_check_ar_symbols (abfd, info, undefined references in shared objects. */ if (h != (struct bfd_link_hash_entry *) NULL && h->type == bfd_link_hash_undefined - && (info->hash->creator != abfd->xvec + && (info->hash->creator != abfd->xvec || (((struct xcoff_link_hash_entry *) h)->flags & XCOFF_DEF_DYNAMIC) == 0)) { @@ -886,92 +889,103 @@ xcoff_find_reloc (relocs, count, address } -/* - * xcoff_link_create_extra_sections - * - * Takes care of creating the .loader, .gl, .ds, .debug and sections - */ +/* xcoff_link_create_extra_sections + + Takes care of creating the .loader, .gl, .ds, .debug and sections. */ + static boolean -xcoff_link_create_extra_sections(bfd * abfd, struct bfd_link_info *info) { +xcoff_link_create_extra_sections(bfd * abfd, struct bfd_link_info *info) +{ boolean return_value = false; - if (info->hash->creator == abfd->xvec) { + if (info->hash->creator == abfd->xvec) + { /* We need to build a .loader section, so we do it here. This won't work if we're producing an XCOFF output file with no XCOFF input files. FIXME. */ - if (xcoff_hash_table (info)->loader_section == NULL) { - asection *lsec; - - lsec = bfd_make_section_anyway (abfd, ".loader"); - if (lsec == NULL) { - goto end_return; + if (xcoff_hash_table (info)->loader_section == NULL) + { + asection *lsec; + + lsec = bfd_make_section_anyway (abfd, ".loader"); + if (lsec == NULL) + { + goto end_return; + } + xcoff_hash_table (info)->loader_section = lsec; + lsec->flags |= SEC_HAS_CONTENTS | SEC_IN_MEMORY; } - xcoff_hash_table (info)->loader_section = lsec; - lsec->flags |= SEC_HAS_CONTENTS | SEC_IN_MEMORY; - } /* Likewise for the linkage section. */ - if (xcoff_hash_table (info)->linkage_section == NULL) { - asection *lsec; + if (xcoff_hash_table (info)->linkage_section == NULL) + { + asection *lsec; - lsec = bfd_make_section_anyway (abfd, ".gl"); - if (lsec == NULL) { - goto end_return; - } + lsec = bfd_make_section_anyway (abfd, ".gl"); + if (lsec == NULL) + { + goto end_return; + } - xcoff_hash_table (info)->linkage_section = lsec; - lsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS - | SEC_IN_MEMORY); - lsec->alignment_power = 2; - } + xcoff_hash_table (info)->linkage_section = lsec; + lsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS + | SEC_IN_MEMORY); + lsec->alignment_power = 2; + } /* Likewise for the TOC section. */ - if (xcoff_hash_table (info)->toc_section == NULL) { - asection *tsec; - - tsec = bfd_make_section_anyway (abfd, ".tc"); - if (tsec == NULL) { - goto end_return; - } + if (xcoff_hash_table (info)->toc_section == NULL) + { + asection *tsec; - xcoff_hash_table (info)->toc_section = tsec; - tsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS - | SEC_IN_MEMORY); - tsec->alignment_power = 2; - } + tsec = bfd_make_section_anyway (abfd, ".tc"); + if (tsec == NULL) + { + goto end_return; + } - /* Likewise for the descriptor section. */ - if (xcoff_hash_table (info)->descriptor_section == NULL) { - asection *dsec; - - dsec = bfd_make_section_anyway (abfd, ".ds"); - if (dsec == NULL) { - goto end_return; + xcoff_hash_table (info)->toc_section = tsec; + tsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS + | SEC_IN_MEMORY); + tsec->alignment_power = 2; } - xcoff_hash_table (info)->descriptor_section = dsec; - dsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS - | SEC_IN_MEMORY); - dsec->alignment_power = 2; - } + /* Likewise for the descriptor section. */ + if (xcoff_hash_table (info)->descriptor_section == NULL) + { + asection *dsec; + + dsec = bfd_make_section_anyway (abfd, ".ds"); + if (dsec == NULL) + { + goto end_return; + } + + xcoff_hash_table (info)->descriptor_section = dsec; + dsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS + | SEC_IN_MEMORY); + dsec->alignment_power = 2; + } /* Likewise for the .debug section. */ if (xcoff_hash_table (info)->debug_section == NULL - && info->strip != strip_all) { - asection *dsec; + && info->strip != strip_all) + { + asection *dsec; - dsec = bfd_make_section_anyway (abfd, ".debug"); - if (dsec == NULL) { - goto end_return; + dsec = bfd_make_section_anyway (abfd, ".debug"); + if (dsec == NULL) + { + goto end_return; + } + xcoff_hash_table (info)->debug_section = dsec; + dsec->flags |= SEC_HAS_CONTENTS | SEC_IN_MEMORY; } - xcoff_hash_table (info)->debug_section = dsec; - dsec->flags |= SEC_HAS_CONTENTS | SEC_IN_MEMORY; - } - } - + } + return_value = true; end_return: @@ -1018,26 +1032,30 @@ xcoff_link_add_symbols (abfd, info) bfd_size_type symesz; bfd_byte *esym; bfd_byte *esym_end; - struct reloc_info_struct + struct reloc_info_struct { struct internal_reloc *relocs; asection **csects; bfd_byte *linenos; } *reloc_info = NULL; + bfd_size_type amt; keep_syms = obj_coff_keep_syms (abfd); if ((abfd->flags & DYNAMIC) != 0 - && ! info->static_link) { - if (! xcoff_link_add_dynamic_symbols (abfd, info)) { - return false; + && ! info->static_link) + { + if (! xcoff_link_add_dynamic_symbols (abfd, info)) + { + return false; + } } - } /* create the loader, toc, gl, ds and debug sections, if needed */ - if (false == xcoff_link_create_extra_sections(abfd, info)) { - goto error_return; - } + if (false == xcoff_link_create_extra_sections(abfd, info)) + { + goto error_return; + } if ((abfd->flags & DYNAMIC) != 0 && ! info->static_link) @@ -1055,79 +1073,78 @@ xcoff_link_add_symbols (abfd, info) else default_copy = true; - symcount = obj_raw_syment_count (abfd); + symcount = obj_raw_syment_count (abfd); /* We keep a list of the linker hash table entries that correspond to each external symbol. */ - sym_hash = ((struct xcoff_link_hash_entry **) - bfd_alloc (abfd, - (symcount - * sizeof (struct xcoff_link_hash_entry *)))); + amt = symcount * sizeof (struct xcoff_link_hash_entry *); + sym_hash = (struct xcoff_link_hash_entry **) bfd_alloc (abfd, amt); if (sym_hash == NULL && symcount != 0) goto error_return; coff_data (abfd)->sym_hashes = (struct coff_link_hash_entry **) sym_hash; - memset (sym_hash, 0, - (size_t) symcount * sizeof (struct xcoff_link_hash_entry *)); + memset (sym_hash, 0, (size_t) amt); /* Because of the weird stuff we are doing with XCOFF csects, we can not easily determine which section a symbol is in, so we store the information in the tdata for the input file. */ - csect_cache = ((asection **) - bfd_alloc (abfd, symcount * sizeof (asection *))); + amt = symcount * sizeof (asection *); + csect_cache = (asection **) bfd_alloc (abfd, amt); if (csect_cache == NULL && symcount != 0) goto error_return; xcoff_data (abfd)->csects = csect_cache; - memset (csect_cache, 0, (size_t) symcount * sizeof (asection *)); + memset (csect_cache, 0, (size_t) amt); /* While splitting sections into csects, we need to assign the relocs correctly. The relocs and the csects must both be in order by VMA within a given section, so we handle this by scanning along the relocs as we process the csects. We index into reloc_info using the section target_index. */ - reloc_info = ((struct reloc_info_struct *) - bfd_malloc ((abfd->section_count + 1) - * sizeof (struct reloc_info_struct))); + amt = abfd->section_count + 1; + amt *= sizeof (struct reloc_info_struct); + reloc_info = (struct reloc_info_struct *) bfd_malloc (amt); if (reloc_info == NULL) goto error_return; - memset ((PTR) reloc_info, 0, - (abfd->section_count + 1) * sizeof (struct reloc_info_struct)); + memset ((PTR) reloc_info, 0, (size_t) amt); /* Read in the relocs and line numbers for each section. */ linesz = bfd_coff_linesz (abfd); last_real = NULL; - for (o = abfd->sections; o != NULL; o = o->next) { + for (o = abfd->sections; o != NULL; o = o->next) + { - last_real = o; - if ((o->flags & SEC_RELOC) != 0) { + last_real = o; + if ((o->flags & SEC_RELOC) != 0) + { - reloc_info[o->target_index].relocs = - xcoff_read_internal_relocs (abfd, o, true, (bfd_byte *) NULL, - false, (struct internal_reloc *) NULL); - reloc_info[o->target_index].csects = - (asection **) bfd_malloc (o->reloc_count * sizeof (asection *)); - if (reloc_info[o->target_index].csects == NULL) - goto error_return; - memset (reloc_info[o->target_index].csects, 0, - o->reloc_count * sizeof (asection *)); - - } + reloc_info[o->target_index].relocs = + xcoff_read_internal_relocs (abfd, o, true, (bfd_byte *) NULL, + false, (struct internal_reloc *) NULL); + amt = o->reloc_count; + amt *= sizeof (asection *); + reloc_info[o->target_index].csects = (asection **) bfd_malloc (amt); + if (reloc_info[o->target_index].csects == NULL) + goto error_return; + memset (reloc_info[o->target_index].csects, 0, (size_t) amt); - if ((info->strip == strip_none || info->strip == strip_some) - && o->lineno_count > 0) { + } - bfd_byte *linenos; + if ((info->strip == strip_none || info->strip == strip_some) + && o->lineno_count > 0) + { - linenos = (bfd_byte *) bfd_malloc (o->lineno_count * linesz); - if (linenos == NULL) - goto error_return; - reloc_info[o->target_index].linenos = linenos; - if (bfd_seek (abfd, o->line_filepos, SEEK_SET) != 0 - || (bfd_read (linenos, linesz, o->lineno_count, abfd) - != linesz * o->lineno_count)) - goto error_return; - + bfd_byte *linenos; + + amt = linesz * o->lineno_count; + linenos = (bfd_byte *) bfd_malloc (amt); + if (linenos == NULL) + goto error_return; + reloc_info[o->target_index].linenos = linenos; + if (bfd_seek (abfd, o->line_filepos, SEEK_SET) != 0 + || bfd_bread (linenos, amt, abfd) != amt) + goto error_return; + + } } - } /* Don't let the linker relocation routines discard the symbols. */ @@ -1142,56 +1159,57 @@ xcoff_link_add_symbols (abfd, info) esym = (bfd_byte *) obj_coff_external_syms (abfd); esym_end = esym + symcount * symesz; - while (esym < esym_end) { - struct internal_syment sym; - union internal_auxent aux; - const char *name; - char buf[SYMNMLEN + 1]; - int smtyp; - flagword flags; - asection *section; - bfd_vma value; - struct xcoff_link_hash_entry *set_toc; - - bfd_coff_swap_sym_in (abfd, (PTR) esym, (PTR) &sym); - - /* In this pass we are only interested in symbols with csect - information. */ - if (sym.n_sclass != C_EXT && sym.n_sclass != C_HIDEXT) { - - /* - * Set csect_cache, - * Normally csect is a .pr, .rw etc. created in the loop - * If C_FILE or first time, handle special - * - * Advance esym, sym_hash, csect_hash ptr's - * Keep track of the last_symndx for the current file - */ - if (sym.n_sclass == C_FILE && csect != NULL) { - xcoff_section_data (abfd, csect)->last_symndx = - ((esym - - (bfd_byte *) obj_coff_external_syms (abfd)) - / symesz); - csect = NULL; - } + while (esym < esym_end) + { + struct internal_syment sym; + union internal_auxent aux; + const char *name; + char buf[SYMNMLEN + 1]; + int smtyp; + flagword flags; + asection *section; + bfd_vma value; + struct xcoff_link_hash_entry *set_toc; - if (csect != NULL) - *csect_cache = csect; - else if (first_csect == NULL || sym.n_sclass == C_FILE) - *csect_cache = coff_section_from_bfd_index (abfd, sym.n_scnum); - else - *csect_cache = NULL; - esym += (sym.n_numaux + 1) * symesz; - sym_hash += sym.n_numaux + 1; - csect_cache += sym.n_numaux + 1; - - continue; - } + bfd_coff_swap_sym_in (abfd, (PTR) esym, (PTR) &sym); + + /* In this pass we are only interested in symbols with csect + information. */ + if (sym.n_sclass != C_EXT && sym.n_sclass != C_HIDEXT) + { - name = _bfd_coff_internal_syment_name (abfd, &sym, buf); + /* Set csect_cache, + Normally csect is a .pr, .rw etc. created in the loop + If C_FILE or first time, handle special + + Advance esym, sym_hash, csect_hash ptr's + Keep track of the last_symndx for the current file. */ + if (sym.n_sclass == C_FILE && csect != NULL) + { + xcoff_section_data (abfd, csect)->last_symndx = + ((esym + - (bfd_byte *) obj_coff_external_syms (abfd)) + / symesz); + csect = NULL; + } - if (name == NULL) - goto error_return; + if (csect != NULL) + *csect_cache = csect; + else if (first_csect == NULL || sym.n_sclass == C_FILE) + *csect_cache = coff_section_from_bfd_index (abfd, sym.n_scnum); + else + *csect_cache = NULL; + esym += (sym.n_numaux + 1) * symesz; + sym_hash += sym.n_numaux + 1; + csect_cache += sym.n_numaux + 1; + + continue; + } + + name = _bfd_coff_internal_syment_name (abfd, &sym, buf); + + if (name == NULL) + goto error_return; /* If this symbol has line number information attached to it, and we're not stripping it, count the number of entries and @@ -1199,80 +1217,89 @@ xcoff_link_add_symbols (abfd, info) we are going to attach line number information by symbol, rather than by section, in order to more easily handle garbage collection. */ - if ((info->strip == strip_none || info->strip == strip_some) && - (sym.n_numaux > 1) && - (csect != NULL) && - (ISFCN (sym.n_type))) { + if ((info->strip == strip_none || info->strip == strip_some) + && sym.n_numaux > 1 + && csect != NULL + && ISFCN (sym.n_type)) + { - union internal_auxent auxlin; + union internal_auxent auxlin; - bfd_coff_swap_aux_in (abfd, (PTR) (esym + symesz), - sym.n_type, sym.n_sclass, - 0, sym.n_numaux, (PTR) &auxlin); + bfd_coff_swap_aux_in (abfd, (PTR) (esym + symesz), + sym.n_type, sym.n_sclass, + 0, sym.n_numaux, (PTR) &auxlin); + + if (auxlin.x_sym.x_fcnary.x_fcn.x_lnnoptr != 0) + { + asection *enclosing; + bfd_signed_vma linoff; + + enclosing = xcoff_section_data (abfd, csect)->enclosing; + if (enclosing == NULL) + { + (*_bfd_error_handler) + (_("%s: `%s' has line numbers but no enclosing section"), + bfd_archive_filename (abfd), name); + bfd_set_error (bfd_error_bad_value); + goto error_return; + } + linoff = (auxlin.x_sym.x_fcnary.x_fcn.x_lnnoptr + - enclosing->line_filepos); + /* explict cast to bfd_signed_vma for compiler */ + if (linoff < (bfd_signed_vma) (enclosing->lineno_count * linesz)) + { + struct internal_lineno lin; + bfd_byte *linpstart; + + linpstart = (reloc_info[enclosing->target_index].linenos + + linoff); + bfd_coff_swap_lineno_in (abfd, (PTR) linpstart, (PTR) &lin); + if (lin.l_lnno == 0 + && ((bfd_size_type) lin.l_addr.l_symndx + == ((esym + - (bfd_byte *) obj_coff_external_syms (abfd)) + / symesz))) + { + bfd_byte *linpend, *linp; + + linpend = (reloc_info[enclosing->target_index].linenos + + enclosing->lineno_count * linesz); + for (linp = linpstart + linesz; + linp < linpend; + linp += linesz) + { + bfd_coff_swap_lineno_in (abfd, (PTR) linp, + (PTR) &lin); + if (lin.l_lnno == 0) + break; + } + csect->lineno_count += (linp - linpstart) / linesz; + /* The setting of line_filepos will only be + useful if all the line number entries for a + csect are contiguous; this only matters for + error reporting. */ + if (csect->line_filepos == 0) + csect->line_filepos = + auxlin.x_sym.x_fcnary.x_fcn.x_lnnoptr; + } + } + } + } + + /* Pick up the csect auxiliary information. */ - if (auxlin.x_sym.x_fcnary.x_fcn.x_lnnoptr != 0) { - asection *enclosing; - bfd_signed_vma linoff; - - enclosing = xcoff_section_data (abfd, csect)->enclosing; - if (enclosing == NULL) { + if (sym.n_numaux == 0) + { (*_bfd_error_handler) - (_("%s: `%s' has line numbers but no enclosing section"), - bfd_get_filename (abfd), name); + (_("%s: class %d symbol `%s' has no aux entries"), + bfd_archive_filename (abfd), sym.n_sclass, name); bfd_set_error (bfd_error_bad_value); goto error_return; } - linoff = (auxlin.x_sym.x_fcnary.x_fcn.x_lnnoptr - - enclosing->line_filepos); - /* explict cast to bfd_signed_vma for compiler */ - if (linoff < (bfd_signed_vma)(enclosing->lineno_count * linesz)) { - struct internal_lineno lin; - bfd_byte *linpstart; - - linpstart = (reloc_info[enclosing->target_index].linenos - + linoff); - bfd_coff_swap_lineno_in (abfd, (PTR) linpstart, (PTR) &lin); - if (lin.l_lnno == 0 - && ((bfd_size_type) lin.l_addr.l_symndx - == ((esym - - (bfd_byte *) obj_coff_external_syms (abfd)) - / symesz))) { - bfd_byte *linpend, *linp; - - linpend = (reloc_info[enclosing->target_index].linenos - + enclosing->lineno_count * linesz); - for (linp = linpstart + linesz; linp < linpend; linp += linesz) { - bfd_coff_swap_lineno_in (abfd, (PTR) linp, - (PTR) &lin); - if (lin.l_lnno == 0) - break; - } - csect->lineno_count += (linp - linpstart) / linesz; - /* The setting of line_filepos will only be - useful if all the line number entries for a - csect are contiguous; this only matters for - error reporting. */ - if (csect->line_filepos == 0) - csect->line_filepos = - auxlin.x_sym.x_fcnary.x_fcn.x_lnnoptr; - } - } - } - } - - /* Pick up the csect auxiliary information. */ - - if (sym.n_numaux == 0) { - (*_bfd_error_handler) - (_("%s: class %d symbol `%s' has no aux entries"), - bfd_get_filename (abfd), sym.n_sclass, name); - bfd_set_error (bfd_error_bad_value); - goto error_return; - } - bfd_coff_swap_aux_in (abfd, - (PTR) (esym + symesz * sym.n_numaux), - sym.n_type, sym.n_sclass, + bfd_coff_swap_aux_in (abfd, + (PTR) (esym + symesz * sym.n_numaux), + sym.n_type, sym.n_sclass, sym.n_numaux - 1, sym.n_numaux, (PTR) &aux); @@ -1288,7 +1315,7 @@ xcoff_link_add_symbols (abfd, info) default: (*_bfd_error_handler) (_("%s: symbol `%s' has unrecognized csect type %d"), - bfd_get_filename (abfd), name, smtyp); + bfd_archive_filename (abfd), name, smtyp); bfd_set_error (bfd_error_bad_value); goto error_return; @@ -1300,7 +1327,7 @@ xcoff_link_add_symbols (abfd, info) { (*_bfd_error_handler) (_("%s: bad XTY_ER symbol `%s': class %d scnum %d scnlen %d"), - bfd_get_filename (abfd), name, sym.n_sclass, sym.n_scnum, + bfd_archive_filename (abfd), name, sym.n_sclass, sym.n_scnum, aux.x_csect.x_scnlen.l); bfd_set_error (bfd_error_bad_value); goto error_return; @@ -1322,13 +1349,11 @@ xcoff_link_add_symbols (abfd, info) if (csect != NULL) { xcoff_section_data (abfd, csect)->last_symndx = - ((esym - - (bfd_byte *) obj_coff_external_syms (abfd)) - / symesz); + ((esym - (bfd_byte *) obj_coff_external_syms (abfd)) / symesz); } csect = NULL; - csect_index = -1; + csect_index = -(unsigned) 1; /* When we see a TOC anchor, we record the TOC value. */ if (aux.x_csect.x_smclas == XMC_TC0) @@ -1338,7 +1363,7 @@ xcoff_link_add_symbols (abfd, info) { (*_bfd_error_handler) (_("%s: XMC_TC0 symbol `%s' is class %d scnlen %d"), - bfd_get_filename (abfd), name, sym.n_sclass, + bfd_archive_filename (abfd), name, sym.n_sclass, aux.x_csect.x_scnlen.l); bfd_set_error (bfd_error_bad_value); goto error_return; @@ -1346,123 +1371,122 @@ xcoff_link_add_symbols (abfd, info) xcoff_data (abfd)->toc = sym.n_value; } - /* - * We must merge TOC entries for the same symbol. We can - * merge two TOC entries if they are both C_HIDEXT, they - * both have the same name, they are both 4 or 8 bytes long, and - * they both have a relocation table entry for an external - * symbol with the same name. Unfortunately, this means - * that we must look through the relocations. Ick. - * - * Logic for 32 bit vs 64 bit. - * 32 bit has a csect length of 4 for TOC - * 64 bit has a csect length of 8 for TOC - * - * The conditions to get past the if-check are not that bad. - * They are what is used to create the TOC csects in the first - * place - */ - if ((aux.x_csect.x_smclas == XMC_TC) && - (sym.n_sclass == C_HIDEXT) && - (info->hash->creator == abfd->xvec) && - (((bfd_xcoff_is_xcoff32(abfd)) && - (aux.x_csect.x_scnlen.l == 4)) || - ((bfd_xcoff_is_xcoff64(abfd)) && - (aux.x_csect.x_scnlen.l == 8)))) { + /* We must merge TOC entries for the same symbol. We can + merge two TOC entries if they are both C_HIDEXT, they + both have the same name, they are both 4 or 8 bytes long, and + they both have a relocation table entry for an external + symbol with the same name. Unfortunately, this means + that we must look through the relocations. Ick. + + Logic for 32 bit vs 64 bit. + 32 bit has a csect length of 4 for TOC + 64 bit has a csect length of 8 for TOC + + The conditions to get past the if-check are not that bad. + They are what is used to create the TOC csects in the first + place. */ + if (aux.x_csect.x_smclas == XMC_TC + && sym.n_sclass == C_HIDEXT + && info->hash->creator == abfd->xvec + && ((bfd_xcoff_is_xcoff32 (abfd) + && aux.x_csect.x_scnlen.l == 4) + || (bfd_xcoff_is_xcoff64 (abfd) + && aux.x_csect.x_scnlen.l == 8))) + { + asection *enclosing; + struct internal_reloc *relocs; + bfd_size_type relindx; + struct internal_reloc *rel; - asection *enclosing; - struct internal_reloc *relocs; - bfd_size_type relindx; - struct internal_reloc *rel; + enclosing = coff_section_from_bfd_index (abfd, sym.n_scnum); + if (enclosing == NULL) + goto error_return; - enclosing = coff_section_from_bfd_index (abfd, sym.n_scnum); - if (enclosing == NULL) - goto error_return; + relocs = reloc_info[enclosing->target_index].relocs; + amt = enclosing->reloc_count; + relindx = xcoff_find_reloc (relocs, amt, sym.n_value); + rel = relocs + relindx; - relocs = reloc_info[enclosing->target_index].relocs; - relindx = xcoff_find_reloc (relocs, enclosing->reloc_count, - sym.n_value); - rel = relocs + relindx; - - /* - * 32 bit R_POS r_size is 31 - * 64 bit R_POS r_size is 63 - */ - if ((relindx < enclosing->reloc_count) && - (rel->r_vaddr == (bfd_vma) sym.n_value) && - (rel->r_type == R_POS) && - (((bfd_xcoff_is_xcoff32(abfd)) && - (rel->r_size == 31)) || - ((bfd_xcoff_is_xcoff64(abfd)) && - (rel->r_size == 63)))) { - - bfd_byte *erelsym; - - struct internal_syment relsym; - - erelsym = ((bfd_byte *) obj_coff_external_syms (abfd) - + rel->r_symndx * symesz); - bfd_coff_swap_sym_in (abfd, (PTR) erelsym, (PTR) &relsym); - if (relsym.n_sclass == C_EXT) { - const char *relname; - char relbuf[SYMNMLEN + 1]; - boolean copy; - struct xcoff_link_hash_entry *h; - - /* At this point we know that the TOC entry is - for an externally visible symbol. */ - - relname = _bfd_coff_internal_syment_name (abfd, &relsym, - relbuf); - if (relname == NULL) - goto error_return; - - /* We only merge TOC entries if the TC name is - the same as the symbol name. This handles - the normal case, but not common cases like - SYM.P4 which gcc generates to store SYM + 4 - in the TOC. FIXME. */ - - if (strcmp (name, relname) == 0) { - copy = (! info->keep_memory - || relsym._n._n_n._n_zeroes != 0 - || relsym._n._n_n._n_offset == 0); - h = xcoff_link_hash_lookup (xcoff_hash_table (info), - relname, true, copy, - false); - if (h == NULL) - goto error_return; - - /* At this point h->root.type could be - bfd_link_hash_new. That should be OK, - since we know for sure that we will come - across this symbol as we step through the - file. */ - - /* We store h in *sym_hash for the - convenience of the relocate_section - function. */ - *sym_hash = h; - - if (h->toc_section != NULL) { - asection **rel_csects; - - /* We already have a TOC entry for this - symbol, so we can just ignore this - one. */ - rel_csects = - reloc_info[enclosing->target_index].csects; - rel_csects[relindx] = bfd_und_section_ptr; - break; - } - - /* We are about to create a TOC entry for - this symbol. */ - set_toc = h; - } /* merge toc reloc */ - } /* c_ext */ - } /* reloc */ - } /* merge toc */ + /* 32 bit R_POS r_size is 31 + 64 bit R_POS r_size is 63 */ + if (relindx < enclosing->reloc_count + && rel->r_vaddr == (bfd_vma) sym.n_value + && rel->r_type == R_POS + && ((bfd_xcoff_is_xcoff32 (abfd) + && rel->r_size == 31) + || (bfd_xcoff_is_xcoff64 (abfd) + && rel->r_size == 63))) + { + bfd_byte *erelsym; + + struct internal_syment relsym; + + erelsym = ((bfd_byte *) obj_coff_external_syms (abfd) + + rel->r_symndx * symesz); + bfd_coff_swap_sym_in (abfd, (PTR) erelsym, (PTR) &relsym); + if (relsym.n_sclass == C_EXT) + { + const char *relname; + char relbuf[SYMNMLEN + 1]; + boolean copy; + struct xcoff_link_hash_entry *h; + + /* At this point we know that the TOC entry is + for an externally visible symbol. */ + + relname = _bfd_coff_internal_syment_name (abfd, &relsym, + relbuf); + if (relname == NULL) + goto error_return; + + /* We only merge TOC entries if the TC name is + the same as the symbol name. This handles + the normal case, but not common cases like + SYM.P4 which gcc generates to store SYM + 4 + in the TOC. FIXME. */ + + if (strcmp (name, relname) == 0) + { + copy = (! info->keep_memory + || relsym._n._n_n._n_zeroes != 0 + || relsym._n._n_n._n_offset == 0); + h = xcoff_link_hash_lookup (xcoff_hash_table (info), + relname, true, copy, + false); + if (h == NULL) + goto error_return; + + /* At this point h->root.type could be + bfd_link_hash_new. That should be OK, + since we know for sure that we will come + across this symbol as we step through the + file. */ + + /* We store h in *sym_hash for the + convenience of the relocate_section + function. */ + *sym_hash = h; + + if (h->toc_section != NULL) + { + asection **rel_csects; + + /* We already have a TOC entry for this + symbol, so we can just ignore this + one. */ + rel_csects = + reloc_info[enclosing->target_index].csects; + rel_csects[relindx] = bfd_und_section_ptr; + break; + } + + /* We are about to create a TOC entry for + this symbol. */ + set_toc = h; + } /* merge toc reloc */ + } /* c_ext */ + } /* reloc */ + } /* merge toc */ { @@ -1473,28 +1497,28 @@ xcoff_link_add_symbols (abfd, info) accumulate similar csects together. */ csect = bfd_xcoff_create_csect_from_smclas(abfd, &aux, name); - if (NULL == csect) { - goto error_return; - } + if (NULL == csect) + { + goto error_return; + } - /* - * The enclosing section is the main section : .data, .text - * or .bss that the csect is coming from - */ + /* The enclosing section is the main section : .data, .text + or .bss that the csect is coming from. */ enclosing = coff_section_from_bfd_index (abfd, sym.n_scnum); if (enclosing == NULL) goto error_return; - if (! bfd_is_abs_section (enclosing) && - ((bfd_vma) sym.n_value < enclosing->vma || - ((bfd_vma) sym.n_value + aux.x_csect.x_scnlen.l - > enclosing->vma + enclosing->_raw_size))) { - (*_bfd_error_handler) - (_("%s: csect `%s' not in enclosing section"), - bfd_get_filename (abfd), name); - bfd_set_error (bfd_error_bad_value); - goto error_return; - } + if (! bfd_is_abs_section (enclosing) + && ((bfd_vma) sym.n_value < enclosing->vma + || ((bfd_vma) sym.n_value + aux.x_csect.x_scnlen.l + > enclosing->vma + enclosing->_raw_size))) + { + (*_bfd_error_handler) + (_("%s: csect `%s' not in enclosing section"), + bfd_archive_filename (abfd), name); + bfd_set_error (bfd_error_bad_value); + goto error_return; + } csect->vma = sym.n_value; csect->filepos = (enclosing->filepos + sym.n_value @@ -1505,46 +1529,48 @@ xcoff_link_add_symbols (abfd, info) /* Record the enclosing section in the tdata for this new section. */ - csect->used_by_bfd = - (PTR) bfd_zalloc (abfd, sizeof (struct coff_section_tdata)); + amt = sizeof (struct coff_section_tdata); + csect->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); if (csect->used_by_bfd == NULL) goto error_return; - coff_section_data (abfd, csect)->tdata = - bfd_zalloc (abfd, sizeof (struct xcoff_section_tdata)); + amt = sizeof (struct xcoff_section_tdata); + coff_section_data (abfd, csect)->tdata = bfd_zalloc (abfd, amt); if (coff_section_data (abfd, csect)->tdata == NULL) goto error_return; xcoff_section_data (abfd, csect)->enclosing = enclosing; xcoff_section_data (abfd, csect)->lineno_count = enclosing->lineno_count; - if (enclosing->owner == abfd) { - struct internal_reloc *relocs; - bfd_size_type relindx; - struct internal_reloc *rel; - asection **rel_csect; - - relocs = reloc_info[enclosing->target_index].relocs; - relindx = xcoff_find_reloc (relocs, enclosing->reloc_count, - csect->vma); - - rel = relocs + relindx; - rel_csect = (reloc_info[enclosing->target_index].csects - + relindx); + if (enclosing->owner == abfd) + { + struct internal_reloc *relocs; + bfd_size_type relindx; + struct internal_reloc *rel; + asection **rel_csect; + + relocs = reloc_info[enclosing->target_index].relocs; + amt = enclosing->reloc_count; + relindx = xcoff_find_reloc (relocs, amt, csect->vma); + + rel = relocs + relindx; + rel_csect = (reloc_info[enclosing->target_index].csects + + relindx); + + csect->rel_filepos = (enclosing->rel_filepos + + relindx * bfd_coff_relsz (abfd)); + while (relindx < enclosing->reloc_count + && *rel_csect == NULL + && rel->r_vaddr < csect->vma + csect->_raw_size) + { - csect->rel_filepos = (enclosing->rel_filepos - + relindx * bfd_coff_relsz (abfd)); - while (relindx < enclosing->reloc_count && - *rel_csect == NULL && - rel->r_vaddr < csect->vma + csect->_raw_size) { - - *rel_csect = csect; - csect->flags |= SEC_RELOC; - ++csect->reloc_count; - ++relindx; - ++rel; - ++rel_csect; + *rel_csect = csect; + csect->flags |= SEC_RELOC; + ++csect->reloc_count; + ++relindx; + ++rel; + ++rel_csect; + } } - } /* There are a number of other fields and section flags which we do not bother to set. */ @@ -1574,7 +1600,7 @@ xcoff_link_add_symbols (abfd, info) case XTY_LD: /* This is a label definition. The x_scnlen field is the - symbol index of the csect. Usually the XTY_LD symbol will + symbol index of the csect. Usually the XTY_LD symbol will follow its appropriate XTY_SD symbol. The .set pseudo op can cause the XTY_LD to not follow the XTY_SD symbol. */ { @@ -1596,7 +1622,7 @@ xcoff_link_add_symbols (abfd, info) { (*_bfd_error_handler) (_("%s: misplaced XTY_LD `%s'"), - bfd_get_filename (abfd), name); + bfd_archive_filename (abfd), name); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -1621,16 +1647,17 @@ xcoff_link_add_symbols (abfd, info) / symesz); } - if (aux.x_csect.x_smclas == XMC_TD) { - /* - * The linker script puts the .td section in the data - * section after the .tc section - */ - csect = bfd_make_section_anyway (abfd, ".td"); + if (aux.x_csect.x_smclas == XMC_TD) + { + /* The linker script puts the .td section in the data + section after the .tc section. */ + csect = bfd_make_section_anyway (abfd, ".td"); - } else { - csect = bfd_make_section_anyway (abfd, ".bss"); - } + } + else + { + csect = bfd_make_section_anyway (abfd, ".bss"); + } if (csect == NULL) goto error_return; csect->vma = sym.n_value; @@ -1644,12 +1671,12 @@ xcoff_link_add_symbols (abfd, info) - (bfd_byte *) obj_coff_external_syms (abfd)) / symesz); - csect->used_by_bfd = - (PTR) bfd_zalloc (abfd, sizeof (struct coff_section_tdata)); + amt = sizeof (struct coff_section_tdata); + csect->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); if (csect->used_by_bfd == NULL) goto error_return; - coff_section_data (abfd, csect)->tdata = - bfd_zalloc (abfd, sizeof (struct xcoff_section_tdata)); + amt = sizeof (struct xcoff_section_tdata); + coff_section_data (abfd, csect)->tdata = bfd_zalloc (abfd, amt); if (coff_section_data (abfd, csect)->tdata == NULL) goto error_return; xcoff_section_data (abfd, csect)->first_symndx = csect_index; @@ -1669,31 +1696,36 @@ xcoff_link_add_symbols (abfd, info) } /* Check for magic symbol names. */ - if ((smtyp == XTY_SD || smtyp == XTY_CM) && - (aux.x_csect.x_smclas != XMC_TC) && - (aux.x_csect.x_smclas != XMC_TD)) { - - int i = -1; - - if (name[0] == '_') { - if (strcmp (name, "_text") == 0) - i = XCOFF_SPECIAL_SECTION_TEXT; - else if (strcmp (name, "_etext") == 0) - i = XCOFF_SPECIAL_SECTION_ETEXT; - else if (strcmp (name, "_data") == 0) - i = XCOFF_SPECIAL_SECTION_DATA; - else if (strcmp (name, "_edata") == 0) - i = XCOFF_SPECIAL_SECTION_EDATA; - else if (strcmp (name, "_end") == 0) - i = XCOFF_SPECIAL_SECTION_END; - } else if (name[0] == 'e' && strcmp (name, "end") == 0) { - i = XCOFF_SPECIAL_SECTION_END2; - } - - if (i != -1) { - xcoff_hash_table (info)->special_sections[i] = csect; - } - } + if ((smtyp == XTY_SD || smtyp == XTY_CM) + && aux.x_csect.x_smclas != XMC_TC + && aux.x_csect.x_smclas != XMC_TD) + { + + int i = -1; + + if (name[0] == '_') + { + if (strcmp (name, "_text") == 0) + i = XCOFF_SPECIAL_SECTION_TEXT; + else if (strcmp (name, "_etext") == 0) + i = XCOFF_SPECIAL_SECTION_ETEXT; + else if (strcmp (name, "_data") == 0) + i = XCOFF_SPECIAL_SECTION_DATA; + else if (strcmp (name, "_edata") == 0) + i = XCOFF_SPECIAL_SECTION_EDATA; + else if (strcmp (name, "_end") == 0) + i = XCOFF_SPECIAL_SECTION_END; + } + else if (name[0] == 'e' && strcmp (name, "end") == 0) + { + i = XCOFF_SPECIAL_SECTION_END2; + } + + if (i != -1) + { + xcoff_hash_table (info)->special_sections[i] = csect; + } + } /* Now we have enough information to add the symbol to the linker hash table. */ @@ -1736,7 +1768,7 @@ xcoff_link_add_symbols (abfd, info) shared object, which will cause symbol redefinitions, although this is an easier case to detect. */ - if (info->hash->creator == abfd->xvec) + if (info->hash->creator == abfd->xvec) { if (! bfd_is_und_section (section)) *sym_hash = xcoff_link_hash_lookup (xcoff_hash_table (info), @@ -1818,7 +1850,7 @@ xcoff_link_add_symbols (abfd, info) not an error. */ if (! ((*info->callbacks->multiple_definition) (info, (*sym_hash)->root.root.string, - (bfd *) NULL, (asection *) NULL, 0, + (bfd *) NULL, (asection *) NULL, (bfd_vma) 0, (*sym_hash)->root.u.def.section->owner, (*sym_hash)->root.u.def.section, (*sym_hash)->root.u.def.value))) @@ -1858,11 +1890,11 @@ xcoff_link_add_symbols (abfd, info) else { (*sym_hash)->root.u.c.p->alignment_power - = csect->alignment_power; + = csect->alignment_power; } } - if (info->hash->creator == abfd->xvec) + if (info->hash->creator == abfd->xvec) { int flag; @@ -1914,7 +1946,7 @@ xcoff_link_add_symbols (abfd, info) { (*_bfd_error_handler) (_("%s: reloc %s:%d not in csect"), - bfd_get_filename (abfd), o->name, i); + bfd_archive_filename (abfd), o->name, i); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -1922,7 +1954,7 @@ xcoff_link_add_symbols (abfd, info) /* We identify all symbols which are called, so that we can create glue code for calls to functions imported from dynamic objects. */ - if (info->hash->creator == abfd->xvec + if (info->hash->creator == abfd->xvec && *rel_csect != bfd_und_section_ptr && (rel->r_type == R_BR || rel->r_type == R_RBR) @@ -2014,7 +2046,7 @@ xcoff_link_add_symbols (abfd, info) if (reloc_info[o->target_index].linenos != NULL) free (reloc_info[o->target_index].linenos); } - free (reloc_info); + free (reloc_info); } obj_coff_keep_syms (abfd) = keep_syms; return false; @@ -2045,15 +2077,15 @@ xcoff_link_add_dynamic_symbols (abfd, in /* We can only handle a dynamic object if we are generating an XCOFF output file. */ - if (info->hash->creator != abfd->xvec) + if (info->hash->creator != abfd->xvec) { (*_bfd_error_handler) (_("%s: XCOFF shared object when not producing XCOFF output"), bfd_get_filename (abfd)); - bfd_set_error (bfd_error_invalid_operation); + bfd_set_error (bfd_error_invalid_operation); return false; } - + /* The symbols we use from a dynamic object are not the symbols in the normal symbol table, but, rather, the symbols in the export table. If there is a global symbol in a dynamic object which is @@ -2176,7 +2208,7 @@ xcoff_link_add_dynamic_symbols (abfd, in { char *dsnm; - dsnm = bfd_malloc (strlen (name) + 2); + dsnm = bfd_malloc ((bfd_size_type) strlen (name) + 2); if (dsnm == NULL) return false; dsnm[0] = '.'; @@ -2227,7 +2259,7 @@ xcoff_link_add_dynamic_symbols (abfd, in /* Record this file in the import files. */ n = ((struct xcoff_import_file *) - bfd_alloc (abfd, sizeof (struct xcoff_import_file))); + bfd_alloc (abfd, (bfd_size_type) sizeof (struct xcoff_import_file))); if (n == NULL) return false; n->next = NULL; @@ -2488,6 +2520,7 @@ bfd_xcoff_link_record_set (output_bfd, i { struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg; struct xcoff_link_size_list *n; + bfd_size_type amt; if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour) return true; @@ -2496,8 +2529,8 @@ bfd_xcoff_link_record_set (output_bfd, i per global symbol, so instead the size is kept on a linked list attached to the hash table. */ - n = ((struct xcoff_link_size_list *) - bfd_alloc (output_bfd, sizeof (struct xcoff_link_size_list))); + amt = sizeof (struct xcoff_link_size_list); + n = (struct xcoff_link_size_list *) bfd_alloc (output_bfd, amt); if (n == NULL) return false; n->next = xcoff_hash_table (info)->size_list; @@ -2514,7 +2547,7 @@ bfd_xcoff_link_record_set (output_bfd, i boolean bfd_xcoff_import_symbol (output_bfd, info, harg, val, imppath, impfile, - impmember) + impmember, syscall_flag) bfd *output_bfd; struct bfd_link_info *info; struct bfd_link_hash_entry *harg; @@ -2522,6 +2555,7 @@ bfd_xcoff_import_symbol (output_bfd, inf const char *imppath; const char *impfile; const char *impmember; + unsigned int syscall_flag; { struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg; @@ -2564,7 +2598,7 @@ bfd_xcoff_import_symbol (output_bfd, inf h = hds; } - h->flags |= XCOFF_IMPORT; + h->flags |= (XCOFF_IMPORT | syscall_flag); if (val != (bfd_vma) -1) { @@ -2610,9 +2644,9 @@ bfd_xcoff_import_symbol (output_bfd, inf if (*pp == NULL) { struct xcoff_import_file *n; + bfd_size_type amt = sizeof (struct xcoff_import_file); - n = ((struct xcoff_import_file *) - bfd_alloc (output_bfd, sizeof (struct xcoff_import_file))); + n = (struct xcoff_import_file *) bfd_alloc (output_bfd, amt); if (n == NULL) return false; n->next = NULL; @@ -2631,11 +2665,10 @@ bfd_xcoff_import_symbol (output_bfd, inf /* Export a symbol. */ boolean -bfd_xcoff_export_symbol (output_bfd, info, harg, syscall) +bfd_xcoff_export_symbol (output_bfd, info, harg) bfd *output_bfd; struct bfd_link_info *info; struct bfd_link_hash_entry *harg; - boolean syscall ATTRIBUTE_UNUSED; { struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg; @@ -2654,8 +2687,9 @@ bfd_xcoff_export_symbol (output_bfd, inf { char *fnname; struct xcoff_link_hash_entry *hfn; + bfd_size_type amt = strlen (h->root.root.string) + 2; - fnname = (char *) bfd_malloc (strlen (h->root.root.string) + 2); + fnname = (char *) bfd_malloc (amt); if (fnname == NULL) return false; fnname[0] = '.'; @@ -2799,13 +2833,15 @@ bfd_xcoff_size_dynamic_sections (output_ bfd *sub; struct bfd_strtab_hash *debug_strtab; bfd_byte *debug_contents = NULL; + bfd_size_type amt; - if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour) { + if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour) + { - for (i = 0; i < XCOFF_NUMBER_OF_SPECIAL_SECTIONS; i++) - special_sections[i] = NULL; - return true; - } + for (i = 0; i < XCOFF_NUMBER_OF_SPECIAL_SECTIONS; i++) + special_sections[i] = NULL; + return true; + } ldinfo.failed = false; ldinfo.output_bfd = output_bfd; @@ -2823,77 +2859,77 @@ bfd_xcoff_size_dynamic_sections (output_ xcoff_hash_table (info)->file_align = file_align; xcoff_hash_table (info)->textro = textro; - if (entry == NULL) { - hentry = NULL; - } else { - hentry = xcoff_link_hash_lookup (xcoff_hash_table (info), entry, - false, false, true); - if (hentry != NULL) - hentry->flags |= XCOFF_ENTRY; - } + if (entry == NULL) + { + hentry = NULL; + } + else + { + hentry = xcoff_link_hash_lookup (xcoff_hash_table (info), entry, + false, false, true); + if (hentry != NULL) + hentry->flags |= XCOFF_ENTRY; + } /* __rtinit */ if (info->init_function || info->fini_function) { struct xcoff_link_hash_entry *hrtinit; struct internal_ldsym *ldsym; - hrtinit = xcoff_link_hash_lookup (xcoff_hash_table (info), + hrtinit = xcoff_link_hash_lookup (xcoff_hash_table (info), "__rtinit", false, false, true); - if (hrtinit != NULL) { - xcoff_mark_symbol (info, hrtinit); - hrtinit->flags |= (XCOFF_DEF_REGULAR | XCOFF_RTINIT); - } else { - (*_bfd_error_handler) - (_("error: undefined symbol __rtinit")); - - return false; - } + if (hrtinit != NULL) + { + xcoff_mark_symbol (info, hrtinit); + hrtinit->flags |= (XCOFF_DEF_REGULAR | XCOFF_RTINIT); + } + else + { + (*_bfd_error_handler) + (_("error: undefined symbol __rtinit")); + + return false; + } + + /* __rtinit initalized here + Some information, like the location of the .initfini seciton will + be filled in later. + + name or offset taken care of below with bfd_xcoff_put_ldsymbol_name. */ + amt = sizeof (struct internal_ldsym); + ldsym = (struct internal_ldsym *) bfd_malloc (amt); - /* - * - * __rtinit initalized here - * Some information, like the location of the .initfini seciton will - * be filled in later - * - * name or offset taken case of below with bfd_xcoff_put_ldsymbol_name - */ - ldsym = (struct internal_ldsym *) - bfd_malloc(sizeof (struct internal_ldsym)); - ldsym->l_value = 0; /* will be filled in later */ ldsym->l_scnum = 2; /* data section */ ldsym->l_smtype = XTY_SD; /* csect section definition */ ldsym->l_smclas = 5; /* .rw */ ldsym->l_ifile = 0; /* special system loader symbol */ ldsym->l_parm = 0; /* NA */ - - /* - * Force __rtinit to be the first symbol in the loader symbol table - * See xcoff_build_ldsyms - * - * The first 3 symbol table indices are reserved to indicate the data, - * text and bss sections. - */ + + /* Force __rtinit to be the first symbol in the loader symbol table + See xcoff_build_ldsyms + + The first 3 symbol table indices are reserved to indicate the data, + text and bss sections. */ BFD_ASSERT (0 == ldinfo.ldsym_count); - + hrtinit->ldindx = 3; ldinfo.ldsym_count = 1; hrtinit->ldsym = ldsym; - + if (false == bfd_xcoff_put_ldsymbol_name (ldinfo.output_bfd, &ldinfo, - hrtinit->ldsym, - hrtinit->root.root.string)) { - return false; - } + hrtinit->ldsym, + hrtinit->root.root.string)) + { + return false; + } - /* - * This symbol is written out by xcoff_write_global_symbol - * Set stuff up so xcoff_write_global_symbol logic works. - */ + /* This symbol is written out by xcoff_write_global_symbol + Set stuff up so xcoff_write_global_symbol logic works. */ hrtinit->flags |= XCOFF_DEF_REGULAR | XCOFF_MARK; hrtinit->root.type = bfd_link_hash_defined; - hrtinit->root.u.def.value = 0; + hrtinit->root.u.def.value = 0; } /* Garbage collect unused sections. */ @@ -2931,22 +2967,24 @@ bfd_xcoff_size_dynamic_sections (output_ } /* Return special sections to the caller. */ - for (i = 0; i < XCOFF_NUMBER_OF_SPECIAL_SECTIONS; i++) { - asection *sec; - - sec = xcoff_hash_table (info)->special_sections[i]; - - if ((sec != NULL) && - (gc && (sec->flags & SEC_MARK) == 0)) { - sec = NULL; + for (i = 0; i < XCOFF_NUMBER_OF_SPECIAL_SECTIONS; i++) + { + sec = xcoff_hash_table (info)->special_sections[i]; + + if (sec != NULL + && gc + && (sec->flags & SEC_MARK) == 0) + { + sec = NULL; + } + special_sections[i] = sec; } - special_sections[i] = sec; - } - if (info->input_bfds == NULL) { - /* I'm not sure what to do in this bizarre case. */ - return true; - } + if (info->input_bfds == NULL) + { + /* I'm not sure what to do in this bizarre case. */ + return true; + } xcoff_link_hash_traverse (xcoff_hash_table (info), xcoff_build_ldsyms, (PTR) &ldinfo); @@ -2987,14 +3025,13 @@ bfd_xcoff_size_dynamic_sections (output_ else ldhdr->l_stoff = stoff; - /* - * 64 bit elements to ldhdr - * The swap out routine for 32 bit will ignore them. - * Nothing fancy, symbols come after the header and relocs come after symbols - */ - ldhdr->l_symoff = bfd_xcoff_ldhdrsz(output_bfd); - ldhdr->l_rldoff = bfd_xcoff_ldhdrsz(output_bfd) + - (ldhdr->l_nsyms * bfd_xcoff_ldsymsz(output_bfd)); + /* 64 bit elements to ldhdr + The swap out routine for 32 bit will ignore them. + Nothing fancy, symbols come after the header and relocs come + after symbols. */ + ldhdr->l_symoff = bfd_xcoff_ldhdrsz (output_bfd); + ldhdr->l_rldoff = (bfd_xcoff_ldhdrsz (output_bfd) + + ldhdr->l_nsyms * bfd_xcoff_ldsymsz (output_bfd)); /* We now know the final size of the .loader section. Allocate space for it. */ @@ -3044,7 +3081,7 @@ bfd_xcoff_size_dynamic_sections (output_ symbols are written out in xcoff_link_input_bfd or xcoff_write_global_symbol. The .loader relocs are written out when the corresponding normal relocs are handled in - xcoff_link_input_bfd. + xcoff_link_input_bfd. */ /* Allocate space for the magic sections. */ @@ -3190,15 +3227,16 @@ xcoff_build_ldsyms (h, p) PTR p; { struct xcoff_loader_info *ldinfo = (struct xcoff_loader_info *) p; - - /* - * __rtinit - * Special handling of this symbol to make is the first symbol in the - * loader symbol table. Make sure this pass through does not undo it - */ - if (h->flags & XCOFF_RTINIT) { - return true; - } + bfd_size_type amt; + + /* __rtinit + Special handling of this symbol to make is the first symbol in + the loader symbol table. Make sure this pass through does not + undo it. */ + if (h->flags & XCOFF_RTINIT) + { + return true; + } /* If this is a final link, and the symbol was defined as a common symbol in a regular object file, and there was no definition in @@ -3305,36 +3343,38 @@ xcoff_build_ldsyms (h, p) || hds->root.type == bfd_link_hash_undefweak) && (hds->flags & XCOFF_DEF_REGULAR) == 0); hds->flags |= XCOFF_MARK; - if (hds->toc_section == NULL) { - int byte_size; + if (hds->toc_section == NULL) + { + int byte_size; - /* - * 32 vs 64 - * xcoff32 uses 4 bytes in the toc - * xcoff64 uses 8 bytes in the toc - */ - if (bfd_xcoff_is_xcoff64(ldinfo->output_bfd)) { - byte_size = 8; - } else if (bfd_xcoff_is_xcoff32(ldinfo->output_bfd)) { - byte_size = 4; - } else { - return false; - } + /* 32 vs 64 + xcoff32 uses 4 bytes in the toc. + xcoff64 uses 8 bytes in the toc. */ + if (bfd_xcoff_is_xcoff64 (ldinfo->output_bfd)) + { + byte_size = 8; + } + else if (bfd_xcoff_is_xcoff32 (ldinfo->output_bfd)) + { + byte_size = 4; + } + else + { + return false; + } - hds->toc_section = xcoff_hash_table (ldinfo->info)->toc_section; - hds->u.toc_offset = hds->toc_section->_raw_size; - hds->toc_section->_raw_size += byte_size; - ++xcoff_hash_table (ldinfo->info)->ldrel_count; - ++hds->toc_section->reloc_count; - hds->indx = -2; - hds->flags |= XCOFF_SET_TOC | XCOFF_LDREL; - - /* - * We need to call xcoff_build_ldsyms recursively here, - * because we may already have passed hds on the traversal. - */ - xcoff_build_ldsyms (hds, p); - } + hds->toc_section = xcoff_hash_table (ldinfo->info)->toc_section; + hds->u.toc_offset = hds->toc_section->_raw_size; + hds->toc_section->_raw_size += byte_size; + ++xcoff_hash_table (ldinfo->info)->ldrel_count; + ++hds->toc_section->reloc_count; + hds->indx = -2; + hds->flags |= XCOFF_SET_TOC | XCOFF_LDREL; + + /* We need to call xcoff_build_ldsyms recursively here, + because we may already have passed hds on the traversal. */ + xcoff_build_ldsyms (hds, p); + } } /* If this symbol is exported, but not defined, we need to try to @@ -3364,24 +3404,18 @@ xcoff_build_ldsyms (h, p) h->smclas = XMC_DS; h->flags |= XCOFF_DEF_REGULAR; - /* - * The size of the function descriptor depends if this is an - * xcoff32 (12) or xcoff64 (24) - */ - sec->_raw_size += + /* The size of the function descriptor depends if this is an + xcoff32 (12) or xcoff64 (24). */ + sec->_raw_size += bfd_xcoff_function_descriptor_size(ldinfo->output_bfd); - /* - * A function descriptor uses two relocs: one for the - * associated code, and one for the TOC address. - */ + /* A function descriptor uses two relocs: one for the + associated code, and one for the TOC address. */ xcoff_hash_table (ldinfo->info)->ldrel_count += 2; sec->reloc_count += 2; - /* - * We handle writing out the contents of the descriptor in - * xcoff_write_global_symbol. - */ + /* We handle writing out the contents of the descriptor in + xcoff_write_global_symbol. */ } else { @@ -3438,9 +3472,8 @@ xcoff_build_ldsyms (h, p) /* We need to add this symbol to the .loader symbols. */ BFD_ASSERT (h->ldsym == NULL); - h->ldsym = ((struct internal_ldsym *) - bfd_zalloc (ldinfo->output_bfd, - sizeof (struct internal_ldsym))); + amt = sizeof (struct internal_ldsym); + h->ldsym = (struct internal_ldsym *) bfd_zalloc (ldinfo->output_bfd, amt); if (h->ldsym == NULL) { ldinfo->failed = true; @@ -3450,19 +3483,18 @@ xcoff_build_ldsyms (h, p) if ((h->flags & XCOFF_IMPORT) != 0) h->ldsym->l_ifile = h->ldindx; - /* - * The first 3 symbol table indices are reserved to indicate the data, - * text and bss sections. - */ + /* The first 3 symbol table indices are reserved to indicate the + data, text and bss sections. */ h->ldindx = ldinfo->ldsym_count + 3; ++ldinfo->ldsym_count; if (false == bfd_xcoff_put_ldsymbol_name (ldinfo->output_bfd, ldinfo, - h->ldsym, - h->root.root.string)) { - return false; - } + h->ldsym, + h->root.root.string)) + { + return false; + } h->flags |= XCOFF_BUILT_LDSYM; @@ -3480,11 +3512,11 @@ _bfd_xcoff_bfd_final_link (abfd, info) struct xcoff_final_link_info finfo; asection *o; struct bfd_link_order *p; - size_t max_contents_size; - size_t max_sym_count; - size_t max_lineno_count; - size_t max_reloc_count; - size_t max_output_reloc_count; + bfd_size_type max_contents_size; + bfd_size_type max_sym_count; + bfd_size_type max_lineno_count; + bfd_size_type max_reloc_count; + bfd_size_type max_output_reloc_count; file_ptr rel_filepos; unsigned int relsz; file_ptr line_filepos; @@ -3492,6 +3524,8 @@ _bfd_xcoff_bfd_final_link (abfd, info) bfd *sub; bfd_byte *external_relocs = NULL; char strbuf[STRING_SIZE_SIZE]; + file_ptr pos; + bfd_size_type amt; if (info->shared) abfd->flags |= DYNAMIC; @@ -3511,11 +3545,12 @@ _bfd_xcoff_bfd_final_link (abfd, info) finfo.contents = NULL; finfo.external_relocs = NULL; - finfo.ldsym = xcoff_hash_table (info)->loader_section->contents + - bfd_xcoff_ldhdrsz(abfd); - finfo.ldrel = xcoff_hash_table (info)->loader_section->contents + - bfd_xcoff_ldhdrsz(abfd) + - xcoff_hash_table (info)->ldhdr.l_nsyms * bfd_xcoff_ldsymsz(abfd); + finfo.ldsym = (xcoff_hash_table (info)->loader_section->contents + + bfd_xcoff_ldhdrsz (abfd)); + finfo.ldrel = (xcoff_hash_table (info)->loader_section->contents + + bfd_xcoff_ldhdrsz(abfd) + + (xcoff_hash_table (info)->ldhdr.l_nsyms + * bfd_xcoff_ldsymsz(abfd))); xcoff_data (abfd)->coff.link_info = info; @@ -3635,16 +3670,14 @@ _bfd_xcoff_bfd_final_link (abfd, info) sofar = bfd_coff_filhsz (abfd); sofar += bfd_coff_aoutsz (abfd); sofar += abfd->section_count * bfd_coff_scnhsz (abfd); - for (o = abfd->sections; o != NULL; o = o->next) { - if ((true == - bfd_xcoff_is_reloc_count_overflow(abfd, o->reloc_count)) || - (true == - bfd_xcoff_is_lineno_count_overflow(abfd, o->lineno_count))) { - + for (o = abfd->sections; o != NULL; o = o->next) + if ((bfd_xcoff_is_reloc_count_overflow + (abfd, (bfd_vma) o->reloc_count)) + || (bfd_xcoff_is_lineno_count_overflow + (abfd, (bfd_vma) o->lineno_count))) /* 64 does not overflow, need to check if 32 does */ sofar += bfd_coff_scnhsz (abfd); - } - } + for (o = abfd->sections; o != NULL; o = o->next) { if (strcmp (o->name, ".pad") == 0) @@ -3679,10 +3712,9 @@ _bfd_xcoff_bfd_final_link (abfd, info) /* We use section_count + 1, rather than section_count, because the target_index fields are 1 based. */ - finfo.section_info = - ((struct xcoff_link_section_info *) - bfd_malloc ((abfd->section_count + 1) - * sizeof (struct xcoff_link_section_info))); + amt = abfd->section_count + 1; + amt *= sizeof (struct xcoff_link_section_info); + finfo.section_info = (struct xcoff_link_section_info *) bfd_malloc (amt); if (finfo.section_info == NULL) goto error_return; for (i = 0; i <= abfd->section_count; i++) @@ -3728,13 +3760,16 @@ _bfd_xcoff_bfd_final_link (abfd, info) memory until the end of the link. This wastes memory. We could backpatch the file later, I suppose, although it would be slow. */ + amt = o->reloc_count; + amt *= sizeof (struct internal_reloc); finfo.section_info[o->target_index].relocs = - ((struct internal_reloc *) - bfd_malloc (o->reloc_count * sizeof (struct internal_reloc))); + (struct internal_reloc *) bfd_malloc (amt); + + amt = o->reloc_count; + amt *= sizeof (struct xcoff_link_hash_entry *); finfo.section_info[o->target_index].rel_hashes = - ((struct xcoff_link_hash_entry **) - bfd_malloc (o->reloc_count - * sizeof (struct xcoff_link_hash_entry *))); + (struct xcoff_link_hash_entry **) bfd_malloc (amt); + if (finfo.section_info[o->target_index].relocs == NULL || finfo.section_info[o->target_index].rel_hashes == NULL) goto error_return; @@ -3774,7 +3809,7 @@ _bfd_xcoff_bfd_final_link (abfd, info) max_sym_count = 6; for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) { - size_t sz; + bfd_size_type sz; sub->output_has_begun = false; sz = obj_raw_syment_count (sub); @@ -3783,17 +3818,24 @@ _bfd_xcoff_bfd_final_link (abfd, info) } /* Allocate some buffers used while linking. */ - finfo.internal_syms = ((struct internal_syment *) - bfd_malloc (max_sym_count - * sizeof (struct internal_syment))); - - finfo.sym_indices = (long *) bfd_malloc (max_sym_count * sizeof (long)); - finfo.outsyms = ((bfd_byte *) - bfd_malloc ((size_t) ((max_sym_count + 1) * symesz))); - finfo.linenos = (bfd_byte *) bfd_malloc (max_lineno_count - * bfd_coff_linesz (abfd)); - finfo.contents = (bfd_byte *) bfd_malloc (max_contents_size); - finfo.external_relocs = (bfd_byte *) bfd_malloc (max_reloc_count * relsz); + amt = max_sym_count * sizeof (struct internal_syment); + finfo.internal_syms = (struct internal_syment *) bfd_malloc (amt); + + amt = max_sym_count * sizeof (long); + finfo.sym_indices = (long *) bfd_malloc (amt); + + amt = (max_sym_count + 1) * symesz; + finfo.outsyms = (bfd_byte *) bfd_malloc (amt); + + amt = max_lineno_count * bfd_coff_linesz (abfd); + finfo.linenos = (bfd_byte *) bfd_malloc (amt); + + amt = max_contents_size; + finfo.contents = (bfd_byte *) bfd_malloc (amt); + + amt = max_reloc_count * relsz; + finfo.external_relocs = (bfd_byte *) bfd_malloc (amt); + if ((finfo.internal_syms == NULL && max_sym_count > 0) || (finfo.sym_indices == NULL && max_sym_count > 0) || finfo.outsyms == NULL @@ -3842,49 +3884,54 @@ _bfd_xcoff_bfd_final_link (abfd, info) /* Free up the buffers used by xcoff_link_input_bfd. */ - if (finfo.internal_syms != NULL) { - free (finfo.internal_syms); - finfo.internal_syms = NULL; - } - if (finfo.sym_indices != NULL) { - free (finfo.sym_indices); - finfo.sym_indices = NULL; - } - if (finfo.linenos != NULL) { - free (finfo.linenos); - finfo.linenos = NULL; - } - if (finfo.contents != NULL) { - free (finfo.contents); - finfo.contents = NULL; - } - if (finfo.external_relocs != NULL) { - free (finfo.external_relocs); - finfo.external_relocs = NULL; - } + if (finfo.internal_syms != NULL) + { + free (finfo.internal_syms); + finfo.internal_syms = NULL; + } + if (finfo.sym_indices != NULL) + { + free (finfo.sym_indices); + finfo.sym_indices = NULL; + } + if (finfo.linenos != NULL) + { + free (finfo.linenos); + finfo.linenos = NULL; + } + if (finfo.contents != NULL) + { + free (finfo.contents); + finfo.contents = NULL; + } + if (finfo.external_relocs != NULL) + { + free (finfo.external_relocs); + finfo.external_relocs = NULL; + } /* The value of the last C_FILE symbol is supposed to be -1. Write it out again. */ - if (finfo.last_file_index != -1) { - finfo.last_file.n_value = -1; - bfd_coff_swap_sym_out (abfd, (PTR) &finfo.last_file, - (PTR) finfo.outsyms); - if (bfd_seek (abfd, - (obj_sym_filepos (abfd) - + finfo.last_file_index * symesz), - SEEK_SET) != 0 - || bfd_write (finfo.outsyms, symesz, 1, abfd) != symesz) - goto error_return; - } + if (finfo.last_file_index != -1) + { + finfo.last_file.n_value = -(bfd_vma) 1; + bfd_coff_swap_sym_out (abfd, (PTR) &finfo.last_file, + (PTR) finfo.outsyms); + pos = obj_sym_filepos (abfd) + finfo.last_file_index * symesz; + if (bfd_seek (abfd, pos, SEEK_SET) != 0 + || bfd_bwrite (finfo.outsyms, symesz, abfd) != symesz) + goto error_return; + } /* init-fini */ - if (info->init_function || info->fini_function) { - struct xcoff_link_hash_entry *hrtinit; + if (info->init_function || info->fini_function) + { + struct xcoff_link_hash_entry *hrtinit; - hrtinit = xcoff_link_hash_lookup (xcoff_hash_table (info), - "__rtinit", - false, false, true); - } + hrtinit = xcoff_link_hash_lookup (xcoff_hash_table (info), + "__rtinit", + false, false, true); + } /* Write out all the global symbols which do not come from XCOFF @@ -3902,132 +3949,145 @@ _bfd_xcoff_bfd_final_link (abfd, info) /* Now that we have written out all the global symbols, we know the symbol indices to use for relocs against them, and we can finally write out the relocs. */ - external_relocs = (bfd_byte *) bfd_malloc (max_output_reloc_count * relsz); + amt = max_output_reloc_count * relsz; + external_relocs = (bfd_byte *) bfd_malloc (amt); if (external_relocs == NULL && max_output_reloc_count != 0) goto error_return; - for (o = abfd->sections; o != NULL; o = o->next) { - struct internal_reloc *irel; - struct internal_reloc *irelend; - struct xcoff_link_hash_entry **rel_hash; - struct xcoff_toc_rel_hash *toc_rel_hash; - bfd_byte *erel; - - /* A stripped file has no relocs. */ - if (info->strip == strip_all) { - o->reloc_count = 0; - continue; - } - - if (o->reloc_count == 0) - continue; - - irel = finfo.section_info[o->target_index].relocs; - irelend = irel + o->reloc_count; - rel_hash = finfo.section_info[o->target_index].rel_hashes; - for (; irel < irelend; irel++, rel_hash++, erel += relsz) { - if (*rel_hash != NULL) { - if ((*rel_hash)->indx < 0) { - if (! ((*info->callbacks->unattached_reloc) - (info, (*rel_hash)->root.root.string, - (bfd *) NULL, o, irel->r_vaddr))) - goto error_return; - (*rel_hash)->indx = 0; + for (o = abfd->sections; o != NULL; o = o->next) + { + struct internal_reloc *irel; + struct internal_reloc *irelend; + struct xcoff_link_hash_entry **rel_hash; + struct xcoff_toc_rel_hash *toc_rel_hash; + bfd_byte *erel; + bfd_size_type rel_size; + + /* A stripped file has no relocs. */ + if (info->strip == strip_all) + { + o->reloc_count = 0; + continue; } - irel->r_symndx = (*rel_hash)->indx; - } - } - for (toc_rel_hash = finfo.section_info[o->target_index].toc_rel_hashes; - toc_rel_hash != NULL; - toc_rel_hash = toc_rel_hash->next) { - if (toc_rel_hash->h->u.toc_indx < 0) { - if (! ((*info->callbacks->unattached_reloc) - (info, toc_rel_hash->h->root.root.string, - (bfd *) NULL, o, toc_rel_hash->rel->r_vaddr))) - goto error_return; - toc_rel_hash->h->u.toc_indx = 0; - } - toc_rel_hash->rel->r_symndx = toc_rel_hash->h->u.toc_indx; - } + if (o->reloc_count == 0) + continue; - /* XCOFF requires that the relocs be sorted by address. We tend - to produce them in the order in which their containing csects - appear in the symbol table, which is not necessarily by - address. So we sort them here. There may be a better way to - do this. */ - qsort ((PTR) finfo.section_info[o->target_index].relocs, - o->reloc_count, sizeof (struct internal_reloc), - xcoff_sort_relocs); - - irel = finfo.section_info[o->target_index].relocs; - irelend = irel + o->reloc_count; - erel = external_relocs; - for (; irel < irelend; irel++, rel_hash++, erel += relsz) - bfd_coff_swap_reloc_out (abfd, (PTR) irel, (PTR) erel); - - if (bfd_seek (abfd, o->rel_filepos, SEEK_SET) != 0 - || bfd_write ((PTR) external_relocs, relsz, o->reloc_count, - abfd) != relsz * o->reloc_count) - goto error_return; - } + irel = finfo.section_info[o->target_index].relocs; + irelend = irel + o->reloc_count; + rel_hash = finfo.section_info[o->target_index].rel_hashes; + for (; irel < irelend; irel++, rel_hash++, erel += relsz) + { + if (*rel_hash != NULL) + { + if ((*rel_hash)->indx < 0) + { + if (! ((*info->callbacks->unattached_reloc) + (info, (*rel_hash)->root.root.string, + (bfd *) NULL, o, irel->r_vaddr))) + goto error_return; + (*rel_hash)->indx = 0; + } + irel->r_symndx = (*rel_hash)->indx; + } + } - if (external_relocs != NULL) { - free (external_relocs); - external_relocs = NULL; - } + for (toc_rel_hash = finfo.section_info[o->target_index].toc_rel_hashes; + toc_rel_hash != NULL; + toc_rel_hash = toc_rel_hash->next) + { + if (toc_rel_hash->h->u.toc_indx < 0) + { + if (! ((*info->callbacks->unattached_reloc) + (info, toc_rel_hash->h->root.root.string, + (bfd *) NULL, o, toc_rel_hash->rel->r_vaddr))) + goto error_return; + toc_rel_hash->h->u.toc_indx = 0; + } + toc_rel_hash->rel->r_symndx = toc_rel_hash->h->u.toc_indx; + } + + /* XCOFF requires that the relocs be sorted by address. We tend + to produce them in the order in which their containing csects + appear in the symbol table, which is not necessarily by + address. So we sort them here. There may be a better way to + do this. */ + qsort ((PTR) finfo.section_info[o->target_index].relocs, + o->reloc_count, sizeof (struct internal_reloc), + xcoff_sort_relocs); + + irel = finfo.section_info[o->target_index].relocs; + irelend = irel + o->reloc_count; + erel = external_relocs; + for (; irel < irelend; irel++, rel_hash++, erel += relsz) + bfd_coff_swap_reloc_out (abfd, (PTR) irel, (PTR) erel); + + rel_size = relsz * o->reloc_count; + if (bfd_seek (abfd, o->rel_filepos, SEEK_SET) != 0 + || bfd_bwrite ((PTR) external_relocs, rel_size, abfd) != rel_size) + goto error_return; + } + + if (external_relocs != NULL) + { + free (external_relocs); + external_relocs = NULL; + } /* Free up the section information. */ - if (finfo.section_info != NULL) { - unsigned int i; + if (finfo.section_info != NULL) + { + unsigned int i; - for (i = 0; i < abfd->section_count; i++) { - if (finfo.section_info[i].relocs != NULL) - free (finfo.section_info[i].relocs); - if (finfo.section_info[i].rel_hashes != NULL) - free (finfo.section_info[i].rel_hashes); + for (i = 0; i < abfd->section_count; i++) + { + if (finfo.section_info[i].relocs != NULL) + free (finfo.section_info[i].relocs); + if (finfo.section_info[i].rel_hashes != NULL) + free (finfo.section_info[i].rel_hashes); + } + free (finfo.section_info); + finfo.section_info = NULL; } - free (finfo.section_info); - finfo.section_info = NULL; - } /* Write out the loader section contents. */ BFD_ASSERT ((bfd_byte *) finfo.ldrel == (xcoff_hash_table (info)->loader_section->contents + xcoff_hash_table (info)->ldhdr.l_impoff)); o = xcoff_hash_table (info)->loader_section; - if (! bfd_set_section_contents (abfd, o->output_section, - o->contents, o->output_offset, - o->_raw_size)) + if (! bfd_set_section_contents (abfd, o->output_section, o->contents, + (file_ptr) o->output_offset, o->_raw_size)) goto error_return; /* Write out the magic sections. */ o = xcoff_hash_table (info)->linkage_section; if (o->_raw_size > 0 && ! bfd_set_section_contents (abfd, o->output_section, o->contents, - o->output_offset, o->_raw_size)) + (file_ptr) o->output_offset, + o->_raw_size)) goto error_return; o = xcoff_hash_table (info)->toc_section; if (o->_raw_size > 0 && ! bfd_set_section_contents (abfd, o->output_section, o->contents, - o->output_offset, o->_raw_size)) + (file_ptr) o->output_offset, + o->_raw_size)) goto error_return; o = xcoff_hash_table (info)->descriptor_section; if (o->_raw_size > 0 && ! bfd_set_section_contents (abfd, o->output_section, o->contents, - o->output_offset, o->_raw_size)) + (file_ptr) o->output_offset, + o->_raw_size)) goto error_return; /* Write out the string table. */ - if (bfd_seek (abfd, - (obj_sym_filepos (abfd) - + obj_raw_syment_count (abfd) * symesz), - SEEK_SET) != 0) + pos = obj_sym_filepos (abfd) + obj_raw_syment_count (abfd) * symesz; + if (bfd_seek (abfd, pos, SEEK_SET) != 0) goto error_return; - bfd_h_put_32 (abfd, - _bfd_stringtab_size (finfo.strtab) + STRING_SIZE_SIZE, - (bfd_byte *) strbuf); - if (bfd_write (strbuf, 1, STRING_SIZE_SIZE, abfd) != STRING_SIZE_SIZE) + H_PUT_32 (abfd, + _bfd_stringtab_size (finfo.strtab) + STRING_SIZE_SIZE, + strbuf); + amt = STRING_SIZE_SIZE; + if (bfd_bwrite (strbuf, amt, abfd) != amt) goto error_return; if (! _bfd_stringtab_emit (abfd, finfo.strtab)) goto error_return; @@ -4036,42 +4096,44 @@ _bfd_xcoff_bfd_final_link (abfd, info) /* Write out the debugging string table. */ o = xcoff_hash_table (info)->debug_section; - if (o != NULL) { - struct bfd_strtab_hash *debug_strtab; - - debug_strtab = xcoff_hash_table (info)->debug_strtab; - BFD_ASSERT (o->output_section->_raw_size - o->output_offset - >= _bfd_stringtab_size (debug_strtab)); - if (bfd_seek (abfd, - o->output_section->filepos + o->output_offset, - SEEK_SET) != 0) - goto error_return; - if (! _bfd_stringtab_emit (abfd, debug_strtab)) - goto error_return; - } - + if (o != NULL) + { + struct bfd_strtab_hash *debug_strtab; + + debug_strtab = xcoff_hash_table (info)->debug_strtab; + BFD_ASSERT (o->output_section->_raw_size - o->output_offset + >= _bfd_stringtab_size (debug_strtab)); + pos = o->output_section->filepos + o->output_offset; + if (bfd_seek (abfd, pos, SEEK_SET) != 0) + goto error_return; + if (! _bfd_stringtab_emit (abfd, debug_strtab)) + goto error_return; + } + /* Setting bfd_get_symcount to 0 will cause write_object_contents to not try to write out the symbols. */ bfd_get_symcount (abfd) = 0; - + return true; error_return: if (finfo.strtab != NULL) _bfd_stringtab_free (finfo.strtab); - - if (finfo.section_info != NULL) { - unsigned int i; - - for (i = 0; i < abfd->section_count; i++) { - if (finfo.section_info[i].relocs != NULL) - free (finfo.section_info[i].relocs); - if (finfo.section_info[i].rel_hashes != NULL) - free (finfo.section_info[i].rel_hashes); + + if (finfo.section_info != NULL) + { + unsigned int i; + + for (i = 0; i < abfd->section_count; i++) + { + if (finfo.section_info[i].relocs != NULL) + free (finfo.section_info[i].relocs); + if (finfo.section_info[i].rel_hashes != NULL) + free (finfo.section_info[i].rel_hashes); + } + free (finfo.section_info); } - free (finfo.section_info); - } - + if (finfo.internal_syms != NULL) free (finfo.internal_syms); if (finfo.sym_indices != NULL) @@ -4272,17 +4334,19 @@ xcoff_link_input_bfd (finfo, input_bfd) BFD_ASSERT (h->ldindx >= 0); bfd_xcoff_swap_ldsym_out (finfo->output_bfd, ldsym, - finfo->ldsym + (h->ldindx - 3) * - bfd_xcoff_ldsymsz(finfo->output_bfd)); + (finfo->ldsym + + ((h->ldindx - 3) + * bfd_xcoff_ldsymsz (finfo->output_bfd)))); h->ldsym = NULL; /* Fill in snentry now that we know the target_index. */ - if ((h->flags & XCOFF_ENTRY) != 0 && - (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak)) { - xcoff_data (output_bfd)->snentry = - h->root.u.def.section->output_section->target_index; - } + if ((h->flags & XCOFF_ENTRY) != 0 + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak)) + { + xcoff_data (output_bfd)->snentry = + h->root.u.def.section->output_section->target_index; + } } *indexp = -1; @@ -4337,7 +4401,6 @@ xcoff_link_input_bfd (finfo, input_bfd) inp != NULL; inp = inp->link_next) { - asection *o; for (o = inp->sections; o != NULL; o = o->next) if (strcmp (o->name, ".tocbss") == 0) @@ -4375,7 +4438,7 @@ xcoff_link_input_bfd (finfo, input_bfd) xcoff_data (finfo->output_bfd)->sntoc = (*csectpp)->output_section->target_index; require = true; - + } } @@ -4520,14 +4583,16 @@ xcoff_link_input_bfd (finfo, input_bfd) /* We have already written out the last C_FILE symbol. We need to write it out again. We borrow *outsym temporarily. */ + file_ptr pos; + bfd_coff_swap_sym_out (output_bfd, (PTR) &finfo->last_file, (PTR) outsym); - if (bfd_seek (output_bfd, - (obj_sym_filepos (output_bfd) - + finfo->last_file_index * osymesz), - SEEK_SET) != 0 - || (bfd_write (outsym, osymesz, 1, output_bfd) + + pos = obj_sym_filepos (output_bfd); + pos += finfo->last_file_index * osymesz; + if (bfd_seek (output_bfd, pos, SEEK_SET) != 0 + || (bfd_bwrite (outsym, osymesz, output_bfd) != osymesz)) return false; } @@ -4692,20 +4757,22 @@ xcoff_link_input_bfd (finfo, input_bfd) if (SMTYP_SMTYP (aux.x_csect.x_smtyp) == XTY_LD) { - bfd_signed_vma indx; + unsigned long indx; - - indx = aux.x_csect.x_scnlen.l; + indx = aux.x_csect.x_scnlen.l; if (indx < obj_raw_syment_count (input_bfd)) { long symindx; symindx = finfo->sym_indices[indx]; - if (symindx < 0) { - aux.x_csect.x_scnlen.l = 0; - } else { - aux.x_csect.x_scnlen.l = symindx; - } + if (symindx < 0) + { + aux.x_csect.x_scnlen.l = 0; + } + else + { + aux.x_csect.x_scnlen.l = symindx; + } } } } @@ -4777,12 +4844,11 @@ xcoff_link_input_bfd (finfo, input_bfd) enc_count = xcoff_section_data (abfd, o)->lineno_count; if (oline != enclosing) { - if (bfd_seek (input_bfd, - enclosing->line_filepos, - SEEK_SET) != 0 - || (bfd_read (finfo->linenos, linesz, - enc_count, input_bfd) - != linesz * enc_count)) + file_ptr pos = enclosing->line_filepos; + bfd_size_type amt = linesz * enc_count; + if (bfd_seek (input_bfd, pos, SEEK_SET) != 0 + || (bfd_bread (finfo->linenos, amt, input_bfd) + != amt)) return false; oline = enclosing; } @@ -4840,8 +4906,8 @@ xcoff_link_input_bfd (finfo, input_bfd) if (bfd_seek (output_bfd, aux.x_sym.x_fcnary.x_fcn.x_lnnoptr, SEEK_SET) != 0 - || (bfd_write (finfo->linenos + linoff, - linesz, count, output_bfd) + || (bfd_bwrite (finfo->linenos + linoff, + linesz * count, output_bfd) != linesz * count)) return false; @@ -4930,12 +4996,10 @@ xcoff_link_input_bfd (finfo, input_bfd) /* Write the modified symbols to the output file. */ if (outsym > finfo->outsyms) { - if (bfd_seek (output_bfd, - obj_sym_filepos (output_bfd) + syment_base * osymesz, - SEEK_SET) != 0 - || (bfd_write (finfo->outsyms, outsym - finfo->outsyms, 1, - output_bfd) - != (bfd_size_type) (outsym - finfo->outsyms))) + file_ptr pos = obj_sym_filepos (output_bfd) + syment_base * osymesz; + bfd_size_type amt = outsym - finfo->outsyms; + if (bfd_seek (output_bfd, pos, SEEK_SET) != 0 + || bfd_bwrite (finfo->outsyms, amt, output_bfd) != amt) return false; BFD_ASSERT ((obj_raw_syment_count (output_bfd) @@ -4950,317 +5014,322 @@ xcoff_link_input_bfd (finfo, input_bfd) obj_coff_keep_syms (input_bfd) = true; /* Relocate the contents of each section. */ - for (o = input_bfd->sections; o != NULL; o = o->next) { - - bfd_byte *contents; - - if (! o->linker_mark){ - /* This section was omitted from the link. */ - continue; - } - - if ((o->flags & SEC_HAS_CONTENTS) == 0 - || o->_raw_size == 0 - || (o->flags & SEC_IN_MEMORY) != 0) - continue; - - /* We have set filepos correctly for the sections we created to - represent csects, so bfd_get_section_contents should work. */ - if (coff_section_data (input_bfd, o) != NULL - && coff_section_data (input_bfd, o)->contents != NULL) - contents = coff_section_data (input_bfd, o)->contents; - else { - if (! bfd_get_section_contents (input_bfd, o, finfo->contents, - (file_ptr) 0, o->_raw_size)) - return false; - contents = finfo->contents; - } + for (o = input_bfd->sections; o != NULL; o = o->next) + { - if ((o->flags & SEC_RELOC) != 0) { - int target_index; - struct internal_reloc *internal_relocs; - struct internal_reloc *irel; - bfd_vma offset; - struct internal_reloc *irelend; - struct xcoff_link_hash_entry **rel_hash; - long r_symndx; - - /* Read in the relocs. */ - target_index = o->output_section->target_index; - internal_relocs = (xcoff_read_internal_relocs - (input_bfd, o, false, finfo->external_relocs, - true, - (finfo->section_info[target_index].relocs - + o->output_section->reloc_count))); - if (internal_relocs == NULL) - return false; + bfd_byte *contents; - /* Call processor specific code to relocate the section - contents. */ - if (! bfd_coff_relocate_section (output_bfd, finfo->info, - input_bfd, o, - contents, - internal_relocs, - finfo->internal_syms, - xcoff_data (input_bfd)->csects)) - return false; + if (! o->linker_mark) + { + /* This section was omitted from the link. */ + continue; + } - offset = o->output_section->vma + o->output_offset - o->vma; - irel = internal_relocs; - irelend = irel + o->reloc_count; - rel_hash = (finfo->section_info[target_index].rel_hashes - + o->output_section->reloc_count); - for (; irel < irelend; irel++, rel_hash++) { - struct xcoff_link_hash_entry *h = NULL; - struct internal_ldrel ldrel; - boolean quiet; + if ((o->flags & SEC_HAS_CONTENTS) == 0 + || o->_raw_size == 0 + || (o->flags & SEC_IN_MEMORY) != 0) + continue; - *rel_hash = NULL; + /* We have set filepos correctly for the sections we created to + represent csects, so bfd_get_section_contents should work. */ + if (coff_section_data (input_bfd, o) != NULL + && coff_section_data (input_bfd, o)->contents != NULL) + contents = coff_section_data (input_bfd, o)->contents; + else { + if (! bfd_get_section_contents (input_bfd, o, finfo->contents, + (file_ptr) 0, o->_raw_size)) + return false; + contents = finfo->contents; + } - /* Adjust the reloc address and symbol index. */ + if ((o->flags & SEC_RELOC) != 0) + { + int target_index; + struct internal_reloc *internal_relocs; + struct internal_reloc *irel; + bfd_vma offset; + struct internal_reloc *irelend; + struct xcoff_link_hash_entry **rel_hash; + long r_symndx; + + /* Read in the relocs. */ + target_index = o->output_section->target_index; + internal_relocs = (xcoff_read_internal_relocs + (input_bfd, o, false, finfo->external_relocs, + true, + (finfo->section_info[target_index].relocs + + o->output_section->reloc_count))); + if (internal_relocs == NULL) + return false; - irel->r_vaddr += offset; + /* Call processor specific code to relocate the section + contents. */ + if (! bfd_coff_relocate_section (output_bfd, finfo->info, + input_bfd, o, + contents, + internal_relocs, + finfo->internal_syms, + xcoff_data (input_bfd)->csects)) + return false; - r_symndx = irel->r_symndx; + offset = o->output_section->vma + o->output_offset - o->vma; + irel = internal_relocs; + irelend = irel + o->reloc_count; + rel_hash = (finfo->section_info[target_index].rel_hashes + + o->output_section->reloc_count); + for (; irel < irelend; irel++, rel_hash++) + { + struct xcoff_link_hash_entry *h = NULL; + struct internal_ldrel ldrel; + boolean quiet; - if (r_symndx == -1) - h = NULL; - else - h = obj_xcoff_sym_hashes (input_bfd)[r_symndx]; + *rel_hash = NULL; - if (r_symndx != -1 && finfo->info->strip != strip_all) - { - if (h != NULL - && h->smclas != XMC_TD - && (irel->r_type == R_TOC - || irel->r_type == R_GL - || irel->r_type == R_TCL - || irel->r_type == R_TRL - || irel->r_type == R_TRLA)) - { - /* This is a TOC relative reloc with a symbol - attached. The symbol should be the one which - this reloc is for. We want to make this - reloc against the TOC address of the symbol, - not the symbol itself. */ - BFD_ASSERT (h->toc_section != NULL); - BFD_ASSERT ((h->flags & XCOFF_SET_TOC) == 0); - if (h->u.toc_indx != -1) - irel->r_symndx = h->u.toc_indx; - else - { - struct xcoff_toc_rel_hash *n; - struct xcoff_link_section_info *si; + /* Adjust the reloc address and symbol index. */ - n = ((struct xcoff_toc_rel_hash *) - bfd_alloc (finfo->output_bfd, - sizeof (struct xcoff_toc_rel_hash))); - if (n == NULL) - return false; - si = finfo->section_info + target_index; - n->next = si->toc_rel_hashes; - n->h = h; - n->rel = irel; - si->toc_rel_hashes = n; - } - } - else if (h != NULL) - { - /* This is a global symbol. */ - if (h->indx >= 0) - irel->r_symndx = h->indx; - else - { - /* This symbol is being written at the end - of the file, and we do not yet know the - symbol index. We save the pointer to the - hash table entry in the rel_hash list. - We set the indx field to -2 to indicate - that this symbol must not be stripped. */ - *rel_hash = h; - h->indx = -2; - } - } - else - { - long indx; + irel->r_vaddr += offset; - indx = finfo->sym_indices[r_symndx]; + r_symndx = irel->r_symndx; - if (indx == -1) - { - struct internal_syment *is; + if (r_symndx == -1) + h = NULL; + else + h = obj_xcoff_sym_hashes (input_bfd)[r_symndx]; - /* Relocations against a TC0 TOC anchor are - automatically transformed to be against - the TOC anchor in the output file. */ - is = finfo->internal_syms + r_symndx; - if (is->n_sclass == C_HIDEXT - && is->n_numaux > 0) - { - PTR auxptr; - union internal_auxent aux; + if (r_symndx != -1 && finfo->info->strip != strip_all) + { + if (h != NULL + && h->smclas != XMC_TD + && (irel->r_type == R_TOC + || irel->r_type == R_GL + || irel->r_type == R_TCL + || irel->r_type == R_TRL + || irel->r_type == R_TRLA)) + { + /* This is a TOC relative reloc with a symbol + attached. The symbol should be the one which + this reloc is for. We want to make this + reloc against the TOC address of the symbol, + not the symbol itself. */ + BFD_ASSERT (h->toc_section != NULL); + BFD_ASSERT ((h->flags & XCOFF_SET_TOC) == 0); + if (h->u.toc_indx != -1) + irel->r_symndx = h->u.toc_indx; + else + { + struct xcoff_toc_rel_hash *n; + struct xcoff_link_section_info *si; + bfd_size_type amt; + + amt = sizeof (struct xcoff_toc_rel_hash); + n = ((struct xcoff_toc_rel_hash *) + bfd_alloc (finfo->output_bfd, amt)); + if (n == NULL) + return false; + si = finfo->section_info + target_index; + n->next = si->toc_rel_hashes; + n->h = h; + n->rel = irel; + si->toc_rel_hashes = n; + } + } + else if (h != NULL) + { + /* This is a global symbol. */ + if (h->indx >= 0) + irel->r_symndx = h->indx; + else + { + /* This symbol is being written at the end + of the file, and we do not yet know the + symbol index. We save the pointer to the + hash table entry in the rel_hash list. + We set the indx field to -2 to indicate + that this symbol must not be stripped. */ + *rel_hash = h; + h->indx = -2; + } + } + else + { + long indx; - auxptr = ((PTR) - (((bfd_byte *) - obj_coff_external_syms (input_bfd)) - + ((r_symndx + is->n_numaux) - * isymesz))); - bfd_coff_swap_aux_in (input_bfd, auxptr, - is->n_type, is->n_sclass, - is->n_numaux - 1, - is->n_numaux, - (PTR) &aux); - if (SMTYP_SMTYP (aux.x_csect.x_smtyp) == XTY_SD - && aux.x_csect.x_smclas == XMC_TC0) - indx = finfo->toc_symindx; - } - } + indx = finfo->sym_indices[r_symndx]; - if (indx != -1) - irel->r_symndx = indx; - else - { + if (indx == -1) + { + struct internal_syment *is; + + /* Relocations against a TC0 TOC anchor are + automatically transformed to be against + the TOC anchor in the output file. */ + is = finfo->internal_syms + r_symndx; + if (is->n_sclass == C_HIDEXT + && is->n_numaux > 0) + { + PTR auxptr; + union internal_auxent aux; + + auxptr = ((PTR) + (((bfd_byte *) + obj_coff_external_syms (input_bfd)) + + ((r_symndx + is->n_numaux) + * isymesz))); + bfd_coff_swap_aux_in (input_bfd, auxptr, + is->n_type, is->n_sclass, + is->n_numaux - 1, + is->n_numaux, + (PTR) &aux); + if (SMTYP_SMTYP (aux.x_csect.x_smtyp) == XTY_SD + && aux.x_csect.x_smclas == XMC_TC0) + indx = finfo->toc_symindx; + } + } - struct internal_syment *is; + if (indx != -1) + irel->r_symndx = indx; + else + { - const char *name; - char buf[SYMNMLEN + 1]; + struct internal_syment *is; - /* This reloc is against a symbol we are - stripping. It would be possible to handle - this case, but I don't think it's worth it. */ - is = finfo->internal_syms + r_symndx; + const char *name; + char buf[SYMNMLEN + 1]; - name = (_bfd_coff_internal_syment_name - (input_bfd, is, buf)); + /* This reloc is against a symbol we are + stripping. It would be possible to handle + this case, but I don't think it's worth it. */ + is = finfo->internal_syms + r_symndx; - if (name == NULL) - return false; + name = (_bfd_coff_internal_syment_name + (input_bfd, is, buf)); - if (! ((*finfo->info->callbacks->unattached_reloc) - (finfo->info, name, input_bfd, o, - irel->r_vaddr))) - return false; - } - } - } + if (name == NULL) + return false; - quiet = false; - switch (irel->r_type) - { - default: - if (h == NULL - || h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak - || h->root.type == bfd_link_hash_common) - break; - /* Fall through. */ - case R_POS: - case R_NEG: - case R_RL: - case R_RLA: - /* This reloc needs to be copied into the .loader - section. */ - ldrel.l_vaddr = irel->r_vaddr; - if (r_symndx == -1) - ldrel.l_symndx = -1; - else if (h == NULL - || (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak - || h->root.type == bfd_link_hash_common)) - { - asection *sec; + if (! ((*finfo->info->callbacks->unattached_reloc) + (finfo->info, name, input_bfd, o, + irel->r_vaddr))) + return false; + } + } + } - if (h == NULL) - sec = xcoff_data (input_bfd)->csects[r_symndx]; - else if (h->root.type == bfd_link_hash_common) - sec = h->root.u.c.p->section; - else - sec = h->root.u.def.section; - sec = sec->output_section; - - if (strcmp (sec->name, ".text") == 0) - ldrel.l_symndx = 0; - else if (strcmp (sec->name, ".data") == 0) - ldrel.l_symndx = 1; - else if (strcmp (sec->name, ".bss") == 0) - ldrel.l_symndx = 2; - else - { - (*_bfd_error_handler) - (_("%s: loader reloc in unrecognized section `%s'"), - bfd_get_filename (input_bfd), - sec->name); - bfd_set_error (bfd_error_nonrepresentable_section); - return false; - } - } - else - { - if (! finfo->info->relocateable - && (h->flags & XCOFF_DEF_DYNAMIC) == 0 - && (h->flags & XCOFF_IMPORT) == 0) - { - /* We already called the undefined_symbol - callback for this relocation, in - _bfd_ppc_xcoff_relocate_section. Don't - issue any more warnings. */ - quiet = true; - } - if (h->ldindx < 0 && ! quiet) - { - (*_bfd_error_handler) - (_("%s: `%s' in loader reloc but not loader sym"), - bfd_get_filename (input_bfd), - h->root.root.string); - bfd_set_error (bfd_error_bad_value); - return false; - } - ldrel.l_symndx = h->ldindx; - } - ldrel.l_rtype = (irel->r_size << 8) | irel->r_type; - ldrel.l_rsecnm = o->output_section->target_index; - if (xcoff_hash_table (finfo->info)->textro - && strcmp (o->output_section->name, ".text") == 0 - && ! quiet) - { - (*_bfd_error_handler) - (_("%s: loader reloc in read-only section %s"), - bfd_get_filename (input_bfd), - bfd_get_section_name (finfo->output_bfd, - o->output_section)); - bfd_set_error (bfd_error_invalid_operation); - return false; - } - bfd_xcoff_swap_ldrel_out (output_bfd, &ldrel, - finfo->ldrel); + quiet = false; + switch (irel->r_type) + { + default: + if (h == NULL + || h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak + || h->root.type == bfd_link_hash_common) + break; + /* Fall through. */ + case R_POS: + case R_NEG: + case R_RL: + case R_RLA: + /* This reloc needs to be copied into the .loader + section. */ + ldrel.l_vaddr = irel->r_vaddr; + if (r_symndx == -1) + ldrel.l_symndx = -(bfd_size_type ) 1; + else if (h == NULL + || (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak + || h->root.type == bfd_link_hash_common)) + { + asection *sec; - finfo->ldrel += bfd_xcoff_ldrelsz(output_bfd); - break; + if (h == NULL) + sec = xcoff_data (input_bfd)->csects[r_symndx]; + else if (h->root.type == bfd_link_hash_common) + sec = h->root.u.c.p->section; + else + sec = h->root.u.def.section; + sec = sec->output_section; - case R_TOC: - case R_GL: - case R_TCL: - case R_TRL: - case R_TRLA: - /* We should never need a .loader reloc for a TOC - relative reloc. */ - break; - } - } + if (strcmp (sec->name, ".text") == 0) + ldrel.l_symndx = 0; + else if (strcmp (sec->name, ".data") == 0) + ldrel.l_symndx = 1; + else if (strcmp (sec->name, ".bss") == 0) + ldrel.l_symndx = 2; + else + { + (*_bfd_error_handler) + (_("%s: loader reloc in unrecognized section `%s'"), + bfd_archive_filename (input_bfd), + sec->name); + bfd_set_error (bfd_error_nonrepresentable_section); + return false; + } + } + else + { + if (! finfo->info->relocateable + && (h->flags & XCOFF_DEF_DYNAMIC) == 0 + && (h->flags & XCOFF_IMPORT) == 0) + { + /* We already called the undefined_symbol + callback for this relocation, in + _bfd_ppc_xcoff_relocate_section. Don't + issue any more warnings. */ + quiet = true; + } + if (h->ldindx < 0 && ! quiet) + { + (*_bfd_error_handler) + (_("%s: `%s' in loader reloc but not loader sym"), + bfd_archive_filename (input_bfd), + h->root.root.string); + bfd_set_error (bfd_error_bad_value); + return false; + } + ldrel.l_symndx = h->ldindx; + } + ldrel.l_rtype = (irel->r_size << 8) | irel->r_type; + ldrel.l_rsecnm = o->output_section->target_index; + if (xcoff_hash_table (finfo->info)->textro + && strcmp (o->output_section->name, ".text") == 0 + && ! quiet) + { + (*_bfd_error_handler) + (_("%s: loader reloc in read-only section %s"), + bfd_archive_filename (input_bfd), + bfd_get_section_name (finfo->output_bfd, + o->output_section)); + bfd_set_error (bfd_error_invalid_operation); + return false; + } + bfd_xcoff_swap_ldrel_out (output_bfd, &ldrel, + finfo->ldrel); - o->output_section->reloc_count += o->reloc_count; - } + finfo->ldrel += bfd_xcoff_ldrelsz(output_bfd); + break; - /* Write out the modified section contents. */ - if (! bfd_set_section_contents (output_bfd, o->output_section, - contents, o->output_offset, - (o->_cooked_size != 0 - ? o->_cooked_size - : o->_raw_size))) - return false; - } + case R_TOC: + case R_GL: + case R_TCL: + case R_TRL: + case R_TRLA: + /* We should never need a .loader reloc for a TOC + relative reloc. */ + break; + } + } + + o->output_section->reloc_count += o->reloc_count; + } + + /* Write out the modified section contents. */ + if (! bfd_set_section_contents (output_bfd, o->output_section, + contents, (file_ptr) o->output_offset, + (o->_cooked_size != 0 + ? o->_cooked_size + : o->_raw_size))) + return false; + } obj_coff_keep_syms (input_bfd) = keep_syms; @@ -5280,16 +5349,18 @@ xcoff_link_input_bfd (finfo, input_bfd) static boolean -xcoff_write_global_symbol (h, p) +xcoff_write_global_symbol (h, inf) struct xcoff_link_hash_entry *h; - PTR p; + PTR inf; { - struct xcoff_final_link_info *finfo = (struct xcoff_final_link_info *) p; + struct xcoff_final_link_info *finfo = (struct xcoff_final_link_info *) inf; bfd *output_bfd; bfd_byte *outsym; struct internal_syment isym; union internal_auxent aux; boolean result; + file_ptr pos; + bfd_size_type amt; output_bfd = finfo->output_bfd; outsym = finfo->outsyms; @@ -5300,123 +5371,165 @@ xcoff_write_global_symbol (h, p) return true; /* If we need a .loader section entry, write it out. */ - if (h->ldsym != NULL) { - struct internal_ldsym *ldsym; - bfd *impbfd; - - ldsym = h->ldsym; - - if (h->root.type == bfd_link_hash_undefined || - h->root.type == bfd_link_hash_undefweak) { - - ldsym->l_value = 0; - ldsym->l_scnum = N_UNDEF; - ldsym->l_smtype = XTY_ER; - impbfd = h->root.u.undef.abfd; + if (h->ldsym != NULL) + { + struct internal_ldsym *ldsym; + bfd *impbfd; - } else if (h->root.type == bfd_link_hash_defined || - h->root.type == bfd_link_hash_defweak) { + ldsym = h->ldsym; - asection *sec; - - sec = h->root.u.def.section; - ldsym->l_value = (sec->output_section->vma - + sec->output_offset - + h->root.u.def.value); - ldsym->l_scnum = sec->output_section->target_index; - ldsym->l_smtype = XTY_SD; - impbfd = sec->owner; + if (h->root.type == bfd_link_hash_undefined + || h->root.type == bfd_link_hash_undefweak) + { - } else { - abort (); - } + ldsym->l_value = 0; + ldsym->l_scnum = N_UNDEF; + ldsym->l_smtype = XTY_ER; + impbfd = h->root.u.undef.abfd; - if (((h->flags & XCOFF_DEF_REGULAR) == 0 && - (h->flags & XCOFF_DEF_DYNAMIC) != 0) || - (h->flags & XCOFF_IMPORT) != 0) { - ldsym->l_smtype |= L_IMPORT; - } + } + else if (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + { - if (((h->flags & XCOFF_DEF_REGULAR) != 0 && - (h->flags & XCOFF_DEF_DYNAMIC) != 0) || - (h->flags & XCOFF_EXPORT) != 0) { - ldsym->l_smtype |= L_EXPORT; - } + asection *sec; - if ((h->flags & XCOFF_ENTRY) != 0) { - ldsym->l_smtype |= L_ENTRY; - } + sec = h->root.u.def.section; + ldsym->l_value = (sec->output_section->vma + + sec->output_offset + + h->root.u.def.value); + ldsym->l_scnum = sec->output_section->target_index; + ldsym->l_smtype = XTY_SD; + impbfd = sec->owner; - if ((h->flags & XCOFF_RTINIT) != 0) { - ldsym->l_smtype = XTY_SD; - } + } + else + abort (); + + if (((h->flags & XCOFF_DEF_REGULAR) == 0 + && (h->flags & XCOFF_DEF_DYNAMIC) != 0) + || (h->flags & XCOFF_IMPORT) != 0) + { + /* Clear l_smtype + Import symbols are defined so the check above will make + the l_smtype XTY_SD. But this is not correct, it should + be cleared. */ + ldsym->l_smtype |= L_IMPORT; + } - ldsym->l_smclas = h->smclas; + if (((h->flags & XCOFF_DEF_REGULAR) != 0 + && (h->flags & XCOFF_DEF_DYNAMIC) != 0) + || (h->flags & XCOFF_EXPORT) != 0) + { + ldsym->l_smtype |= L_EXPORT; + } - if (ldsym->l_ifile == (bfd_size_type) -1) { - ldsym->l_ifile = 0; + if ((h->flags & XCOFF_ENTRY) != 0) + { + ldsym->l_smtype |= L_ENTRY; + } - } else if (ldsym->l_ifile == 0) { - if ((ldsym->l_smtype & L_IMPORT) == 0) { - ldsym->l_ifile = 0; - } else if (impbfd == NULL) { - ldsym->l_ifile = 0; - } else { - BFD_ASSERT (impbfd->xvec == output_bfd->xvec); - ldsym->l_ifile = xcoff_data (impbfd)->import_file_id; - } + if ((h->flags & XCOFF_RTINIT) != 0) + { + ldsym->l_smtype = XTY_SD; + } + + ldsym->l_smclas = h->smclas; + + if (ldsym->l_smtype & L_IMPORT) + { + if ((h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + && (h->root.u.def.value != 0)) + { + ldsym->l_smclas = XMC_XO; + } + else if ((h->flags & (XCOFF_SYSCALL32 | XCOFF_SYSCALL64)) == + (XCOFF_SYSCALL32 | XCOFF_SYSCALL64)) + { + ldsym->l_smclas = XMC_SV3264; + } + else if (h->flags & XCOFF_SYSCALL32) + { + ldsym->l_smclas = XMC_SV; + } + else if (h->flags & XCOFF_SYSCALL64) + { + ldsym->l_smclas = XMC_SV64; + } + } + + if (ldsym->l_ifile == -(bfd_size_type) 1) + { + ldsym->l_ifile = 0; + } + else if (ldsym->l_ifile == 0) + { + if ((ldsym->l_smtype & L_IMPORT) == 0) + { + ldsym->l_ifile = 0; + } + else if (impbfd == NULL) + { + ldsym->l_ifile = 0; + } + else + { + BFD_ASSERT (impbfd->xvec == output_bfd->xvec); + ldsym->l_ifile = xcoff_data (impbfd)->import_file_id; + } + } + + ldsym->l_parm = 0; + + BFD_ASSERT (h->ldindx >= 0); + + bfd_xcoff_swap_ldsym_out (output_bfd, ldsym, + (finfo->ldsym + + (h->ldindx - 3) + * bfd_xcoff_ldsymsz(finfo->output_bfd))); + h->ldsym = NULL; } - - ldsym->l_parm = 0; - - BFD_ASSERT (h->ldindx >= 0); - - bfd_xcoff_swap_ldsym_out (output_bfd, ldsym, finfo->ldsym + - (h->ldindx - 3) * - bfd_xcoff_ldsymsz(finfo->output_bfd)); - h->ldsym = NULL; - } - + /* If this symbol needs global linkage code, write it out. */ - if (h->root.type == bfd_link_hash_defined && - (h->root.u.def.section == - xcoff_hash_table (finfo->info)->linkage_section)) { + if (h->root.type == bfd_link_hash_defined + && (h->root.u.def.section + == xcoff_hash_table (finfo->info)->linkage_section)) + { + bfd_byte *p; + bfd_vma tocoff; + unsigned int i; - bfd_byte *p; - bfd_vma tocoff; - unsigned int i; - - p = h->root.u.def.section->contents + h->root.u.def.value; + p = h->root.u.def.section->contents + h->root.u.def.value; + + /* The first instruction in the global linkage code loads a + specific TOC element. */ + tocoff = (h->descriptor->toc_section->output_section->vma + + h->descriptor->toc_section->output_offset + - xcoff_data (output_bfd)->toc); - /* The first instruction in the global linkage code loads a - specific TOC element. */ - tocoff = (h->descriptor->toc_section->output_section->vma - + h->descriptor->toc_section->output_offset - - xcoff_data (output_bfd)->toc); - - if ((h->descriptor->flags & XCOFF_SET_TOC) != 0) { - tocoff += h->descriptor->u.toc_offset; - } - - - /* - * The first instruction in the glink code needs to be cooked to - * to hold the correct offset in the toc. The rest are just outputted - * raw. - */ - bfd_put_32 (output_bfd, - bfd_xcoff_glink_code(output_bfd, 0) | (tocoff & 0xffff), p); - - /* - * Start with i == 1 to get past the first instruction done above - * The /4 is because the glink code is in bytes and we are going 4 - * at a pop - */ - for (i = 1; i < bfd_xcoff_glink_code_size(output_bfd) / 4; i++) { - bfd_put_32 (output_bfd, bfd_xcoff_glink_code(output_bfd, i), - &p[4 * i]); + if ((h->descriptor->flags & XCOFF_SET_TOC) != 0) + { + tocoff += h->descriptor->u.toc_offset; + } + + + /* The first instruction in the glink code needs to be + cooked to to hold the correct offset in the toc. The + rest are just output raw. */ + bfd_put_32 (output_bfd, + bfd_xcoff_glink_code(output_bfd, 0) | (tocoff & 0xffff), p); + + /* Start with i == 1 to get past the first instruction done above + The /4 is because the glink code is in bytes and we are going + 4 at a pop. */ + for (i = 1; i < bfd_xcoff_glink_code_size(output_bfd) / 4; i++) + { + bfd_put_32 (output_bfd, + (bfd_vma) bfd_xcoff_glink_code(output_bfd, i), + &p[4 * i]); + } } - } /* If we created a TOC entry for this symbol, write out the required relocs. */ @@ -5439,43 +5552,46 @@ xcoff_write_global_symbol (h, p) + h->u.toc_offset); - if (h->indx >= 0) { - irel->r_symndx = h->indx; - } else { - h->indx = -2; - irel->r_symndx = obj_raw_syment_count (output_bfd); - } - + if (h->indx >= 0) + { + irel->r_symndx = h->indx; + } + else + { + h->indx = -2; + irel->r_symndx = obj_raw_syment_count (output_bfd); + } + BFD_ASSERT (h->ldindx >= 0); - /* - * Initialize the aux union here instead of closer to when it is - * written out below because the length of the csect depends on - * whether the output is 32 or 64 bit - */ + /* Initialize the aux union here instead of closer to when it is + written out below because the length of the csect depends on + whether the output is 32 or 64 bit. */ memset (&iraux, 0, sizeof iraux); iraux.x_csect.x_smtyp = XTY_SD; /* iraux.x_csect.x_scnlen.l = 4 or 8, see below */ iraux.x_csect.x_smclas = XMC_TC; + /* 32 bit uses a 32 bit R_POS to do the relocations + 64 bit uses a 64 bit R_POS to do the relocations - /* - * 32 bit uses a 32 bit R_POS to do the relocations - * 64 bit uses a 64 bit R_POS to do the relocations - * - * Also needs to change the csect size : 4 for 32 bit, 8 for 64 bit - * - * Which one is determined by the backend - */ - if (bfd_xcoff_is_xcoff64(output_bfd)) { - irel->r_size = 63; - iraux.x_csect.x_scnlen.l = 8; - } else if (bfd_xcoff_is_xcoff32(output_bfd)) { - irel->r_size = 31; - iraux.x_csect.x_scnlen.l = 4; - } else { - return false; - } + Also needs to change the csect size : 4 for 32 bit, 8 for 64 bit + + Which one is determined by the backend. */ + if (bfd_xcoff_is_xcoff64 (output_bfd)) + { + irel->r_size = 63; + iraux.x_csect.x_scnlen.l = 8; + } + else if (bfd_xcoff_is_xcoff32 (output_bfd)) + { + irel->r_size = 31; + iraux.x_csect.x_scnlen.l = 4; + } + else + { + return false; + } irel->r_type = R_POS; finfo->section_info[oindx].rel_hashes[osec->reloc_count] = NULL; ++osec->reloc_count; @@ -5487,41 +5603,42 @@ xcoff_write_global_symbol (h, p) bfd_xcoff_swap_ldrel_out (output_bfd, &ldrel, finfo->ldrel); finfo->ldrel += bfd_xcoff_ldrelsz(output_bfd); - /* We need to emit a symbol to define a csect which holds the reloc. */ - if (finfo->info->strip != strip_all) { + /* We need to emit a symbol to define a csect which holds + the reloc. */ + if (finfo->info->strip != strip_all) + { - result = bfd_xcoff_put_symbol_name (output_bfd, finfo->strtab, &irsym, - h->root.root.string); - if (false == result) { - return false; - } + result = bfd_xcoff_put_symbol_name (output_bfd, finfo->strtab, + &irsym, h->root.root.string); + if (false == result) + { + return false; + } - irsym.n_value = irel->r_vaddr; - irsym.n_scnum = osec->target_index; - irsym.n_sclass = C_HIDEXT; - irsym.n_type = T_NULL; - irsym.n_numaux = 1; - - bfd_coff_swap_sym_out (output_bfd, (PTR) &irsym, (PTR) outsym); - outsym += bfd_coff_symesz (output_bfd); - - /* note : iraux is initialized above */ - bfd_coff_swap_aux_out (output_bfd, (PTR) &iraux, T_NULL, C_HIDEXT, - 0, 1, (PTR) outsym); - outsym += bfd_coff_auxesz (output_bfd); + irsym.n_value = irel->r_vaddr; + irsym.n_scnum = osec->target_index; + irsym.n_sclass = C_HIDEXT; + irsym.n_type = T_NULL; + irsym.n_numaux = 1; - if (h->indx >= 0) - { - /* We aren't going to write out the symbols below, so we + bfd_coff_swap_sym_out (output_bfd, (PTR) &irsym, (PTR) outsym); + outsym += bfd_coff_symesz (output_bfd); + + /* note : iraux is initialized above */ + bfd_coff_swap_aux_out (output_bfd, (PTR) &iraux, T_NULL, C_HIDEXT, + 0, 1, (PTR) outsym); + outsym += bfd_coff_auxesz (output_bfd); + + if (h->indx >= 0) + { + /* We aren't going to write out the symbols below, so we need to write them out now. */ - if (bfd_seek (output_bfd, - (obj_sym_filepos (output_bfd) - + (obj_raw_syment_count (output_bfd) - * bfd_coff_symesz (output_bfd))), - SEEK_SET) != 0 - || (bfd_write (finfo->outsyms, outsym - finfo->outsyms, 1, - output_bfd) - != (bfd_size_type) (outsym - finfo->outsyms))) + pos = obj_sym_filepos (output_bfd); + pos += (obj_raw_syment_count (output_bfd) + * bfd_coff_symesz (output_bfd)); + amt = outsym - finfo->outsyms; + if (bfd_seek (output_bfd, pos, SEEK_SET) != 0 + || bfd_bwrite (finfo->outsyms, amt, output_bfd) != amt) return false; obj_raw_syment_count (output_bfd) += (outsym - finfo->outsyms) / bfd_coff_symesz (output_bfd); @@ -5531,18 +5648,16 @@ xcoff_write_global_symbol (h, p) } } - /* - * If this symbol is a specially defined function descriptor, write - * it out. The first word is the address of the function code - * itself, the second word is the address of the TOC, and the third - * word is zero. - * - * 32 bit vs 64 bit - * The addresses for the 32 bit will take 4 bytes and the addresses - * for 64 bit will take 8 bytes. Similar for the relocs. This type - * of logic was also done above to create a TOC entry in - * xcoff_write_global_symbol - */ + /* If this symbol is a specially defined function descriptor, write + it out. The first word is the address of the function code + itself, the second word is the address of the TOC, and the third + word is zero. + + 32 bit vs 64 bit + The addresses for the 32 bit will take 4 bytes and the addresses + for 64 bit will take 8 bytes. Similar for the relocs. This type + of logic was also done above to create a TOC entry in + xcoff_write_global_symbol. */ if ((h->flags & XCOFF_DESCRIPTOR) != 0 && h->root.type == bfd_link_hash_defined && (h->root.u.def.section @@ -5559,15 +5674,20 @@ xcoff_write_global_symbol (h, p) asection *tsec; unsigned int reloc_size, byte_size; - if (bfd_xcoff_is_xcoff64(output_bfd)) { - reloc_size = 63; - byte_size = 8; - } else if (bfd_xcoff_is_xcoff32(output_bfd)) { - reloc_size = 31; - byte_size = 4; - } else { - return false; - } + if (bfd_xcoff_is_xcoff64 (output_bfd)) + { + reloc_size = 63; + byte_size = 8; + } + else if (bfd_xcoff_is_xcoff32 (output_bfd)) + { + reloc_size = 31; + byte_size = 4; + } + else + { + return false; + } sec = h->root.u.def.section; osec = sec->output_section; @@ -5611,33 +5731,33 @@ xcoff_write_global_symbol (h, p) bfd_xcoff_swap_ldrel_out (output_bfd, &ldrel, finfo->ldrel); finfo->ldrel += bfd_xcoff_ldrelsz(output_bfd); - /* - * There are three items to write out, - * the address of the code - * the address of the toc anchor - * the environment pointer. - * We are ignoring the environment pointer. So set it to zero - */ - if (bfd_xcoff_is_xcoff64(output_bfd)) { - bfd_put_64 (output_bfd, (esec->output_section->vma + - esec->output_offset + - hentry->root.u.def.value), p); - bfd_put_64 (output_bfd, xcoff_data (output_bfd)->toc, p + 8); - bfd_put_64 (output_bfd, 0, p + 16); - } else { - /* - * 32 bit backend - * - * This logic was already called above so the error case where - * the backend is neither has already been checked - */ - bfd_put_32 (output_bfd, (esec->output_section->vma + - esec->output_offset + - hentry->root.u.def.value), p); - bfd_put_32 (output_bfd, xcoff_data (output_bfd)->toc, p + 4); - bfd_put_32 (output_bfd, 0, p + 8); - } - + /* There are three items to write out, + the address of the code + the address of the toc anchor + the environment pointer. + We are ignoring the environment pointer. So set it to zero. */ + if (bfd_xcoff_is_xcoff64 (output_bfd)) + { + bfd_put_64 (output_bfd, + (esec->output_section->vma + esec->output_offset + + hentry->root.u.def.value), + p); + bfd_put_64 (output_bfd, xcoff_data (output_bfd)->toc, p + 8); + bfd_put_64 (output_bfd, (bfd_vma) 0, p + 16); + } + else + { + /* 32 bit backend + This logic was already called above so the error case where + the backend is neither has already been checked. */ + bfd_put_32 (output_bfd, + (esec->output_section->vma + esec->output_offset + + hentry->root.u.def.value), + p); + bfd_put_32 (output_bfd, xcoff_data (output_bfd)->toc, p + 4); + bfd_put_32 (output_bfd, (bfd_vma) 0, p + 8); + } + tsec = coff_section_from_bfd_index (output_bfd, xcoff_data (output_bfd)->sntoc); @@ -5683,9 +5803,8 @@ xcoff_write_global_symbol (h, p) if (h->indx != -2 && (finfo->info->strip == strip_all || (finfo->info->strip == strip_some - && (bfd_hash_lookup (finfo->info->keep_hash, - h->root.root.string, false, false) - == NULL)))) + && bfd_hash_lookup (finfo->info->keep_hash, h->root.root.string, + false, false) == NULL))) { BFD_ASSERT (outsym == finfo->outsyms); return true; @@ -5702,11 +5821,12 @@ xcoff_write_global_symbol (h, p) h->indx = obj_raw_syment_count (output_bfd); - result = bfd_xcoff_put_symbol_name (output_bfd, finfo->strtab, &isym, + result = bfd_xcoff_put_symbol_name (output_bfd, finfo->strtab, &isym, h->root.root.string); - if (false == result) { - return false; - } + if (false == result) + { + return false; + } if (h->root.type == bfd_link_hash_undefined || h->root.type == bfd_link_hash_undefweak) @@ -5794,13 +5914,11 @@ xcoff_write_global_symbol (h, p) outsym += bfd_coff_auxesz (output_bfd); } - if (bfd_seek (output_bfd, - (obj_sym_filepos (output_bfd) - + (obj_raw_syment_count (output_bfd) - * bfd_coff_symesz (output_bfd))), - SEEK_SET) != 0 - || (bfd_write (finfo->outsyms, outsym - finfo->outsyms, 1, output_bfd) - != (bfd_size_type) (outsym - finfo->outsyms))) + pos = obj_sym_filepos (output_bfd); + pos += obj_raw_syment_count (output_bfd) * bfd_coff_symesz (output_bfd); + amt = outsym - finfo->outsyms; + if (bfd_seek (output_bfd, pos, SEEK_SET) != 0 + || bfd_bwrite (finfo->outsyms, amt, output_bfd) != amt) return false; obj_raw_syment_count (output_bfd) += (outsym - finfo->outsyms) / bfd_coff_symesz (output_bfd); diff -uprN binutils-2.11.90.0.31/binutils/ChangeLog binutils-2.11.92.0.5/binutils/ChangeLog --- binutils-2.11.90.0.31/binutils/ChangeLog Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/binutils/ChangeLog Thu Oct 4 14:35:43 2001 @@ -1,3 +1,188 @@ +2001-10-03 Alan Modra + + * doc/Makefile.in: Regenerate. + * configure: Regenerate. + +2001-10-02 Nick Clifton + + * readelf.c (display_debug_line, display_debug_pubnames, + display_debug_info, display_debug_frames): Detect and warn + about 64-bit format entries. + (display_debug_aranges): Reword 64-bit warning. + (debug_displays): Add .debug_pubtypes as a known, but not yet + supported, debug section. + +2001-10-02 Alan Modra + + * coffdump.c (PROGRAM_VERSION): Delete. + (main <'V'>): Call print_version. + * srconv.c: Likewise. + * sysdump.c: Likewise. + * version.c (program_version): Remove. + (print_version): Use BFD_VERSION_STRING. Just print the current + year in copyright message. + * addr2line.c (program_version): Remove unused declaration. + * objdump.c (display_target_tables): Use BFD_VERSION_STRING in + place of BFD_VERSION. + * Makefile.am (Makefile): Depend on bfd/configure.in. + (cplus-dem.o): Depend on Makefile. + Run "make dep-am". + * Makefile.in: Regenerate. + +2001-10-01 Nick Clifton + + * readelf.c (display_debug_aranges): Detect and warn about DWARF64 + format .debug_arange sections. + (main): Add missing prototype. + +2001-09-30 Hans-Peter Nilsson + + * Makefile.am: Update dependencies with "make dep-am". + * Makefile.in: Regenerate. + +2001-09-28 Richard Henderson + + * objdump.c (dump_section_header): Dump SEC_ARCH_BIT_0. + +2001-09-26 Alan Modra + + * bucomm.c (fatal): Define using VPARAMS, VA_OPEN, VA_FIXEDARG, + VA_CLOSE. + (non_fatal): Likewise. + * objdump.c (objdump_sprintf): Likewise. + * readelf.c (error): Likewise. + (warn): Likewise. + +2001-09-25 Jakub Jelinek + + * readelf.c (do_wide): New. + (options): Add --wide. + (usage, parse_args): Likewise. + (process_program_headers): Put each segment on a single line if + --wide is given. + (process_section_headers): Put each section on a single line if + --wide is given. + * doc/binutils.texi: Document it. + * NEWS: Likewise. + +2001-09-25 Alan Modra + + * readelf.c (print_vma): Print 8 digits of low hex value. + +2001-09-24 Andreas Jaeger + + * nlmconv.c: Fix warnings about unused attributes and function + prototypes. + + * strings.c: Add prototype for get_char. + +2000-09-19 H.J. Lu + + * doc/Makefile.am ($(DEMANGLER_NAME).1): Try cxxfilt.man and + $(srcdir)/cxxfilt.man. + * doc/Makefile.in: Rebuild. + +2001-09-19 Alan Modra + + * objcopy.c (copy_main): Correct rename-section string parsing. + Consolidate new_name parsing, and error messages. + +2001-09-18 Bruno Haible + + * addr2line.c: Don't include . + (main): For gettext, also set the LC_CTYPE locate facet. + * ar.c (main): Likewise. + * coffdump.c (main): Likewise. + * dlltool.c: Include "safe-ctype.h" instead of . + (main): For gettext, also set the LC_CTYPE locate facet. + Use ISALNUM instead of isalpha/isdigit. + * dllwrap.c: Don't include . + (main): For gettext, also set the LC_CTYPE locate facet. + * nlmconv.c: Include "safe-ctype.h" instead of . + (main): For gettext, also set the LC_CTYPE locate facet. + Use TOUPPER instead of islower/toupper. + * nlmheader.y: Include "safe-ctype.h" instead of . + (yylex): Use ISSPACE/ISALNUM instead of isspace/isalnum. + Use TOUPPER instead of islower/toupper. + * nm.c (main): For gettext, also set the LC_CTYPE locate facet. + * objcopy.c (main): Likewise. + * objdump.c: Include "safe-ctype.h" instead of . + (disassemble_bytes): Use ISPRINT instead of isprint. + (dump_section_stabs): Use ISDIGIT instead of isdigit. + (dump_data): Use ISPRINT instead of isprint. + (main): For gettext, also set the LC_CTYPE locate facet. + * rclex.l: Include "safe-ctype.h" instead of . + (cpp_line, handle_quotes): Use ISSPACE instead of isspace. + * rcparse.y: Include "safe-ctype.h" instead of . + Use TOUPPER instead of islower/toupper. + * readelf.c (main): For gettext, also set the LC_CTYPE locate facet. + * resrc.c: Include "safe-ctype.h" instead of . + (write_rc_accelerators): Use ISPRINT instead of isprint. + (write_rc_rcdata): Likewise. + * size.c (main): For gettext, also set the LC_CTYPE locate facet. + * srconv.c (main): Likewise. + * stabs.c: Include "safe-ctype.h" instead of . + (parse_number): Use ISDIGIT/ISUPPER/ISLOWER instead of + isdigit/isupper/islower. + (parse_stab_string, parse_stab_type, parse_stab_argtypes, + parse_stab_array_type, stab_demangle_count, stab_demangle_get_count, + stab_demangle_prefix, stab_demangle_qualified, + stab_demangle_template, stab_demangle_type, + stab_demangle_fund_type): Use ISDIGIT instead of isdigit. + * strings.c: Include "safe-ctype.h" instead of . + (isgraphic): Use ISPRINT instead of isascii/isprint. + (main): Remove HAVE_LC_MESSAGES dependency. + * sysdump.c: Include "safe-ctype.h" instead of . + (pbarray): Use ISPRINT instead of isprint. + (main): For gettext, also set the LC_CTYPE locate facet. + * windres.c: Include "safe-ctype.h" instead of . + (format_from_filename): Use ISPRINT instead of isprint. + (main): For gettext, also set the LC_CTYPE locate facet. + * winduni.c: Include "safe-ctype.h" instead of . + (unicode_print): Use ISPRINT instead of isprint. + * wrstabs.c: Include "safe-ctype.h" instead of . + (stab_variable): Use ISDIGIT instead of isdigit. + +2001-09-18 Alan Modra + + * ar.c (print_contents): Cast args of bfd_seek to the right types. + Replace bfd_read call with call to bfd_bread. + (extract_file): Likewise. + + * objdump.c (dump_section_header): Cast section->filepos to + unsigned long to suit printf format string. + * readelf.c (process_section_headers): Similarly for sh_offset. + (process_unwind): Likewise. + +2001-09-14 Nick Clifton + + * strings.c (encoding, encoding_bytes): New variables. + (long_options): Add --encoding. + (main): Accept -e and --encoding. + (get_char): New function. Read a, possibly wide, character from + the input stream. + (print_strings): Use get_char(). + (usage): Document new command line option. + * doc/binutils.texi: Document new command line option. + * NEWS: Announce new command line option. + +Wed Sep 12 20:07:16 2001 Alexandre Oliva + + * readelf.c (guess_is_rela, dump_relocations, get_machine_name, + get_machine_flags): Added EM_M32R, EM_D10V, EM_V850, EM_D30V, + EM_MN10200, EM_MN10300, EM_FR30, EM_AVR_OLD and EM_PJ_OLD. + Removed EM_CYGNUS_ARC. + +Tue Sep 4 20:26:08 2001 Jeffrey A Law (law@cygnus.com) + + * readelf.c: Include elf/h8 for H8 series definitions. + (guess_is_rela): H8 series if RELA. + (dump_relocations): Handle H8 series relocations. + +2001-08-31 Eric Christopher + + * readelf.c (get_machine_flags): Remove E_MIPS_MACH_MIPS32_4K. + 2001-08-29 Peter Targett * MAINTAINERS: Include ARC Maintainer. diff -uprN binutils-2.11.90.0.31/binutils/Makefile.am binutils-2.11.92.0.5/binutils/Makefile.am --- binutils-2.11.90.0.31/binutils/Makefile.am Tue Jun 19 11:57:33 2001 +++ binutils-2.11.92.0.5/binutils/Makefile.am Thu Oct 4 14:35:43 2001 @@ -177,7 +177,7 @@ stamp-under: Makefile $(SHELL) $(srcdir)/../move-if-change underscore.t underscore.c touch stamp-under -cplus-dem.o: $(BASEDIR)/libiberty/cplus-dem.c $(INCDIR)/getopt.h +cplus-dem.o: $(BASEDIR)/libiberty/cplus-dem.c $(INCDIR)/getopt.h Makefile $(COMPILE) -c -DMAIN -DVERSION='"$(VERSION)"' $(BASEDIR)/libiberty/cplus-dem.c cxxfilt_SOURCES = @@ -280,6 +280,8 @@ diststuff: $(EXTRA_DIST) info DISTCLEANFILES = stamp-under sysinfo underscore.c sysroff.c sysroff.h \ site.exp site.bak +Makefile: $(BFDDIR)/configure.in + # Targets to rebuild dependencies in this Makefile. # Have to get rid of DEP1 here so that "$?" later includes all of $(CFILES). DEP: dep.sed $(CFILES) $(HFILES) $(GENERATED_CFILES) $(GENERATED_HFILES) config.h @@ -360,149 +362,170 @@ install-exec-local: install-binPROGRAMS # DO NOT DELETE THIS LINE -- mkdep uses it. # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. addr2line.o: addr2line.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/getopt.h $(INCDIR)/libiberty.h $(INCDIR)/demangle.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h -ar.o: ar.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ - $(INCDIR)/progress.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/aout/ar.h $(BFDDIR)/libbfd.h \ - arsup.h $(INCDIR)/filenames.h + $(INCDIR)/symcat.h $(INCDIR)/getopt.h $(INCDIR)/libiberty.h \ + $(INCDIR)/demangle.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h +ar.o: ar.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \ + $(INCDIR)/libiberty.h $(INCDIR)/progress.h bucomm.h \ + config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/aout/ar.h $(BFDDIR)/libbfd.h arsup.h $(INCDIR)/filenames.h arsup.o: arsup.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - arsup.h $(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h + $(INCDIR)/symcat.h arsup.h $(INCDIR)/libiberty.h bucomm.h \ + config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/filenames.h bucomm.o: bucomm.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h + $(INCDIR)/symcat.h $(INCDIR)/libiberty.h bucomm.h config.h \ + $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h coffdump.o: coffdump.c coffgrok.h bucomm.h config.h \ $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h coffgrok.o: coffgrok.c bucomm.h config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h coffgrok.h debug.o: debug.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h debug.h + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h debug.h dlltool.o: dlltool.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/demangle.h $(INCDIR)/dyn-string.h \ - dlltool.h + $(INCDIR)/symcat.h $(INCDIR)/libiberty.h bucomm.h config.h \ + $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/demangle.h \ + $(INCDIR)/dyn-string.h dlltool.h $(INCDIR)/safe-ctype.h filemode.o: filemode.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h -ieee.o: ieee.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/ieee.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h debug.h budbg.h $(INCDIR)/filenames.h + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h +ieee.o: ieee.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \ + $(INCDIR)/ieee.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h debug.h \ + budbg.h $(INCDIR)/filenames.h is-ranlib.o: is-ranlib.c is-strip.o: is-strip.c maybe-ranlib.o: maybe-ranlib.c maybe-strip.o: maybe-strip.c nlmconv.o: nlmconv.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(BFDDIR)/libnlm.h $(INCDIR)/nlm/common.h \ - $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h nlmconv.h -nm.o: nm.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/progress.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ranlib.h \ - $(INCDIR)/demangle.h $(INCDIR)/libiberty.h + $(INCDIR)/symcat.h $(INCDIR)/libiberty.h bucomm.h config.h \ + $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/safe-ctype.h \ + $(BFDDIR)/libnlm.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \ + $(INCDIR)/nlm/external.h nlmconv.h +nm.o: nm.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \ + $(INCDIR)/progress.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ranlib.h $(INCDIR)/demangle.h $(INCDIR)/libiberty.h not-ranlib.o: not-ranlib.c not-strip.o: not-strip.c objcopy.o: objcopy.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/progress.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h budbg.h \ - $(INCDIR)/filenames.h + $(INCDIR)/symcat.h $(INCDIR)/progress.h bucomm.h config.h \ + $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ + budbg.h $(INCDIR)/filenames.h objdump.o: objdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/getopt.h $(INCDIR)/progress.h bucomm.h config.h \ - $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/dis-asm.h \ - $(INCDIR)/libiberty.h $(INCDIR)/demangle.h debug.h \ - budbg.h $(INCDIR)/aout/aout64.h -prdbg.o: prdbg.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h $(INCDIR)/getopt.h $(INCDIR)/progress.h \ bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h debug.h budbg.h + $(INCDIR)/safe-ctype.h $(INCDIR)/dis-asm.h $(INCDIR)/libiberty.h \ + $(INCDIR)/demangle.h debug.h budbg.h $(INCDIR)/aout/aout64.h +prdbg.o: prdbg.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h debug.h \ + budbg.h rdcoff.o: rdcoff.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/coff/internal.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/demangle.h \ - debug.h budbg.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h bucomm.h \ + config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/libiberty.h $(INCDIR)/demangle.h debug.h \ + budbg.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h rddbg.o: rddbg.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h debug.h budbg.h -size.o: size.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/getopt.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h debug.h \ + budbg.h +size.o: size.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \ + $(INCDIR)/getopt.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h srconv.o: srconv.c bucomm.h config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h sysroff.h coffgrok.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h sysroff.c stabs.o: stabs.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h $(INCDIR)/demangle.h debug.h \ - budbg.h $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/demangle.h debug.h budbg.h $(INCDIR)/filenames.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def strings.o: strings.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h sysdump.o: sysdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - sysroff.h sysroff.c + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/safe-ctype.h sysroff.h \ + sysroff.c version.o: version.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h wrstabs.o: wrstabs.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h debug.h budbg.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h \ + debug.h budbg.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ + $(INCDIR)/aout/stab.def windres.o: windres.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/getopt.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/obstack.h \ - windres.h winduni.h + $(INCDIR)/symcat.h $(INCDIR)/getopt.h bucomm.h config.h \ + $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h windres.h \ + winduni.h resrc.o: resrc.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h windres.h winduni.h + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h \ + windres.h winduni.h rescoff.o: rescoff.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h windres.h winduni.h $(INCDIR)/coff/internal.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h windres.h \ + winduni.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h resbin.o: resbin.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h windres.h winduni.h -winduni.o: winduni.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h windres.h \ winduni.h +winduni.o: winduni.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h winduni.h $(INCDIR)/safe-ctype.h readelf.o: readelf.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/external.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/dwarf2.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \ - $(INCDIR)/elf/v850.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/mips.h \ - $(INCDIR)/elf/alpha.h $(INCDIR)/elf/arm.h $(INCDIR)/elf/m68k.h \ - $(INCDIR)/elf/sparc.h $(INCDIR)/elf/m32r.h $(INCDIR)/elf/d10v.h \ - $(INCDIR)/elf/d30v.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/mn10200.h \ - $(INCDIR)/elf/mn10300.h $(INCDIR)/elf/hppa.h $(INCDIR)/elf/arc.h \ - $(INCDIR)/elf/fr30.h $(INCDIR)/elf/mcore.h $(INCDIR)/elf/i960.h \ - $(INCDIR)/elf/pj.h $(INCDIR)/elf/avr.h $(INCDIR)/elf/ia64.h \ - $(INCDIR)/elf/cris.h $(INCDIR)/elf/i860.h $(INCDIR)/elf/x86-64.h \ - $(INCDIR)/elf/s390.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h unwind-ia64.h -resres.o: resres.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h $(INCDIR)/elf/common.h $(INCDIR)/elf/external.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/dwarf2.h $(INCDIR)/elf/i386.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/elf/v850.h $(INCDIR)/elf/ppc.h \ + $(INCDIR)/elf/mips.h $(INCDIR)/elf/alpha.h $(INCDIR)/elf/arm.h \ + $(INCDIR)/elf/m68k.h $(INCDIR)/elf/sparc.h $(INCDIR)/elf/m32r.h \ + $(INCDIR)/elf/d10v.h $(INCDIR)/elf/d30v.h $(INCDIR)/elf/sh.h \ + $(INCDIR)/elf/mn10200.h $(INCDIR)/elf/mn10300.h $(INCDIR)/elf/hppa.h \ + $(INCDIR)/elf/h8.h $(INCDIR)/elf/arc.h $(INCDIR)/elf/fr30.h \ + $(INCDIR)/elf/mcore.h $(INCDIR)/elf/i960.h $(INCDIR)/elf/pj.h \ + $(INCDIR)/elf/avr.h $(INCDIR)/elf/ia64.h $(INCDIR)/elf/cris.h \ + $(INCDIR)/elf/i860.h $(INCDIR)/elf/x86-64.h $(INCDIR)/elf/s390.h \ bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h windres.h winduni.h + unwind-ia64.h +resres.o: resres.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h windres.h \ + winduni.h dllwrap.o: dllwrap.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/dyn-string.h + $(INCDIR)/symcat.h $(INCDIR)/libiberty.h bucomm.h config.h \ + $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/dyn-string.h rename.o: rename.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h underscore.o: underscore.c arparse.o: arparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - arsup.h + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h arsup.h arlex.o: arlex.c $(INCDIR)/libiberty.h arparse.h sysroff.o: sysroff.c sysinfo.o: sysinfo.c syslex.o: syslex.c sysinfo.h defparse.o: defparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - dlltool.h + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h dlltool.h deflex.o: deflex.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \ defparse.h dlltool.h -nlmheader.o: nlmheader.c ../bfd/bfd.h bucomm.h config.h \ - $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/nlm/common.h \ - $(INCDIR)/nlm/internal.h nlmconv.h +nlmheader.o: nlmheader.c $(INCDIR)/safe-ctype.h ../bfd/bfd.h \ + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \ + nlmconv.h rcparse.o: rcparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h windres.h winduni.h + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h windres.h \ + winduni.h $(INCDIR)/safe-ctype.h rclex.o: rclex.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h windres.h winduni.h rcparse.h + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h \ + windres.h winduni.h rcparse.h # IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff -uprN binutils-2.11.90.0.31/binutils/Makefile.in binutils-2.11.92.0.5/binutils/Makefile.in --- binutils-2.11.90.0.31/binutils/Makefile.in Tue Jun 19 11:57:33 2001 +++ binutils-2.11.92.0.5/binutils/Makefile.in Thu Oct 4 14:35:43 2001 @@ -421,7 +421,7 @@ configure.in deflex.c defparse.c nlmhead DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = gtar +TAR = tar GZIP_ENV = --best SOURCES = $(nlmconv_SOURCES) $(srconv_SOURCES) $(sysdump_SOURCES) $(coffdump_SOURCES) $(dlltool_SOURCES) $(windres_SOURCES) $(dllwrap_SOURCES) $(size_SOURCES) $(objdump_SOURCES) $(ar_SOURCES) $(strings_SOURCES) $(ranlib_SOURCES) $(objcopy_SOURCES) $(addr2line_SOURCES) $(readelf_SOURCES) $(nm_new_SOURCES) $(strip_new_SOURCES) $(cxxfilt_SOURCES) OBJECTS = $(nlmconv_OBJECTS) $(srconv_OBJECTS) $(sysdump_OBJECTS) $(coffdump_OBJECTS) $(dlltool_OBJECTS) $(windres_OBJECTS) $(dllwrap_OBJECTS) $(size_OBJECTS) $(objdump_OBJECTS) $(ar_OBJECTS) $(strings_OBJECTS) $(ranlib_OBJECTS) $(objcopy_OBJECTS) $(addr2line_OBJECTS) $(readelf_OBJECTS) $(nm_new_OBJECTS) $(strip_new_OBJECTS) $(cxxfilt_OBJECTS) @@ -938,7 +938,7 @@ stamp-under: Makefile $(SHELL) $(srcdir)/../move-if-change underscore.t underscore.c touch stamp-under -cplus-dem.o: $(BASEDIR)/libiberty/cplus-dem.c $(INCDIR)/getopt.h +cplus-dem.o: $(BASEDIR)/libiberty/cplus-dem.c $(INCDIR)/getopt.h Makefile $(COMPILE) -c -DMAIN -DVERSION='"$(VERSION)"' $(BASEDIR)/libiberty/cplus-dem.c # The following is commented out for the conversion to automake. @@ -1005,6 +1005,8 @@ nlmconv.o: nlmconv.c $(INCDIR)/coff/sym. diststuff: $(EXTRA_DIST) info +Makefile: $(BFDDIR)/configure.in + # Targets to rebuild dependencies in this Makefile. # Have to get rid of DEP1 here so that "$?" later includes all of $(CFILES). DEP: dep.sed $(CFILES) $(HFILES) $(GENERATED_CFILES) $(GENERATED_HFILES) config.h @@ -1079,151 +1081,172 @@ install-exec-local: install-binPROGRAMS # DO NOT DELETE THIS LINE -- mkdep uses it. # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. addr2line.o: addr2line.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/getopt.h $(INCDIR)/libiberty.h $(INCDIR)/demangle.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h -ar.o: ar.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ - $(INCDIR)/progress.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/aout/ar.h $(BFDDIR)/libbfd.h \ - arsup.h $(INCDIR)/filenames.h + $(INCDIR)/symcat.h $(INCDIR)/getopt.h $(INCDIR)/libiberty.h \ + $(INCDIR)/demangle.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h +ar.o: ar.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \ + $(INCDIR)/libiberty.h $(INCDIR)/progress.h bucomm.h \ + config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/aout/ar.h $(BFDDIR)/libbfd.h arsup.h $(INCDIR)/filenames.h arsup.o: arsup.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - arsup.h $(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h + $(INCDIR)/symcat.h arsup.h $(INCDIR)/libiberty.h bucomm.h \ + config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/filenames.h bucomm.o: bucomm.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h + $(INCDIR)/symcat.h $(INCDIR)/libiberty.h bucomm.h config.h \ + $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h coffdump.o: coffdump.c coffgrok.h bucomm.h config.h \ $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h coffgrok.o: coffgrok.c bucomm.h config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h coffgrok.h debug.o: debug.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h debug.h + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h debug.h dlltool.o: dlltool.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/demangle.h $(INCDIR)/dyn-string.h \ - dlltool.h + $(INCDIR)/symcat.h $(INCDIR)/libiberty.h bucomm.h config.h \ + $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/demangle.h \ + $(INCDIR)/dyn-string.h dlltool.h $(INCDIR)/safe-ctype.h filemode.o: filemode.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h -ieee.o: ieee.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/ieee.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h debug.h budbg.h $(INCDIR)/filenames.h + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h +ieee.o: ieee.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \ + $(INCDIR)/ieee.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h debug.h \ + budbg.h $(INCDIR)/filenames.h is-ranlib.o: is-ranlib.c is-strip.o: is-strip.c maybe-ranlib.o: maybe-ranlib.c maybe-strip.o: maybe-strip.c nlmconv.o: nlmconv.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(BFDDIR)/libnlm.h $(INCDIR)/nlm/common.h \ - $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h nlmconv.h -nm.o: nm.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/progress.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ranlib.h \ - $(INCDIR)/demangle.h $(INCDIR)/libiberty.h + $(INCDIR)/symcat.h $(INCDIR)/libiberty.h bucomm.h config.h \ + $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/safe-ctype.h \ + $(BFDDIR)/libnlm.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \ + $(INCDIR)/nlm/external.h nlmconv.h +nm.o: nm.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \ + $(INCDIR)/progress.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ranlib.h $(INCDIR)/demangle.h $(INCDIR)/libiberty.h not-ranlib.o: not-ranlib.c not-strip.o: not-strip.c objcopy.o: objcopy.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/progress.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h budbg.h \ - $(INCDIR)/filenames.h + $(INCDIR)/symcat.h $(INCDIR)/progress.h bucomm.h config.h \ + $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ + budbg.h $(INCDIR)/filenames.h objdump.o: objdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/getopt.h $(INCDIR)/progress.h bucomm.h config.h \ - $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/dis-asm.h \ - $(INCDIR)/libiberty.h $(INCDIR)/demangle.h debug.h \ - budbg.h $(INCDIR)/aout/aout64.h -prdbg.o: prdbg.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h $(INCDIR)/getopt.h $(INCDIR)/progress.h \ bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h debug.h budbg.h + $(INCDIR)/safe-ctype.h $(INCDIR)/dis-asm.h $(INCDIR)/libiberty.h \ + $(INCDIR)/demangle.h debug.h budbg.h $(INCDIR)/aout/aout64.h +prdbg.o: prdbg.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h debug.h \ + budbg.h rdcoff.o: rdcoff.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/coff/internal.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/demangle.h \ - debug.h budbg.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h bucomm.h \ + config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/libiberty.h $(INCDIR)/demangle.h debug.h \ + budbg.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h rddbg.o: rddbg.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h debug.h budbg.h -size.o: size.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/getopt.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h debug.h \ + budbg.h +size.o: size.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \ + $(INCDIR)/getopt.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h srconv.o: srconv.c bucomm.h config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h sysroff.h coffgrok.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h sysroff.c stabs.o: stabs.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h $(INCDIR)/demangle.h debug.h \ - budbg.h $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/demangle.h debug.h budbg.h $(INCDIR)/filenames.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def strings.o: strings.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h sysdump.o: sysdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - sysroff.h sysroff.c + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/safe-ctype.h sysroff.h \ + sysroff.c version.o: version.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h wrstabs.o: wrstabs.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h debug.h budbg.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h \ + debug.h budbg.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ + $(INCDIR)/aout/stab.def windres.o: windres.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/getopt.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/obstack.h \ - windres.h winduni.h + $(INCDIR)/symcat.h $(INCDIR)/getopt.h bucomm.h config.h \ + $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h windres.h \ + winduni.h resrc.o: resrc.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h windres.h winduni.h + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h \ + windres.h winduni.h rescoff.o: rescoff.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h windres.h winduni.h $(INCDIR)/coff/internal.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h windres.h \ + winduni.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h resbin.o: resbin.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h windres.h winduni.h -winduni.o: winduni.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h windres.h \ winduni.h +winduni.o: winduni.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h winduni.h $(INCDIR)/safe-ctype.h readelf.o: readelf.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/external.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/dwarf2.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \ - $(INCDIR)/elf/v850.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/mips.h \ - $(INCDIR)/elf/alpha.h $(INCDIR)/elf/arm.h $(INCDIR)/elf/m68k.h \ - $(INCDIR)/elf/sparc.h $(INCDIR)/elf/m32r.h $(INCDIR)/elf/d10v.h \ - $(INCDIR)/elf/d30v.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/mn10200.h \ - $(INCDIR)/elf/mn10300.h $(INCDIR)/elf/hppa.h $(INCDIR)/elf/arc.h \ - $(INCDIR)/elf/fr30.h $(INCDIR)/elf/mcore.h $(INCDIR)/elf/i960.h \ - $(INCDIR)/elf/pj.h $(INCDIR)/elf/avr.h $(INCDIR)/elf/ia64.h \ - $(INCDIR)/elf/cris.h $(INCDIR)/elf/i860.h $(INCDIR)/elf/x86-64.h \ - $(INCDIR)/elf/s390.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h unwind-ia64.h -resres.o: resres.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h $(INCDIR)/elf/common.h $(INCDIR)/elf/external.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/dwarf2.h $(INCDIR)/elf/i386.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/elf/v850.h $(INCDIR)/elf/ppc.h \ + $(INCDIR)/elf/mips.h $(INCDIR)/elf/alpha.h $(INCDIR)/elf/arm.h \ + $(INCDIR)/elf/m68k.h $(INCDIR)/elf/sparc.h $(INCDIR)/elf/m32r.h \ + $(INCDIR)/elf/d10v.h $(INCDIR)/elf/d30v.h $(INCDIR)/elf/sh.h \ + $(INCDIR)/elf/mn10200.h $(INCDIR)/elf/mn10300.h $(INCDIR)/elf/hppa.h \ + $(INCDIR)/elf/h8.h $(INCDIR)/elf/arc.h $(INCDIR)/elf/fr30.h \ + $(INCDIR)/elf/mcore.h $(INCDIR)/elf/i960.h $(INCDIR)/elf/pj.h \ + $(INCDIR)/elf/avr.h $(INCDIR)/elf/ia64.h $(INCDIR)/elf/cris.h \ + $(INCDIR)/elf/i860.h $(INCDIR)/elf/x86-64.h $(INCDIR)/elf/s390.h \ bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h windres.h winduni.h + unwind-ia64.h +resres.o: resres.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h windres.h \ + winduni.h dllwrap.o: dllwrap.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/dyn-string.h + $(INCDIR)/symcat.h $(INCDIR)/libiberty.h bucomm.h config.h \ + $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/dyn-string.h rename.o: rename.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h underscore.o: underscore.c arparse.o: arparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - arsup.h + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h arsup.h arlex.o: arlex.c $(INCDIR)/libiberty.h arparse.h sysroff.o: sysroff.c sysinfo.o: sysinfo.c syslex.o: syslex.c sysinfo.h defparse.o: defparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - dlltool.h + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h dlltool.h deflex.o: deflex.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \ defparse.h dlltool.h -nlmheader.o: nlmheader.c ../bfd/bfd.h bucomm.h config.h \ - $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/nlm/common.h \ - $(INCDIR)/nlm/internal.h nlmconv.h +nlmheader.o: nlmheader.c $(INCDIR)/safe-ctype.h ../bfd/bfd.h \ + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \ + nlmconv.h rcparse.o: rcparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h windres.h winduni.h + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h windres.h \ + winduni.h $(INCDIR)/safe-ctype.h rclex.o: rclex.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h windres.h winduni.h rcparse.h + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h \ + windres.h winduni.h rcparse.h # IF YOU PUT ANYTHING HERE IT WILL GO AWAY # Tell versions [3.59,3.63) of GNU make to not export all variables. diff -uprN binutils-2.11.90.0.31/binutils/NEWS binutils-2.11.92.0.5/binutils/NEWS --- binutils-2.11.90.0.31/binutils/NEWS Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/binutils/NEWS Mon Oct 1 15:25:22 2001 @@ -1,5 +1,10 @@ -*- text -*- +* readelf: Add --wide option to not break section header or segment listing + lines to fit into 80 columns. + +* strings: Add --encoding to display wide character strings. By Markus Kuhn. + * objcopy: Add --rename-section to change section names. * readelf: Support added for DWARF 2.1 extensions. Support added for diff -uprN binutils-2.11.90.0.31/binutils/addr2line.c binutils-2.11.92.0.5/binutils/addr2line.c --- binutils-2.11.90.0.31/binutils/addr2line.c Sat Mar 17 12:47:57 2001 +++ binutils-2.11.92.0.5/binutils/addr2line.c Thu Oct 4 14:35:43 2001 @@ -1,5 +1,5 @@ /* addr2line.c -- convert addresses to line number and function name - Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Contributed by Ulrich Lauther This file is part of GNU Binutils. @@ -28,7 +28,6 @@ both forms write results to stdout, the second form reads addresses to be converted from stdin. */ -#include #include #include "bfd.h" @@ -37,8 +36,6 @@ #include "demangle.h" #include "bucomm.h" -extern char *program_version; - static boolean with_functions; /* -f, show function names. */ static boolean do_demangle; /* -C, demangle names. */ static boolean base_names; /* -s, strip directory names. */ @@ -284,6 +281,9 @@ main (argc, argv) #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) setlocale (LC_MESSAGES, ""); #endif +#if defined (HAVE_SETLOCALE) + setlocale (LC_CTYPE, ""); +#endif bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); diff -uprN binutils-2.11.90.0.31/binutils/ar.c binutils-2.11.92.0.5/binutils/ar.c --- binutils-2.11.90.0.31/binutils/ar.c Sat Mar 17 12:47:57 2001 +++ binutils-2.11.92.0.5/binutils/ar.c Mon Oct 1 15:25:22 2001 @@ -1,5 +1,6 @@ /* ar.c - Archive modify and extract. - Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 + Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, + 2001 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -378,6 +379,9 @@ main (argc, argv) #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) setlocale (LC_MESSAGES, ""); #endif +#if defined (HAVE_SETLOCALE) + setlocale (LC_CTYPE, ""); +#endif bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); @@ -827,7 +831,7 @@ print_contents (abfd) /* xgettext:c-format */ printf (_("\n\n\n"), bfd_get_filename (abfd)); - bfd_seek (abfd, 0, SEEK_SET); + bfd_seek (abfd, (file_ptr) 0, SEEK_SET); size = buf.st_size; while (ncopied < size) @@ -838,8 +842,7 @@ print_contents (abfd) if (tocopy > BUFSIZE) tocopy = BUFSIZE; - nread = bfd_read (cbuf, 1, tocopy, abfd); /* oops -- broke - abstraction! */ + nread = bfd_bread (cbuf, (bfd_size_type) tocopy, abfd); if (nread != tocopy) /* xgettext:c-format */ fatal (_("%s is not a valid archive"), @@ -883,7 +886,7 @@ extract_file (abfd) if (verbose) printf ("x - %s\n", bfd_get_filename (abfd)); - bfd_seek (abfd, 0, SEEK_SET); + bfd_seek (abfd, (file_ptr) 0, SEEK_SET); ostream = NULL; if (size == 0) @@ -907,7 +910,7 @@ extract_file (abfd) if (tocopy > BUFSIZE) tocopy = BUFSIZE; - nread = bfd_read (cbuf, 1, tocopy, abfd); + nread = bfd_bread (cbuf, (bfd_size_type) tocopy, abfd); if (nread != tocopy) /* xgettext:c-format */ fatal (_("%s is not a valid archive"), diff -uprN binutils-2.11.90.0.31/binutils/bucomm.c binutils-2.11.92.0.5/binutils/bucomm.c --- binutils-2.11.90.0.31/binutils/bucomm.c Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/binutils/bucomm.c Mon Oct 1 15:25:22 2001 @@ -70,55 +70,26 @@ report (format, args) putc ('\n', stderr); } -#ifdef ANSI_PROTOTYPES void -fatal (const char *format, ...) +fatal VPARAMS ((const char *format, ...)) { - va_list args; + VA_OPEN (args, format); + VA_FIXEDARG (args, const char *, format); - va_start (args, format); report (format, args); - va_end (args); + VA_CLOSE (args); xexit (1); } void -non_fatal (const char *format, ...) +non_fatal VPARAMS ((const char *format, ...)) { - va_list args; + VA_OPEN (args, format); + VA_FIXEDARG (args, const char *, format); - va_start (args, format); report (format, args); - va_end (args); + VA_CLOSE (args); } -#else -void -fatal (va_alist) - va_dcl -{ - char *Format; - va_list args; - - va_start (args); - Format = va_arg (args, char *); - report (Format, args); - va_end (args); - xexit (1); -} - -void -non_fatal (va_alist) - va_dcl -{ - char *Format; - va_list args; - - va_start (args); - Format = va_arg (args, char *); - report (Format, args); - va_end (args); -} -#endif /* Set the default BFD target based on the configured target. Doing this permits the binutils to be configured for a particular target, diff -uprN binutils-2.11.90.0.31/binutils/coffdump.c binutils-2.11.92.0.5/binutils/coffdump.c --- binutils-2.11.90.0.31/binutils/coffdump.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/binutils/coffdump.c Thu Oct 4 14:35:43 2001 @@ -30,8 +30,6 @@ Foundation, Inc., 59 Temple Place - Suit #include "coffgrok.h" #include "bucomm.h" -#define PROGRAM_VERSION "1.0" - static int atnl; static void tab PARAMS ((int)); @@ -493,6 +491,9 @@ main (ac, av) #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) setlocale (LC_MESSAGES, ""); #endif +#if defined (HAVE_SETLOCALE) + setlocale (LC_CTYPE, ""); +#endif bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); @@ -509,7 +510,7 @@ main (ac, av) show_help (); /*NOTREACHED*/ case 'V': - printf (_("GNU %s version %s\n"), program_name, PROGRAM_VERSION); + print_version ("coffdump"); exit (0); /*NOTREACHED*/ case 0: diff -uprN binutils-2.11.90.0.31/binutils/configure binutils-2.11.92.0.5/binutils/configure --- binutils-2.11.90.0.31/binutils/configure Fri Aug 10 14:08:01 2001 +++ binutils-2.11.92.0.5/binutils/configure Thu Oct 4 14:35:43 2001 @@ -4337,7 +4337,7 @@ fi l= - if test -d $srcdir/po; then + if test -f $srcdir/po/POTFILES.in; then test -d po || mkdir po if test "x$srcdir" != "x."; then if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then diff -uprN binutils-2.11.90.0.31/binutils/dlltool.c binutils-2.11.92.0.5/binutils/dlltool.c --- binutils-2.11.90.0.31/binutils/dlltool.c Tue Apr 24 09:10:51 2001 +++ binutils-2.11.92.0.5/binutils/dlltool.c Mon Oct 1 15:25:22 2001 @@ -1,5 +1,5 @@ /* dlltool.c -- tool to generate stuff for PE style DLLs - Copyright 1995, 1996, 1997, 1998, 1999, 2000 + Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -253,8 +253,8 @@ #include "demangle.h" #include "dyn-string.h" #include "dlltool.h" +#include "safe-ctype.h" -#include #include #include @@ -3220,6 +3220,9 @@ main (ac, av) #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) setlocale (LC_MESSAGES, ""); #endif +#if defined (HAVE_SETLOCALE) + setlocale (LC_CTYPE, ""); +#endif bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); @@ -3386,7 +3389,7 @@ main (ac, av) imp_name_lab = xstrdup (imp_name); for (p = imp_name_lab; *p; p++) { - if (!isalpha ((unsigned char) *p) && !isdigit ((unsigned char) *p)) + if (!ISALNUM (*p)) *p = '_'; } head_label = make_label("_head_", imp_name_lab); diff -uprN binutils-2.11.90.0.31/binutils/dllwrap.c binutils-2.11.92.0.5/binutils/dllwrap.c --- binutils-2.11.90.0.31/binutils/dllwrap.c Thu Mar 15 14:51:47 2001 +++ binutils-2.11.92.0.5/binutils/dllwrap.c Mon Oct 1 15:25:22 2001 @@ -1,5 +1,5 @@ /* dllwrap.c -- wrapper for DLLTOOL and GCC to generate PE style DLLs - Copyright 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Contributed by Mumit Khan (khan@xraylith.wisc.edu). This file is part of GNU Binutils. @@ -36,7 +36,6 @@ #include "getopt.h" #include "dyn-string.h" -#include #include #include @@ -664,6 +663,15 @@ main (argc, argv) program_name = argv[0]; +#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) + setlocale (LC_MESSAGES, ""); +#endif +#if defined (HAVE_SETLOCALE) + setlocale (LC_CTYPE, ""); +#endif + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); + saved_argv = (char **) xmalloc (argc * sizeof (char*)); dlltool_arg_indices = (int *) xmalloc (argc * sizeof (int)); driver_arg_indices = (int *) xmalloc (argc * sizeof (int)); diff -uprN binutils-2.11.90.0.31/binutils/doc/Makefile.am binutils-2.11.92.0.5/binutils/doc/Makefile.am --- binutils-2.11.90.0.31/binutils/doc/Makefile.am Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/binutils/doc/Makefile.am Mon Oct 1 15:25:22 2001 @@ -146,8 +146,13 @@ DISTCLEANFILES = config.texi MOSTLYCLEANFILES = $(DEMANGLER_NAME).1 $(DEMANGLER_NAME).1: cxxfilt.man Makefile + if test -f cxxfilt.man; then \ + man=cxxfilt.man; \ + else \ + man=$(srcdir)/cxxfilt.man; \ + fi; \ sed -e 's/@PROGRAM@/$(DEMANGLER_NAME)/' \ - -e 's/cxxfilt/$(DEMANGLER_NAME)/' < cxxfilt.man \ + -e 's/cxxfilt/$(DEMANGLER_NAME)/' < $$man \ > $(DEMANGLER_NAME).1 # Maintenance diff -uprN binutils-2.11.90.0.31/binutils/doc/Makefile.in binutils-2.11.92.0.5/binutils/doc/Makefile.in --- binutils-2.11.90.0.31/binutils/doc/Makefile.in Fri Jul 6 09:26:11 2001 +++ binutils-2.11.92.0.5/binutils/doc/Makefile.in Thu Oct 4 14:35:43 2001 @@ -129,7 +129,9 @@ MANCONF = -Dman TEXI2POD = perl $(top_srcdir)/../etc/texi2pod.pl -POD2MAN = pod2man --center="GNU" --release="binutils-$(VERSION)" --section=1 +POD2MAN = pod2man --center="GNU Development Tools" \ + --release="binutils-$(VERSION)" --section=1 + # List of man pages generated from binutils.texi man_MANS = \ @@ -173,7 +175,7 @@ DIST_COMMON = Makefile.am Makefile.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = gtar +TAR = tar GZIP_ENV = --best all: all-redirect .SUFFIXES: @@ -536,8 +538,13 @@ cxxfilt.man: $(binutils_TEXI) rm -f $(DEMANGLER_NAME).pod $(DEMANGLER_NAME).1: cxxfilt.man Makefile + if test -f cxxfilt.man; then \ + man=cxxfilt.man; \ + else \ + man=$(srcdir)/cxxfilt.man; \ + fi; \ sed -e 's/@PROGRAM@/$(DEMANGLER_NAME)/' \ - -e 's/cxxfilt/$(DEMANGLER_NAME)/' < cxxfilt.man \ + -e 's/cxxfilt/$(DEMANGLER_NAME)/' < $$man \ > $(DEMANGLER_NAME).1 # Maintenance diff -uprN binutils-2.11.90.0.31/binutils/doc/binutils.texi binutils-2.11.92.0.5/binutils/doc/binutils.texi --- binutils-2.11.90.0.31/binutils/doc/binutils.texi Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/binutils/doc/binutils.texi Mon Oct 1 15:25:22 2001 @@ -1853,9 +1853,12 @@ ar(1), objdump(1), readelf(1), and the I @smallexample @c man begin SYNOPSIS strings -strings [@option{-afov}] [@option{-}@var{min-len}] [@option{-n} @var{min-len}] [@option{-t} @var{radix}] [@option{-}] - [@option{--all}] [@option{--print-file-name}] [@option{--bytes=}@var{min-len}] - [@option{--radix=}@var{radix}] [@option{--target=}@var{bfdname}] +strings [@option{-afov}] [@option{-}@var{min-len}] + [@option{-n} @var{min-len}] [@option{--bytes=}@var{min-len}] + [@option{-t} @var{radix}] [@option{--radix=}@var{radix}] + [@option{-e} @var{encoding}] [@option{--encoding=}@var{encoding}] + [@option{-}] [@option{--all}] [@option{--print-file-name}] + [@option{--target=}@var{bfdname}] [@option{--help}] [@option{--version}] @var{file}@dots{} @c man end @end smallexample @@ -1907,6 +1910,15 @@ Print the offset within the file before character argument specifies the radix of the offset---@samp{o} for octal, @samp{x} for hexadecimal, or @samp{d} for decimal. +@item -e @var{encoding} +@itemx --encoding=@var{encoding} +Select the character encoding of the strings that are to be found. +Possible values for @var{encoding} are: @samp{s} = single-byte +characters (ASCII, ISO 8859, etc., default), @samp{b} = 16-bit +Bigendian, @samp{l} = 16-bit Littleendian, @samp{B} = 32-bit Bigendian, +@samp{L} = 32-bit Littleendian. Useful for finding wide character +strings. + @item --target=@var{bfdname} @cindex object code format Specify an object code format other than your system's default format. @@ -2825,6 +2837,7 @@ readelf [@option{-a}|@option{--all}] [@option{-w[liaprmf]}|@option{--debug-dump}[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames]] [@option{-histogram}] [@option{-v}|@option{--version}] + [@option{-W}|@option{--wide}] [@option{-H}|@option{--help}] @var{elffile}@dots{} @c man end @@ -2937,6 +2950,14 @@ of the symbol tables. @itemx --version Display the version number of readelf. +@item -W +@itemx --wide +Don't break output lines to fit into 80 columns. By default +@command{readelf} breaks section header and segment listing lines for +64-bit ELF files, so that they fit into 80 columns. This option causes +@command{readelf} to print each section header resp. each segment one a +single line, which is far more readable on terminals wider than 80 columns. + @item -H @itemx --help Display the command line options understood by @command{readelf}. diff -uprN binutils-2.11.90.0.31/binutils/nlmconv.c binutils-2.11.92.0.5/binutils/nlmconv.c --- binutils-2.11.90.0.31/binutils/nlmconv.c Sat Mar 17 12:47:57 2001 +++ binutils-2.11.92.0.5/binutils/nlmconv.c Mon Oct 1 15:25:22 2001 @@ -1,5 +1,5 @@ /* nlmconv.c -- NLM conversion program - Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 + Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -35,10 +35,10 @@ Foundation, Inc., 59 Temple Place - Suit #include "bfd.h" #include "libiberty.h" #include "bucomm.h" +#include "safe-ctype.h" #include #include -#include #include #include #include @@ -56,7 +56,7 @@ Foundation, Inc., 59 Temple Place - Suit /* If strerror is just a macro, we want to use the one from libiberty since it will handle undefined values. */ #undef strerror -extern char *strerror (); +extern char *strerror PARAMS ((int)); #ifndef localtime extern struct tm *localtime (); @@ -214,6 +214,9 @@ main (argc, argv) #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) setlocale (LC_MESSAGES, ""); #endif +#if defined (HAVE_SETLOCALE) + setlocale (LC_CTYPE, ""); +#endif bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); @@ -1071,8 +1074,7 @@ main (argc, argv) for (modname = nlm_fixed_header (outbfd)->moduleName; *modname != '\0'; modname++) - if (islower ((unsigned char) *modname)) - *modname = toupper (*modname); + *modname = TOUPPER (*modname); strncpy (nlm_variable_header (outbfd)->oldThreadName, " LONG", NLM_OLD_THREAD_NAME_LENGTH); @@ -1127,7 +1129,7 @@ static const char * select_output_format (arch, mach, bigendian) enum bfd_architecture arch; unsigned long mach; - boolean bigendian; + boolean bigendian ATTRIBUTE_UNUSED; { switch (arch) { @@ -1160,7 +1162,7 @@ select_output_format (arch, mach, bigend static void setup_sections (inbfd, insec, data_ptr) - bfd *inbfd; + bfd *inbfd ATTRIBUTE_UNUSED; asection *insec; PTR data_ptr; { @@ -1384,12 +1386,12 @@ mangle_relocs (outbfd, insec, relocs_ptr static void default_mangle_relocs (outbfd, insec, relocs_ptr, reloc_count_ptr, contents, contents_size) - bfd *outbfd; + bfd *outbfd ATTRIBUTE_UNUSED; asection *insec; arelent ***relocs_ptr; long *reloc_count_ptr; - char *contents; - bfd_size_type contents_size; + char *contents ATTRIBUTE_UNUSED; + bfd_size_type contents_size ATTRIBUTE_UNUSED; { if (insec->output_offset != 0) { @@ -1593,8 +1595,8 @@ alpha_mangle_relocs (outbfd, insec, relo asection *insec; register arelent ***relocs_ptr; long *reloc_count_ptr; - char *contents; - bfd_size_type contents_size; + char *contents ATTRIBUTE_UNUSED; + bfd_size_type contents_size ATTRIBUTE_UNUSED; { long old_reloc_count; arelent **old_relocs; @@ -1726,7 +1728,7 @@ static bfd_size_type powerpc_initial_got static void powerpc_build_stubs (inbfd, outbfd, symbols_ptr, symcount_ptr) bfd *inbfd; - bfd *outbfd; + bfd *outbfd ATTRIBUTE_UNUSED; asymbol ***symbols_ptr; long *symcount_ptr; { @@ -1915,7 +1917,7 @@ powerpc_mangle_relocs (outbfd, insec, re register arelent ***relocs_ptr; long *reloc_count_ptr; char *contents; - bfd_size_type contents_size; + bfd_size_type contents_size ATTRIBUTE_UNUSED; { reloc_howto_type *toc_howto; long reloc_count; diff -uprN binutils-2.11.90.0.31/binutils/nlmheader.y binutils-2.11.92.0.5/binutils/nlmheader.y --- binutils-2.11.90.0.31/binutils/nlmheader.y Thu Mar 15 14:51:48 2001 +++ binutils-2.11.92.0.5/binutils/nlmheader.y Mon Oct 1 15:25:22 2001 @@ -1,5 +1,5 @@ %{/* nlmheader.y - parse NLM header specification keywords. - Copyright 1993, 1994, 1995, 1997, 1998 Free Software Foundation, Inc. + Copyright 1993, 1994, 1995, 1997, 1998, 2001 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suit #include #include -#include +#include "safe-ctype.h" #include "bfd.h" #include "bucomm.h" #include "nlm/common.h" @@ -682,7 +682,7 @@ tail_recurse: c = getc (current.file); /* Commas are treated as whitespace characters. */ - while (isspace ((unsigned char) c) || c == ',') + while (ISSPACE (c) || c == ',') { current.state = IN_LINE; if (c == '\n') @@ -735,9 +735,9 @@ tail_recurse: if (c == '\n') ++current.lineno; } - while (isspace ((unsigned char) c)); + while (ISSPACE (c)); BUF_INIT (); - while (! isspace ((unsigned char) c) && c != EOF) + while (! ISSPACE (c) && c != EOF) { BUF_ADD (c); c = getc (current.file); @@ -755,17 +755,14 @@ tail_recurse: if (current.state == BEGINNING_OF_LINE) { BUF_INIT (); - while (isalnum ((unsigned char) c) || c == '_') + while (ISALNUM (c) || c == '_') { - if (islower ((unsigned char) c)) - BUF_ADD (toupper ((unsigned char) c)); - else - BUF_ADD (c); + BUF_ADD (TOUPPER (c)); c = getc (current.file); } BUF_FINISH (); - if (c != EOF && ! isspace ((unsigned char) c) && c != ',') + if (c != EOF && ! ISSPACE (c) && c != ',') { nlmheader_identify (); fprintf (stderr, _("%s:%d: illegal character in keyword: %c\n"), @@ -838,7 +835,7 @@ tail_recurse: /* Gather a generic argument. */ BUF_INIT (); - while (! isspace (c) + while (! ISSPACE (c) && c != ',' && c != COMMENT_CHAR && c != '(' diff -uprN binutils-2.11.90.0.31/binutils/nm.c binutils-2.11.92.0.5/binutils/nm.c --- binutils-2.11.90.0.31/binutils/nm.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/binutils/nm.c Mon Oct 1 15:25:22 2001 @@ -409,6 +409,9 @@ main (argc, argv) #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) setlocale (LC_MESSAGES, ""); #endif +#if defined (HAVE_SETLOCALE) + setlocale (LC_CTYPE, ""); +#endif bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); diff -uprN binutils-2.11.90.0.31/binutils/objcopy.c binutils-2.11.92.0.5/binutils/objcopy.c --- binutils-2.11.90.0.31/binutils/objcopy.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/binutils/objcopy.c Mon Oct 1 15:25:22 2001 @@ -2399,47 +2399,43 @@ copy_main (argc, argv) case OPTION_RENAME_SECTION: { flagword flags; - const char * s; - char * old_name; - char * new_name; + const char *eq, *fl; + char *old_name; + char *new_name; unsigned int len; - s = strchr (optarg, '='); - if (s == NULL) + eq = strchr (optarg, '='); + if (eq == NULL) fatal (_("bad format for %s"), "--rename-section"); - len = s - optarg; + len = eq - optarg; if (len == 0) - fatal (_("no old name is %s"), "--rename-section"); + fatal (_("bad format for %s"), "--rename-section"); old_name = (char *) xmalloc (len + 1); strncpy (old_name, optarg, len); old_name[len] = 0; - s = strchr (optarg + len, ','); - if (s) + eq++; + fl = strchr (eq, ','); + if (fl) { - unsigned int new_len; - - flags = parse_flags (s + 1); - new_len = s - (optarg + len); - if (new_len == 0) - fatal (_("no new name in %s"), "--rename-section"); - new_name = (char *) xmalloc (new_len + 1); - strncpy (new_name, optarg + len, new_len); - new_name [new_len] = 0; + flags = parse_flags (fl + 1); + len = fl - eq; } else { - s = optarg + len; - len = strlen (s); - if (len == 0) - fatal (_("no new name in %s"), "--rename-section"); - new_name = (char *) xmalloc (len + 1); - strcpy (new_name, s); flags = -1; + len = strlen (eq); } + if (len == 0) + fatal (_("bad format for %s"), "--rename-section"); + + new_name = (char *) xmalloc (len + 1); + strncpy (new_name, eq, len); + new_name[len] = 0; + add_section_rename (old_name, new_name, flags); } break; @@ -2611,6 +2607,9 @@ main (argc, argv) #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) setlocale (LC_MESSAGES, ""); #endif +#if defined (HAVE_SETLOCALE) + setlocale (LC_CTYPE, ""); +#endif bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); diff -uprN binutils-2.11.90.0.31/binutils/objdump.c binutils-2.11.92.0.5/binutils/objdump.c --- binutils-2.11.90.0.31/binutils/objdump.c Fri Aug 10 14:08:01 2001 +++ binutils-2.11.92.0.5/binutils/objdump.c Thu Oct 4 14:35:43 2001 @@ -23,7 +23,7 @@ Foundation, 59 Temple Place - Suite 330, #include "getopt.h" #include "progress.h" #include "bucomm.h" -#include +#include "safe-ctype.h" #include "dis-asm.h" #include "libiberty.h" #include "demangle.h" @@ -289,7 +289,7 @@ dump_section_header (abfd, section, igno bfd_printf_vma (abfd, bfd_get_section_vma (abfd, section)); printf (" "); bfd_printf_vma (abfd, section->lma); - printf (" %08lx 2**%u", section->filepos, + printf (" %08lx 2**%u", (unsigned long) section->filepos, bfd_get_section_alignment (abfd, section)); if (! wide_output) printf ("\n "); @@ -306,9 +306,6 @@ dump_section_header (abfd, section, igno PF (SEC_CONSTRUCTOR_BSS, "CONSTRUCTOR BSS"); PF (SEC_LOAD, "LOAD"); PF (SEC_RELOC, "RELOC"); -#ifdef SEC_BALIGN - PF (SEC_BALIGN, "BALIGN"); -#endif PF (SEC_READONLY, "READONLY"); PF (SEC_CODE, "CODE"); PF (SEC_DATA, "DATA"); @@ -321,6 +318,7 @@ dump_section_header (abfd, section, igno PF (SEC_CLINK, "CLINK"); PF (SEC_SMALL_DATA, "SMALL_DATA"); PF (SEC_SHARED, "SHARED"); + PF (SEC_ARCH_BIT_0, "ARCH_BIT_0"); if ((section->flags & SEC_LINK_ONCE) != 0) { @@ -1111,35 +1109,20 @@ typedef struct /* sprintf to a "stream" */ static int -#ifdef ANSI_PROTOTYPES -objdump_sprintf (SFILE *f, const char *format, ...) -#else -objdump_sprintf (va_alist) - va_dcl -#endif +objdump_sprintf VPARAMS ((SFILE *f, const char *format, ...)) { -#ifndef ANSI_PROTOTYPES - SFILE *f; - const char *format; -#endif char *buf; - va_list args; size_t n; -#ifdef ANSI_PROTOTYPES - va_start (args, format); -#else - va_start (args); - f = va_arg (args, SFILE *); - format = va_arg (args, const char *); -#endif + VA_OPEN (args, format); + VA_FIXEDARG (args, SFILE *, f); + VA_FIXEDARG (args, const char *, format); vasprintf (&buf, format, args); - va_end (args); - if (buf == NULL) { + va_end (args); fatal (_("Out of virtual memory")); } @@ -1161,6 +1144,7 @@ objdump_sprintf (va_alist) free (buf); + VA_CLOSE (args); return n; } @@ -1347,7 +1331,7 @@ disassemble_bytes (info, disassemble_fn, for (j = addr_offset * opb; j < addr_offset * opb + octets; ++j) { - if (isprint (data[j])) + if (ISPRINT (data[j])) buf[j - addr_offset * opb] = data[j]; else buf[j - addr_offset * opb] = '.'; @@ -2001,7 +1985,7 @@ dump_section_stabs (abfd, stabsect_name, match or a section followed by a number. */ if (strncmp (stabsect_name, s->name, len) == 0 && (s->name[len] == '\000' - || isdigit ((unsigned char) s->name[len]))) + || ISDIGIT (s->name[len]))) { if (read_section_stabs (abfd, s->name, strsect_name)) { @@ -2288,7 +2272,7 @@ dump_data (abfd) if (j >= stop_offset * opb) printf (" "); else - printf ("%c", isprint (data[j]) ? data[j] : '.'); + printf ("%c", ISPRINT (data[j]) ? data[j] : '.'); } putchar ('\n'); } @@ -2751,7 +2735,7 @@ display_target_tables () static void display_info () { - printf (_("BFD header file version %s\n"), BFD_VERSION); + printf (_("BFD header file version %s\n"), BFD_VERSION_STRING); display_target_list (); display_target_tables (); } @@ -2769,6 +2753,9 @@ main (argc, argv) #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) setlocale (LC_MESSAGES, ""); #endif +#if defined (HAVE_SETLOCALE) + setlocale (LC_CTYPE, ""); +#endif bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); diff -uprN binutils-2.11.90.0.31/binutils/rclex.l binutils-2.11.92.0.5/binutils/rclex.l --- binutils-2.11.90.0.31/binutils/rclex.l Thu Mar 15 14:51:50 2001 +++ binutils-2.11.92.0.5/binutils/rclex.l Mon Oct 1 15:25:22 2001 @@ -1,5 +1,5 @@ %{ /* rclex.l -- lexer for Windows rc files parser */ -/* Copyright 1997, 1998, 1999 Free Software Foundation, Inc. +/* Copyright 1997, 1998, 1999, 2001 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of GNU Binutils. @@ -26,10 +26,10 @@ #include "bfd.h" #include "bucomm.h" #include "libiberty.h" +#include "safe-ctype.h" #include "windres.h" #include "rcparse.h" -#include #include /* Whether we are in rcdata mode, in which we returns the lengths of @@ -252,18 +252,18 @@ cpp_line (s) char *send, *fn; ++s; - while (isspace ((unsigned char) *s)) + while (ISSPACE (*s)) ++s; line = strtol (s, &send, 0); - if (*send != '\0' && ! isspace ((unsigned char) *send)) + if (*send != '\0' && ! ISSPACE (*send)) return; /* Subtract 1 because we are about to count the newline. */ rc_lineno = line - 1; s = send; - while (isspace ((unsigned char) *s)) + while (ISSPACE (*s)) ++s; if (*s != '"') @@ -423,8 +423,8 @@ handle_quotes (input, len) else { ++t; - assert (isspace ((unsigned char) *t)); - while (isspace ((unsigned char) *t)) + assert (ISSPACE (*t)); + while (ISSPACE (*t)) ++t; if (*t == '\0') break; diff -uprN binutils-2.11.90.0.31/binutils/rcparse.y binutils-2.11.92.0.5/binutils/rcparse.y --- binutils-2.11.90.0.31/binutils/rcparse.y Thu Jul 26 18:02:55 2001 +++ binutils-2.11.92.0.5/binutils/rcparse.y Mon Oct 1 15:25:22 2001 @@ -1,5 +1,5 @@ %{ /* rcparse.y -- parser for Windows rc files - Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of GNU Binutils. @@ -26,8 +26,7 @@ #include "bucomm.h" #include "libiberty.h" #include "windres.h" - -#include +#include "safe-ctype.h" /* The current language. */ @@ -245,7 +244,7 @@ acc_event: $$.flags = ACC_CONTROL | ACC_VIRTKEY; ++s; ch = *s; - ch = toupper ((unsigned char) ch); + ch = TOUPPER (ch); } $$.key = ch; if (s[1] != '\0') @@ -1259,8 +1258,7 @@ id: /* It seems that resource ID's are forced to upper case. */ copy = xstrdup ($1); for (s = copy; *s != '\0'; s++) - if (islower ((unsigned char) *s)) - *s = toupper ((unsigned char) *s); + *s = TOUPPER (*s); res_string_to_id (&$$, copy); free (copy); } @@ -1297,8 +1295,7 @@ resref: /* It seems that resource ID's are forced to upper case. */ copy = xstrdup ($1); for (s = copy; *s != '\0'; s++) - if (islower ((unsigned char) *s)) - *s = toupper ((unsigned char) *s); + *s = TOUPPER (*s); res_string_to_id (&$$, copy); free (copy); } diff -uprN binutils-2.11.90.0.31/binutils/readelf.c binutils-2.11.92.0.5/binutils/readelf.c --- binutils-2.11.90.0.31/binutils/readelf.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/binutils/readelf.c Thu Oct 4 14:35:43 2001 @@ -64,6 +64,7 @@ #include "elf/mn10200.h" #include "elf/mn10300.h" #include "elf/hppa.h" +#include "elf/h8.h" #include "elf/arc.h" #include "elf/fr30.h" #include "elf/mcore.h" @@ -110,6 +111,7 @@ int do_using_dynamic; int do_header; int do_dump; int do_version; +int do_wide; int do_histogram; int do_debugging; int do_debug_info; @@ -279,61 +281,27 @@ typedef int Elf32_Word; : get_64bit_elf_symbols (file, offset, size)) -#ifdef ANSI_PROTOTYPES static void -error (const char * message, ...) +error VPARAMS ((const char *message, ...)) { - va_list args; + VA_OPEN (args, message); + VA_FIXEDARG (args, const char *, message); fprintf (stderr, _("%s: Error: "), program_name); - va_start (args, message); vfprintf (stderr, message, args); - va_end (args); - return; -} - -static void -warn (const char * message, ...) -{ - va_list args; - - fprintf (stderr, _("%s: Warning: "), program_name); - va_start (args, message); - vfprintf (stderr, message, args); - va_end (args); - return; -} -#else -static void -error (va_alist) - va_dcl -{ - char * message; - va_list args; - - fprintf (stderr, _("%s: Error: "), program_name); - va_start (args); - message = va_arg (args, char *); - vfprintf (stderr, message, args); - va_end (args); - return; + VA_CLOSE (args); } static void -warn (va_alist) - va_dcl +warn VPARAMS ((const char *message, ...)) { - char * message; - va_list args; + VA_OPEN (args, message); + VA_FIXEDARG (args, const char *, message); fprintf (stderr, _("%s: Warning: "), program_name); - va_start (args); - message = va_arg (args, char *); vfprintf (stderr, message, args); - va_end (args); - return; + VA_CLOSE (args); } -#endif static PTR get_data PARAMS ((PTR, FILE *, long, size_t, const char *)); @@ -472,7 +440,7 @@ print_vma (vma, mode) printf ("%lx", vma); #else if (_bfd_int64_high (vma)) - printf ("%lx%lx", _bfd_int64_high (vma), _bfd_int64_low (vma)); + printf ("%lx%8.8lx", _bfd_int64_high (vma), _bfd_int64_low (vma)); else printf ("%lx", _bfd_int64_low (vma)); #endif @@ -581,7 +549,9 @@ guess_is_rela (e_machine) case EM_386: case EM_486: case EM_960: + case EM_M32R: case EM_CYGNUS_M32R: + case EM_D10V: case EM_CYGNUS_D10V: case EM_MIPS: case EM_MIPS_RS3_LE: @@ -589,20 +559,29 @@ guess_is_rela (e_machine) /* Targets that use RELA relocations. */ case EM_68K: + case EM_H8_300: + case EM_H8_300H: + case EM_H8S: case EM_SPARC32PLUS: case EM_SPARCV9: case EM_SPARC: case EM_PPC: + case EM_V850: case EM_CYGNUS_V850: + case EM_D30V: case EM_CYGNUS_D30V: + case EM_MN10200: case EM_CYGNUS_MN10200: + case EM_MN10300: case EM_CYGNUS_MN10300: + case EM_FR30: case EM_CYGNUS_FR30: case EM_SH: case EM_ALPHA: case EM_MCORE: case EM_IA_64: case EM_AVR: + case EM_AVR_OLD: case EM_CRIS: case EM_860: case EM_X86_64: @@ -894,6 +873,7 @@ dump_relocations (file, rel_offset, rel_ rtype = NULL; break; + case EM_M32R: case EM_CYGNUS_M32R: rtype = elf_m32r_reloc_type (type); break; @@ -912,6 +892,7 @@ dump_relocations (file, rel_offset, rel_ break; case EM_AVR: + case EM_AVR_OLD: rtype = elf_avr_reloc_type (type); break; @@ -922,14 +903,17 @@ dump_relocations (file, rel_offset, rel_ rtype = elf_sparc_reloc_type (type); break; + case EM_V850: case EM_CYGNUS_V850: rtype = v850_reloc_type (type); break; + case EM_D10V: case EM_CYGNUS_D10V: rtype = elf_d10v_reloc_type (type); break; + case EM_D30V: case EM_CYGNUS_D30V: rtype = elf_d30v_reloc_type (type); break; @@ -938,14 +922,17 @@ dump_relocations (file, rel_offset, rel_ rtype = elf_sh_reloc_type (type); break; + case EM_MN10300: case EM_CYGNUS_MN10300: rtype = elf_mn10300_reloc_type (type); break; + case EM_MN10200: case EM_CYGNUS_MN10200: rtype = elf_mn10200_reloc_type (type); break; + case EM_FR30: case EM_CYGNUS_FR30: rtype = elf_fr30_reloc_type (type); break; @@ -972,7 +959,6 @@ dump_relocations (file, rel_offset, rel_ rtype = elf_arm_reloc_type (type); break; - case EM_CYGNUS_ARC: case EM_ARC: rtype = elf_arc_reloc_type (type); break; @@ -981,7 +967,14 @@ dump_relocations (file, rel_offset, rel_ rtype = elf_hppa_reloc_type (type); break; + case EM_H8_300: + case EM_H8_300H: + case EM_H8S: + rtype = elf_h8_reloc_type (type); + break; + case EM_PJ: + case EM_PJ_OLD: rtype = elf_pj_reloc_type (type); break; case EM_IA_64: @@ -1345,14 +1338,21 @@ get_machine_name (e_machine) case EM_COLDFIRE: return "Motorola Coldfire"; case EM_68HC12: return "Motorola M68HC12"; case EM_ALPHA: return "Alpha"; - case EM_CYGNUS_D10V: return "d10v"; - case EM_CYGNUS_D30V: return "d30v"; - case EM_CYGNUS_ARC: return "ARC"; - case EM_CYGNUS_M32R: return "Mitsubishi M32r"; - case EM_CYGNUS_V850: return "NEC v850"; - case EM_CYGNUS_MN10300: return "mn10300"; - case EM_CYGNUS_MN10200: return "mn10200"; - case EM_CYGNUS_FR30: return "Fujitsu FR30"; + case EM_CYGNUS_D10V: + case EM_D10V: return "d10v"; + case EM_CYGNUS_D30V: + case EM_D30V: return "d30v"; + case EM_CYGNUS_M32R: + case EM_M32R: return "Mitsubishi M32r"; + case EM_CYGNUS_V850: + case EM_V850: return "NEC v850"; + case EM_CYGNUS_MN10300: + case EM_MN10300: return "mn10300"; + case EM_CYGNUS_MN10200: + case EM_MN10200: return "mn10200"; + case EM_CYGNUS_FR30: + case EM_FR30: return "Fujitsu FR30"; + case EM_PJ_OLD: case EM_PJ: return "picoJava"; case EM_MMA: return "Fujitsu Multimedia Accelerator"; case EM_PCP: return "Siemens PCP"; @@ -1372,6 +1372,7 @@ get_machine_name (e_machine) case EM_SVX: return "Silicon Graphics SVx"; case EM_ST19: return "STMicroelectronics ST19 8-bit microcontroller"; case EM_VAX: return "Digital VAX"; + case EM_AVR_OLD: case EM_AVR: return "Atmel AVR 8-bit microcontroller"; case EM_CRIS: return "Axis Communications 32-bit embedded processor"; case EM_JAVELIN: return "Infineon Technologies 32-bit embedded cpu"; @@ -1567,6 +1568,7 @@ get_machine_flags (e_flags, e_machine) strcat (buf, ", relocatable-lib"); break; + case EM_V850: case EM_CYGNUS_V850: switch (e_flags & EF_V850_ARCH) { @@ -1585,6 +1587,7 @@ get_machine_flags (e_flags, e_machine) } break; + case EM_M32R: case EM_CYGNUS_M32R: if ((e_flags & EF_M32R_ARCH) == E_M32R_ARCH) strcat (buf, ", m32r"); @@ -1639,7 +1642,6 @@ get_machine_flags (e_flags, e_machine) case E_MIPS_MACH_4100: strcat (buf, ", 4100"); break; case E_MIPS_MACH_4650: strcat (buf, ", 4650"); break; case E_MIPS_MACH_4111: strcat (buf, ", 4111"); break; - case E_MIPS_MACH_MIPS32_4K: strcat (buf, ", mips32-4k"); break; case E_MIPS_MACH_SB1: strcat (buf, ", sb1"); break; default: strcat (buf, " UNKNOWN"); break; } @@ -1701,6 +1703,7 @@ get_machine_flags (e_flags, e_machine) break; case EM_PJ: + case EM_PJ_OLD: if ((e_flags & EF_PICOJAVA_NEWCALLS) == EF_PICOJAVA_NEWCALLS) strcat (buf, ", new calling convention"); @@ -2035,6 +2038,7 @@ struct option options [] = #endif {"version", no_argument, 0, 'v'}, + {"wide", no_argument, 0, 'W'}, {"help", no_argument, 0, 'H'}, {0, no_argument, 0, 0} }; @@ -2069,6 +2073,7 @@ usage () #endif fprintf (stdout, _(" -I or --histogram Display histogram of bucket list lengths\n")); fprintf (stdout, _(" -v or --version Display the version number of readelf\n")); + fprintf (stdout, _(" -W or --wide Don't split lines to fit into 80 columns\n")); fprintf (stdout, _(" -H or --help Display this information\n")); fprintf (stdout, _("Report bugs to %s\n"), REPORT_BUGS_TO); @@ -2117,7 +2122,7 @@ parse_args (argc, argv) usage (); while ((c = getopt_long - (argc, argv, "ersuahnldSDAIw::x:i:vV", options, NULL)) != EOF) + (argc, argv, "ersuahnldSDAIw::x:i:vVW", options, NULL)) != EOF) { char * cp; int section; @@ -2259,6 +2264,9 @@ parse_args (argc, argv) case 'V': do_version ++; break; + case 'W': + do_wide ++; + break; default: oops: /* xgettext:c-format */ @@ -2542,6 +2550,9 @@ process_program_headers (file) if (is_32bit_elf) printf (_(" Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align\n")); + else if (do_wide) + printf + (_(" Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align\n")); else { printf @@ -2576,6 +2587,48 @@ process_program_headers (file) (segment->p_flags & PF_X ? 'E' : ' ')); printf ("%#lx", (unsigned long) segment->p_align); } + else if (do_wide) + { + if ((unsigned long) segment->p_offset == segment->p_offset) + printf ("0x%6.6lx ", (unsigned long) segment->p_offset); + else + { + print_vma (segment->p_offset, FULL_HEX); + putchar (' '); + } + + print_vma (segment->p_vaddr, FULL_HEX); + putchar (' '); + print_vma (segment->p_paddr, FULL_HEX); + putchar (' '); + + if ((unsigned long) segment->p_filesz == segment->p_filesz) + printf ("0x%6.6lx ", (unsigned long) segment->p_filesz); + else + { + print_vma (segment->p_filesz, FULL_HEX); + putchar (' '); + } + + if ((unsigned long) segment->p_memsz == segment->p_memsz) + printf ("0x%6.6lx", (unsigned long) segment->p_memsz); + else + { + print_vma (segment->p_offset, FULL_HEX); + } + + printf (" %c%c%c ", + (segment->p_flags & PF_R ? 'R' : ' '), + (segment->p_flags & PF_W ? 'W' : ' '), + (segment->p_flags & PF_X ? 'E' : ' ')); + + if ((unsigned long) segment->p_align == segment->p_align) + printf ("%#lx", (unsigned long) segment->p_align); + else + { + print_vma (segment->p_align, PREFIX_HEX); + } + } else { print_vma (segment->p_offset, FULL_HEX); @@ -3014,6 +3067,9 @@ process_section_headers (file) if (is_32bit_elf) printf (_(" [Nr] Name Type Addr Off Size ES Flg Lk Inf Al\n")); + else if (do_wide) + printf + (_(" [Nr] Name Type Address Off Size ES Flg Lk Inf Al\n")); else { printf (_(" [Nr] Name Type Address Offset\n")); @@ -3045,11 +3101,59 @@ process_section_headers (file) (unsigned long) section->sh_info, (unsigned long) section->sh_addralign); } + else if (do_wide) + { + print_vma (section->sh_addr, LONG_HEX); + + if ((long) section->sh_offset == section->sh_offset) + printf (" %6.6lx", (unsigned long) section->sh_offset); + else + { + putchar (' '); + print_vma (section->sh_offset, LONG_HEX); + } + + if ((unsigned long) section->sh_size == section->sh_size) + printf (" %6.6lx", (unsigned long) section->sh_size); + else + { + putchar (' '); + print_vma (section->sh_size, LONG_HEX); + } + + if ((unsigned long) section->sh_entsize == section->sh_entsize) + printf (" %2.2lx", (unsigned long) section->sh_entsize); + else + { + putchar (' '); + print_vma (section->sh_entsize, LONG_HEX); + } + + printf (" %3s ", get_elf_section_flags (section->sh_flags)); + + printf ("%2ld %3lx ", + (unsigned long) section->sh_link, + (unsigned long) section->sh_info); + + if ((unsigned long) section->sh_addralign == section->sh_addralign) + printf ("%2ld\n", (unsigned long) section->sh_addralign); + else + { + print_vma (section->sh_addralign, DEC); + putchar ('\n'); + } + } else { putchar (' '); print_vma (section->sh_addr, LONG_HEX); - printf (" %8.8lx", section->sh_offset); + if ((long) section->sh_offset == section->sh_offset) + printf (" %8.8lx", (unsigned long) section->sh_offset); + else + { + printf (" "); + print_vma (section->sh_offset, LONG_HEX); + } printf ("\n "); print_vma (section->sh_size, LONG_HEX); printf (" "); @@ -3614,7 +3718,7 @@ process_unwind (file) printf ("'%s'", SECTION_NAME (unwsec)); printf (_(" at offset 0x%lx contains %lu entries:\n"), - unwsec->sh_offset, + (unsigned long) unwsec->sh_offset, (unsigned long) (unwsec->sh_size / (3 * addr_size))); (void) slurp_ia64_unwind_table (file, & aux, unwsec); @@ -5657,6 +5761,13 @@ display_debug_lines (section, start, fil /* Check the length of the block. */ info.li_length = BYTE_GET (external->li_length); + + if (info.li_length == 0xffffffff) + { + warn (_("64-bit DWARF line info is not supported yet.\n")); + break; + } + if (info.li_length + sizeof (external->li_length) > section->sh_size) { warn @@ -5885,6 +5996,12 @@ display_debug_pubnames (section, start, data = start + sizeof (* external); start += pubnames.pn_length + sizeof (external->pn_length); + if (pubnames.pn_length == 0xffffffff) + { + warn (_("64-bit DWARF pubnames are not supported yet.\n")); + break; + } + if (pubnames.pn_version != 2) { static int warned = 0; @@ -6384,7 +6501,7 @@ display_debug_macinfo (section, start, f return 1; } - + static int display_debug_abbrev (section, start, file) @@ -7079,6 +7196,12 @@ display_debug_info (section, start, file compunit.cu_abbrev_offset = BYTE_GET (external->cu_abbrev_offset); compunit.cu_pointer_size = BYTE_GET (external->cu_pointer_size); + if (compunit.cu_length == 0xffffffff) + { + warn (_("64-bit DWARF debug info is not supported yet.\n")); + break; + } + /* Check for RELA relocations in the abbrev_offset address, and apply them. */ for (relsec = section_headers; @@ -7109,7 +7232,7 @@ display_debug_info (section, start, file != (bfd_vma) ((unsigned char *) &external->cu_abbrev_offset - section_begin)) continue; - + if (is_32bit_elf) { sym = symtab + ELF32_R_SYM (rp->r_info); @@ -7180,7 +7303,7 @@ display_debug_info (section, start, file } begin = ((unsigned char *) - get_data (NULL, file, sec->sh_offset, sec->sh_size, + get_data (NULL, file, sec->sh_offset, sec->sh_size, _("debug_abbrev section data"))); if (!begin) return 0; @@ -7272,6 +7395,12 @@ display_debug_aranges (section, start, f arange.ar_pointer_size = BYTE_GET (external->ar_pointer_size); arange.ar_segment_size = BYTE_GET (external->ar_segment_size); + if (arange.ar_length == 0xffffffff) + { + warn (_("64-bit DWARF aranges are not supported yet.\n")); + break; + } + if (arange.ar_version != 2) { warn (_("Only DWARF 2 aranges are currently supported.\n")); @@ -7487,6 +7616,12 @@ display_debug_frames (section, start, fi if (length == 0) return 1; + if (length == 0xffffffff) + { + warn (_("64-bit DWARF format frames are not supported yet.\n")); + break; + } + block_end = saved_start + length + 4; cie_id = byte_get (start, 4); start += 4; @@ -7595,7 +7730,7 @@ display_debug_frames (section, start, fi look_for = is_eh ? start - 4 - cie_id : section_start + cie_id; - for (cie=chunks; cie ; cie = cie->next) + for (cie = chunks; cie ; cie = cie->next) if (cie->chunk_start == look_for) break; @@ -8037,6 +8172,7 @@ debug_displays[] = { ".debug_frame", display_debug_frames, NULL }, { ".eh_frame", display_debug_frames, NULL }, { ".debug_macinfo", display_debug_macinfo, NULL }, + { ".debug_pubtypes", display_debug_not_supported, NULL }, { ".debug_str", display_debug_not_supported, NULL }, { ".debug_static_func", display_debug_not_supported, NULL }, { ".debug_static_vars", display_debug_not_supported, NULL }, @@ -8061,7 +8197,7 @@ display_debug_section (section, file) return 0; } - start = (unsigned char *) get_data (NULL, file, section->sh_offset, length, + start = (unsigned char *) get_data (NULL, file, section->sh_offset, length, _("debug section data")); if (!start) return 0; @@ -8124,7 +8260,7 @@ process_section_contents (file) length = section->sh_size; start = ((unsigned char *) - get_data (NULL, file, section->sh_offset, length, + get_data (NULL, file, section->sh_offset, length, _("debug section data"))); if (!start) return 0; @@ -8966,6 +9102,8 @@ db_task_printsym (unsigned int addr) } #endif +int main PARAMS ((int, char **)); + int main (argc, argv) int argc; @@ -8976,6 +9114,9 @@ main (argc, argv) #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) setlocale (LC_MESSAGES, ""); #endif +#if defined (HAVE_SETLOCALE) + setlocale (LC_CTYPE, ""); +#endif bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); diff -uprN binutils-2.11.90.0.31/binutils/resrc.c binutils-2.11.92.0.5/binutils/resrc.c --- binutils-2.11.90.0.31/binutils/resrc.c Thu Jul 26 18:02:55 2001 +++ binutils-2.11.92.0.5/binutils/resrc.c Mon Oct 1 15:25:22 2001 @@ -1,5 +1,5 @@ /* resrc.c -- read and write Windows rc files. - Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of GNU Binutils. @@ -25,10 +25,10 @@ #include "bfd.h" #include "bucomm.h" #include "libiberty.h" +#include "safe-ctype.h" #include "windres.h" #include -#include #include #include #ifdef HAVE_UNISTD_H @@ -1976,7 +1976,7 @@ write_rc_accelerators (e, accelerators) fprintf (e, " "); if ((acc->key & 0x7f) == acc->key - && isprint ((unsigned char) acc->key) + && ISPRINT (acc->key) && (acc->flags & ACC_VIRTKEY) == 0) { fprintf (e, "\"%c\"", acc->key); @@ -2383,7 +2383,7 @@ write_rc_rcdata (e, rcdata, ind) s = ri->u.string.s; for (i = 0; i < ri->u.string.length; i++) { - if (isprint ((unsigned char) *s)) + if (ISPRINT (*s)) putc (*s, e); else fprintf (e, "\\%03o", *s); @@ -2421,7 +2421,7 @@ write_rc_rcdata (e, rcdata, ind) if (i + 4 < ri->u.buffer.length || ri->next != NULL) fprintf (e, ","); for (j = 0; j < 4; ++j) - if (! isprint (ri->u.buffer.data[i + j]) + if (! ISPRINT (ri->u.buffer.data[i + j]) && ri->u.buffer.data[i + j] != 0) break; if (j >= 4) @@ -2429,7 +2429,7 @@ write_rc_rcdata (e, rcdata, ind) fprintf (e, "\t// "); for (j = 0; j < 4; ++j) { - if (! isprint (ri->u.buffer.data[i + j])) + if (! ISPRINT (ri->u.buffer.data[i + j])) fprintf (e, "\\%03o", ri->u.buffer.data[i + j]); else { @@ -2455,7 +2455,7 @@ write_rc_rcdata (e, rcdata, ind) if (i + 2 < ri->u.buffer.length || ri->next != NULL) fprintf (e, ","); for (j = 0; j < 2; ++j) - if (! isprint (ri->u.buffer.data[i + j]) + if (! ISPRINT (ri->u.buffer.data[i + j]) && ri->u.buffer.data[i + j] != 0) break; if (j >= 2) @@ -2463,7 +2463,7 @@ write_rc_rcdata (e, rcdata, ind) fprintf (e, "\t// "); for (j = 0; j < 2; ++j) { - if (! isprint (ri->u.buffer.data[i + j])) + if (! ISPRINT (ri->u.buffer.data[i + j])) fprintf (e, "\\%03o", ri->u.buffer.data[i + j]); else { @@ -2483,7 +2483,7 @@ write_rc_rcdata (e, rcdata, ind) if (! first) indent (e, ind + 2); if ((ri->u.buffer.data[i] & 0x7f) == ri->u.buffer.data[i] - && isprint (ri->u.buffer.data[i])) + && ISPRINT (ri->u.buffer.data[i])) fprintf (e, "\"%c\"", ri->u.buffer.data[i]); else fprintf (e, "\"\\%03o\"", ri->u.buffer.data[i]); diff -uprN binutils-2.11.90.0.31/binutils/size.c binutils-2.11.92.0.5/binutils/size.c --- binutils-2.11.90.0.31/binutils/size.c Sat Mar 17 12:47:59 2001 +++ binutils-2.11.92.0.5/binutils/size.c Mon Oct 1 15:25:22 2001 @@ -1,5 +1,5 @@ /* size.c -- report size of various sections of an executable file. - Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 + Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -113,6 +113,9 @@ main (argc, argv) #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) setlocale (LC_MESSAGES, ""); #endif +#if defined (HAVE_SETLOCALE) + setlocale (LC_CTYPE, ""); +#endif bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); diff -uprN binutils-2.11.90.0.31/binutils/srconv.c binutils-2.11.92.0.5/binutils/srconv.c --- binutils-2.11.90.0.31/binutils/srconv.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/binutils/srconv.c Thu Oct 4 14:35:43 2001 @@ -36,7 +36,6 @@ #include "coff/internal.h" #include "../bfd/libcoff.h" -#define PROGRAM_VERSION "1.5" /*#define FOOP1 1 */ static int addrsize; @@ -1965,6 +1964,9 @@ main (ac, av) #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) setlocale (LC_MESSAGES, ""); #endif +#if defined (HAVE_SETLOCALE) + setlocale (LC_CTYPE, ""); +#endif bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); @@ -1990,7 +1992,7 @@ main (ac, av) show_help (); /*NOTREACHED */ case 'V': - printf (_("GNU %s version %s\n"), program_name, PROGRAM_VERSION); + print_version ("srconv"); exit (0); /*NOTREACHED */ case 0: diff -uprN binutils-2.11.90.0.31/binutils/stabs.c binutils-2.11.92.0.5/binutils/stabs.c --- binutils-2.11.90.0.31/binutils/stabs.c Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/binutils/stabs.c Mon Oct 1 15:25:22 2001 @@ -26,11 +26,11 @@ trying to identify the correct address for anything. */ #include -#include #include "bfd.h" #include "bucomm.h" #include "libiberty.h" +#include "safe-ctype.h" #include "demangle.h" #include "debug.h" #include "budbg.h" @@ -307,11 +307,11 @@ parse_number (pp, poverflow) int d; d = *p++; - if (isdigit ((unsigned char) d)) + if (ISDIGIT (d)) d -= '0'; - else if (isupper ((unsigned char) d)) + else if (ISUPPER (d)) d -= 'A'; - else if (islower ((unsigned char) d)) + else if (ISLOWER (d)) d -= 'a'; else break; @@ -781,7 +781,7 @@ parse_stab_string (dhandle, info, stabty } ++p; - if (isdigit ((unsigned char) *p) || *p == '(' || *p == '-') + if (ISDIGIT (*p) || *p == '(' || *p == '-') type = 'l'; else type = *p++; @@ -1185,7 +1185,7 @@ parse_stab_type (dhandle, info, typename /* Read type number if present. The type number may be omitted. for instance in a two-dimensional array declared with type "ar1;1;10;ar1;1;10;4". */ - if (! isdigit ((unsigned char) **pp) && **pp != '(' && **pp != '-') + if (! ISDIGIT (**pp) && **pp != '(' && **pp != '-') { /* 'typenums=' not present, type is anonymous. Read and return the definition, but don't put it in the type vector. */ @@ -1228,7 +1228,7 @@ parse_stab_type (dhandle, info, typename const char *p = *pp + 1; const char *attr; - if (isdigit ((unsigned char) *p) || *p == '(' || *p == '-') + if (ISDIGIT (*p) || *p == '(' || *p == '-') { /* Member type. */ break; @@ -2913,7 +2913,7 @@ parse_stab_argtypes (dhandle, info, clas /* Constructors are sometimes handled specially. */ is_full_physname_constructor = ((argtypes[0] == '_' && argtypes[1] == '_' - && (isdigit ((unsigned char) argtypes[2]) + && (ISDIGIT (argtypes[2]) || argtypes[2] == 'Q' || argtypes[2] == 't')) || strncmp (argtypes, "__ct", 4) == 0); @@ -3149,7 +3149,7 @@ parse_stab_array_type (dhandle, info, pp adjustable = false; - if (! isdigit ((unsigned char) **pp) && **pp != '-') + if (! ISDIGIT (**pp) && **pp != '-') { ++*pp; adjustable = true; @@ -3163,7 +3163,7 @@ parse_stab_array_type (dhandle, info, pp } ++*pp; - if (! isdigit ((unsigned char) **pp) && **pp != '-') + if (! ISDIGIT (**pp) && **pp != '-') { ++*pp; adjustable = true; @@ -3772,7 +3772,7 @@ stab_demangle_count (pp) unsigned int count; count = 0; - while (isdigit ((unsigned char) **pp)) + while (ISDIGIT (**pp)) { count *= 10; count += **pp - '0'; @@ -3789,12 +3789,12 @@ stab_demangle_get_count (pp, pi) const char **pp; unsigned int *pi; { - if (! isdigit ((unsigned char) **pp)) + if (! ISDIGIT (**pp)) return false; *pi = **pp - '0'; ++*pp; - if (isdigit ((unsigned char) **pp)) + if (ISDIGIT (**pp)) { unsigned int count; const char *p; @@ -3807,7 +3807,7 @@ stab_demangle_get_count (pp, pi) count += *p - '0'; ++p; } - while (isdigit ((unsigned char) *p)); + while (ISDIGIT (*p)); if (*p == '_') { *pp = p + 1; @@ -3902,7 +3902,7 @@ stab_demangle_prefix (minfo, pp) scan += i - 2; if (scan == *pp - && (isdigit ((unsigned char) scan[2]) + && (ISDIGIT (scan[2]) || scan[2] == 'Q' || scan[2] == 't')) { @@ -3911,7 +3911,7 @@ stab_demangle_prefix (minfo, pp) return true; } else if (scan == *pp - && ! isdigit ((unsigned char) scan[2]) + && ! ISDIGIT (scan[2]) && scan[2] != 't') { /* Look for the `__' that separates the prefix from the @@ -4126,13 +4126,13 @@ stab_demangle_qualified (minfo, pp, ptyp preceded by an underscore (to distinguish it from the <= 9 case) and followed by an underscore. */ p = *pp + 2; - if (! isdigit ((unsigned char) *p) || *p == '0') + if (! ISDIGIT (*p) || *p == '0') { stab_bad_demangle (orig); return false; } qualifiers = atoi (p); - while (isdigit ((unsigned char) *p)) + while (ISDIGIT (*p)) ++p; if (*p != '_') { @@ -4397,7 +4397,7 @@ stab_demangle_template (minfo, pp, pname { if (**pp == 'm') ++*pp; - while (isdigit ((unsigned char) **pp)) + while (ISDIGIT (**pp)) ++*pp; } else if (charp) @@ -4428,18 +4428,18 @@ stab_demangle_template (minfo, pp, pname { if (**pp == 'm') ++*pp; - while (isdigit ((unsigned char) **pp)) + while (ISDIGIT (**pp)) ++*pp; if (**pp == '.') { ++*pp; - while (isdigit ((unsigned char) **pp)) + while (ISDIGIT (**pp)) ++*pp; } if (**pp == 'e') { ++*pp; - while (isdigit ((unsigned char) **pp)) + while (ISDIGIT (**pp)) ++*pp; } } @@ -4692,7 +4692,7 @@ stab_demangle_type (minfo, pp, ptype) high = 0; while (**pp != '\0' && **pp != '_') { - if (! isdigit ((unsigned char) **pp)) + if (! ISDIGIT (**pp)) { stab_bad_demangle (orig); return false; @@ -4796,7 +4796,7 @@ stab_demangle_type (minfo, pp, ptype) varargs = false; ++*pp; - if (isdigit ((unsigned char) **pp)) + if (ISDIGIT (**pp)) { n = stab_demangle_count (pp); if (strlen (*pp) < n) @@ -5106,7 +5106,7 @@ stab_demangle_fund_type (minfo, pp, ptyp case 'G': ++*pp; - if (! isdigit ((unsigned char) **pp)) + if (! ISDIGIT (**pp)) { stab_bad_demangle (orig); return false; diff -uprN binutils-2.11.90.0.31/binutils/strings.c binutils-2.11.92.0.5/binutils/strings.c --- binutils-2.11.90.0.31/binutils/strings.c Fri Apr 27 14:03:48 2001 +++ binutils-2.11.92.0.5/binutils/strings.c Mon Oct 1 15:25:22 2001 @@ -1,5 +1,5 @@ /* strings -- print the strings of printable characters in files - Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 + Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -39,6 +39,11 @@ -o Like -to. (Some other implementations have -o like -to, others like -td. We chose one arbitrarily.) + --encoding={s,b,l,B,L} + -e {s,b,l,B,L} + Select character encoding: single-byte, bigendian 16-bit, + littleendian 16-bit, bigendian 32-bit, littleendian 32-bit + --target=BFDNAME Specify a non-default object file format. @@ -54,10 +59,10 @@ #include "bfd.h" #include #include -#include #include #include "bucomm.h" #include "libiberty.h" +#include "safe-ctype.h" /* Some platforms need to put stdin into binary mode, to read binary files. */ @@ -76,14 +81,7 @@ #endif #endif -/* Not all printable characters have ASCII codes (depending upon the - LOCALE set) but on some older systems it is not safe to test isprint - without first testing isascii... */ -#if defined isascii && !defined HAVE_LOCALE_H -#define isgraphic(c) (isascii (c) && (isprint (c) || (c) == '\t')) -#else -#define isgraphic(c) (isprint (c) || (c) == '\t') -#endif +#define isgraphic(c) (ISPRINT (c) || (c) == '\t') #ifndef errno extern int errno; @@ -113,12 +111,17 @@ static boolean got_a_section; /* The BFD object file format. */ static char *target; +/* The character encoding format. */ +static char encoding; +static int encoding_bytes; + static struct option long_options[] = { {"all", no_argument, NULL, 'a'}, {"print-file-name", no_argument, NULL, 'f'}, {"bytes", required_argument, NULL, 'n'}, {"radix", required_argument, NULL, 't'}, + {"encoding", required_argument, NULL, 'e'}, {"target", required_argument, NULL, 'T'}, {"help", no_argument, NULL, 'h'}, {"version", no_argument, NULL, 'v'}, @@ -133,6 +136,8 @@ static void print_strings PARAMS ((const file_ptr address, int stop_point, int magiccount, char *magic)); static void usage PARAMS ((FILE *stream, int status)); +static long get_char PARAMS ((FILE *stream, file_ptr *address, + int *magiccount, char **magic)); int main (argc, argv) @@ -143,7 +148,7 @@ main (argc, argv) int exit_status = 0; boolean files_given = false; -#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) +#if defined (HAVE_SETLOCALE) setlocale (LC_ALL, ""); #endif bindtextdomain (PACKAGE, LOCALEDIR); @@ -156,8 +161,9 @@ main (argc, argv) print_filenames = false; datasection_only = true; target = NULL; + encoding = 's'; - while ((optc = getopt_long (argc, argv, "afn:ot:v0123456789", + while ((optc = getopt_long (argc, argv, "afn:ot:e:v0123456789", long_options, (int *) 0)) != EOF) { switch (optc) @@ -213,6 +219,12 @@ main (argc, argv) target = optarg; break; + case 'e': + if (optarg[1] != '\0') + usage (stderr, 1); + encoding = optarg[0]; + break; + case 'v': print_version ("strings"); break; @@ -232,6 +244,23 @@ main (argc, argv) if (string_min < 0) string_min = 4; + switch (encoding) + { + case 's': + encoding_bytes = 1; + break; + case 'b': + case 'l': + encoding_bytes = 2; + break; + case 'B': + case 'L': + encoding_bytes = 4; + break; + default: + usage (stderr, 1); + } + bfd_init (); set_default_bfd_target (); @@ -366,6 +395,74 @@ strings_file (file) return true; } +/* Read the next character, return EOF if none available. + Assume that STREAM is positioned so that the next byte read + is at address ADDRESS in the file. + + If STREAM is NULL, do not read from it. + The caller can supply a buffer of characters + to be processed before the data in STREAM. + MAGIC is the address of the buffer and + MAGICCOUNT is how many characters are in it. */ + +static long +get_char (stream, address, magiccount, magic) + FILE *stream; + file_ptr *address; + int *magiccount; + char **magic; +{ + int c, i; + long r; + unsigned char buf[4]; + + for (i = 0; i < encoding_bytes; i++) + { + if (*magiccount) + { + (*magiccount)--; + c = *(*magic)++; + } + else + { + if (stream == NULL) + return EOF; + c = getc (stream); + if (c == EOF) + return EOF; + } + + (*address)++; + buf[i] = c; + } + + switch (encoding) + { + case 's': + r = buf[0]; + break; + case 'b': + r = (buf[0] << 8) | buf[1]; + break; + case 'l': + r = buf[0] | (buf[1] << 8); + break; + case 'B': + r = ((long) buf[0] << 24) | ((long) buf[1] << 16) | + ((long) buf[2] << 8) | buf[3]; + break; + case 'L': + r = buf[0] | ((long) buf[1] << 8) | ((long) buf[2] << 16) | + ((long) buf[3] << 24); + break; + } + + if (r == EOF) + return 0; + + return r; +} + /* Find the strings in file FILENAME, read from STREAM. Assume that STREAM is positioned so that the next byte read is at address ADDRESS in the file. @@ -387,13 +484,13 @@ print_strings (filename, stream, address int magiccount; char *magic; { - char *buf = (char *) xmalloc (string_min + 1); + char *buf = (char *) xmalloc (sizeof (char) * (string_min + 1)); while (1) { file_ptr start; int i; - int c; + long c; /* See if the next `string_min' chars are all graphic chars. */ tryline: @@ -402,21 +499,10 @@ print_strings (filename, stream, address start = address; for (i = 0; i < string_min; i++) { - if (magiccount) - { - magiccount--; - c = *magic++; - } - else - { - if (stream == NULL) - return; - c = getc (stream); - if (c == EOF) - return; - } - address++; - if (!isgraphic (c)) + c = get_char (stream, &address, &magiccount, &magic); + if (c == EOF) + return; + if (c > 255 || c < 0 || !isgraphic (c)) /* Found a non-graphic. Try again starting with next char. */ goto tryline; buf[i] = c; @@ -448,21 +534,10 @@ print_strings (filename, stream, address while (1) { - if (magiccount) - { - magiccount--; - c = *magic++; - } - else - { - if (stream == NULL) - break; - c = getc (stream); - if (c == EOF) - break; - } - address++; - if (! isgraphic (c)) + c = get_char (stream, &address, &magiccount, &magic); + if (c == EOF) + break; + if (c > 255 || c < 0 || !isgraphic (c)) break; putchar (c); } @@ -524,9 +599,9 @@ usage (stream, status) int status; { fprintf (stream, _("\ -Usage: %s [-afov] [-n min-len] [-min-len] [-t {o,x,d}] [-]\n\ - [--all] [--print-file-name] [--bytes=min-len] [--radix={o,x,d}]\n\ - [--target=bfdname] [--help] [--version] file...\n"), +Usage: %s [-afov] [-n min-len] [-min-len] [-t {o,x,d}] [-e {s,b,l,B,L}]\n\ + [-] [--all] [--print-file-name] [--bytes=min-len] [--radix={o,x,d}]\n\ + [--target=bfdname] [--encoding {s,b,l,B,L}] [--help] [--version] file...\n"), program_name); list_supported_targets (program_name, stream); if (status == 0) diff -uprN binutils-2.11.90.0.31/binutils/sysdump.c binutils-2.11.92.0.5/binutils/sysdump.c --- binutils-2.11.90.0.31/binutils/sysdump.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/binutils/sysdump.c Thu Oct 4 14:35:43 2001 @@ -26,15 +26,13 @@ #include "bfd.h" #include "bucomm.h" +#include "safe-ctype.h" #include -#include #include #include #include "sysroff.h" -#define PROGRAM_VERSION "1.0" - static int dump = 1; static int segmented_p; static int code; @@ -260,7 +258,8 @@ pbarray (y) printf ("%d (", y->len); for (x = 0; x < y->len; x++) { - printf ("(%02x %c)", y->data[x], isprint (y->data[x]) ? y->data[x] : '.'); + printf ("(%02x %c)", y->data[x], + ISPRINT (y->data[x]) ? y->data[x] : '.'); } printf (")\n"); } @@ -760,6 +759,9 @@ main (ac, av) #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) setlocale (LC_MESSAGES, ""); #endif +#if defined (HAVE_SETLOCALE) + setlocale (LC_CTYPE, ""); +#endif bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); @@ -774,7 +776,7 @@ main (ac, av) show_help (); /*NOTREACHED*/ case 'V': - printf (_("GNU %s version %s\n"), program_name, PROGRAM_VERSION); + print_version ("sysdump"); exit (0); /*NOTREACHED*/ case 0: diff -uprN binutils-2.11.90.0.31/binutils/testsuite/ChangeLog binutils-2.11.92.0.5/binutils/testsuite/ChangeLog --- binutils-2.11.90.0.31/binutils/testsuite/ChangeLog Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/binutils/testsuite/ChangeLog Thu Oct 4 14:35:43 2001 @@ -1,3 +1,13 @@ +2001-10-03 Thiemo Seufer + + * binutils-all/readelf.exp: Exclude mips*-*-elf* from 'readelf -wi' + test. + +Tue Sep 4 20:25:41 2001 Jeffrey A Law (law@cygnus.com) + + * binutils/all/readelf.exp: Expect readelf -wi to + fail for the H8 series. + 2001-08-27 Alan Modra * binutils-all/readelf.s-64: Adjust offsets for powerpc64. Don't diff -uprN binutils-2.11.90.0.31/binutils/testsuite/binutils-all/readelf.exp binutils-2.11.92.0.5/binutils/testsuite/binutils-all/readelf.exp --- binutils-2.11.90.0.31/binutils/testsuite/binutils-all/readelf.exp Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/binutils/testsuite/binutils-all/readelf.exp Thu Oct 4 14:35:43 2001 @@ -287,4 +287,4 @@ if [is_remote host] { # The xfail targets here do not default to DWARF2 format debug information # The symptom is that the output of 'readelf -wi' is empty. -readelf_test -wi $tempfile readelf.wi {v850*-*-* cris-*-* *-*-linux*} +readelf_test -wi $tempfile readelf.wi {v850*-*-* cris-*-* mips*-*-elf* *-*-linux* h8300*-*-*} diff -uprN binutils-2.11.90.0.31/binutils/version.c binutils-2.11.92.0.5/binutils/version.c --- binutils-2.11.90.0.31/binutils/version.c Thu Mar 15 14:51:54 2001 +++ binutils-2.11.92.0.5/binutils/version.c Thu Oct 4 14:35:43 2001 @@ -22,11 +22,6 @@ Foundation, 59 Temple Place - Suite 330, #include "bfd.h" #include "bucomm.h" -/* This is the version numbers for the binutils. They all change in - lockstep -- it's easier that way. */ - -const char *program_version = VERSION; - /* Print the version number and copyright information, and exit. This implements the --version option for the various programs. */ @@ -36,8 +31,8 @@ print_version (name) { /* This output is intended to follow the GNU standards document. */ /* xgettext:c-format */ - printf ("GNU %s %s\n", name, program_version); - printf (_("Copyright 1997, 98, 99, 2000, 2001 Free Software Foundation, Inc.\n")); + printf ("GNU %s %s\n", name, BFD_VERSION_STRING); + printf (_("Copyright 2001 Free Software Foundation, Inc.\n")); printf (_("\ This program is free software; you may redistribute it under the terms of\n\ the GNU General Public License. This program has absolutely no warranty.\n")); diff -uprN binutils-2.11.90.0.31/binutils/windres.c binutils-2.11.92.0.5/binutils/windres.c --- binutils-2.11.90.0.31/binutils/windres.c Sat Mar 17 12:47:59 2001 +++ binutils-2.11.92.0.5/binutils/windres.c Mon Oct 1 15:25:22 2001 @@ -1,5 +1,5 @@ /* windres.c -- a program to manipulate Windows resources - Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of GNU Binutils. @@ -39,11 +39,11 @@ #include "getopt.h" #include "bucomm.h" #include "libiberty.h" +#include "safe-ctype.h" #include "obstack.h" #include "windres.h" #include -#include #include /* used by resrc.c at least */ @@ -679,11 +679,11 @@ format_from_filename (filename, input) return RES_FORMAT_RES; /* If every character is printable or space, assume it's an RC file. */ - if ((isprint (b1) || isspace (b1)) - && (isprint (b2) || isspace (b2)) - && (isprint (b3) || isspace (b3)) - && (isprint (b4) || isspace (b4)) - && (isprint (b5) || isspace (b5))) + if ((ISPRINT (b1) || ISSPACE (b1)) + && (ISPRINT (b2) || ISSPACE (b2)) + && (ISPRINT (b3) || ISSPACE (b3)) + && (ISPRINT (b4) || ISSPACE (b4)) + && (ISPRINT (b5) || ISSPACE (b5))) return RES_FORMAT_RC; /* Otherwise, we give up. */ @@ -789,6 +789,9 @@ main (argc, argv) #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) setlocale (LC_MESSAGES, ""); #endif +#if defined (HAVE_SETLOCALE) + setlocale (LC_CTYPE, ""); +#endif bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); diff -uprN binutils-2.11.90.0.31/binutils/winduni.c binutils-2.11.92.0.5/binutils/winduni.c --- binutils-2.11.90.0.31/binutils/winduni.c Thu Jun 3 11:01:56 1999 +++ binutils-2.11.92.0.5/binutils/winduni.c Mon Oct 1 15:25:22 2001 @@ -1,5 +1,5 @@ /* winduni.c -- unicode support for the windres program. - Copyright 1997, 1998 Free Software Foundation, Inc. + Copyright 1997, 1998, 2000, 2001 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of GNU Binutils. @@ -30,8 +30,7 @@ #include "bfd.h" #include "bucomm.h" #include "winduni.h" - -#include +#include "safe-ctype.h" #ifdef _WIN32 #include @@ -99,7 +98,7 @@ unicode_print (e, unicode, length) { if (ch == '\\') fputs ("\\", e); - else if (isprint (ch)) + else if (ISPRINT (ch)) putc (ch, e); else { diff -uprN binutils-2.11.90.0.31/binutils/wrstabs.c binutils-2.11.92.0.5/binutils/wrstabs.c --- binutils-2.11.90.0.31/binutils/wrstabs.c Thu Mar 15 14:51:54 2001 +++ binutils-2.11.92.0.5/binutils/wrstabs.c Mon Oct 1 15:25:22 2001 @@ -1,5 +1,5 @@ /* wrstabs.c -- Output stabs debugging information - Copyright 1996, 1997, 1998, 2000 Free Software Foundation, Inc. + Copyright 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc. Written by Ian Lance Taylor . This file is part of GNU Binutils. @@ -23,12 +23,12 @@ information. */ #include -#include #include #include "bfd.h" #include "bucomm.h" #include "libiberty.h" +#include "safe-ctype.h" #include "debug.h" #include "budbg.h" @@ -2172,7 +2172,7 @@ stab_variable (p, name, kind, val) kindstr = ""; /* Make sure that this is a type reference or definition. */ - if (! isdigit ((unsigned char) *s)) + if (! ISDIGIT (*s)) { char *n; long index; diff -uprN binutils-2.11.90.0.31/binutils.spec binutils-2.11.92.0.5/binutils.spec --- binutils-2.11.90.0.31/binutils.spec Thu Aug 30 14:54:50 2001 +++ binutils-2.11.92.0.5/binutils.spec Fri Oct 5 13:50:54 2001 @@ -9,7 +9,7 @@ Summary: A GNU collection of binary utilities. Name: binutils -Version: 2.11.90.0.31 +Version: 2.11.92.0.5 Release: 1 Copyright: GPL Group: Development/Tools @@ -37,8 +37,7 @@ binary files. Most programmers will wan %setup -q %ifarch mips mipsel -patch -p1 -b --suffix .mips64 < mips/binutils-mips64.patch \ -&& patch -p0 -b --suffix .mips < mips/gas-mips.patch +patch -p0 -b --suffix .kernel < mips/gas-mips-kernel.patch find -name "*.rej" | grep rej && exit 1 %endif diff -uprN binutils-2.11.90.0.31/binutils.spec.in binutils-2.11.92.0.5/binutils.spec.in --- binutils-2.11.90.0.31/binutils.spec.in Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/binutils.spec.in Fri Oct 5 14:11:21 2001 @@ -37,8 +37,7 @@ binary files. Most programmers will wan %setup -q %ifarch mips mipsel -patch -p1 -b --suffix .mips64 < mips/binutils-mips64.patch \ -&& patch -p0 -b --suffix .mips < mips/gas-mips.patch +patch -p0 -b --suffix .kernel < mips/gas-mips-kernel.patch find -name "*.rej" | grep rej && exit 1 %endif diff -uprN binutils-2.11.90.0.31/config.guess binutils-2.11.92.0.5/config.guess --- binutils-2.11.90.0.31/config.guess Wed Aug 22 08:52:09 2001 +++ binutils-2.11.92.0.5/config.guess Mon Oct 1 15:25:20 2001 @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. -timestamp='2001-08-09' +timestamp='2001-09-13' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -127,7 +127,7 @@ UNAME_VERSION=`(uname -v) 2>/dev/null` | case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) - # Netbsd (nbsd) targets should (where applicable) match one or + # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old @@ -144,6 +144,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$ macppc) machine=powerpc-apple ;; hp3[0-9][05]) machine=m68k-hp ;; ibmrt|romp-ibm) machine=romp-ibm ;; + sparc*) machine=`uname -p`-unknown ;; *) machine=${UNAME_MACHINE}-unknown ;; esac # The Operating System including object format, if it has switched @@ -172,6 +173,45 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + macppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvmeppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mipseb-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` @@ -247,30 +287,9 @@ EOF Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit 0;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit 0 ;; - arc64:OpenBSD:*:*) - echo mips64el-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hkmips:OpenBSD:*:*) - echo mips-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mips-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; @@ -333,9 +352,6 @@ EOF aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; - atari*:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor @@ -362,18 +378,6 @@ EOF *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; - sun3*:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; @@ -390,6 +394,7 @@ EOF echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ @@ -411,7 +416,6 @@ EOF exit (-1); } EOF - eval $set_cc_for_build $CC_FOR_BUILD $dummy.c -o $dummy \ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && rm -f $dummy.c $dummy && exit 0 @@ -481,6 +485,7 @@ EOF exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include @@ -492,7 +497,6 @@ EOF exit(0); } EOF - eval $set_cc_for_build $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo rs6000-ibm-aix3.2.5 @@ -560,6 +564,7 @@ EOF fi ;; esac if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE @@ -593,10 +598,9 @@ EOF exit (0); } EOF - eval $set_cc_for_build - (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` - if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi - rm -f $dummy.c $dummy + (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` + if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi + rm -f $dummy.c $dummy fi ;; esac echo ${HP_ARCH}-hp-hpux${HPUX_REV} @@ -606,6 +610,7 @@ EOF echo ia64-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) + eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int @@ -631,7 +636,6 @@ EOF exit (0); } EOF - eval $set_cc_for_build $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo unknown-hitachi-hiuxwe2 @@ -661,9 +665,6 @@ EOF parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; - hppa*:OpenBSD:*:*) - echo hppa-unknown-openbsd - exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; @@ -715,9 +716,6 @@ EOF FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; @@ -730,9 +728,6 @@ EOF *:FreeBSD:*:*) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; - *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; @@ -848,6 +843,7 @@ EOF exit 0 ;; esac # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build cat >$dummy.c < #ifdef __cplusplus @@ -872,7 +868,6 @@ EOF return 0; } EOF - eval $set_cc_for_build $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 @@ -1111,11 +1106,15 @@ EOF i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 +eval $set_cc_for_build cat >$dummy.c < @@ -1230,7 +1229,6 @@ main () } EOF -eval $set_cc_for_build $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy diff -uprN binutils-2.11.90.0.31/config.sub binutils-2.11.92.0.5/config.sub --- binutils-2.11.90.0.31/config.sub Wed Aug 22 08:52:09 2001 +++ binutils-2.11.92.0.5/config.sub Mon Oct 1 15:25:20 2001 @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. -timestamp='2001-08-13' +timestamp='2001-09-14' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -240,7 +240,8 @@ case $basic_machine in | mips16 | mips64 | mips64el | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el | mips64vr4300 \ | mips64vr4300el | mips64vr5000 | mips64vr5000el \ - | mipsbe | mipsel | mipsle | mipstx39 | mipstx39el \ + | mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \ + | mipsisa32 \ | mn10200 | mn10300 \ | ns16k | ns32k \ | openrisc \ @@ -250,7 +251,7 @@ case $basic_machine in | s390 | s390x \ | sh | sh[34] | sh[34]eb | shbe | shle \ | sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \ - | strongarm \ + | stormy16 | strongarm \ | tahoe | thumb | tic80 | tron \ | v850 \ | we32k \ @@ -283,6 +284,7 @@ case $basic_machine in | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alphapca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armv*-* \ + | avr-* \ | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c54x-* \ | clipper-* | cray2-* | cydra-* \ @@ -297,8 +299,8 @@ case $basic_machine in | m88110-* | m88k-* | mcore-* \ | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \ | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipsel-* \ - | mipsle-* | mipstx39-* | mipstx39el-* \ + | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \ + | mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ @@ -308,7 +310,7 @@ case $basic_machine in | s390-* | s390x-* \ | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \ | sparc-* | sparc64-* | sparc86x-* | sparclite-* \ - | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* \ + | sparcv9-* | sparcv9b-* | stormy16-* | strongarm-* | sv1-* \ | t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ | v850-* | vax-* \ | we32k-* \ diff -uprN binutils-2.11.90.0.31/configure.in binutils-2.11.92.0.5/configure.in --- binutils-2.11.90.0.31/configure.in Thu May 24 23:16:54 2001 +++ binutils-2.11.92.0.5/configure.in Mon Oct 1 15:25:20 2001 @@ -702,7 +702,9 @@ case "${target}" in target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon" fi ;; - h8300*-*-* | \ + h8300*-*-*) + noconfigdirs="$noconfigdirs target-libgloss" + ;; h8500-*-*) noconfigdirs="$noconfigdirs ${libstdcxx_version} target-libgloss target-libffi" ;; @@ -1210,7 +1212,7 @@ rm -f conftest* case "${host}" in sparc-sun-solaris2*) CCBASE="`echo ${CC-cc} | sed 's/ .*$//'`" - if [ "`/usr/bin/which $CCBASE`" = "/usr/ucb/cc" ] ; then + if [ "`type $CCBASE | sed 's/^[^/]*//'`" = "/usr/ucb/cc" ] ; then could_use= [ -d /opt/SUNWspro/bin ] && could_use="/opt/SUNWspro/bin" if [ -d /opt/cygnus/bin ] ; then diff -uprN binutils-2.11.90.0.31/gas/ChangeLog binutils-2.11.92.0.5/gas/ChangeLog --- binutils-2.11.90.0.31/gas/ChangeLog Thu Aug 30 14:58:40 2001 +++ binutils-2.11.92.0.5/gas/ChangeLog Fri Oct 5 14:11:21 2001 @@ -1,3 +1,587 @@ +2001-10-05 Jakub Jelinek + + * doc/as.texinfo: Document M and S ELF section flags. + +2001-10-05 Alan Modra + + * subsegs.c (subseg_text_p): Return 0 for absolute section. + * read.c (do_align): If in absolute section, warn about and ignore + non-zero fill pattern. + +2001-10-05 Alexandre Oliva + + * config/tc-mn10300.c (tc_gen_reloc): Don't free + reloc->sym_ptr_ptr if it's not allocated. + +2001-10-04 Thiemo Seufer + + * config/tc-mips.c (prev_insn_reloc_type): Make it an array to hold a + relocation triple. + (prev_insn_fixp): Likewise. + (append_insn): Changed prototype to accept a relocation pointer. + (imm_reloc): Make it an array. + (offset_reloc): Likewise. + (md_assemble): Handle triple relocations. + (append_insn): Likewise. Add handling for some NewABI relocations. + (mips_no_prev_insn): Handle triple relocations. + (macro_build): Likewise. Add handling for some NewABI relocations. + Move handling for the 'u' case to append_insn(). + (mips16_macro_build): Handle triple relocations. + (macro_build_lui): Likewise. Don't handle _gp_disp as special symbol + for NewABI. + (mips_ip): Handle triple relocations. + (mips16_ip): Likewise. + (mips_force_relocation): Force handling of triple relocations + without symbols for NewABI. + (md_apply_fix): Add handling for some NewABI relocations. + +2001-10-05 Alan Modra + + * config/tc-i386.c (parse_register): If not producing code for + x86_64, reject x86_64 register name matches. + (md_assemble): Remove now redundant check for x86_64 regs. + +2001-10-04 Alan Modra + + * config/tc-ppc.c (md_assemble ): Test ppc_size as well + as BFD_DEFAULT_TARGET_SIZE. + (ppc_tc): Likewise. + (ppc_is_toc_sym): Likewise. + (md_apply_fix3): Likewise. + +2001-10-03 Thiemo Seufer + + * config/tc-mips.c (mips_64): Remove. + (mips_target_format): Move downwards in file, use HAVE_64BIT_OBJECTS + in it. + (mips_abi_level, mips_abi): New enum. + (mips_32bit_abi): Remove. + (HAVE*PRS): Use mips_abi instead of mips_32bit_abi. + (HAVE_NEWABI): New define. + (HAVE_64BIT_OBJECTS): New define. + (HAVE_32BIT_ADDRESSES): Don't return true for 64bit objects. + (HAVE_64BIT_ADDRESSES): New define, inverse of HAVE_32BIT_ADDRESSES. + (support_64bit_objects): New prototype. + (md_begin): Use mips_abi instead of mips_32bit_abi. Don't write + .reginfo section for n32, use .MIPS.options instead. + (support_64bit_objects): New function, code from md_parse_option. + (md_longopts): Add -n32 option. + (md_parse_option): Use mips_abi instead of mips_32bit_abi/mips64. + Add -n32 option. Protect with OBJ_ELF. + (s_mipsset): Use mips_abi instead of mips_32bit_abi. + (mips_elf_final_processing): Likewise. Don't write .reginfo section + for n32, use .MIPS.options instead. + +2001-10-03 Alan Modra + + * po/POTFILES.in: Regenerate. + * configure: Regenerate. + +2001-10-02 Alan Modra + + * config/tc-ppc.c (md_apply_fix3 ): Make it 64 + bits if target is 64 bit. + + * doc/as.texinfo (listing): Fix typo. + + * as.c (print_version_id): Use BFD_VERSION_STRING in place of + BFD_VERSION. + * Makefile.am (Makefile): Depend on bfd/configure.in. + Run "make dep-am". + * Makefile.in: Regenerate. + +2001-09-30 H.J. Lu + + * config/obj-elf.c (obj_elf_parse_section_letters): Accept "am" + and "ams" for compatibility. + +2001-09-30 Hans-Peter Nilsson + + * config/tc-sh.c (md_pcrel_from_section): Transformed from + md_pcrel_from. Handle pc-relativeness against link-time + symbol. Handle relativeness to elsewhere than the fixup. + * config/tc-sh.h (MD_PCREL_FROM_SECTION): Define. + (md_pcrel_from_section): Prototype. + + * Makefile.am: Update dependencies with "make dep-am". + * Makefile.in: Regenerate. + +2001-09-30 Stephane Carrez + + * config/tc-m68hc11.c (cmp_opcode): Define prototype. + (print_opcode_format, skip_whites): Likewise. + (convert_branch, m68hc11_new_insn): Likewise. + (build_dbranch_insn, build_indexed_byte): Likewise. + (build_reg_mode, find, find_opcode): Likewise. + (print_insn_format): Fix call to print_opcode_format. + (md_assemble): Fix call to build_dbranch_insn. + +2001-09-27 Nick Clifton + + * config/tc-arm.c: Add missing prototypes. + +2001-09-26 Jeff Johnston + + * input-file.c (input_file_open): When reading the + first line looking for #NO_APP, prepare for the possibility + of finding #APP instead. Also fix algorithm to allow + white-space to follow either #NO_APP or #APP directives. + +2001-09-25 Geoff Berry + + * listing.c (buffer_line): Don't write past the end of `line' when + EOF is reached. + +2001-09-25 Alexandre Oliva + + * config/tc-mn10300.c (tc_gen_reloc): Don't emit an *ABS* + relocation for differences between symbols in a section other + than the one in which the difference is to be placed; apply + the relocation instead. + +2001-09-24 Nick Clifton + + * config/tc-arc.c: Add missing prototype. + (md_atof): Change type to int. Add missing prototype. + * config/tc-arc.h: Prototype exported functions. + +2001-09-22 Nick Clifton + + * as.c: Add missing function prototype. + * config/obj-aout.c: Fix compile time warning. + +2001-09-21 Bruno Haible + + * config/tc-openrisc.c: Don't include . + +2001-09-19 Martin Schwidefsky + + * gas/config/tc-s390.c: Add option -mwarn-areg-zero. + +2001-09-19 Alan Modra + + * config/tc-i370.c: Fix typo in last change. + +2001-09-19 Nick Clifton + + * doc/as.texinfo (Symbol Names): Improve documentation on local + labels and add documenation about dollar labels. + +2001-09-18 Bruno Haible + + * as.h: Don't include . + * as.c (main): For gettext, also set the LC_CTYPE locate facet. + * atof-generic.c: Include "safe-ctype.h" instead of . + (atof_generic): Use ISDIGIT instead of isdigit. + * config/m68k-parse.y: Include "safe-ctype.h". + (yylex): Use ISDIGIT/ISALNUM instead of isdigit/isalnum. + * config/obj-elf.c: Include "safe-ctype.h". + (obj_elf_vtable_inherit): Use ISSPACE instead of isspace. + * config/obj-vms.c: Include "safe-ctype.h". + (Write_VMS_MHD_Records): Use TOUPPER instead of islower/toupper. + (VMS_Case_Hack_Symbol): Use ISUPPER/ISLOWER/TOUPPER/TOLOWER + instead of isupper/islower/toupper/tolower. + * config/tc-a29k.c: Include "safe-ctype.h" instead of . + (insert_sreg): Use TOUPPER instead of islower/toupper. + (machine_ip): Use ISALPHA/ISALNUM/ISUPPER/TOLOWER instead of + isalpha/isalnum/isupper/tolower. + (a29k_unrecognized_line, md_operand): Use ISDIGIT instead of + isdigit. + * config/tc-alpha.c: Include "safe-ctype.h" instead of . + (md_undefined_symbol, s_alpha_ent): Use ISDIGIT instead of isdigit. + * config/tc-arc.c: Include "safe-ctype.h" instead of . + (md_assemble): Use ISSPACE/ISALNUM instead of isspace/isalnum. + (arc_extoper): Use TOLOWER instead of isupper/tolower. + * config/tc-arm.c: Include "safe-ctype.h" instead of . + (arm_psr_parse): Use ISALPHA instead of isalpha. + (accum0_required_here): Use ISALNUM instead of isalnum. + (do_ldrd): Use ISSPACE instead of isspace. + (decode_shift): Use ISALPHA instead of isalpha. + (insert_reg): Use TOUPPER instead of islower/toupper. + (arm_reg_parse): Use ISALPHA instead of isalpha. + (arm_parse_reloc): Use ISALNUM/ISPUNCT/TOLOWER instead of + isalnum/ispunct/tolower. + * config/tc-avr.c: Include "safe-ctype.h" instead of . + (md_parse_option): Use TOLOWER instead of tolower. + (avr_operand): Use ISDIGIT/TOLOWER instead of isdigit/tolower. + * config/tc-cris.c: Include "safe-ctype.h" instead of . + (cris_process_instruction): Use ISLOWER instead of islower. + (get_gen_reg): Use ISALNUM/ISDIGIT instead of isalnum/isdigit. + (get_spec_reg): Use TOLOWER/ISALNUM instead of isupper/tolower/isalnum. + (get_flags): Use ISSPACE instead of isspace. + * config/tc-d10v.c: Include "safe-ctype.h" instead of . + (do_assemble): Use TOLOWER instead of tolower. + * config/tc-d30v.c: Include "safe-ctype.h" instead of . + (do_assemble): Use TOLOWER instead of tolower. + (d30v_start_line): Use ISSPACE instead of isspace. + * config/tc-fr30.c: Include "safe-ctype.h" instead of . + (fr30_is_colon_insn): Use TOLOWER instead of tolower. + * config/tc-h8300.c: Include "safe-ctype.h" instead of . + (skip_colonthing, get_operand): Use ISDIGIT instead of isdigit. + * config/tc-h8500.c: Include "safe-ctype.h" instead of . + (start_label): Use ISALPHA instead of isalpha. + * config/tc-hppa.c: Include "safe-ctype.h" instead of . + (pa_ip): Use ISUPPER/ISLOWER/TOLOWER instead of + isupper/islower/tolower. + (pa_parse_number): Use ISDIGIT instead of isdigit. + (pa_chk_field_selector): Use TOLOWER instead of tolower. + (pa_stringer): Use ISDIGIT instead of isdigit. + * config/tc-i370.c: Include "safe-ctype.h" instead of . + (register_name): Use ISALPHA instead of isalpha. + (i370_elf_suffix): Use ISALNUM/TOLOWER instead of + isalnum/islower/tolower. + (i370_addr_offset): Use ISDIGIT/ISALPHA instead of + isdigit/isalpha. + (i370_addr_cons): Use ISALPHA/ISXDIGIT instead of + isalpha/isxdigit. + (md_assemble): Use ISSPACE instead of isspace. + * config/tc-i386.c: Include "safe-ctype.h" instead of . + (md_begin): Use ISDIGIT/ISLOWER/ISUPPER/TOLOWER/ISALPHA + instead of isdigit/islower/isupper/tolower/isalpha. + (output_invalid): Use ISPRINT instead of isprint. + * config/tc-i860.c: Include "safe-ctype.h" instead of . + (i860_ip): Use ISLOWER/ISDIGIT instead of islower/isdigit. + * config/tc-i960.c: Include "safe-ctype.h" instead of . + (get_args): Use ISALNUM instead of isalnum. + * config/tc-ia64.c: Include "safe-ctype.h". + (dot_pred_rel): Use TOUPPER/ISDIGIT instead of toupper/isdigit. + (ia64_unrecognized_line): Use ISDIGIT instead of isdigit. + (ia64_parse_name): Likewise. + * config/tc-m32r.c: Include "safe-ctype.h" instead of . + (assemble_two_insns): Use ISSPACE/ISALNUM/ISUPPER/TOLOWER + instead of isspace/isalnum/isupper/tolower. + * config/tc-m68hc11.c: Include "safe-ctype.h" instead of . + (md_assemble): Use TOLOWER/ISALNUM instead of tolower/isalnum. + * config/tc-m68k.c: Include "safe-ctype.h" instead of . + (mklower_table): Remove variable. + (mklower): Remove macro. + (insert_reg): Use TOUPPER instead of islower/toupper. + (md_begin): Remove initialization of mklower_table. + (s_reg): Use ISALNUM instead of isalnum. + (mri_assemble): Use ISUPPER/TOLOWER instead of isupper/tolower. + (parse_mri_condition): Use TOLOWER instead of isupper/tolower. + (build_mri_control_operand): Use TOLOWER instead of tolower. + (s_mri_else, s_mri_break, s_mri_next, s_mri_for): Likewise. + * config/tc-m88k.c: Include "safe-ctype.h" instead of . + (md_assemble): Use ISSPACE instead of isspace. + (get_imm16): Use ISALNUM instead of isalnum. + (get_cnd): Use ISDIGIT/ISUPPER/TOLOWER instead of + isdigit/isupper/tolower. + (get_bf_offset_expression): Use ISALPHA/ISUPPER/TOLOWER + instead of isalpha/isupper/tolower. + (hexval): Use ISDIGIT/ISLOWER/ISUPPER instead of + isdigit/islower/isupper. + * config/tc-mcore.c: Include "safe-ctype.h" instead of . + (mcore_s_section): Use ISSPACE instead of isspace. + (parse_reg): Use ISSPACE/TOLOWER/ISALNUM instead of + isspace/tolower/isalnum. + (parse_creg): Use ISSPACE/TOLOWER instead of isspace/tolower. + (parse_psrmod): Use TOLOWER instead of isascii/tolower. + (parse_exp, parse_mem, md_assemble): Use ISSPACE instead of + isspace. + * config/tc-mips.c: Include "safe-ctype.h" instead of . + (mips_ip): Use ISSPACE/ISDIGIT instead of isspace/isdigit. + (mips16_ip): Use ISLOWER/ISDIGIT instead of islower/isdigit. + (my_getSmallExpression): Use ISDIGIT/TOLOWER instead of + isdigit/tolower. + (tc_get_register): Likewise. + (get_number): Use ISDIGIT/ISXDIGIT instead of isdigit/isxdigit. + (s_mips_ent): Use ISDIGIT instead of isdigit. + * config/tc-mn10200.c: Include "safe-ctype.h" instead of . + (md_assemble): Use ISSPACE instead of isspace. + * config/tc-mn10300.c: Include "safe-ctype.h" instead of . + (md_assemble): Use ISSPACE instead of isspace. + * config/tc-ns32k.c: Don't include . + * config/tc-pdp11.c: Include "safe-ctype.h". + (mklower): Remove function. + (parse_reg): Use TOLOWER instead of mklower. + * config/tc-pj.c: Include "safe-ctype.h". + (md_assemble): Use ISSPACE instead of isspace. + * config/tc-ppc.c: Include "safe-ctype.h" instead of . + (register_name): Use ISALPHA instead of isalpha. + (ppc_elf_suffix): Use ISALNUM/TOLOWER instead of + isalnum/islower/tolower. + (md_assemble): Use ISSPACE instead of isspace. + (ppc_canonicalize_symbol_name): Use ISLOWER/TOUPPER instead of + islower/toupper. + * config/tc-s390.c: Include "safe-ctype.h" instead of . + (register_name): Use ISALPHA instead of isalpha. + (s390_elf_suffix, s390_lit_suffix): Use ISALNUM instead of isalnum. + (md_gather_operands, md_assemble, s390_insn): Use ISSPACE instead of + isspace. + * config/tc-sh.c: Include "safe-ctype.h" instead of . + (sh_elf_suffix): Use ISALNUM/TOLOWER instead of + isalnum/islower/tolower. + (IDENT_CHAR): Use ISALNUM instead of isalnum. + (parse_reg): Use TOLOWER instead of tolower. + (find_cooked_opcode): Use TOLOWER instead of isupper/tolower. + * config/tc-sparc.c: Include "safe-ctype.h" instead of . + (sparc_ip): Use ISLOWER/ISDIGIT instead of islower/isdigit. + (parse_keyword_arg): Use ISALNUM instead of isalnum. + * config/tc-tahoe.c: Include "safe-ctype.h". + (tahoe_reg_parse): Use ISDIGIT instead of isdigit. + (tip_op): Use TOLOWER instead of isupper/tolower. + * config/tc-tic30.c: Include "safe-ctype.h". + (md_begin): Use ISLOWER/ISDIGIT/ISUPPER/TOLOWER/ISLOWER/ + ISALPHA instead of islower/isdigit/isupper/tolower/islower/isalpha. + (tic30_operand): Use TOLOWER instead of tolower. + (tic30_find_parallel_insn): Likewise. + (output_invalid): Use ISPRINT instead of isprint. + * config/tc-tic54x.c: Include "safe-ctype.h". + (tic54x_asg, tic54x_eval): Use ISALPHA instead of isalpha. + (lookup_version): Use TOUPPER instead of toupper. + (tic54x_var): Use ISALPHA instead of isalpha. + (tic54x_mlib): Use ISSPACE instead of isspace. + (subsym_iscons): Use TOUPPER instead of toupper. + (get_operands): Use ISSPACE instead of isspace. + (is_type): Use TOUPPER/ISDIGIT instead of toupper/isdigit. + (encode_indirect, encode_operand): Use TOUPPER instead of toupper. + (next_line_shows_parallel): Use ISSPACE instead of isspace. + (subsym_get_arg, subsym_substitute): Use ISDIGIT instead of isdigit. + (tic54x_start_line_hook, md_assemble, tic54x_start_label): Use + ISSPACE instead of isspace. + * config/tc-tic80.c: Include "safe-ctype.h". + (md_assemble): Use ISSPACE instead of isspace. + * config/tc-v850.c: Include "safe-ctype.h" instead of . + (system_register_name): Use ISDIGIT instead of isdigit. + (md_assemble): Use ISSPACE instead of isspace. + * config/tc-vax.c: Include "safe-ctype.h" instead of . + (vax_reg_parse): Use TOLOWER/ISDIGIT instead of + isupper/tolower/isdigit. + (vip_op): Use TOLOWER instead of isupper/tolower. + * config/tc-w65.c: Don't include . + * config/tc-z8k.c: Include "safe-ctype.h" instead of . + (tohex): Use ISDIGIT/ISLOWER instead of isdigit/islower. + (whatreg): Use ISDIGIT instead of isdigit. + * ecoff.c: Include "safe-ctype.h" instead of . + (ecoff_directive_ent, ecoff_stab): Use ISDIGIT instead of isdigit. + * expr.c: Include "safe-ctype.h" instead of . + (integer_constant): Use ISALNUM/TOUPPER instead of + isalnum/islower/toupper. + (operand): Use TOLOWER instead of isupper/tolower. + * gasp.c: Include "safe-ctype.h" instead of . + (sb_strtol, level_0, change_base, doinstr): Use ISDIGIT instead + of isdigit. + (process_assigns, whatcond): Use TOUPPER instead of toupper. + (chartype_init): Use ISALPHA/ISDIGIT instead of isalpha/isdigit. + (main): For gettext, also set the LC_CTYPE locate facet. + * hash.c: Include "safe-ctype.h". + (main): Use TOLOWER instead of isupper/tolower. + * itbl-lex.l: Don't include . + * listing.c: Include "safe-ctype.h" instead of . + (listing_newline): Use ISCNTRL instead of isascii/iscntrl. Don't + omit non-ASCII characters. + (debugging_pseudo): Use ISSPACE instead of isspace. + * macro.c: Include "safe-ctype.h" instead of . + (buffer_and_nest): Use ISALNUM instead of isalnum. + (get_token): Use ISALPHA/ISALNUM instead of isalpha/isalnum. + (define_macro): Use ISUPPER/TOLOWER instead of isupper/tolower. + (macro_expand_body): Use ISALNUM/ISDIGIT/ISUPPER/ISALPHA + instead of isalnum/isdigit/isupper/isalpha. + (check_macro): Use ISALPHA/ISALNUM/ISUPPER/TOLOWER instead + of isalpha/isalnum/isupper/tolower. + * read.c: Include "safe-ctype.h" instead of . + (read_a_source_file): Use ISUPPER/TOLOWER/ISDIGIT instead of + isupper/tolower/isdigit. + (s_mri_common): Use ISDIGIT instead of isdigit. + (s_mri_sect): Use ISDIGIT/TOUPPER instead of isdigit/toupper. + (s_float_space): Use ISALPHA instead of isalpha. + (ignore_rest_of_line): Use ISPRINT instead of isprint. + (float_cons): Use ISALPHA instead of isalpha. + (next_char_of_string): Use ISDIGIT/ISXDIGIT instead of + isdigit/isxdigit. + * symbols.c: Include "safe-ctype.h" instead of . + (save_symbol_name): Use ISLOWER/TOUPPER instead of + islower/toupper. + (symbol_find_base): Use TOUPPER instead of islower/toupper. + (decode_local_label_name): Use ISDIGIT instead of isdigit. + +2001-09-18 Martin Schwidefsky + + * tc-s390.c (s390_insn): Add code to cope with 6 byte O_constants + in 64 bit mode and make format "e" work. + +2001-09-18 Alan Modra + + * dwarf2dbg.c (dwarf2_directive_file): Avoid signed/unsigned warning. + + * write.c (set_symtab): Update bfd_alloc declaration. Use a temp + var to ensure bfd_alloc arg is the right type. + (write_object_file): Cast args of bfd_seek. Replace bfd_write with + bfd_bwrite. + + * config/obj-coff.c: Replace calls to bfd_write with calls to + bfd_bwrite. Cast args of bfd_seek. + + * config/obj-elf.c (obj_elf_change_section): Avoid signed/unsigned + warning. + + * config/tc-mn10300.c (set_arch_mach): Make param unsigned. + + * config/tc-tic54x.c (tic54x_mlib): Replace bfd_read call with + call to bfd_bread. + +2001-09-15 Hans-Peter Nilsson + + * config/tc-sh.h (sh_force_relocation): Prototype. + (struct fix): Forward declare. + * config/tc-sh.c (type sh_operand_info): Move to top of file. + (cons, s_align_bytes): Remove old-type declarations. + (sh_elf_suffix, parse_reg, dot, parse_exp, parse_at, get_operand, + get_operands, get_specific, insert, build_relax, + insert_loop_bounds, build_Mytes): Prototype. + (little): Make static. Prototype. + (check, tc_Nout_fix_to_chars): Delete unused functions. + +2001-09-14 Eric Christopher + + * config/tc-mips.c (md_parse_option): Remove setting mips_64 via + -mgp32/mgp64. + +2001-09-14 Kevin Lo + + * configure.in: Add arm-openbsd target. + * configure: Regenerate. + +2001-09-14 Thiemo Seufer + + * configure.in: Change machine triplets from mips-*-linux-gnu* to + mips*-*-linux*. + +2001-09-12 Thiemo Seufer + + * config/tc-mips.c (append_insn): Don't rightshift BFD_RELOC_16_PCREL. + +2001-09-11 Richard Henderson + + * config/tc-alpha.c (alpha_elf_section_letter): New. + (alpha_elf_section_flags): New. + * config/tc-alpha.h (md_elf_section_letter): New. + (md_elf_section_flags): New. + * config/tc-ia64.c (ia64_elf_section_letter): New. + * config/tc-ia64.h (md_elf_section_letter): New. + +2001-09-11 Jakub Jelinek + + * config/obj-elf.c (obj_elf_parse_section_letters): Use 'M' instead + of 'm', 'S' instead of 's'. Update bad_msg. + * config/tc-ppc.c (ppc_section_letter): Update bad_msg. + * config/tc-i370.c (i370_sectioN_letter): Update bad_msg. + +2001-09-09 Alan Modra + + * expr.c (expr): Move code setting "retval" to the end of the loop, + and rearrange for efficiency. For "PIC code" subtraction, use + "rightseg" rather than recalculating. For "symbol OP symbol" + subtract, set "retval" to absolute_section if symbols in same + section. + * symbols.c (resolve_symbol_value): Resolve "sym +/- expr" to an + O_symbol. Simplify a +/- b code. Allow equality and non-equality + comparisons on symbols from any section. Allow other comparison + operators as for subtraction. + (symbol_equated_reloc_p): New predicate function. + * symbols.h (symbol_equated_reloc_p): Declare. + * write.c (relax_segment ): Ensure segment + for expression syms is set correctly. + (adjust_reloc_syms): Use symbol_equated_reloc_p. + (write_relocs): Likewise. + (write_object_file): Likewise. + * config/tc-mips.c (md_estimate_size_before_relax): Likewise. + * config/tc-i386.c (md_assemble ): Don't lose part + of a complex expression when setting up frag_var. + +2001-09-07 Richard Henderson + + * config/tc-alpha.c (alpha_reloc_op_tag): Replace need_seq with + require_seq and allow_seq. Let !literal omit the sequence number. + (tokenize_arguments): Reject sequence numbers of !allow_seq. + +2001-09-08 Jakub Jelinek + + * config/tc-sparc.c (md_apply_fix3): Handle relocs against SEC_MERGE + section symbols the same way as externs. + +2001-09-07 Thiemo Seufer + + * config/tc-mips.c (s_mipsset): Reallow unrestricted use of .set mipsX + pseudo-op. + +2001-09-07 Thiemo Seufer + + * config/tc-mips.c (append_insn): Handle BFD_RELOC_16_PCREL. + (macro_build): Use BFD_RELOC_16_PCREL_S2 only for embedded + PIC, BFD_RELOC_16_PCREL for the rest. + (mips_ip): Likewise. + (md_pcrel_from): return the right offset for the differently shifted + pcrel relocs. + (md_apply_fix): Handle BFD_RELOC_16_PCREL. + +2001-09-05 Richard Henderson + + * config/tc-ia64.c (FUNC_IPLT_RELOC): New. + (pseudo_func): Add @iplt. + (pseudo_opcode): Add data16 and data16.ua. + (md_begin): Set iplt pseudo. + (ia64_cons_fix_new): Handle 16 byte iplt reloc specially. + +2001-09-04 Richard Henderson + + * config/tc-alpha.c (struct alpha_insn): Make sequence scalar long. + (MACRO_LITERAL, MACRO_BASE, MACRO_BYTOFF, MACRO_JSR): Remove. + (alpha_macros): Remove occurrences of same. + (O_lituse_addr, O_gprel): New. + (DUMMY_RELOC_LITUSE_*): New. + (s_alpha_ucons, s_alpha_arch): Prototype. + (alpha_reloc_op): Construct elements via DEF macro. + (ALPHA_RELOC_SEQUENCE_OK): Remove. + (struct alpha_reloc_tag): Rename from alpha_literal_tag; rename + members to not be literal specific. + (next_sequence_num): New. + (md_apply_fix3): Cope with missing GPDISP_LO16. Adjust for + added/removed BFD relocations. + (alpha_force_relocation, alpha_fix_adjustable): Likewise. + (alpha_adjust_symtab_relocs): Handle GPDISP relocs as well. + (tokenize_arguments): Parse ! relocations properly. + (find_macro_match): Delete unused macro argument types. + (assemble_insn): Add reloc parameter; emit that instead of the + default as appropriate. + (get_alpha_reloc_tag): New. Split from ... + (emit_insn): ... here. Allocate a reloc tag for GPDISP. + (assemble_tokens): Don't search macros if user relocation present. + Copy reloc sequence number to insn struct. + (emit_ldgp): Remove user reloc handling. + (load_expression, emit_lda, emit_ldah, emit_ir_load): Likewise. + (emit_loadstore, emit_ldXu, emit_ldil, emit_stX): Likewise. + (emit_sextX, emit_division, emit_jsrjmp, emit_retjcr): Likewise. + * config/tc-alpha.h (tc_adjust_symtab): Always define. + (struct alpha_fix_tag): Name members less literal specific. + +Tue Sep 4 20:01:19 2001 Jeffrey A Law (law@cygnus.com) + + * tc-h8300.c (tc_gen_reloc): Give an error if we try to take the + address of two symbols in different sections. + +2001-08-31 Eric Christopher + Jason Eckhardt + + * config/tc-mips.c (mips_cpu_info): Add support for mipsisa32, + 5kc, and 20kc. Clean up old entries. + +Fri Aug 31 12:05:13 2001 J"orn Rennecke + Jeff Law + + * config/tc-h8300.c (build_bytes): For OBJ_ELF, make relocation's + offset match H8 ELF spec. + (md_section_align): Alternate implementation for BFD_ASSEMBLER. + (md_apply_fix): Fix argument and return types for BFD_ASSEMBLER. + + * tc-h8300.c (relocation mappings): Remove. Moved to tc-h8300.h. + (build_bytes): Mark fixups for PCrel branches as signed. For + OBJ_ELF, make sure the reloc's offset points to the first byte + to be modified. + (md_convert_frag): Update definiton based on BFD_ASSEMBLER. + * tc-h8300.h (relocation mappings): Add. + Thu Aug 30 12:05:13 2001 J"orn Rennecke * tc-h8300.c (tc_crawl_symbol_chain, tc_headers_hook): Don't @@ -7,13 +591,13 @@ Thu Aug 30 12:05:13 2001 J"orn Rennecke Wed Aug 29 12:49:58 2001 Jeffrey A Law (law@cygnus.com) - * config/tc-h8300.c (h8300hmode): Record the machine type + * config/tc-h8300.c (h8300hmode): Record the machine type if BFD_ASSEMBLER is defined. (h8300smode, md_begin): Similarly. 2001-08-29 Joel Sherrill - * configure.in (i[3456]86-*-rtems*, m68*-*-rtems*): Change + * configure.in (i[3456]86-*-rtems*, m68*-*-rtems*): Change default from coff to elf. * configure: Regenerate. @@ -33,7 +617,7 @@ Wed Aug 29 12:05:13 2001 J"orn Rennecke 2001-08-27 Thiemo Seufer - * tc_mips.c (load_address): Reflect change to MAX_GPREL_OFFSET. + * config/tc-mips.c (load_address): Reflect change to MAX_GPREL_OFFSET. (macro): Reflect change to MAX_GPREL_OFFSET. 2001-08-27 Torbjorn Granlund @@ -87,9 +671,9 @@ Wed Aug 29 12:05:13 2001 J"orn Rennecke 2001-08-26 Thiemo Seufer - * tc_mips.h (MAX_GPREL_OFFSET): Change it to the maximum allowed - value, not the word beyond maximum. - * tc_mips.c (macro_build_lui): Code cleanup. + * config/tc-mips.h (MAX_GPREL_OFFSET): Change it to the maximum + allowed value, not the word beyond maximum. + * config/tc-mips.c (macro_build_lui): Code cleanup. (macro): Reflect change to MAX_GPREL_OFFSET. (mips_ip): Check explicitly against S_EX_NONE. (my_get_SmallExpression): parse for %gp_rel, not %gprel. @@ -107,8 +691,8 @@ Wed Aug 29 12:05:13 2001 J"orn Rennecke 2001-08-21 Thiemo Seufer - * tc_mips.c (md_begin): Warn about incompatibility between -march=FOO - and -mipsN option, continue with default ISA. + * config/tc-mips.c (md_begin): Warn about incompatibility between + -march=FOO and -mipsN option, continue with default ISA. 2001-08-21 Thiemo Seufer @@ -156,8 +740,8 @@ Wed Aug 29 12:05:13 2001 J"orn Rennecke 2001-08-14 Jeff Johnston - * expr.c (operand)[LITERAL_PREFIXDOLLAR_HEX]: Treat $L as - a label, not a hex constant. + * expr.c (operand)[LITERAL_PREFIXDOLLAR_HEX]: Treat $L as + a label, not a hex constant. 2001-08-13 Nick Clifton @@ -234,12 +818,13 @@ Wed Aug 29 12:05:13 2001 J"orn Rennecke 2001-08-07 Thiemo Seufer - * tc-mips.c (macro_build): Replace magic constants by defines. + * config/tc-mips.c (macro_build): Replace magic constants by defines. (mips_ip): Likewise. Typo. 2001-08-04 Thiemo Seufer - * tc-mips.c (mips_abi_string): Initialize with NULL instead of 0. + * config/tc-mips.c (mips_abi_string): Initialize with NULL instead + of 0. (RELAX_ENCODE): Replace bfd_vma by valueT. (load_address): Formatting. (macro): Likewise. Code cleanup. Typo. diff -uprN binutils-2.11.90.0.31/gas/Makefile.am binutils-2.11.92.0.5/gas/Makefile.am --- binutils-2.11.90.0.31/gas/Makefile.am Thu Jul 26 18:02:55 2001 +++ binutils-2.11.92.0.5/gas/Makefile.am Thu Oct 4 14:35:43 2001 @@ -753,6 +753,8 @@ de-stage3: DEP_FILE_DEPS = $(CFILES) $(HFILES) $(TARGET_CPU_CFILES) \ $(TARGET_CPU_HFILES) $(OBJ_FORMAT_CFILES) $(OBJ_FORMAT_HFILES) +Makefile: $(BFDDIR)/configure.in + # Automatic dependency computation. This is a real pain, because the # dependencies change based on target_cpu_type and obj_format. # Just to make things even more complicated, automake separates the @@ -932,394 +934,474 @@ dep-am: DEP .PHONY: dep dep-in dep-am AMKDEP = #DO NOT PUT ANYTHING BETWEEN THIS LINE AND THE MATCHING WARNING BELOW. -DEPTC_a29k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-a29k.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/a29k.h -DEPTC_a29k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-a29k.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/a29k.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/a29k.h -DEPTC_a29k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-a29k.h $(INCDIR)/opcode/a29k.h -DEPTC_alpha_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-alpha.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - subsegs.h $(INCDIR)/obstack.h struc-symbol.h ecoff.h \ - $(INCDIR)/opcode/alpha.h $(srcdir)/config/atof-vax.c -DEPTC_alpha_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-alpha.h \ - ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \ - subsegs.h $(INCDIR)/obstack.h struc-symbol.h $(INCDIR)/opcode/alpha.h \ +DEPTC_a29k_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-a29k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/a29k.h +DEPTC_a29k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-a29k.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/a29k.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/a29k.h +DEPTC_a29k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-a29k.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/a29k.h +DEPTC_alpha_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-alpha.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h ecoff.h $(INCDIR)/opcode/alpha.h $(INCDIR)/safe-ctype.h \ + $(srcdir)/config/atof-vax.c +DEPTC_alpha_ecoff = $(INCDIR)/symcat.h $(srcdir)/config/obj-ecoff.h \ + $(srcdir)/config/tc-alpha.h ecoff.h $(INCDIR)/coff/sym.h \ + $(INCDIR)/coff/ecoff.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/opcode/alpha.h $(INCDIR)/safe-ctype.h \ $(srcdir)/config/atof-vax.c -DEPTC_alpha_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-alpha.h subsegs.h \ - $(INCDIR)/obstack.h struc-symbol.h ecoff.h $(INCDIR)/coff/sym.h \ - $(INCDIR)/coff/ecoff.h $(INCDIR)/opcode/alpha.h $(INCDIR)/elf/alpha.h \ - $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h $(srcdir)/config/atof-vax.c -DEPTC_alpha_evax = $(srcdir)/config/obj-evax.h $(srcdir)/config/tc-alpha.h \ +DEPTC_alpha_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-alpha.h \ subsegs.h $(INCDIR)/obstack.h struc-symbol.h ecoff.h \ - $(INCDIR)/opcode/alpha.h $(srcdir)/config/atof-vax.c -DEPTC_arc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arc.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - struc-symbol.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/arc.h \ - $(srcdir)/../opcodes/arc-ext.h $(INCDIR)/elf/arc.h \ - $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h -DEPTC_arc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arc.h struc-symbol.h \ - subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/arc.h \ - $(srcdir)/../opcodes/arc-ext.h $(INCDIR)/elf/arc.h \ - $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h -DEPTC_arm_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-arm.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h -DEPTC_arm_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arm.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h -DEPTC_arm_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arm.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h \ - dwarf2dbg.h -DEPTC_avr_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-avr.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h $(INCDIR)/opcode/alpha.h \ + $(INCDIR)/elf/alpha.h $(INCDIR)/elf/reloc-macros.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h $(srcdir)/config/atof-vax.c +DEPTC_alpha_evax = $(INCDIR)/symcat.h $(srcdir)/config/obj-evax.h \ + $(srcdir)/config/tc-alpha.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h ecoff.h $(INCDIR)/opcode/alpha.h $(INCDIR)/safe-ctype.h \ + $(srcdir)/config/atof-vax.c +DEPTC_arc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-arc.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h struc-symbol.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/arc.h $(srcdir)/../opcodes/arc-ext.h \ + $(INCDIR)/elf/arc.h $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h +DEPTC_arc_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arc.h \ + struc-symbol.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/arc.h $(srcdir)/../opcodes/arc-ext.h \ + $(INCDIR)/elf/arc.h $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h +DEPTC_arm_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-arm.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h +DEPTC_arm_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-arm.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h subsegs.h \ + $(INCDIR)/obstack.h +DEPTC_arm_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arm.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h +DEPTC_avr_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-avr.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/avr.h -DEPTC_avr_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-avr.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/avr.h -DEPTC_cris_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-cris.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ +DEPTC_avr_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-avr.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/avr.h +DEPTC_cris_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-cris.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/cris.h dwarf2dbg.h +DEPTC_cris_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-cris.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ $(INCDIR)/opcode/cris.h dwarf2dbg.h -DEPTC_cris_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-cris.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/cris.h dwarf2dbg.h -DEPTC_d10v_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-d10v.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ +DEPTC_d10v_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-d10v.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/d10v.h \ $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h -DEPTC_d10v_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d10v.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/d10v.h $(INCDIR)/elf/ppc.h \ - $(INCDIR)/elf/reloc-macros.h -DEPTC_d30v_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-d30v.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ +DEPTC_d10v_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d10v.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/d10v.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h +DEPTC_d30v_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-d30v.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/d30v.h -DEPTC_d30v_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d30v.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/d30v.h -DEPTC_fr30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-fr30.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - subsegs.h $(INCDIR)/obstack.h $(INCDIR)/symcat.h $(srcdir)/../opcodes/fr30-desc.h \ - $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/fr30-opc.h \ - cgen.h -DEPTC_fr30_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-fr30.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/symcat.h $(srcdir)/../opcodes/fr30-desc.h \ +DEPTC_d30v_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d30v.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/d30v.h +DEPTC_fr30_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-fr30.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ + subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/fr30-desc.h \ $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/fr30-opc.h \ cgen.h -DEPTC_h8300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8300.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/h8300.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ - $(INCDIR)/opcode/h8300.h -DEPTC_h8300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8300.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/h8300.h -DEPTC_h8500_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8500.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/h8500.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ - $(srcdir)/../opcodes/h8500-opc.h -DEPTC_h8500_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8500.h subsegs.h \ - $(INCDIR)/obstack.h $(srcdir)/../opcodes/h8500-opc.h -DEPTC_hppa_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-hppa.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ +DEPTC_fr30_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-fr30.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(srcdir)/../opcodes/fr30-desc.h $(INCDIR)/opcode/cgen.h \ + $(srcdir)/../opcodes/fr30-opc.h cgen.h +DEPTC_h8300_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-h8300.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/h8300.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/h8300.h \ + $(INCDIR)/safe-ctype.h +DEPTC_h8300_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8300.h \ + subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/h8300.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/elf/h8.h $(INCDIR)/elf/reloc-macros.h +DEPTC_h8500_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-h8500.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/h8500.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/h8500-opc.h \ + $(INCDIR)/safe-ctype.h +DEPTC_h8500_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8500.h \ + subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/h8500-opc.h \ + $(INCDIR)/safe-ctype.h +DEPTC_hppa_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-hppa.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ subsegs.h $(INCDIR)/obstack.h $(BFDDIR)/libhppa.h $(INCDIR)/opcode/hppa.h -DEPTC_hppa_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-hppa.h $(BFDDIR)/elf32-hppa.h \ - $(BFDDIR)/libhppa.h $(INCDIR)/elf/hppa.h $(INCDIR)/elf/reloc-macros.h \ +DEPTC_hppa_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-hppa.h \ + $(BFDDIR)/elf32-hppa.h $(BFDDIR)/libhppa.h $(INCDIR)/elf/hppa.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/safe-ctype.h \ subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/hppa.h \ dwarf2dbg.h -DEPTC_ia64_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ia64.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ +DEPTC_ia64_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-ia64.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ dwarf2dbg.h subsegs.h $(INCDIR)/obstack.h -DEPTC_ia64_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ia64.h dwarf2dbg.h \ - subsegs.h $(INCDIR)/obstack.h -DEPTC_i370_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i370.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ +DEPTC_ia64_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ia64.h \ + $(INCDIR)/safe-ctype.h dwarf2dbg.h subsegs.h $(INCDIR)/obstack.h +DEPTC_i370_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-i370.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ subsegs.h $(INCDIR)/obstack.h struc-symbol.h $(INCDIR)/opcode/i370.h -DEPTC_i370_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i370.h subsegs.h \ - $(INCDIR)/obstack.h struc-symbol.h $(INCDIR)/opcode/i370.h \ - $(INCDIR)/elf/i370.h -DEPTC_i386_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-i386.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ - dwarf2dbg.h $(INCDIR)/opcode/i386.h -DEPTC_i386_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i386.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ +DEPTC_i370_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i370.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/opcode/i370.h $(INCDIR)/elf/i370.h +DEPTC_i386_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-i386.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ dwarf2dbg.h $(INCDIR)/opcode/i386.h -DEPTC_i386_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i386.h subsegs.h \ +DEPTC_i386_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-i386.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h subsegs.h \ $(INCDIR)/obstack.h dwarf2dbg.h $(INCDIR)/opcode/i386.h -DEPTC_i860_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i860.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/i860.h $(INCDIR)/elf/i860.h \ - $(INCDIR)/elf/reloc-macros.h -DEPTC_i960_bout = $(srcdir)/config/obj-bout.h $(srcdir)/config/tc-i960.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/i960.h -DEPTC_i960_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i960.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/i960.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h $(INCDIR)/opcode/i960.h -DEPTC_i960_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i960.h $(INCDIR)/obstack.h \ +DEPTC_i386_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i386.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + dwarf2dbg.h $(INCDIR)/opcode/i386.h +DEPTC_i860_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i860.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/i860.h $(INCDIR)/elf/i860.h $(INCDIR)/elf/reloc-macros.h +DEPTC_i960_bout = $(INCDIR)/symcat.h $(srcdir)/config/obj-bout.h \ + $(srcdir)/config/tc-i960.h $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h \ $(INCDIR)/opcode/i960.h -DEPTC_m32r_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m32r.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - subsegs.h $(INCDIR)/obstack.h $(INCDIR)/symcat.h $(srcdir)/../opcodes/m32r-desc.h \ - $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/m32r-opc.h \ - cgen.h -DEPTC_m32r_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32r.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/symcat.h $(srcdir)/../opcodes/m32r-desc.h \ +DEPTC_i960_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-i960.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/i960.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h $(INCDIR)/opcode/i960.h +DEPTC_i960_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i960.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h $(INCDIR)/opcode/i960.h +DEPTC_m32r_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-m32r.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ + subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/m32r-desc.h \ $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/m32r-opc.h \ cgen.h -DEPTC_m68hc11_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m68hc11.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ - $(INCDIR)/opcode/m68hc11.h dwarf2dbg.h -DEPTC_m68hc11_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68hc11.h subsegs.h \ +DEPTC_m32r_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32r.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(srcdir)/../opcodes/m32r-desc.h $(INCDIR)/opcode/cgen.h \ + $(srcdir)/../opcodes/m32r-opc.h cgen.h +DEPTC_m68hc11_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-m68hc11.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h subsegs.h \ $(INCDIR)/obstack.h $(INCDIR)/opcode/m68hc11.h dwarf2dbg.h -DEPTC_m68k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ - subsegs.h dwarf2dbg.h $(INCDIR)/opcode/m68k.h $(srcdir)/config/m68k-parse.h -DEPTC_m68k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m68k.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ +DEPTC_m68hc11_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68hc11.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/m68hc11.h dwarf2dbg.h +DEPTC_m68k_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-m68k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h subsegs.h \ + dwarf2dbg.h $(INCDIR)/opcode/m68k.h $(srcdir)/config/m68k-parse.h +DEPTC_m68k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-m68k.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h \ subsegs.h dwarf2dbg.h $(INCDIR)/opcode/m68k.h $(srcdir)/config/m68k-parse.h -DEPTC_m68k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68k.h $(INCDIR)/obstack.h \ - subsegs.h dwarf2dbg.h $(INCDIR)/opcode/m68k.h $(srcdir)/config/m68k-parse.h \ +DEPTC_m68k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68k.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h subsegs.h \ + dwarf2dbg.h $(INCDIR)/opcode/m68k.h $(srcdir)/config/m68k-parse.h \ $(INCDIR)/elf/m68k.h $(INCDIR)/elf/reloc-macros.h -DEPTC_m68k_hp300 = $(srcdir)/config/obj-hp300.h $(srcdir)/config/obj-aout.h \ - $(srcdir)/config/tc-m68k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ +DEPTC_m68k_hp300 = $(INCDIR)/symcat.h $(srcdir)/config/obj-hp300.h \ + $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \ + $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ $(INCDIR)/obstack.h subsegs.h dwarf2dbg.h $(INCDIR)/opcode/m68k.h \ $(srcdir)/config/m68k-parse.h -DEPTC_m88k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m88k.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/m88k.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ - $(srcdir)/config/m88k-opcode.h -DEPTC_m88k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m88k.h subsegs.h \ +DEPTC_m88k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-m88k.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/m88k.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h subsegs.h \ $(INCDIR)/obstack.h $(srcdir)/config/m88k-opcode.h -DEPTC_mcore_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mcore.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/mcore.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ - $(srcdir)/../opcodes/mcore-opc.h -DEPTC_mcore_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mcore.h subsegs.h \ - $(INCDIR)/obstack.h $(srcdir)/../opcodes/mcore-opc.h \ - $(INCDIR)/elf/mcore.h $(INCDIR)/elf/reloc-macros.h -DEPTC_mips_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-mips.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ +DEPTC_m88k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m88k.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(srcdir)/config/m88k-opcode.h +DEPTC_mcore_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-mcore.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/mcore.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/mcore-opc.h \ + $(INCDIR)/safe-ctype.h +DEPTC_mcore_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mcore.h \ + subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/mcore-opc.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/elf/mcore.h $(INCDIR)/elf/reloc-macros.h +DEPTC_mips_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-mips.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + subsegs.h $(INCDIR)/obstack.h $(INCDIR)/safe-ctype.h \ $(INCDIR)/opcode/mips.h itbl-ops.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h \ ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h -DEPTC_mips_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mips.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ +DEPTC_mips_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-mips.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/safe-ctype.h \ $(INCDIR)/opcode/mips.h itbl-ops.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h \ ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h -DEPTC_mips_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-mips.h \ - ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \ - subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/mips.h \ - itbl-ops.h $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h -DEPTC_mips_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mips.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/mips.h itbl-ops.h \ - $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h ecoff.h \ - $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h -DEPTC_mn10200_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10200.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ +DEPTC_mips_ecoff = $(INCDIR)/symcat.h $(srcdir)/config/obj-ecoff.h \ + $(srcdir)/config/tc-mips.h ecoff.h $(INCDIR)/coff/sym.h \ + $(INCDIR)/coff/ecoff.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/mips.h itbl-ops.h \ + $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h +DEPTC_mips_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mips.h \ + subsegs.h $(INCDIR)/obstack.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/opcode/mips.h itbl-ops.h $(INCDIR)/elf/mips.h \ + $(INCDIR)/elf/reloc-macros.h ecoff.h $(INCDIR)/coff/sym.h \ + $(INCDIR)/coff/ecoff.h +DEPTC_mn10200_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-mn10200.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/mn10200.h -DEPTC_mn10200_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10200.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/mn10200.h -DEPTC_mn10300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10300.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ +DEPTC_mn10200_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10200.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/mn10200.h +DEPTC_mn10300_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-mn10300.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/mn10300.h \ dwarf2dbg.h -DEPTC_mn10300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10300.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/mn10300.h dwarf2dbg.h -DEPTC_ns32k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-ns32k.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ns32k.h \ - $(INCDIR)/obstack.h -DEPTC_ns32k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ns32k.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ +DEPTC_mn10300_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10300.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/mn10300.h dwarf2dbg.h +DEPTC_ns32k_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-ns32k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ $(INCDIR)/opcode/ns32k.h $(INCDIR)/obstack.h -DEPTC_ns32k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h $(INCDIR)/opcode/ns32k.h \ +DEPTC_ns32k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-ns32k.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ns32k.h \ $(INCDIR)/obstack.h -DEPTC_openrisc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-openrisc.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - subsegs.h $(INCDIR)/obstack.h $(INCDIR)/symcat.h $(srcdir)/../opcodes/openrisc-desc.h \ - $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/openrisc-opc.h \ - cgen.h -DEPTC_openrisc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-openrisc.h \ - subsegs.h $(INCDIR)/obstack.h $(INCDIR)/symcat.h $(srcdir)/../opcodes/openrisc-desc.h \ +DEPTC_ns32k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h \ + $(INCDIR)/opcode/ns32k.h $(INCDIR)/obstack.h +DEPTC_openrisc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-openrisc.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ + $(srcdir)/../opcodes/openrisc-desc.h $(INCDIR)/opcode/cgen.h \ + $(srcdir)/../opcodes/openrisc-opc.h cgen.h +DEPTC_openrisc_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-openrisc.h \ + subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/openrisc-desc.h \ $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/openrisc-opc.h \ cgen.h -DEPTC_pdp11_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-pdp11.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/pdp11.h -DEPTC_pdp11_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-pdp11.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ +DEPTC_pdp11_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-pdp11.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/pdp11.h +DEPTC_pdp11_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-pdp11.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ $(INCDIR)/opcode/pdp11.h -DEPTC_pdp11_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pdp11.h $(INCDIR)/opcode/pdp11.h -DEPTC_pj_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-pj.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ +DEPTC_pdp11_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pdp11.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/pdp11.h +DEPTC_pj_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-pj.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ $(INCDIR)/opcode/pj.h -DEPTC_pj_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pj.h $(INCDIR)/opcode/pj.h -DEPTC_ppc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ppc.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/rs6000.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/ppc.h -DEPTC_ppc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ppc.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/ppc.h $(INCDIR)/elf/ppc.h \ - $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h -DEPTC_s390_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-s390.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ +DEPTC_pj_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pj.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/pj.h +DEPTC_ppc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-ppc.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/rs6000.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/ppc.h +DEPTC_ppc_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ppc.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/ppc.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \ + dwarf2dbg.h +DEPTC_s390_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-s390.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ subsegs.h $(INCDIR)/obstack.h struc-symbol.h $(INCDIR)/opcode/s390.h \ $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h -DEPTC_s390_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-s390.h subsegs.h \ - $(INCDIR)/obstack.h struc-symbol.h $(INCDIR)/opcode/s390.h \ - $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h -DEPTC_sh_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sh.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/sh.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ - $(srcdir)/../opcodes/sh-opc.h struc-symbol.h dwarf2dbg.h -DEPTC_sh_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh.h subsegs.h \ - $(INCDIR)/obstack.h $(srcdir)/../opcodes/sh-opc.h struc-symbol.h \ - $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h -DEPTC_sparc_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-sparc.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ - $(INCDIR)/opcode/sparc.h -DEPTC_sparc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sparc.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/sparc.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ - $(INCDIR)/opcode/sparc.h -DEPTC_sparc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sparc.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/sparc.h $(INCDIR)/elf/sparc.h \ +DEPTC_s390_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-s390.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/opcode/s390.h $(INCDIR)/elf/s390.h \ + $(INCDIR)/elf/reloc-macros.h +DEPTC_sh_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-sh.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/sh.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/sh-opc.h \ + $(INCDIR)/safe-ctype.h struc-symbol.h dwarf2dbg.h +DEPTC_sh_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh.h \ + subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/sh-opc.h \ + $(INCDIR)/safe-ctype.h struc-symbol.h $(INCDIR)/elf/sh.h \ $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h -DEPTC_tahoe_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tahoe.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ - $(INCDIR)/opcode/tahoe.h -DEPTC_tahoe_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tahoe.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ +DEPTC_sparc_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-sparc.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/sparc.h +DEPTC_sparc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-sparc.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/sparc.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/opcode/sparc.h +DEPTC_sparc_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sparc.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/sparc.h $(INCDIR)/elf/sparc.h $(INCDIR)/elf/reloc-macros.h \ + dwarf2dbg.h +DEPTC_tahoe_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-tahoe.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h $(INCDIR)/opcode/tahoe.h +DEPTC_tahoe_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-tahoe.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ $(INCDIR)/obstack.h $(INCDIR)/opcode/tahoe.h -DEPTC_tahoe_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tahoe.h $(INCDIR)/obstack.h \ - $(INCDIR)/opcode/tahoe.h -DEPTC_tic30_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tic30.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/tic30.h -DEPTC_tic30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic30.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic30.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/tic30.h -DEPTC_tic30_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic30.h $(INCDIR)/opcode/tic30.h -DEPTC_tic54x_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic54x.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h sb.h macro.h \ +DEPTC_tahoe_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tahoe.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h $(INCDIR)/opcode/tahoe.h +DEPTC_tic30_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-tic30.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/tic30.h +DEPTC_tic30_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-tic30.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/tic30.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/tic30.h +DEPTC_tic30_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic30.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/tic30.h +DEPTC_tic54x_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-tic54x.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h sb.h macro.h \ subsegs.h $(INCDIR)/obstack.h struc-symbol.h $(INCDIR)/opcode/tic54x.h -DEPTC_tic54x_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic54x.h sb.h \ - macro.h subsegs.h $(INCDIR)/obstack.h struc-symbol.h \ - $(INCDIR)/opcode/tic54x.h $(srcdir)/config/obj-coff.h \ +DEPTC_tic54x_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic54x.h \ + $(INCDIR)/safe-ctype.h sb.h macro.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/opcode/tic54x.h $(srcdir)/config/obj-coff.h \ $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h \ $(BFDDIR)/libcoff.h -DEPTC_tic80_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic80.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic80.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/tic80.h -DEPTC_tic80_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic80.h $(INCDIR)/opcode/tic80.h -DEPTC_vax_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-vax.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(srcdir)/config/vax-inst.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/vax.h -DEPTC_vax_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-vax.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(srcdir)/config/vax-inst.h $(INCDIR)/obstack.h $(INCDIR)/opcode/vax.h -DEPTC_vax_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-vax.h $(srcdir)/config/vax-inst.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/vax.h -DEPTC_vax_vms = $(srcdir)/config/obj-vms.h $(srcdir)/config/tc-vax.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(srcdir)/config/vax-inst.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/vax.h -DEPTC_w65_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-w65.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/w65.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ - $(srcdir)/../opcodes/w65-opc.h -DEPTC_w65_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-w65.h subsegs.h \ - $(INCDIR)/obstack.h $(srcdir)/../opcodes/w65-opc.h -DEPTC_v850_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-v850.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ +DEPTC_tic80_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-tic80.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/tic80.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/tic80.h +DEPTC_tic80_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic80.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/tic80.h +DEPTC_vax_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-vax.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(srcdir)/config/vax-inst.h $(INCDIR)/obstack.h $(INCDIR)/opcode/vax.h \ + $(INCDIR)/safe-ctype.h +DEPTC_vax_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-vax.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(srcdir)/config/vax-inst.h \ + $(INCDIR)/obstack.h $(INCDIR)/opcode/vax.h $(INCDIR)/safe-ctype.h +DEPTC_vax_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-vax.h \ + $(srcdir)/config/vax-inst.h $(INCDIR)/obstack.h $(INCDIR)/opcode/vax.h \ + $(INCDIR)/safe-ctype.h +DEPTC_vax_vms = $(INCDIR)/symcat.h $(srcdir)/config/obj-vms.h \ + $(srcdir)/config/tc-vax.h $(INCDIR)/aout/stab_gnu.h \ + $(INCDIR)/aout/stab.def $(srcdir)/config/vax-inst.h \ + $(INCDIR)/obstack.h $(INCDIR)/opcode/vax.h $(INCDIR)/safe-ctype.h +DEPTC_w65_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-w65.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/w65.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/w65-opc.h +DEPTC_w65_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-w65.h \ + subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/w65-opc.h +DEPTC_v850_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-v850.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/v850.h \ dwarf2dbg.h -DEPTC_v850_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/v850.h dwarf2dbg.h -DEPTC_z8k_coff = $(srcdir)/../opcodes/z8k-opc.h $(srcdir)/config/obj-coff.h \ - $(srcdir)/config/tc-z8k.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/z8k.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h -DEPTC_z8k_elf = $(srcdir)/../opcodes/z8k-opc.h $(srcdir)/config/obj-elf.h \ +DEPTC_v850_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-z8k.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/v850.h dwarf2dbg.h +DEPTC_z8k_coff = $(srcdir)/../opcodes/z8k-opc.h $(INCDIR)/symcat.h \ + $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-z8k.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/z8k.h $(INCDIR)/coff/external.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h +DEPTC_z8k_elf = $(srcdir)/../opcodes/z8k-opc.h $(INCDIR)/symcat.h \ + $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + $(srcdir)/config/tc-z8k.h $(INCDIR)/safe-ctype.h DEPTC_hppa_som = $(srcdir)/config/tc-hppa.h subsegs.h \ $(INCDIR)/obstack.h $(BFDDIR)/libhppa.h $(INCDIR)/opcode/hppa.h \ $(BFDDIR)/som.h @@ -1328,363 +1410,427 @@ DEPTC_i386_multi = $(DEPTC_i386_aout) $( DEPTC_mips_multi = $(DEPTC_mips_coff) $(DEPTC_mips_ecoff) \ $(DEPTC_mips_elf) DEPTC_cris_multi = $(DEPTC_cris_aout) $(DEPTC_cris_elf) -DEPOBJ_a29k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-a29k.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/obstack.h -DEPOBJ_a29k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-a29k.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/a29k.h $(INCDIR)/coff/external.h \ +DEPOBJ_a29k_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-a29k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h +DEPOBJ_a29k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-a29k.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/a29k.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h +DEPOBJ_a29k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-a29k.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_alpha_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-alpha.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ subsegs.h -DEPOBJ_a29k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-a29k.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_alpha_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-alpha.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/obstack.h subsegs.h -DEPOBJ_alpha_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-alpha.h \ +DEPOBJ_alpha_ecoff = $(INCDIR)/symcat.h $(srcdir)/config/obj-ecoff.h \ + $(srcdir)/config/tc-alpha.h ecoff.h $(INCDIR)/coff/sym.h \ + $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(BFDDIR)/libecoff.h +DEPOBJ_alpha_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-alpha.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(BFDDIR)/libecoff.h -DEPOBJ_alpha_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-alpha.h subsegs.h \ - $(INCDIR)/obstack.h ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \ $(INCDIR)/elf/alpha.h $(INCDIR)/elf/reloc-macros.h \ $(INCDIR)/aout/aout64.h -DEPOBJ_alpha_evax = $(srcdir)/config/obj-evax.h $(srcdir)/config/tc-alpha.h -DEPOBJ_arc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arc.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - struc-symbol.h $(INCDIR)/obstack.h subsegs.h -DEPOBJ_arc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arc.h struc-symbol.h \ - subsegs.h $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_arm_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-arm.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/obstack.h -DEPOBJ_arm_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arm.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h \ +DEPOBJ_alpha_evax = $(INCDIR)/symcat.h $(srcdir)/config/obj-evax.h \ + $(srcdir)/config/tc-alpha.h +DEPOBJ_arc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-arc.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h struc-symbol.h \ + $(INCDIR)/obstack.h subsegs.h +DEPOBJ_arc_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arc.h \ + struc-symbol.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_arm_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-arm.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h +DEPOBJ_arm_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-arm.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h +DEPOBJ_arm_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arm.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_avr_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-avr.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ subsegs.h -DEPOBJ_arm_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arm.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_avr_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-avr.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/obstack.h subsegs.h -DEPOBJ_avr_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-avr.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_cris_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-cris.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/obstack.h -DEPOBJ_cris_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-cris.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_d10v_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-d10v.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/obstack.h subsegs.h -DEPOBJ_d10v_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d10v.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_d30v_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-d30v.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/obstack.h subsegs.h -DEPOBJ_d30v_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d30v.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_fr30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-fr30.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/obstack.h subsegs.h -DEPOBJ_fr30_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-fr30.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_h8300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8300.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/h8300.h $(INCDIR)/coff/external.h \ +DEPOBJ_avr_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-avr.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_cris_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-cris.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h +DEPOBJ_cris_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-cris.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_d10v_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-d10v.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ subsegs.h -DEPOBJ_h8300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8300.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_h8500_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8500.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/h8500.h $(INCDIR)/coff/external.h \ +DEPOBJ_d10v_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d10v.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_d30v_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-d30v.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ subsegs.h -DEPOBJ_h8500_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8500.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_hppa_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-hppa.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/obstack.h subsegs.h -DEPOBJ_hppa_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-hppa.h $(BFDDIR)/elf32-hppa.h \ - $(BFDDIR)/libhppa.h $(INCDIR)/elf/hppa.h $(INCDIR)/elf/reloc-macros.h \ +DEPOBJ_d30v_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d30v.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_fr30_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-fr30.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ + subsegs.h +DEPOBJ_fr30_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-fr30.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_h8300_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-h8300.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/h8300.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h +DEPOBJ_h8300_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8300.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_h8500_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-h8500.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/h8500.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h +DEPOBJ_h8500_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8500.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_hppa_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-hppa.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ + subsegs.h +DEPOBJ_hppa_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-hppa.h \ + $(BFDDIR)/elf32-hppa.h $(BFDDIR)/libhppa.h $(INCDIR)/elf/hppa.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/safe-ctype.h \ subsegs.h $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_ia64_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ia64.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/obstack.h subsegs.h -DEPOBJ_ia64_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ia64.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_i370_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i370.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/obstack.h subsegs.h -DEPOBJ_i370_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i370.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/elf/i370.h $(INCDIR)/aout/aout64.h -DEPOBJ_i386_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-i386.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/obstack.h -DEPOBJ_i386_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i386.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \ +DEPOBJ_ia64_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-ia64.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ subsegs.h -DEPOBJ_i386_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i386.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_i860_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i860.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_i960_bout = $(srcdir)/config/obj-bout.h $(srcdir)/config/tc-i960.h \ - $(INCDIR)/obstack.h -DEPOBJ_i960_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i960.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/i960.h $(BFDDIR)/libcoff.h \ +DEPOBJ_ia64_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ia64.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_i370_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-i370.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ + subsegs.h +DEPOBJ_i370_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i370.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/elf/i370.h $(INCDIR)/aout/aout64.h +DEPOBJ_i386_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-i386.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h +DEPOBJ_i386_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-i386.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h -DEPOBJ_i960_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i960.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_m32r_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m32r.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ +DEPOBJ_i386_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i386.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_i860_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i860.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_i960_bout = $(INCDIR)/symcat.h $(srcdir)/config/obj-bout.h \ + $(srcdir)/config/tc-i960.h $(INCDIR)/obstack.h +DEPOBJ_i960_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-i960.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/i960.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ $(INCDIR)/obstack.h subsegs.h -DEPOBJ_m32r_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32r.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_m68hc11_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m68hc11.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h \ +DEPOBJ_i960_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i960.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_m32r_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-m32r.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ subsegs.h -DEPOBJ_m68hc11_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68hc11.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_m68k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \ +DEPOBJ_m32r_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32r.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_m68hc11_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-m68hc11.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h +DEPOBJ_m68hc11_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68hc11.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_m68k_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-m68k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h +DEPOBJ_m68k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-m68k.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h +DEPOBJ_m68k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68k.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_m68k_hp300 = $(srcdir)/config/obj-aout.c $(INCDIR)/symcat.h \ + $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ $(INCDIR)/obstack.h -DEPOBJ_m68k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m68k.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ - subsegs.h -DEPOBJ_m68k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68k.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_m68k_hp300 = $(srcdir)/config/obj-aout.c $(srcdir)/config/obj-aout.h \ - $(srcdir)/config/tc-m68k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ +DEPOBJ_m88k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-m88k.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/m88k.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h +DEPOBJ_m88k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m88k.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_mcore_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-mcore.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/mcore.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h +DEPOBJ_mcore_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mcore.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_mips_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-mips.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h -DEPOBJ_m88k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m88k.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/m88k.h $(INCDIR)/coff/external.h \ +DEPOBJ_mips_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-mips.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h +DEPOBJ_mips_ecoff = $(INCDIR)/symcat.h $(srcdir)/config/obj-ecoff.h \ + $(srcdir)/config/tc-mips.h ecoff.h $(INCDIR)/coff/sym.h \ + $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(BFDDIR)/libecoff.h +DEPOBJ_mips_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mips.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \ + $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/aout/aout64.h +DEPOBJ_mn10200_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-mn10200.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ subsegs.h -DEPOBJ_m88k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m88k.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_mcore_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mcore.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/mcore.h $(INCDIR)/coff/external.h \ +DEPOBJ_mn10200_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10200.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_mn10300_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-mn10300.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ subsegs.h -DEPOBJ_mcore_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mcore.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_mips_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-mips.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/obstack.h -DEPOBJ_mips_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mips.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/external.h \ +DEPOBJ_mn10300_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10300.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_ns32k_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-ns32k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h +DEPOBJ_ns32k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-ns32k.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ subsegs.h -DEPOBJ_mips_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-mips.h \ - ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(BFDDIR)/libecoff.h -DEPOBJ_mips_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mips.h subsegs.h \ - $(INCDIR)/obstack.h ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \ - $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/aout/aout64.h -DEPOBJ_mn10200_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10200.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/obstack.h subsegs.h -DEPOBJ_mn10200_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10200.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_mn10300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10300.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/obstack.h subsegs.h -DEPOBJ_mn10300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10300.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_ns32k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-ns32k.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/obstack.h -DEPOBJ_ns32k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ns32k.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/obstack.h subsegs.h -DEPOBJ_ns32k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_openrisc_coff = $(srcdir)/config/obj-coff.h \ +DEPOBJ_ns32k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_openrisc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-openrisc.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ subsegs.h -DEPOBJ_openrisc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-openrisc.h \ - subsegs.h $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_pdp11_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-pdp11.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/obstack.h -DEPOBJ_pdp11_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-pdp11.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/obstack.h subsegs.h -DEPOBJ_pdp11_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pdp11.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_pj_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-pj.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/obstack.h subsegs.h -DEPOBJ_pj_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pj.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_ppc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ppc.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/rs6000.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h -DEPOBJ_ppc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ppc.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \ +DEPOBJ_openrisc_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-openrisc.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ $(INCDIR)/aout/aout64.h -DEPOBJ_s390_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-s390.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/obstack.h subsegs.h -DEPOBJ_s390_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-s390.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_sh_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sh.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/sh.h $(INCDIR)/coff/external.h \ +DEPOBJ_pdp11_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-pdp11.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h +DEPOBJ_pdp11_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-pdp11.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ subsegs.h -DEPOBJ_sh_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_sparc_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-sparc.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/obstack.h -DEPOBJ_sparc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sparc.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/sparc.h $(INCDIR)/coff/external.h \ +DEPOBJ_pdp11_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pdp11.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_pj_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-pj.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ subsegs.h -DEPOBJ_sparc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sparc.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_tahoe_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tahoe.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/obstack.h -DEPOBJ_tahoe_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tahoe.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ +DEPOBJ_pj_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pj.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_ppc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-ppc.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/rs6000.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ $(INCDIR)/obstack.h subsegs.h -DEPOBJ_tahoe_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tahoe.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_tic30_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tic30.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/obstack.h -DEPOBJ_tic30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic30.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic30.h $(INCDIR)/coff/external.h \ +DEPOBJ_ppc_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ppc.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/aout/aout64.h +DEPOBJ_s390_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-s390.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ subsegs.h -DEPOBJ_tic30_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic30.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_tic54x_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic54x.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h \ +DEPOBJ_s390_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-s390.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_sh_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-sh.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/sh.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h +DEPOBJ_sh_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_sparc_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-sparc.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h +DEPOBJ_sparc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-sparc.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/sparc.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h +DEPOBJ_sparc_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sparc.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_tahoe_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-tahoe.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h +DEPOBJ_tahoe_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-tahoe.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ subsegs.h -DEPOBJ_tic54x_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic54x.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_tic80_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic80.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic80.h $(INCDIR)/coff/external.h \ +DEPOBJ_tahoe_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tahoe.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_tic30_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-tic30.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h +DEPOBJ_tic30_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-tic30.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/tic30.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h +DEPOBJ_tic30_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic30.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_tic54x_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-tic54x.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h +DEPOBJ_tic54x_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic54x.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_tic80_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-tic80.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/tic80.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h +DEPOBJ_tic80_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic80.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_vax_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-vax.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h +DEPOBJ_vax_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-vax.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ subsegs.h -DEPOBJ_tic80_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic80.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_vax_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-vax.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/obstack.h -DEPOBJ_vax_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-vax.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/obstack.h subsegs.h -DEPOBJ_vax_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-vax.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_vax_vms = $(srcdir)/config/obj-vms.h $(srcdir)/config/tc-vax.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def subsegs.h \ +DEPOBJ_vax_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-vax.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_vax_vms = $(INCDIR)/symcat.h $(srcdir)/config/obj-vms.h \ + $(srcdir)/config/tc-vax.h $(INCDIR)/aout/stab_gnu.h \ + $(INCDIR)/aout/stab.def $(INCDIR)/safe-ctype.h subsegs.h \ $(INCDIR)/obstack.h -DEPOBJ_w65_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-w65.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/w65.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ - subsegs.h -DEPOBJ_w65_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-w65.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_v850_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-v850.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/obstack.h subsegs.h -DEPOBJ_v850_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_z8k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-z8k.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/z8k.h $(INCDIR)/coff/external.h \ +DEPOBJ_w65_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-w65.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/w65.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h +DEPOBJ_w65_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-w65.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_v850_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-v850.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ subsegs.h -DEPOBJ_z8k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-z8k.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +DEPOBJ_v850_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_z8k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-z8k.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/z8k.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h +DEPOBJ_z8k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-z8k.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h DEPOBJ_hppa_som = $(srcdir)/config/obj-som.h subsegs.h \ $(INCDIR)/obstack.h $(BFDDIR)/libhppa.h $(BFDDIR)/som.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def @@ -1696,258 +1842,278 @@ DEPOBJ_cris_multi = $(DEPOBJ_cris_aout) DEP_a29k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-a29k.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h DEP_a29k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-a29k.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/a29k.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_a29k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-a29k.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/a29k.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +DEP_a29k_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-a29k.h DEP_alpha_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-alpha.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h DEP_alpha_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-alpha.h \ ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h -DEP_alpha_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-alpha.h +DEP_alpha_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-alpha.h DEP_alpha_evax = $(srcdir)/config/obj-evax.h $(srcdir)/config/tc-alpha.h DEP_arc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arc.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_arc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arc.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +DEP_arc_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arc.h DEP_arm_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-arm.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h DEP_arm_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arm.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_arm_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arm.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/arm.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +DEP_arm_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arm.h DEP_avr_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-avr.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_avr_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-avr.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +DEP_avr_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-avr.h DEP_cris_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-cris.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h -DEP_cris_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-cris.h +DEP_cris_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-cris.h DEP_d10v_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-d10v.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_d10v_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d10v.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +DEP_d10v_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d10v.h DEP_d30v_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-d30v.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_d30v_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d30v.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +DEP_d30v_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d30v.h DEP_fr30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-fr30.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_fr30_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-fr30.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +DEP_fr30_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-fr30.h DEP_h8300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8300.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/h8300.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_h8300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8300.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/h8300.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +DEP_h8300_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8300.h DEP_h8500_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8500.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/h8500.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_h8500_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8500.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/h8500.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +DEP_h8500_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8500.h DEP_hppa_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-hppa.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_hppa_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-hppa.h $(BFDDIR)/elf32-hppa.h \ - $(BFDDIR)/libhppa.h $(INCDIR)/elf/hppa.h $(INCDIR)/elf/reloc-macros.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +DEP_hppa_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-hppa.h \ + $(BFDDIR)/elf32-hppa.h $(BFDDIR)/libhppa.h $(INCDIR)/elf/hppa.h \ + $(INCDIR)/elf/reloc-macros.h DEP_ia64_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ia64.h \ $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_ia64_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ia64.h +DEP_ia64_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ia64.h DEP_i370_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i370.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_i370_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i370.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +DEP_i370_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i370.h DEP_i386_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-i386.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h DEP_i386_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i386.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_i386_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i386.h -DEP_i860_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i860.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/i386.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +DEP_i386_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i386.h +DEP_i860_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i860.h DEP_i960_bout = $(srcdir)/config/obj-bout.h $(srcdir)/config/tc-i960.h DEP_i960_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i960.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/i960.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h -DEP_i960_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i960.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/i960.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +DEP_i960_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i960.h DEP_m32r_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m32r.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_m32r_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32r.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +DEP_m32r_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32r.h DEP_m68hc11_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m68hc11.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_m68hc11_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68hc11.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +DEP_m68hc11_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68hc11.h DEP_m68k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h DEP_m68k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m68k.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_m68k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68k.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +DEP_m68k_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68k.h DEP_m68k_hp300 = $(srcdir)/config/obj-hp300.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-m68k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h DEP_m88k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m88k.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/m88k.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_m88k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m88k.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/m88k.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +DEP_m88k_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m88k.h DEP_mcore_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mcore.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/mcore.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_mcore_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mcore.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/mcore.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +DEP_mcore_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mcore.h DEP_mips_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-mips.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h DEP_mips_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mips.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/mipspe.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h DEP_mips_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-mips.h \ ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h -DEP_mips_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mips.h +DEP_mips_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mips.h DEP_mn10200_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10200.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_mn10200_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10200.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +DEP_mn10200_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10200.h DEP_mn10300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10300.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_mn10300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10300.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +DEP_mn10300_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10300.h DEP_ns32k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-ns32k.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h DEP_ns32k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ns32k.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_ns32k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +DEP_ns32k_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h DEP_openrisc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-openrisc.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_openrisc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-openrisc.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +DEP_openrisc_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-openrisc.h DEP_pdp11_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-pdp11.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h DEP_pdp11_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-pdp11.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_pdp11_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pdp11.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +DEP_pdp11_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pdp11.h DEP_pj_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-pj.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_pj_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pj.h -DEP_ppc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ppc.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/rs6000.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h -DEP_ppc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ppc.h +DEP_pj_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pj.h +DEP_ppc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ppc.h \ + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/rs6000.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +DEP_ppc_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ppc.h DEP_s390_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-s390.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_s390_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-s390.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +DEP_s390_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-s390.h DEP_sh_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sh.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/sh.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_sh_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/sh.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +DEP_sh_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh.h DEP_sparc_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-sparc.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h DEP_sparc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sparc.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/sparc.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_sparc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sparc.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/sparc.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +DEP_sparc_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sparc.h DEP_tahoe_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tahoe.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h DEP_tahoe_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tahoe.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_tahoe_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tahoe.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +DEP_tahoe_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tahoe.h DEP_tic30_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tic30.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h DEP_tic30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic30.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic30.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_tic30_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic30.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic30.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +DEP_tic30_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic30.h DEP_tic54x_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic54x.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_tic54x_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic54x.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic54x.h \ + $(INCDIR)/coff/ti.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +DEP_tic54x_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic54x.h DEP_tic80_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic80.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic80.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_tic80_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic80.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic80.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +DEP_tic80_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic80.h DEP_vax_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-vax.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h DEP_vax_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-vax.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_vax_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-vax.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +DEP_vax_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-vax.h DEP_vax_vms = $(srcdir)/config/obj-vms.h $(srcdir)/config/tc-vax.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def DEP_w65_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-w65.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/w65.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_w65_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-w65.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/w65.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +DEP_w65_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-w65.h DEP_v850_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-v850.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_v850_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +DEP_v850_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h DEP_z8k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-z8k.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/z8k.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_z8k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-z8k.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/z8k.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +DEP_z8k_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-z8k.h DEP_hppa_som = $(BFDDIR)/som.h DEP_i386_multi = $(DEP_i386_aout) $(DEP_i386_coff) \ $(DEP_i386_elf) @@ -1956,49 +2122,61 @@ DEP_mips_multi = $(DEP_mips_coff) $(DEP_ DEP_cris_multi = $(DEP_cris_aout) $(DEP_cris_elf) BMKDEP = #DO NOT PUT ANYTHING BETWEEN THIS LINE AND THE MATCHING WARNING ABOVE. #MKDEP DO NOT PUT ANYTHING BETWEEN THIS LINE AND THE MATCHING WARNING BELOW. -app.o: app.c -as.o: as.c subsegs.h $(INCDIR)/obstack.h output-file.h \ - sb.h macro.h dwarf2dbg.h -atof-generic.o: atof-generic.c -bignum-copy.o: bignum-copy.c -cond.o: cond.c macro.h sb.h $(INCDIR)/obstack.h -depend.o: depend.c -dwarf2dbg.o: dwarf2dbg.c dwarf2dbg.h subsegs.h $(INCDIR)/obstack.h \ +app.o: app.c $(INCDIR)/symcat.h +as.o: as.c $(INCDIR)/symcat.h subsegs.h $(INCDIR)/obstack.h \ + output-file.h sb.h macro.h dwarf2dbg.h +atof-generic.o: atof-generic.c $(INCDIR)/symcat.h $(INCDIR)/safe-ctype.h +bignum-copy.o: bignum-copy.c $(INCDIR)/symcat.h +cond.o: cond.c $(INCDIR)/symcat.h macro.h sb.h $(INCDIR)/obstack.h +depend.o: depend.c $(INCDIR)/symcat.h +dwarf2dbg.o: dwarf2dbg.c $(INCDIR)/symcat.h dwarf2dbg.h \ + subsegs.h $(INCDIR)/obstack.h $(INCDIR)/elf/dwarf2.h +ecoff.o: ecoff.c $(INCDIR)/symcat.h ecoff.h +ehopt.o: ehopt.c $(INCDIR)/symcat.h subsegs.h $(INCDIR)/obstack.h \ $(INCDIR)/elf/dwarf2.h -ecoff.o: ecoff.c ecoff.h -ehopt.o: ehopt.c subsegs.h $(INCDIR)/obstack.h $(INCDIR)/elf/dwarf2.h -expr.o: expr.c $(INCDIR)/obstack.h -flonum-copy.o: flonum-copy.c +expr.o: expr.c $(INCDIR)/symcat.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/obstack.h +flonum-copy.o: flonum-copy.c $(INCDIR)/symcat.h flonum-konst.o: flonum-konst.c flonum-mult.o: flonum-mult.c -frags.o: frags.c subsegs.h $(INCDIR)/obstack.h -hash.o: hash.c $(INCDIR)/obstack.h -input-file.o: input-file.c input-file.h -input-scrub.o: input-scrub.c input-file.h sb.h -listing.o: listing.c input-file.h subsegs.h -literal.o: literal.c subsegs.h $(INCDIR)/obstack.h -macro.o: macro.c sb.h macro.h -messages.o: messages.c -output-file.o: output-file.c output-file.h -read.o: read.c subsegs.h $(INCDIR)/obstack.h sb.h macro.h \ - ecoff.h +frags.o: frags.c $(INCDIR)/symcat.h subsegs.h $(INCDIR)/obstack.h +hash.o: hash.c $(INCDIR)/symcat.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/obstack.h +input-file.o: input-file.c $(INCDIR)/symcat.h input-file.h +input-scrub.o: input-scrub.c $(INCDIR)/symcat.h input-file.h \ + sb.h +listing.o: listing.c $(INCDIR)/symcat.h $(INCDIR)/safe-ctype.h \ + input-file.h subsegs.h +literal.o: literal.c $(INCDIR)/symcat.h subsegs.h $(INCDIR)/obstack.h +macro.o: macro.c $(INCDIR)/safe-ctype.h sb.h macro.h +messages.o: messages.c $(INCDIR)/symcat.h +output-file.o: output-file.c $(INCDIR)/symcat.h output-file.h +read.o: read.c $(INCDIR)/symcat.h $(INCDIR)/safe-ctype.h \ + subsegs.h $(INCDIR)/obstack.h sb.h macro.h ecoff.h sb.o: sb.c sb.h -stabs.o: stabs.c $(INCDIR)/obstack.h subsegs.h ecoff.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def -subsegs.o: subsegs.c subsegs.h $(INCDIR)/obstack.h -symbols.o: symbols.c $(INCDIR)/obstack.h subsegs.h \ - struc-symbol.h -write.o: write.c subsegs.h $(INCDIR)/obstack.h output-file.h \ - dwarf2dbg.h -gasp.o: gasp.c sb.h macro.h -itbl-ops.o: itbl-ops.c itbl-ops.h -e-crisaout.o: $(srcdir)/config/e-crisaout.c emul-target.h -e-criself.o: $(srcdir)/config/e-criself.c emul-target.h -e-i386aout.o: $(srcdir)/config/e-i386aout.c emul-target.h -e-i386coff.o: $(srcdir)/config/e-i386coff.c emul-target.h -e-i386elf.o: $(srcdir)/config/e-i386elf.c emul-target.h -e-mipsecoff.o: $(srcdir)/config/e-mipsecoff.c emul-target.h -e-mipself.o: $(srcdir)/config/e-mipself.c emul-target.h +stabs.o: stabs.c $(INCDIR)/symcat.h $(INCDIR)/obstack.h \ + subsegs.h ecoff.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def +subsegs.o: subsegs.c $(INCDIR)/symcat.h subsegs.h $(INCDIR)/obstack.h +symbols.o: symbols.c $(INCDIR)/symcat.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/obstack.h subsegs.h struc-symbol.h +write.o: write.c $(INCDIR)/symcat.h subsegs.h $(INCDIR)/obstack.h \ + output-file.h dwarf2dbg.h +gasp.o: gasp.c $(INCDIR)/safe-ctype.h sb.h macro.h +itbl-ops.o: itbl-ops.c itbl-ops.h $(INCDIR)/symcat.h +e-crisaout.o: $(srcdir)/config/e-crisaout.c $(INCDIR)/symcat.h \ + emul-target.h +e-criself.o: $(srcdir)/config/e-criself.c $(INCDIR)/symcat.h \ + emul-target.h +e-i386aout.o: $(srcdir)/config/e-i386aout.c $(INCDIR)/symcat.h \ + emul-target.h +e-i386coff.o: $(srcdir)/config/e-i386coff.c $(INCDIR)/symcat.h \ + emul-target.h +e-i386elf.o: $(srcdir)/config/e-i386elf.c $(INCDIR)/symcat.h \ + emul-target.h +e-mipsecoff.o: $(srcdir)/config/e-mipsecoff.c $(INCDIR)/symcat.h \ + emul-target.h +e-mipself.o: $(srcdir)/config/e-mipself.c $(INCDIR)/symcat.h \ + emul-target.h $(OBJS): $(DEP_@target_cpu_type@_@obj_format@) $(TARG_CPU_O): $(DEPTC_@target_cpu_type@_@obj_format@) $(OBJ_FORMAT_O): $(DEPOBJ_@target_cpu_type@_@obj_format@) diff -uprN binutils-2.11.90.0.31/gas/Makefile.in binutils-2.11.92.0.5/gas/Makefile.in --- binutils-2.11.90.0.31/gas/Makefile.in Thu Jul 26 18:02:55 2001 +++ binutils-2.11.92.0.5/gas/Makefile.in Thu Oct 4 14:35:43 2001 @@ -640,491 +640,571 @@ DEP_FILE_DEPS = $(CFILES) $(HFILES) $(TA AMKDEP = #DO NOT PUT ANYTHING BETWEEN THIS LINE AND THE MATCHING WARNING BELOW. -DEPTC_a29k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-a29k.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/a29k.h +DEPTC_a29k_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-a29k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/a29k.h + +DEPTC_a29k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-a29k.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/a29k.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/a29k.h -DEPTC_a29k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-a29k.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/a29k.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/a29k.h - -DEPTC_a29k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-a29k.h $(INCDIR)/opcode/a29k.h - -DEPTC_alpha_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-alpha.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - subsegs.h $(INCDIR)/obstack.h struc-symbol.h ecoff.h \ - $(INCDIR)/opcode/alpha.h $(srcdir)/config/atof-vax.c +DEPTC_a29k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-a29k.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/a29k.h -DEPTC_alpha_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-alpha.h \ - ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \ - subsegs.h $(INCDIR)/obstack.h struc-symbol.h $(INCDIR)/opcode/alpha.h \ +DEPTC_alpha_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-alpha.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h ecoff.h $(INCDIR)/opcode/alpha.h $(INCDIR)/safe-ctype.h \ $(srcdir)/config/atof-vax.c -DEPTC_alpha_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-alpha.h subsegs.h \ - $(INCDIR)/obstack.h struc-symbol.h ecoff.h $(INCDIR)/coff/sym.h \ - $(INCDIR)/coff/ecoff.h $(INCDIR)/opcode/alpha.h $(INCDIR)/elf/alpha.h \ - $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h $(srcdir)/config/atof-vax.c +DEPTC_alpha_ecoff = $(INCDIR)/symcat.h $(srcdir)/config/obj-ecoff.h \ + $(srcdir)/config/tc-alpha.h ecoff.h $(INCDIR)/coff/sym.h \ + $(INCDIR)/coff/ecoff.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/opcode/alpha.h $(INCDIR)/safe-ctype.h \ + $(srcdir)/config/atof-vax.c -DEPTC_alpha_evax = $(srcdir)/config/obj-evax.h $(srcdir)/config/tc-alpha.h \ +DEPTC_alpha_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-alpha.h \ subsegs.h $(INCDIR)/obstack.h struc-symbol.h ecoff.h \ - $(INCDIR)/opcode/alpha.h $(srcdir)/config/atof-vax.c - -DEPTC_arc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arc.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - struc-symbol.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/arc.h \ - $(srcdir)/../opcodes/arc-ext.h $(INCDIR)/elf/arc.h \ - $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h + $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h $(INCDIR)/opcode/alpha.h \ + $(INCDIR)/elf/alpha.h $(INCDIR)/elf/reloc-macros.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h $(srcdir)/config/atof-vax.c -DEPTC_arc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arc.h struc-symbol.h \ - subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/arc.h \ - $(srcdir)/../opcodes/arc-ext.h $(INCDIR)/elf/arc.h \ - $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h +DEPTC_alpha_evax = $(INCDIR)/symcat.h $(srcdir)/config/obj-evax.h \ + $(srcdir)/config/tc-alpha.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h ecoff.h $(INCDIR)/opcode/alpha.h $(INCDIR)/safe-ctype.h \ + $(srcdir)/config/atof-vax.c -DEPTC_arm_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-arm.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h +DEPTC_arc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-arc.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h struc-symbol.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/arc.h $(srcdir)/../opcodes/arc-ext.h \ + $(INCDIR)/elf/arc.h $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h -DEPTC_arm_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arm.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h - -DEPTC_arm_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arm.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h \ - dwarf2dbg.h +DEPTC_arc_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arc.h \ + struc-symbol.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/arc.h $(srcdir)/../opcodes/arc-ext.h \ + $(INCDIR)/elf/arc.h $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h + +DEPTC_arm_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-arm.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h + +DEPTC_arm_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-arm.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h subsegs.h \ + $(INCDIR)/obstack.h -DEPTC_avr_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-avr.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ +DEPTC_arm_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arm.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h + +DEPTC_avr_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-avr.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/avr.h -DEPTC_avr_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-avr.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/avr.h - -DEPTC_cris_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-cris.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ +DEPTC_avr_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-avr.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/avr.h + +DEPTC_cris_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-cris.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ $(INCDIR)/opcode/cris.h dwarf2dbg.h -DEPTC_cris_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-cris.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/cris.h dwarf2dbg.h +DEPTC_cris_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-cris.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/cris.h dwarf2dbg.h -DEPTC_d10v_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-d10v.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ +DEPTC_d10v_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-d10v.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/d10v.h \ $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h -DEPTC_d10v_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d10v.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/d10v.h $(INCDIR)/elf/ppc.h \ - $(INCDIR)/elf/reloc-macros.h - -DEPTC_d30v_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-d30v.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ +DEPTC_d10v_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d10v.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/d10v.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h + +DEPTC_d30v_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-d30v.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/d30v.h -DEPTC_d30v_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d30v.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/d30v.h - -DEPTC_fr30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-fr30.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - subsegs.h $(INCDIR)/obstack.h $(INCDIR)/symcat.h $(srcdir)/../opcodes/fr30-desc.h \ - $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/fr30-opc.h \ - cgen.h - -DEPTC_fr30_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-fr30.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/symcat.h $(srcdir)/../opcodes/fr30-desc.h \ +DEPTC_d30v_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d30v.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/d30v.h + +DEPTC_fr30_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-fr30.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ + subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/fr30-desc.h \ $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/fr30-opc.h \ cgen.h -DEPTC_h8300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8300.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/h8300.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ - $(INCDIR)/opcode/h8300.h - -DEPTC_h8300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8300.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/h8300.h - -DEPTC_h8500_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8500.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/h8500.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ - $(srcdir)/../opcodes/h8500-opc.h +DEPTC_fr30_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-fr30.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(srcdir)/../opcodes/fr30-desc.h $(INCDIR)/opcode/cgen.h \ + $(srcdir)/../opcodes/fr30-opc.h cgen.h + +DEPTC_h8300_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-h8300.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/h8300.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/h8300.h \ + $(INCDIR)/safe-ctype.h -DEPTC_h8500_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8500.h subsegs.h \ - $(INCDIR)/obstack.h $(srcdir)/../opcodes/h8500-opc.h +DEPTC_h8300_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8300.h \ + subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/h8300.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/elf/h8.h $(INCDIR)/elf/reloc-macros.h + +DEPTC_h8500_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-h8500.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/h8500.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/h8500-opc.h \ + $(INCDIR)/safe-ctype.h -DEPTC_hppa_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-hppa.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ +DEPTC_h8500_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8500.h \ + subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/h8500-opc.h \ + $(INCDIR)/safe-ctype.h + +DEPTC_hppa_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-hppa.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ subsegs.h $(INCDIR)/obstack.h $(BFDDIR)/libhppa.h $(INCDIR)/opcode/hppa.h -DEPTC_hppa_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-hppa.h $(BFDDIR)/elf32-hppa.h \ - $(BFDDIR)/libhppa.h $(INCDIR)/elf/hppa.h $(INCDIR)/elf/reloc-macros.h \ +DEPTC_hppa_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-hppa.h \ + $(BFDDIR)/elf32-hppa.h $(BFDDIR)/libhppa.h $(INCDIR)/elf/hppa.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/safe-ctype.h \ subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/hppa.h \ dwarf2dbg.h -DEPTC_ia64_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ia64.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ +DEPTC_ia64_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-ia64.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ dwarf2dbg.h subsegs.h $(INCDIR)/obstack.h -DEPTC_ia64_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ia64.h dwarf2dbg.h \ - subsegs.h $(INCDIR)/obstack.h +DEPTC_ia64_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ia64.h \ + $(INCDIR)/safe-ctype.h dwarf2dbg.h subsegs.h $(INCDIR)/obstack.h -DEPTC_i370_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i370.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ +DEPTC_i370_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-i370.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ subsegs.h $(INCDIR)/obstack.h struc-symbol.h $(INCDIR)/opcode/i370.h -DEPTC_i370_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i370.h subsegs.h \ - $(INCDIR)/obstack.h struc-symbol.h $(INCDIR)/opcode/i370.h \ - $(INCDIR)/elf/i370.h - -DEPTC_i386_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-i386.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ - dwarf2dbg.h $(INCDIR)/opcode/i386.h - -DEPTC_i386_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i386.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ +DEPTC_i370_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i370.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/opcode/i370.h $(INCDIR)/elf/i370.h + +DEPTC_i386_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-i386.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ dwarf2dbg.h $(INCDIR)/opcode/i386.h -DEPTC_i386_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i386.h subsegs.h \ +DEPTC_i386_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-i386.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h subsegs.h \ $(INCDIR)/obstack.h dwarf2dbg.h $(INCDIR)/opcode/i386.h -DEPTC_i860_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i860.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/i860.h $(INCDIR)/elf/i860.h \ - $(INCDIR)/elf/reloc-macros.h +DEPTC_i386_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i386.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + dwarf2dbg.h $(INCDIR)/opcode/i386.h -DEPTC_i960_bout = $(srcdir)/config/obj-bout.h $(srcdir)/config/tc-i960.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/i960.h +DEPTC_i860_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i860.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/i860.h $(INCDIR)/elf/i860.h $(INCDIR)/elf/reloc-macros.h -DEPTC_i960_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i960.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/i960.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h $(INCDIR)/opcode/i960.h - -DEPTC_i960_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i960.h $(INCDIR)/obstack.h \ +DEPTC_i960_bout = $(INCDIR)/symcat.h $(srcdir)/config/obj-bout.h \ + $(srcdir)/config/tc-i960.h $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h \ $(INCDIR)/opcode/i960.h -DEPTC_m32r_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m32r.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - subsegs.h $(INCDIR)/obstack.h $(INCDIR)/symcat.h $(srcdir)/../opcodes/m32r-desc.h \ - $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/m32r-opc.h \ - cgen.h +DEPTC_i960_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-i960.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/i960.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h $(INCDIR)/opcode/i960.h + +DEPTC_i960_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i960.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h $(INCDIR)/opcode/i960.h -DEPTC_m32r_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32r.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/symcat.h $(srcdir)/../opcodes/m32r-desc.h \ +DEPTC_m32r_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-m32r.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ + subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/m32r-desc.h \ $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/m32r-opc.h \ cgen.h -DEPTC_m68hc11_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m68hc11.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ - $(INCDIR)/opcode/m68hc11.h dwarf2dbg.h - -DEPTC_m68hc11_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68hc11.h subsegs.h \ +DEPTC_m32r_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32r.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(srcdir)/../opcodes/m32r-desc.h $(INCDIR)/opcode/cgen.h \ + $(srcdir)/../opcodes/m32r-opc.h cgen.h + +DEPTC_m68hc11_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-m68hc11.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h subsegs.h \ $(INCDIR)/obstack.h $(INCDIR)/opcode/m68hc11.h dwarf2dbg.h -DEPTC_m68k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ - subsegs.h dwarf2dbg.h $(INCDIR)/opcode/m68k.h $(srcdir)/config/m68k-parse.h +DEPTC_m68hc11_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68hc11.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/m68hc11.h dwarf2dbg.h -DEPTC_m68k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m68k.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ +DEPTC_m68k_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-m68k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h subsegs.h \ + dwarf2dbg.h $(INCDIR)/opcode/m68k.h $(srcdir)/config/m68k-parse.h + +DEPTC_m68k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-m68k.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h \ subsegs.h dwarf2dbg.h $(INCDIR)/opcode/m68k.h $(srcdir)/config/m68k-parse.h -DEPTC_m68k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68k.h $(INCDIR)/obstack.h \ - subsegs.h dwarf2dbg.h $(INCDIR)/opcode/m68k.h $(srcdir)/config/m68k-parse.h \ +DEPTC_m68k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68k.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h subsegs.h \ + dwarf2dbg.h $(INCDIR)/opcode/m68k.h $(srcdir)/config/m68k-parse.h \ $(INCDIR)/elf/m68k.h $(INCDIR)/elf/reloc-macros.h -DEPTC_m68k_hp300 = $(srcdir)/config/obj-hp300.h $(srcdir)/config/obj-aout.h \ - $(srcdir)/config/tc-m68k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ +DEPTC_m68k_hp300 = $(INCDIR)/symcat.h $(srcdir)/config/obj-hp300.h \ + $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \ + $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ $(INCDIR)/obstack.h subsegs.h dwarf2dbg.h $(INCDIR)/opcode/m68k.h \ $(srcdir)/config/m68k-parse.h -DEPTC_m88k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m88k.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/m88k.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ - $(srcdir)/config/m88k-opcode.h - -DEPTC_m88k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m88k.h subsegs.h \ +DEPTC_m88k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-m88k.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/m88k.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h subsegs.h \ $(INCDIR)/obstack.h $(srcdir)/config/m88k-opcode.h -DEPTC_mcore_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mcore.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/mcore.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ - $(srcdir)/../opcodes/mcore-opc.h +DEPTC_m88k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m88k.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(srcdir)/config/m88k-opcode.h -DEPTC_mcore_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mcore.h subsegs.h \ - $(INCDIR)/obstack.h $(srcdir)/../opcodes/mcore-opc.h \ - $(INCDIR)/elf/mcore.h $(INCDIR)/elf/reloc-macros.h +DEPTC_mcore_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-mcore.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/mcore.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/mcore-opc.h \ + $(INCDIR)/safe-ctype.h -DEPTC_mips_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-mips.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ +DEPTC_mcore_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mcore.h \ + subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/mcore-opc.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/elf/mcore.h $(INCDIR)/elf/reloc-macros.h + +DEPTC_mips_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-mips.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + subsegs.h $(INCDIR)/obstack.h $(INCDIR)/safe-ctype.h \ $(INCDIR)/opcode/mips.h itbl-ops.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h \ ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h -DEPTC_mips_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mips.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ +DEPTC_mips_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-mips.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/safe-ctype.h \ $(INCDIR)/opcode/mips.h itbl-ops.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h \ ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h -DEPTC_mips_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-mips.h \ - ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \ - subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/mips.h \ - itbl-ops.h $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h - -DEPTC_mips_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mips.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/mips.h itbl-ops.h \ - $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h ecoff.h \ - $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h +DEPTC_mips_ecoff = $(INCDIR)/symcat.h $(srcdir)/config/obj-ecoff.h \ + $(srcdir)/config/tc-mips.h ecoff.h $(INCDIR)/coff/sym.h \ + $(INCDIR)/coff/ecoff.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/mips.h itbl-ops.h \ + $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h -DEPTC_mn10200_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10200.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ +DEPTC_mips_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mips.h \ + subsegs.h $(INCDIR)/obstack.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/opcode/mips.h itbl-ops.h $(INCDIR)/elf/mips.h \ + $(INCDIR)/elf/reloc-macros.h ecoff.h $(INCDIR)/coff/sym.h \ + $(INCDIR)/coff/ecoff.h + +DEPTC_mn10200_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-mn10200.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/mn10200.h -DEPTC_mn10200_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10200.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/mn10200.h - -DEPTC_mn10300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10300.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ +DEPTC_mn10200_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10200.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/mn10200.h + +DEPTC_mn10300_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-mn10300.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/mn10300.h \ dwarf2dbg.h -DEPTC_mn10300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10300.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/mn10300.h dwarf2dbg.h - -DEPTC_ns32k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-ns32k.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ns32k.h \ - $(INCDIR)/obstack.h +DEPTC_mn10300_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10300.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/mn10300.h dwarf2dbg.h -DEPTC_ns32k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ns32k.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ +DEPTC_ns32k_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-ns32k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ $(INCDIR)/opcode/ns32k.h $(INCDIR)/obstack.h -DEPTC_ns32k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h $(INCDIR)/opcode/ns32k.h \ +DEPTC_ns32k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-ns32k.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ns32k.h \ $(INCDIR)/obstack.h -DEPTC_openrisc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-openrisc.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - subsegs.h $(INCDIR)/obstack.h $(INCDIR)/symcat.h $(srcdir)/../opcodes/openrisc-desc.h \ - $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/openrisc-opc.h \ - cgen.h +DEPTC_ns32k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h \ + $(INCDIR)/opcode/ns32k.h $(INCDIR)/obstack.h -DEPTC_openrisc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-openrisc.h \ - subsegs.h $(INCDIR)/obstack.h $(INCDIR)/symcat.h $(srcdir)/../opcodes/openrisc-desc.h \ +DEPTC_openrisc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-openrisc.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ + $(srcdir)/../opcodes/openrisc-desc.h $(INCDIR)/opcode/cgen.h \ + $(srcdir)/../opcodes/openrisc-opc.h cgen.h + +DEPTC_openrisc_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-openrisc.h \ + subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/openrisc-desc.h \ $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/openrisc-opc.h \ cgen.h -DEPTC_pdp11_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-pdp11.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/pdp11.h - -DEPTC_pdp11_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-pdp11.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ +DEPTC_pdp11_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-pdp11.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/pdp11.h + +DEPTC_pdp11_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-pdp11.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ $(INCDIR)/opcode/pdp11.h -DEPTC_pdp11_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pdp11.h $(INCDIR)/opcode/pdp11.h +DEPTC_pdp11_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pdp11.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/pdp11.h -DEPTC_pj_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-pj.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ +DEPTC_pj_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-pj.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ $(INCDIR)/opcode/pj.h -DEPTC_pj_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pj.h $(INCDIR)/opcode/pj.h - -DEPTC_ppc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ppc.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/rs6000.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/ppc.h - -DEPTC_ppc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ppc.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/ppc.h $(INCDIR)/elf/ppc.h \ - $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h +DEPTC_pj_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pj.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/pj.h -DEPTC_s390_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-s390.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - subsegs.h $(INCDIR)/obstack.h struc-symbol.h $(INCDIR)/opcode/s390.h \ - $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h +DEPTC_ppc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-ppc.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/rs6000.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/ppc.h + +DEPTC_ppc_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ppc.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/ppc.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \ + dwarf2dbg.h -DEPTC_s390_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-s390.h subsegs.h \ - $(INCDIR)/obstack.h struc-symbol.h $(INCDIR)/opcode/s390.h \ +DEPTC_s390_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-s390.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ + subsegs.h $(INCDIR)/obstack.h struc-symbol.h $(INCDIR)/opcode/s390.h \ $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h -DEPTC_sh_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sh.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/sh.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ - $(srcdir)/../opcodes/sh-opc.h struc-symbol.h dwarf2dbg.h +DEPTC_s390_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-s390.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/opcode/s390.h $(INCDIR)/elf/s390.h \ + $(INCDIR)/elf/reloc-macros.h -DEPTC_sh_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh.h subsegs.h \ - $(INCDIR)/obstack.h $(srcdir)/../opcodes/sh-opc.h struc-symbol.h \ - $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h +DEPTC_sh_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-sh.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/sh.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/sh-opc.h \ + $(INCDIR)/safe-ctype.h struc-symbol.h dwarf2dbg.h -DEPTC_sparc_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-sparc.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ - $(INCDIR)/opcode/sparc.h +DEPTC_sh_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh.h \ + subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/sh-opc.h \ + $(INCDIR)/safe-ctype.h struc-symbol.h $(INCDIR)/elf/sh.h \ + $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h -DEPTC_sparc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sparc.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/sparc.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ +DEPTC_sparc_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-sparc.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ $(INCDIR)/opcode/sparc.h -DEPTC_sparc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sparc.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/sparc.h $(INCDIR)/elf/sparc.h \ - $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h +DEPTC_sparc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-sparc.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/sparc.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/opcode/sparc.h -DEPTC_tahoe_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tahoe.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ - $(INCDIR)/opcode/tahoe.h +DEPTC_sparc_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sparc.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/sparc.h $(INCDIR)/elf/sparc.h $(INCDIR)/elf/reloc-macros.h \ + dwarf2dbg.h -DEPTC_tahoe_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tahoe.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ +DEPTC_tahoe_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-tahoe.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h $(INCDIR)/opcode/tahoe.h + +DEPTC_tahoe_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-tahoe.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ $(INCDIR)/obstack.h $(INCDIR)/opcode/tahoe.h -DEPTC_tahoe_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tahoe.h $(INCDIR)/obstack.h \ - $(INCDIR)/opcode/tahoe.h - -DEPTC_tic30_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tic30.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/tic30.h - -DEPTC_tic30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic30.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic30.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/tic30.h - -DEPTC_tic30_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic30.h $(INCDIR)/opcode/tic30.h +DEPTC_tahoe_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tahoe.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h $(INCDIR)/opcode/tahoe.h -DEPTC_tic54x_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic54x.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h sb.h macro.h \ +DEPTC_tic30_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-tic30.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/tic30.h + +DEPTC_tic30_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-tic30.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/tic30.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/tic30.h + +DEPTC_tic30_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic30.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/tic30.h + +DEPTC_tic54x_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-tic54x.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h sb.h macro.h \ subsegs.h $(INCDIR)/obstack.h struc-symbol.h $(INCDIR)/opcode/tic54x.h -DEPTC_tic54x_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic54x.h sb.h \ - macro.h subsegs.h $(INCDIR)/obstack.h struc-symbol.h \ - $(INCDIR)/opcode/tic54x.h $(srcdir)/config/obj-coff.h \ +DEPTC_tic54x_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic54x.h \ + $(INCDIR)/safe-ctype.h sb.h macro.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/opcode/tic54x.h $(srcdir)/config/obj-coff.h \ $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h \ $(BFDDIR)/libcoff.h -DEPTC_tic80_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic80.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic80.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/tic80.h - -DEPTC_tic80_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic80.h $(INCDIR)/opcode/tic80.h - -DEPTC_vax_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-vax.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(srcdir)/config/vax-inst.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/vax.h - -DEPTC_vax_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-vax.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(srcdir)/config/vax-inst.h $(INCDIR)/obstack.h $(INCDIR)/opcode/vax.h - -DEPTC_vax_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-vax.h $(srcdir)/config/vax-inst.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/vax.h - -DEPTC_vax_vms = $(srcdir)/config/obj-vms.h $(srcdir)/config/tc-vax.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(srcdir)/config/vax-inst.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/vax.h +DEPTC_tic80_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-tic80.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/tic80.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/tic80.h -DEPTC_w65_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-w65.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/w65.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ - $(srcdir)/../opcodes/w65-opc.h +DEPTC_tic80_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic80.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/tic80.h + +DEPTC_vax_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-vax.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(srcdir)/config/vax-inst.h $(INCDIR)/obstack.h $(INCDIR)/opcode/vax.h \ + $(INCDIR)/safe-ctype.h + +DEPTC_vax_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-vax.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(srcdir)/config/vax-inst.h \ + $(INCDIR)/obstack.h $(INCDIR)/opcode/vax.h $(INCDIR)/safe-ctype.h -DEPTC_w65_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-w65.h subsegs.h \ - $(INCDIR)/obstack.h $(srcdir)/../opcodes/w65-opc.h +DEPTC_vax_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-vax.h \ + $(srcdir)/config/vax-inst.h $(INCDIR)/obstack.h $(INCDIR)/opcode/vax.h \ + $(INCDIR)/safe-ctype.h + +DEPTC_vax_vms = $(INCDIR)/symcat.h $(srcdir)/config/obj-vms.h \ + $(srcdir)/config/tc-vax.h $(INCDIR)/aout/stab_gnu.h \ + $(INCDIR)/aout/stab.def $(srcdir)/config/vax-inst.h \ + $(INCDIR)/obstack.h $(INCDIR)/opcode/vax.h $(INCDIR)/safe-ctype.h + +DEPTC_w65_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-w65.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/w65.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/w65-opc.h -DEPTC_v850_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-v850.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ +DEPTC_w65_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-w65.h \ + subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/w65-opc.h + +DEPTC_v850_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-v850.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/v850.h \ dwarf2dbg.h -DEPTC_v850_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/v850.h dwarf2dbg.h +DEPTC_v850_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/v850.h dwarf2dbg.h -DEPTC_z8k_coff = $(srcdir)/../opcodes/z8k-opc.h $(srcdir)/config/obj-coff.h \ - $(srcdir)/config/tc-z8k.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/z8k.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h +DEPTC_z8k_coff = $(srcdir)/../opcodes/z8k-opc.h $(INCDIR)/symcat.h \ + $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-z8k.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/z8k.h $(INCDIR)/coff/external.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h -DEPTC_z8k_elf = $(srcdir)/../opcodes/z8k-opc.h $(srcdir)/config/obj-elf.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-z8k.h +DEPTC_z8k_elf = $(srcdir)/../opcodes/z8k-opc.h $(INCDIR)/symcat.h \ + $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + $(srcdir)/config/tc-z8k.h $(INCDIR)/safe-ctype.h DEPTC_hppa_som = $(srcdir)/config/tc-hppa.h subsegs.h \ $(INCDIR)/obstack.h $(BFDDIR)/libhppa.h $(INCDIR)/opcode/hppa.h \ @@ -1137,459 +1217,524 @@ DEPTC_mips_multi = $(DEPTC_mips_coff) $( $(DEPTC_mips_elf) DEPTC_cris_multi = $(DEPTC_cris_aout) $(DEPTC_cris_elf) -DEPOBJ_a29k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-a29k.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/obstack.h +DEPOBJ_a29k_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-a29k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h + +DEPOBJ_a29k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-a29k.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/a29k.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h -DEPOBJ_a29k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-a29k.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/a29k.h $(INCDIR)/coff/external.h \ +DEPOBJ_a29k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-a29k.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h + +DEPOBJ_alpha_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-alpha.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ subsegs.h -DEPOBJ_a29k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-a29k.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h - -DEPOBJ_alpha_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-alpha.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/obstack.h subsegs.h +DEPOBJ_alpha_ecoff = $(INCDIR)/symcat.h $(srcdir)/config/obj-ecoff.h \ + $(srcdir)/config/tc-alpha.h ecoff.h $(INCDIR)/coff/sym.h \ + $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(BFDDIR)/libecoff.h -DEPOBJ_alpha_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-alpha.h \ +DEPOBJ_alpha_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-alpha.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(BFDDIR)/libecoff.h - -DEPOBJ_alpha_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-alpha.h subsegs.h \ - $(INCDIR)/obstack.h ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \ $(INCDIR)/elf/alpha.h $(INCDIR)/elf/reloc-macros.h \ $(INCDIR)/aout/aout64.h -DEPOBJ_alpha_evax = $(srcdir)/config/obj-evax.h $(srcdir)/config/tc-alpha.h -DEPOBJ_arc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arc.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - struc-symbol.h $(INCDIR)/obstack.h subsegs.h - -DEPOBJ_arc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arc.h struc-symbol.h \ - subsegs.h $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h - -DEPOBJ_arm_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-arm.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/obstack.h - -DEPOBJ_arm_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arm.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ - subsegs.h - -DEPOBJ_arm_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arm.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +DEPOBJ_alpha_evax = $(INCDIR)/symcat.h $(srcdir)/config/obj-evax.h \ + $(srcdir)/config/tc-alpha.h -DEPOBJ_avr_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-avr.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ +DEPOBJ_arc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-arc.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h struc-symbol.h \ $(INCDIR)/obstack.h subsegs.h -DEPOBJ_avr_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-avr.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +DEPOBJ_arc_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arc.h \ + struc-symbol.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h -DEPOBJ_cris_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-cris.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/obstack.h +DEPOBJ_arm_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-arm.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h -DEPOBJ_cris_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-cris.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +DEPOBJ_arm_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-arm.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h -DEPOBJ_d10v_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-d10v.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/obstack.h subsegs.h +DEPOBJ_arm_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arm.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h + +DEPOBJ_avr_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-avr.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ + subsegs.h -DEPOBJ_d10v_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d10v.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +DEPOBJ_avr_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-avr.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h -DEPOBJ_d30v_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-d30v.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/obstack.h subsegs.h +DEPOBJ_cris_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-cris.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h -DEPOBJ_d30v_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d30v.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +DEPOBJ_cris_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-cris.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h -DEPOBJ_fr30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-fr30.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/obstack.h subsegs.h +DEPOBJ_d10v_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-d10v.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ + subsegs.h -DEPOBJ_fr30_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-fr30.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +DEPOBJ_d10v_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d10v.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h -DEPOBJ_h8300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8300.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/h8300.h $(INCDIR)/coff/external.h \ +DEPOBJ_d30v_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-d30v.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ subsegs.h -DEPOBJ_h8300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8300.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +DEPOBJ_d30v_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d30v.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h -DEPOBJ_h8500_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8500.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/h8500.h $(INCDIR)/coff/external.h \ +DEPOBJ_fr30_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-fr30.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ subsegs.h -DEPOBJ_h8500_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8500.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +DEPOBJ_fr30_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-fr30.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h -DEPOBJ_hppa_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-hppa.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/obstack.h subsegs.h +DEPOBJ_h8300_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-h8300.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/h8300.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h -DEPOBJ_hppa_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-hppa.h $(BFDDIR)/elf32-hppa.h \ - $(BFDDIR)/libhppa.h $(INCDIR)/elf/hppa.h $(INCDIR)/elf/reloc-macros.h \ - subsegs.h $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +DEPOBJ_h8300_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8300.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h -DEPOBJ_ia64_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ia64.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/obstack.h subsegs.h +DEPOBJ_h8500_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-h8500.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/h8500.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h -DEPOBJ_ia64_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ia64.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +DEPOBJ_h8500_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8500.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h -DEPOBJ_i370_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i370.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/obstack.h subsegs.h +DEPOBJ_hppa_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-hppa.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ + subsegs.h -DEPOBJ_i370_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i370.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/elf/i370.h $(INCDIR)/aout/aout64.h +DEPOBJ_hppa_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-hppa.h \ + $(BFDDIR)/elf32-hppa.h $(BFDDIR)/libhppa.h $(INCDIR)/elf/hppa.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/safe-ctype.h \ + subsegs.h $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h -DEPOBJ_i386_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-i386.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/obstack.h +DEPOBJ_ia64_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-ia64.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ + subsegs.h -DEPOBJ_i386_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i386.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \ +DEPOBJ_ia64_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ia64.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h + +DEPOBJ_i370_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-i370.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ subsegs.h -DEPOBJ_i386_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i386.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h - -DEPOBJ_i860_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i860.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +DEPOBJ_i370_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i370.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/elf/i370.h $(INCDIR)/aout/aout64.h -DEPOBJ_i960_bout = $(srcdir)/config/obj-bout.h $(srcdir)/config/tc-i960.h \ - $(INCDIR)/obstack.h +DEPOBJ_i386_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-i386.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h -DEPOBJ_i960_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i960.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/i960.h $(BFDDIR)/libcoff.h \ +DEPOBJ_i386_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-i386.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h -DEPOBJ_i960_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i960.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +DEPOBJ_i386_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i386.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h + +DEPOBJ_i860_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i860.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h -DEPOBJ_m32r_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m32r.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ +DEPOBJ_i960_bout = $(INCDIR)/symcat.h $(srcdir)/config/obj-bout.h \ + $(srcdir)/config/tc-i960.h $(INCDIR)/obstack.h + +DEPOBJ_i960_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-i960.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/i960.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ $(INCDIR)/obstack.h subsegs.h -DEPOBJ_m32r_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32r.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +DEPOBJ_i960_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i960.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h -DEPOBJ_m68hc11_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m68hc11.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h \ +DEPOBJ_m32r_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-m32r.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ subsegs.h -DEPOBJ_m68hc11_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68hc11.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +DEPOBJ_m32r_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32r.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h + +DEPOBJ_m68hc11_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-m68hc11.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h + +DEPOBJ_m68hc11_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68hc11.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h -DEPOBJ_m68k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \ +DEPOBJ_m68k_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-m68k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h + +DEPOBJ_m68k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-m68k.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h + +DEPOBJ_m68k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68k.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h + +DEPOBJ_m68k_hp300 = $(srcdir)/config/obj-aout.c $(INCDIR)/symcat.h \ + $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ $(INCDIR)/obstack.h -DEPOBJ_m68k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m68k.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ - subsegs.h +DEPOBJ_m88k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-m88k.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/m88k.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h + +DEPOBJ_m88k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m88k.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h -DEPOBJ_m68k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68k.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +DEPOBJ_mcore_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-mcore.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/mcore.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h -DEPOBJ_m68k_hp300 = $(srcdir)/config/obj-aout.c $(srcdir)/config/obj-aout.h \ - $(srcdir)/config/tc-m68k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ +DEPOBJ_mcore_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mcore.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h + +DEPOBJ_mips_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-mips.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h -DEPOBJ_m88k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m88k.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/m88k.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ - subsegs.h +DEPOBJ_mips_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-mips.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h -DEPOBJ_m88k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m88k.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +DEPOBJ_mips_ecoff = $(INCDIR)/symcat.h $(srcdir)/config/obj-ecoff.h \ + $(srcdir)/config/tc-mips.h ecoff.h $(INCDIR)/coff/sym.h \ + $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(BFDDIR)/libecoff.h -DEPOBJ_mcore_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mcore.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/mcore.h $(INCDIR)/coff/external.h \ +DEPOBJ_mips_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mips.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \ + $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/aout/aout64.h + +DEPOBJ_mn10200_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-mn10200.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ subsegs.h -DEPOBJ_mcore_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mcore.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h - -DEPOBJ_mips_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-mips.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/obstack.h +DEPOBJ_mn10200_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10200.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h -DEPOBJ_mips_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mips.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/external.h \ +DEPOBJ_mn10300_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-mn10300.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ subsegs.h -DEPOBJ_mips_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-mips.h \ - ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(BFDDIR)/libecoff.h +DEPOBJ_mn10300_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10300.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h -DEPOBJ_mips_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mips.h subsegs.h \ - $(INCDIR)/obstack.h ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h \ - $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/aout/aout64.h +DEPOBJ_ns32k_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-ns32k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h -DEPOBJ_mn10200_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10200.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/obstack.h subsegs.h +DEPOBJ_ns32k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-ns32k.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ + subsegs.h -DEPOBJ_mn10200_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10200.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +DEPOBJ_ns32k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h -DEPOBJ_mn10300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10300.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/obstack.h subsegs.h +DEPOBJ_openrisc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-openrisc.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ + subsegs.h -DEPOBJ_mn10300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10300.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +DEPOBJ_openrisc_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-openrisc.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h -DEPOBJ_ns32k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-ns32k.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/obstack.h +DEPOBJ_pdp11_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-pdp11.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h -DEPOBJ_ns32k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ns32k.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/obstack.h subsegs.h +DEPOBJ_pdp11_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-pdp11.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ + subsegs.h -DEPOBJ_ns32k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +DEPOBJ_pdp11_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pdp11.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h -DEPOBJ_openrisc_coff = $(srcdir)/config/obj-coff.h \ - $(srcdir)/config/tc-openrisc.h $(INCDIR)/coff/internal.h \ +DEPOBJ_pj_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-pj.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ subsegs.h -DEPOBJ_openrisc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-openrisc.h \ - subsegs.h $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h - -DEPOBJ_pdp11_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-pdp11.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/obstack.h +DEPOBJ_pj_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pj.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h -DEPOBJ_pdp11_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-pdp11.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ +DEPOBJ_ppc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-ppc.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/rs6000.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ $(INCDIR)/obstack.h subsegs.h -DEPOBJ_pdp11_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pdp11.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +DEPOBJ_ppc_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ppc.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/aout/aout64.h -DEPOBJ_pj_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-pj.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/obstack.h subsegs.h +DEPOBJ_s390_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-s390.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ + subsegs.h -DEPOBJ_pj_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pj.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +DEPOBJ_s390_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-s390.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h -DEPOBJ_ppc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ppc.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/rs6000.h $(BFDDIR)/libcoff.h \ +DEPOBJ_sh_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-sh.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/sh.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h -DEPOBJ_ppc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ppc.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \ +DEPOBJ_sh_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ $(INCDIR)/aout/aout64.h -DEPOBJ_s390_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-s390.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/obstack.h subsegs.h - -DEPOBJ_s390_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-s390.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +DEPOBJ_sparc_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-sparc.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h -DEPOBJ_sh_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sh.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/sh.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ - subsegs.h +DEPOBJ_sparc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-sparc.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/sparc.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h -DEPOBJ_sh_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +DEPOBJ_sparc_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sparc.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h -DEPOBJ_sparc_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-sparc.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/obstack.h +DEPOBJ_tahoe_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-tahoe.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h -DEPOBJ_sparc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sparc.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/sparc.h $(INCDIR)/coff/external.h \ +DEPOBJ_tahoe_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-tahoe.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ subsegs.h -DEPOBJ_sparc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sparc.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +DEPOBJ_tahoe_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tahoe.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h -DEPOBJ_tahoe_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tahoe.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/obstack.h +DEPOBJ_tic30_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-tic30.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h -DEPOBJ_tahoe_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tahoe.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/obstack.h subsegs.h +DEPOBJ_tic30_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-tic30.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/tic30.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h -DEPOBJ_tahoe_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tahoe.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +DEPOBJ_tic30_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic30.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h -DEPOBJ_tic30_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tic30.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/obstack.h +DEPOBJ_tic54x_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-tic54x.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h -DEPOBJ_tic30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic30.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic30.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ - subsegs.h +DEPOBJ_tic54x_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic54x.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h -DEPOBJ_tic30_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic30.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +DEPOBJ_tic80_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-tic80.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/tic80.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h -DEPOBJ_tic54x_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic54x.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ - subsegs.h +DEPOBJ_tic80_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic80.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h -DEPOBJ_tic54x_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic54x.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +DEPOBJ_vax_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ + $(srcdir)/config/tc-vax.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h -DEPOBJ_tic80_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic80.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic80.h $(INCDIR)/coff/external.h \ +DEPOBJ_vax_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-vax.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ subsegs.h -DEPOBJ_tic80_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic80.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +DEPOBJ_vax_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-vax.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h -DEPOBJ_vax_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-vax.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ +DEPOBJ_vax_vms = $(INCDIR)/symcat.h $(srcdir)/config/obj-vms.h \ + $(srcdir)/config/tc-vax.h $(INCDIR)/aout/stab_gnu.h \ + $(INCDIR)/aout/stab.def $(INCDIR)/safe-ctype.h subsegs.h \ $(INCDIR)/obstack.h -DEPOBJ_vax_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-vax.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/obstack.h subsegs.h - -DEPOBJ_vax_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-vax.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +DEPOBJ_w65_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-w65.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/w65.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h -DEPOBJ_vax_vms = $(srcdir)/config/obj-vms.h $(srcdir)/config/tc-vax.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def subsegs.h \ - $(INCDIR)/obstack.h +DEPOBJ_w65_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-w65.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h -DEPOBJ_w65_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-w65.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/w65.h $(INCDIR)/coff/external.h \ +DEPOBJ_v850_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-v850.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ subsegs.h -DEPOBJ_w65_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-w65.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h - -DEPOBJ_v850_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-v850.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/obstack.h subsegs.h - -DEPOBJ_v850_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +DEPOBJ_v850_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h -DEPOBJ_z8k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-z8k.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/z8k.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ - subsegs.h +DEPOBJ_z8k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-z8k.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/z8k.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h -DEPOBJ_z8k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-z8k.h subsegs.h \ - $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h +DEPOBJ_z8k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-z8k.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/aout/aout64.h DEPOBJ_hppa_som = $(srcdir)/config/obj-som.h subsegs.h \ $(INCDIR)/obstack.h $(BFDDIR)/libhppa.h $(BFDDIR)/som.h \ @@ -1606,352 +1751,372 @@ DEP_a29k_aout = $(srcdir)/config/obj-aou $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h DEP_a29k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-a29k.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/a29k.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/a29k.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_a29k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-a29k.h +DEP_a29k_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-a29k.h DEP_alpha_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-alpha.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h DEP_alpha_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-alpha.h \ ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h -DEP_alpha_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-alpha.h +DEP_alpha_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-alpha.h DEP_alpha_evax = $(srcdir)/config/obj-evax.h $(srcdir)/config/tc-alpha.h DEP_arc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arc.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h -DEP_arc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arc.h +DEP_arc_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arc.h DEP_arm_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-arm.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h DEP_arm_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arm.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/arm.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_arm_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arm.h +DEP_arm_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arm.h DEP_avr_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-avr.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h -DEP_avr_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-avr.h +DEP_avr_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-avr.h DEP_cris_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-cris.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h -DEP_cris_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-cris.h +DEP_cris_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-cris.h DEP_d10v_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-d10v.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h -DEP_d10v_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d10v.h +DEP_d10v_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d10v.h DEP_d30v_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-d30v.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h -DEP_d30v_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d30v.h +DEP_d30v_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-d30v.h DEP_fr30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-fr30.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h -DEP_fr30_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-fr30.h +DEP_fr30_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-fr30.h DEP_h8300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8300.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/h8300.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/h8300.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_h8300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8300.h +DEP_h8300_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8300.h DEP_h8500_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8500.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/h8500.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/h8500.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_h8500_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8500.h +DEP_h8500_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8500.h DEP_hppa_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-hppa.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h -DEP_hppa_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-hppa.h $(BFDDIR)/elf32-hppa.h \ - $(BFDDIR)/libhppa.h $(INCDIR)/elf/hppa.h $(INCDIR)/elf/reloc-macros.h +DEP_hppa_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-hppa.h \ + $(BFDDIR)/elf32-hppa.h $(BFDDIR)/libhppa.h $(INCDIR)/elf/hppa.h \ + $(INCDIR)/elf/reloc-macros.h DEP_ia64_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ia64.h \ $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_ia64_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ia64.h +DEP_ia64_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ia64.h DEP_i370_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i370.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h -DEP_i370_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i370.h +DEP_i370_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i370.h DEP_i386_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-i386.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h DEP_i386_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i386.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/i386.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_i386_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i386.h - -DEP_i860_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i860.h +DEP_i386_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i386.h + +DEP_i860_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i860.h DEP_i960_bout = $(srcdir)/config/obj-bout.h $(srcdir)/config/tc-i960.h DEP_i960_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i960.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/i960.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/i960.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_i960_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i960.h +DEP_i960_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i960.h DEP_m32r_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m32r.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h -DEP_m32r_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32r.h +DEP_m32r_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32r.h DEP_m68hc11_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m68hc11.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_m68hc11_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68hc11.h +DEP_m68hc11_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68hc11.h DEP_m68k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h DEP_m68k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m68k.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_m68k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68k.h +DEP_m68k_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68k.h DEP_m68k_hp300 = $(srcdir)/config/obj-hp300.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-m68k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h DEP_m88k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m88k.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/m88k.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/m88k.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_m88k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m88k.h +DEP_m88k_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m88k.h DEP_mcore_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mcore.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/mcore.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/mcore.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_mcore_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mcore.h +DEP_mcore_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mcore.h DEP_mips_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-mips.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h DEP_mips_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mips.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/mipspe.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h DEP_mips_ecoff = $(srcdir)/config/obj-ecoff.h $(srcdir)/config/tc-mips.h \ ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h -DEP_mips_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mips.h +DEP_mips_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mips.h DEP_mn10200_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10200.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h -DEP_mn10200_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10200.h +DEP_mn10200_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10200.h DEP_mn10300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10300.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h -DEP_mn10300_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10300.h +DEP_mn10300_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10300.h DEP_ns32k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-ns32k.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h DEP_ns32k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ns32k.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h -DEP_ns32k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h +DEP_ns32k_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h DEP_openrisc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-openrisc.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h -DEP_openrisc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-openrisc.h +DEP_openrisc_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-openrisc.h DEP_pdp11_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-pdp11.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h DEP_pdp11_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-pdp11.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h -DEP_pdp11_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pdp11.h +DEP_pdp11_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pdp11.h DEP_pj_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-pj.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h -DEP_pj_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pj.h +DEP_pj_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pj.h DEP_ppc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ppc.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/rs6000.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/rs6000.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_ppc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ppc.h +DEP_ppc_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ppc.h DEP_s390_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-s390.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h -DEP_s390_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-s390.h +DEP_s390_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-s390.h DEP_sh_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sh.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/sh.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/sh.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_sh_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh.h +DEP_sh_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh.h DEP_sparc_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-sparc.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h DEP_sparc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sparc.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/sparc.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/sparc.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_sparc_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sparc.h +DEP_sparc_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sparc.h DEP_tahoe_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tahoe.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h DEP_tahoe_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tahoe.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h -DEP_tahoe_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tahoe.h +DEP_tahoe_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tahoe.h DEP_tic30_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tic30.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h DEP_tic30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic30.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic30.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic30.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_tic30_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic30.h +DEP_tic30_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic30.h DEP_tic54x_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic54x.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic54x.h \ + $(INCDIR)/coff/ti.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_tic54x_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic54x.h +DEP_tic54x_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic54x.h DEP_tic80_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic80.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic80.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic80.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_tic80_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic80.h +DEP_tic80_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic80.h DEP_vax_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-vax.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h DEP_vax_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-vax.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h -DEP_vax_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-vax.h +DEP_vax_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-vax.h DEP_vax_vms = $(srcdir)/config/obj-vms.h $(srcdir)/config/tc-vax.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def DEP_w65_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-w65.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/w65.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/w65.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_w65_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-w65.h +DEP_w65_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-w65.h DEP_v850_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-v850.h \ - $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h -DEP_v850_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h +DEP_v850_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h DEP_z8k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-z8k.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/z8k.h $(INCDIR)/coff/external.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/z8k.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_z8k_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/config/tc-z8k.h +DEP_z8k_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-z8k.h DEP_hppa_som = $(BFDDIR)/som.h DEP_i386_multi = $(DEP_i386_aout) $(DEP_i386_coff) \ @@ -2646,6 +2811,8 @@ de-stage3: - (cd stage3 ; rm -f as$(EXEEXT) ; mv -f * ..) - rmdir stage3 +Makefile: $(BFDDIR)/configure.in + # Automatic dependency computation. This is a real pain, because the # dependencies change based on target_cpu_type and obj_format. # Just to make things even more complicated, automake separates the @@ -2824,49 +2991,61 @@ dep-am: DEP # ANYTHING CHANGED OR ADDED BETWEEN THE WARNING LINES MAY GO AWAY. .PHONY: dep dep-in dep-am #MKDEP DO NOT PUT ANYTHING BETWEEN THIS LINE AND THE MATCHING WARNING BELOW. -app.o: app.c -as.o: as.c subsegs.h $(INCDIR)/obstack.h output-file.h \ - sb.h macro.h dwarf2dbg.h -atof-generic.o: atof-generic.c -bignum-copy.o: bignum-copy.c -cond.o: cond.c macro.h sb.h $(INCDIR)/obstack.h -depend.o: depend.c -dwarf2dbg.o: dwarf2dbg.c dwarf2dbg.h subsegs.h $(INCDIR)/obstack.h \ +app.o: app.c $(INCDIR)/symcat.h +as.o: as.c $(INCDIR)/symcat.h subsegs.h $(INCDIR)/obstack.h \ + output-file.h sb.h macro.h dwarf2dbg.h +atof-generic.o: atof-generic.c $(INCDIR)/symcat.h $(INCDIR)/safe-ctype.h +bignum-copy.o: bignum-copy.c $(INCDIR)/symcat.h +cond.o: cond.c $(INCDIR)/symcat.h macro.h sb.h $(INCDIR)/obstack.h +depend.o: depend.c $(INCDIR)/symcat.h +dwarf2dbg.o: dwarf2dbg.c $(INCDIR)/symcat.h dwarf2dbg.h \ + subsegs.h $(INCDIR)/obstack.h $(INCDIR)/elf/dwarf2.h +ecoff.o: ecoff.c $(INCDIR)/symcat.h ecoff.h +ehopt.o: ehopt.c $(INCDIR)/symcat.h subsegs.h $(INCDIR)/obstack.h \ $(INCDIR)/elf/dwarf2.h -ecoff.o: ecoff.c ecoff.h -ehopt.o: ehopt.c subsegs.h $(INCDIR)/obstack.h $(INCDIR)/elf/dwarf2.h -expr.o: expr.c $(INCDIR)/obstack.h -flonum-copy.o: flonum-copy.c +expr.o: expr.c $(INCDIR)/symcat.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/obstack.h +flonum-copy.o: flonum-copy.c $(INCDIR)/symcat.h flonum-konst.o: flonum-konst.c flonum-mult.o: flonum-mult.c -frags.o: frags.c subsegs.h $(INCDIR)/obstack.h -hash.o: hash.c $(INCDIR)/obstack.h -input-file.o: input-file.c input-file.h -input-scrub.o: input-scrub.c input-file.h sb.h -listing.o: listing.c input-file.h subsegs.h -literal.o: literal.c subsegs.h $(INCDIR)/obstack.h -macro.o: macro.c sb.h macro.h -messages.o: messages.c -output-file.o: output-file.c output-file.h -read.o: read.c subsegs.h $(INCDIR)/obstack.h sb.h macro.h \ - ecoff.h +frags.o: frags.c $(INCDIR)/symcat.h subsegs.h $(INCDIR)/obstack.h +hash.o: hash.c $(INCDIR)/symcat.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/obstack.h +input-file.o: input-file.c $(INCDIR)/symcat.h input-file.h +input-scrub.o: input-scrub.c $(INCDIR)/symcat.h input-file.h \ + sb.h +listing.o: listing.c $(INCDIR)/symcat.h $(INCDIR)/safe-ctype.h \ + input-file.h subsegs.h +literal.o: literal.c $(INCDIR)/symcat.h subsegs.h $(INCDIR)/obstack.h +macro.o: macro.c $(INCDIR)/safe-ctype.h sb.h macro.h +messages.o: messages.c $(INCDIR)/symcat.h +output-file.o: output-file.c $(INCDIR)/symcat.h output-file.h +read.o: read.c $(INCDIR)/symcat.h $(INCDIR)/safe-ctype.h \ + subsegs.h $(INCDIR)/obstack.h sb.h macro.h ecoff.h sb.o: sb.c sb.h -stabs.o: stabs.c $(INCDIR)/obstack.h subsegs.h ecoff.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def -subsegs.o: subsegs.c subsegs.h $(INCDIR)/obstack.h -symbols.o: symbols.c $(INCDIR)/obstack.h subsegs.h \ - struc-symbol.h -write.o: write.c subsegs.h $(INCDIR)/obstack.h output-file.h \ - dwarf2dbg.h -gasp.o: gasp.c sb.h macro.h -itbl-ops.o: itbl-ops.c itbl-ops.h -e-crisaout.o: $(srcdir)/config/e-crisaout.c emul-target.h -e-criself.o: $(srcdir)/config/e-criself.c emul-target.h -e-i386aout.o: $(srcdir)/config/e-i386aout.c emul-target.h -e-i386coff.o: $(srcdir)/config/e-i386coff.c emul-target.h -e-i386elf.o: $(srcdir)/config/e-i386elf.c emul-target.h -e-mipsecoff.o: $(srcdir)/config/e-mipsecoff.c emul-target.h -e-mipself.o: $(srcdir)/config/e-mipself.c emul-target.h +stabs.o: stabs.c $(INCDIR)/symcat.h $(INCDIR)/obstack.h \ + subsegs.h ecoff.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def +subsegs.o: subsegs.c $(INCDIR)/symcat.h subsegs.h $(INCDIR)/obstack.h +symbols.o: symbols.c $(INCDIR)/symcat.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/obstack.h subsegs.h struc-symbol.h +write.o: write.c $(INCDIR)/symcat.h subsegs.h $(INCDIR)/obstack.h \ + output-file.h dwarf2dbg.h +gasp.o: gasp.c $(INCDIR)/safe-ctype.h sb.h macro.h +itbl-ops.o: itbl-ops.c itbl-ops.h $(INCDIR)/symcat.h +e-crisaout.o: $(srcdir)/config/e-crisaout.c $(INCDIR)/symcat.h \ + emul-target.h +e-criself.o: $(srcdir)/config/e-criself.c $(INCDIR)/symcat.h \ + emul-target.h +e-i386aout.o: $(srcdir)/config/e-i386aout.c $(INCDIR)/symcat.h \ + emul-target.h +e-i386coff.o: $(srcdir)/config/e-i386coff.c $(INCDIR)/symcat.h \ + emul-target.h +e-i386elf.o: $(srcdir)/config/e-i386elf.c $(INCDIR)/symcat.h \ + emul-target.h +e-mipsecoff.o: $(srcdir)/config/e-mipsecoff.c $(INCDIR)/symcat.h \ + emul-target.h +e-mipself.o: $(srcdir)/config/e-mipself.c $(INCDIR)/symcat.h \ + emul-target.h $(OBJS): $(DEP_@target_cpu_type@_@obj_format@) $(TARG_CPU_O): $(DEPTC_@target_cpu_type@_@obj_format@) $(OBJ_FORMAT_O): $(DEPOBJ_@target_cpu_type@_@obj_format@) diff -uprN binutils-2.11.90.0.31/gas/as.c binutils-2.11.92.0.5/gas/as.c --- binutils-2.11.90.0.31/gas/as.c Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/gas/as.c Thu Oct 4 14:35:43 2001 @@ -208,7 +208,7 @@ print_version_id () #ifdef BFD_ASSEMBLER fprintf (stderr, _("GNU assembler version %s (%s) using BFD version %s"), - VERSION, TARGET_ALIAS, BFD_VERSION); + VERSION, TARGET_ALIAS, BFD_VERSION_STRING); #else fprintf (stderr, _("GNU assembler version %s (%s)"), VERSION, TARGET_ALIAS); #endif @@ -766,6 +766,8 @@ the GNU General Public License. This pr static long start_time; +int main PARAMS ((int, char **)); + int main (argc, argv) int argc; @@ -780,6 +782,9 @@ main (argc, argv) #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) setlocale (LC_MESSAGES, ""); #endif +#if defined (HAVE_SETLOCALE) + setlocale (LC_CTYPE, ""); +#endif bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); diff -uprN binutils-2.11.90.0.31/gas/as.h binutils-2.11.92.0.5/gas/as.h --- binutils-2.11.90.0.31/gas/as.h Fri Aug 10 14:08:01 2001 +++ binutils-2.11.92.0.5/gas/as.h Mon Oct 1 15:25:22 2001 @@ -73,7 +73,6 @@ extern void *alloca (); /* System include files first... */ #include -#include #ifdef HAVE_STRING_H #include #else diff -uprN binutils-2.11.90.0.31/gas/atof-generic.c binutils-2.11.92.0.5/gas/atof-generic.c --- binutils-2.11.90.0.31/gas/atof-generic.c Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/gas/atof-generic.c Mon Oct 1 15:25:22 2001 @@ -1,5 +1,5 @@ /* atof_generic.c - turn a string of digits into a Flonum - Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000 + Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -19,10 +19,10 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include #include #include "as.h" +#include "safe-ctype.h" #ifndef FALSE #define FALSE (0) @@ -171,7 +171,7 @@ atof_generic (address_of_string_pointer, && (!c || !strchr (string_of_decimal_exponent_marks, c))); p++) { - if (isdigit ((unsigned char) c)) + if (ISDIGIT (c)) { if (seen_significant_digit || c > '0') { @@ -200,7 +200,7 @@ atof_generic (address_of_string_pointer, { unsigned int zeros = 0; /* Length of current string of zeros */ - for (p++; (c = *p) && isdigit ((unsigned char) c); p++) + for (p++; (c = *p) && ISDIGIT (c); p++) { if (c == '0') { @@ -221,7 +221,7 @@ atof_generic (address_of_string_pointer, && (!c || !strchr (string_of_decimal_exponent_marks, c))); p++) { - if (isdigit ((unsigned char) c)) + if (ISDIGIT (c)) { /* This may be retracted below. */ number_of_digits_after_decimal++; @@ -275,7 +275,7 @@ atof_generic (address_of_string_pointer, for (; (c); c = *++p) { - if (isdigit ((unsigned char) c)) + if (ISDIGIT (c)) { decimal_exponent = decimal_exponent * 10 + c - '0'; /* @@ -400,7 +400,7 @@ atof_generic (address_of_string_pointer, for (p = first_digit, count = number_of_digits_to_use; count; p++, --count) { c = *p; - if (isdigit ((unsigned char) c)) + if (ISDIGIT (c)) { /* * Multiply by 10. Assume can never overflow. diff -uprN binutils-2.11.90.0.31/gas/config/m68k-parse.y binutils-2.11.92.0.5/gas/config/m68k-parse.y --- binutils-2.11.90.0.31/gas/config/m68k-parse.y Fri Mar 9 11:16:47 2001 +++ binutils-2.11.92.0.5/gas/config/m68k-parse.y Mon Oct 1 15:25:22 2001 @@ -1,5 +1,5 @@ /* m68k.y -- bison grammar for m68k operand parsing - Copyright 1995, 1996, 1997, 1998 Free Software Foundation, Inc. + Copyright 1995, 1996, 1997, 1998, 2001 Free Software Foundation, Inc. Written by Ken Raeburn and Ian Lance Taylor, Cygnus Support This file is part of GAS, the GNU Assembler. @@ -29,6 +29,7 @@ #include "as.h" #include "tc-m68k.h" #include "m68k-parse.h" +#include "safe-ctype.h" /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc), as well as gratuitiously global symbol names If other parser @@ -743,9 +744,9 @@ yylex () /* In MRI mode, this can be the start of an octal number. */ if (flag_mri) { - if (isdigit (str[1]) + if (ISDIGIT (str[1]) || ((str[1] == '+' || str[1] == '-') - && isdigit (str[2]))) + && ISDIGIT (str[2]))) break; } /* Fall through. */ @@ -929,7 +930,7 @@ yylex () { if (parens == 0 && s > str - && (s[-1] == ')' || isalnum ((unsigned char) s[-1]))) + && (s[-1] == ')' || ISALNUM (s[-1]))) break; ++parens; } diff -uprN binutils-2.11.90.0.31/gas/config/obj-aout.c binutils-2.11.92.0.5/gas/config/obj-aout.c --- binutils-2.11.90.0.31/gas/config/obj-aout.c Wed May 23 11:36:05 2001 +++ binutils-2.11.92.0.5/gas/config/obj-aout.c Mon Oct 1 15:25:22 2001 @@ -755,4 +755,4 @@ const struct format_ops aout_format_ops 0, /* read_begin_hook */ 0 /* symbol_new_hook */ }; -#endif BFD_ASSEMBLER +#endif /* BFD_ASSEMBLER */ diff -uprN binutils-2.11.90.0.31/gas/config/obj-coff.c binutils-2.11.92.0.5/gas/config/obj-coff.c --- binutils-2.11.90.0.31/gas/config/obj-coff.c Fri Aug 10 14:08:01 2001 +++ binutils-2.11.92.0.5/gas/config/obj-coff.c Mon Oct 1 15:25:22 2001 @@ -2059,8 +2059,8 @@ do_relocs_for (abfd, h, file_cursor) #endif /* Write out the reloc table */ - bfd_write ((PTR) external_reloc_vec, 1, external_reloc_size, - abfd); + bfd_bwrite ((PTR) external_reloc_vec, + (bfd_size_type) external_reloc_size, abfd); free (external_reloc_vec); /* Fill in section header info. */ @@ -2202,7 +2202,7 @@ fill_section (abfd, h, file_cursor) { if (s->s_scnptr != 0) { - bfd_write (buffer, s->s_size, 1, abfd); + bfd_bwrite (buffer, s->s_size, abfd); *file_cursor += s->s_size; } free (buffer); @@ -2226,7 +2226,7 @@ coff_header_append (abfd, h) unsigned long string_size = 4; #endif - bfd_seek (abfd, 0, 0); + bfd_seek (abfd, (file_ptr) 0, 0); #ifndef OBJ_COFF_OMIT_OPTIONAL_HEADER H_SET_MAGIC_NUMBER (h, COFF_MAGIC); @@ -2242,8 +2242,8 @@ coff_header_append (abfd, h) i = bfd_coff_swap_filehdr_out (abfd, &h->filehdr, buffer); - bfd_write (buffer, i, 1, abfd); - bfd_write (buffero, H_GET_SIZEOF_OPTIONAL_HEADER (h), 1, abfd); + bfd_bwrite (buffer, (bfd_size_type) i, abfd); + bfd_bwrite (buffero, (bfd_size_type) H_GET_SIZEOF_OPTIONAL_HEADER (h), abfd); for (i = SEG_E0; i < SEG_LAST; i++) { @@ -2268,7 +2268,7 @@ coff_header_append (abfd, h) buffer); if (size == 0) as_bad (_("bfd_coff_swap_scnhdr_out failed")); - bfd_write (buffer, size, 1, abfd); + bfd_bwrite (buffer, (bfd_size_type) size, abfd); } } } @@ -3395,7 +3395,7 @@ do_linenos_for (abfd, h, file_cursor) s->scnhdr.s_lnnoptr = *file_cursor; - bfd_write (buffer, 1, s->scnhdr.s_nlnno * LINESZ, abfd); + bfd_bwrite (buffer, (bfd_size_type) s->scnhdr.s_nlnno * LINESZ, abfd); free (buffer); *file_cursor += s->scnhdr.s_nlnno * LINESZ; @@ -3618,7 +3618,8 @@ write_object_file () w_symbols (abfd, buffer1, symbol_rootP); if (string_byte_count > 0) w_strings (buffer1 + symtable_size); - bfd_write (buffer1, 1, symtable_size + string_byte_count, abfd); + bfd_bwrite (buffer1, (bfd_size_type) symtable_size + string_byte_count, + abfd); free (buffer1); } diff -uprN binutils-2.11.90.0.31/gas/config/obj-elf.c binutils-2.11.92.0.5/gas/config/obj-elf.c --- binutils-2.11.90.0.31/gas/config/obj-elf.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/gas/config/obj-elf.c Mon Oct 1 15:25:22 2001 @@ -21,6 +21,7 @@ #define OBJ_HEADER "obj-elf.h" #include "as.h" +#include "safe-ctype.h" #include "subsegs.h" #include "obstack.h" @@ -721,7 +722,7 @@ obj_elf_change_section (name, type, attr & (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE | SEC_EXCLUDE | SEC_SORT_ENTRIES | SEC_MERGE | SEC_STRINGS)) as_warn (_("Ignoring changed section attributes for %s"), name); - else if ((flags & SEC_MERGE) && old_sec->entsize != entsize) + else if ((flags & SEC_MERGE) && old_sec->entsize != (unsigned) entsize) as_warn (_("Ignoring changed section entity size for %s"), name); } @@ -750,15 +751,27 @@ obj_elf_parse_section_letters (str, len) case 'x': attr |= SHF_EXECINSTR; break; - case 'm': + case 'M': attr |= SHF_MERGE; break; - case 's': + case 'S': attr |= SHF_STRINGS; break; + /* Compatibility. */ + case 'm': + if (*(str - 1) == 'a') + { + attr |= SHF_MERGE; + if (len > 1 && str[1] == 's') + { + attr |= SHF_STRINGS; + str++, len--; + } + break; + } default: { - char *bad_msg = _("Unrecognized .section attribute: want a,m,s,w,x"); + char *bad_msg = _("Unrecognized .section attribute: want a,w,x,M,S"); #ifdef md_elf_section_letter int md_attr = md_elf_section_letter (*str, &bad_msg); if (md_attr >= 0) @@ -1236,7 +1249,7 @@ obj_elf_vtable_inherit (ignore) if (input_line_pointer[0] == '0' && (input_line_pointer[1] == '\0' - || isspace ((unsigned char) input_line_pointer[1]))) + || ISSPACE (input_line_pointer[1]))) { psym = section_symbol (absolute_section); ++input_line_pointer; diff -uprN binutils-2.11.90.0.31/gas/config/obj-vms.c binutils-2.11.92.0.5/gas/config/obj-vms.c --- binutils-2.11.90.0.31/gas/config/obj-vms.c Wed May 23 10:55:11 2001 +++ binutils-2.11.92.0.5/gas/config/obj-vms.c Mon Oct 1 15:25:22 2001 @@ -28,6 +28,7 @@ Software Foundation, 59 Temple Place - S #include "as.h" #include "config.h" +#include "safe-ctype.h" #include "subsegs.h" #include "obstack.h" @@ -3071,7 +3072,7 @@ Write_VMS_MHD_Records () cp++; continue; } - *cp1++ = islower (*cp) ? toupper (*cp++) : *cp++; + *cp1++ = TOUPPER (*cp++); } *cp1 = '\0'; @@ -3254,20 +3255,20 @@ VMS_Case_Hack_Symbol (In, Out) switch (vms_name_mapping) { case 0: - if (isupper (*In)) { + if (ISUPPER (*In)) { *Out++ = *In++; Case_Hack_Bits |= 1; } else { - *Out++ = islower (*In) ? toupper (*In++) : *In++; + *Out++ = TOUPPER (*In++); } break; case 3: *Out++ = *In++; break; case 2: - if (islower (*In)) { + if (ISLOWER (*In)) { *Out++ = *In++; } else { - *Out++ = isupper (*In) ? tolower (*In++) : *In++; + *Out++ = TOLOWER (*In++); } break; } @@ -3298,7 +3299,7 @@ VMS_Case_Hack_Symbol (In, Out) * and ensure that they are lowercase */ for (i = 0; (In[i] != 0) && (i < 8); i++) - if (isupper (In[i]) && !Saw_Dollar && !flag_no_hash_mixed_case) + if (ISUPPER (In[i]) && !Saw_Dollar && !flag_no_hash_mixed_case) break; if (In[i] == 0) @@ -3313,11 +3314,11 @@ VMS_Case_Hack_Symbol (In, Out) i = 8; while ((--i >= 0) && (*In)) switch (vms_name_mapping){ - case 0: *Out++ = islower (*In) ? toupper (*In++) : *In++; + case 0: *Out++ = TOUPPER (*In++); break; case 3: *Out++ = *In++; break; - case 2: *Out++ = isupper (*In) ? tolower (*In++) : *In++; + case 2: *Out++ = TOLOWER (*In++); break; } } diff -uprN binutils-2.11.90.0.31/gas/config/tc-a29k.c binutils-2.11.92.0.5/gas/config/tc-a29k.c --- binutils-2.11.90.0.31/gas/config/tc-a29k.c Fri Mar 9 11:16:49 2001 +++ binutils-2.11.92.0.5/gas/config/tc-a29k.c Mon Oct 1 15:25:22 2001 @@ -1,5 +1,5 @@ /* tc-a29k.c -- Assemble for the AMD 29000. - Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1998, 2000 + Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1998, 2000, 2001 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -23,8 +23,8 @@ to convert it to new machines' assemblers as desired. There was too much bloody rewriting required before. There still probably is. */ -#include #include "as.h" +#include "safe-ctype.h" #include "opcode/a29k.h" @@ -188,7 +188,7 @@ insert_sreg (regname, regnum) symbol_table_insert (symbol_new (regname, SEG_REGISTER, (valueT) regnum, &zero_address_frag)); for (i = 0; regname[i]; i++) - buf[i] = islower (regname[i]) ? toupper (regname[i]) : regname[i]; + buf[i] = TOUPPER (regname[i]); buf[i] = '\0'; symbol_table_insert (symbol_new (buf, SEG_REGISTER, (valueT) regnum, @@ -397,10 +397,9 @@ machine_ip (str) /* Must handle `div0' opcode. */ s = str; - if (isalpha (*s)) - for (; isalnum (*s); ++s) - if (isupper (*s)) - *s = tolower (*s); + if (ISALPHA (*s)) + for (; ISALNUM (*s); ++s) + *s = TOLOWER (*s); switch (*s) { @@ -1067,13 +1066,13 @@ a29k_unrecognized_line (c) char *s; if (c != '$' - || ! isdigit ((unsigned char) input_line_pointer[0])) + || ! ISDIGIT (input_line_pointer[0])) return 0; s = input_line_pointer; lab = 0; - while (isdigit ((unsigned char) *s)) + while (ISDIGIT (*s)) { lab = lab * 10 + *s - '0'; ++s; @@ -1176,7 +1175,7 @@ md_operand (expressionP) expressionP->X_op = O_constant; } else if (input_line_pointer[0] == '$' - && isdigit ((unsigned char) input_line_pointer[1])) + && ISDIGIT (input_line_pointer[1])) { long lab; char *name; @@ -1238,7 +1237,7 @@ md_operand (expressionP) return; } - if (isdigit (*s)) + if (ISDIGIT (*s)) { fieldnum = *s - '0'; ++s; diff -uprN binutils-2.11.90.0.31/gas/config/tc-alpha.c binutils-2.11.92.0.5/gas/config/tc-alpha.c --- binutils-2.11.90.0.31/gas/config/tc-alpha.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/gas/config/tc-alpha.c Mon Oct 1 15:25:22 2001 @@ -62,7 +62,7 @@ #include "dwarf2dbg.h" #endif -#include +#include "safe-ctype.h" /* Local types */ @@ -81,7 +81,7 @@ struct alpha_insn { unsigned insn; int nfixups; struct alpha_fixup fixups[MAX_INSN_FIXUPS]; - unsigned sequence[MAX_INSN_FIXUPS]; + long sequence; }; enum alpha_macro_arg { @@ -92,10 +92,6 @@ enum alpha_macro_arg { MACRO_CPIR, MACRO_FPR, MACRO_EXP, - MACRO_LITERAL, - MACRO_BASE, - MACRO_BYTOFF, - MACRO_JSR }; struct alpha_macro { @@ -110,19 +106,29 @@ struct alpha_macro { #define O_pregister O_md1 /* O_register, in parentheses */ #define O_cpregister O_md2 /* + a leading comma */ -#ifdef RELOC_OP_P /* Note, the alpha_reloc_op table below depends on the ordering - of O_literal .. O_gprelow. */ + of O_literal .. O_gpre16. */ #define O_literal O_md3 /* !literal relocation */ -#define O_lituse_base O_md4 /* !lituse_base relocation */ -#define O_lituse_bytoff O_md5 /* !lituse_bytoff relocation */ -#define O_lituse_jsr O_md6 /* !lituse_jsr relocation */ -#define O_gpdisp O_md7 /* !gpdisp relocation */ -#define O_gprelhigh O_md8 /* !gprelhigh relocation */ -#define O_gprellow O_md9 /* !gprellow relocation */ +#define O_lituse_addr O_md4 /* !lituse_addr relocation */ +#define O_lituse_base O_md5 /* !lituse_base relocation */ +#define O_lituse_bytoff O_md6 /* !lituse_bytoff relocation */ +#define O_lituse_jsr O_md7 /* !lituse_jsr relocation */ +#define O_gpdisp O_md8 /* !gpdisp relocation */ +#define O_gprelhigh O_md9 /* !gprelhigh relocation */ +#define O_gprellow O_md10 /* !gprellow relocation */ +#define O_gprel O_md11 /* !gprel relocation */ + +#define DUMMY_RELOC_LITUSE_ADDR (BFD_RELOC_UNUSED + 1) +#define DUMMY_RELOC_LITUSE_BASE (BFD_RELOC_UNUSED + 2) +#define DUMMY_RELOC_LITUSE_BYTOFF (BFD_RELOC_UNUSED + 3) +#define DUMMY_RELOC_LITUSE_JSR (BFD_RELOC_UNUSED + 4) -#define USER_RELOC_P(R) ((R) >= O_literal && (R) <= O_gprellow) -#endif +#define LITUSE_ADDR 0 +#define LITUSE_BASE 1 +#define LITUSE_BYTOFF 2 +#define LITUSE_JSR 3 + +#define USER_RELOC_P(R) ((R) >= O_literal && (R) <= O_gprel) /* Macros for extracting the type and number of encoded register tokens */ @@ -188,6 +194,9 @@ struct alpha_macro { /* Prototypes for all local functions */ +static struct alpha_reloc_tag *get_alpha_reloc_tag PARAMS ((long)); +static void alpha_adjust_symtab_relocs PARAMS ((bfd *, asection *, PTR)); + static int tokenize_arguments PARAMS ((char *, expressionS *, int)); static const struct alpha_opcode *find_opcode_match PARAMS ((const struct alpha_opcode *, const expressionS *, int *, int *)); @@ -197,16 +206,15 @@ static unsigned insert_operand PARAMS ((unsigned, const struct alpha_operand *, offsetT, char *, unsigned)); static void assemble_insn PARAMS ((const struct alpha_opcode *, const expressionS *, int, - struct alpha_insn *)); + struct alpha_insn *, bfd_reloc_code_real_type)); static void emit_insn PARAMS ((struct alpha_insn *)); static void assemble_tokens_to_insn PARAMS ((const char *, const expressionS *, int, struct alpha_insn *)); static void assemble_tokens PARAMS ((const char *, const expressionS *, int, int)); -static int load_expression - PARAMS ((int, const expressionS *, int *, expressionS *, - const expressionS *)); +static long load_expression + PARAMS ((int, const expressionS *, int *, expressionS *)); static void emit_ldgp PARAMS ((const expressionS *, int, const PTR)); static void emit_division PARAMS ((const expressionS *, int, const PTR)); @@ -257,16 +265,14 @@ static void s_alpha_base PARAMS ((int)); static void s_alpha_align PARAMS ((int)); static void s_alpha_stringer PARAMS ((int)); static void s_alpha_space PARAMS ((int)); +static void s_alpha_ucons PARAMS ((int)); +static void s_alpha_arch PARAMS ((int)); static void create_literal_section PARAMS ((const char *, segT *, symbolS **)); #ifndef OBJ_ELF static void select_gp_value PARAMS ((void)); #endif static void alpha_align PARAMS ((int, char *, symbolS *, int)); - -#ifdef RELOC_OP_P -static void alpha_adjust_symtab_relocs PARAMS ((bfd *, asection *, PTR)); -#endif /* Generic assembler global variables which must be defined by all targets. */ @@ -469,103 +475,58 @@ static int alpha_flag_show_after_trunc = that op-O_literal indexes into it. */ #define ALPHA_RELOC_TABLE(op) \ -&alpha_reloc_op[ ((!USER_RELOC_P (op)) \ +(&alpha_reloc_op[ ((!USER_RELOC_P (op)) \ ? (abort (), 0) \ - : (int) (op) - (int) O_literal) ] + : (int) (op) - (int) O_literal) ]) -#define LITUSE_BASE 1 -#define LITUSE_BYTOFF 2 -#define LITUSE_JSR 3 +#define DEF(NAME, RELOC, REQ, ALLOW) \ + { #NAME, sizeof(#NAME)-1, O_##NAME, RELOC, REQ, ALLOW} static const struct alpha_reloc_op_tag { const char *name; /* string to lookup */ size_t length; /* size of the string */ - bfd_reloc_code_real_type reloc; /* relocation before frob */ operatorT op; /* which operator to use */ - int lituse; /* addened to specify lituse */ + bfd_reloc_code_real_type reloc; /* relocation before frob */ + unsigned int require_seq : 1; /* require a sequence number */ + unsigned int allow_seq : 1; /* allow a sequence number */ } alpha_reloc_op[] = { - - { - "literal", /* name */ - sizeof ("literal")-1, /* length */ - BFD_RELOC_ALPHA_USER_LITERAL, /* reloc */ - O_literal, /* op */ - 0, /* lituse */ - }, - - { - "lituse_base", /* name */ - sizeof ("lituse_base")-1, /* length */ - BFD_RELOC_ALPHA_USER_LITUSE_BASE, /* reloc */ - O_lituse_base, /* op */ - LITUSE_BASE, /* lituse */ - }, - - { - "lituse_bytoff", /* name */ - sizeof ("lituse_bytoff")-1, /* length */ - BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF, /* reloc */ - O_lituse_bytoff, /* op */ - LITUSE_BYTOFF, /* lituse */ - }, - - { - "lituse_jsr", /* name */ - sizeof ("lituse_jsr")-1, /* length */ - BFD_RELOC_ALPHA_USER_LITUSE_JSR, /* reloc */ - O_lituse_jsr, /* op */ - LITUSE_JSR, /* lituse */ - }, - - { - "gpdisp", /* name */ - sizeof ("gpdisp")-1, /* length */ - BFD_RELOC_ALPHA_USER_GPDISP, /* reloc */ - O_gpdisp, /* op */ - 0, /* lituse */ - }, - - { - "gprelhigh", /* name */ - sizeof ("gprelhigh")-1, /* length */ - BFD_RELOC_ALPHA_USER_GPRELHIGH, /* reloc */ - O_gprelhigh, /* op */ - 0, /* lituse */ - }, - - { - "gprellow", /* name */ - sizeof ("gprellow")-1, /* length */ - BFD_RELOC_ALPHA_USER_GPRELLOW, /* reloc */ - O_gprellow, /* op */ - 0, /* lituse */ - }, + DEF(literal, BFD_RELOC_ALPHA_ELF_LITERAL, 0, 1), + DEF(lituse_addr, DUMMY_RELOC_LITUSE_ADDR, 1, 1), + DEF(lituse_base, DUMMY_RELOC_LITUSE_BASE, 1, 1), + DEF(lituse_bytoff, DUMMY_RELOC_LITUSE_BYTOFF, 1, 1), + DEF(lituse_jsr, DUMMY_RELOC_LITUSE_JSR, 1, 1), + DEF(gpdisp, BFD_RELOC_ALPHA_GPDISP, 1, 1), + DEF(gprelhigh, BFD_RELOC_ALPHA_GPREL_HI16, 0, 0), + DEF(gprellow, BFD_RELOC_ALPHA_GPREL_LO16, 0, 0), + DEF(gprel, BFD_RELOC_GPREL16, 0, 0) }; +#undef DEF + static const int alpha_num_reloc_op = sizeof (alpha_reloc_op) / sizeof (*alpha_reloc_op); +#endif /* RELOC_OP_P */ /* Maximum # digits needed to hold the largest sequence # */ #define ALPHA_RELOC_DIGITS 25 -/* Whether a sequence number is valid. */ -#define ALPHA_RELOC_SEQUENCE_OK(X) ((X) > 0 && ((unsigned) (X)) == (X)) - /* Structure to hold explict sequence information. */ -struct alpha_literal_tag +struct alpha_reloc_tag { - fixS *lituse; /* head of linked list of !literals */ + fixS *slaves; /* head of linked list of !literals */ segT segment; /* segment relocs are in or undefined_section*/ - int multi_section_p; /* True if more than one section was used */ - unsigned sequence; /* sequence # */ - unsigned n_literals; /* # of literals */ - unsigned n_lituses; /* # of lituses */ + long sequence; /* sequence # */ + unsigned n_master; /* # of literals */ + unsigned n_slaves; /* # of lituses */ + char multi_section_p; /* True if more than one section was used */ char string[1]; /* printable form of sequence to hash with */ }; /* Hash table to link up literals with the appropriate lituse */ static struct hash_control *alpha_literal_hash; -#endif + +/* Sequence numbers for internal use by macros. */ +static long next_sequence_num = -1; /* A table of CPU names and opcode sets. */ @@ -606,48 +567,48 @@ static const struct cpu_type { static const struct alpha_macro alpha_macros[] = { /* Load/Store macros */ { "lda", emit_lda, NULL, - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_LITERAL, MACRO_BASE, MACRO_EOA } }, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, { "ldah", emit_ldah, NULL, { MACRO_IR, MACRO_EXP, MACRO_EOA } }, { "ldl", emit_ir_load, "ldl", - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } }, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, { "ldl_l", emit_ir_load, "ldl_l", - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } }, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, { "ldq", emit_ir_load, "ldq", - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_LITERAL, MACRO_EOA } }, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, { "ldq_l", emit_ir_load, "ldq_l", - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } }, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, { "ldq_u", emit_ir_load, "ldq_u", - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } }, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, { "ldf", emit_loadstore, "ldf", - { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } }, + { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, { "ldg", emit_loadstore, "ldg", - { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } }, + { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, { "lds", emit_loadstore, "lds", - { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } }, + { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, { "ldt", emit_loadstore, "ldt", - { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } }, + { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, { "ldb", emit_ldX, (PTR) 0, - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } }, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, { "ldbu", emit_ldXu, (PTR) 0, - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } }, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, { "ldw", emit_ldX, (PTR) 1, - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } }, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, { "ldwu", emit_ldXu, (PTR) 1, - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } }, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, { "uldw", emit_uldX, (PTR) 1, - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } }, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, { "uldwu", emit_uldXu, (PTR) 1, - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } }, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, { "uldl", emit_uldX, (PTR) 2, - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } }, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, { "uldlu", emit_uldXu, (PTR) 2, - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } }, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, { "uldq", emit_uldXu, (PTR) 3, - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } }, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, { "ldgp", emit_ldgp, NULL, { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA } }, @@ -672,34 +633,34 @@ static const struct alpha_macro alpha_ma #endif { "stl", emit_loadstore, "stl", - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } }, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, { "stl_c", emit_loadstore, "stl_c", - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } }, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, { "stq", emit_loadstore, "stq", - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } }, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, { "stq_c", emit_loadstore, "stq_c", - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } }, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, { "stq_u", emit_loadstore, "stq_u", - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } }, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, { "stf", emit_loadstore, "stf", - { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } }, + { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, { "stg", emit_loadstore, "stg", - { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } }, + { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, { "sts", emit_loadstore, "sts", - { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } }, + { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, { "stt", emit_loadstore, "stt", - { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } }, + { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, { "stb", emit_stX, (PTR) 0, - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } }, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, { "stw", emit_stX, (PTR) 1, - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } }, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, { "ustw", emit_ustX, (PTR) 1, - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } }, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, { "ustl", emit_ustX, (PTR) 2, - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } }, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, { "ustq", emit_ustX, (PTR) 3, - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_BASE, MACRO_EOA } }, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, /* Arithmetic macros */ #if 0 @@ -762,15 +723,15 @@ static const struct alpha_macro alpha_ma MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, { "jsr", emit_jsrjmp, "jsr", - { MACRO_PIR, MACRO_EXP, MACRO_JSR, MACRO_EOA, - MACRO_PIR, MACRO_JSR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_JSR, MACRO_EOA, - MACRO_EXP, MACRO_JSR, MACRO_EOA } }, + { MACRO_PIR, MACRO_EXP, MACRO_EOA, + MACRO_PIR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA, + MACRO_EXP, MACRO_EOA } }, { "jmp", emit_jsrjmp, "jmp", - { MACRO_PIR, MACRO_EXP, MACRO_JSR, MACRO_EOA, - MACRO_PIR, MACRO_JSR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_JSR, MACRO_EOA, - MACRO_EXP, MACRO_JSR, MACRO_EOA } }, + { MACRO_PIR, MACRO_EXP, MACRO_EOA, + MACRO_PIR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA, + MACRO_EXP, MACRO_EOA } }, { "ret", emit_retjcr, "ret", { MACRO_IR, MACRO_EXP, MACRO_EOA, MACRO_IR, MACRO_EOA, @@ -825,7 +786,8 @@ md_begin () name = alpha_opcodes[i].name; retval = hash_insert (alpha_opcode_hash, name, (PTR) &alpha_opcodes[i]); if (retval) - as_fatal (_("internal error: can't hash opcode `%s': %s"), name, retval); + as_fatal (_("internal error: can't hash opcode `%s': %s"), + name, retval); /* Some opcodes include modifiers of various sorts with a "/mod" syntax, like the architecture manual suggests. However, for @@ -912,12 +874,10 @@ md_begin () } #endif /* OBJ_ELF */ - subseg_set (text_section, 0); - -#ifdef RELOC_OP_P /* Create literal lookup hash table. */ alpha_literal_hash = hash_new (); -#endif + + subseg_set (text_section, 0); } /* The public interface to the instruction assembler. */ @@ -1177,10 +1137,13 @@ md_apply_fix3 (fixP, valueP, seg) case BFD_RELOC_ALPHA_GPDISP_HI16: { fixS *next = fixP->fx_next; - assert (next->fx_r_type == BFD_RELOC_ALPHA_GPDISP_LO16); - fixP->fx_offset = (next->fx_frag->fr_address + next->fx_where - - fixP->fx_frag->fr_address - fixP->fx_where); + /* With user-specified !gpdisp relocations, we can be missing + the matching LO16 reloc. We will have already issued an + error message. */ + if (next) + fixP->fx_offset = (next->fx_frag->fr_address + next->fx_where + - fixP->fx_frag->fr_address - fixP->fx_where); value = (value - sign_extend_16 (value)) >> 16; } @@ -1230,11 +1193,13 @@ md_apply_fix3 (fixP, valueP, seg) /* FIXME: inherited this obliviousness of `value' -- why? */ md_number_to_chars (fixpos, -alpha_gp_value, 4); break; -#endif -#ifdef OBJ_ELF +#else case BFD_RELOC_GPREL32: - return 1; #endif + case BFD_RELOC_GPREL16: + case BFD_RELOC_ALPHA_GPREL_HI16: + case BFD_RELOC_ALPHA_GPREL_LO16: + return 1; case BFD_RELOC_23_PCREL_S2: if (fixP->fx_pcrel == 0 && fixP->fx_addsy == 0) @@ -1258,33 +1223,12 @@ md_apply_fix3 (fixP, valueP, seg) case BFD_RELOC_ALPHA_LITERAL: md_number_to_chars (fixpos, value, 2); return 1; - - case BFD_RELOC_ALPHA_LITUSE: - return 1; #endif -#ifdef OBJ_ELF case BFD_RELOC_ALPHA_ELF_LITERAL: case BFD_RELOC_ALPHA_LITUSE: - return 1; -#endif -#ifdef OBJ_EVAX case BFD_RELOC_ALPHA_LINKAGE: case BFD_RELOC_ALPHA_CODEADDR: return 1; -#endif - -#ifdef RELOC_OP_P - case BFD_RELOC_ALPHA_USER_LITERAL: - case BFD_RELOC_ALPHA_USER_LITUSE_BASE: - case BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF: - case BFD_RELOC_ALPHA_USER_LITUSE_JSR: - return 1; - - case BFD_RELOC_ALPHA_USER_GPDISP: - case BFD_RELOC_ALPHA_USER_GPRELHIGH: - case BFD_RELOC_ALPHA_USER_GPRELLOW: - abort (); -#endif case BFD_RELOC_VTABLE_INHERIT: case BFD_RELOC_VTABLE_ENTRY: @@ -1355,7 +1299,7 @@ md_undefined_symbol (name) /* FALLTHRU */ case 'r': - if (!isdigit (*++name)) + if (!ISDIGIT (*++name)) break; /* FALLTHRU */ @@ -1363,7 +1307,7 @@ md_undefined_symbol (name) case '5': case '6': case '7': case '8': case '9': if (name[1] == '\0') num = name[0] - '0'; - else if (name[0] != '0' && isdigit (name[1]) && name[2] == '\0') + else if (name[0] != '0' && ISDIGIT (name[1]) && name[2] == '\0') { num = (name[0] - '0') * 10 + name[1] - '0'; if (num >= 32) @@ -1438,27 +1382,15 @@ alpha_force_relocation (f) case BFD_RELOC_ALPHA_GPDISP_HI16: case BFD_RELOC_ALPHA_GPDISP_LO16: case BFD_RELOC_ALPHA_GPDISP: -#ifdef OBJ_ECOFF case BFD_RELOC_ALPHA_LITERAL: -#endif -#ifdef OBJ_ELF case BFD_RELOC_ALPHA_ELF_LITERAL: -#endif case BFD_RELOC_ALPHA_LITUSE: + case BFD_RELOC_GPREL16: case BFD_RELOC_GPREL32: -#ifdef OBJ_EVAX + case BFD_RELOC_ALPHA_GPREL_HI16: + case BFD_RELOC_ALPHA_GPREL_LO16: case BFD_RELOC_ALPHA_LINKAGE: case BFD_RELOC_ALPHA_CODEADDR: -#endif -#ifdef RELOC_OP_P - case BFD_RELOC_ALPHA_USER_LITERAL: - case BFD_RELOC_ALPHA_USER_LITUSE_BASE: - case BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF: - case BFD_RELOC_ALPHA_USER_LITUSE_JSR: - case BFD_RELOC_ALPHA_USER_GPDISP: - case BFD_RELOC_ALPHA_USER_GPRELHIGH: - case BFD_RELOC_ALPHA_USER_GPRELLOW: -#endif case BFD_RELOC_VTABLE_INHERIT: case BFD_RELOC_VTABLE_ENTRY: return 1; @@ -1497,35 +1429,21 @@ alpha_fix_adjustable (f) case BFD_RELOC_ALPHA_GPDISP: return 0; -#ifdef OBJ_ECOFF case BFD_RELOC_ALPHA_LITERAL: -#endif -#ifdef OBJ_ELF case BFD_RELOC_ALPHA_ELF_LITERAL: -#endif -#ifdef RELOC_OP_P - case BFD_RELOC_ALPHA_USER_LITERAL: -#endif -#ifdef OBJ_EVAX + case BFD_RELOC_ALPHA_LITUSE: case BFD_RELOC_ALPHA_LINKAGE: case BFD_RELOC_ALPHA_CODEADDR: -#endif return 1; - case BFD_RELOC_ALPHA_LITUSE: -#ifdef RELOC_OP_P - case BFD_RELOC_ALPHA_USER_LITUSE_BASE: - case BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF: - case BFD_RELOC_ALPHA_USER_LITUSE_JSR: - case BFD_RELOC_ALPHA_USER_GPDISP: - case BFD_RELOC_ALPHA_USER_GPRELHIGH: - case BFD_RELOC_ALPHA_USER_GPRELLOW: -#endif case BFD_RELOC_VTABLE_ENTRY: case BFD_RELOC_VTABLE_INHERIT: return 0; + case BFD_RELOC_GPREL16: case BFD_RELOC_GPREL32: + case BFD_RELOC_ALPHA_GPREL_HI16: + case BFD_RELOC_ALPHA_GPREL_LO16: case BFD_RELOC_23_PCREL_S2: case BFD_RELOC_32: case BFD_RELOC_64: @@ -1651,31 +1569,45 @@ alpha_frob_file_before_adjust () #endif /* OBJ_ECOFF */ -#ifdef RELOC_OP_P +static struct alpha_reloc_tag * +get_alpha_reloc_tag (sequence) + long sequence; +{ + char buffer[ALPHA_RELOC_DIGITS]; + struct alpha_reloc_tag *info; + + sprintf (buffer, "!%ld", sequence); + + info = (struct alpha_reloc_tag *) hash_find (alpha_literal_hash, buffer); + if (! info) + { + size_t len = strlen (buffer); + const char *errmsg; + + info = (struct alpha_reloc_tag *) + xcalloc (sizeof (struct alpha_reloc_tag) + len, 1); + + info->segment = now_seg; + info->sequence = sequence; + strcpy (info->string, buffer); + errmsg = hash_insert (alpha_literal_hash, info->string, (PTR) info); + if (errmsg) + as_fatal (errmsg); + } + + return info; +} /* Before the relocations are written, reorder them, so that user supplied !lituse relocations follow the appropriate !literal - relocations. Also convert the gas-internal relocations to the - appropriate linker relocations. */ + relocations, and similarly for !gpdisp relocations. */ void alpha_adjust_symtab () { if (alpha_literal_hash) - { -#ifdef DEBUG2_ALPHA - fprintf (stderr, "alpha_adjust_symtab called\n"); -#endif - - /* Go over each section, reordering the relocations so that all - of the explicit LITUSE's are adjacent to the explicit - LITERAL's. */ - bfd_map_over_sections (stdoutput, alpha_adjust_symtab_relocs, - (char *) 0); - } + bfd_map_over_sections (stdoutput, alpha_adjust_symtab_relocs, NULL); } - -/* Inner function to move LITUSE's next to the LITERAL. */ static void alpha_adjust_symtab_relocs (abfd, sec, ptr) @@ -1687,14 +1619,8 @@ alpha_adjust_symtab_relocs (abfd, sec, p fixS **prevP; fixS *fixp; fixS *next; - fixS *lituse; - int n_lituses = 0; - -#ifdef DEBUG2_ALPHA - int n = 0; - int n_literals = 0; - int n_dup_literals = 0; -#endif + fixS *slave; + unsigned long n_slaves = 0; /* If seginfo is NULL, we did not create this section; don't do anything with it. By using a pointer to a pointer, we can update @@ -1706,121 +1632,94 @@ alpha_adjust_symtab_relocs (abfd, sec, p if (! seginfo->fix_root) return; - /* First rebuild the fixup chain without the expicit lituse's. */ - prevP = &(seginfo->fix_root); + /* First rebuild the fixup chain without the expicit lituse and + gpdisp_lo16 relocs. */ + prevP = &seginfo->fix_root; for (fixp = seginfo->fix_root; fixp; fixp = next) { next = fixp->fx_next; fixp->fx_next = (fixS *) 0; -#ifdef DEBUG2_ALPHA - n++; -#endif switch (fixp->fx_r_type) { - default: - *prevP = fixp; - prevP = &(fixp->fx_next); -#ifdef DEBUG2_ALPHA - fprintf (stderr, - "alpha_adjust_symtab_relocs: 0x%lx, other relocation %s\n", - (long) fixp, - bfd_get_reloc_code_name (fixp->fx_r_type)); -#endif - break; - - case BFD_RELOC_ALPHA_USER_LITERAL: - *prevP = fixp; - prevP = &(fixp->fx_next); - /* prevent assembler from trying to adjust the offset */ -#ifdef DEBUG2_ALPHA - n_literals++; - if (fixp->tc_fix_data.info->n_literals != 1) - n_dup_literals++; - fprintf (stderr, - "alpha_adjust_symtab_relocs: 0x%lx, !literal!%.6d, # literals = %2d\n", - (long) fixp, - fixp->tc_fix_data.info->sequence, - fixp->tc_fix_data.info->n_literals); -#endif + case BFD_RELOC_ALPHA_LITUSE: + n_slaves++; + if (fixp->tc_fix_data.info->n_master == 0) + as_bad_where (fixp->fx_file, fixp->fx_line, + _("No !literal!%ld was found"), + fixp->tc_fix_data.info->sequence); break; - /* do not link in lituse's */ - case BFD_RELOC_ALPHA_USER_LITUSE_BASE: - case BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF: - case BFD_RELOC_ALPHA_USER_LITUSE_JSR: - n_lituses++; - if (fixp->tc_fix_data.info->n_literals == 0) + case BFD_RELOC_ALPHA_GPDISP_LO16: + n_slaves++; + if (fixp->tc_fix_data.info->n_master == 0) as_bad_where (fixp->fx_file, fixp->fx_line, - _("No !literal!%d was found"), + _("No ldah !gpdisp!%ld was found"), fixp->tc_fix_data.info->sequence); -#ifdef DEBUG2_ALPHA - fprintf (stderr, - "alpha_adjust_symtab_relocs: 0x%lx, !lituse !%.6d, # lituses = %2d, next_lituse = 0x%lx\n", - (long) fixp, - fixp->tc_fix_data.info->sequence, - fixp->tc_fix_data.info->n_lituses, - (long) fixp->tc_fix_data.next_lituse); -#endif + break; + + default: + *prevP = fixp; + prevP = &fixp->fx_next; break; } } - /* If there were any lituses, go and add them to the chain, unless there is - more than one !literal for a given sequence number. They are linked - through the next_lituse field in reverse order, so as we go through the - next_lituse chain, we effectively reverse the chain once again. If there - was more than one !literal, we fall back to loading up the address w/o - optimization. Also, if the !literals/!lituses are spread in different - segments (happens in the Linux kernel semaphores), suppress the - optimization. */ - if (n_lituses) + /* If there were any dependent relocations, go and add them back to + the chain. They are linked through the next_reloc field in + reverse order, so as we go through the next_reloc chain, we + effectively reverse the chain once again. + + Except if there is more than one !literal for a given sequence + number. In that case, the programmer and/or compiler is not sure + how control flows from literal to lituse, and we can't be sure to + get the relaxation correct. + + ??? Well, actually we could, if there are enough lituses such that + we can make each literal have at least one of each lituse type + present. Not implemented. + + Also suppress the optimization if the !literals/!lituses are spread + in different segments. This can happen with "intersting" uses of + inline assembly; examples are present in the Linux kernel semaphores. */ + + for (fixp = seginfo->fix_root; fixp; fixp = next) { - for (fixp = seginfo->fix_root; fixp; fixp = fixp->fx_next) + next = fixp->fx_next; + switch (fixp->fx_r_type) { - switch (fixp->fx_r_type) + case BFD_RELOC_ALPHA_ELF_LITERAL: + if (fixp->tc_fix_data.info->n_master == 1 + && ! fixp->tc_fix_data.info->multi_section_p) { - default: - break; - - case BFD_RELOC_ALPHA_USER_LITERAL: -#ifdef OBJ_ELF - fixp->fx_r_type = BFD_RELOC_ALPHA_ELF_LITERAL; -#else - fixp->fx_r_type = BFD_RELOC_ALPHA_LITERAL; /* XXX check this */ -#endif - if (fixp->tc_fix_data.info->n_literals == 1 - && ! fixp->tc_fix_data.info->multi_section_p) + for (slave = fixp->tc_fix_data.info->slaves; + slave != (fixS *) 0; + slave = slave->tc_fix_data.next_reloc) { - for (lituse = fixp->tc_fix_data.info->lituse; - lituse != (fixS *) 0; - lituse = lituse->tc_fix_data.next_lituse) - { - lituse->fx_next = fixp->fx_next; - fixp->fx_next = lituse; - } + slave->fx_next = fixp->fx_next; + fixp->fx_next = slave; } - break; + } + break; - case BFD_RELOC_ALPHA_USER_LITUSE_BASE: - case BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF: - case BFD_RELOC_ALPHA_USER_LITUSE_JSR: - fixp->fx_r_type = BFD_RELOC_ALPHA_LITUSE; - break; + case BFD_RELOC_ALPHA_GPDISP_HI16: + if (fixp->tc_fix_data.info->n_slaves == 0) + as_bad_where (fixp->fx_file, fixp->fx_line, + _("No lda !gpdisp!%ld was found"), + fixp->tc_fix_data.info->sequence); + else + { + slave = fixp->tc_fix_data.info->slaves; + slave->fx_next = next; + fixp->fx_next = slave; } + break; + + default: + break; } } - -#ifdef DEBUG2_ALPHA - fprintf (stderr, "alpha_adjust_symtab_relocs: %s, %d literal%s, %d duplicate literal%s, %d lituse%s\n\n", - sec->name, - n_literals, (n_literals == 1) ? "" : "s", - n_dup_literals, (n_dup_literals == 1) ? "" : "s", - n_lituses, (n_lituses == 1) ? "" : "s"); -#endif } - -#endif /* RELOC_OP_P */ #ifdef DEBUG_ALPHA static void @@ -1877,7 +1776,7 @@ debug_exp (tok, ntok) case O_gpdisp: name = "O_gpdisp"; break; case O_gprelhigh: name = "O_gprelhigh"; break; case O_gprellow: name = "O_gprellow"; break; - case O_md10: name = "O_md10"; break; + case O_gprel: name = "O_gprel"; break; case O_md11: name = "O_md11"; break; case O_md12: name = "O_md12"; break; case O_md13: name = "O_md13"; break; @@ -1910,13 +1809,11 @@ tokenize_arguments (str, tok, ntok) #ifdef DEBUG_ALPHA expressionS *orig_tok = tok; #endif -#ifdef RELOC_OP_P char *p; const struct alpha_reloc_op_tag *r; int c, i; size_t len; int reloc_found_p = 0; -#endif memset (tok, 0, sizeof (*tok) * ntok); @@ -1924,6 +1821,11 @@ tokenize_arguments (str, tok, ntok) old_input_line_pointer = input_line_pointer; input_line_pointer = str; +#ifdef RELOC_OP_P + /* ??? Wrest control of ! away from the regular expression parser. */ + is_end_of_line[(unsigned char) '!'] = 1; +#endif + while (tok < end_tok && *input_line_pointer) { SKIP_WHITESPACE (); @@ -1946,59 +1848,66 @@ tokenize_arguments (str, tok, ntok) if (!saw_arg) goto err; - for (p = ++input_line_pointer; - ((c = *p) != '!' && c != ';' && c != '#' && c != ',' - && !is_end_of_line[c]); - p++) - ; + ++input_line_pointer; + SKIP_WHITESPACE (); + p = input_line_pointer; + c = get_symbol_end (); /* Parse !relocation_type */ - len = p - input_line_pointer; + len = input_line_pointer - p; if (len == 0) { as_bad (_("No relocation operand")); goto err_report; } - if (c != '!') - { - as_bad (_("No !sequence-number after !%s"), input_line_pointer); - goto err_report; - } - r = &alpha_reloc_op[0]; for (i = alpha_num_reloc_op - 1; i >= 0; i--, r++) - { - if (len == r->length - && memcmp (input_line_pointer, r->name, len) == 0) - break; - } + if (len == r->length && memcmp (p, r->name, len) == 0) + break; if (i < 0) { - as_bad (_("Unknown relocation operand: !%s"), - input_line_pointer); + as_bad (_("Unknown relocation operand: !%s"), p); goto err_report; } - input_line_pointer = ++p; - - /* Parse !sequence_number */ - memset (tok, '\0', sizeof (expressionS)); - expression (tok); + *input_line_pointer = c; + SKIP_WHITESPACE (); + if (*input_line_pointer != '!') + { + if (r->require_seq) + { + as_bad (_("no sequence number after !%s"), p); + goto err_report; + } - if (tok->X_op != O_constant - || ! ALPHA_RELOC_SEQUENCE_OK (tok->X_add_number)) + tok->X_add_number = 0; + } + else { - as_bad (_("Bad sequence number: !%s!%s"), - r->name, input_line_pointer); - goto err_report; + if (! r->allow_seq) + { + as_bad (_("!%s does not use a sequence number"), p); + goto err_report; + } + + input_line_pointer++; + + /* Parse !sequence_number */ + expression (tok); + if (tok->X_op != O_constant || tok->X_add_number <= 0) + { + as_bad (_("Bad sequence number: !%s!%s"), + r->name, input_line_pointer); + goto err_report; + } } tok->X_op = r->op; reloc_found_p = 1; ++tok; break; -#endif +#endif /* RELOC_OP_P */ case ',': ++input_line_pointer; @@ -2050,18 +1959,25 @@ fini: #ifdef DEBUG_ALPHA debug_exp (orig_tok, ntok - (end_tok - tok)); #endif +#ifdef RELOC_OP_P + is_end_of_line[(unsigned char) '!'] = 0; +#endif return ntok - (end_tok - tok); err: +#ifdef RELOC_OP_P + is_end_of_line[(unsigned char) '!'] = 0; +#endif input_line_pointer = old_input_line_pointer; return TOKENIZE_ERROR; -#ifdef RELOC_OP_P err_report: +#ifdef RELOC_OP_P + is_end_of_line[(unsigned char) '!'] = 0; +#endif input_line_pointer = old_input_line_pointer; return TOKENIZE_ERROR_REPORT; -#endif } /* Search forward through all variants of an opcode looking for a @@ -2249,7 +2165,6 @@ find_macro_match (first_macro, tok, pnto case O_register: case O_pregister: case O_cpregister: -#ifdef RELOC_OP_P case O_literal: case O_lituse_base: case O_lituse_bytoff: @@ -2257,7 +2172,7 @@ find_macro_match (first_macro, tok, pnto case O_gpdisp: case O_gprelhigh: case O_gprellow: -#endif + case O_gprel: goto match_failed; default: @@ -2266,38 +2181,6 @@ find_macro_match (first_macro, tok, pnto ++tokidx; break; - /* optional !literal! */ - case MACRO_LITERAL: -#ifdef RELOC_OP_P - if (tokidx < ntok && tok[tokidx].X_op == O_literal) - tokidx++; -#endif - break; - - /* optional !lituse_base! */ - case MACRO_BASE: -#ifdef RELOC_OP_P - if (tokidx < ntok && tok[tokidx].X_op == O_lituse_base) - tokidx++; -#endif - break; - - /* optional !lituse_bytoff! */ - case MACRO_BYTOFF: -#ifdef RELOC_OP_P - if (tokidx < ntok && tok[tokidx].X_op == O_lituse_bytoff) - tokidx++; -#endif - break; - - /* optional !lituse_jsr! */ - case MACRO_JSR: -#ifdef RELOC_OP_P - if (tokidx < ntok && tok[tokidx].X_op == O_lituse_jsr) - tokidx++; -#endif - break; - match_failed: while (*arg != MACRO_EOA) ++arg; @@ -2372,12 +2255,15 @@ insert_operand (insn, operand, val, file */ static void -assemble_insn (opcode, tok, ntok, insn) +assemble_insn (opcode, tok, ntok, insn, reloc) const struct alpha_opcode *opcode; const expressionS *tok; int ntok; struct alpha_insn *insn; + bfd_reloc_code_real_type reloc; { + const struct alpha_operand *reloc_operand = NULL; + const expressionS *reloc_exp = NULL; const unsigned char *argidx; unsigned image; int tokidx = 0; @@ -2433,24 +2319,85 @@ assemble_insn (opcode, tok, ntok, insn) case O_constant: image = insert_operand (image, operand, t->X_add_number, NULL, 0); + assert (reloc_operand == NULL); + reloc_operand = operand; + reloc_exp = t; break; default: - { - struct alpha_fixup *fixup; + /* This is only 0 for fields that should contain registers, + which means this pattern shouldn't have matched. */ + if (operand->default_reloc == 0) + abort (); - if (insn->nfixups >= MAX_INSN_FIXUPS) - as_fatal (_("too many fixups")); + /* There is one special case for which an insn receives two + relocations, and thus the user-supplied reloc does not + override the operand reloc. */ + if (operand->default_reloc == BFD_RELOC_ALPHA_HINT) + { + struct alpha_fixup *fixup; - fixup = &insn->fixups[insn->nfixups++]; + if (insn->nfixups >= MAX_INSN_FIXUPS) + as_fatal (_("too many fixups")); - fixup->exp = *t; - fixup->reloc = operand->default_reloc; - } + fixup = &insn->fixups[insn->nfixups++]; + fixup->exp = *t; + fixup->reloc = BFD_RELOC_ALPHA_HINT; + } + else + { + if (reloc == BFD_RELOC_UNUSED) + reloc = operand->default_reloc; + + assert (reloc_operand == NULL); + reloc_operand = operand; + reloc_exp = t; + } break; } } + if (reloc != BFD_RELOC_UNUSED) + { + struct alpha_fixup *fixup; + + if (insn->nfixups >= MAX_INSN_FIXUPS) + as_fatal (_("too many fixups")); + + /* ??? My but this is hacky. But the OSF/1 assembler uses the same + relocation tag for both ldah and lda with gpdisp. Choose the + correct internal relocation based on the opcode. */ + if (reloc == BFD_RELOC_ALPHA_GPDISP) + { + if (strcmp (opcode->name, "ldah") == 0) + reloc = BFD_RELOC_ALPHA_GPDISP_HI16; + else if (strcmp (opcode->name, "lda") == 0) + reloc = BFD_RELOC_ALPHA_GPDISP_LO16; + else + as_bad (_("invalid relocation for instruction")); + } + + /* If this is a real relocation (as opposed to a lituse hint), then + the relocation width should match the operand width. */ + else if (reloc < BFD_RELOC_UNUSED) + { + reloc_howto_type *reloc_howto + = bfd_reloc_type_lookup (stdoutput, reloc); + if (reloc_howto->bitsize != reloc_operand->bits) + { + as_bad (_("invalid relocation for field")); + return; + } + } + + fixup = &insn->fixups[insn->nfixups++]; + if (reloc_exp) + fixup->exp = *reloc_exp; + else + fixup->exp.X_op = O_absent; + fixup->reloc = reloc; + } + insn->insn = image; } @@ -2485,12 +2432,9 @@ emit_insn (insn) { const struct alpha_operand *operand = (const struct alpha_operand *) 0; struct alpha_fixup *fixup = &insn->fixups[i]; + struct alpha_reloc_tag *info; int size, pcrel; fixS *fixP; -#ifdef RELOC_OP_P - char buffer[ALPHA_RELOC_DIGITS]; - struct alpha_literal_tag *info; -#endif /* Some fixups are only used internally and so have no howto */ if ((int) fixup->reloc < 0) @@ -2499,43 +2443,24 @@ emit_insn (insn) size = 4; pcrel = ((operand->flags & AXP_OPERAND_RELATIVE) != 0); } + else if (fixup->reloc > BFD_RELOC_UNUSED + || fixup->reloc == BFD_RELOC_ALPHA_GPDISP_HI16 + || fixup->reloc == BFD_RELOC_ALPHA_GPDISP_LO16) + { + size = 2; + pcrel = 0; + } else - switch (fixup->reloc) - { -#ifdef OBJ_ELF - /* These relocation types are only used internally. */ - case BFD_RELOC_ALPHA_GPDISP_HI16: - case BFD_RELOC_ALPHA_GPDISP_LO16: - size = 2; - pcrel = 0; - break; -#endif -#ifdef RELOC_OP_P - /* and these also are internal only relocations */ - case BFD_RELOC_ALPHA_USER_LITERAL: - case BFD_RELOC_ALPHA_USER_LITUSE_BASE: - case BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF: - case BFD_RELOC_ALPHA_USER_LITUSE_JSR: - case BFD_RELOC_ALPHA_USER_GPDISP: - case BFD_RELOC_ALPHA_USER_GPRELHIGH: - case BFD_RELOC_ALPHA_USER_GPRELLOW: - size = 2; - pcrel = 0; - break; -#endif + { + reloc_howto_type *reloc_howto + = bfd_reloc_type_lookup (stdoutput, fixup->reloc); + assert (reloc_howto); - default: - { - reloc_howto_type *reloc_howto - = bfd_reloc_type_lookup (stdoutput, fixup->reloc); - assert (reloc_howto); + size = bfd_get_reloc_size (reloc_howto); + assert (size >= 1 && size <= 4); - size = bfd_get_reloc_size (reloc_howto); - pcrel = reloc_howto->pc_relative; - } - assert (size >= 1 && size <= 4); - break; - } + pcrel = reloc_howto->pc_relative; + } fixP = fix_new_exp (frag_now, f - frag_now->fr_literal, size, &fixup->exp, pcrel, fixup->reloc); @@ -2544,79 +2469,75 @@ emit_insn (insn) and copy in the sequence number for the explicit relocations. */ switch (fixup->reloc) { - case BFD_RELOC_ALPHA_GPDISP_LO16: -#ifdef OBJ_ECOFF - case BFD_RELOC_ALPHA_LITERAL: -#endif -#ifdef OBJ_ELF - case BFD_RELOC_ALPHA_ELF_LITERAL: -#endif + case BFD_RELOC_ALPHA_HINT: case BFD_RELOC_GPREL32: + case BFD_RELOC_GPREL16: + case BFD_RELOC_ALPHA_GPREL_HI16: + case BFD_RELOC_ALPHA_GPREL_LO16: fixP->fx_no_overflow = 1; break; -#ifdef RELOC_OP_P - case BFD_RELOC_ALPHA_USER_LITERAL: + case BFD_RELOC_ALPHA_GPDISP_HI16: fixP->fx_no_overflow = 1; - sprintf (buffer, "!%u", insn->sequence[i]); - info = ((struct alpha_literal_tag *) - hash_find (alpha_literal_hash, buffer)); + fixP->fx_addsy = section_symbol (now_seg); + fixP->fx_offset = 0; - if (! info) - { - size_t len = strlen (buffer); - const char *errmsg; + info = get_alpha_reloc_tag (insn->sequence); + if (++info->n_master > 1) + as_bad (_("too many ldah insns for !gpdisp!%ld"), insn->sequence); + if (info->segment != now_seg) + as_bad (_("both insns for !gpdisp!%ld must be in the same section"), + insn->sequence); + fixP->tc_fix_data.info = info; + break; - info = ((struct alpha_literal_tag *) - xcalloc (sizeof (struct alpha_literal_tag) + len, 1)); + case BFD_RELOC_ALPHA_GPDISP_LO16: + fixP->fx_no_overflow = 1; - info->segment = now_seg; - info->sequence = insn->sequence[i]; - strcpy (info->string, buffer); - errmsg = hash_insert (alpha_literal_hash, info->string, (PTR) info); - if (errmsg) - as_bad (errmsg); - } + info = get_alpha_reloc_tag (insn->sequence); + if (++info->n_slaves > 1) + as_bad (_("too many lda insns for !gpdisp!%ld"), insn->sequence); + if (info->segment != now_seg) + as_bad (_("both insns for !gpdisp!%ld must be in the same section"), + insn->sequence); + fixP->tc_fix_data.info = info; + info->slaves = fixP; + break; - ++info->n_literals; + case BFD_RELOC_ALPHA_LITERAL: + case BFD_RELOC_ALPHA_ELF_LITERAL: + fixP->fx_no_overflow = 1; + info = get_alpha_reloc_tag (insn->sequence); + info->n_master++; if (info->segment != now_seg) info->multi_section_p = 1; - fixP->tc_fix_data.info = info; break; - case BFD_RELOC_ALPHA_USER_LITUSE_BASE: - case BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF: - case BFD_RELOC_ALPHA_USER_LITUSE_JSR: - sprintf (buffer, "!%u", insn->sequence[i]); - info = ((struct alpha_literal_tag *) - hash_find (alpha_literal_hash, buffer)); - - if (! info) - { - size_t len = strlen (buffer); - const char *errmsg; + case DUMMY_RELOC_LITUSE_ADDR: + fixP->fx_offset = LITUSE_ADDR; + goto do_lituse; + case DUMMY_RELOC_LITUSE_BASE: + fixP->fx_offset = LITUSE_BASE; + goto do_lituse; + case DUMMY_RELOC_LITUSE_BYTOFF: + fixP->fx_offset = LITUSE_BYTOFF; + goto do_lituse; + case DUMMY_RELOC_LITUSE_JSR: + fixP->fx_offset = LITUSE_JSR; + do_lituse: + fixP->fx_addsy = section_symbol (now_seg); + fixP->fx_r_type = BFD_RELOC_ALPHA_LITUSE; - info = ((struct alpha_literal_tag *) - xcalloc (sizeof (struct alpha_literal_tag) + len, 1)); - - info->segment = now_seg; - info->sequence = insn->sequence[i]; - strcpy (info->string, buffer); - errmsg = hash_insert (alpha_literal_hash, info->string, (PTR) info); - if (errmsg) - as_bad (errmsg); - } - info->n_lituses++; + info = get_alpha_reloc_tag (insn->sequence); + info->n_slaves++; fixP->tc_fix_data.info = info; - fixP->tc_fix_data.next_lituse = info->lituse; - info->lituse = fixP; + fixP->tc_fix_data.next_reloc = info->slaves; + info->slaves = fixP; if (info->segment != now_seg) info->multi_section_p = 1; - break; -#endif default: if ((int) fixup->reloc < 0) @@ -2652,7 +2573,7 @@ assemble_tokens_to_insn (opname, tok, nt opcode = find_opcode_match (opcode, tok, &ntok, &cpumatch); if (opcode) { - assemble_insn (opcode, tok, ntok, insn); + assemble_insn (opcode, tok, ntok, insn, BFD_RELOC_UNUSED); return; } else if (cpumatch) @@ -2679,9 +2600,15 @@ assemble_tokens (opname, tok, ntok, loca const struct alpha_opcode *opcode; const struct alpha_macro *macro; int cpumatch = 1; + bfd_reloc_code_real_type reloc = BFD_RELOC_UNUSED; - /* search macros */ - if (local_macros_on) + /* If a user-specified relocation is present, this is not a macro. */ + if (ntok && USER_RELOC_P (tok[ntok - 1].X_op)) + { + reloc = ALPHA_RELOC_TABLE (tok[ntok - 1].X_op)->reloc; + ntok--; + } + else if (local_macros_on) { macro = ((const struct alpha_macro *) hash_find (alpha_macro_hash, opname)); @@ -2697,17 +2624,6 @@ assemble_tokens (opname, tok, ntok, loca } } -#ifdef RELOC_OP_P - if (ntok && USER_RELOC_P (tok[ntok - 1].X_op)) - { - const expressionS *reloc_exp = &tok[ntok - 1]; - const struct alpha_reloc_op_tag *r = ALPHA_RELOC_TABLE (reloc_exp->X_op); - as_bad (_("Cannot use !%s!%d with %s"), r->name, - (int) reloc_exp->X_add_number, opname); - ntok--; - } -#endif - /* search opcodes */ opcode = (const struct alpha_opcode *) hash_find (alpha_opcode_hash, opname); if (opcode) @@ -2717,18 +2633,25 @@ assemble_tokens (opname, tok, ntok, loca if (opcode) { struct alpha_insn insn; - assemble_insn (opcode, tok, ntok, &insn); + assemble_insn (opcode, tok, ntok, &insn, reloc); + + /* Copy the sequence number for the reloc from the reloc token. */ + if (reloc != BFD_RELOC_UNUSED) + insn.sequence = tok[ntok].X_add_number; + emit_insn (&insn); return; } } if (found_something) - if (cpumatch) - as_bad (_("inappropriate arguments for opcode `%s'"), opname); - else - as_bad (_("opcode `%s' not supported for target %s"), opname, - alpha_target_name); + { + if (cpumatch) + as_bad (_("inappropriate arguments for opcode `%s'"), opname); + else + as_bad (_("opcode `%s' not supported for target %s"), opname, + alpha_target_name); + } else as_bad (_("unknown opcode `%s'"), opname); } @@ -2763,17 +2686,6 @@ FIXME expressionS newtok[3]; expressionS addend; -#ifdef RELOC_OP_P - if (ntok && USER_RELOC_P (tok[ntok - 1].X_op)) - { - const expressionS *reloc_exp = &tok[ntok - 1]; - const struct alpha_reloc_op_tag *r = ALPHA_RELOC_TABLE (reloc_exp->X_op); - as_bad (_("Cannot use !%s!%d with %s"), r->name, - (int) reloc_exp->X_add_number, "ldgp"); - ntok--; - } -#endif - #ifdef OBJ_ECOFF if (regno (tok[2].X_add_number) == AXP_REG_PV) ecoff_set_gp_prolog_size (0); @@ -2797,6 +2709,7 @@ FIXME insn.nfixups = 1; insn.fixups[0].exp = addend; insn.fixups[0].reloc = BFD_RELOC_ALPHA_GPDISP_HI16; + insn.sequence = next_sequence_num; emit_insn (&insn); @@ -2811,6 +2724,7 @@ FIXME insn.nfixups = 1; insn.fixups[0].exp = addend; insn.fixups[0].reloc = BFD_RELOC_ALPHA_GPDISP_LO16; + insn.sequence = next_sequence_num--; emit_insn (&insn); #endif /* OBJ_ECOFF || OBJ_ELF */ @@ -2890,18 +2804,18 @@ add_to_link_pool (basesym, sym, addend) If explicit relocations of the form !literal! are allowed, and used, then explict_reloc with be an expression pointer. - Finally, the return value is true if the calling macro may emit a - LITUSE reloc if otherwise appropriate. */ + Finally, the return value is nonzero if the calling macro may emit + a LITUSE reloc if otherwise appropriate; the return value is the + sequence number to use. */ -static int -load_expression (targreg, exp, pbasereg, poffset, explicit_reloc) +static long +load_expression (targreg, exp, pbasereg, poffset) int targreg; const expressionS *exp; int *pbasereg; expressionS *poffset; - const expressionS *explicit_reloc; { - int emit_lituse = 0; + long emit_lituse = 0; offsetT addend = exp->X_add_number; int basereg = *pbasereg; struct alpha_insn insn; @@ -2951,9 +2865,9 @@ load_expression (targreg, exp, pbasereg, assemble_tokens_to_insn ("ldq", newtok, 3, &insn); - assert (explicit_reloc == (const expressionS *) 0); assert (insn.nfixups == 1); insn.fixups[0].reloc = BFD_RELOC_ALPHA_LITERAL; + insn.sequence = emit_lituse = next_sequence_num--; #endif /* OBJ_ECOFF */ #ifdef OBJ_ELF /* emit "ldq r, gotoff(gp)" */ @@ -2990,25 +2904,14 @@ load_expression (targreg, exp, pbasereg, assemble_tokens_to_insn ("ldq", newtok, 3, &insn); assert (insn.nfixups == 1); - if (!explicit_reloc) - insn.fixups[0].reloc = BFD_RELOC_ALPHA_ELF_LITERAL; - else - { -#ifdef RELOC_OP_P - insn.fixups[0].reloc - = (ALPHA_RELOC_TABLE (explicit_reloc->X_op))->reloc; - insn.sequence[0] = explicit_reloc->X_add_number; -#else - abort (); -#endif - } + insn.fixups[0].reloc = BFD_RELOC_ALPHA_ELF_LITERAL; + insn.sequence = emit_lituse = next_sequence_num--; #endif /* OBJ_ELF */ #ifdef OBJ_EVAX offsetT link; /* Find symbol or symbol pointer in link section. */ - assert (explicit_reloc == (const expressionS *) 0); if (exp->X_add_symbol == alpha_evax_proc.symbol) { if (range_signed_16 (addend)) @@ -3050,8 +2953,6 @@ load_expression (targreg, exp, pbasereg, emit_insn (&insn); #ifndef OBJ_EVAX - emit_lituse = 1; - if (basereg != alpha_gp_register && basereg != AXP_REG_ZERO) { /* emit "addq r, base, r" */ @@ -3067,14 +2968,12 @@ load_expression (targreg, exp, pbasereg, break; case O_constant: - assert (explicit_reloc == (const expressionS *) 0); break; case O_subtract: /* Assume that this difference expression will be resolved to an absolute value and that that value will fit in 16 bits. */ - assert (explicit_reloc == (const expressionS *) 0); set_tok_reg (newtok[0], targreg); newtok[1] = *exp; set_tok_preg (newtok[2], basereg); @@ -3101,8 +3000,9 @@ load_expression (targreg, exp, pbasereg, if (!range_signed_32 (addend)) { offsetT lit; + long seq_num = next_sequence_num--; - /* for 64-bit addends, just put it in the literal pool */ + /* For 64-bit addends, just put it in the literal pool. */ #ifdef OBJ_EVAX /* emit "ldq targreg, lit(basereg)" */ @@ -3162,6 +3062,7 @@ load_expression (targreg, exp, pbasereg, #ifdef OBJ_ELF insn.fixups[0].reloc = BFD_RELOC_ALPHA_ELF_LITERAL; #endif + insn.sequence = seq_num; emit_insn (&insn); @@ -3173,16 +3074,10 @@ load_expression (targreg, exp, pbasereg, assemble_tokens_to_insn ("ldq", newtok, 3, &insn); assert (insn.nfixups < MAX_INSN_FIXUPS); - if (insn.nfixups > 0) - { - memmove (&insn.fixups[1], &insn.fixups[0], - sizeof (struct alpha_fixup) * insn.nfixups); - } + insn.fixups[insn.nfixups].reloc = DUMMY_RELOC_LITUSE_BASE; + insn.fixups[insn.nfixups].exp.X_op = O_absent; insn.nfixups++; - insn.fixups[0].reloc = BFD_RELOC_ALPHA_LITUSE; - insn.fixups[0].exp.X_op = O_symbol; - insn.fixups[0].exp.X_add_symbol = section_symbol (now_seg); - insn.fixups[0].exp.X_add_number = LITUSE_BASE; + insn.sequence = seq_num; emit_lituse = 0; emit_insn (&insn); @@ -3262,66 +3157,19 @@ load_expression (targreg, exp, pbasereg, large constants. */ static void -emit_lda (tok, ntok, opname) +emit_lda (tok, ntok, unused) const expressionS *tok; int ntok; - const PTR opname; + const PTR unused ATTRIBUTE_UNUSED; { int basereg; - const expressionS *reloc = (const expressionS *) 0; - -#ifdef RELOC_OP_P - if (ntok && USER_RELOC_P (tok[ntok - 1].X_op)) - { - const struct alpha_reloc_op_tag *r; - - reloc = &tok[ntok - 1]; - r = ALPHA_RELOC_TABLE (reloc->X_op); - switch (reloc->X_op) - { - default: - as_bad (_("Cannot use !%s!%d with %s"), r->name, - (int) reloc->X_add_number, (const char *) opname); - - reloc = (const expressionS *) 0; - ntok--; - break; - - case O_literal: - ntok--; - break; - - /* For lda $x,0($x)!lituse_base!y, don't use load_expression, since - it is really too general for our needs. Instead just generate the - lda directly. */ - case O_lituse_base: - if (ntok != 4 - || tok[0].X_op != O_register - || !is_ir_num (tok[0].X_add_number) - || tok[1].X_op != O_constant - || tok[2].X_op != O_pregister - || !is_ir_num (tok[2].X_add_number)) - { - as_bad (_("bad instruction format for lda !%s!%ld"), r->name, - (long) reloc->X_add_number); - - reloc = (const expressionS *) 0; - ntok--; - break; - } - - emit_loadstore (tok, ntok, "lda"); - return; - } - } -#endif if (ntok == 2) basereg = (tok[1].X_op == O_constant ? AXP_REG_ZERO : alpha_gp_register); else basereg = tok[2].X_add_number; - (void) load_expression (tok[0].X_add_number, &tok[1], &basereg, NULL, reloc); + (void) load_expression (tok[0].X_add_number, &tok[1], &basereg, NULL); } /* The ldah macro differs from the ldah instruction in that it has $31 @@ -3335,17 +3183,6 @@ emit_ldah (tok, ntok, unused) { expressionS newtok[3]; -#ifdef RELOC_OP_P - if (ntok && USER_RELOC_P (tok[ntok - 1].X_op)) - { - const expressionS *reloc_exp = &tok[ntok - 1]; - const struct alpha_reloc_op_tag *r = ALPHA_RELOC_TABLE (reloc_exp->X_op); - as_bad (_("Cannot use !%s!%d with %s"), r->name, - (int) reloc_exp->X_add_number, "ldah"); - ntok--; - } -#endif - newtok[0] = tok[0]; newtok[1] = tok[1]; set_tok_preg (newtok[2], AXP_REG_ZERO); @@ -3363,83 +3200,31 @@ emit_ir_load (tok, ntok, opname) int ntok; const PTR opname; { - int basereg, lituse; + int basereg; + long lituse; expressionS newtok[3]; struct alpha_insn insn; -#ifdef RELOC_OP_P - const expressionS *reloc = (const expressionS *) 0; - - if (ntok && USER_RELOC_P (tok[ntok - 1].X_op)) - { - const struct alpha_reloc_op_tag *r; - - reloc = &tok[ntok - 1]; - switch (reloc->X_op) - { - case O_lituse_base: - ntok--; - break; - - case O_literal: - if (strcmp ((const char *) opname, "ldq") == 0) - { - emit_lda (tok, ntok, opname); - return; - } - - /* fall through */ - default: - ntok--; - r = ALPHA_RELOC_TABLE (reloc->X_op); - as_bad (_("Cannot use !%s!%d with %s"), r->name, - (int) reloc->X_add_number, (const char *) opname); - } - } -#endif - if (ntok == 2) basereg = (tok[1].X_op == O_constant ? AXP_REG_ZERO : alpha_gp_register); else basereg = tok[2].X_add_number; lituse = load_expression (tok[0].X_add_number, &tok[1], &basereg, - &newtok[1], (const expressionS *) 0); + &newtok[1]); newtok[0] = tok[0]; set_tok_preg (newtok[2], basereg); assemble_tokens_to_insn ((const char *) opname, newtok, 3, &insn); -#ifdef RELOC_OP_P - if (reloc) - { - int nfixups = insn.nfixups; - const struct alpha_reloc_op_tag *r = ALPHA_RELOC_TABLE (reloc->X_op); - - assert (nfixups < MAX_INSN_FIXUPS); - insn.fixups[nfixups].reloc = r->reloc; - insn.fixups[nfixups].exp.X_op = O_symbol; - insn.fixups[nfixups].exp.X_add_symbol = section_symbol (now_seg); - insn.fixups[nfixups].exp.X_add_number = r->lituse; - insn.sequence[nfixups] = reloc->X_add_number; - insn.nfixups++; - } -#endif - if (lituse) { assert (insn.nfixups < MAX_INSN_FIXUPS); - if (insn.nfixups > 0) - { - memmove (&insn.fixups[1], &insn.fixups[0], - sizeof (struct alpha_fixup) * insn.nfixups); - } + insn.fixups[insn.nfixups].reloc = DUMMY_RELOC_LITUSE_BASE; + insn.fixups[insn.nfixups].exp.X_op = O_absent; insn.nfixups++; - insn.fixups[0].reloc = BFD_RELOC_ALPHA_LITUSE; - insn.fixups[0].exp.X_op = O_symbol; - insn.fixups[0].exp.X_add_symbol = section_symbol (now_seg); - insn.fixups[0].exp.X_add_number = LITUSE_BASE; + insn.sequence = lituse; } emit_insn (&insn); @@ -3454,25 +3239,11 @@ emit_loadstore (tok, ntok, opname) int ntok; const PTR opname; { - int basereg, lituse; + int basereg; + long lituse; expressionS newtok[3]; struct alpha_insn insn; -#ifdef RELOC_OP_P - const expressionS *reloc = (const expressionS *) 0; - - if (ntok && USER_RELOC_P (tok[ntok - 1].X_op)) - { - reloc = &tok[--ntok]; - if (reloc->X_op != O_lituse_base) - { - const struct alpha_reloc_op_tag *r = &alpha_reloc_op[reloc->X_md]; - as_bad (_("Cannot use !%s!%d with %s"), r->name, - (int) reloc->X_add_number, (const char *) opname); - } - } -#endif - if (ntok == 2) basereg = (tok[1].X_op == O_constant ? AXP_REG_ZERO : alpha_gp_register); else @@ -3483,8 +3254,7 @@ emit_loadstore (tok, ntok, opname) if (alpha_noat_on) as_bad (_("macro requires $at register while noat in effect")); - lituse = load_expression (AXP_REG_AT, &tok[1], &basereg, &newtok[1], - (const expressionS *) 0); + lituse = load_expression (AXP_REG_AT, &tok[1], &basereg, &newtok[1]); } else { @@ -3497,35 +3267,13 @@ emit_loadstore (tok, ntok, opname) assemble_tokens_to_insn ((const char *) opname, newtok, 3, &insn); -#ifdef RELOC_OP_P - if (reloc) - { - int nfixups = insn.nfixups; - const struct alpha_reloc_op_tag *r = ALPHA_RELOC_TABLE (reloc->X_op); - - assert (nfixups < MAX_INSN_FIXUPS); - insn.fixups[nfixups].reloc = r->reloc; - insn.fixups[nfixups].exp.X_op = O_symbol; - insn.fixups[nfixups].exp.X_add_symbol = section_symbol (now_seg); - insn.fixups[nfixups].exp.X_add_number = r->lituse; - insn.sequence[nfixups] = reloc->X_add_number; - insn.nfixups++; - } -#endif - if (lituse) { assert (insn.nfixups < MAX_INSN_FIXUPS); - if (insn.nfixups > 0) - { - memmove (&insn.fixups[1], &insn.fixups[0], - sizeof (struct alpha_fixup) * insn.nfixups); - } + insn.fixups[insn.nfixups].reloc = DUMMY_RELOC_LITUSE_BASE; + insn.fixups[insn.nfixups].exp.X_op = O_absent; insn.nfixups++; - insn.fixups[0].reloc = BFD_RELOC_ALPHA_LITUSE; - insn.fixups[0].exp.X_op = O_symbol; - insn.fixups[0].exp.X_add_symbol = section_symbol (now_seg); - insn.fixups[0].exp.X_add_number = LITUSE_BASE; + insn.sequence = lituse; } emit_insn (&insn); @@ -3544,41 +3292,57 @@ emit_ldXu (tok, ntok, vlgsize) else { expressionS newtok[3]; - -#ifdef RELOC_OP_P - if (ntok && USER_RELOC_P (tok[ntok - 1].X_op)) - { - const expressionS *reloc_exp = &tok[ntok - 1]; - const struct alpha_reloc_op_tag *r - = ALPHA_RELOC_TABLE (reloc_exp->X_op); - - as_bad (_("Cannot use !%s!%d with %s"), r->name, - (int) reloc_exp->X_add_number, "ldbu/ldwu"); - ntok--; - } -#endif + struct alpha_insn insn; + int basereg; + long lituse; if (alpha_noat_on) as_bad (_("macro requires $at register while noat in effect")); + if (ntok == 2) + basereg = (tok[1].X_op == O_constant + ? AXP_REG_ZERO : alpha_gp_register); + else + basereg = tok[2].X_add_number; + /* emit "lda $at, exp" */ - memcpy (newtok, tok, sizeof (expressionS) * ntok); - newtok[0].X_add_number = AXP_REG_AT; - assemble_tokens ("lda", newtok, ntok, 1); + lituse = load_expression (AXP_REG_AT, &tok[1], &basereg, NULL); /* emit "ldq_u targ, 0($at)" */ newtok[0] = tok[0]; set_tok_const (newtok[1], 0); - set_tok_preg (newtok[2], AXP_REG_AT); - assemble_tokens ("ldq_u", newtok, 3, 1); + set_tok_preg (newtok[2], basereg); + assemble_tokens_to_insn ("ldq_u", newtok, 3, &insn); + + if (lituse) + { + assert (insn.nfixups < MAX_INSN_FIXUPS); + insn.fixups[insn.nfixups].reloc = DUMMY_RELOC_LITUSE_BASE; + insn.fixups[insn.nfixups].exp.X_op = O_absent; + insn.nfixups++; + insn.sequence = lituse; + } + + emit_insn (&insn); /* emit "extXl targ, $at, targ" */ - set_tok_reg (newtok[1], AXP_REG_AT); + set_tok_reg (newtok[1], basereg); newtok[2] = newtok[0]; - assemble_tokens (extXl_op[(long) vlgsize], newtok, 3, 1); + assemble_tokens_to_insn (extXl_op[(long) vlgsize], newtok, 3, &insn); + + if (lituse) + { + assert (insn.nfixups < MAX_INSN_FIXUPS); + insn.fixups[insn.nfixups].reloc = DUMMY_RELOC_LITUSE_BYTOFF; + insn.fixups[insn.nfixups].exp.X_op = O_absent; + insn.nfixups++; + insn.sequence = lituse; + } + + emit_insn (&insn); } } @@ -3673,17 +3437,6 @@ emit_ldil (tok, ntok, unused) { expressionS newtok[2]; -#ifdef RELOC_OP_P - if (ntok && USER_RELOC_P (tok[ntok - 1].X_op)) - { - const expressionS *reloc_exp = &tok[ntok - 1]; - const struct alpha_reloc_op_tag *r = ALPHA_RELOC_TABLE (reloc_exp->X_op); - as_bad (_("Cannot use !%s!%d with %s"), r->name, - (int) reloc_exp->X_add_number, "ldil"); - ntok--; - } -#endif - memcpy (newtok, tok, sizeof (newtok)); newtok[1].X_add_number = sign_extend_32 (tok[1].X_add_number); @@ -3705,35 +3458,75 @@ emit_stX (tok, ntok, vlgsize) else { expressionS newtok[3]; + struct alpha_insn insn; + int basereg; + long lituse; if (alpha_noat_on) as_bad (_("macro requires $at register while noat in effect")); + if (ntok == 2) + basereg = (tok[1].X_op == O_constant + ? AXP_REG_ZERO : alpha_gp_register); + else + basereg = tok[2].X_add_number; + /* emit "lda $at, exp" */ - memcpy (newtok, tok, sizeof (expressionS) * ntok); - newtok[0].X_add_number = AXP_REG_AT; - assemble_tokens ("lda", newtok, ntok, 1); + lituse = load_expression (AXP_REG_AT, &tok[1], &basereg, NULL); /* emit "ldq_u $t9, 0($at)" */ set_tok_reg (newtok[0], AXP_REG_T9); set_tok_const (newtok[1], 0); - set_tok_preg (newtok[2], AXP_REG_AT); - assemble_tokens ("ldq_u", newtok, 3, 1); + set_tok_preg (newtok[2], basereg); + assemble_tokens_to_insn ("ldq_u", newtok, 3, &insn); + + if (lituse) + { + assert (insn.nfixups < MAX_INSN_FIXUPS); + insn.fixups[insn.nfixups].reloc = DUMMY_RELOC_LITUSE_BASE; + insn.fixups[insn.nfixups].exp.X_op = O_absent; + insn.nfixups++; + insn.sequence = lituse; + } + + emit_insn (&insn); /* emit "insXl src, $at, $t10" */ newtok[0] = tok[0]; - set_tok_reg (newtok[1], AXP_REG_AT); + set_tok_reg (newtok[1], basereg); set_tok_reg (newtok[2], AXP_REG_T10); - assemble_tokens (insXl_op[lgsize], newtok, 3, 1); + assemble_tokens_to_insn (insXl_op[lgsize], newtok, 3, &insn); + + if (lituse) + { + assert (insn.nfixups < MAX_INSN_FIXUPS); + insn.fixups[insn.nfixups].reloc = DUMMY_RELOC_LITUSE_BYTOFF; + insn.fixups[insn.nfixups].exp.X_op = O_absent; + insn.nfixups++; + insn.sequence = lituse; + } + + emit_insn (&insn); /* emit "mskXl $t9, $at, $t9" */ set_tok_reg (newtok[0], AXP_REG_T9); newtok[2] = newtok[0]; - assemble_tokens (mskXl_op[lgsize], newtok, 3, 1); + assemble_tokens_to_insn (mskXl_op[lgsize], newtok, 3, &insn); + + if (lituse) + { + assert (insn.nfixups < MAX_INSN_FIXUPS); + insn.fixups[insn.nfixups].reloc = DUMMY_RELOC_LITUSE_BYTOFF; + insn.fixups[insn.nfixups].exp.X_op = O_absent; + insn.nfixups++; + insn.sequence = lituse; + } + + emit_insn (&insn); /* emit "or $t9, $t10, $t9" */ @@ -3742,9 +3535,20 @@ emit_stX (tok, ntok, vlgsize) /* emit "stq_u $t9, 0($at) */ - set_tok_const (newtok[1], 0); + set_tok_const(newtok[1], 0); set_tok_preg (newtok[2], AXP_REG_AT); - assemble_tokens ("stq_u", newtok, 3, 1); + assemble_tokens_to_insn ("stq_u", newtok, 3, &insn); + + if (lituse) + { + assert (insn.nfixups < MAX_INSN_FIXUPS); + insn.fixups[insn.nfixups].reloc = DUMMY_RELOC_LITUSE_BASE; + insn.fixups[insn.nfixups].exp.X_op = O_absent; + insn.nfixups++; + insn.sequence = lituse; + } + + emit_insn (&insn); } } @@ -3848,19 +3652,6 @@ emit_sextX (tok, ntok, vlgsize) int bitshift = 64 - 8 * (1 << lgsize); expressionS newtok[3]; -#ifdef RELOC_OP_P - if (ntok && USER_RELOC_P (tok[ntok - 1].X_op)) - { - const expressionS *reloc_exp = &tok[ntok - 1]; - const struct alpha_reloc_op_tag *r - = ALPHA_RELOC_TABLE (reloc_exp->X_op); - - as_bad (_("Cannot use !%s!%d with %s"), r->name, - (int) reloc_exp->X_add_number, "setxt"); - ntok--; - } -#endif - /* emit "sll src,bits,dst" */ newtok[0] = tok[0]; @@ -3907,17 +3698,6 @@ emit_division (tok, ntok, symname) symbolS *sym; expressionS newtok[3]; -#ifdef RELOC_OP_P - if (ntok && USER_RELOC_P (tok[ntok - 1].X_op)) - { - const expressionS *reloc_exp = &tok[ntok - 1]; - const struct alpha_reloc_op_tag *r = ALPHA_RELOC_TABLE (reloc_exp->X_op); - as_bad (_("Cannot use !%s!%d with %s"), r->name, - (int) reloc_exp->X_add_number, (char char *) symname); - ntok--; - } -#endif - xr = regno (tok[0].X_add_number); yr = regno (tok[1].X_add_number); @@ -4017,17 +3797,6 @@ emit_division (tok, ntok, symname) symbolS *sym; expressionS newtok[3]; -#ifdef RELOC_OP_P - if (ntok && USER_RELOC_P (tok[ntok - 1].X_op)) - { - const expressionS *reloc_exp = &tok[ntok - 1]; - const struct alpha_reloc_op_tag *r = ALPHA_RELOC_TABLE (reloc_exp->X_op); - as_bad (_("Cannot use !%s!%d with %s"), r->name, - (int) reloc_exp->X_add_number, (const char *) symname); - ntok--; - } -#endif - xr = regno (tok[0].X_add_number); yr = regno (tok[1].X_add_number); @@ -4122,18 +3891,8 @@ emit_jsrjmp (tok, ntok, vopname) const char *opname = (const char *) vopname; struct alpha_insn insn; expressionS newtok[3]; - int r, tokidx = 0, lituse = 0; - -#ifdef RELOC_OP_P - if (ntok && USER_RELOC_P (tok[ntok - 1].X_op)) - { - const expressionS *reloc_exp = &tok[ntok - 1]; - const struct alpha_reloc_op_tag *r = ALPHA_RELOC_TABLE (reloc_exp->X_op); - as_bad (_("Cannot use !%s!%d with %s"), r->name, - (int) reloc_exp->X_add_number, opname); - ntok--; - } -#endif + int r, tokidx = 0; + long lituse = 0; if (tokidx < ntok && tok[tokidx].X_op == O_register) r = regno (tok[tokidx++].X_add_number); @@ -4151,8 +3910,7 @@ emit_jsrjmp (tok, ntok, vopname) else { int basereg = alpha_gp_register; - lituse = load_expression (r = AXP_REG_PV, &tok[tokidx], &basereg, NULL, - (const expressionS *) 0); + lituse = load_expression (r = AXP_REG_PV, &tok[tokidx], &basereg, NULL); } #endif @@ -4169,20 +3927,13 @@ emit_jsrjmp (tok, ntok, vopname) assemble_tokens_to_insn (opname, newtok, 3, &insn); - /* add the LITUSE fixup */ if (lituse) { assert (insn.nfixups < MAX_INSN_FIXUPS); - if (insn.nfixups > 0) - { - memmove (&insn.fixups[1], &insn.fixups[0], - sizeof (struct alpha_fixup) * insn.nfixups); - } + insn.fixups[insn.nfixups].reloc = DUMMY_RELOC_LITUSE_JSR; + insn.fixups[insn.nfixups].exp.X_op = O_absent; insn.nfixups++; - insn.fixups[0].reloc = BFD_RELOC_ALPHA_LITUSE; - insn.fixups[0].exp.X_op = O_symbol; - insn.fixups[0].exp.X_add_symbol = section_symbol (now_seg); - insn.fixups[0].exp.X_add_number = LITUSE_JSR; + insn.sequence = lituse; } emit_insn (&insn); @@ -4201,17 +3952,6 @@ emit_retjcr (tok, ntok, vopname) expressionS newtok[3]; int r, tokidx = 0; -#ifdef RELOC_OP_P - if (ntok && USER_RELOC_P (tok[ntok - 1].X_op)) - { - const expressionS *reloc_exp = &tok[ntok - 1]; - const struct alpha_reloc_op_tag *r = ALPHA_RELOC_TABLE (reloc_exp->X_op); - as_bad (_("Cannot use !%s!%d with %s"), r->name, - (int) reloc_exp->X_add_number, opname); - ntok--; - } -#endif - if (tokidx < ntok && tok[tokidx].X_op == O_register) r = regno (tok[tokidx++].X_add_number); else @@ -4474,7 +4214,7 @@ s_alpha_ent (dummy) input_line_pointer++; SKIP_WHITESPACE (); } - if (isdigit (*input_line_pointer) || *input_line_pointer == '-') + if (ISDIGIT (*input_line_pointer) || *input_line_pointer == '-') (void) get_absolute_expression (); } demand_empty_rest_of_line (); @@ -5659,6 +5399,34 @@ select_gp_value () } #endif /* OBJ_ECOFF */ +#ifdef OBJ_ELF +/* Map 's' to SHF_ALPHA_GPREL. */ + +int +alpha_elf_section_letter (letter, ptr_msg) + int letter; + char **ptr_msg; +{ + if (letter == 's') + return SHF_ALPHA_GPREL; + + *ptr_msg = _("Bad .section directive: want a,s,w,x,M,S in string"); + return 0; +} + +/* Map SHF_ALPHA_GPREL to SEC_SMALL_DATA. */ + +flagword +alpha_elf_section_flags (flags, attr, type) + flagword flags; + int attr, type ATTRIBUTE_UNUSED; +{ + if (attr & SHF_ALPHA_GPREL) + flags |= SEC_SMALL_DATA; + return flags; +} +#endif /* OBJ_ELF */ + /* Called internally to handle all alignment needs. This takes care of eliding calls to frag_align if'n the cached current alignment says we've already got it, as well as taking care of the auto-align diff -uprN binutils-2.11.90.0.31/gas/config/tc-alpha.h binutils-2.11.92.0.5/gas/config/tc-alpha.h --- binutils-2.11.90.0.31/gas/config/tc-alpha.h Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/gas/config/tc-alpha.h Mon Oct 1 15:25:22 2001 @@ -108,6 +108,11 @@ extern void alpha_frob_file_before_adjus #define ELF_TC_SPECIAL_SECTIONS \ { ".sdata", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL }, \ { ".sbss", SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL }, + +#define md_elf_section_letter alpha_elf_section_letter +extern int alpha_elf_section_letter PARAMS ((int, char **)); +#define md_elf_section_flags alpha_elf_section_flags +extern flagword alpha_elf_section_flags PARAMS ((flagword, int, int)); #endif /* Whether to add support for explict !relocation_op!sequence_number. At the @@ -117,11 +122,10 @@ extern void alpha_frob_file_before_adjus #define RELOC_OP_P #endif -#ifdef RELOC_OP_P -/* Before the relocations are written, reorder them, so that user supplied - !lituse relocations follow the appropriate !literal relocations. Also - convert the gas-internal relocations to the appropriate linker relocations. - */ +/* Before the relocations are written, reorder them, so that user + supplied !lituse relocations follow the appropriate !literal + relocations. Also convert the gas-internal relocations to the + appropriate linker relocations. */ #define tc_adjust_symtab() alpha_adjust_symtab () extern void alpha_adjust_symtab PARAMS ((void)); @@ -133,14 +137,14 @@ extern void alpha_adjust_symtab PARAMS ( struct alpha_fix_tag { - struct fix *next_lituse; /* next !lituse */ - struct alpha_literal_tag *info; /* other members with same sequence */ + struct fix *next_reloc; /* next !lituse or !gpdisp */ + struct alpha_reloc_tag *info; /* other members with same sequence */ }; /* Initialize the TC_FIX_TYPE field. */ #define TC_INIT_FIX_DATA(fixP) \ do { \ - fixP->tc_fix_data.next_lituse = (struct fix *)0; \ + fixP->tc_fix_data.next_reloc = (struct fix *)0; \ fixP->tc_fix_data.info = (struct alpha_literal_tag *)0; \ } while (0) @@ -148,10 +152,9 @@ do { \ #define TC_FIX_DATA_PRINT(stream,fixP) \ do { \ if (fixP->tc_fix_data.info) \ - fprintf (stderr, "\tinfo = 0x%lx, next_lituse = 0x%lx\n", \ + fprintf (stderr, "\tinfo = 0x%lx, next_reloc = 0x%lx\n", \ (long)fixP->tc_fix_data.info, \ - (long)fixP->tc_fix_data.next_lituse); \ + (long)fixP->tc_fix_data.next_reloc); \ } while (0) -#endif #define DWARF2_LINE_MIN_INSN_LENGTH 4 diff -uprN binutils-2.11.90.0.31/gas/config/tc-arc.c binutils-2.11.92.0.5/gas/config/tc-arc.c --- binutils-2.11.90.0.31/gas/config/tc-arc.c Thu Jul 26 18:02:55 2001 +++ binutils-2.11.92.0.5/gas/config/tc-arc.c Mon Oct 1 15:25:22 2001 @@ -21,9 +21,9 @@ 02111-1307, USA. */ #include -#include #include "libiberty.h" #include "as.h" +#include "safe-ctype.h" #include "subsegs.h" #include "opcode/arc.h" #include "../opcodes/arc-ext.h" @@ -46,9 +46,11 @@ static void arc_common PARAMS ((int)); static void arc_extinst PARAMS ((int)); static void arc_extoper PARAMS ((int)); static void arc_option PARAMS ((int)); -static int get_arc_exp_reloc_type PARAMS ((int, int, expressionS *, +static int get_arc_exp_reloc_type PARAMS ((int, int, expressionS *, expressionS *)); +static void init_opcode_tables PARAMS ((int)); + const struct suffix_classes { char *name; int len; @@ -393,7 +395,7 @@ md_assemble (str) } /* Skip leading white space. */ - while (isspace (*str)) + while (ISSPACE (*str)) str++; /* The instructions are stored in lists hashed by the first letter (though @@ -544,7 +546,7 @@ md_assemble (str) } /* Pick the suffix out and look it up via the hash table. */ - for (t = s; *t && isalnum (*t); ++t) + for (t = s; *t && ISALNUM (*t); ++t) continue; c = *t; *t = '\0'; @@ -736,7 +738,7 @@ md_assemble (str) insn and it is assumed that longer versions of insns appear before shorter ones (eg: lsr r2,r3,1 vs lsr r2,r3). */ - while (isspace (*str)) + while (ISSPACE (*str)) ++str; if (!is_end_of_line[(unsigned char) *str]) @@ -913,8 +915,7 @@ arc_extoper (opertype) p = name; while (*p) { - if (isupper (*p)) - *p = tolower (*p); + *p = TOLOWER (*p); p++; } @@ -1538,7 +1539,7 @@ arc_option (ignore) char * md_atof (type, litP, sizeP) - char type; + int type; char *litP; int *sizeP; { @@ -1546,7 +1547,7 @@ md_atof (type, litP, sizeP) LITTLENUM_TYPE words[MAX_LITTLENUMS]; LITTLENUM_TYPE *wordP; char *t; - char *atof_ieee (); + char * atof_ieee PARAMS ((char *, int, LITTLENUM_TYPE *)); switch (type) { @@ -1703,7 +1704,7 @@ md_operand (expressionP) while (ext_oper) { l = strlen (ext_oper->operand.name); - if (!strncmp (p, ext_oper->operand.name, l) && !isalnum (*(p + l))) + if (!strncmp (p, ext_oper->operand.name, l) && !ISALNUM (*(p + l))) { input_line_pointer += l + 1; expressionP->X_op = O_register; @@ -1715,7 +1716,7 @@ md_operand (expressionP) for (i = 0; i < arc_reg_names_count; i++) { l = strlen (arc_reg_names[i].name); - if (!strncmp (p, arc_reg_names[i].name, l) && !isalnum (*(p + l))) + if (!strncmp (p, arc_reg_names[i].name, l) && !ISALNUM (*(p + l))) { input_line_pointer += l + 1; expressionP->X_op = O_register; diff -uprN binutils-2.11.90.0.31/gas/config/tc-arc.h binutils-2.11.92.0.5/gas/config/tc-arc.h --- binutils-2.11.90.0.31/gas/config/tc-arc.h Sat May 12 08:22:37 2001 +++ binutils-2.11.92.0.5/gas/config/tc-arc.h Mon Oct 1 15:25:22 2001 @@ -59,11 +59,11 @@ extern const char *arc_target_format; /* The ARC needs to parse reloc specifiers in .word. */ -extern void arc_parse_cons_expression (); +extern void arc_parse_cons_expression PARAMS ((struct expressionS *, unsigned)); #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) \ arc_parse_cons_expression (EXP, NBYTES) -extern void arc_cons_fix_new (); +extern void arc_cons_fix_new PARAMS ((struct frag *, int, int, struct expressionS *)); #define TC_CONS_FIX_NEW(FRAG, WHERE, NBYTES, EXP) \ arc_cons_fix_new (FRAG, WHERE, NBYTES, EXP) diff -uprN binutils-2.11.90.0.31/gas/config/tc-arm.c binutils-2.11.92.0.5/gas/config/tc-arm.c --- binutils-2.11.90.0.31/gas/config/tc-arm.c Fri Jul 6 09:26:11 2001 +++ binutils-2.11.92.0.5/gas/config/tc-arm.c Mon Oct 1 15:25:22 2001 @@ -21,10 +21,10 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include #include #define NO_RELOC 0 #include "as.h" +#include "safe-ctype.h" /* Need TARGET_CPU. */ #include "config.h" @@ -590,7 +590,6 @@ static void do_branch PARAMS ((char *, static void do_swi PARAMS ((char *, unsigned long)); /* Pseudo Op codes. */ static void do_adr PARAMS ((char *, unsigned long)); -static void do_adrl PARAMS ((char *, unsigned long)); static void do_nop PARAMS ((char *, unsigned long)); /* ARM 2. */ static void do_mul PARAMS ((char *, unsigned long)); @@ -679,6 +678,10 @@ static void set_constant_flonums PARAMS static valueT md_chars_to_number PARAMS ((char *, int)); static void insert_reg_alias PARAMS ((char *, int)); static void output_inst PARAMS ((void)); +static int accum0_required_here PARAMS ((char **)); +static int ld_mode_required_here PARAMS ((char **)); +static void do_branch25 PARAMS ((char *, unsigned long)); +static symbolS * find_real_start PARAMS ((symbolS *)); #ifdef OBJ_ELF static bfd_reloc_code_real_type arm_parse_reloc PARAMS ((void)); #endif @@ -1864,7 +1867,7 @@ arm_psr_parse (ccp) { c = *p++; } - while (isalpha (c) || c == '_'); + while (ISALPHA (c) || c == '_'); /* Terminate the word. */ *--p = 0; @@ -2517,7 +2520,7 @@ accum0_required_here (str) *str = p; /* Advance caller's string pointer too. */ c = *p++; - while (isalnum (c)) + while (ISALNUM (c)) c = *p++; *--p = 0; /* Aap nul into input buffer at non-alnum. */ @@ -3513,7 +3516,7 @@ do_ldrd (str, flags) static char buff[128]; --str; - while (isspace (*str)) + while (ISSPACE (*str)) --str; str -= 4; @@ -3710,7 +3713,7 @@ decode_shift (str, unrestrict) skip_whitespace (* str); - for (p = * str; isalpha (* p); p ++) + for (p = * str; ISALPHA (* p); p ++) ; if (p == * str) @@ -6407,7 +6410,7 @@ insert_reg (entry) strcpy (buf + i, reg_table[entry].name); for (i = 0; buf[i]; i++) - buf2[i] = islower (buf[i]) ? toupper (buf[i]) : buf[i]; + buf2[i] = TOUPPER (buf[i]); buf2[i] = '\0'; @@ -6775,11 +6778,11 @@ arm_reg_parse (ccp) p++, start++; #endif #endif - if (!isalpha (*p) || !is_name_beginner (*p)) + if (!ISALPHA (*p) || !is_name_beginner (*p)) return FAIL; c = *p++; - while (isalpha (c) || isdigit (c) || c == '_') + while (ISALPHA (c) || ISDIGIT (c) || c == '_') c = *p++; *--p = 0; @@ -8724,9 +8727,9 @@ arm_parse_reloc () }; for (i = 0, ip = input_line_pointer; - i < sizeof (id) && (isalnum (*ip) || ispunct (*ip)); + i < sizeof (id) && (ISALNUM (*ip) || ISPUNCT (*ip)); i++, ip++) - id[i] = tolower (*ip); + id[i] = TOLOWER (*ip); for (i = 0; reloc_map[i].str; i++) if (strncmp (id, reloc_map[i].str, reloc_map[i].len) == 0) diff -uprN binutils-2.11.90.0.31/gas/config/tc-avr.c binutils-2.11.92.0.5/gas/config/tc-avr.c --- binutils-2.11.90.0.31/gas/config/tc-avr.c Fri Mar 9 11:16:52 2001 +++ binutils-2.11.92.0.5/gas/config/tc-avr.c Mon Oct 1 15:25:22 2001 @@ -1,6 +1,6 @@ /* tc-avr.c -- Assembler code for the ATMEL AVR - Copyright 1999, 2000 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001 Free Software Foundation, Inc. Contributed by Denis Chertykov This file is part of GAS, the GNU Assembler. @@ -21,8 +21,8 @@ Boston, MA 02111-1307, USA. */ #include -#include #include "as.h" +#include "safe-ctype.h" #include "subsegs.h" struct avr_opcodes_s @@ -298,7 +298,7 @@ md_parse_option (c, arg) char *arg1 = arg; do - *t = tolower (*arg1++); + *t = TOLOWER (*arg1++); while (*t++); } @@ -555,12 +555,12 @@ avr_operand (opcode, where, op, line) str = extract_word (str, r_name, sizeof (r_name)); op_mask = 0xff; - if (isdigit (r_name[1])) + if (ISDIGIT (r_name[1])) { if (r_name[2] == '\0') op_mask = r_name[1] - '0'; else if (r_name[1] != '0' - && isdigit (r_name[2]) + && ISDIGIT (r_name[2]) && r_name[3] == '\0') op_mask = (r_name[1] - '0') * 10 + r_name[2] - '0'; } @@ -613,7 +613,7 @@ avr_operand (opcode, where, op, line) str = skip_space (str + 1); op_mask = 0x1002; } - c = tolower (*str); + c = TOLOWER (*str); if (c == 'x') op_mask |= 0x100c; else if (c == 'y') @@ -656,7 +656,7 @@ avr_operand (opcode, where, op, line) case 'b': { - char c = tolower (*str++); + char c = TOLOWER (*str++); if (c == 'y') op_mask |= 0x8; diff -uprN binutils-2.11.90.0.31/gas/config/tc-cris.c binutils-2.11.92.0.5/gas/config/tc-cris.c --- binutils-2.11.90.0.31/gas/config/tc-cris.c Thu Jul 26 18:02:55 2001 +++ binutils-2.11.92.0.5/gas/config/tc-cris.c Mon Oct 1 15:25:22 2001 @@ -23,8 +23,8 @@ MA 02111-1307, USA. */ #include -#include #include "as.h" +#include "safe-ctype.h" #include "subsegs.h" #include "opcode/cris.h" #include "dwarf2dbg.h" @@ -925,7 +925,7 @@ cris_process_instruction (insn_text, out /* Find the end of the opcode mnemonic. We assume (true in 2.9.1) that the caller has translated the opcode to lower-case, up to the first non-letter. */ - for (operands = insn_text; islower (*operands); ++operands) + for (operands = insn_text; ISLOWER (*operands); ++operands) ; /* Terminate the opcode after letters, but save the character there if @@ -1586,7 +1586,7 @@ get_gen_reg (cPP, regnop) (*cPP)++; if ((**cPP == 'C' || **cPP == 'c') - && ! isalnum ((*cPP)[1])) + && ! ISALNUM ((*cPP)[1])) { /* It's "PC": consume the "c" and we're done. */ (*cPP)++; @@ -1600,13 +1600,13 @@ get_gen_reg (cPP, regnop) /* Hopefully r[0-9] or r1[0-5]. Consume 'R' or 'r'. */ (*cPP)++; - if (isdigit (**cPP)) + if (ISDIGIT (**cPP)) { /* It's r[0-9]. Consume and check the next digit. */ *regnop = **cPP - '0'; (*cPP)++; - if (! isalnum (**cPP)) + if (! ISALNUM (**cPP)) { /* No more digits, we're done. */ return 1; @@ -1688,8 +1688,7 @@ get_spec_reg (cPP, sregpp) s1 = name_begin; s2 = sregp->name; - while (*s2 != '\0' - && (isupper (*s1) ? tolower (*s1) == *s2 : *s1 == *s2)) + while (*s2 != '\0' && TOLOWER (*s1) == *s2) { s1++; s2++; @@ -1698,7 +1697,7 @@ get_spec_reg (cPP, sregpp) /* For a match, we must have consumed the name in the table, and we must be outside what could be part of a name. Assume here that a test for alphanumerics is sufficient for a name test. */ - if (*s2 == 0 && ! isalnum (*s1)) + if (*s2 == 0 && ! ISALNUM (*s1)) { /* We have a match. Update the pointer and be done. */ *cPP = s1; @@ -2321,7 +2320,7 @@ get_flags (cPP, flagsp) whitespace. Anything else, and we consider it a failure. */ if (**cPP != ',' && **cPP != 0 - && ! isspace (**cPP)) + && ! ISSPACE (**cPP)) return 0; else return 1; diff -uprN binutils-2.11.90.0.31/gas/config/tc-d10v.c binutils-2.11.92.0.5/gas/config/tc-d10v.c --- binutils-2.11.90.0.31/gas/config/tc-d10v.c Fri Mar 9 11:16:53 2001 +++ binutils-2.11.92.0.5/gas/config/tc-d10v.c Mon Oct 1 15:25:22 2001 @@ -20,8 +20,8 @@ Boston, MA 02111-1307, USA. */ #include -#include #include "as.h" +#include "safe-ctype.h" #include "subsegs.h" #include "opcode/d10v.h" #include "elf/ppc.h" @@ -1185,7 +1185,7 @@ do_assemble (str, opcode) && !is_end_of_line[*op_end] && *op_end != ' '; op_end++) { - name[nlen] = tolower (op_start[nlen]); + name[nlen] = TOLOWER (op_start[nlen]); nlen++; } name[nlen] = 0; diff -uprN binutils-2.11.90.0.31/gas/config/tc-d30v.c binutils-2.11.92.0.5/gas/config/tc-d30v.c --- binutils-2.11.90.0.31/gas/config/tc-d30v.c Fri Mar 9 11:16:53 2001 +++ binutils-2.11.92.0.5/gas/config/tc-d30v.c Mon Oct 1 15:25:22 2001 @@ -1,5 +1,5 @@ /* tc-d30v.c -- Assembler code for the Mitsubishi D30V - Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -19,8 +19,8 @@ Boston, MA 02111-1307, USA. */ #include -#include #include "as.h" +#include "safe-ctype.h" #include "subsegs.h" #include "opcode/d30v.h" @@ -1454,7 +1454,7 @@ do_assemble (str, opcode, shortp, is_par && !is_end_of_line[*op_end] && *op_end != ' '; op_end++) { - name[nlen] = tolower (op_start[nlen]); + name[nlen] = TOLOWER (op_start[nlen]); nlen++; } @@ -2045,7 +2045,7 @@ d30v_start_line () { char *c = input_line_pointer; - while (isspace (*c)) + while (ISSPACE (*c)) c++; if (*c == '.') diff -uprN binutils-2.11.90.0.31/gas/config/tc-fr30.c binutils-2.11.92.0.5/gas/config/tc-fr30.c --- binutils-2.11.90.0.31/gas/config/tc-fr30.c Thu Jul 26 18:02:55 2001 +++ binutils-2.11.92.0.5/gas/config/tc-fr30.c Mon Oct 1 15:25:22 2001 @@ -19,8 +19,8 @@ Boston, MA 02111-1307, USA. */ #include -#include #include "as.h" +#include "safe-ctype.h" #include "subsegs.h" #include "symcat.h" #include "opcodes/fr30-desc.h" @@ -614,7 +614,7 @@ fr30_is_colon_insn (start) continue; while (len --) - if (tolower (start [len]) != insn [len]) + if (TOLOWER (start [len]) != insn [len]) break; if (len == -1) diff -uprN binutils-2.11.90.0.31/gas/config/tc-h8300.c binutils-2.11.92.0.5/gas/config/tc-h8300.c --- binutils-2.11.90.0.31/gas/config/tc-h8300.c Thu Aug 30 14:58:40 2001 +++ binutils-2.11.92.0.5/gas/config/tc-h8300.c Mon Oct 1 15:25:22 2001 @@ -28,22 +28,10 @@ #define DEFINE_TABLE #define h8_opcodes ops #include "opcode/h8300.h" -#include +#include "safe-ctype.h" #ifdef OBJ_ELF #include "elf/h8.h" - -#define R_MOV24B1 BFD_RELOC_H8_DIR24A8 -#define R_MOVL1 BFD_RELOC_H8_DIR32A16 -#define R_MOV24B1 BFD_RELOC_H8_DIR24A8 -#define R_MOVL1 BFD_RELOC_H8_DIR32A16 -#define R_RELLONG BFD_RELOC_32 -#define R_MOV16B1 BFD_RELOC_H8_DIR16A8 -#define R_RELWORD BFD_RELOC_16 -#define R_RELBYTE BFD_RELOC_8 -#define R_PCRWORD BFD_RELOC_16_PCREL -#define R_PCRBYTE BFD_RELOC_8_PCREL -#define R_JMPL1 BFD_RELOC_H8_DIR24R8 #endif const char comment_chars[] = ";"; @@ -359,7 +347,7 @@ skip_colonthing (ptr, exp, mode) { *mode |= L_16; } - while (isdigit (*ptr)) + while (ISDIGIT (*ptr)) ptr++; } } @@ -430,8 +418,8 @@ get_operand (ptr, op, dst, direction) /* Gross. Gross. ldm and stm have a format not easily handled by get_operand. We deal with it explicitly here. */ - if (src[0] == 'e' && src[1] == 'r' && isdigit (src[2]) - && src[3] == '-' && src[4] == 'e' && src[5] == 'r' && isdigit (src[6])) + if (src[0] == 'e' && src[1] == 'r' && ISDIGIT (src[2]) + && src[3] == '-' && src[4] == 'e' && src[5] == 'r' && ISDIGIT (src[6])) { int low, high; @@ -1110,6 +1098,7 @@ build_bytes (this_try, operand) int where = size16 ? 2 : 1; int size = size16 ? 2 : 1; int type = size16 ? R_PCRWORD : R_PCRBYTE; + fixS *fixP; check_operand (operand + i, size16 ? 0x7fff : 0x7f, "@"); @@ -1119,16 +1108,25 @@ build_bytes (this_try, operand) (unsigned long) operand->exp.X_add_number); } +#ifndef OBJ_ELF + /* The COFF port has always been off by one, changing it + now would be an incompatible change, so we leave it as-is. + + We don't want to do this for ELF as we want to be + compatible with the proposed ELF format from Hitachi. */ operand[i].exp.X_add_number -= 1; +#endif + operand[i].exp.X_add_number = ((operand[i].exp.X_add_number & 0xff) ^ 0x80) - 0x80; - fix_new_exp (frag_now, - output - frag_now->fr_literal + where, - size, - &operand[i].exp, - 1, - type); + fixP = fix_new_exp (frag_now, + output - frag_now->fr_literal + where, + size, + &operand[i].exp, + 1, + type); + fixP->fx_signed = 1; } else if (x & MEMIND) { @@ -1142,6 +1140,15 @@ build_bytes (this_try, operand) } else if (x & ABSJMP) { + int where = 0; + +#ifdef OBJ_ELF + /* To be compatible with the proposed H8 ELF format, we + want the relocation's offset to point to the first byte + that will be modified, not to the start of the instruction. */ + where += 1; +#endif + /* This jmp may be a jump or a branch. */ check_operand (operand + i, Hmode ? 0xffffff : 0xffff, "@"); @@ -1154,7 +1161,7 @@ build_bytes (this_try, operand) operand[i].exp.X_add_number = ((operand[i].exp.X_add_number & 0xffff) ^ 0x8000) - 0x8000; fix_new_exp (frag_now, - output - frag_now->fr_literal, + output - frag_now->fr_literal + where, 4, &operand[i].exp, 0, @@ -1448,7 +1455,11 @@ tc_aout_fix_to_chars () void md_convert_frag (headers, seg, fragP) +#ifdef BFD_ASSEMBLER + bfd *headers ATTRIBUTE_UNUSED; +#else object_headers *headers ATTRIBUTE_UNUSED; +#endif segT seg ATTRIBUTE_UNUSED; fragS *fragP ATTRIBUTE_UNUSED; { @@ -1456,21 +1467,43 @@ md_convert_frag (headers, seg, fragP) abort (); } +#ifdef BFD_ASSEMBLER +valueT +md_section_align (segment, size) + segT segment; + valueT size; +{ + int align = bfd_get_section_alignment (stdoutput, segment); + return ((size + (1 << align) - 1) & (-1 << align)); +} +#else valueT md_section_align (seg, size) segT seg; valueT size; { return ((size + (1 << section_alignment[(int) seg]) - 1) - & (-1 << section_alignment[(int) seg])); + & (-1 << section_alignment[(int) seg])); } +#endif + +#ifdef BFD_ASSEMBLER +int +md_apply_fix (fixP, valp) + fixS *fixP; + valueT *valp; +#else void md_apply_fix (fixP, val) fixS *fixP; long val; +#endif { char *buf = fixP->fx_where + fixP->fx_frag->fr_literal; +#ifdef BFD_ASSEMBLER + long val = *valp; +#endif switch (fixP->fx_size) { @@ -1590,6 +1623,17 @@ tc_gen_reloc (section, fixp) arelent *rel; bfd_reloc_code_real_type r_type; + if (fixp->fx_addsy && fixp->fx_subsy) + { + if ((S_GET_SEGMENT (fixp->fx_addsy) != S_GET_SEGMENT (fixp->fx_subsy)) + || S_GET_SEGMENT (fixp->fx_addsy) == undefined_section) + { + as_bad_where (fixp->fx_file, fixp->fx_line, + "Difference of symbols in different sections is not supported"); + return NULL; + } + } + rel = (arelent *) xmalloc (sizeof (arelent)); rel->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *)); *rel->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy); diff -uprN binutils-2.11.90.0.31/gas/config/tc-h8300.h binutils-2.11.92.0.5/gas/config/tc-h8300.h --- binutils-2.11.90.0.31/gas/config/tc-h8300.h Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/gas/config/tc-h8300.h Mon Oct 1 15:25:22 2001 @@ -49,12 +49,37 @@ struct internal_reloc; extern void tc_reloc_mangle PARAMS ((struct fix *, struct internal_reloc *, bfd_vma)); +#ifdef OBJ_ELF +/* Provide mappings from the original H8 COFF relocation names to + their corresponding BFD relocation names. This allows us to use + most of tc-h8300.c without modifications for both ELF and COFF + ports. */ +#define R_MOV24B1 BFD_RELOC_H8_DIR24A8 +#define R_MOVL1 BFD_RELOC_H8_DIR32A16 +#define R_MOV24B1 BFD_RELOC_H8_DIR24A8 +#define R_MOVL1 BFD_RELOC_H8_DIR32A16 +#define R_RELLONG BFD_RELOC_32 +#define R_MOV16B1 BFD_RELOC_H8_DIR16A8 +#define R_RELWORD BFD_RELOC_16 +#define R_RELBYTE BFD_RELOC_8 +#define R_PCRWORD BFD_RELOC_16_PCREL +#define R_PCRBYTE BFD_RELOC_8_PCREL +#define R_JMPL1 BFD_RELOC_H8_DIR24R8 +#define R_MEM_INDIRECT BFD_RELOC_8 + +/* We do not want to adjust any relocations to make implementation of + linker relaxations easier. */ +#define tc_fix_adjustable(FIX) 0 +#endif + #define TC_CONS_RELOC (Hmode ? R_RELLONG: R_RELWORD) #define DO_NOT_STRIP 0 #define LISTING_HEADER "Hitachi H8/300 GAS " #define NEED_FX_R_TYPE 1 +#ifndef OBJ_ELF #define RELOC_32 1234 +#endif extern int Hmode; extern int Smode; diff -uprN binutils-2.11.90.0.31/gas/config/tc-h8500.c binutils-2.11.92.0.5/gas/config/tc-h8500.c --- binutils-2.11.90.0.31/gas/config/tc-h8500.c Sat May 12 00:06:30 2001 +++ binutils-2.11.92.0.5/gas/config/tc-h8500.c Mon Oct 1 15:25:22 2001 @@ -28,7 +28,7 @@ #define DEFINE_TABLE #define ASSEMBLER_TABLE #include "opcodes/h8500-opc.h" -#include +#include "safe-ctype.h" const char comment_chars[] = "!"; const char line_separator_chars[] = ";"; @@ -1589,10 +1589,10 @@ start_label (ptr) char *ptr; { /* Check for :s.w */ - if (isalpha (ptr[1]) && ptr[2] == '.') + if (ISALPHA (ptr[1]) && ptr[2] == '.') return 0; /* Check for :s */ - if (isalpha (ptr[1]) && !isalpha (ptr[2])) + if (ISALPHA (ptr[1]) && !ISALPHA (ptr[2])) return 0; return 1; } diff -uprN binutils-2.11.90.0.31/gas/config/tc-hppa.c binutils-2.11.92.0.5/gas/config/tc-hppa.c --- binutils-2.11.90.0.31/gas/config/tc-hppa.c Thu Jul 26 18:02:55 2001 +++ binutils-2.11.92.0.5/gas/config/tc-hppa.c Mon Oct 1 15:25:22 2001 @@ -23,9 +23,9 @@ at the University of Utah. */ #include -#include #include "as.h" +#include "safe-ctype.h" #include "subsegs.h" #include "bfd/libhppa.h" @@ -1571,11 +1571,12 @@ pa_ip (str) /* Convert everything up to the first whitespace character into lower case. */ for (s = str; *s != ' ' && *s != '\t' && *s != '\n' && *s != '\0'; s++) - if (isupper (*s)) - *s = tolower (*s); + *s = TOLOWER (*s); /* Skip to something interesting. */ - for (s = str; isupper (*s) || islower (*s) || (*s >= '0' && *s <= '3'); ++s) + for (s = str; + ISUPPER (*s) || ISLOWER (*s) || (*s >= '0' && *s <= '3'); + ++s) ; switch (*s) @@ -4687,7 +4688,7 @@ pa_parse_number (s, is_float) pa_number = -1; have_prefix = 0; num = 0; - if (!strict && isdigit (*p)) + if (!strict && ISDIGIT (*p)) { /* Looks like a number. */ @@ -4695,10 +4696,10 @@ pa_parse_number (s, is_float) { /* The number is specified in hex. */ p += 2; - while (isdigit (*p) || ((*p >= 'a') && (*p <= 'f')) + while (ISDIGIT (*p) || ((*p >= 'a') && (*p <= 'f')) || ((*p >= 'A') && (*p <= 'F'))) { - if (isdigit (*p)) + if (ISDIGIT (*p)) num = num * 16 + *p - '0'; else if (*p >= 'a' && *p <= 'f') num = num * 16 + *p - 'a' + 10; @@ -4710,7 +4711,7 @@ pa_parse_number (s, is_float) else { /* The number is specified in decimal. */ - while (isdigit (*p)) + while (ISDIGIT (*p)) { num = num * 10 + *p - '0'; ++p; @@ -4762,7 +4763,7 @@ pa_parse_number (s, is_float) num = 2; p++; } - else if (!isdigit (*p)) + else if (!ISDIGIT (*p)) { if (print_errors) as_bad (_("Undefined register: '%s'."), name); @@ -4772,7 +4773,7 @@ pa_parse_number (s, is_float) { do num = num * 10 + *p++ - '0'; - while (isdigit (*p)); + while (ISDIGIT (*p)); } } else @@ -5124,16 +5125,16 @@ pa_chk_field_selector (str) *str = *str + 1; if ((*str)[1] == '\'' || (*str)[1] == '%') - name[0] = tolower ((*str)[0]), + name[0] = TOLOWER ((*str)[0]), name[1] = 0; else if ((*str)[2] == '\'' || (*str)[2] == '%') - name[0] = tolower ((*str)[0]), - name[1] = tolower ((*str)[1]), + name[0] = TOLOWER ((*str)[0]), + name[1] = TOLOWER ((*str)[1]), name[2] = 0; else if ((*str)[3] == '\'' || (*str)[3] == '%') - name[0] = tolower ((*str)[0]), - name[1] = tolower ((*str)[1]), - name[2] = tolower ((*str)[2]), + name[0] = TOLOWER ((*str)[0]), + name[1] = TOLOWER ((*str)[1]), + name[2] = TOLOWER ((*str)[2]), name[3] = 0; else return e_fsel; @@ -8196,11 +8197,11 @@ pa_stringer (append_zero) s++; for (num_digit = 0, number = 0, dg = *s; num_digit < 2 - && (isdigit (dg) || (dg >= 'a' && dg <= 'f') + && (ISDIGIT (dg) || (dg >= 'a' && dg <= 'f') || (dg >= 'A' && dg <= 'F')); num_digit++) { - if (isdigit (dg)) + if (ISDIGIT (dg)) number = number * 16 + dg - '0'; else if (dg >= 'a' && dg <= 'f') number = number * 16 + dg - 'a' + 10; diff -uprN binutils-2.11.90.0.31/gas/config/tc-i370.c binutils-2.11.92.0.5/gas/config/tc-i370.c --- binutils-2.11.90.0.31/gas/config/tc-i370.c Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/gas/config/tc-i370.c Mon Oct 1 15:25:22 2001 @@ -29,8 +29,8 @@ */ #include -#include #include "as.h" +#include "safe-ctype.h" #include "subsegs.h" #include "struc-symbol.h" @@ -334,7 +334,7 @@ register_name (expressionP) /* Find the spelling of the operand. */ start = name = input_line_pointer; - if (name[0] == '%' && isalpha (name[1])) + if (name[0] == '%' && ISALPHA (name[1])) name = ++input_line_pointer; else if (!reg_names_p) @@ -345,7 +345,7 @@ register_name (expressionP) /* If it's a number, treat it as a number. If it's alpha, look to see if it's in the register table. */ - if (!isalpha (name[0])) + if (!ISALPHA (name[0])) { reg_number = get_single_number (); } @@ -702,10 +702,10 @@ i370_elf_suffix (str_p, exp_p) for (ch = *str, str2 = ident; (str2 < ident + sizeof (ident) - 1 - && (isalnum (ch) || ch == '@')); + && (ISALNUM (ch) || ch == '@')); ch = *++str) { - *str2++ = (islower (ch)) ? ch : tolower (ch); + *str2++ = TOLOWER (ch); } *str2 = '\0'; @@ -1489,11 +1489,11 @@ i370_addr_offset (expressionS *exx) lab = input_line_pointer; while (*lab && (',' != *lab) && ('(' != *lab)) { - if (isdigit (*lab)) + if (ISDIGIT (*lab)) { all_digits = 1; } - else if (isalpha (*lab)) + else if (ISALPHA (*lab)) { if (!all_digits) { @@ -1562,7 +1562,7 @@ i370_addr_cons (expressionS *exp) name = input_line_pointer; sym_name = input_line_pointer; /* Find the spelling of the operand */ - if (name[0] == '=' && isalpha (name[1])) + if (name[0] == '=' && ISALPHA (name[1])) { name = ++input_line_pointer; } @@ -1652,7 +1652,7 @@ i370_addr_cons (expressionS *exp) save = input_line_pointer; while (*save) { - if (isxdigit (*save)) + if (ISXDIGIT (*save)) hex_len++; save++; } @@ -1979,7 +1979,7 @@ md_assemble (str) #endif /* Get the opcode. */ - for (s = str; *s != '\0' && ! isspace (*s); s++) + for (s = str; *s != '\0' && ! ISSPACE (*s); s++) ; if (*s != '\0') *s++ = '\0'; @@ -2004,7 +2004,7 @@ md_assemble (str) insn = opcode->opcode; str = s; - while (isspace (*str)) + while (ISSPACE (*str)) ++str; /* I370 operands are either expressions or address constants. @@ -2289,7 +2289,7 @@ md_assemble (str) ++str; } - while (isspace (*str)) + while (ISSPACE (*str)) ++str; if (*str != '\0') @@ -2462,7 +2462,7 @@ i370_section_letter (letter, ptr_msg) if (letter == 'e') return SHF_EXCLUDE; - *ptr_msg = "Bad .section directive: want a,w,x,e in string"; + *ptr_msg = "Bad .section directive: want a,e,w,x,M,S in string"; return 0; } diff -uprN binutils-2.11.90.0.31/gas/config/tc-i386.c binutils-2.11.92.0.5/gas/config/tc-i386.c --- binutils-2.11.90.0.31/gas/config/tc-i386.c Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/gas/config/tc-i386.c Thu Oct 4 14:35:43 2001 @@ -26,9 +26,8 @@ Bugs & suggestions are completely welcome. This is free software. Please help us make it better. */ -#include - #include "as.h" +#include "safe-ctype.h" #include "subsegs.h" #include "dwarf2dbg.h" #include "opcode/i386.h" @@ -891,27 +890,27 @@ md_begin () for (c = 0; c < 256; c++) { - if (isdigit (c)) + if (ISDIGIT (c)) { digit_chars[c] = c; mnemonic_chars[c] = c; register_chars[c] = c; operand_chars[c] = c; } - else if (islower (c)) + else if (ISLOWER (c)) { mnemonic_chars[c] = c; register_chars[c] = c; operand_chars[c] = c; } - else if (isupper (c)) + else if (ISUPPER (c)) { - mnemonic_chars[c] = tolower (c); + mnemonic_chars[c] = TOLOWER (c); register_chars[c] = mnemonic_chars[c]; operand_chars[c] = c; } - if (isalpha (c) || isdigit (c)) + if (ISALPHA (c) || ISDIGIT (c)) identifier_chars[c] = c; else if (c >= 128) { @@ -1936,19 +1935,6 @@ md_assemble (line) } } - if (i.reg_operands && flag_code < CODE_64BIT) - { - int op; - for (op = i.operands; --op >= 0;) - if ((i.types[op] & Reg) - && (i.op[op].regs->reg_flags & (RegRex64|RegRex))) - { - as_bad (_("Extended register `%%%s' available only in 64bit mode."), - i.op[op].regs->reg_name); - return; - } - } - /* If matched instruction specifies an explicit instruction mnemonic suffix, use it. */ if (i.tm.opcode_modifier & (Size16 | Size32 | Size64)) @@ -2741,6 +2727,9 @@ md_assemble (line) { int code16; int prefix; + relax_substateT subtype; + symbolS *sym; + offsetT off; code16 = 0; if (flag_code == CODE_16BIT) @@ -2785,19 +2774,29 @@ md_assemble (line) if (i.prefix[REX_PREFIX]) *p++ = i.prefix[REX_PREFIX]; *p = i.tm.base_opcode; - /* 1 possible extra opcode + displacement go in var part. + + if ((unsigned char) *p == JUMP_PC_RELATIVE) + subtype = ENCODE_RELAX_STATE (UNCOND_JUMP, SMALL); + else if ((cpu_arch_flags & Cpu386) != 0) + subtype = ENCODE_RELAX_STATE (COND_JUMP, SMALL); + else + subtype = ENCODE_RELAX_STATE (COND_JUMP86, SMALL); + subtype |= code16; + + sym = i.op[0].disps->X_add_symbol; + off = i.op[0].disps->X_add_number; + + if (i.op[0].disps->X_op != O_constant + && i.op[0].disps->X_op != O_symbol) + { + /* Handle complex expressions. */ + sym = make_expr_symbol (i.op[0].disps); + off = 0; + } + + /* 1 possible extra opcode + 4 byte displacement go in var part. Pass reloc in fr_var. */ - frag_var (rs_machine_dependent, - 1 + 4, - i.reloc[0], - ((unsigned char) *p == JUMP_PC_RELATIVE - ? ENCODE_RELAX_STATE (UNCOND_JUMP, SMALL) | code16 - : ((cpu_arch_flags & Cpu386) != 0 - ? ENCODE_RELAX_STATE (COND_JUMP, SMALL) | code16 - : ENCODE_RELAX_STATE (COND_JUMP86, SMALL) | code16)), - i.op[0].disps->X_add_symbol, - i.op[0].disps->X_add_number, - p); + frag_var (rs_machine_dependent, 5, i.reloc[0], subtype, sym, off, p); } else if (i.tm.opcode_modifier & (JumpByte | JumpDword)) { @@ -4448,7 +4447,7 @@ static char * output_invalid (c) int c; { - if (isprint (c)) + if (ISPRINT (c)) sprintf (output_invalid_buf, "'%c'", c); else sprintf (output_invalid_buf, "(0x%x)", (unsigned) c); @@ -4519,6 +4518,13 @@ parse_register (reg_string, end_op) } } + if (r != NULL + && r->reg_flags & (RegRex64|RegRex) + && flag_code != CODE_64BIT) + { + return (const reg_entry *) NULL; + } + return r; } diff -uprN binutils-2.11.90.0.31/gas/config/tc-i860.c binutils-2.11.92.0.5/gas/config/tc-i860.c --- binutils-2.11.90.0.31/gas/config/tc-i860.c Fri Mar 9 11:16:58 2001 +++ binutils-2.11.92.0.5/gas/config/tc-i860.c Mon Oct 1 15:25:22 2001 @@ -1,5 +1,5 @@ /* tc-i860.c -- Assembler for the Intel i860 architecture. - Copyright 1989, 1992, 1993, 1994, 1995, 1998, 1999, 2000 + Copyright 1989, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Brought back from the dead and completely reworked @@ -21,10 +21,10 @@ with GAS; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include #include #include #include "as.h" +#include "safe-ctype.h" #include "subsegs.h" #include "opcode/i860.h" #include "elf/i860.h" @@ -409,7 +409,7 @@ i860_process_insn (str) opcode = 0; #endif - for (s = str; islower (*s) || *s == '.' || *s == '3' + for (s = str; ISLOWER (*s) || *s == '.' || *s == '3' || *s == '2' || *s == '1'; ++s) ; @@ -485,9 +485,9 @@ i860_process_insn (str) /* Must be at least one digit. */ case '#': - if (isdigit (*s++)) + if (ISDIGIT (*s++)) { - while (isdigit (*s)) + while (ISDIGIT (*s)) ++s; continue; } @@ -528,11 +528,11 @@ i860_process_insn (str) /* Any register r0..r31. */ case 'r': s++; - if (!isdigit (c = *s++)) + if (!ISDIGIT (c = *s++)) { goto error; } - if (isdigit (*s)) + if (ISDIGIT (*s)) { if ((c = 10 * (c - '0') + (*s++ - '0')) >= 32) goto error; @@ -575,10 +575,10 @@ i860_process_insn (str) else s++; - if (*s++ == 'f' && isdigit (*s)) + if (*s++ == 'f' && ISDIGIT (*s)) { mask = *s++; - if (isdigit (*s)) + if (ISDIGIT (*s)) { mask = 10 * (mask - '0') + (*s++ - '0'); if (mask >= 32) diff -uprN binutils-2.11.90.0.31/gas/config/tc-i960.c binutils-2.11.92.0.5/gas/config/tc-i960.c --- binutils-2.11.90.0.31/gas/config/tc-i960.c Fri Mar 9 11:16:58 2001 +++ binutils-2.11.92.0.5/gas/config/tc-i960.c Mon Oct 1 15:25:22 2001 @@ -64,10 +64,10 @@ a relocation directive. */ #include -#include #include "as.h" +#include "safe-ctype.h" #include "obstack.h" #include "opcode/i960.h" @@ -1389,8 +1389,8 @@ get_args (p, args) { if (*p == ' ' - && (! isalnum ((unsigned char) p[1]) - || ! isalnum ((unsigned char) p[-1]))) + && (! ISALNUM (p[1]) + || ! ISALNUM (p[-1]))) { p++; diff -uprN binutils-2.11.90.0.31/gas/config/tc-ia64.c binutils-2.11.92.0.5/gas/config/tc-ia64.c --- binutils-2.11.90.0.31/gas/config/tc-ia64.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/gas/config/tc-ia64.c Mon Oct 1 15:25:22 2001 @@ -43,6 +43,7 @@ */ #include "as.h" +#include "safe-ctype.h" #include "dwarf2dbg.h" #include "subsegs.h" @@ -85,6 +86,7 @@ enum reloc_func FUNC_SEG_RELATIVE, FUNC_LTV_RELATIVE, FUNC_LT_FPTR_RELATIVE, + FUNC_IPLT_RELOC, }; enum reg_symbol @@ -483,6 +485,7 @@ pseudo_func[] = { "segrel", PSEUDO_FUNC_RELOC, { 0 } }, { "ltv", PSEUDO_FUNC_RELOC, { 0 } }, { "", 0, { 0 } }, /* placeholder for FUNC_LT_FPTR_RELATIVE */ + { "iplt", PSEUDO_FUNC_RELOC, { 0 } }, /* mbtype4 constants: */ { "alt", PSEUDO_FUNC_CONST, { 0xa } }, @@ -914,6 +917,20 @@ set_section (name) input_line_pointer = saved_input_line_pointer; } +/* Map 's' to SHF_IA_64_SHORT. */ + +int +ia64_elf_section_letter (letter, ptr_msg) + int letter; + char **ptr_msg; +{ + if (letter == 's') + return SHF_IA_64_SHORT; + + *ptr_msg = _("Bad .section directive: want a,s,w,x,M,S in string"); + return 0; +} + /* Map SHF_IA_64_SHORT to SEC_SMALL_DATA. */ flagword @@ -4498,7 +4515,7 @@ dot_pred_rel (type) valueT bit = 1; int regno; - if (toupper (*input_line_pointer) != 'P' + if (TOUPPER (*input_line_pointer) != 'P' || (regno = atoi (++input_line_pointer)) < 0 || regno > 63) { @@ -4506,7 +4523,7 @@ dot_pred_rel (type) ignore_rest_of_line (); return; } - while (isdigit (*input_line_pointer)) + while (ISDIGIT (*input_line_pointer)) ++input_line_pointer; if (p1 == -1) p1 = regno; @@ -4523,7 +4540,7 @@ dot_pred_rel (type) valueT stop = 1; ++input_line_pointer; - if (toupper (*input_line_pointer) != 'P' + if (TOUPPER (*input_line_pointer) != 'P' || (regno = atoi (++input_line_pointer)) < 0 || regno > 63) { @@ -4531,7 +4548,7 @@ dot_pred_rel (type) ignore_rest_of_line (); return; } - while (isdigit (*input_line_pointer)) + while (ISDIGIT (*input_line_pointer)) ++input_line_pointer; stop <<= regno; if (bit >= stop) @@ -4796,6 +4813,7 @@ pseudo_opcode[] = { "data2", cons, 2 }, { "data4", cons, 4 }, { "data8", cons, 8 }, + { "data16", cons, 16 }, { "real4", stmt_float_cons, 'f' }, { "real8", stmt_float_cons, 'd' }, { "real10", stmt_float_cons, 'x' }, @@ -4806,6 +4824,7 @@ pseudo_opcode[] = { "data2.ua", stmt_cons_ua, 2 }, { "data4.ua", stmt_cons_ua, 4 }, { "data8.ua", stmt_cons_ua, 8 }, + { "data16.ua", stmt_cons_ua, 16 }, { "real4.ua", float_cons, 'f' }, { "real8.ua", float_cons, 'd' }, { "real10.ua", float_cons, 'x' }, @@ -6381,6 +6400,10 @@ md_begin () symbol_new (".", undefined_section, FUNC_LT_FPTR_RELATIVE, &zero_address_frag); + pseudo_func[FUNC_IPLT_RELOC].u.sym = + symbol_new (".", undefined_section, FUNC_IPLT_RELOC, + &zero_address_frag); + /* Compute the table of best templates. We compute goodness as a base 4 value, in which each match counts for 3, each F counts for 2, each B counts for 1. This should maximize the number of @@ -6757,10 +6780,10 @@ ia64_unrecognized_line (ch) c = get_symbol_end (); } else if (LOCAL_LABELS_FB - && isdigit ((unsigned char) *input_line_pointer)) + && ISDIGIT (*input_line_pointer)) { temp = 0; - while (isdigit ((unsigned char) *input_line_pointer)) + while (ISDIGIT (*input_line_pointer)) temp = (temp * 10) + *input_line_pointer++ - '0'; fb_label_instance_inc (temp); s = fb_label_name (temp, 0); @@ -6933,7 +6956,7 @@ ia64_parse_name (name, e) switch (name[0]) { case 'i': - if (name[1] == 'n' && isdigit (name[2])) + if (name[1] == 'n' && ISDIGIT (name[2])) { dr = &md.in; name += 2; @@ -6941,7 +6964,7 @@ ia64_parse_name (name, e) break; case 'l': - if (name[1] == 'o' && name[2] == 'c' && isdigit (name[3])) + if (name[1] == 'o' && name[2] == 'c' && ISDIGIT (name[3])) { dr = &md.loc; name += 3; @@ -6949,7 +6972,7 @@ ia64_parse_name (name, e) break; case 'o': - if (name[1] == 'u' && name[2] == 't' && isdigit (name[3])) + if (name[1] == 'u' && name[2] == 't' && ISDIGIT (name[3])) { dr = &md.out; name += 3; @@ -9826,6 +9849,21 @@ ia64_cons_fix_new (f, where, nbytes, exp code = BFD_RELOC_IA64_DIR64LSB; break; + case 16: + if (exp->X_op == O_pseudo_fixup + && exp->X_op_symbol + && S_GET_VALUE (exp->X_op_symbol) == FUNC_IPLT_RELOC) + { + if (target_big_endian) + code = BFD_RELOC_IA64_IPLTMSB; + else + code = BFD_RELOC_IA64_IPLTLSB; + + exp->X_op = O_symbol; + break; + } + /* FALLTHRU */ + default: as_bad ("Unsupported fixup size %d", nbytes); ignore_rest_of_line (); @@ -9837,6 +9875,7 @@ ia64_cons_fix_new (f, where, nbytes, exp exp->X_op = O_symbol; code = ia64_gen_real_reloc_type (exp->X_op_symbol, code); } + fix = fix_new_exp (f, where, nbytes, exp, 0, code); /* We need to store the byte order in effect in case we're going to fix an 8 or 16 bit relocation (for which there no real @@ -9964,6 +10003,7 @@ ia64_gen_real_reloc_type (sym, r_type) break; } break; + default: abort (); } diff -uprN binutils-2.11.90.0.31/gas/config/tc-ia64.h binutils-2.11.92.0.5/gas/config/tc-ia64.h --- binutils-2.11.90.0.31/gas/config/tc-ia64.h Thu Jul 26 18:02:55 2001 +++ binutils-2.11.92.0.5/gas/config/tc-ia64.h Mon Oct 1 15:25:22 2001 @@ -81,6 +81,7 @@ extern void ia64_cons_fix_new PARAMS ((f expressionS *exp)); extern void ia64_validate_fix PARAMS ((struct fix *fix)); extern char * ia64_canonicalize_symbol_name PARAMS ((char *)); +extern int ia64_elf_section_letter PARAMS ((int, char **)); extern flagword ia64_elf_section_flags PARAMS ((flagword, int, int)); extern int ia64_elf_section_type PARAMS ((const char *, size_t len)); extern long ia64_pcrel_from_section PARAMS ((struct fix *fix, segT sec)); @@ -104,6 +105,7 @@ extern void ia64_handle_align PARAMS ((f as_fatal ("ia64_create_short_jump") #define md_estimate_size_before_relax(f,s) \ (as_fatal ("ia64_estimate_size_before_relax"), 1) +#define md_elf_section_letter ia64_elf_section_letter #define md_elf_section_flags ia64_elf_section_flags #define TC_FIX_TYPE struct ia64_fix #define TC_INIT_FIX_DATA(f) { f->tc_fix_data.opnd = 0; } diff -uprN binutils-2.11.90.0.31/gas/config/tc-m32r.c binutils-2.11.92.0.5/gas/config/tc-m32r.c --- binutils-2.11.90.0.31/gas/config/tc-m32r.c Thu Jul 26 18:02:55 2001 +++ binutils-2.11.92.0.5/gas/config/tc-m32r.c Mon Oct 1 15:25:22 2001 @@ -20,8 +20,8 @@ Boston, MA 02111-1307, USA. */ #include -#include #include "as.h" +#include "safe-ctype.h" #include "subsegs.h" #include "symcat.h" #include "opcodes/m32r-desc.h" @@ -819,15 +819,14 @@ assemble_two_insns (str, str2, parallel_ { char *s2 = str; - while (isspace (*s2++)) + while (ISSPACE (*s2++)) continue; --s2; - while (isalnum (*s2)) + while (ISALNUM (*s2)) { - if (isupper ((unsigned char) *s2)) - *s2 = tolower (*s2); + *s2 = TOLOWER (*s2); s2++; } } diff -uprN binutils-2.11.90.0.31/gas/config/tc-m68hc11.c binutils-2.11.92.0.5/gas/config/tc-m68hc11.c --- binutils-2.11.90.0.31/gas/config/tc-m68hc11.c Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/gas/config/tc-m68hc11.c Mon Oct 1 15:25:22 2001 @@ -20,8 +20,8 @@ Boston, MA 02111-1307, USA. */ #include -#include #include "as.h" +#include "safe-ctype.h" #include "subsegs.h" #include "opcode/m68hc11.h" #include "dwarf2dbg.h" @@ -152,6 +152,10 @@ static alias alias_opcodes[] = { /* Local functions. */ static register_id reg_name_search PARAMS ((char *)); static register_id register_name PARAMS ((void)); +static int cmp_opcode PARAMS ((struct m68hc11_opcode *, + struct m68hc11_opcode *)); +static char *print_opcode_format PARAMS ((struct m68hc11_opcode *, int)); +static char *skip_whites PARAMS ((char *)); static int check_range PARAMS ((long, int)); static void print_opcode_list PARAMS ((void)); static void get_default_target PARAMS ((void)); @@ -159,12 +163,22 @@ static void print_insn_format PARAMS ((c static int get_operand PARAMS ((operand *, int, long)); static void fixup8 PARAMS ((expressionS *, int, int)); static void fixup16 PARAMS ((expressionS *, int, int)); +static unsigned char convert_branch PARAMS ((unsigned char)); +static char *m68hc11_new_insn PARAMS ((int)); +static void build_dbranch_insn PARAMS ((struct m68hc11_opcode *, + operand *, int, int)); +static int build_indexed_byte PARAMS ((operand *, int, int)); +static int build_reg_mode PARAMS ((operand *, int)); + +static struct m68hc11_opcode *find + PARAMS ((struct m68hc11_opcode_def *, operand *, int)); static struct m68hc11_opcode *find_opcode PARAMS ((struct m68hc11_opcode_def *, operand *, int *)); static void build_jump_insn PARAMS ((struct m68hc11_opcode *, operand *, int, int)); static void build_insn PARAMS ((struct m68hc11_opcode *, operand *, int)); +static int relaxable_symbol PARAMS ((symbolS *)); /* Controls whether relative branches can be turned into long branches. When the relative offset is too large, the insn are changed: @@ -803,7 +817,7 @@ print_insn_format (name) { char *fmt; - fmt = print_opcode_format (opcode, 0, 0); + fmt = print_opcode_format (opcode, 0); sprintf (buf, "\t%-5.5s %s", opcode->name, fmt); as_bad ("%s", buf); @@ -2234,7 +2248,7 @@ md_assemble (str) *op_end && nlen < 20 && !is_end_of_line[*op_end] && *op_end != ' '; op_end++) { - name[nlen] = tolower (op_start[nlen]); + name[nlen] = TOLOWER (op_start[nlen]); nlen++; } name[nlen] = 0; @@ -2276,14 +2290,14 @@ md_assemble (str) && (*op_end && (is_end_of_line[op_end[1]] || op_end[1] == ' ' || op_end[1] == '\t' - || !isalnum (op_end[1]))) + || !ISALNUM (op_end[1]))) && (*op_end == 'a' || *op_end == 'b' || *op_end == 'A' || *op_end == 'B' || *op_end == 'd' || *op_end == 'D' || *op_end == 'x' || *op_end == 'X' || *op_end == 'y' || *op_end == 'Y')) { - name[nlen++] = tolower (*op_end++); + name[nlen++] = TOLOWER (*op_end++); name[nlen] = 0; opc = (struct m68hc11_opcode_def *) hash_find (m68hc11_hash, name); @@ -2359,7 +2373,7 @@ md_assemble (str) relative and must be in the range -256..255 (9-bits). */ if ((opcode->format & M6812_XBCC_MARKER) && (opcode->format & M6811_OP_JUMP_REL)) - build_dbranch_insn (opcode, operands, nb_operands); + build_dbranch_insn (opcode, operands, nb_operands, branch_optimize); /* Relative jumps instructions are taken care of separately. We have to make sure that the relative branch is within the range -128..127. If it's out diff -uprN binutils-2.11.90.0.31/gas/config/tc-m68k.c binutils-2.11.92.0.5/gas/config/tc-m68k.c --- binutils-2.11.90.0.31/gas/config/tc-m68k.c Thu Jul 26 18:02:55 2001 +++ binutils-2.11.92.0.5/gas/config/tc-m68k.c Mon Oct 1 15:25:22 2001 @@ -20,8 +20,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include #include "as.h" +#include "safe-ctype.h" #include "obstack.h" #include "subsegs.h" #include "dwarf2dbg.h" @@ -648,8 +648,6 @@ CONST pseudo_typeS mote_pseudo_table[] = extern char *input_line_pointer; -static char mklower_table[256]; -#define mklower(c) (mklower_table[(unsigned char) (c)]) static char notend_table[256]; static char alt_notend_table[256]; #define notend(s) \ @@ -3311,7 +3309,7 @@ insert_reg (regname, regnum) &zero_address_frag)); for (i = 0; regname[i]; i++) - buf[i] = islower (regname[i]) ? toupper (regname[i]) : regname[i]; + buf[i] = TOUPPER (regname[i]); buf[i] = '\0'; symbol_table_insert (symbol_new (buf, reg_section, regnum, @@ -3880,9 +3878,6 @@ md_begin () } } - for (i = 0; i < (int) sizeof (mklower_table); i++) - mklower_table[i] = (isupper (c = (char) i)) ? tolower (c) : c; - for (i = 0; i < (int) sizeof (notend_table); i++) { notend_table[i] = 0; @@ -5370,7 +5365,7 @@ s_reg (ignore) SKIP_WHITESPACE (); s = input_line_pointer; - while (isalnum ((unsigned char) *input_line_pointer) + while (ISALNUM (*input_line_pointer) #ifdef REGISTER_PREFIX || *input_line_pointer == REGISTER_PREFIX #endif @@ -5582,10 +5577,7 @@ mri_assemble (str) /* md_assemble expects the opcode to be in lower case. */ for (s = str; *s != ' ' && *s != '\0'; s++) - { - if (isupper ((unsigned char) *s)) - *s = tolower ((unsigned char) *s); - } + *s = TOLOWER (*s); md_assemble (str); } @@ -5667,10 +5659,8 @@ parse_mri_condition (pcc) ++input_line_pointer; SKIP_WHITESPACE (); - if (isupper (c1)) - c1 = tolower (c1); - if (isupper (c2)) - c2 = tolower (c2); + c1 = TOLOWER (c1); + c2 = TOLOWER (c2); *pcc = (c1 << 8) | c2; @@ -5912,7 +5902,7 @@ build_mri_control_operand (qual, cc, lef *s++ = 'm'; *s++ = 'p'; if (qual != '\0') - *s++ = tolower (qual); + *s++ = TOLOWER (qual); *s++ = ' '; memcpy (s, leftstart, leftstop - leftstart); s += leftstop - leftstart; @@ -5930,7 +5920,7 @@ build_mri_control_operand (qual, cc, lef *s++ = cc >> 8; *s++ = cc & 0xff; if (extent != '\0') - *s++ = tolower (extent); + *s++ = TOLOWER (extent); *s++ = ' '; strcpy (s, truelab); mri_assemble (buf); @@ -6180,7 +6170,7 @@ s_mri_else (qual) mri_control_stack->else_seen = 1; buf = (char *) xmalloc (20 + strlen (mri_control_stack->bottom)); - q[0] = tolower (qual); + q[0] = TOLOWER (qual); q[1] = '\0'; sprintf (buf, "bra%s %s", q, mri_control_stack->bottom); mri_assemble (buf); @@ -6253,7 +6243,7 @@ s_mri_break (extent) } buf = (char *) xmalloc (20 + strlen (n->bottom)); - ex[0] = tolower (extent); + ex[0] = TOLOWER (extent); ex[1] = '\0'; sprintf (buf, "bra%s %s", ex, n->bottom); mri_assemble (buf); @@ -6292,7 +6282,7 @@ s_mri_next (extent) } buf = (char *) xmalloc (20 + strlen (n->next)); - ex[0] = tolower (extent); + ex[0] = TOLOWER (extent); ex[1] = '\0'; sprintf (buf, "bra%s %s", ex, n->next); mri_assemble (buf); @@ -6476,7 +6466,7 @@ s_mri_for (qual) *s++ = 'v'; *s++ = 'e'; if (qual != '\0') - *s++ = tolower (qual); + *s++ = TOLOWER (qual); *s++ = ' '; memcpy (s, initstart, initstop - initstart); s += initstop - initstart; @@ -6494,7 +6484,7 @@ s_mri_for (qual) *s++ = 'm'; *s++ = 'p'; if (qual != '\0') - *s++ = tolower (qual); + *s++ = TOLOWER (qual); *s++ = ' '; memcpy (s, endstart, endstop - endstart); s += endstop - endstart; @@ -6505,7 +6495,7 @@ s_mri_for (qual) mri_assemble (buf); /* bcc bottom */ - ex[0] = tolower (extent); + ex[0] = TOLOWER (extent); ex[1] = '\0'; if (up) sprintf (buf, "blt%s %s", ex, n->bottom); @@ -6521,7 +6511,7 @@ s_mri_for (qual) strcpy (s, "sub"); s += 3; if (qual != '\0') - *s++ = tolower (qual); + *s++ = TOLOWER (qual); *s++ = ' '; memcpy (s, bystart, bystop - bystart); s += bystop - bystart; diff -uprN binutils-2.11.90.0.31/gas/config/tc-m88k.c binutils-2.11.92.0.5/gas/config/tc-m88k.c --- binutils-2.11.90.0.31/gas/config/tc-m88k.c Thu Jul 26 18:02:55 2001 +++ binutils-2.11.92.0.5/gas/config/tc-m88k.c Mon Oct 1 15:25:22 2001 @@ -2,7 +2,7 @@ Contributed by Devon Bowen of Buffalo University and Torbjorn Granlund of the Swedish Institute of Computer Science. Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999, - 2000 + 2000, 2001 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -22,8 +22,8 @@ along with GAS; see the file COPYING. I Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include #include "as.h" +#include "safe-ctype.h" #include "subsegs.h" #include "m88k-opcode.h" @@ -239,7 +239,7 @@ md_assemble (op) assert (op); /* Skip over instruction to find parameters. */ - for (param = op; *param != 0 && !isspace (*param); param++) + for (param = op; *param != 0 && !ISSPACE (*param); param++) ; c = *param; *param++ = '\0'; @@ -517,17 +517,17 @@ get_imm16 (param, insn) unsigned int val; char *save_ptr; - if (!strncmp (param, "hi16", 4) && !isalnum (param[4])) + if (!strncmp (param, "hi16", 4) && !ISALNUM (param[4])) { reloc = RELOC_HI16; param += 4; } - else if (!strncmp (param, "lo16", 4) && !isalnum (param[4])) + else if (!strncmp (param, "lo16", 4) && !ISALNUM (param[4])) { reloc = RELOC_LO16; param += 4; } - else if (!strncmp (param, "iw16", 4) && !isalnum (param[4])) + else if (!strncmp (param, "iw16", 4) && !ISALNUM (param[4])) { reloc = RELOC_IW16; param += 4; @@ -630,7 +630,7 @@ get_cnd (param, valp) { unsigned int val; - if (isdigit (*param)) + if (ISDIGIT (*param)) { param = getval (param, &val); @@ -642,11 +642,8 @@ get_cnd (param, valp) } else { - if (isupper (*param)) - *param = tolower (*param); - - if (isupper (param[1])) - param[1] = tolower (param[1]); + param[0] = TOLOWER (param[0]); + param[1] = TOLOWER (param[1]); param = match_name (param, cndmsk, valp); @@ -690,12 +687,10 @@ get_bf_offset_expression (param, offsetp { unsigned offset; - if (isalpha (param[0])) + if (ISALPHA (param[0])) { - if (isupper (param[0])) - param[0] = tolower (param[0]); - if (isupper (param[1])) - param[1] = tolower (param[1]); + param[0] = TOLOWER (param[0]); + param[1] = TOLOWER (param[1]); param = match_name (param, cmpslot, offsetp); @@ -888,9 +883,9 @@ get_o6 (param, valp) } #define hexval(z) \ - (isdigit (z) ? (z) - '0' : \ - islower (z) ? (z) - 'a' + 10 : \ - isupper (z) ? (z) - 'A' + 10 : -1) + (ISDIGIT (z) ? (z) - '0' : \ + ISLOWER (z) ? (z) - 'a' + 10 : \ + ISUPPER (z) ? (z) - 'A' + 10 : -1) static char * getval (param, valp) diff -uprN binutils-2.11.90.0.31/gas/config/tc-mcore.c binutils-2.11.92.0.5/gas/config/tc-mcore.c --- binutils-2.11.90.0.31/gas/config/tc-mcore.c Thu Jul 26 18:02:55 2001 +++ binutils-2.11.92.0.5/gas/config/tc-mcore.c Mon Oct 1 15:25:22 2001 @@ -24,7 +24,7 @@ #include "subsegs.h" #define DEFINE_TABLE #include "../opcodes/mcore-opc.h" -#include +#include "safe-ctype.h" #include #ifdef OBJ_ELF @@ -390,11 +390,11 @@ mcore_s_section (ignore) pool. */ char * ilp = input_line_pointer; - while (*ilp != 0 && isspace(*ilp)) + while (*ilp != 0 && ISSPACE (*ilp)) ++ ilp; if (strncmp (ilp, ".line", 5) == 0 - && (isspace (ilp[5]) || *ilp == '\n' || *ilp == '\r')) + && (ISSPACE (ilp[5]) || *ilp == '\n' || *ilp == '\r')) ; else dump_literals (0); @@ -480,10 +480,10 @@ parse_reg (s, reg) unsigned * reg; { /* Strip leading whitespace. */ - while (isspace (* s)) + while (ISSPACE (* s)) ++ s; - if (tolower (s[0]) == 'r') + if (TOLOWER (s[0]) == 'r') { if (s[1] == '1' && s[2] >= '0' && s[2] <= '5') { @@ -497,9 +497,9 @@ parse_reg (s, reg) return s + 2; } } - else if ( tolower (s[0]) == 's' - && tolower (s[1]) == 'p' - && ! isalnum (s[2])) + else if ( TOLOWER (s[0]) == 's' + && TOLOWER (s[1]) == 'p' + && ! ISALNUM (s[2])) { * reg = 0; return s + 2; @@ -540,10 +540,10 @@ parse_creg (s, reg) int i; /* Strip leading whitespace. */ - while (isspace (* s)) + while (ISSPACE (* s)) ++s; - if ((tolower (s[0]) == 'c' && tolower (s[1]) == 'r')) + if ((TOLOWER (s[0]) == 'c' && TOLOWER (s[1]) == 'r')) { if (s[2] == '3' && s[3] >= '0' && s[3] <= '1') { @@ -580,7 +580,7 @@ parse_creg (s, reg) length = strlen (cregs[i].name); for (j = 0; j < length; j++) - buf[j] = tolower (s[j]); + buf[j] = TOLOWER (s[j]); if (strncmp (cregs[i].name, buf, length) == 0) { @@ -615,7 +615,7 @@ parse_psrmod (s, reg) }; for (i = 0; i < 2; i++) - buf[i] = isascii (s[i]) ? tolower (s[i]) : 0; + buf[i] = TOLOWER (s[i]); for (i = sizeof (psrmods) / sizeof (psrmods[0]); i--;) { @@ -643,7 +643,7 @@ parse_exp (s, e) char * new; /* Skip whitespace. */ - while (isspace (* s)) + while (ISSPACE (* s)) ++ s; save = input_line_pointer; @@ -903,14 +903,14 @@ parse_mem (s, reg, off, siz) * off = 0; - while (isspace (* s)) + while (ISSPACE (* s)) ++ s; if (* s == '(') { s = parse_reg (s + 1, reg); - while (isspace (* s)) + while (ISSPACE (* s)) ++ s; if (* s == ',') @@ -936,7 +936,7 @@ parse_mem (s, reg, off, siz) } } - while (isspace (* s)) + while (ISSPACE (* s)) ++ s; if (* s == ')') @@ -969,7 +969,7 @@ md_assemble (str) char name[20]; /* Drop leading whitespace. */ - while (isspace (* str)) + while (ISSPACE (* str)) str ++; /* Find the op code end. */ @@ -1068,7 +1068,7 @@ md_assemble (str) inst |= reg; /* Skip whitespace. */ - while (isspace (* op_end)) + while (ISSPACE (* op_end)) ++ op_end; if (*op_end == ',') @@ -1092,7 +1092,7 @@ md_assemble (str) inst |= reg; /* Skip whitespace. */ - while (isspace (* op_end)) + while (ISSPACE (* op_end)) ++ op_end; if (* op_end == ',') @@ -1110,7 +1110,7 @@ md_assemble (str) op_end = parse_reg (op_end + 1, & reg); /* Skip whitespace. */ - while (isspace (* op_end)) + while (ISSPACE (* op_end)) ++ op_end; if (* op_end == ',') /* xtrb- r1,rx */ @@ -1130,7 +1130,7 @@ md_assemble (str) inst |= reg; /* Skip whitespace. */ - while (isspace (* op_end)) + while (ISSPACE (* op_end)) ++ op_end; if (* op_end == ',') @@ -1150,7 +1150,7 @@ md_assemble (str) inst |= reg; /* Skip whitespace. */ - while (isspace (* op_end)) + while (ISSPACE (* op_end)) ++ op_end; if (* op_end == ',') @@ -1169,7 +1169,7 @@ md_assemble (str) inst |= reg; /* Skip whitespace. */ - while (isspace (* op_end)) + while (ISSPACE (* op_end)) ++ op_end; if (* op_end == ',') @@ -1188,7 +1188,7 @@ md_assemble (str) inst |= reg; /* Skip whitespace. */ - while (isspace (* op_end)) + while (ISSPACE (* op_end)) ++ op_end; if (* op_end == ',') @@ -1217,7 +1217,7 @@ md_assemble (str) inst |= reg; /* Skip whitespace. */ - while (isspace (* op_end)) + while (ISSPACE (* op_end)) ++ op_end; if (* op_end == ',') @@ -1244,7 +1244,7 @@ md_assemble (str) inst |= reg; /* Skip whitespace. */ - while (isspace (* op_end)) + while (ISSPACE (* op_end)) ++ op_end; if (* op_end == ',') @@ -1283,7 +1283,7 @@ md_assemble (str) inst |= reg; /* Skip whitespace. */ - while (isspace (* op_end)) + while (ISSPACE (* op_end)) ++ op_end; if (* op_end == ',') @@ -1316,7 +1316,7 @@ md_assemble (str) inst |= reg; /* Skip whitespace. */ - while (isspace (* op_end)) + while (ISSPACE (* op_end)) ++ op_end; if (* op_end == ',') @@ -1335,7 +1335,7 @@ md_assemble (str) inst |= reg; /* Skip whitespace. */ - while (isspace (* op_end)) + while (ISSPACE (* op_end)) ++ op_end; if (* op_end == ',') @@ -1354,7 +1354,7 @@ md_assemble (str) inst |= reg << 8; /* Skip whitespace. */ - while (isspace (* op_end)) + while (ISSPACE (* op_end)) ++ op_end; if (* op_end == ',') @@ -1390,7 +1390,7 @@ md_assemble (str) inst |= (reg << 8); /* Skip whitespace. */ - while (isspace (* op_end)) + while (ISSPACE (* op_end)) ++ op_end; if (* op_end == ',') @@ -1421,7 +1421,7 @@ md_assemble (str) inst |= reg; /* Skip whitespace. */ - while (isspace (* op_end)) + while (ISSPACE (* op_end)) ++ op_end; if (* op_end == '-') @@ -1432,7 +1432,7 @@ md_assemble (str) as_bad (_("ending register must be r15")); /* Skip whitespace. */ - while (isspace (* op_end)) + while (ISSPACE (* op_end)) ++ op_end; } @@ -1441,7 +1441,7 @@ md_assemble (str) op_end ++; /* Skip whitespace. */ - while (isspace (* op_end)) + while (ISSPACE (* op_end)) ++ op_end; if (* op_end == '(') @@ -1470,7 +1470,7 @@ md_assemble (str) as_fatal (_("first register must be r4")); /* Skip whitespace. */ - while (isspace (* op_end)) + while (ISSPACE (* op_end)) ++ op_end; if (* op_end == '-') @@ -1481,7 +1481,7 @@ md_assemble (str) as_fatal (_("last register must be r7")); /* Skip whitespace. */ - while (isspace (* op_end)) + while (ISSPACE (* op_end)) ++ op_end; if (* op_end == ',') @@ -1489,7 +1489,7 @@ md_assemble (str) op_end ++; /* Skip whitespace. */ - while (isspace (* op_end)) + while (ISSPACE (* op_end)) ++ op_end; if (* op_end == '(') @@ -1502,7 +1502,7 @@ md_assemble (str) inst |= reg; /* Skip whitespace. */ - while (isspace (* op_end)) + while (ISSPACE (* op_end)) ++ op_end; if (* op_end == ')') @@ -1535,7 +1535,7 @@ md_assemble (str) inst |= reg << 4; /* Skip whitespace. */ - while (isspace (* op_end)) + while (ISSPACE (* op_end)) ++ op_end; if (* op_end == ',') @@ -1595,7 +1595,7 @@ md_assemble (str) inst |= reg; /* Skip whitespace. */ - while (isspace (* op_end)) + while (ISSPACE (* op_end)) ++ op_end; if (* op_end == ',') @@ -1617,7 +1617,7 @@ md_assemble (str) inst |= reg << 4; /* Skip whitespace. */ - while (isspace (* op_end)) + while (ISSPACE (* op_end)) ++ op_end; if (* op_end == ',') @@ -1638,7 +1638,7 @@ md_assemble (str) inst |= reg; /* Skip whitespace. */ - while (isspace (* op_end)) + while (ISSPACE (* op_end)) ++ op_end; if (* op_end == ',') @@ -1690,7 +1690,7 @@ md_assemble (str) } /* Drop whitespace after all the operands have been parsed. */ - while (isspace (* op_end)) + while (ISSPACE (* op_end)) op_end ++; /* Give warning message if the insn has more operands than required. */ diff -uprN binutils-2.11.90.0.31/gas/config/tc-mips.c binutils-2.11.92.0.5/gas/config/tc-mips.c --- binutils-2.11.90.0.31/gas/config/tc-mips.c Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/gas/config/tc-mips.c Fri Oct 5 14:11:21 2001 @@ -26,8 +26,7 @@ #include "as.h" #include "config.h" #include "subsegs.h" - -#include +#include "safe-ctype.h" #ifdef USE_STDARG #include @@ -103,42 +102,6 @@ static char *mips_regmask_frag; extern int target_big_endian; -/* 1 is we should use the 64 bit MIPS ELF ABI, 0 if we should use the - 32 bit ABI. This has no meaning for ECOFF. - Note that the default is always 32 bit, even if "configured" for - 64 bit [e.g. --target=mips64-elf]. */ -static int mips_64; - -/* The default target format to use. */ - -const char * -mips_target_format () -{ - switch (OUTPUT_FLAVOR) - { - case bfd_target_aout_flavour: - return target_big_endian ? "a.out-mips-big" : "a.out-mips-little"; - case bfd_target_ecoff_flavour: - return target_big_endian ? "ecoff-bigmips" : ECOFF_LITTLE_FORMAT; - case bfd_target_coff_flavour: - return "pe-mips"; - case bfd_target_elf_flavour: -#ifdef TE_TMIPS - /* This is traditional mips */ - return (target_big_endian - ? (mips_64 ? "elf64-tradbigmips" : "elf32-tradbigmips") - : (mips_64 ? "elf64-tradlittlemips" : "elf32-tradlittlemips")); -#else - return (target_big_endian - ? (mips_64 ? "elf64-bigmips" : "elf32-bigmips") - : (mips_64 ? "elf64-littlemips" : "elf32-littlemips")); -#endif - default: - abort (); - return NULL; - } -} - /* The name of the readonly data section. */ #define RDATA_SECTION_NAME (OUTPUT_FLAVOR == bfd_target_aout_flavour \ ? ".data" \ @@ -216,8 +179,18 @@ static int mips_arch = CPU_UNKNOWN; are optimizing. */ static int mips_tune = CPU_UNKNOWN; -/* The argument of the -mabi= flag. */ -static char * mips_abi_string = NULL; +/* The ABI to use. */ +enum mips_abi_level +{ + NO_ABI = 0, + O32_ABI, + O64_ABI, + N32_ABI, + N64_ABI, + EABI_ABI +}; + +static enum mips_abi_level mips_abi = NO_ABI; /* Whether we should mark the file EABI64 or EABI32. */ static int mips_eabi64 = 0; @@ -232,9 +205,6 @@ static int mips_gp32 = 0; /* True if -mfp32 was passed. */ static int mips_fp32 = 0; -/* True if the selected ABI is defined for 32-bit registers only. */ -static int mips_32bit_abi = 0; - /* Some ISA's have delay slots for instructions which read or write from a coprocessor (eg. mips1-mips3); some don't (eg mips4). Return true if instructions marked INSN_LOAD_COPROC_DELAY, @@ -257,22 +227,31 @@ static int mips_32bit_abi = 0; || (ISA) == ISA_MIPS64 \ ) -#define HAVE_32BIT_GPRS \ - (mips_gp32 \ - || mips_32bit_abi \ - || ! ISA_HAS_64BIT_REGS (mips_opts.isa)) - -#define HAVE_32BIT_FPRS \ - (mips_fp32 \ - || mips_32bit_abi \ - || ! ISA_HAS_64BIT_REGS (mips_opts.isa)) +#define HAVE_32BIT_GPRS \ + (mips_gp32 \ + || mips_abi == O32_ABI \ + || ! ISA_HAS_64BIT_REGS (mips_opts.isa)) + +#define HAVE_32BIT_FPRS \ + (mips_fp32 \ + || mips_abi == O32_ABI \ + || ! ISA_HAS_64BIT_REGS (mips_opts.isa)) #define HAVE_64BIT_GPRS (! HAVE_32BIT_GPRS) #define HAVE_64BIT_FPRS (! HAVE_32BIT_FPRS) -#define HAVE_32BIT_ADDRESSES \ - (HAVE_32BIT_GPRS \ - || bfd_arch_bits_per_address (stdoutput) == 32) +#define HAVE_NEWABI (mips_abi == N32_ABI || mips_abi == N64_ABI) + +#define HAVE_64BIT_OBJECTS (mips_abi == N64_ABI) + +/* We can only have 64bit addresses if the object file format + supports it. */ +#define HAVE_32BIT_ADDRESSES \ + (HAVE_32BIT_GPRS \ + || bfd_arch_bits_per_address (stdoutput) == 32 \ + || ! HAVE_64BIT_OBJECTS) + +#define HAVE_64BIT_ADDRESSES (! HAVE_32BIT_ADDRESSES) /* Whether the processor uses hardware interlocks to protect reads from the HI and LO registers, and thus does not @@ -451,10 +430,10 @@ static struct frag *prev_insn_frag; static long prev_insn_where; /* The reloc type for the previous instruction, if any. */ -static bfd_reloc_code_real_type prev_insn_reloc_type; +static bfd_reloc_code_real_type prev_insn_reloc_type[3]; /* The reloc for the previous instruction, if any. */ -static fixS *prev_insn_fixp; +static fixS *prev_insn_fixp[3]; /* Non-zero if the previous instruction was in a delay slot. */ static int prev_insn_is_delay_slot; @@ -664,7 +643,7 @@ static void mips16_mark_labels PARAMS (( static void append_insn PARAMS ((char *place, struct mips_cl_insn * ip, expressionS * p, - bfd_reloc_code_real_type r, + bfd_reloc_code_real_type *r, boolean)); static void mips_no_prev_insn PARAMS ((int)); static void mips_emit_delays PARAMS ((boolean)); @@ -698,6 +677,7 @@ static void mips16_immed PARAMS ((char * boolean *, unsigned short *)); static int my_getSmallExpression PARAMS ((expressionS * ep, char *str)); static void my_getExpression PARAMS ((expressionS * ep, char *str)); +static int support_64bit_objects PARAMS((void)); static symbolS *get_symbol PARAMS ((void)); static void mips_align PARAMS ((int to, int fill, symbolS *label)); static void s_align PARAMS ((int)); @@ -888,8 +868,10 @@ static expressionS offset_expr; /* Relocs associated with imm_expr and offset_expr. */ -static bfd_reloc_code_real_type imm_reloc; -static bfd_reloc_code_real_type offset_reloc; +static bfd_reloc_code_real_type imm_reloc[3] + = {BFD_RELOC_UNUSED, BFD_RELOC_UNUSED, BFD_RELOC_UNUSED}; +static bfd_reloc_code_real_type offset_reloc[3] + = {BFD_RELOC_UNUSED, BFD_RELOC_UNUSED, BFD_RELOC_UNUSED}; /* This is set by mips_ip if imm_reloc is an unmatched HI16_S reloc. */ @@ -935,6 +917,39 @@ mips_cpu_to_str (cpu) return s; } +/* The default target format to use. */ + +const char * +mips_target_format () +{ + switch (OUTPUT_FLAVOR) + { + case bfd_target_aout_flavour: + return target_big_endian ? "a.out-mips-big" : "a.out-mips-little"; + case bfd_target_ecoff_flavour: + return target_big_endian ? "ecoff-bigmips" : ECOFF_LITTLE_FORMAT; + case bfd_target_coff_flavour: + return "pe-mips"; + case bfd_target_elf_flavour: +#ifdef TE_TMIPS + /* This is traditional mips */ + return (target_big_endian + ? (HAVE_64BIT_OBJECTS ? "elf64-tradbigmips" + : "elf32-tradbigmips") + : (HAVE_64BIT_OBJECTS ? "elf64-tradlittlemips" + : "elf32-tradlittlemips")); +#else + return (target_big_endian + ? (HAVE_64BIT_OBJECTS ? "elf64-bigmips" : "elf32-bigmips") + : (HAVE_64BIT_OBJECTS ? "elf64-littlemips" + : "elf32-littlemips")); +#endif + default: + abort (); + return NULL; + } +} + /* This function is called once, at assembler startup time. It should set up all the tables, etc. that the MD part of the assembler will need. */ @@ -1076,8 +1091,7 @@ md_begin () to change the ISA with directives. This isn't really the best, but then neither is basing the abi on the isa. */ if (ISA_HAS_64BIT_REGS (mips_opts.isa) - && mips_abi_string - && 0 == strcmp (mips_abi_string, "eabi")) + && mips_abi == EABI_ABI) mips_eabi64 = 1; /* If they asked for mips1 or mips2 and a cpu that is @@ -1217,7 +1231,7 @@ md_begin () if (strcmp (TARGET_OS, "elf") != 0) flags |= SEC_ALLOC | SEC_LOAD; - if (! mips_64) + if (! HAVE_NEWABI) { sec = subseg_new (".reginfo", (subsegT) 0); @@ -1291,12 +1305,18 @@ md_assemble (str) char *str; { struct mips_cl_insn insn; + bfd_reloc_code_real_type unused_reloc[3] + = {BFD_RELOC_UNUSED, BFD_RELOC_UNUSED, BFD_RELOC_UNUSED}; imm_expr.X_op = O_absent; - imm_reloc = BFD_RELOC_UNUSED; imm_unmatched_hi = false; offset_expr.X_op = O_absent; - offset_reloc = BFD_RELOC_UNUSED; + imm_reloc[0] = BFD_RELOC_UNUSED; + imm_reloc[1] = BFD_RELOC_UNUSED; + imm_reloc[2] = BFD_RELOC_UNUSED; + offset_reloc[0] = BFD_RELOC_UNUSED; + offset_reloc[1] = BFD_RELOC_UNUSED; + offset_reloc[2] = BFD_RELOC_UNUSED; if (mips_opts.mips16) mips16_ip (str, &insn); @@ -1328,7 +1348,7 @@ md_assemble (str) else if (offset_expr.X_op != O_absent) append_insn ((char *) NULL, &insn, &offset_expr, offset_reloc, false); else - append_insn ((char *) NULL, &insn, NULL, BFD_RELOC_UNUSED, false); + append_insn ((char *) NULL, &insn, NULL, unused_reloc, false); } } @@ -1480,12 +1500,12 @@ append_insn (place, ip, address_expr, re char *place; struct mips_cl_insn *ip; expressionS *address_expr; - bfd_reloc_code_real_type reloc_type; + bfd_reloc_code_real_type *reloc_type; boolean unmatched_hi; { register unsigned long prev_pinfo, pinfo; char *f; - fixS *fixp; + fixS *fixp[3]; int nops = 0; /* Mark instruction labels in mips16 mode. */ @@ -1831,16 +1851,16 @@ append_insn (place, ip, address_expr, re } } - if (reloc_type > BFD_RELOC_UNUSED) + if (*reloc_type > BFD_RELOC_UNUSED) { /* We need to set up a variant frag. */ assert (mips_opts.mips16 && address_expr != NULL); f = frag_var (rs_machine_dependent, 4, 0, - RELAX_MIPS16_ENCODE (reloc_type - BFD_RELOC_UNUSED, + RELAX_MIPS16_ENCODE (*reloc_type - BFD_RELOC_UNUSED, mips16_small, mips16_ext, (prev_pinfo & INSN_UNCOND_BRANCH_DELAY), - (prev_insn_reloc_type + (*prev_insn_reloc_type == BFD_RELOC_MIPS16_JMP)), make_expr_symbol (address_expr), (offsetT) 0, (char *) NULL); @@ -1849,7 +1869,7 @@ append_insn (place, ip, address_expr, re f = place; else if (mips_opts.mips16 && ! ip->use_extend - && reloc_type != BFD_RELOC_MIPS16_JMP) + && *reloc_type != BFD_RELOC_MIPS16_JMP) { /* Make sure there is enough room to swap this instruction with a following jump instruction. */ @@ -1866,17 +1886,39 @@ append_insn (place, ip, address_expr, re f = frag_more (4); } - fixp = NULL; - if (address_expr != NULL && reloc_type < BFD_RELOC_UNUSED) + fixp[0] = fixp[1] = fixp[2] = NULL; + if (address_expr != NULL && *reloc_type < BFD_RELOC_UNUSED) { if (address_expr->X_op == O_constant) { - switch (reloc_type) + unsigned long tmp; + + switch (*reloc_type) { case BFD_RELOC_32: ip->insn_opcode |= address_expr->X_add_number; break; + case BFD_RELOC_MIPS_HIGHEST: + tmp = (address_expr->X_add_number + 0x800080008000) >> 16; + tmp >>= 16; + ip->insn_opcode |= (tmp >> 16) & 0xffff; + break; + + case BFD_RELOC_MIPS_HIGHER: + tmp = (address_expr->X_add_number + 0x80008000) >> 16; + ip->insn_opcode |= (tmp >> 16) & 0xffff; + break; + + case BFD_RELOC_HI16_S: + ip->insn_opcode |= ((address_expr->X_add_number + 0x8000) + >> 16) & 0xffff; + break; + + case BFD_RELOC_HI16: + ip->insn_opcode |= (address_expr->X_add_number >> 16) & 0xffff; + break; + case BFD_RELOC_LO16: ip->insn_opcode |= address_expr->X_add_number & 0xffff; break; @@ -1898,6 +1940,10 @@ append_insn (place, ip, address_expr, re | ((address_expr->X_add_number & 0x3fffc) >> 2)); break; + case BFD_RELOC_16_PCREL: + ip->insn_opcode |= address_expr->X_add_number & 0xffff; + break; + case BFD_RELOC_16_PCREL_S2: goto need_reloc; @@ -1908,33 +1954,122 @@ append_insn (place, ip, address_expr, re else { need_reloc: - /* Don't generate a reloc if we are writing into a variant - frag. */ + /* Don't generate a reloc if we are writing into a variant frag. */ if (place == NULL) { - fixp = fix_new_exp (frag_now, f - frag_now->fr_literal, 4, - address_expr, - reloc_type == BFD_RELOC_16_PCREL_S2, - reloc_type); + fixp[0] = fix_new_exp (frag_now, f - frag_now->fr_literal, 4, + address_expr, + (*reloc_type == BFD_RELOC_16_PCREL + || *reloc_type == BFD_RELOC_16_PCREL_S2), + reloc_type[0]); + + /* These relocations can have a addend that won't fit in + 4 octets for 64bit assembly. */ + if (HAVE_64BIT_GPRS && + (*reloc_type == BFD_RELOC_16 + || *reloc_type == BFD_RELOC_32 + || *reloc_type == BFD_RELOC_MIPS_JMP + || *reloc_type == BFD_RELOC_HI16_S + || *reloc_type == BFD_RELOC_LO16 + || *reloc_type == BFD_RELOC_GPREL16 + || *reloc_type == BFD_RELOC_MIPS_LITERAL + || *reloc_type == BFD_RELOC_GPREL32 + || *reloc_type == BFD_RELOC_64 + || *reloc_type == BFD_RELOC_CTOR + || *reloc_type == BFD_RELOC_MIPS_SUB + || *reloc_type == BFD_RELOC_MIPS_HIGHEST + || *reloc_type == BFD_RELOC_MIPS_HIGHER + || *reloc_type == BFD_RELOC_MIPS_SCN_DISP + || *reloc_type == BFD_RELOC_MIPS_REL16 + || *reloc_type == BFD_RELOC_MIPS_RELGOT)) + fixp[0]->fx_no_overflow = 1; + if (unmatched_hi) { struct mips_hi_fixup *hi_fixup; - assert (reloc_type == BFD_RELOC_HI16_S); + assert (*reloc_type == BFD_RELOC_HI16_S); hi_fixup = ((struct mips_hi_fixup *) xmalloc (sizeof (struct mips_hi_fixup))); - hi_fixup->fixp = fixp; + hi_fixup->fixp = fixp[0]; hi_fixup->seg = now_seg; hi_fixup->next = mips_hi_fixup_list; mips_hi_fixup_list = hi_fixup; } + + if (reloc_type[1] != BFD_RELOC_UNUSED) + { + /* FIXME: This symbol can be one of + RSS_UNDEF, RSS_GP, RSS_GP0, RSS_LOC. */ + address_expr->X_op = O_absent; + address_expr->X_add_symbol = 0; + address_expr->X_add_number = 0; + + fixp[1] = fix_new_exp (frag_now, f - frag_now->fr_literal, + 4, address_expr, false, + reloc_type[1]); + + /* These relocations can have a addend that won't fit in + 4 octets for 64bit assembly. */ + if (HAVE_64BIT_GPRS && + (*reloc_type == BFD_RELOC_16 + || *reloc_type == BFD_RELOC_32 + || *reloc_type == BFD_RELOC_MIPS_JMP + || *reloc_type == BFD_RELOC_HI16_S + || *reloc_type == BFD_RELOC_LO16 + || *reloc_type == BFD_RELOC_GPREL16 + || *reloc_type == BFD_RELOC_MIPS_LITERAL + || *reloc_type == BFD_RELOC_GPREL32 + || *reloc_type == BFD_RELOC_64 + || *reloc_type == BFD_RELOC_CTOR + || *reloc_type == BFD_RELOC_MIPS_SUB + || *reloc_type == BFD_RELOC_MIPS_HIGHEST + || *reloc_type == BFD_RELOC_MIPS_HIGHER + || *reloc_type == BFD_RELOC_MIPS_SCN_DISP + || *reloc_type == BFD_RELOC_MIPS_REL16 + || *reloc_type == BFD_RELOC_MIPS_RELGOT)) + fixp[1]->fx_no_overflow = 1; + + if (reloc_type[2] != BFD_RELOC_UNUSED) + { + address_expr->X_op = O_absent; + address_expr->X_add_symbol = 0; + address_expr->X_add_number = 0; + + fixp[2] = fix_new_exp (frag_now, + f - frag_now->fr_literal, 4, + address_expr, false, + reloc_type[2]); + + /* These relocations can have a addend that won't fit in + 4 octets for 64bit assembly. */ + if (HAVE_64BIT_GPRS && + (*reloc_type == BFD_RELOC_16 + || *reloc_type == BFD_RELOC_32 + || *reloc_type == BFD_RELOC_MIPS_JMP + || *reloc_type == BFD_RELOC_HI16_S + || *reloc_type == BFD_RELOC_LO16 + || *reloc_type == BFD_RELOC_GPREL16 + || *reloc_type == BFD_RELOC_MIPS_LITERAL + || *reloc_type == BFD_RELOC_GPREL32 + || *reloc_type == BFD_RELOC_64 + || *reloc_type == BFD_RELOC_CTOR + || *reloc_type == BFD_RELOC_MIPS_SUB + || *reloc_type == BFD_RELOC_MIPS_HIGHEST + || *reloc_type == BFD_RELOC_MIPS_HIGHER + || *reloc_type == BFD_RELOC_MIPS_SCN_DISP + || *reloc_type == BFD_RELOC_MIPS_REL16 + || *reloc_type == BFD_RELOC_MIPS_RELGOT)) + fixp[2]->fx_no_overflow = 1; + } + } } } } if (! mips_opts.mips16) md_number_to_chars (f, ip->insn_opcode, 4); - else if (reloc_type == BFD_RELOC_MIPS16_JMP) + else if (*reloc_type == BFD_RELOC_MIPS16_JMP) { md_number_to_chars (f, ip->insn_opcode >> 16, 2); md_number_to_chars (f + 2, ip->insn_opcode & 0xffff, 2); @@ -2218,7 +2353,7 @@ append_insn (place, ip, address_expr, re /* If the previous instruction had a fixup in mips16 mode, we can not swap. This normally means that the previous instruction was a 4 byte branch anyhow. */ - || (mips_opts.mips16 && prev_insn_fixp) + || (mips_opts.mips16 && prev_insn_fixp[0]) /* If the previous instruction is a sync, sync.l, or sync.p, we can not swap. */ || (prev_pinfo & INSN_SYNC)) @@ -2244,15 +2379,35 @@ append_insn (place, ip, address_expr, re memcpy (temp, prev_f, 4); memcpy (prev_f, f, 4); memcpy (f, temp, 4); - if (prev_insn_fixp) + if (prev_insn_fixp[0]) { - prev_insn_fixp->fx_frag = frag_now; - prev_insn_fixp->fx_where = f - frag_now->fr_literal; + prev_insn_fixp[0]->fx_frag = frag_now; + prev_insn_fixp[0]->fx_where = f - frag_now->fr_literal; } - if (fixp) + if (prev_insn_fixp[1]) { - fixp->fx_frag = prev_insn_frag; - fixp->fx_where = prev_insn_where; + prev_insn_fixp[1]->fx_frag = frag_now; + prev_insn_fixp[1]->fx_where = f - frag_now->fr_literal; + } + if (prev_insn_fixp[2]) + { + prev_insn_fixp[2]->fx_frag = frag_now; + prev_insn_fixp[2]->fx_where = f - frag_now->fr_literal; + } + if (fixp[0]) + { + fixp[0]->fx_frag = prev_insn_frag; + fixp[0]->fx_where = prev_insn_where; + } + if (fixp[1]) + { + fixp[1]->fx_frag = prev_insn_frag; + fixp[1]->fx_where = prev_insn_where; + } + if (fixp[2]) + { + fixp[2]->fx_frag = prev_insn_frag; + fixp[2]->fx_where = prev_insn_where; } } else @@ -2260,13 +2415,15 @@ append_insn (place, ip, address_expr, re char *prev_f; char temp[2]; - assert (prev_insn_fixp == NULL); + assert (prev_insn_fixp[0] == NULL); + assert (prev_insn_fixp[1] == NULL); + assert (prev_insn_fixp[2] == NULL); prev_f = prev_insn_frag->fr_literal + prev_insn_where; memcpy (temp, prev_f, 2); memcpy (prev_f, f, 2); - if (reloc_type != BFD_RELOC_MIPS16_JMP) + if (*reloc_type != BFD_RELOC_MIPS16_JMP) { - assert (reloc_type == BFD_RELOC_UNUSED); + assert (*reloc_type == BFD_RELOC_UNUSED); memcpy (f, temp, 2); } else @@ -2274,10 +2431,20 @@ append_insn (place, ip, address_expr, re memcpy (f, f + 2, 2); memcpy (f + 2, temp, 2); } - if (fixp) + if (fixp[0]) { - fixp->fx_frag = prev_insn_frag; - fixp->fx_where = prev_insn_where; + fixp[0]->fx_frag = prev_insn_frag; + fixp[0]->fx_where = prev_insn_where; + } + if (fixp[1]) + { + fixp[1]->fx_frag = prev_insn_frag; + fixp[1]->fx_where = prev_insn_where; + } + if (fixp[2]) + { + fixp[2]->fx_frag = prev_insn_frag; + fixp[2]->fx_where = prev_insn_where; } } @@ -2295,8 +2462,12 @@ append_insn (place, ip, address_expr, re prev_insn.insn_mo = &dummy_opcode; } - prev_insn_fixp = NULL; - prev_insn_reloc_type = BFD_RELOC_UNUSED; + prev_insn_fixp[0] = NULL; + prev_insn_fixp[1] = NULL; + prev_insn_fixp[2] = NULL; + prev_insn_reloc_type[0] = BFD_RELOC_UNUSED; + prev_insn_reloc_type[1] = BFD_RELOC_UNUSED; + prev_insn_reloc_type[2] = BFD_RELOC_UNUSED; prev_insn_extended = 0; } else if (pinfo & INSN_COND_BRANCH_LIKELY) @@ -2309,8 +2480,12 @@ append_insn (place, ip, address_expr, re /* Update the previous insn information. */ prev_prev_insn = *ip; prev_insn.insn_mo = &dummy_opcode; - prev_insn_fixp = NULL; - prev_insn_reloc_type = BFD_RELOC_UNUSED; + prev_insn_fixp[0] = NULL; + prev_insn_fixp[1] = NULL; + prev_insn_fixp[2] = NULL; + prev_insn_reloc_type[0] = BFD_RELOC_UNUSED; + prev_insn_reloc_type[1] = BFD_RELOC_UNUSED; + prev_insn_reloc_type[2] = BFD_RELOC_UNUSED; prev_insn_extended = 0; } else @@ -2327,11 +2502,15 @@ append_insn (place, ip, address_expr, re is not in a delay slot. */ prev_insn_is_delay_slot = 0; - prev_insn_fixp = fixp; - prev_insn_reloc_type = reloc_type; + prev_insn_fixp[0] = fixp[0]; + prev_insn_fixp[1] = fixp[1]; + prev_insn_fixp[2] = fixp[2]; + prev_insn_reloc_type[0] = reloc_type[0]; + prev_insn_reloc_type[1] = reloc_type[1]; + prev_insn_reloc_type[2] = reloc_type[2]; if (mips_opts.mips16) prev_insn_extended = (ip->use_extend - || reloc_type > BFD_RELOC_UNUSED); + || *reloc_type > BFD_RELOC_UNUSED); } prev_prev_insn_unreordered = prev_insn_unreordered; @@ -2347,7 +2526,9 @@ append_insn (place, ip, address_expr, re PC relative relocs. */ prev_prev_insn = prev_insn; prev_insn = *ip; - prev_insn_reloc_type = reloc_type; + prev_insn_reloc_type[0] = reloc_type[0]; + prev_insn_reloc_type[1] = reloc_type[1]; + prev_insn_reloc_type[2] = reloc_type[2]; prev_prev_insn_unreordered = prev_insn_unreordered; prev_insn_unreordered = 1; } @@ -2387,7 +2568,9 @@ mips_no_prev_insn (preserve) prev_insn_is_delay_slot = 0; prev_insn_unreordered = 0; prev_insn_extended = 0; - prev_insn_reloc_type = BFD_RELOC_UNUSED; + prev_insn_reloc_type[0] = BFD_RELOC_UNUSED; + prev_insn_reloc_type[1] = BFD_RELOC_UNUSED; + prev_insn_reloc_type[2] = BFD_RELOC_UNUSED; prev_prev_insn_unreordered = 0; mips_clear_insn_labels (); } @@ -2527,7 +2710,7 @@ macro_build (place, counter, ep, name, f #endif { struct mips_cl_insn insn; - bfd_reloc_code_real_type r; + bfd_reloc_code_real_type r[3]; va_list args; #ifdef USE_STDARG @@ -2554,7 +2737,9 @@ macro_build (place, counter, ep, name, f return; } - r = BFD_RELOC_UNUSED; + r[0] = BFD_RELOC_UNUSED; + r[1] = BFD_RELOC_UNUSED; + r[2] = BFD_RELOC_UNUSED; insn.insn_mo = (struct mips_opcode *) hash_find (op_hash, name); assert (insn.insn_mo); assert (strcmp (name, insn.insn_mo->name) == 0); @@ -2653,35 +2838,33 @@ macro_build (place, counter, ep, name, f case 'i': case 'j': case 'o': - r = (bfd_reloc_code_real_type) va_arg (args, int); - assert (r == BFD_RELOC_MIPS_GPREL - || r == BFD_RELOC_MIPS_LITERAL - || r == BFD_RELOC_LO16 - || r == BFD_RELOC_MIPS_GOT16 - || r == BFD_RELOC_MIPS_CALL16 - || r == BFD_RELOC_MIPS_GOT_LO16 - || r == BFD_RELOC_MIPS_CALL_LO16 + *r = (bfd_reloc_code_real_type) va_arg (args, int); + assert (*r == BFD_RELOC_MIPS_GPREL + || *r == BFD_RELOC_MIPS_LITERAL + || *r == BFD_RELOC_MIPS_HIGHER + || *r == BFD_RELOC_HI16_S + || *r == BFD_RELOC_LO16 + || *r == BFD_RELOC_MIPS_GOT16 + || *r == BFD_RELOC_MIPS_CALL16 + || *r == BFD_RELOC_MIPS_GOT_LO16 + || *r == BFD_RELOC_MIPS_CALL_LO16 || (ep->X_op == O_subtract - && r == BFD_RELOC_PCREL_LO16)); + && *r == BFD_RELOC_PCREL_LO16)); continue; case 'u': - r = (bfd_reloc_code_real_type) va_arg (args, int); + *r = (bfd_reloc_code_real_type) va_arg (args, int); assert (ep != NULL && (ep->X_op == O_constant || (ep->X_op == O_symbol - && (r == BFD_RELOC_HI16_S - || r == BFD_RELOC_HI16 - || r == BFD_RELOC_MIPS_GOT_HI16 - || r == BFD_RELOC_MIPS_CALL_HI16)) + && (*r == BFD_RELOC_MIPS_HIGHEST + || *r == BFD_RELOC_HI16_S + || *r == BFD_RELOC_HI16 + || *r == BFD_RELOC_GPREL16 + || *r == BFD_RELOC_MIPS_GOT_HI16 + || *r == BFD_RELOC_MIPS_CALL_HI16)) || (ep->X_op == O_subtract - && r == BFD_RELOC_PCREL_HI16_S))); - if (ep->X_op == O_constant) - { - insn.insn_opcode |= (ep->X_add_number >> 16) & 0xffff; - ep = NULL; - r = BFD_RELOC_UNUSED; - } + && *r == BFD_RELOC_PCREL_HI16_S))); continue; case 'p': @@ -2699,12 +2882,15 @@ macro_build (place, counter, ep, name, f ep = NULL; } else - r = BFD_RELOC_16_PCREL_S2; + if (mips_pic == EMBEDDED_PIC) + *r = BFD_RELOC_16_PCREL_S2; + else + *r = BFD_RELOC_16_PCREL; continue; case 'a': assert (ep != NULL); - r = BFD_RELOC_MIPS_JMP; + *r = BFD_RELOC_MIPS_JMP; continue; case 'C': @@ -2717,7 +2903,7 @@ macro_build (place, counter, ep, name, f break; } va_end (args); - assert (r == BFD_RELOC_UNUSED ? ep == NULL : ep != NULL); + assert (*r == BFD_RELOC_UNUSED ? ep == NULL : ep != NULL); append_insn (place, &insn, ep, r, false); } @@ -2732,9 +2918,9 @@ mips16_macro_build (place, counter, ep, va_list args; { struct mips_cl_insn insn; - bfd_reloc_code_real_type r; + bfd_reloc_code_real_type r[3] + = {BFD_RELOC_UNUSED, BFD_RELOC_UNUSED, BFD_RELOC_UNUSED}; - r = BFD_RELOC_UNUSED; insn.insn_mo = (struct mips_opcode *) hash_find (mips16_op_hash, name); assert (insn.insn_mo); assert (strcmp (name, insn.insn_mo->name) == 0); @@ -2823,14 +3009,14 @@ mips16_macro_build (place, counter, ep, assert (ep != NULL); if (ep->X_op != O_constant) - r = BFD_RELOC_UNUSED + c; + *r = BFD_RELOC_UNUSED + c; else { mips16_immed ((char *) NULL, 0, c, ep->X_add_number, false, false, false, &insn.insn_opcode, &insn.use_extend, &insn.extend); ep = NULL; - r = BFD_RELOC_UNUSED; + *r = BFD_RELOC_UNUSED; } } continue; @@ -2843,7 +3029,7 @@ mips16_macro_build (place, counter, ep, break; } - assert (r == BFD_RELOC_UNUSED ? ep == NULL : ep != NULL); + assert (*r == BFD_RELOC_UNUSED ? ep == NULL : ep != NULL); append_insn (place, &insn, ep, r, false); } @@ -2860,7 +3046,8 @@ macro_build_lui (place, counter, ep, reg { expressionS high_expr; struct mips_cl_insn insn; - bfd_reloc_code_real_type r; + bfd_reloc_code_real_type r[3] + = {BFD_RELOC_UNUSED, BFD_RELOC_UNUSED, BFD_RELOC_UNUSED}; CONST char *name = "lui"; CONST char *fmt = "t,u"; @@ -2879,15 +3066,15 @@ macro_build_lui (place, counter, ep, reg /* we can compute the instruction now without a relocation entry */ high_expr.X_add_number = ((high_expr.X_add_number + 0x8000) >> 16) & 0xffff; - r = BFD_RELOC_UNUSED; + *r = BFD_RELOC_UNUSED; } - else + else if (! HAVE_NEWABI) { assert (ep->X_op == O_symbol); /* _gp_disp is a special case, used from s_cpload. */ assert (mips_pic == NO_PIC || strcmp (S_GET_NAME (ep->X_add_symbol), "_gp_disp") == 0); - r = BFD_RELOC_HI16_S; + *r = BFD_RELOC_HI16_S; } /* @@ -2907,7 +3094,7 @@ macro_build_lui (place, counter, ep, reg assert (strcmp (fmt, insn.insn_mo->args) == 0); insn.insn_opcode = insn.insn_mo->match | (regnum << OP_SH_RT); - if (r == BFD_RELOC_UNUSED) + if (*r == BFD_RELOC_UNUSED) { insn.insn_opcode |= high_expr.X_add_number; append_insn (place, &insn, NULL, r, false); @@ -6938,13 +7125,13 @@ mips_ip (str, ip) /* If the instruction contains a '.', we first try to match an instruction including the '.'. Then we try again without the '.'. */ insn = NULL; - for (s = str; *s != '\0' && !isspace ((unsigned char) *s); ++s) + for (s = str; *s != '\0' && !ISSPACE (*s); ++s) continue; /* If we stopped on whitespace, then replace the whitespace with null for the call to hash_find. Save the character we replaced just in case we have to re-parse the instruction. */ - if (isspace ((unsigned char) *s)) + if (ISSPACE (*s)) { save_c = *s; *s++ = '\0'; @@ -6962,7 +7149,9 @@ mips_ip (str, ip) *(--s) = save_c; /* Scan up to the first '.' or whitespace. */ - for (s = str; *s != '\0' && *s != '.' && !isspace ((unsigned char) *s); ++s) + for (s = str; + *s != '\0' && *s != '.' && !ISSPACE (*s); + ++s) continue; /* If we did not find a '.', then we can quit now. */ @@ -7226,7 +7415,7 @@ mips_ip (str, ip) if (s[0] == '$') { - if (isdigit ((unsigned char) s[1])) + if (ISDIGIT (s[1])) { ++s; regno = 0; @@ -7236,7 +7425,7 @@ mips_ip (str, ip) regno += *s - '0'; ++s; } - while (isdigit ((unsigned char) *s)); + while (ISDIGIT (*s)); if (regno > 31) as_bad (_("Invalid register number (%d)"), regno); } @@ -7389,7 +7578,8 @@ mips_ip (str, ip) case 'V': case 'W': s_reset = s; - if (s[0] == '$' && s[1] == 'f' && isdigit ((unsigned char) s[2])) + if (s[0] == '$' && s[1] == 'f' + && ISDIGIT (s[2])) { s += 2; regno = 0; @@ -7399,7 +7589,7 @@ mips_ip (str, ip) regno += *s - '0'; ++s; } - while (isdigit ((unsigned char) *s)); + while (ISDIGIT (*s)); if (regno > 31) as_bad (_("Invalid float register number (%d)"), regno); @@ -7469,7 +7659,7 @@ mips_ip (str, ip) case 'A': my_getExpression (&offset_expr, s); - imm_reloc = BFD_RELOC_32; + *imm_reloc = BFD_RELOC_32; s = expr_end; continue; @@ -7681,7 +7871,7 @@ mips_ip (str, ip) case 'i': /* 16 bit unsigned immediate */ case 'j': /* 16 bit signed immediate */ - imm_reloc = BFD_RELOC_LO16; + *imm_reloc = BFD_RELOC_LO16; c = my_getSmallExpression (&imm_expr, s); if (c != S_EX_NONE) { @@ -7691,16 +7881,16 @@ mips_ip (str, ip) imm_expr.X_add_number = (imm_expr.X_add_number >> 16) & 0xffff; else if (c == S_EX_HIGHEST) - imm_reloc = BFD_RELOC_MIPS_HIGHEST; + *imm_reloc = BFD_RELOC_MIPS_HIGHEST; else if (c == S_EX_HIGHER) - imm_reloc = BFD_RELOC_MIPS_HIGHER; + *imm_reloc = BFD_RELOC_MIPS_HIGHER; else if (c == S_EX_HI) { - imm_reloc = BFD_RELOC_HI16_S; + *imm_reloc = BFD_RELOC_HI16_S; imm_unmatched_hi = true; } else - imm_reloc = BFD_RELOC_HI16; + *imm_reloc = BFD_RELOC_HI16; } else if (imm_expr.X_op == O_constant) imm_expr.X_add_number &= 0xffff; @@ -7791,19 +7981,22 @@ mips_ip (str, ip) offset_expr.X_add_number = (offset_expr.X_add_number >> 16) & 0xffff; } - offset_reloc = BFD_RELOC_LO16; + *offset_reloc = BFD_RELOC_LO16; s = expr_end; continue; case 'p': /* pc relative offset */ - offset_reloc = BFD_RELOC_16_PCREL_S2; + if (mips_pic == EMBEDDED_PIC) + *offset_reloc = BFD_RELOC_16_PCREL_S2; + else + *offset_reloc = BFD_RELOC_16_PCREL; my_getExpression (&offset_expr, s); s = expr_end; continue; case 'u': /* upper 16 bits */ c = my_getSmallExpression (&imm_expr, s); - imm_reloc = BFD_RELOC_LO16; + *imm_reloc = BFD_RELOC_LO16; if (c != S_EX_NONE) { if (c != S_EX_LO) @@ -7812,14 +8005,14 @@ mips_ip (str, ip) imm_expr.X_add_number = (imm_expr.X_add_number >> 16) & 0xffff; else if (c == S_EX_HIGHEST) - imm_reloc = BFD_RELOC_MIPS_HIGHEST; + *imm_reloc = BFD_RELOC_MIPS_HIGHEST; else if (c == S_EX_HI) { - imm_reloc = BFD_RELOC_HI16_S; + *imm_reloc = BFD_RELOC_HI16_S; imm_unmatched_hi = true; } else - imm_reloc = BFD_RELOC_HI16; + *imm_reloc = BFD_RELOC_HI16; } else if (imm_expr.X_op == O_constant) imm_expr.X_add_number &= 0xffff; @@ -7834,7 +8027,7 @@ mips_ip (str, ip) case 'a': /* 26 bit address */ my_getExpression (&offset_expr, s); s = expr_end; - offset_reloc = BFD_RELOC_MIPS_JMP; + *offset_reloc = BFD_RELOC_MIPS_JMP; continue; case 'N': /* 3 bit branch condition code */ @@ -7849,7 +8042,7 @@ mips_ip (str, ip) regno += *s - '0'; ++s; } - while (isdigit ((unsigned char) *s)); + while (ISDIGIT (*s)); if (regno > 7) as_bad (_("invalid condition code register $fcc%d"), regno); if (*args == 'N') @@ -7861,7 +8054,7 @@ mips_ip (str, ip) case 'H': if (s[0] == '0' && (s[1] == 'x' || s[1] == 'X')) s += 2; - if (isdigit ((unsigned char) *s)) + if (ISDIGIT (*s)) { c = 0; do @@ -7870,7 +8063,7 @@ mips_ip (str, ip) c += *s - '0'; ++s; } - while (isdigit ((unsigned char) *s)); + while (ISDIGIT (*s)); } else c = 8; /* Invalid sel value. */ @@ -7927,7 +8120,7 @@ mips16_ip (str, ip) mips16_small = false; mips16_ext = false; - for (s = str; islower ((unsigned char) *s); ++s) + for (s = str; ISLOWER (*s); ++s) ; switch (*s) { @@ -7977,9 +8170,13 @@ mips16_ip (str, ip) ip->insn_opcode = insn->match; ip->use_extend = false; imm_expr.X_op = O_absent; - imm_reloc = BFD_RELOC_UNUSED; + imm_reloc[0] = BFD_RELOC_UNUSED; + imm_reloc[1] = BFD_RELOC_UNUSED; + imm_reloc[2] = BFD_RELOC_UNUSED; offset_expr.X_op = O_absent; - offset_reloc = BFD_RELOC_UNUSED; + offset_reloc[0] = BFD_RELOC_UNUSED; + offset_reloc[1] = BFD_RELOC_UNUSED; + offset_reloc[2] = BFD_RELOC_UNUSED; for (args = insn->args; 1; ++args) { int c; @@ -7999,16 +8196,16 @@ mips16_ip (str, ip) { /* Stuff the immediate value in now, if we can. */ if (imm_expr.X_op == O_constant - && imm_reloc > BFD_RELOC_UNUSED + && *imm_reloc > BFD_RELOC_UNUSED && insn->pinfo != INSN_MACRO) { mips16_immed ((char *) NULL, 0, - imm_reloc - BFD_RELOC_UNUSED, + *imm_reloc - BFD_RELOC_UNUSED, imm_expr.X_add_number, true, mips16_small, mips16_ext, &ip->insn_opcode, &ip->use_extend, &ip->extend); imm_expr.X_op = O_absent; - imm_reloc = BFD_RELOC_UNUSED; + *imm_reloc = BFD_RELOC_UNUSED; } return; @@ -8060,7 +8257,7 @@ mips16_ip (str, ip) if (s[0] != '$') break; s_reset = s; - if (isdigit ((unsigned char) s[1])) + if (ISDIGIT (s[1])) { ++s; regno = 0; @@ -8070,7 +8267,7 @@ mips16_ip (str, ip) regno += *s - '0'; ++s; } - while (isdigit ((unsigned char) *s)); + while (ISDIGIT (*s)); if (regno > 31) { as_bad (_("invalid register number (%d)"), regno); @@ -8233,7 +8430,7 @@ mips16_ip (str, ip) if (imm_expr.X_op == O_symbol) { mips16_ext = true; - imm_reloc = BFD_RELOC_MIPS16_GPREL; + *imm_reloc = BFD_RELOC_MIPS16_GPREL; s = expr_end; ip->use_extend = true; ip->extend = 0; @@ -8260,7 +8457,7 @@ mips16_ip (str, ip) explicit extensions correctly. */ imm_expr.X_op = O_constant; imm_expr.X_add_number = 0; - imm_reloc = (int) BFD_RELOC_UNUSED + c; + *imm_reloc = (int) BFD_RELOC_UNUSED + c; continue; } @@ -8268,7 +8465,7 @@ mips16_ip (str, ip) } /* We need to relax this instruction. */ - imm_reloc = (int) BFD_RELOC_UNUSED + c; + *imm_reloc = (int) BFD_RELOC_UNUSED + c; s = expr_end; continue; @@ -8286,7 +8483,7 @@ mips16_ip (str, ip) break; /* We need to relax this instruction. */ - offset_reloc = (int) BFD_RELOC_UNUSED + c; + *offset_reloc = (int) BFD_RELOC_UNUSED + c; s = expr_end; continue; @@ -8308,7 +8505,7 @@ mips16_ip (str, ip) case 'a': /* 26 bit address */ my_getExpression (&offset_expr, s); s = expr_end; - offset_reloc = BFD_RELOC_MIPS16_JMP; + *offset_reloc = BFD_RELOC_MIPS16_JMP; ip->insn_opcode <<= 16; continue; @@ -8341,7 +8538,7 @@ mips16_ip (str, ip) ++s; } reg1 = 0; - while (isdigit ((unsigned char) *s)) + while (ISDIGIT (*s)) { reg1 *= 10; reg1 += *s - '0'; @@ -8368,7 +8565,7 @@ mips16_ip (str, ip) } } reg2 = 0; - while (isdigit ((unsigned char) *s)) + while (ISDIGIT (*s)) { reg2 *= 10; reg2 += *s - '0'; @@ -8630,41 +8827,41 @@ my_getSmallExpression (ep, str) if (*str == '(') c = S_EX_NONE; else if (str[0] == '%' - && tolower(str[1]) == 'l' - && tolower(str[2]) == 'o' + && TOLOWER (str[1]) == 'l' + && TOLOWER (str[2]) == 'o' && str[3] == '(') { c = S_EX_LO; str += sizeof ("%lo(") - 2; } else if (str[0] == '%' - && tolower(str[1]) == 'h' - && tolower(str[2]) == 'i' + && TOLOWER (str[1]) == 'h' + && TOLOWER (str[2]) == 'i' && str[3] == '(') { c = S_EX_HI; str += sizeof ("%hi(") - 2; } else if (str[0] == '%' - && tolower(str[1]) == 'h' - && tolower(str[2]) == 'i' - && tolower(str[3]) == 'g' - && tolower(str[4]) == 'h' - && tolower(str[5]) == 'e' - && tolower(str[6]) == 'r' + && TOLOWER (str[1]) == 'h' + && TOLOWER (str[2]) == 'i' + && TOLOWER (str[3]) == 'g' + && TOLOWER (str[4]) == 'h' + && TOLOWER (str[5]) == 'e' + && TOLOWER (str[6]) == 'r' && str[7] == '(') { c = S_EX_HIGHER; str += sizeof ("%higher(") - 2; } else if (str[0] == '%' - && tolower(str[1]) == 'h' - && tolower(str[2]) == 'i' - && tolower(str[3]) == 'g' - && tolower(str[4]) == 'h' - && tolower(str[5]) == 'e' - && tolower(str[6]) == 's' - && tolower(str[7]) == 't' + && TOLOWER (str[1]) == 'h' + && TOLOWER (str[2]) == 'i' + && TOLOWER (str[3]) == 'g' + && TOLOWER (str[4]) == 'h' + && TOLOWER (str[5]) == 'e' + && TOLOWER (str[6]) == 's' + && TOLOWER (str[7]) == 't' && str[8] == '(') { c = S_EX_HIGHEST; @@ -8673,21 +8870,21 @@ my_getSmallExpression (ep, str) /* currently unsupported */ #if 0 else if (str[0] == '%' - && tolower(str[1]) == 'g' - && tolower(str[2]) == 'p' - && tolower(str[3]) == '_' - && tolower(str[4]) == 'r' - && tolower(str[5]) == 'e' - && tolower(str[6]) == 'l' + && TOLOWER (str[1]) == 'g' + && TOLOWER (str[2]) == 'p' + && TOLOWER (str[3]) == '_' + && TOLOWER (str[4]) == 'r' + && TOLOWER (str[5]) == 'e' + && TOLOWER (str[6]) == 'l' && str[7] == '(') { c = S_EX_GPREL; str += sizeof ("%gp_rel(") - 2; } else if (str[0] == '%' - && tolower(str[1]) == 'n' - && tolower(str[2]) == 'e' - && tolower(str[3]) == 'g' + && TOLOWER (str[1]) == 'n' + && TOLOWER (str[2]) == 'e' + && TOLOWER (str[3]) == 'g' && str[4] == '(') { c = S_EX_NEG; @@ -8710,9 +8907,9 @@ my_getSmallExpression (ep, str) ; if (sp - 4 >= str && sp[-1] == ')') { - if (isdigit ((unsigned char) sp[-2])) + if (ISDIGIT (sp[-2])) { - for (sp -= 3; sp >= str && isdigit ((unsigned char) *sp); sp--) + for (sp -= 3; sp >= str && ISDIGIT (*sp); sp--) ; if (*sp == '$' && sp > str && sp[-1] == '(') { @@ -8860,6 +9057,25 @@ md_number_to_chars (buf, val, n) number_to_chars_littleendian (buf, val, n); } +static int support_64bit_objects(void) +{ + const char **list, **l; + + list = bfd_target_list (); + for (l = list; *l != NULL; l++) +#ifdef TE_TMIPS + /* This is traditional mips */ + if (strcmp (*l, "elf64-tradbigmips") == 0 + || strcmp (*l, "elf64-tradlittlemips") == 0) +#else + if (strcmp (*l, "elf64-bigmips") == 0 + || strcmp (*l, "elf64-littlemips") == 0) +#endif + break; + free (list); + return (*l != NULL); +} + CONST char *md_shortopts = "nO::g::G:"; struct option md_longopts[] = @@ -8939,12 +9155,14 @@ struct option md_longopts[] = #define OPTION_NON_SHARED (OPTION_ELF_BASE + 1) #define OPTION_XGOT (OPTION_ELF_BASE + 2) #define OPTION_32 (OPTION_ELF_BASE + 3) -#define OPTION_64 (OPTION_ELF_BASE + 4) +#define OPTION_N32 (OPTION_ELF_BASE + 4) +#define OPTION_64 (OPTION_ELF_BASE + 5) {"KPIC", no_argument, NULL, OPTION_CALL_SHARED}, {"call_shared", no_argument, NULL, OPTION_CALL_SHARED}, {"non_shared", no_argument, NULL, OPTION_NON_SHARED}, {"xgot", no_argument, NULL, OPTION_XGOT}, {"32", no_argument, NULL, OPTION_32}, + {"n32", no_argument, NULL, OPTION_N32}, {"64", no_argument, NULL, OPTION_64}, #endif @@ -9212,73 +9430,57 @@ md_parse_option (c, arg) /* The -32 and -64 options tell the assembler to output the 32 bit or the 64 bit MIPS ELF format. */ case OPTION_32: - mips_64 = 0; + mips_abi = O32_ABI; break; - case OPTION_64: - { - const char **list, **l; + case OPTION_N32: + mips_abi = N32_ABI; + break; - list = bfd_target_list (); - for (l = list; *l != NULL; l++) -#ifdef TE_TMIPS - /* This is traditional mips */ - if (strcmp (*l, "elf64-tradbigmips") == 0 - || strcmp (*l, "elf64-tradlittlemips") == 0) -#else - if (strcmp (*l, "elf64-bigmips") == 0 - || strcmp (*l, "elf64-littlemips") == 0) -#endif - break; - if (*l == NULL) - as_fatal (_("No compiled in support for 64 bit object file format")); - free (list); - mips_64 = 1; - } + case OPTION_64: + mips_abi = N64_ABI; + if (! support_64bit_objects()) + as_fatal (_("No compiled in support for 64 bit object file format")); break; -#endif /* OBJ_ELF */ case OPTION_GP32: mips_gp32 = 1; - mips_64 = 0; - - /* We deliberately don't allow "-gp32" to set the MIPS_32BITMODE - flag in object files because to do so would make it - impossible to link with libraries compiled without "-gp32". - This is unnecessarily restrictive. - - We could solve this problem by adding "-gp32" multilibs to - gcc, but to set this flag before gcc is built with such - multilibs will break too many systems. */ - -#if 0 - mips_32bitmode = 1; -#endif + if (mips_abi != O32_ABI) + mips_abi = NO_ABI; break; case OPTION_GP64: mips_gp32 = 0; - mips_64 = 1; -#if 0 - mips_32bitmode = 0; -#endif + if (mips_abi == O32_ABI) + mips_abi = NO_ABI; break; case OPTION_FP32: mips_fp32 = 1; + if (mips_abi != O32_ABI) + mips_abi = NO_ABI; break; case OPTION_MABI: - if (strcmp (arg, "32") == 0 - || strcmp (arg, "n32") == 0 - || strcmp (arg, "64") == 0 - || strcmp (arg, "o64") == 0 - || strcmp (arg, "eabi") == 0) - { - mips_abi_string = arg; - mips_32bit_abi = (strcmp (arg, "32") == 0); + if (strcmp (arg, "32") == 0) + mips_abi = O32_ABI; + else if (strcmp (arg, "o64") == 0) + mips_abi = O64_ABI; + else if (strcmp (arg, "n32") == 0) + mips_abi = N32_ABI; + else if (strcmp (arg, "64") == 0) + { + mips_abi = N64_ABI; + if (! support_64bit_objects()) + as_fatal (_("No compiled in support for 64 bit object file " + "format")); } + else if (strcmp (arg, "eabi") == 0) + mips_abi = EABI_ABI; + else + mips_abi = NO_ABI; break; +#endif /* OBJ_ELF */ case OPTION_M7000_HILO_FIX: mips_7000_hilo_fix = true; @@ -9372,7 +9574,6 @@ MIPS options:\n\ show (stream, "8000", &column, &first); show (stream, "10000", &column, &first); show (stream, "12000", &column, &first); - show (stream, "mips32-4k", &column, &first); show (stream, "sb-1", &column, &first); fputc ('\n', stream); @@ -9406,8 +9607,9 @@ MIPS options:\n\ -KPIC, -call_shared generate SVR4 position independent code\n\ -non_shared do not generate position independent code\n\ -xgot assume a 32 bit GOT\n\ --32 create 32 bit object file (default)\n\ --64 create 64 bit object file\n")); +-32 create o32 ABI object file (default)\n\ +-n32 create n32 ABI object file\n\ +-64 create 64 ABI object file\n")); #endif } @@ -9427,9 +9629,16 @@ md_pcrel_from (fixP) && fixP->fx_addsy != (symbolS *) NULL && ! S_IS_DEFINED (fixP->fx_addsy)) { - /* This makes a branch to an undefined symbol be a branch to the - current location. */ - return 4; + if (mips_pic == EMBEDDED_PIC) + { + /* This makes a branch to an undefined symbol be a branch to the + current location. */ + return 4; + } + else + { + return 1; + } } /* return the address of the delay slot */ @@ -9552,7 +9761,10 @@ mips_frob_file () /* When generating embedded PIC code we must keep all PC relative relocations, in case the linker has to relax a call. We also need - to keep relocations for switch table entries. */ + to keep relocations for switch table entries. + + We may have combined relocations without symbols in the N32/N64 ABI. + We have to prevent gas from dropping them. */ int mips_force_relocation (fixp) @@ -9562,6 +9774,13 @@ mips_force_relocation (fixp) || fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY) return 1; + if (HAVE_NEWABI + && S_GET_SEGMENT (fixp->fx_addsy) == bfd_abs_section_ptr + && (fixp->fx_r_type == BFD_RELOC_MIPS_SUB + || fixp->fx_r_type == BFD_RELOC_HI16_S + || fixp->fx_r_type == BFD_RELOC_LO16)) + return 1; + return (mips_pic == EMBEDDED_PIC && (fixp->fx_pcrel || SWITCH_TABLE (fixp) @@ -9582,7 +9801,21 @@ md_apply_fix (fixP, valueP) assert (fixP->fx_size == 4 || fixP->fx_r_type == BFD_RELOC_16 + || fixP->fx_r_type == BFD_RELOC_32 + || fixP->fx_r_type == BFD_RELOC_MIPS_JMP + || fixP->fx_r_type == BFD_RELOC_HI16_S + || fixP->fx_r_type == BFD_RELOC_LO16 + || fixP->fx_r_type == BFD_RELOC_GPREL16 + || fixP->fx_r_type == BFD_RELOC_MIPS_LITERAL + || fixP->fx_r_type == BFD_RELOC_GPREL32 || fixP->fx_r_type == BFD_RELOC_64 + || fixP->fx_r_type == BFD_RELOC_CTOR + || fixP->fx_r_type == BFD_RELOC_MIPS_SUB + || fixP->fx_r_type == BFD_RELOC_MIPS_HIGHEST + || fixP->fx_r_type == BFD_RELOC_MIPS_HIGHER + || fixP->fx_r_type == BFD_RELOC_MIPS_SCN_DISP + || fixP->fx_r_type == BFD_RELOC_MIPS_REL16 + || fixP->fx_r_type == BFD_RELOC_MIPS_RELGOT || fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT || fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY); @@ -9666,7 +9899,8 @@ md_apply_fix (fixP, valueP) /* BFD's REL handling, for MIPS, is _very_ weird. This gives the right results, but it can't possibly be the way things are supposed to work. */ - if (fixP->fx_r_type != BFD_RELOC_16_PCREL_S2 + if ((fixP->fx_r_type != BFD_RELOC_16_PCREL + && fixP->fx_r_type != BFD_RELOC_16_PCREL_S2) || S_GET_SEGMENT (fixP->fx_addsy) != undefined_section) value += fixP->fx_frag->fr_address + fixP->fx_where; } @@ -9812,15 +10046,18 @@ md_apply_fix (fixP, valueP) break; case BFD_RELOC_16_PCREL_S2: + if ((value & 0x3) != 0) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("Branch to odd address (%lx)"), (long) value); + + /* Fall through. */ + + case BFD_RELOC_16_PCREL: /* * We need to save the bits in the instruction since fixup_segment() * might be deleting the relocation entry (i.e., a branch within * the current segment). */ - if ((value & 0x3) != 0) - as_bad_where (fixP->fx_file, fixP->fx_line, - _("Branch to odd address (%lx)"), (long) value); - if (!fixP->fx_done && value != 0) break; /* If 'value' is zero, the remaining reloc code won't actually @@ -10385,12 +10622,57 @@ s_mipsset (x) else if (strncmp (name, "mips", 4) == 0) { int isa; + static int saved_mips_gp32; + static int saved_mips_fp32; + static enum mips_abi_level saved_mips_abi; + static int is_saved; /* Permit the user to change the ISA on the fly. Needless to say, misuse can cause serious problems. */ isa = atoi (name + 4); switch (isa) { + case 0: + mips_gp32 = saved_mips_gp32; + mips_fp32 = saved_mips_fp32; + mips_abi = saved_mips_abi; + is_saved = 0; + break; + case 1: + case 2: + case 32: + if (! is_saved) + { + saved_mips_gp32 = mips_gp32; + saved_mips_fp32 = mips_fp32; + saved_mips_abi = mips_abi; + } + mips_gp32 = 1; + mips_fp32 = 1; + is_saved = 1; + break; + case 3: + case 4: + case 5: + case 64: + if (! is_saved) + { + saved_mips_gp32 = mips_gp32; + saved_mips_fp32 = mips_fp32; + saved_mips_abi = mips_abi; + } + mips_gp32 = 0; + mips_fp32 = 0; + mips_abi = NO_ABI; + is_saved = 1; + break; + default: + as_bad (_("unknown ISA level")); + break; + } + + switch (isa) + { case 0: mips_opts.isa = file_mips_isa; break; case 1: mips_opts.isa = ISA_MIPS1; break; case 2: mips_opts.isa = ISA_MIPS2; break; @@ -10713,7 +10995,7 @@ tc_get_register (frame) as_warn (_("expected `$'")); reg = 0; } - else if (isdigit ((unsigned char) *input_line_pointer)) + else if (ISDIGIT (*input_line_pointer)) { reg = get_absolute_expression (); if (reg < 0 || reg >= 32) @@ -11077,8 +11359,7 @@ md_estimate_size_before_relax (fragp, se sym = fragp->fr_symbol; /* Handle the case of a symbol equated to another symbol. */ - while (symbol_equated_p (sym) - && (! S_IS_DEFINED (sym) || S_IS_COMMON (sym))) + while (symbol_equated_reloc_p (sym)) { symbolS *n; @@ -11597,7 +11878,7 @@ void mips_elf_final_processing () { /* Write out the register information. */ - if (! mips_64) + if (! HAVE_NEWABI) { Elf32_RegInfo s; @@ -11637,20 +11918,20 @@ mips_elf_final_processing () elf_elfheader (stdoutput)->e_flags |= EF_MIPS_PIC; /* Set the MIPS ELF ABI flags. */ - if (mips_abi_string == NULL) + if (mips_abi == NO_ABI) ; - else if (strcmp (mips_abi_string, "32") == 0) + else if (mips_abi == O32_ABI) elf_elfheader (stdoutput)->e_flags |= E_MIPS_ABI_O32; - else if (strcmp (mips_abi_string, "o64") == 0) + else if (mips_abi == O64_ABI) elf_elfheader (stdoutput)->e_flags |= E_MIPS_ABI_O64; - else if (strcmp (mips_abi_string, "eabi") == 0) + else if (mips_abi == EABI_ABI) { if (mips_eabi64) elf_elfheader (stdoutput)->e_flags |= E_MIPS_ABI_EABI64; else elf_elfheader (stdoutput)->e_flags |= E_MIPS_ABI_EABI32; } - else if (strcmp (mips_abi_string, "n32") == 0) + else if (mips_abi == N32_ABI) elf_elfheader (stdoutput)->e_flags |= EF_MIPS_ABI2; /* Nothing to do for "64". */ @@ -11733,14 +12014,14 @@ get_number () ++input_line_pointer; negative = 1; } - if (!isdigit ((unsigned char) *input_line_pointer)) + if (!ISDIGIT (*input_line_pointer)) as_bad (_("Expected simple number.")); if (input_line_pointer[0] == '0') { if (input_line_pointer[1] == 'x') { input_line_pointer += 2; - while (isxdigit ((unsigned char) *input_line_pointer)) + while (ISXDIGIT (*input_line_pointer)) { val <<= 4; val |= hex_value (*input_line_pointer++); @@ -11750,7 +12031,7 @@ get_number () else { ++input_line_pointer; - while (isdigit ((unsigned char) *input_line_pointer)) + while (ISDIGIT (*input_line_pointer)) { val <<= 3; val |= *input_line_pointer++ - '0'; @@ -11758,14 +12039,14 @@ get_number () return negative ? -val : val; } } - if (!isdigit ((unsigned char) *input_line_pointer)) + if (!ISDIGIT (*input_line_pointer)) { printf (_(" *input_line_pointer == '%c' 0x%02x\n"), *input_line_pointer, *input_line_pointer); as_warn (_("Invalid number")); return -1; } - while (isdigit ((unsigned char) *input_line_pointer)) + while (ISDIGIT (*input_line_pointer)) { val *= 10; val += *input_line_pointer++ - '0'; @@ -11888,7 +12169,7 @@ s_mips_ent (aent) if (*input_line_pointer == ',') input_line_pointer++; SKIP_WHITESPACE (); - if (isdigit ((unsigned char) *input_line_pointer) + if (ISDIGIT (*input_line_pointer) || *input_line_pointer == '-') number = get_number (); @@ -12068,17 +12349,20 @@ static const struct mips_cpu_info mips_c /* MIPS32 ISA */ { "MIPS32", 1, ISA_MIPS32, CPU_MIPS32, }, + { "mipsisa32", 0, ISA_MIPS32, CPU_MIPS32, }, { "Generic-MIPS32", 0, ISA_MIPS32, CPU_MIPS32, }, + { "4kc", 0, ISA_MIPS32, CPU_MIPS32, }, + { "4km", 0, ISA_MIPS32, CPU_MIPS32, }, + { "4kp", 0, ISA_MIPS32, CPU_MIPS32, }, + + /* For historical reasons. */ + { "MIPS64", 1, ISA_MIPS3, CPU_R4000, }, -#if 1 - /* XXX for now, MIPS64 -> MIPS3 because of history */ - { "MIPS64", 1, ISA_MIPS3, CPU_R4000 }, /* XXX! */ -#else /* MIPS64 ISA */ - { "MIPS64", 1, ISA_MIPS64, CPU_MIPS64 }, -#endif - { "mips64isa", 1, ISA_MIPS64, CPU_MIPS64 }, + { "mipsisa64", 1, ISA_MIPS64, CPU_MIPS64, }, { "Generic-MIPS64", 0, ISA_MIPS64, CPU_MIPS64, }, + { "5kc", 0, ISA_MIPS64, CPU_MIPS64, }, + { "20kc", 0, ISA_MIPS64, CPU_MIPS64, }, /* R2000 CPU */ { "R2000", 0, ISA_MIPS1, CPU_R2000, }, @@ -12182,15 +12466,6 @@ static const struct mips_cpu_info mips_c { "r5k", 0, ISA_MIPS4, CPU_R5000, }, { "r7000", 0, ISA_MIPS4, CPU_R5000, }, - /* MIPS32 4K CPU */ - { "MIPS32-4K", 0, ISA_MIPS32, CPU_MIPS32_4K, }, - { "4kc", 0, ISA_MIPS32, CPU_MIPS32_4K, }, - { "4km", 0, ISA_MIPS32, CPU_MIPS32_4K, }, - { "4kp", 0, ISA_MIPS32, CPU_MIPS32_4K, }, - { "mips32-4kc", 0, ISA_MIPS32, CPU_MIPS32_4K, }, - { "mips32-4km", 0, ISA_MIPS32, CPU_MIPS32_4K, }, - { "mips32-4kp", 0, ISA_MIPS32, CPU_MIPS32_4K, }, - /* SiByte SB-1 CPU */ { "SB-1", 0, ISA_MIPS64, CPU_SB1, }, { "sb-1250", 0, ISA_MIPS64, CPU_SB1, }, diff -uprN binutils-2.11.90.0.31/gas/config/tc-mn10200.c binutils-2.11.92.0.5/gas/config/tc-mn10200.c --- binutils-2.11.90.0.31/gas/config/tc-mn10200.c Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/gas/config/tc-mn10200.c Mon Oct 1 15:25:22 2001 @@ -20,8 +20,8 @@ Boston, MA 02111-1307, USA. */ #include -#include #include "as.h" +#include "safe-ctype.h" #include "subsegs.h" #include "opcode/mn10200.h" @@ -781,7 +781,7 @@ md_assemble (str) int match; /* Get the opcode. */ - for (s = str; *s != '\0' && !isspace (*s); s++) + for (s = str; *s != '\0' && !ISSPACE (*s); s++) ; if (*s != '\0') *s++ = '\0'; @@ -795,7 +795,7 @@ md_assemble (str) } str = s; - while (isspace (*str)) + while (ISSPACE (*str)) ++str; input_line_pointer = str; @@ -1029,7 +1029,7 @@ keep_going: break; } - while (isspace (*str)) + while (ISSPACE (*str)) ++str; if (*str != '\0') diff -uprN binutils-2.11.90.0.31/gas/config/tc-mn10300.c binutils-2.11.92.0.5/gas/config/tc-mn10300.c --- binutils-2.11.90.0.31/gas/config/tc-mn10300.c Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/gas/config/tc-mn10300.c Fri Oct 5 14:11:21 2001 @@ -20,8 +20,8 @@ Boston, MA 02111-1307, USA. */ #include -#include #include "as.h" +#include "safe-ctype.h" #include "subsegs.h" #include "opcode/mn10300.h" #include "dwarf2dbg.h" @@ -92,7 +92,7 @@ static int reg_name_search PARAMS ((cons static boolean data_register_name PARAMS ((expressionS *expressionP)); static boolean address_register_name PARAMS ((expressionS *expressionP)); static boolean other_register_name PARAMS ((expressionS *expressionP)); -static void set_arch_mach PARAMS ((int)); +static void set_arch_mach PARAMS ((unsigned int)); /* Set linkrelax here to avoid fixups in most sections. */ int linkrelax = 1; @@ -917,7 +917,7 @@ md_assemble (str) int match; /* Get the opcode. */ - for (s = str; *s != '\0' && !isspace (*s); s++) + for (s = str; *s != '\0' && !ISSPACE (*s); s++) ; if (*s != '\0') *s++ = '\0'; @@ -931,7 +931,7 @@ md_assemble (str) } str = s; - while (isspace (*str)) + while (ISSPACE (*str)) ++str; input_line_pointer = str; @@ -1445,7 +1445,7 @@ keep_going: break; } - while (isspace (*str)) + while (ISSPACE (*str)) ++str; if (*str != '\0') @@ -1779,6 +1779,8 @@ tc_gen_reloc (seg, fixp) if (fixp->fx_addsy && fixp->fx_subsy) { + reloc->sym_ptr_ptr = NULL; + /* If we got a difference between two symbols, and the subtracted symbol is in the current section, use a PC-relative relocation. If both symbols are in the same @@ -1824,12 +1826,42 @@ tc_gen_reloc (seg, fixp) { as_bad_where (fixp->fx_file, fixp->fx_line, "Difference of symbols in different sections is not supported"); - return NULL; + } + else + { + char *fixpos = fixp->fx_where + fixp->fx_frag->fr_literal; + + reloc->addend = (S_GET_VALUE (fixp->fx_addsy) + - S_GET_VALUE (fixp->fx_subsy) + fixp->fx_offset); + + switch (fixp->fx_r_type) + { + case BFD_RELOC_8: + md_number_to_chars (fixpos, reloc->addend, 1); + break; + + case BFD_RELOC_16: + md_number_to_chars (fixpos, reloc->addend, 2); + break; + + case BFD_RELOC_24: + md_number_to_chars (fixpos, reloc->addend, 3); + break; + + case BFD_RELOC_32: + md_number_to_chars (fixpos, reloc->addend, 4); + break; + + default: + reloc->sym_ptr_ptr = (asymbol **) &bfd_abs_symbol; + return reloc; + } } - reloc->sym_ptr_ptr = (asymbol **) &bfd_abs_symbol; - reloc->addend = (S_GET_VALUE (fixp->fx_addsy) - - S_GET_VALUE (fixp->fx_subsy) + fixp->fx_offset); + if (reloc->sym_ptr_ptr) + free (reloc->sym_ptr_ptr); + free (reloc); + return NULL; } else { @@ -2130,7 +2162,7 @@ check_operand (insn, operand, val) static void set_arch_mach (mach) - int mach; + unsigned int mach; { if (!bfd_set_arch_mach (stdoutput, bfd_arch_mn10300, mach)) as_warn (_("could not set architecture and machine")); diff -uprN binutils-2.11.90.0.31/gas/config/tc-ns32k.c binutils-2.11.92.0.5/gas/config/tc-ns32k.c --- binutils-2.11.90.0.31/gas/config/tc-ns32k.c Thu Jul 26 18:02:55 2001 +++ binutils-2.11.92.0.5/gas/config/tc-ns32k.c Mon Oct 1 15:25:22 2001 @@ -23,7 +23,6 @@ /*#define SHOW_NUM 1*//* Uncomment for debugging. */ #include -#include #include "as.h" #include "opcode/ns32k.h" diff -uprN binutils-2.11.90.0.31/gas/config/tc-openrisc.c binutils-2.11.92.0.5/gas/config/tc-openrisc.c --- binutils-2.11.90.0.31/gas/config/tc-openrisc.c Sat May 12 00:06:47 2001 +++ binutils-2.11.92.0.5/gas/config/tc-openrisc.c Mon Oct 1 15:25:22 2001 @@ -20,7 +20,6 @@ Boston, MA 02111-1307, USA. */ #include -#include #include "as.h" #include "subsegs.h" #include "symcat.h" diff -uprN binutils-2.11.90.0.31/gas/config/tc-pdp11.c binutils-2.11.92.0.5/gas/config/tc-pdp11.c --- binutils-2.11.90.0.31/gas/config/tc-pdp11.c Thu Jul 26 18:02:55 2001 +++ binutils-2.11.92.0.5/gas/config/tc-pdp11.c Mon Oct 1 15:25:22 2001 @@ -26,6 +26,7 @@ */ #include "as.h" +#include "safe-ctype.h" #include "opcode/pdp11.h" static int set_option PARAMS ((char *arg)); @@ -252,19 +253,11 @@ find_whitespace (char *str) return str; } -static char -mklower (char c) -{ - if (isupper (c)) - return tolower (c); - return c; -} - static char * parse_reg (char *str, struct pdp11_code *operand) { str = skip_whitespace (str); - if (mklower (*str) == 'r') + if (TOLOWER (*str) == 'r') { str++; switch (*str) diff -uprN binutils-2.11.90.0.31/gas/config/tc-pj.c binutils-2.11.92.0.5/gas/config/tc-pj.c --- binutils-2.11.90.0.31/gas/config/tc-pj.c Fri Mar 9 11:17:07 2001 +++ binutils-2.11.92.0.5/gas/config/tc-pj.c Mon Oct 1 15:25:22 2001 @@ -1,6 +1,6 @@ /*- tc-pj.c -- Assemble code for Pico Java - Copyright 1999, 2000 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -22,6 +22,7 @@ /* Contributed by Steve Chamberlain of Transmeta . */ #include "as.h" +#include "safe-ctype.h" #include "opcode/pj.h" extern const pj_opc_info_t pj_opc_info[512]; @@ -312,7 +313,7 @@ md_assemble (str) pending_reloc = 0; } - while (isspace (*op_end)) + while (ISSPACE (*op_end)) op_end++; if (*op_end != 0) diff -uprN binutils-2.11.90.0.31/gas/config/tc-ppc.c binutils-2.11.92.0.5/gas/config/tc-ppc.c --- binutils-2.11.90.0.31/gas/config/tc-ppc.c Mon Aug 27 11:44:51 2001 +++ binutils-2.11.92.0.5/gas/config/tc-ppc.c Thu Oct 4 14:35:43 2001 @@ -21,8 +21,8 @@ 02111-1307, USA. */ #include -#include #include "as.h" +#include "safe-ctype.h" #include "subsegs.h" #include "opcode/ppc.h" @@ -618,10 +618,10 @@ register_name (expressionP) /* Find the spelling of the operand. */ start = name = input_line_pointer; - if (name[0] == '%' && isalpha (name[1])) + if (name[0] == '%' && ISALPHA (name[1])) name = ++input_line_pointer; - else if (!reg_names_p || !isalpha (name[0])) + else if (!reg_names_p || !ISALPHA (name[0])) return false; c = get_symbol_end (); @@ -1383,10 +1383,10 @@ ppc_elf_suffix (str_p, exp_p) for (ch = *str, str2 = ident; (str2 < ident + sizeof (ident) - 1 - && (isalnum (ch) || ch == '@')); + && (ISALNUM (ch) || ch == '@')); ch = *++str) { - *str2++ = (islower (ch)) ? ch : tolower (ch); + *str2++ = TOLOWER (ch); } *str2 = '\0'; @@ -1820,7 +1820,7 @@ md_assemble (str) #endif /* Get the opcode. */ - for (s = str; *s != '\0' && ! isspace (*s); s++) + for (s = str; *s != '\0' && ! ISSPACE (*s); s++) ; if (*s != '\0') *s++ = '\0'; @@ -1843,7 +1843,7 @@ md_assemble (str) insn = opcode->opcode; str = s; - while (isspace (*str)) + while (ISSPACE (*str)) ++str; /* PowerPC operands are just expressions. The only real issue is @@ -2176,6 +2176,7 @@ md_assemble (str) } if (BFD_DEFAULT_TARGET_SIZE == 64 + && ppc_size == PPC_OPCODE_64 && (operand->flags & PPC_OPERAND_DS) != 0) { switch (reloc) @@ -2266,7 +2267,7 @@ md_assemble (str) ++str; } - while (isspace (*str)) + while (ISSPACE (*str)) ++str; if (*str != '\0') @@ -2440,7 +2441,7 @@ ppc_section_letter (letter, ptr_msg) if (letter == 'e') return SHF_EXCLUDE; - *ptr_msg = _("Bad .section directive: want a,w,x,e in string"); + *ptr_msg = _("Bad .section directive: want a,e,w,x,M,S in string"); return 0; } @@ -3586,6 +3587,7 @@ ppc_tc (ignore) #endif /* OBJ_XCOFF */ #ifdef OBJ_ELF + int align; /* Skip the TOC symbol name. */ while (is_part_of_name (*input_line_pointer) @@ -3596,8 +3598,9 @@ ppc_tc (ignore) ++input_line_pointer; /* Align to a four/eight byte boundary. */ - frag_align (BFD_DEFAULT_TARGET_SIZE == 64 ? 3 : 2, 0, 0); - record_alignment (now_seg, BFD_DEFAULT_TARGET_SIZE == 64 ? 3 : 2); + align = BFD_DEFAULT_TARGET_SIZE == 64 && ppc_size == PPC_OPCODE_64 ? 3 : 2; + frag_align (align, 0, 0); + record_alignment (now_seg, align); #endif /* OBJ_ELF */ if (*input_line_pointer != ',') @@ -3630,7 +3633,7 @@ ppc_is_toc_sym (sym) #endif #ifdef OBJ_ELF const char *sname = segment_name (S_GET_SEGMENT (sym)); - if (BFD_DEFAULT_TARGET_SIZE == 64) + if (BFD_DEFAULT_TARGET_SIZE == 64 && ppc_size == PPC_OPCODE_64) return strcmp (sname, ".toc") == 0; else return strcmp (sname, ".got") == 0; @@ -4267,8 +4270,7 @@ ppc_canonicalize_symbol_name (name) } for (s++; *s != '\0' && *s != brac; s++) - if (islower (*s)) - *s = toupper (*s); + *s = TOUPPER (*s); if (*s == '\0' || s[1] != '\0') as_bad (_("bad symbol suffix")); @@ -5175,6 +5177,7 @@ md_apply_fix3 (fixp, valuep, seg) fixp->fx_r_type = BFD_RELOC_PPC_TOC16; #ifdef OBJ_ELF if (BFD_DEFAULT_TARGET_SIZE == 64 + && ppc_size == PPC_OPCODE_64 && (operand->flags & PPC_OPERAND_DS) != 0) fixp->fx_r_type = BFD_RELOC_PPC64_TOC16_DS; #endif @@ -5209,7 +5212,10 @@ md_apply_fix3 (fixp, valuep, seg) switch (fixp->fx_r_type) { case BFD_RELOC_CTOR: - /* FIXME: 32 bits even for 64-bit targets? */ + if (BFD_DEFAULT_TARGET_SIZE == 64 && ppc_size == PPC_OPCODE_64) + goto ctor64; + /* fall through */ + case BFD_RELOC_32: if (fixp->fx_pcrel) fixp->fx_r_type = BFD_RELOC_32_PCREL; @@ -5224,6 +5230,7 @@ md_apply_fix3 (fixp, valuep, seg) break; case BFD_RELOC_64: + ctor64: if (fixp->fx_pcrel) fixp->fx_r_type = BFD_RELOC_64_PCREL; /* fall through */ diff -uprN binutils-2.11.90.0.31/gas/config/tc-s390.c binutils-2.11.92.0.5/gas/config/tc-s390.c --- binutils-2.11.90.0.31/gas/config/tc-s390.c Mon Aug 27 11:44:52 2001 +++ binutils-2.11.92.0.5/gas/config/tc-s390.c Mon Oct 1 15:25:22 2001 @@ -20,33 +20,36 @@ 02111-1307, USA. */ #include -#include #include "as.h" +#include "safe-ctype.h" #include "subsegs.h" #include "struc-symbol.h" #include "opcode/s390.h" #include "elf/s390.h" -/* The default architecture */ +/* The default architecture. */ #ifndef DEFAULT_ARCH #define DEFAULT_ARCH "s390" #endif static char *default_arch = DEFAULT_ARCH; /* Either 32 or 64, selects file format. */ static int s390_arch_size; -/* Current architecture. Start with the smallest instruction set */ +/* Current architecture. Start with the smallest instruction set. */ static enum s390_opcode_arch_val current_architecture = S390_OPCODE_ESA; static int current_arch_mask = 1 << S390_OPCODE_ESA; static int current_arch_requested = 0; -/* Whether to use user friendly register names. Default is true. */ +/* Whether to use user friendly register names. Default is true. */ #ifndef TARGET_REG_NAMES_P #define TARGET_REG_NAMES_P true #endif static boolean reg_names_p = TARGET_REG_NAMES_P; +/* Set to TRUE if we want to warn about zero base/index registers. */ +static boolean warn_areg_zero = FALSE; + /* Generic assembler global variables which must be defined by all targets. */ @@ -263,7 +266,7 @@ register_name (expressionP) /* Find the spelling of the operand. */ start = name = input_line_pointer; - if (name[0] == '%' && isalpha (name[1])) + if (name[0] == '%' && ISALPHA (name[1])) name = ++input_line_pointer; else return false; @@ -367,6 +370,9 @@ md_parse_option (c, arg) else if (arg != NULL && strcmp (arg, "no-regnames") == 0) reg_names_p = false; + else if (arg != NULL && strcmp (arg, "warn-areg-zero") == 0) + warn_areg_zero = TRUE; + else { as_bad (_("invalid switch -m%s"), arg); @@ -413,17 +419,18 @@ md_show_usage (stream) FILE *stream; { fprintf (stream, _("\ - S390 options:\n\ - -mregnames \tAllow symbolic names for registers\n\ - -mno-regnames\tDo not allow symbolic names for registers\n")); + S390 options:\n\ + -mregnames Allow symbolic names for registers\n\ + -mwarn-areg-zero Warn about zero base/index registers\n\ + -mno-regnames Do not allow symbolic names for registers\n")); fprintf (stream, _("\ - -V \tprint assembler version number\n\ - -Qy, -Qn \tignored\n")); + -V print assembler version number\n\ + -Qy, -Qn ignored\n")); } /* This function is called when the assembler starts up. It is called after the options have been parsed and the output file has been - opened. */ + opened. */ void md_begin () @@ -433,7 +440,7 @@ md_begin () boolean dup_insn = false; const char *retval; - /* Set the ELF flags if desired. */ + /* Set the ELF flags if desired. */ if (s390_flags) bfd_set_private_flags (stdoutput, s390_flags); @@ -633,13 +640,13 @@ s390_elf_suffix (str_p, exp_p) return ELF_SUFFIX_NONE; ident = str; - while (isalnum (*str)) + while (ISALNUM (*str)) str++; len = str - ident; for (ptr = &mapping[0]; ptr->length > 0; ptr++) - if (len == ptr->length && - strncasecmp (ident, ptr->string, ptr->length) == 0) + if (len == ptr->length + && strncasecmp (ident, ptr->string, ptr->length) == 0) { if (exp_p->X_add_number != 0) as_warn (_("identifier+constant@%s means identifier@%s+constant"), @@ -732,8 +739,8 @@ s390_exp_compare(exp1, exp2) case O_uminus: case O_bit_not: case O_logical_not: - return (exp1->X_add_symbol == exp2->X_add_symbol) && - (exp1->X_add_number == exp2->X_add_number); + return (exp1->X_add_symbol == exp2->X_add_symbol) + && (exp1->X_add_number == exp2->X_add_number); case O_multiply: /* X_add_symbol,X_op_symbol&X_add_number must be equal. */ case O_divide: @@ -754,9 +761,9 @@ s390_exp_compare(exp1, exp2) case O_gt: case O_logical_and: case O_logical_or: - return (exp1->X_add_symbol == exp2->X_add_symbol) && - (exp1->X_op_symbol == exp2->X_op_symbol) && - (exp1->X_add_number == exp2->X_add_number); + return (exp1->X_add_symbol == exp2->X_add_symbol) + && (exp1->X_op_symbol == exp2->X_op_symbol) + && (exp1->X_add_number == exp2->X_add_number); default: return 0; } @@ -782,11 +789,11 @@ s390_lit_suffix (str_p, exp_p, suffix) /* We look for a suffix of the form "@lit1", "@lit2", "@lit4" or "@lit8". */ ident = str; - while (isalnum (*str)) + while (ISALNUM (*str)) str++; len = str - ident; - if (len != 4 || strncasecmp (ident, "lit", 3) != 0 || - (ident[3]!='1' && ident[3]!='2' && ident[3]!='4' && ident[3]!='8')) + if (len != 4 || strncasecmp (ident, "lit", 3) != 0 + || (ident[3]!='1' && ident[3]!='2' && ident[3]!='4' && ident[3]!='8')) return suffix; /* no modification */ nbytes = ident[3] - '0'; @@ -838,8 +845,8 @@ s390_lit_suffix (str_p, exp_p, suffix) { /* Processing for 'normal' data types. */ for (lpe = lpe_list; lpe != NULL; lpe = lpe->next) - if (lpe->nbytes == nbytes && lpe->reloc == reloc && - s390_exp_compare(exp_p, &lpe->ex) != 0) + if (lpe->nbytes == nbytes && lpe->reloc == reloc + && s390_exp_compare(exp_p, &lpe->ex) != 0) break; } @@ -1006,7 +1013,7 @@ md_gather_operands (str, insn, opcode) char *f; int fc, i; - while (isspace(*str)) str++; + while (ISSPACE (*str)) str++; parentheses = 0; skip_optional = 0; @@ -1062,9 +1069,13 @@ md_gather_operands (str, insn, opcode) } else { - if ((operand->flags & S390_OPERAND_INDEX) && ex.X_add_number == 0) + if ((operand->flags & S390_OPERAND_INDEX) + && ex.X_add_number == 0 + && warn_areg_zero == TRUE) as_warn ("index register specified but zero"); - if ((operand->flags & S390_OPERAND_BASE) && ex.X_add_number == 0) + if ((operand->flags & S390_OPERAND_BASE) + && ex.X_add_number == 0 + && warn_areg_zero == TRUE) as_warn ("base register specified but zero"); s390_insert_operand (insn, operand, ex.X_add_number, NULL, 0); } @@ -1079,26 +1090,26 @@ md_gather_operands (str, insn, opcode) { if (operand->flags & S390_OPERAND_DISP) reloc = BFD_RELOC_390_GOT12; - else if ((operand->flags & S390_OPERAND_SIGNED) && - (operand->bits == 16)) + else if ((operand->flags & S390_OPERAND_SIGNED) + && (operand->bits == 16)) reloc = BFD_RELOC_390_GOT16; - else if ((operand->flags & S390_OPERAND_PCREL) && - (operand->bits == 32)) + else if ((operand->flags & S390_OPERAND_PCREL) + && (operand->bits == 32)) reloc = BFD_RELOC_390_GOTENT; } else if (suffix == ELF_SUFFIX_PLT) { - if ((operand->flags & S390_OPERAND_PCREL) && - (operand->bits == 16)) + if ((operand->flags & S390_OPERAND_PCREL) + && (operand->bits == 16)) reloc = BFD_RELOC_390_PLT16DBL; - else if ((operand->flags & S390_OPERAND_PCREL) && - (operand->bits == 32)) + else if ((operand->flags & S390_OPERAND_PCREL) + && (operand->bits == 32)) reloc = BFD_RELOC_390_PLT32DBL; } else if (suffix == ELF_SUFFIX_GOTENT) { - if ((operand->flags & S390_OPERAND_PCREL) && - (operand->bits == 32)) + if ((operand->flags & S390_OPERAND_PCREL) + && (operand->bits == 32)) reloc = BFD_RELOC_390_GOTENT; } @@ -1193,7 +1204,7 @@ md_gather_operands (str, insn, opcode) } } - while (isspace (*str)) + while (ISSPACE (*str)) ++str; if (*str != '\0') @@ -1243,8 +1254,8 @@ md_gather_operands (str, insn, opcode) /* Turn off overflow checking in fixup_segment. This is necessary because fixup_segment will signal an overflow for large 4 byte quantities for GOT12 relocations. */ - if (fixups[i].reloc == BFD_RELOC_390_GOT12 || - fixups[i].reloc == BFD_RELOC_390_GOT16) + if ( fixups[i].reloc == BFD_RELOC_390_GOT12 + || fixups[i].reloc == BFD_RELOC_390_GOT16) fixP->fx_no_overflow = 1; } else @@ -1267,7 +1278,7 @@ md_assemble (str) char *s; /* Get the opcode. */ - for (s = str; *s != '\0' && ! isspace (*s); s++) + for (s = str; *s != '\0' && ! ISSPACE (*s); s++) ; if (*s != '\0') *s++ = '\0'; @@ -1336,7 +1347,7 @@ s390_insn (ignore) /* Get the opcode format. */ s = input_line_pointer; - while (*s != '\0' && *s != ',' && ! isspace (*s)) + while (*s != '\0' && *s != ',' && ! ISSPACE (*s)) s++; if (*s != ',') as_bad (_("Invalid .insn format\n")); @@ -1354,17 +1365,18 @@ s390_insn (ignore) expression (&exp); if (exp.X_op == O_constant) { - if (opformat->oplen == 4 || - (opformat->oplen == 2 && exp.X_op < 0x10000)) + if ( ((opformat->oplen == 6) && (exp.X_op > 0) && (exp.X_op < (1ULL << 48))) + || ((opformat->oplen == 4) && (exp.X_op > 0) && (exp.X_op < (1ULL << 32))) + || ((opformat->oplen == 2) && (exp.X_op > 0) && (exp.X_op < (1ULL << 16)))) md_number_to_chars (insn, exp.X_add_number, opformat->oplen); else as_bad (_("Invalid .insn format\n")); } else if (exp.X_op == O_big) { - if (exp.X_add_number > 0 && - opformat->oplen == 6 && - generic_bignum[3] == 0) + if (exp.X_add_number > 0 + && opformat->oplen == 6 + && generic_bignum[3] == 0) { md_number_to_chars (insn, generic_bignum[2], 2); md_number_to_chars (&insn[2], generic_bignum[1], 2); @@ -1375,12 +1387,14 @@ s390_insn (ignore) } else as_bad (_("second operand of .insn not a constant\n")); - if (*input_line_pointer++ != ',') - as_bad (_("missing comma after insn constant\n")); + if (strcmp (opformat->name, "e") != 0 && *input_line_pointer++ != ',') + as_bad (_("missing comma after insn constant\n")); + if ((s = strchr (input_line_pointer, '\n')) != NULL) *s = '\0'; - input_line_pointer = md_gather_operands (input_line_pointer, insn, opformat); + input_line_pointer = md_gather_operands (input_line_pointer, insn, + opformat); if (s != NULL) *s = '\n'; demand_empty_rest_of_line (); @@ -1611,7 +1625,7 @@ tc_s390_fix_adjustable(fixP) if (S_IS_WEAK (fixP->fx_addsy)) return 0; /* adjust_reloc_syms doesn't know about the GOT. */ - if (fixP->fx_r_type == BFD_RELOC_32_GOTOFF + if ( fixP->fx_r_type == BFD_RELOC_32_GOTOFF || fixP->fx_r_type == BFD_RELOC_390_PLT16DBL || fixP->fx_r_type == BFD_RELOC_390_PLT32 || fixP->fx_r_type == BFD_RELOC_390_PLT32DBL @@ -1723,8 +1737,8 @@ md_apply_fix3 (fixp, valuep, seg) else fixp->fx_r_type = BFD_RELOC_16; } - else if (operand->bits == 32 && operand->shift == 16 && - (operand->flags & S390_OPERAND_PCREL)) + else if (operand->bits == 32 && operand->shift == 16 + && (operand->flags & S390_OPERAND_PCREL)) { fixp->fx_size = 4; fixp->fx_where += 2; @@ -1887,8 +1901,8 @@ tc_gen_reloc (seg, fixp) code = fixp->fx_r_type; if (GOT_symbol && fixp->fx_addsy == GOT_symbol) { - if ((s390_arch_size == 32 && code == BFD_RELOC_32_PCREL) || - (s390_arch_size == 64 && code == BFD_RELOC_64_PCREL)) + if ( (s390_arch_size == 32 && code == BFD_RELOC_32_PCREL) + || (s390_arch_size == 64 && code == BFD_RELOC_64_PCREL)) code = BFD_RELOC_390_GOTPC; if (code == BFD_RELOC_390_PC32DBL) code = BFD_RELOC_390_GOTPCDBL; diff -uprN binutils-2.11.90.0.31/gas/config/tc-sh.c binutils-2.11.92.0.5/gas/config/tc-sh.c --- binutils-2.11.90.0.31/gas/config/tc-sh.c Fri Jul 6 09:26:11 2001 +++ binutils-2.11.92.0.5/gas/config/tc-sh.c Mon Oct 1 15:25:22 2001 @@ -27,7 +27,7 @@ #include "subsegs.h" #define DEFINE_TABLE #include "opcodes/sh-opc.h" -#include +#include "safe-ctype.h" #include "struc-symbol.h" #ifdef OBJ_ELF @@ -36,6 +36,14 @@ #include "dwarf2dbg.h" +typedef struct + { + sh_arg_type type; + int reg; + expressionS immediate; + } +sh_operand_info; + const char comment_chars[] = "!"; const char line_separator_chars[] = ";"; const char line_comment_chars[] = "!#"; @@ -45,11 +53,26 @@ static void s_uses PARAMS ((int)); static void sh_count_relocs PARAMS ((bfd *, segT, PTR)); static void sh_frob_section PARAMS ((bfd *, segT, PTR)); -void cons (); -void s_align_bytes (); static void s_uacons PARAMS ((int)); static sh_opcode_info *find_cooked_opcode PARAMS ((char **)); static unsigned int assemble_ppi PARAMS ((char *, sh_opcode_info *)); +static void little PARAMS ((int)); +static bfd_reloc_code_real_type sh_elf_suffix + PARAMS ((char **str_p, expressionS *, expressionS *new_exp_p)); +static int parse_reg PARAMS ((char *, int *, int *)); +static symbolS *dot PARAMS ((void)); +static char *parse_exp PARAMS ((char *, sh_operand_info *)); +static char *parse_at PARAMS ((char *, sh_operand_info *)); +static void get_operand PARAMS ((char **, sh_operand_info *)); +static char *get_operands + PARAMS ((sh_opcode_info *, char *, sh_operand_info *)); +static sh_opcode_info *get_specific + PARAMS ((sh_opcode_info *, sh_operand_info *)); +static void insert PARAMS ((char *, int, int, sh_operand_info *)); +static void build_relax PARAMS ((sh_opcode_info *, sh_operand_info *)); +static char *insert_loop_bounds PARAMS ((char *, sh_operand_info *)); +static unsigned int build_Mytes + PARAMS ((sh_opcode_info *, sh_operand_info *)); #ifdef OBJ_ELF static void sh_elf_cons PARAMS ((int)); @@ -259,11 +282,9 @@ sh_elf_suffix (str_p, exp_p, new_exp_p) for (ch = *str, str2 = ident; (str2 < ident + sizeof (ident) - 1 - && (isalnum (ch) || ch == '@')); + && (ISALNUM (ch) || ch == '@')); ch = *++str) - { - *str2++ = (islower (ch)) ? ch : tolower (ch); - } + *str2++ = TOLOWER (ch); *str2 = '\0'; len = str2 - ident; @@ -456,15 +477,7 @@ static int reg_x, reg_y; static int reg_efg; static int reg_b; -typedef struct - { - sh_arg_type type; - int reg; - expressionS immediate; - } -sh_operand_info; - -#define IDENT_CHAR(c) (isalnum (c) || (c) == '_') +#define IDENT_CHAR(c) (ISALNUM (c) || (c) == '_') /* Try to parse a reg name. Return the number of chars consumed. */ @@ -474,8 +487,8 @@ parse_reg (src, mode, reg) int *mode; int *reg; { - char l0 = tolower (src[0]); - char l1 = l0 ? tolower (src[1]) : 0; + char l0 = TOLOWER (src[0]); + char l1 = l0 ? TOLOWER (src[1]) : 0; /* We use ! IDENT_CHAR for the next character after the register name, to make sure that we won't accidentally recognize a symbol name such as @@ -530,7 +543,7 @@ parse_reg (src, mode, reg) *reg = A_A0_NUM; return 2; } - if (tolower (src[2]) == 'g' && ! IDENT_CHAR ((unsigned char) src[3])) + if (TOLOWER (src[2]) == 'g' && ! IDENT_CHAR ((unsigned char) src[3])) { *mode = DSP_REG_N; *reg = A_A0G_NUM; @@ -545,7 +558,7 @@ parse_reg (src, mode, reg) *reg = A_A1_NUM; return 2; } - if (tolower (src[2]) == 'g' && ! IDENT_CHAR ((unsigned char) src[3])) + if (TOLOWER (src[2]) == 'g' && ! IDENT_CHAR ((unsigned char) src[3])) { *mode = DSP_REG_N; *reg = A_A1G_NUM; @@ -626,34 +639,34 @@ parse_reg (src, mode, reg) if (l0 == 's' && l1 == 's' - && tolower (src[2]) == 'r' && ! IDENT_CHAR ((unsigned char) src[3])) + && TOLOWER (src[2]) == 'r' && ! IDENT_CHAR ((unsigned char) src[3])) { *mode = A_SSR; return 3; } - if (l0 == 's' && l1 == 'p' && tolower (src[2]) == 'c' + if (l0 == 's' && l1 == 'p' && TOLOWER (src[2]) == 'c' && ! IDENT_CHAR ((unsigned char) src[3])) { *mode = A_SPC; return 3; } - if (l0 == 's' && l1 == 'g' && tolower (src[2]) == 'r' + if (l0 == 's' && l1 == 'g' && TOLOWER (src[2]) == 'r' && ! IDENT_CHAR ((unsigned char) src[3])) { *mode = A_SGR; return 3; } - if (l0 == 'd' && l1 == 's' && tolower (src[2]) == 'r' + if (l0 == 'd' && l1 == 's' && TOLOWER (src[2]) == 'r' && ! IDENT_CHAR ((unsigned char) src[3])) { *mode = A_DSR; return 3; } - if (l0 == 'd' && l1 == 'b' && tolower (src[2]) == 'r' + if (l0 == 'd' && l1 == 'b' && TOLOWER (src[2]) == 'r' && ! IDENT_CHAR ((unsigned char) src[3])) { *mode = A_DBR; @@ -685,34 +698,34 @@ parse_reg (src, mode, reg) *mode = A_PC; return 2; } - if (l0 == 'g' && l1 == 'b' && tolower (src[2]) == 'r' + if (l0 == 'g' && l1 == 'b' && TOLOWER (src[2]) == 'r' && ! IDENT_CHAR ((unsigned char) src[3])) { *mode = A_GBR; return 3; } - if (l0 == 'v' && l1 == 'b' && tolower (src[2]) == 'r' + if (l0 == 'v' && l1 == 'b' && TOLOWER (src[2]) == 'r' && ! IDENT_CHAR ((unsigned char) src[3])) { *mode = A_VBR; return 3; } - if (l0 == 'm' && l1 == 'a' && tolower (src[2]) == 'c' + if (l0 == 'm' && l1 == 'a' && TOLOWER (src[2]) == 'c' && ! IDENT_CHAR ((unsigned char) src[4])) { - if (tolower (src[3]) == 'l') + if (TOLOWER (src[3]) == 'l') { *mode = A_MACL; return 4; } - if (tolower (src[3]) == 'h') + if (TOLOWER (src[3]) == 'h') { *mode = A_MACH; return 4; } } - if (l0 == 'm' && l1 == 'o' && tolower (src[2]) == 'd' + if (l0 == 'm' && l1 == 'o' && TOLOWER (src[2]) == 'd' && ! IDENT_CHAR ((unsigned char) src[4])) { *mode = A_MOD; @@ -794,25 +807,25 @@ parse_reg (src, mode, reg) return 3; } } - if (l0 == 'f' && l1 == 'p' && tolower (src[2]) == 'u' - && tolower (src[3]) == 'l' + if (l0 == 'f' && l1 == 'p' && TOLOWER (src[2]) == 'u' + && TOLOWER (src[3]) == 'l' && ! IDENT_CHAR ((unsigned char) src[4])) { *mode = FPUL_N; return 4; } - if (l0 == 'f' && l1 == 'p' && tolower (src[2]) == 's' - && tolower (src[3]) == 'c' - && tolower (src[4]) == 'r' && ! IDENT_CHAR ((unsigned char) src[5])) + if (l0 == 'f' && l1 == 'p' && TOLOWER (src[2]) == 's' + && TOLOWER (src[3]) == 'c' + && TOLOWER (src[4]) == 'r' && ! IDENT_CHAR ((unsigned char) src[5])) { *mode = FPSCR_N; return 5; } - if (l0 == 'x' && l1 == 'm' && tolower (src[2]) == 't' - && tolower (src[3]) == 'r' - && tolower (src[4]) == 'x' && ! IDENT_CHAR ((unsigned char) src[5])) + if (l0 == 'x' && l1 == 'm' && TOLOWER (src[2]) == 't' + && TOLOWER (src[3]) == 'r' + && TOLOWER (src[4]) == 'x' && ! IDENT_CHAR ((unsigned char) src[5])) { *mode = XMTRX_M4; return 5; @@ -1381,21 +1394,6 @@ get_specific (opcode, operands) return 0; } -int -check (operand, low, high) - expressionS *operand; - int low; - int high; -{ - if (operand->X_op != O_constant - || operand->X_add_number < low - || operand->X_add_number > high) - { - as_bad (_("operand must be absolute in range %d..%d"), low, high); - } - return operand->X_add_number; -} - static void insert (where, how, pcrel, op) char *where; @@ -1501,7 +1499,6 @@ static unsigned int build_Mytes (opcode, operand) sh_opcode_info *opcode; sh_operand_info *operand; - { int index; char nbuf[4]; @@ -1638,9 +1635,9 @@ find_cooked_opcode (str_p) /* The machine independent code will convert CMP/EQ into cmp/EQ because it thinks the '/' is the end of the symbol. Moreover, all but the first sub-insn is a parallel processing insn won't - be capitailzed. Instead of hacking up the machine independent + be capitalized. Instead of hacking up the machine independent code, we just deal with it here. */ - c = isupper (c) ? tolower (c) : c; + c = TOLOWER (c); name[nlen] = c; nlen++; } @@ -2185,13 +2182,6 @@ SH options:\n\ -dsp enable sh-dsp insns, and disable sh3e / sh4 insns.\n")); } -void -tc_Nout_fix_to_chars () -{ - printf (_("call to tc_Nout_fix_to_chars \n")); - abort (); -} - /* This struct is used to pass arguments to sh_count_relocs through bfd_map_over_sections. */ @@ -3118,9 +3108,23 @@ md_number_to_chars (ptr, use, nbytes) } long -md_pcrel_from (fixP) +md_pcrel_from_section (fixP, sec) fixS *fixP; + segT sec; { + if (fixP->fx_addsy != (symbolS *) NULL + && (! S_IS_DEFINED (fixP->fx_addsy) + || S_IS_EXTERN (fixP->fx_addsy) + || S_IS_WEAK (fixP->fx_addsy) + || S_GET_SEGMENT (fixP->fx_addsy) != sec)) + { + /* The symbol is undefined (or is defined but not in this section, + or we're not sure about it being the final definition). Let the + linker figure it out. We need to adjust the subtraction of a + symbol to the position of the relocated data, though. */ + return fixP->fx_subsy ? fixP->fx_where + fixP->fx_frag->fr_address : 0; + } + return fixP->fx_size + fixP->fx_where + fixP->fx_frag->fr_address + 2; } diff -uprN binutils-2.11.90.0.31/gas/config/tc-sh.h binutils-2.11.92.0.5/gas/config/tc-sh.h --- binutils-2.11.90.0.31/gas/config/tc-sh.h Fri Mar 9 11:17:08 2001 +++ binutils-2.11.92.0.5/gas/config/tc-sh.h Mon Oct 1 15:25:22 2001 @@ -58,7 +58,13 @@ extern void sh_handle_align PARAMS ((fra /* We need to force out some relocations when relaxing. */ #define TC_FORCE_RELOCATION(fix) sh_force_relocation (fix) -extern int sh_force_relocation (); + +/* The type fixS is defined (to struct fix) in write.h, but write.h uses + definitions from this file. To avoid problems with including write.h + after the "right" definitions, don't; just forward-declare struct fix + here. */ +struct fix; +extern int sh_force_relocation PARAMS ((struct fix *)); #ifdef OBJ_ELF #define obj_fix_adjustable(fixP) sh_fix_adjustable(fixP) @@ -70,6 +76,9 @@ extern boolean sh_fix_adjustable PARAMS #define TC_FIX_ADJUSTABLE(fixP) obj_fix_adjustable (fixP) #endif +#define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section (FIXP, SEC) +extern long md_pcrel_from_section PARAMS ((struct fix *, segT)); + #define IGNORE_NONSTANDARD_ESCAPES #define LISTING_HEADER (shl ? "Hitachi Super-H GAS Little Endian" : "Hitachi Super-H GAS Big Endian") diff -uprN binutils-2.11.90.0.31/gas/config/tc-sparc.c binutils-2.11.92.0.5/gas/config/tc-sparc.c --- binutils-2.11.90.0.31/gas/config/tc-sparc.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/gas/config/tc-sparc.c Mon Oct 1 15:25:22 2001 @@ -20,9 +20,9 @@ Boston, MA 02111-1307, USA. */ #include -#include #include "as.h" +#include "safe-ctype.h" #include "subsegs.h" #include "opcode/sparc.h" @@ -1385,11 +1385,11 @@ sparc_ip (str, pinsn) int special_case = SPECIAL_CASE_NONE; s = str; - if (islower ((unsigned char) *s)) + if (ISLOWER (*s)) { do ++s; - while (islower ((unsigned char) *s) || isdigit ((unsigned char) *s)); + while (ISLOWER (*s) || ISDIGIT (*s)); } switch (*s) @@ -1617,11 +1617,11 @@ sparc_ip (str, pinsn) { s += 4; - if (isdigit ((unsigned char) *s)) + if (ISDIGIT (*s)) { long num = 0; - while (isdigit ((unsigned char) *s)) + while (ISDIGIT (*s)) { num = num * 10 + *s - '0'; ++s; @@ -1825,9 +1825,9 @@ sparc_ip (str, pinsn) break; case '#': /* Must be at least one digit. */ - if (isdigit ((unsigned char) *s++)) + if (ISDIGIT (*s++)) { - while (isdigit ((unsigned char) *s)) + while (ISDIGIT (*s)) { ++s; } @@ -1846,10 +1846,10 @@ sparc_ip (str, pinsn) case 'b': /* Next operand is a coprocessor register. */ case 'c': case 'D': - if (*s++ == '%' && *s++ == 'c' && isdigit ((unsigned char) *s)) + if (*s++ == '%' && *s++ == 'c' && ISDIGIT (*s)) { mask = *s++; - if (isdigit ((unsigned char) *s)) + if (ISDIGIT (*s)) { mask = 10 * (mask - '0') + (*s++ - '0'); if (mask >= 32) @@ -1942,7 +1942,7 @@ sparc_ip (str, pinsn) goto error; case 'r': /* any register */ - if (!isdigit ((unsigned char) (c = *s++))) + if (!ISDIGIT ((c = *s++))) { goto error; } @@ -1957,7 +1957,7 @@ sparc_ip (str, pinsn) case '7': case '8': case '9': - if (isdigit ((unsigned char) *s)) + if (ISDIGIT (*s)) { if ((c = 10 * (c - '0') + (*s++ - '0')) >= 32) { @@ -2022,9 +2022,9 @@ sparc_ip (str, pinsn) if (*s++ == '%' && ((format = *s) == 'f') - && isdigit ((unsigned char) *++s)) + && ISDIGIT (*++s)) { - for (mask = 0; isdigit ((unsigned char) *s); ++s) + for (mask = 0; ISDIGIT (*s); ++s) { mask = 10 * mask + (*s - '0'); } /* read the number */ @@ -2240,7 +2240,7 @@ sparc_ip (str, pinsn) for (s1 = s; *s1 && *s1 != ',' && *s1 != ']'; s1++) ; - if (s1 != s && isdigit ((unsigned char) s1[-1])) + if (s1 != s && ISDIGIT (s1[-1])) { if (s1[-2] == '%' && s1[-3] == '+') s1 -= 3; @@ -2663,7 +2663,7 @@ parse_keyword_arg (lookup_fn, input_poin p = *input_pointerP; for (q = p + (*p == '#' || *p == '%'); - isalnum ((unsigned char) *q) || *q == '_'; + ISALNUM (*q) || *q == '_'; ++q) continue; c = *q; @@ -2908,6 +2908,7 @@ md_apply_fix3 (fixP, value, segment) if (symbol_used_in_reloc_p (fixP->fx_addsy) && (S_IS_EXTERNAL (fixP->fx_addsy) || S_IS_WEAK (fixP->fx_addsy) + || (S_GET_SEGMENT (fixP->fx_addsy)->flags & SEC_MERGE) || (sparc_pic_code && ! fixP->fx_pcrel) || (S_GET_SEGMENT (fixP->fx_addsy) != segment && ((bfd_get_section_flags (stdoutput, diff -uprN binutils-2.11.90.0.31/gas/config/tc-tahoe.c binutils-2.11.92.0.5/gas/config/tc-tahoe.c --- binutils-2.11.90.0.31/gas/config/tc-tahoe.c Sat May 12 00:06:43 2001 +++ binutils-2.11.92.0.5/gas/config/tc-tahoe.c Mon Oct 1 15:25:22 2001 @@ -1,6 +1,6 @@ /* This file is tc-tahoe.c - Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1995, 2000 + Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1995, 2000, 2001 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -20,6 +20,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "as.h" +#include "safe-ctype.h" #include "obstack.h" /* This bit glommed from tahoe-inst.h. */ @@ -885,11 +886,11 @@ tahoe_reg_parse (start) R or r, and then a number. */ case 'R': case 'r': - if (isdigit (*regpoint)) + if (ISDIGIT (*regpoint)) { /* Got the first digit. */ regnum = *regpoint++ - '0'; - if ((regnum == 1) && isdigit (*regpoint)) + if ((regnum == 1) && ISDIGIT (*regpoint)) { /* Its a two digit number. */ regnum = 10 + (*regpoint++ - '0'); @@ -1064,7 +1065,7 @@ tip_op (optex, topP) as_warn (_("Casting a branch displacement is bad form, and is ignored.")); else { - c = (isupper (*point) ? tolower (*point) : *point); + c = TOLOWER (*point); call_width = ((c == 'b') ? 1 : ((c == 'w') ? 2 : 4)); } diff -uprN binutils-2.11.90.0.31/gas/config/tc-tic30.c binutils-2.11.92.0.5/gas/config/tc-tic30.c --- binutils-2.11.90.0.31/gas/config/tc-tic30.c Fri Mar 9 11:17:09 2001 +++ binutils-2.11.92.0.5/gas/config/tc-tic30.c Mon Oct 1 15:25:22 2001 @@ -1,5 +1,5 @@ /* tc-c30.c -- Assembly code for the Texas Instruments TMS320C30 - Copyright 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au) This file is part of GAS, the GNU Assembler. @@ -25,6 +25,7 @@ Please help us make it better. */ #include "as.h" +#include "safe-ctype.h" #include "opcode/tic30.h" /* Put here all non-digit non-letter charcters that may occur in an @@ -188,25 +189,25 @@ md_begin () for (c = 0; c < 256; c++) { - if (islower (c) || isdigit (c)) + if (ISLOWER (c) || ISDIGIT (c)) { opcode_chars[c] = c; register_chars[c] = c; } - else if (isupper (c)) + else if (ISUPPER (c)) { - opcode_chars[c] = tolower (c); + opcode_chars[c] = TOLOWER (c); register_chars[c] = opcode_chars[c]; } else if (c == ')' || c == '(') { register_chars[c] = c; } - if (isupper (c) || islower (c) || isdigit (c)) + if (ISUPPER (c) || ISLOWER (c) || ISDIGIT (c)) operand_chars[c] = c; - if (isdigit (c) || c == '-') + if (ISDIGIT (c) || c == '-') digit_chars[c] = c; - if (isalpha (c) || c == '_' || c == '.' || isdigit (c)) + if (ISALPHA (c) || c == '_' || c == '.' || ISDIGIT (c)) identifier_chars[c] = c; if (c == ' ' || c == '\t') space_chars[c] = c; @@ -1267,7 +1268,7 @@ tic30_operand (token) ind_buffer[0] = *token; for (count = 1; count < strlen (token); count++) { /* Strip operand */ - ind_buffer[buffer_posn] = tolower (*(token + count)); + ind_buffer[buffer_posn] = TOLOWER (*(token + count)); if ((*(token + count - 1) == 'a' || *(token + count - 1) == 'A') && (*(token + count) == 'r' || *(token + count) == 'R')) { @@ -1486,12 +1487,12 @@ tic30_find_parallel_insn (current_line, { if (is_opcode_char (c) && search_status == NONE) { - opcode[char_ptr++] = tolower (c); + opcode[char_ptr++] = TOLOWER (c); search_status = START_OPCODE; } else if (is_opcode_char (c) && search_status == START_OPCODE) { - opcode[char_ptr++] = tolower (c); + opcode[char_ptr++] = TOLOWER (c); } else if (!is_opcode_char (c) && search_status == START_OPCODE) { @@ -1868,7 +1869,7 @@ char * output_invalid (c) char c; { - if (isprint (c)) + if (ISPRINT (c)) sprintf (output_invalid_buf, "'%c'", c); else sprintf (output_invalid_buf, "(0x%x)", (unsigned) c); diff -uprN binutils-2.11.90.0.31/gas/config/tc-tic54x.c binutils-2.11.92.0.5/gas/config/tc-tic54x.c --- binutils-2.11.90.0.31/gas/config/tc-tic54x.c Fri Mar 9 11:17:10 2001 +++ binutils-2.11.92.0.5/gas/config/tc-tic54x.c Mon Oct 1 15:25:22 2001 @@ -1,5 +1,5 @@ /* tc-tic54x.c -- Assembly code for the Texas Instruments TMS320C54X - Copyright 1999, 2000 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001 Free Software Foundation, Inc. Contributed by Timothy Wall (twall@cygnus.com) This file is part of GAS, the GNU Assembler. @@ -45,6 +45,7 @@ #include #include #include "as.h" +#include "safe-ctype.h" #include "sb.h" #include "macro.h" #include "subsegs.h" @@ -355,7 +356,7 @@ tic54x_asg (x) name = ++input_line_pointer; c = get_symbol_end (); /* Get terminator. */ - if (!isalpha (*name)) + if (!ISALPHA (*name)) { as_bad ("symbols assigned with .asg must begin with a letter"); ignore_rest_of_line (); @@ -420,7 +421,7 @@ tic54x_eval (x) name = strcpy (tmp, name); *input_line_pointer = c; - if (!isalpha (*name)) + if (!ISALPHA (*name)) { as_bad (_("symbols assigned with .eval must begin with a letter")); ignore_rest_of_line (); @@ -1464,8 +1465,8 @@ lookup_version (ver) || ver[2] == '5' || ver[2] == '8' || ver[2] == '9')) version = ver[2] - '0'; else if (strlen (ver) == 5 - && toupper (ver[3]) == 'L' - && toupper (ver[4]) == 'P' + && TOUPPER (ver[3]) == 'L' + && TOUPPER (ver[4]) == 'P' && (ver[2] == '5' || ver[2] == '6')) version = ver[2] - '0' + 10; } @@ -2272,7 +2273,7 @@ tic54x_var (ignore) } do { - if (!isalpha (*input_line_pointer)) + if (!ISALPHA (*input_line_pointer)) { as_bad (_("Substitution symbols must begin with a letter")); ignore_rest_of_line (); @@ -2325,7 +2326,7 @@ tic54x_mlib (ignore) SKIP_WHITESPACE (); len = 0; while (!is_end_of_line[(int) *input_line_pointer] - && !isspace (*input_line_pointer)) + && !ISSPACE (*input_line_pointer)) { obstack_1grow (¬es, *input_line_pointer); ++input_line_pointer; @@ -2388,7 +2389,7 @@ tic54x_mlib (ignore) FILE *ftmp; /* We're not sure how big it is, but it will be smaller than "size". */ - bfd_read (buf, size, 1, mbfd); + bfd_bread (buf, size, mbfd); /* Write to a temporary file, then use s_include to include it a bit of a hack. */ @@ -2739,7 +2740,7 @@ subsym_iscons (a, ignore) { int len = strlen (a); - switch (toupper (a[len - 1])) + switch (TOUPPER (a[len - 1])) { case 'B': return 1; @@ -2755,7 +2756,7 @@ subsym_iscons (a, ignore) /* No suffix; either octal, hex, or decimal. */ if (*a == '0' && len > 1) { - if (toupper (a[1]) == 'X') + if (TOUPPER (a[1]) == 'X') return 3; return 2; } @@ -3294,7 +3295,7 @@ get_operands (operands, line) { int paren_not_balanced = 0; char *op_start, *op_end; - while (*lptr && isspace (*lptr)) + while (*lptr && ISSPACE (*lptr)) ++lptr; op_start = lptr; while (paren_not_balanced || *lptr != ',') @@ -3324,7 +3325,7 @@ get_operands (operands, line) /* Trim trailing spaces; while the preprocessor gets rid of most, there are weird usage patterns that can introduce them (i.e. using strings for macro args). */ - while (len > 0 && isspace (operands[numexp].buf[len - 1])) + while (len > 0 && ISSPACE (operands[numexp].buf[len - 1])) operands[numexp].buf[--len] = 0; lptr = op_end; ++numexp; @@ -3348,7 +3349,7 @@ get_operands (operands, line) } } - while (*lptr && isspace (*lptr++)) + while (*lptr && ISSPACE (*lptr++)) ; if (!is_end_of_line[(int) *lptr]) { @@ -3501,12 +3502,12 @@ is_type (operand, type) case OP_DST: return is_accumulator (operand); case OP_B: - return is_accumulator (operand) && toupper (operand->buf[0]) == 'B'; + return is_accumulator (operand) && TOUPPER (operand->buf[0]) == 'B'; case OP_A: - return is_accumulator (operand) && toupper (operand->buf[0]) == 'A'; + return is_accumulator (operand) && TOUPPER (operand->buf[0]) == 'A'; case OP_ARX: return strncasecmp ("ar", operand->buf, 2) == 0 - && isdigit (operand->buf[2]); + && ISDIGIT (operand->buf[2]); case OP_SBIT: return hash_find (sbit_hash, operand->buf) != 0 || is_absolute (operand); case OP_CC: @@ -3736,7 +3737,7 @@ encode_indirect (insn, operand) if (insn->is_lkaddr) { /* lk addresses always go in the second insn word. */ - mod = ((toupper (operand->buf[1]) == 'A') ? 12 : + mod = ((TOUPPER (operand->buf[1]) == 'A') ? 12 : (operand->buf[1] == '(') ? 15 : (strchr (operand->buf, '%') != NULL) ? 14 : 13); arf = ((mod == 12) ? operand->buf[3] - '0' : @@ -3761,7 +3762,7 @@ encode_indirect (insn, operand) } else { - arf = (toupper (operand->buf[1]) == 'A' ? + arf = (TOUPPER (operand->buf[1]) == 'A' ? operand->buf[3] : operand->buf[4]) - '0'; if (operand->buf[1] == '+') @@ -3782,9 +3783,9 @@ encode_indirect (insn, operand) else mod = (operand->buf[4] == '-' ? 8 : 10);/* *ARx+% / *ARx-% */ } - else if (toupper (operand->buf[6]) == 'B') + else if (TOUPPER (operand->buf[6]) == 'B') mod = (operand->buf[4] == '-' ? 4 : 7); /* ARx+0B / *ARx-0B */ - else if (toupper (operand->buf[6]) == '%') + else if (TOUPPER (operand->buf[6]) == '%') mod = (operand->buf[4] == '-' ? 9 : 11); /* ARx+0% / *ARx - 0% */ else { @@ -4002,7 +4003,7 @@ encode_operand (insn, type, operand) /* 16-bit immediate value. */ return encode_dmad (insn, operand, 0); case OP_SRC: - if (toupper (*operand->buf) == 'B') + if (TOUPPER (*operand->buf) == 'B') { insn->opcode[ext ? (1 + insn->is_lkaddr) : 0].word |= (1 << 9); if (insn->using_default_dst) @@ -4011,7 +4012,7 @@ encode_operand (insn, type, operand) return 1; case OP_RND: /* Make sure this agrees with with the OP_DST operand. */ - if (!((toupper (operand->buf[0]) == 'B') ^ + if (!((TOUPPER (operand->buf[0]) == 'B') ^ ((insn->opcode[0].word & (1 << 8)) != 0))) { as_bad (_("Destination accumulator for each part of this parallel " @@ -4021,7 +4022,7 @@ encode_operand (insn, type, operand) return 1; case OP_SRC1: case OP_DST: - if (toupper (operand->buf[0]) == 'B') + if (TOUPPER (operand->buf[0]) == 'B') insn->opcode[ext ? (1 + insn->is_lkaddr) : 0].word |= (1 << 8); return 1; case OP_Xmem: @@ -4418,7 +4419,7 @@ next_line_shows_parallel (next_line) char *next_line; { /* Look for the second half. */ - while (isspace (*next_line)) + while (ISSPACE (*next_line)) ++next_line; return (next_line[0] == PARALLEL_SEPARATOR @@ -4505,11 +4506,11 @@ subsym_get_arg (char *line, char *termin char *ptr = line; char *endp; int is_string = *line == '"'; - int is_char = isdigit (*line); + int is_char = ISDIGIT (*line); if (is_char) { - while (isdigit (*ptr)) + while (ISDIGIT (*ptr)) ++ptr; endp = ptr; *str = xmalloc (ptr - line + 1); @@ -4728,7 +4729,7 @@ subsym_substitute (char *line, int force /* Check for local labels; replace them with the appropriate substitution. */ - if ((*name == '$' && isdigit (name[1]) && name[2] == '\0') + if ((*name == '$' && ISDIGIT (name[1]) && name[2] == '\0') || name[strlen (name) - 1] == '?') { /* Use an existing identifier for that label if, available, or @@ -4821,7 +4822,7 @@ subsym_substitute (char *line, int force } /* Character constants are converted to numerics by the preprocessor. */ - arg_type[1] = (isdigit (*ptr)) ? 2 : (*ptr == '"'); + arg_type[1] = (ISDIGIT (*ptr)) ? 2 : (*ptr == '"'); ptr = subsym_get_arg (ptr, ")", &arg2, ismember); } /* Args checking. */ @@ -5026,7 +5027,7 @@ tic54x_start_line_hook () comment = replacement + strlen (replacement) - 1; /* Trim trailing whitespace. */ - while (isspace (*comment)) + while (ISSPACE (*comment)) { comment[0] = endc; comment[1] = 0; @@ -5034,7 +5035,7 @@ tic54x_start_line_hook () } /* Compact leading whitespace. */ - while (isspace (tmp[0]) && isspace (tmp[1])) + while (ISSPACE (tmp[0]) && ISSPACE (tmp[1])) ++tmp; input_line_pointer = endp; @@ -5135,7 +5136,7 @@ md_assemble (line) otherwise let the assembler pick up the next line for us. */ if (tmp != NULL) { - while (isspace (tmp[2])) + while (ISSPACE (tmp[2])) ++tmp; md_assemble (tmp + 2); } @@ -5673,18 +5674,18 @@ tic54x_start_label (c, rest) if (is_end_of_line[(int) c]) return 1; - if (isspace (c)) - while (isspace (c = *++rest)) + if (ISSPACE (c)) + while (ISSPACE (c = *++rest)) ; if (c == '.') { /* Don't let colon () define a label for any of these... */ - return (strncasecmp (rest, ".tag", 4) != 0 || !isspace (rest[4])) - && (strncasecmp (rest, ".struct", 7) != 0 || !isspace (rest[7])) - && (strncasecmp (rest, ".union", 6) != 0 || !isspace (rest[6])) - && (strncasecmp (rest, ".macro", 6) != 0 || !isspace (rest[6])) - && (strncasecmp (rest, ".set", 4) != 0 || !isspace (rest[4])) - && (strncasecmp (rest, ".equ", 4) != 0 || !isspace (rest[4])); + return (strncasecmp (rest, ".tag", 4) != 0 || !ISSPACE (rest[4])) + && (strncasecmp (rest, ".struct", 7) != 0 || !ISSPACE (rest[7])) + && (strncasecmp (rest, ".union", 6) != 0 || !ISSPACE (rest[6])) + && (strncasecmp (rest, ".macro", 6) != 0 || !ISSPACE (rest[6])) + && (strncasecmp (rest, ".set", 4) != 0 || !ISSPACE (rest[4])) + && (strncasecmp (rest, ".equ", 4) != 0 || !ISSPACE (rest[4])); } return 1; diff -uprN binutils-2.11.90.0.31/gas/config/tc-tic80.c binutils-2.11.92.0.5/gas/config/tc-tic80.c --- binutils-2.11.90.0.31/gas/config/tc-tic80.c Thu Jul 26 18:02:55 2001 +++ binutils-2.11.92.0.5/gas/config/tc-tic80.c Mon Oct 1 15:25:22 2001 @@ -1,5 +1,5 @@ /* tc-tic80.c -- Assemble for the TI TMS320C80 (MV) - Copyright 1996, 1997, 2000 Free Software Foundation, Inc. + Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -19,6 +19,7 @@ 02111-1307, USA. */ #include "as.h" +#include "safe-ctype.h" #include "opcode/tic80.h" #define internal_error(what) \ @@ -784,12 +785,12 @@ md_assemble (str) assert (str); /* Drop any leading whitespace. */ - while (isspace (*str)) + while (ISSPACE (*str)) str++; /* Isolate the mnemonic from the rest of the string by finding the first whitespace character and zapping it to a null byte. */ - for (scan = str; *scan != '\000' && !isspace (*scan); scan++) + for (scan = str; *scan != '\000' && !ISSPACE (*scan); scan++) ; if (*scan != '\000') @@ -803,7 +804,7 @@ md_assemble (str) } str = scan; - while (isspace (*scan)) + while (ISSPACE (*scan)) scan++; input_line_save = input_line_pointer; diff -uprN binutils-2.11.90.0.31/gas/config/tc-v850.c binutils-2.11.92.0.5/gas/config/tc-v850.c --- binutils-2.11.90.0.31/gas/config/tc-v850.c Wed May 23 10:55:28 2001 +++ binutils-2.11.92.0.5/gas/config/tc-v850.c Mon Oct 1 15:25:22 2001 @@ -20,8 +20,8 @@ Boston, MA 02111-1307, USA. */ #include -#include #include "as.h" +#include "safe-ctype.h" #include "subsegs.h" #include "opcode/v850.h" #include "dwarf2dbg.h" @@ -858,7 +858,7 @@ system_register_name (expressionP, accep /* Reset input_line pointer. */ input_line_pointer = start; - if (isdigit (*input_line_pointer)) + if (ISDIGIT (*input_line_pointer)) { reg_number = strtol (input_line_pointer, &input_line_pointer, 10); @@ -1711,7 +1711,7 @@ md_assemble (str) strncpy (copy_of_instruction, str, sizeof (copy_of_instruction) - 1); /* Get the opcode. */ - for (s = str; *s != '\0' && ! isspace (*s); s++) + for (s = str; *s != '\0' && ! ISSPACE (*s); s++) continue; if (*s != '\0') @@ -1728,7 +1728,7 @@ md_assemble (str) } str = s; - while (isspace (*str)) + while (ISSPACE (*str)) ++str; start_of_operands = str; @@ -2141,7 +2141,7 @@ md_assemble (str) break; } - while (isspace (*str)) + while (ISSPACE (*str)) ++str; if (*str != '\0') diff -uprN binutils-2.11.90.0.31/gas/config/tc-vax.c binutils-2.11.92.0.5/gas/config/tc-vax.c --- binutils-2.11.90.0.31/gas/config/tc-vax.c Sat May 12 00:06:45 2001 +++ binutils-2.11.92.0.5/gas/config/tc-vax.c Mon Oct 1 15:25:22 2001 @@ -1965,7 +1965,7 @@ main () * */ -#include +#include "safe-ctype.h" #define AP (12) #define FP (13) #define SP (14) @@ -1979,14 +1979,12 @@ vax_reg_parse (c1, c2, c3) /* 3 chars of retval = -1; - if (isupper (c1)) - c1 = tolower (c1); - if (isupper (c2)) - c2 = tolower (c2); - if (isdigit (c2) && c1 == 'r') + c1 = TOLOWER (c1); + c2 = TOLOWER (c2); + if (ISDIGIT (c2) && c1 == 'r') { retval = c2 - '0'; - if (isdigit (c3)) + if (ISDIGIT (c3)) { retval = retval * 10 + c3 - '0'; retval = (retval > 15) ? -1 : retval; @@ -2332,8 +2330,7 @@ vip_op (optext, vopP) char c; c = *p; - if (isupper (c)) - c = tolower (c); + c = TOLOWER (c); if (DISPLENP (p[1]) && strchr ("bilws", len = c)) p += 2; /* skip (letter) '^' */ else /* no (letter) '^' seen */ diff -uprN binutils-2.11.90.0.31/gas/config/tc-w65.c binutils-2.11.92.0.5/gas/config/tc-w65.c --- binutils-2.11.90.0.31/gas/config/tc-w65.c Fri Apr 6 15:33:09 2001 +++ binutils-2.11.92.0.5/gas/config/tc-w65.c Mon Oct 1 15:25:22 2001 @@ -26,7 +26,6 @@ #include "subsegs.h" #define DEFINE_TABLE #include "../opcodes/w65-opc.h" -#include const char comment_chars[] = "!"; CONST char line_separator_chars[] = ";"; diff -uprN binutils-2.11.90.0.31/gas/config/tc-z8k.c binutils-2.11.92.0.5/gas/config/tc-z8k.c --- binutils-2.11.90.0.31/gas/config/tc-z8k.c Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/gas/config/tc-z8k.c Mon Oct 1 15:25:22 2001 @@ -1,5 +1,5 @@ /* tc-z8k.c -- Assemble code for the Zilog Z800n - Copyright 1992, 1993, 1994, 1995, 1996, 1998, 2000 + Copyright 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -28,7 +28,7 @@ #include "as.h" #include "bfd.h" -#include +#include "safe-ctype.h" const char comment_chars[] = "!"; const char line_comment_chars[] = "#"; @@ -70,9 +70,9 @@ int tohex (c) int c; { - if (isdigit (c)) + if (ISDIGIT (c)) return c - '0'; - if (islower (c)) + if (ISLOWER (c)) return c - 'a' + 10; return c - 'A' + 10; } @@ -221,7 +221,7 @@ whatreg (reg, src) int *reg; char *src; { - if (isdigit (src[1])) + if (ISDIGIT (src[1])) { *reg = (src[0] - '0') * 10 + src[1] - '0'; return src + 2; diff -uprN binutils-2.11.90.0.31/gas/configure binutils-2.11.92.0.5/gas/configure --- binutils-2.11.90.0.31/gas/configure Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/gas/configure Thu Oct 4 14:35:43 2001 @@ -2327,7 +2327,7 @@ for this_target in $target $canon_target arm-*-linux*aout*) fmt=aout em=linux ;; arm*-*-linux-gnu* | arm*-*-uclinux*) fmt=elf em=linux ;; - arm-*-netbsd*) fmt=aout em=nbsd ;; + arm-*-netbsd* | arm-*-openbsd*) fmt=aout em=nbsd ;; arm-*-oabi | thumb-*-oabi) fmt=elf ;; arm-epoc-pe | thumb-epoc-pe) fmt=coff em=epoc-pe ;; arm-*-wince) fmt=coff em=wince-pe ;; @@ -2489,7 +2489,7 @@ EOF mips-*-irix*) fmt=ecoff ;; mips-*-lnews*) fmt=ecoff em=lnews ;; mips-*-riscos*) fmt=ecoff ;; - mips-*-linux-gnu*) + mips*-*-linux*) fmt=elf em=tmips cat >> confdefs.h <<\EOF #define MIPS_STABS_ELF 1 @@ -2766,7 +2766,7 @@ EOF case ${generic_target}-${fmt} in mips-*-irix5*-*) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;; - mips-*-linux-gnu*-*) case "$endian" in + mips*-*-linux*-*) case "$endian" in big) emulation="mipsbelf mipslelf mipself" ;; *) emulation="mipslelf mipsbelf mipself" ;; esac ;; @@ -5247,7 +5247,7 @@ fi l= - if test -d $srcdir/po; then + if test -f $srcdir/po/POTFILES.in; then test -d po || mkdir po if test "x$srcdir" != "x."; then if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then diff -uprN binutils-2.11.90.0.31/gas/configure.in binutils-2.11.92.0.5/gas/configure.in --- binutils-2.11.90.0.31/gas/configure.in Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/gas/configure.in Mon Oct 1 15:25:22 2001 @@ -191,7 +191,7 @@ changequote([,])dnl arm-*-linux*aout*) fmt=aout em=linux ;; arm*-*-linux-gnu* | arm*-*-uclinux*) fmt=elf em=linux ;; - arm-*-netbsd*) fmt=aout em=nbsd ;; + arm-*-netbsd* | arm-*-openbsd*) fmt=aout em=nbsd ;; arm-*-oabi | thumb-*-oabi) fmt=elf ;; arm-epoc-pe | thumb-epoc-pe) fmt=coff em=epoc-pe ;; arm-*-wince) fmt=coff em=wince-pe ;; @@ -350,7 +350,7 @@ changequote([,])dnl mips-*-irix*) fmt=ecoff ;; mips-*-lnews*) fmt=ecoff em=lnews ;; mips-*-riscos*) fmt=ecoff ;; - mips-*-linux-gnu*) + mips*-*-linux*) fmt=elf em=tmips AC_DEFINE(MIPS_STABS_ELF, 1, [Use ELF stabs for MIPS, not ECOFF stabs]) @@ -610,7 +610,7 @@ changequote([,])dnl case ${generic_target}-${fmt} in mips-*-irix5*-*) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;; - mips-*-linux-gnu*-*) case "$endian" in + mips*-*-linux*-*) case "$endian" in big) emulation="mipsbelf mipslelf mipself" ;; *) emulation="mipslelf mipsbelf mipself" ;; esac ;; diff -uprN binutils-2.11.90.0.31/gas/doc/as.texinfo binutils-2.11.92.0.5/gas/doc/as.texinfo --- binutils-2.11.90.0.31/gas/doc/as.texinfo Sat Jul 14 10:29:15 2001 +++ binutils-2.11.92.0.5/gas/doc/as.texinfo Fri Oct 5 14:11:21 2001 @@ -1395,7 +1395,7 @@ On the HPPA local labels begin with @sam @end ifset @node listing -@section Configuringh listing output: @code{--listing} +@section Configuring listing output: @code{--listing} The listing feature of the assembler can be enabled via the command line switch @samp{-a} (@pxref{a}). This feature combines the input source file(s) with a @@ -2907,26 +2907,45 @@ in a program. @cindex temporary symbol names @cindex symbol names, temporary Local symbols help compilers and programmers use names temporarily. -There are ten local symbol names, which are re-used throughout the -program. You may refer to them using the names @samp{0} @samp{1} -@dots{} @samp{9}. To define a local symbol, write a label of the form -@samp{@b{N}:} (where @b{N} represents any digit). To refer to the most -recent previous definition of that symbol write @samp{@b{N}b}, using the -same digit as when you defined the label. To refer to the next -definition of a local label, write @samp{@b{N}f}---where @b{N} gives you -a choice of 10 forward references. The @samp{b} stands for -``backwards'' and the @samp{f} stands for ``forwards''. - -Local symbols are not emitted by the current @sc{gnu} C compiler. - -There is no restriction on how you can use these labels, but -remember that at any point in the assembly you can refer to at most -10 prior local labels and to at most 10 forward local labels. - -Local symbol names are only a notation device. They are immediately -transformed into more conventional symbol names before the assembler -uses them. The symbol names stored in the symbol table, appearing in -error messages and optionally emitted to the object file have these +They create symbols which are guaranteed to be unique over the entire scope of +the input source code and which can be referred to by a simple notation. +To define a local symbol, write a label of the form @samp{@b{N}:} (where @b{N} +represents any positive integer). To refer to the most recent previous +definition of that symbol write @samp{@b{N}b}, using the same number as when +you defined the label. To refer to the next definition of a local label, write +@samp{@b{N}f}--- The @samp{b} stands for``backwards'' and the @samp{f} stands +for ``forwards''. + +There is no restriction on how you can use these labels, and you can reuse them +too. So that it is possible to repeatedly define the same local label (using +the same number @samp{@b{N}}), although you can only refer to the most recently +defined local label of that number (for a backwards reference) or the next +definition of a specific local label for a forward reference. It is also worth +noting that the first 10 local labels (@samp{@b{0:}}@dots{}@samp{@b{9:}}) are +implemented in a slightly more efficient manner than the others. + +Here is an example: + +@smallexample +1: branch 1f +2: branch 1b +1: branch 2f +2: branch 1b +@end smallexample + +Which is the equivalent of: + +@smallexample +label_1: branch label_3 +label_2: branch label_1 +label_3: branch label_4 +label_4: branch label_3 +@end smallexample + +Local symbol names are only a notational device. They are immediately +transformed into more conventional symbol names before the assembler uses them. +The symbol names stored in the symbol table, appearing in error messages and +optionally emitted to the object file. The names are constructed using these parts: @table @code @@ -2938,25 +2957,42 @@ used for symbols you are never intended object file. If you also instruct @code{@value{LD}} to retain these symbols, you may use them in debugging. -@item @var{digit} -If the label is written @samp{0:} then the digit is @samp{0}. -If the label is written @samp{1:} then the digit is @samp{1}. -And so on up through @samp{9:}. - -@item @kbd{C-A} -This unusual character is included so you do not accidentally invent -a symbol of the same name. The character has ASCII value -@samp{\001}. +@item @var{number} +This is the number that was used in the local label definition. So if the +label is written @samp{55:} then the number is @samp{55}. + +@item @kbd{C-B} +This unusual character is included so you do not accidentally invent a symbol +of the same name. The character has ASCII value of @samp{\002} (control-B). @item @emph{ordinal number} -This is a serial number to keep the labels distinct. The first -@samp{0:} gets the number @samp{1}; The 15th @samp{0:} gets the -number @samp{15}; @emph{etc.}. Likewise for the other labels @samp{1:} -through @samp{9:}. +This is a serial number to keep the labels distinct. The first definition of +@samp{0:} gets the number @samp{1}. The 15th definition of @samp{0:} gets the +number @samp{15}, and so on. Likewise the first definition of @samp{1:} gets +the number @samp{1} and its 15th defintion gets @samp{15} as well. @end table -For instance, the first @code{1:} is named @code{L1@kbd{C-A}1}, the 44th -@code{3:} is named @code{L3@kbd{C-A}44}. +So for example, the first @code{1:} is named @code{L1@kbd{C-B}1}, the 44th +@code{3:} is named @code{L3@kbd{C-B}44}. + +@subheading Dollar Local Labels +@cindex dollar local symbols + +@code{@value{AS}} also supports an even more local form of local labels called +dollar labels. These labels go out of scope (ie they become undefined) as soon +as a non-local label is defined. Thus they remain valid for only a small +region of the input source code. Normal local labels, by contrast, remain in +scope for the entire file, or until they are redefined by another occurrence of +the same local label. + +Dollar labels are defined in exactly the same way as ordinary local labels, +except that instead of being terminated by a colon, they are terminated by a +dollar sign. eg @samp{@b{55$}}. + +They can also be distinguished from ordinary local labels by their transformed +name which uses ASCII character @samp{\001} (control-A) as the magic character +to distinguish them from ordinary labels. Thus the 5th defintion of @samp{6$} +is named @samp{L6@kbd{C-A}5}. @node Dot @section The Special Dot Symbol @@ -4860,7 +4896,7 @@ This is one of the ELF section stack man For ELF targets, the @code{.section} directive is used like this: @smallexample -.section @var{name} [, "@var{flags}"[, @@@var{type}]] +.section @var{name} [, "@var{flags}"[, @@@var{type}[, @@@var{entsize}]]] @end smallexample The optional @var{flags} argument is a quoted string which may contain any @@ -4872,6 +4908,10 @@ section is allocatable section is writable @item x section is executable +@item M +section is mergeable +@item S +section contains zero terminated strings @end table The optional @var{type} argument may contain one of the following constants: @@ -4882,6 +4922,13 @@ section contains data section does not contain data (i.e., section only occupies space) @end table +If @var{flags} contains @code{M} flag, @var{type} argument must be specified +as well as @var{entsize} argument. Sections with @code{M} flag but not +@code{S} flag must contain fixed size constants, each @var{entsize} octets +long. Sections with both @code{M} and @code{S} must contain zero terminated +strings where each character is @var{entsize} bytes long. The linker may remove +duplicates within sections with the same name, same entity size and same flags. + If no flags are specified, the default flags depend upon the section name. If the section name is not recognized, the default will be for the section to have none of the above flags: it will not be allocated in memory, nor writable, nor diff -uprN binutils-2.11.90.0.31/gas/dwarf2dbg.c binutils-2.11.92.0.5/gas/dwarf2dbg.c --- binutils-2.11.90.0.31/gas/dwarf2dbg.c Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/gas/dwarf2dbg.c Mon Oct 1 15:25:22 2001 @@ -345,7 +345,7 @@ dwarf2_directive_file (dummy) return; } - if (num < files_in_use && files[num].filename != 0) + if (num < (int) files_in_use && files[num].filename != 0) { as_bad (_("file number %ld already allocated"), (long) num); return; diff -uprN binutils-2.11.90.0.31/gas/ecoff.c binutils-2.11.92.0.5/gas/ecoff.c --- binutils-2.11.90.0.31/gas/ecoff.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/gas/ecoff.c Mon Oct 1 15:25:22 2001 @@ -37,7 +37,7 @@ #include "coff/symconst.h" #include "aout/stab_gnu.h" -#include +#include "safe-ctype.h" /* Why isn't this in coff/sym.h? */ #define ST_RFDESCAPE 0xfff @@ -3101,7 +3101,7 @@ ecoff_directive_ent (ignore) ++input_line_pointer; SKIP_WHITESPACE (); } - if (isdigit ((unsigned char) *input_line_pointer) + if (ISDIGIT (*input_line_pointer) || *input_line_pointer == '-') (void) get_absolute_expression (); @@ -3546,7 +3546,7 @@ ecoff_stab (sec, what, string, type, oth listing_source_file (string); #endif - if (isdigit ((unsigned char) *input_line_pointer) + if (ISDIGIT (*input_line_pointer) || *input_line_pointer == '-' || *input_line_pointer == '+') { diff -uprN binutils-2.11.90.0.31/gas/expr.c binutils-2.11.92.0.5/gas/expr.c --- binutils-2.11.90.0.31/gas/expr.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/gas/expr.c Mon Oct 1 15:25:22 2001 @@ -25,11 +25,11 @@ (It also gives smaller files to re-compile.) Here, "operand"s are of expressions, not instructions. */ -#include #include #define min(a, b) ((a) < (b) ? (a) : (b)) #include "as.h" +#include "safe-ctype.h" #include "obstack.h" static void floating_constant PARAMS ((expressionS * expressionP)); @@ -331,9 +331,7 @@ integer_constant (radix, expressionP) /* In MRI mode, the number may have a suffix indicating the radix. For that matter, it might actually be a floating point constant. */ - for (suffix = input_line_pointer; - isalnum ((unsigned char) *suffix); - suffix++) + for (suffix = input_line_pointer; ISALNUM (*suffix); suffix++) { if (*suffix == 'e' || *suffix == 'E') flt = 1; @@ -347,8 +345,7 @@ integer_constant (radix, expressionP) else { c = *--suffix; - if (islower ((unsigned char) c)) - c = toupper (c); + c = TOUPPER (c); if (c == 'B') radix = 2; else if (c == 'D') @@ -862,8 +859,7 @@ operand (expressionP) { input_line_pointer++; floating_constant (expressionP); - expressionP->X_add_number = - - (isupper ((unsigned char) c) ? tolower (c) : c); + expressionP->X_add_number = - TOLOWER (c); } else { @@ -985,8 +981,7 @@ operand (expressionP) case 'G': input_line_pointer++; floating_constant (expressionP); - expressionP->X_add_number = - - (isupper ((unsigned char) c) ? tolower (c) : c); + expressionP->X_add_number = - TOLOWER (c); break; case '$': @@ -1699,21 +1694,6 @@ expr (rankarg, resultP) } } - if (retval == undefined_section) - { - if (SEG_NORMAL (rightseg)) - retval = rightseg; - } - else if (! SEG_NORMAL (retval)) - retval = rightseg; - else if (SEG_NORMAL (rightseg) - && retval != rightseg -#ifdef DIFF_EXPR_OK - && op_left != O_subtract -#endif - ) - as_bad (_("operation combines symbols in different segments")); - op_right = operator (&op_chars); know (op_right == O_illegal @@ -1769,8 +1749,7 @@ expr (rankarg, resultP) && resultP->X_op == O_symbol && (symbol_get_frag (right.X_add_symbol) == symbol_get_frag (resultP->X_add_symbol)) - && SEG_NORMAL (S_GET_SEGMENT (right.X_add_symbol))) - + && SEG_NORMAL (rightseg)) { resultP->X_add_number -= right.X_add_number; resultP->X_add_number += (S_GET_VALUE (resultP->X_add_symbol) @@ -1865,7 +1844,14 @@ expr (rankarg, resultP) if (op_left == O_add) resultP->X_add_number += right.X_add_number; else if (op_left == O_subtract) - resultP->X_add_number -= right.X_add_number; + { + resultP->X_add_number -= right.X_add_number; + if (retval == rightseg && SEG_NORMAL (retval)) + { + retval = absolute_section; + rightseg = absolute_section; + } + } } else { @@ -1877,6 +1863,21 @@ expr (rankarg, resultP) resultP->X_unsigned = 1; } + if (retval != rightseg) + { + if (! SEG_NORMAL (retval)) + { + if (retval != undefined_section || SEG_NORMAL (rightseg)) + retval = rightseg; + } + else if (SEG_NORMAL (rightseg) +#ifdef DIFF_EXPR_OK + && op_left != O_subtract +#endif + ) + as_bad (_("operation combines symbols in different segments")); + } + op_left = op_right; } /* While next operator is >= this rank. */ diff -uprN binutils-2.11.90.0.31/gas/gasp.c binutils-2.11.92.0.5/gas/gasp.c --- binutils-2.11.90.0.31/gas/gasp.c Fri Mar 9 11:38:13 2001 +++ binutils-2.11.92.0.5/gas/gasp.c Mon Oct 1 15:25:22 2001 @@ -1,5 +1,5 @@ /* gasp.c - Gnu assembler preprocessor main program. - Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000 + Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Written by Steve and Judy Chamberlain of Cygnus Support, @@ -51,7 +51,6 @@ suitable for gas to consume. #include #include #include -#include #ifdef HAVE_STDLIB_H #include @@ -63,6 +62,7 @@ extern char *malloc (); #include "ansidecl.h" #include "libiberty.h" +#include "safe-ctype.h" #include "sb.h" #include "macro.h" #include "asintl.h" @@ -539,7 +539,7 @@ sb_strtol (idx, string, base, ptr) { int ch = string->ptr[idx]; int dig = 0; - if (isdigit (ch)) + if (ISDIGIT (ch)) dig = ch - '0'; else if (ch >= 'a' && ch <= 'f') dig = ch - 'a' + 10; @@ -574,7 +574,7 @@ level_0 (idx, string, lhs) lhs->value = 0; - if (isdigit ((unsigned char) string->ptr[idx])) + if (ISDIGIT (string->ptr[idx])) { idx = sb_strtol (idx, string, 10, &lhs->value); } @@ -1132,7 +1132,7 @@ change_base (idx, in, out) idx++; } } - else if (isdigit ((unsigned char) in->ptr[idx])) + else if (ISDIGIT (in->ptr[idx])) { int value; /* All numbers must start with a digit, let's chew it and @@ -1676,7 +1676,7 @@ doinstr (idx, in, out) idx = sb_skip_comma (idx, in); idx = get_and_process (idx, in, &search); idx = sb_skip_comma (idx, in); - if (isdigit ((unsigned char) in->ptr[idx])) + if (ISDIGIT (in->ptr[idx])) { idx = exp_get_abs (_(".instr needs absolute expresson.\n"), idx, in, &start); } @@ -1776,26 +1776,26 @@ process_assigns (idx, in, buf) } else if (idx + 3 < in->len && in->ptr[idx] == '.' - && toupper ((unsigned char) in->ptr[idx + 1]) == 'L' - && toupper ((unsigned char) in->ptr[idx + 2]) == 'E' - && toupper ((unsigned char) in->ptr[idx + 3]) == 'N') + && TOUPPER (in->ptr[idx + 1]) == 'L' + && TOUPPER (in->ptr[idx + 2]) == 'E' + && TOUPPER (in->ptr[idx + 3]) == 'N') idx = dolen (idx + 4, in, buf); else if (idx + 6 < in->len && in->ptr[idx] == '.' - && toupper ((unsigned char) in->ptr[idx + 1]) == 'I' - && toupper ((unsigned char) in->ptr[idx + 2]) == 'N' - && toupper ((unsigned char) in->ptr[idx + 3]) == 'S' - && toupper ((unsigned char) in->ptr[idx + 4]) == 'T' - && toupper ((unsigned char) in->ptr[idx + 5]) == 'R') + && TOUPPER (in->ptr[idx + 1]) == 'I' + && TOUPPER (in->ptr[idx + 2]) == 'N' + && TOUPPER (in->ptr[idx + 3]) == 'S' + && TOUPPER (in->ptr[idx + 4]) == 'T' + && TOUPPER (in->ptr[idx + 5]) == 'R') idx = doinstr (idx + 6, in, buf); else if (idx + 7 < in->len && in->ptr[idx] == '.' - && toupper ((unsigned char) in->ptr[idx + 1]) == 'S' - && toupper ((unsigned char) in->ptr[idx + 2]) == 'U' - && toupper ((unsigned char) in->ptr[idx + 3]) == 'B' - && toupper ((unsigned char) in->ptr[idx + 4]) == 'S' - && toupper ((unsigned char) in->ptr[idx + 5]) == 'T' - && toupper ((unsigned char) in->ptr[idx + 6]) == 'R') + && TOUPPER (in->ptr[idx + 1]) == 'S' + && TOUPPER (in->ptr[idx + 2]) == 'U' + && TOUPPER (in->ptr[idx + 3]) == 'B' + && TOUPPER (in->ptr[idx + 4]) == 'S' + && TOUPPER (in->ptr[idx + 5]) == 'T' + && TOUPPER (in->ptr[idx + 6]) == 'R') idx = dosubstr (idx + 7, in, buf); else if (ISFIRSTCHAR (in->ptr[idx])) { @@ -2130,8 +2130,8 @@ whatcond (idx, in, val) char a, b; p = in->ptr + idx; - a = toupper ((unsigned char) p[0]); - b = toupper ((unsigned char) p[1]); + a = TOUPPER (p[0]); + b = TOUPPER (p[1]); if (a == 'E' && b == 'Q') cond = EQ; else if (a == 'N' && b == 'E') @@ -2980,13 +2980,13 @@ chartype_init () int x; for (x = 0; x < 256; x++) { - if (isalpha (x) || x == '_' || x == '$') + if (ISALPHA (x) || x == '_' || x == '$') chartype[x] |= FIRSTBIT; if (mri && x == '.') chartype[x] |= FIRSTBIT; - if (isdigit (x) || isalpha (x) || x == '_' || x == '$') + if (ISDIGIT (x) || ISALPHA (x) || x == '_' || x == '$') chartype[x] |= NEXTBIT; if (x == ' ' || x == '\t' || x == ',' || x == '"' || x == ';' @@ -3552,6 +3552,9 @@ main (argc, argv) #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) setlocale (LC_MESSAGES, ""); #endif +#if defined (HAVE_SETLOCALE) + setlocale (LC_CTYPE, ""); +#endif bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); diff -uprN binutils-2.11.90.0.31/gas/hash.c binutils-2.11.92.0.5/gas/hash.c --- binutils-2.11.90.0.31/gas/hash.c Fri Mar 9 11:16:42 2001 +++ binutils-2.11.92.0.5/gas/hash.c Mon Oct 1 15:25:22 2001 @@ -1,6 +1,6 @@ /* hash.c -- gas hash table code Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, - 2000 + 2000, 2001 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -30,6 +30,7 @@ structure. */ #include "as.h" +#include "safe-ctype.h" #include "obstack.h" /* The default number of entries to use when creating a hash table. */ @@ -458,8 +459,7 @@ main () printf ("hash_test command: "); gets (answer); command = answer[0]; - if (isupper (command)) - command = tolower (command); /* Ecch! */ + command = TOLOWER (command); /* Ecch! */ switch (command) { case '#': diff -uprN binutils-2.11.90.0.31/gas/input-file.c binutils-2.11.92.0.5/gas/input-file.c --- binutils-2.11.90.0.31/gas/input-file.c Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/gas/input-file.c Mon Oct 1 15:25:22 2001 @@ -157,19 +157,29 @@ input_file_open (filename, pre) /* Begins with comment, may not want to preprocess. */ c = getc (f_in); if (c == 'N') - { - fgets (buf, 80, f_in); - if (!strcmp (buf, "O_APP\n")) - preprocess = 0; - if (!strchr (buf, '\n')) - ungetc ('#', f_in); /* It was longer. */ - else - ungetc ('\n', f_in); - } + { + fgets (buf, 80, f_in); + if (!strncmp (buf, "O_APP", 5) && isspace (buf[5])) + preprocess = 0; + if (!strchr (buf, '\n')) + ungetc ('#', f_in); /* It was longer. */ + else + ungetc ('\n', f_in); + } + else if (c == 'A') + { + fgets (buf, 80, f_in); + if (!strncmp (buf, "PP", 2) && isspace (buf[2])) + preprocess = 1; + if (!strchr (buf, '\n')) + ungetc ('#', f_in); + else + ungetc ('\n', f_in); + } else if (c == '\n') - ungetc ('\n', f_in); + ungetc ('\n', f_in); else - ungetc ('#', f_in); + ungetc ('#', f_in); } else ungetc (c, f_in); diff -uprN binutils-2.11.90.0.31/gas/itbl-lex.l binutils-2.11.92.0.5/gas/itbl-lex.l --- binutils-2.11.90.0.31/gas/itbl-lex.l Fri Mar 9 11:16:42 2001 +++ binutils-2.11.92.0.5/gas/itbl-lex.l Mon Oct 1 15:25:22 2001 @@ -1,5 +1,5 @@ /* itbl-lex.l - Copyright 1997, 1998 Free Software Foundation, Inc. + Copyright 1997, 1998, 2001 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -22,7 +22,6 @@ #include #include #include -#include #include "itbl-parse.h" #ifdef DEBUG diff -uprN binutils-2.11.90.0.31/gas/listing.c binutils-2.11.92.0.5/gas/listing.c --- binutils-2.11.90.0.31/gas/listing.c Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/gas/listing.c Mon Oct 1 15:25:22 2001 @@ -91,10 +91,9 @@ Software Foundation, 59 Temple Place - S on a line */ -#include - #include "as.h" #include +#include "safe-ctype.h" #include "input-file.h" #include "subsegs.h" @@ -370,7 +369,7 @@ listing_newline (ps) unsigned char c = *src++; /* Omit control characters in the listing. */ - if (isascii (c) && ! iscntrl (c)) + if (!ISCNTRL (c)) *dest++ = c; } @@ -514,9 +513,12 @@ buffer_line (file, line, size) if (c == EOF) { file->at_end = 1; - *p++ = '.'; - *p++ = '.'; - *p++ = '.'; + if (count + 2 < size) + { + *p++ = '.'; + *p++ = '.'; + *p++ = '.'; + } } file->linenum++; *p++ = 0; @@ -908,7 +910,7 @@ debugging_pseudo (list, line) was_debug = in_debug; in_debug = 0; - while (isspace ((unsigned char) *line)) + while (ISSPACE (*line)) line++; if (*line != '.') diff -uprN binutils-2.11.90.0.31/gas/macro.c binutils-2.11.92.0.5/gas/macro.c --- binutils-2.11.90.0.31/gas/macro.c Fri Aug 10 14:08:01 2001 +++ binutils-2.11.92.0.5/gas/macro.c Mon Oct 1 15:25:22 2001 @@ -1,5 +1,5 @@ /* macro.c - macro support for gas and gasp - Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000 + Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Written by Steve and Judy Chamberlain of Cygnus Support, @@ -51,11 +51,11 @@ extern void *alloca (); #else #include #endif -#include #ifdef HAVE_STDLIB_H #include #endif #include "libiberty.h" +#include "safe-ctype.h" #include "sb.h" #include "hash.h" #include "macro.h" @@ -183,7 +183,7 @@ buffer_and_nest (from, to, ptr, get_line /* Skip over a label. */ while (i < ptr->len - && (isalnum ((unsigned char) ptr->ptr[i]) + && (ISALNUM (ptr->ptr[i]) || ptr->ptr[i] == '_' || ptr->ptr[i] == '$')) i++; @@ -206,11 +206,11 @@ buffer_and_nest (from, to, ptr, get_line i++; if (strncasecmp (ptr->ptr + i, from, from_len) == 0 && (ptr->len == (i + from_len) - || ! isalnum (ptr->ptr[i + from_len]))) + || ! ISALNUM (ptr->ptr[i + from_len]))) depth++; if (strncasecmp (ptr->ptr + i, to, to_len) == 0 && (ptr->len == (i + to_len) - || ! isalnum (ptr->ptr[i + to_len]))) + || ! ISALNUM (ptr->ptr[i + to_len]))) { depth--; if (depth == 0) @@ -241,13 +241,13 @@ get_token (idx, in, name) sb *name; { if (idx < in->len - && (isalpha ((unsigned char) in->ptr[idx]) + && (ISALPHA (in->ptr[idx]) || in->ptr[idx] == '_' || in->ptr[idx] == '$')) { sb_add_char (name, in->ptr[idx++]); while (idx < in->len - && (isalnum ((unsigned char) in->ptr[idx]) + && (ISALNUM (in->ptr[idx]) || in->ptr[idx] == '_' || in->ptr[idx] == '$')) { @@ -567,8 +567,7 @@ define_macro (idx, in, label, get_line, /* And stick it in the macro hash table. */ for (idx = 0; idx < name.len; idx++) - if (isupper ((unsigned char) name.ptr[idx])) - name.ptr[idx] = tolower (name.ptr[idx]); + name.ptr[idx] = TOLOWER (name.ptr[idx]); namestr = sb_terminate (&name); hash_jam (macro_hash, namestr, (PTR) macro); @@ -726,15 +725,14 @@ macro_expand_body (in, out, formals, for sb_add_char (out, '&'); src++; } - else if (macro_mri - && isalnum ((unsigned char) in->ptr[src])) + else if (macro_mri && ISALNUM (in->ptr[src])) { int ind; formal_entry *f; - if (isdigit ((unsigned char) in->ptr[src])) + if (ISDIGIT (in->ptr[src])) ind = in->ptr[src] - '0'; - else if (isupper ((unsigned char) in->ptr[src])) + else if (ISUPPER (in->ptr[src])) ind = in->ptr[src] - 'A' + 10; else ind = in->ptr[src] - 'a' + 10; @@ -758,7 +756,7 @@ macro_expand_body (in, out, formals, for } } else if ((macro_alternate || macro_mri) - && (isalpha ((unsigned char) in->ptr[src]) + && (ISALPHA (in->ptr[src]) || in->ptr[src] == '_' || in->ptr[src] == '$') && (! inquote @@ -1107,14 +1105,14 @@ check_macro (line, expand, comment_char, macro_entry *macro; sb line_sb; - if (! isalpha ((unsigned char) *line) + if (! ISALPHA (*line) && *line != '_' && *line != '$' && (! macro_mri || *line != '.')) return 0; s = line + 1; - while (isalnum ((unsigned char) *s) + while (ISALNUM (*s) || *s == '_' || *s == '$') ++s; @@ -1123,8 +1121,7 @@ check_macro (line, expand, comment_char, memcpy (copy, line, s - line); copy[s - line] = '\0'; for (cs = copy; *cs != '\0'; cs++) - if (isupper ((unsigned char) *cs)) - *cs = tolower (*cs); + *cs = TOLOWER (*cs); macro = (macro_entry *) hash_find (macro_hash, copy); diff -uprN binutils-2.11.90.0.31/gas/po/POTFILES.in binutils-2.11.92.0.5/gas/po/POTFILES.in --- binutils-2.11.90.0.31/gas/po/POTFILES.in Tue Jun 19 11:57:57 2001 +++ binutils-2.11.92.0.5/gas/po/POTFILES.in Thu Oct 4 14:35:43 2001 @@ -132,18 +132,18 @@ ecoff.c ecoff.h ehopt.c ehopt.c -emul.h emul-target.h +emul.h expr.c expr.c expr.h flonum-copy.c flonum-copy.c -flonum.h flonum-konst.c flonum-konst.c flonum-mult.c flonum-mult.c +flonum.h frags.c frags.c frags.h diff -uprN binutils-2.11.90.0.31/gas/read.c binutils-2.11.92.0.5/gas/read.c --- binutils-2.11.90.0.31/gas/read.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/gas/read.c Fri Oct 5 14:11:21 2001 @@ -35,10 +35,8 @@ Software Foundation, 59 Temple Place - S /* Routines that read assembler source text to build spagetti in memory. Another group of these functions is in the expr.c module. */ -/* For isdigit (). */ -#include - #include "as.h" +#include "safe-ctype.h" #include "subsegs.h" #include "sb.h" #include "macro.h" @@ -739,8 +737,7 @@ read_a_source_file (name) while (*s2) { - if (isupper ((unsigned char) *s2)) - *s2 = tolower (*s2); + *s2 = TOLOWER (*s2); s2++; } } @@ -907,8 +904,7 @@ read_a_source_file (name) if (is_end_of_line[(unsigned char) c]) continue; - if ((LOCAL_LABELS_DOLLAR || LOCAL_LABELS_FB) - && isdigit ((unsigned char) c)) + if ((LOCAL_LABELS_DOLLAR || LOCAL_LABELS_FB) && ISDIGIT (c)) { /* local label ("4:") */ char *backup = input_line_pointer; @@ -918,7 +914,7 @@ read_a_source_file (name) temp = c - '0'; /* Read the whole number. */ - while (isdigit ((unsigned char) *input_line_pointer)) + while (ISDIGIT (*input_line_pointer)) { temp = (temp * 10) + *input_line_pointer - '0'; ++input_line_pointer; @@ -1166,6 +1162,19 @@ do_align (n, fill, len, max) int len; int max; { + if (now_seg == absolute_section) + { + if (fill != NULL) + while (len-- > 0) + if (*fill++ != '\0') + { + as_warn (_("ignoring fill value in absolute section")); + break; + } + fill = NULL; + len = 0; + } + #ifdef md_do_align md_do_align (n, fill, len, max, just_record_alignment); #endif @@ -1453,7 +1462,7 @@ s_mri_common (small) SKIP_WHITESPACE (); name = input_line_pointer; - if (!isdigit ((unsigned char) *name)) + if (!ISDIGIT (*name)) c = get_symbol_end (); else { @@ -1461,7 +1470,7 @@ s_mri_common (small) { ++input_line_pointer; } - while (isdigit ((unsigned char) *input_line_pointer)); + while (ISDIGIT (*input_line_pointer)); c = *input_line_pointer; *input_line_pointer = '\0'; @@ -2488,7 +2497,7 @@ s_mri_sect (type) SKIP_WHITESPACE (); name = input_line_pointer; - if (!isdigit ((unsigned char) *name)) + if (!ISDIGIT (*name)) c = get_symbol_end (); else { @@ -2496,7 +2505,7 @@ s_mri_sect (type) { ++input_line_pointer; } - while (isdigit ((unsigned char) *input_line_pointer)); + while (ISDIGIT (*input_line_pointer)); c = *input_line_pointer; *input_line_pointer = '\0'; @@ -2521,7 +2530,7 @@ s_mri_sect (type) if (*input_line_pointer == ',') { c = *++input_line_pointer; - c = toupper ((unsigned char) c); + c = TOUPPER (c); if (c == 'C' || c == 'D' || c == 'M' || c == 'R') *type = c; else @@ -3044,7 +3053,7 @@ s_float_space (float_type) /* Skip any 0{letter} that may be present. Don't even check if the * letter is legal. */ if (input_line_pointer[0] == '0' - && isalpha ((unsigned char) input_line_pointer[1])) + && ISALPHA (input_line_pointer[1])) input_line_pointer += 2; /* Accept :xxxx, where the x's are hex digits, for a floating point @@ -3141,7 +3150,7 @@ ignore_rest_of_line () /* For suspect lines: gives warning. */ if (!is_end_of_line[(unsigned char) *input_line_pointer]) { - if (isprint ((unsigned char) *input_line_pointer)) + if (ISPRINT (*input_line_pointer)) as_warn (_("rest of line ignored; first ignored character is `%c'"), *input_line_pointer); else @@ -4130,7 +4139,7 @@ float_cons (float_type) has no use for such information. Lusers beware: you get diagnostics if your input is ill-conditioned. */ if (input_line_pointer[0] == '0' - && isalpha ((unsigned char) input_line_pointer[1])) + && ISALPHA (input_line_pointer[1])) input_line_pointer += 2; /* Accept :xxxx, where the x's are hex digits, for a floating @@ -4668,7 +4677,7 @@ next_char_of_string () int i; for (i = 0, number = 0; - isdigit (c) && i < 3; + ISDIGIT (c) && i < 3; c = *input_line_pointer++, i++) { number = number * 8 + c - '0'; @@ -4686,11 +4695,11 @@ next_char_of_string () number = 0; c = *input_line_pointer++; - while (isxdigit (c)) + while (ISXDIGIT (c)) { - if (isdigit (c)) + if (ISDIGIT (c)) number = number * 16 + c - '0'; - else if (isupper (c)) + else if (ISUPPER (c)) number = number * 16 + c - 'A' + 10; else number = number * 16 + c - 'a' + 10; diff -uprN binutils-2.11.90.0.31/gas/subsegs.c binutils-2.11.92.0.5/gas/subsegs.c --- binutils-2.11.90.0.31/gas/subsegs.c Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/gas/subsegs.c Fri Oct 5 14:11:21 2001 @@ -587,7 +587,7 @@ subseg_text_p (sec) #else /* ! BFD_ASSEMBLER */ const char * const *p; - if (sec == data_section || sec == bss_section) + if (sec == data_section || sec == bss_section || sec == absolute_section) return 0; for (p = nontext_section_names; *p != NULL; ++p) diff -uprN binutils-2.11.90.0.31/gas/symbols.c binutils-2.11.92.0.5/gas/symbols.c --- binutils-2.11.90.0.31/gas/symbols.c Fri Aug 10 14:08:01 2001 +++ binutils-2.11.92.0.5/gas/symbols.c Mon Oct 1 15:25:22 2001 @@ -22,10 +22,9 @@ /* #define DEBUG_SYMS / * to debug symbol list maintenance. */ -#include - #include "as.h" +#include "safe-ctype.h" #include "obstack.h" /* For "symbols.h" */ #include "subsegs.h" @@ -124,11 +123,10 @@ save_symbol_name (name) if (! symbols_case_sensitive) { - unsigned char *s; + char *s; - for (s = (unsigned char *) ret; *s != '\0'; s++) - if (islower (*s)) - *s = toupper (*s); + for (s = ret; *s != '\0'; s++) + *s = TOUPPER (*s); } return ret; @@ -630,9 +628,7 @@ symbol_find_base (name, strip_underscore while ((c = *orig++) != '\0') { - if (islower (c)) - c = toupper (c); - *copy++ = c; + *copy++ = TOUPPER (c); } *copy = '\0'; } @@ -914,13 +910,16 @@ resolve_symbol_value (symp) case O_symbol: case O_symbol_rva: left = resolve_symbol_value (add_symbol); - do_symbol: + seg_left = S_GET_SEGMENT (add_symbol); + if (finalize_syms) + symp->sy_value.X_op_symbol = NULL; + do_symbol: if (symp->sy_mri_common) { /* This is a symbol inside an MRI common section. The - relocation routines are going to handle it specially. - Don't change the value. */ + relocation routines are going to handle it specially. + Don't change the value. */ resolved = symbol_resolved_p (add_symbol); break; } @@ -933,31 +932,51 @@ resolve_symbol_value (symp) copy_symbol_attributes (symp, add_symbol); } - /* If we have equated this symbol to an undefined symbol, we - keep X_op set to O_symbol, and we don't change - X_add_number. This permits the routine which writes out - relocation to detect this case, and convert the - relocation to be against the symbol to which this symbol - is equated. */ + /* If we have equated this symbol to an undefined or common + symbol, keep X_op set to O_symbol, and don't change + X_add_number. This permits the routine which writes out + relocation to detect this case, and convert the + relocation to be against the symbol to which this symbol + is equated. */ if (! S_IS_DEFINED (add_symbol) || S_IS_COMMON (add_symbol)) { if (finalize_syms) { - final_seg = S_GET_SEGMENT (add_symbol); symp->sy_value.X_op = O_symbol; symp->sy_value.X_add_symbol = add_symbol; symp->sy_value.X_add_number = final_val; + /* Use X_op_symbol as a flag. */ + symp->sy_value.X_op_symbol = add_symbol; + final_seg = seg_left; } final_val = 0; resolved = symbol_resolved_p (add_symbol); symp->sy_resolving = 0; goto exit_dont_set_value; } + else if (finalize_syms && final_seg == expr_section + && seg_left != expr_section) + { + /* If the symbol is an expression symbol, do similarly + as for undefined and common syms above. Handles + "sym +/- expr" where "expr" cannot be evaluated + immediately, and we want relocations to be against + "sym", eg. because it is weak. */ + symp->sy_value.X_op = O_symbol; + symp->sy_value.X_add_symbol = add_symbol; + symp->sy_value.X_add_number = final_val; + symp->sy_value.X_op_symbol = add_symbol; + final_seg = seg_left; + final_val += symp->sy_frag->fr_address + left; + resolved = symbol_resolved_p (add_symbol); + symp->sy_resolving = 0; + goto exit_dont_set_value; + } else { final_val += symp->sy_frag->fr_address + left; if (final_seg == expr_section || final_seg == undefined_section) - final_seg = S_GET_SEGMENT (add_symbol); + final_seg = seg_left; } resolved = symbol_resolved_p (add_symbol); @@ -1008,42 +1027,49 @@ resolve_symbol_value (symp) /* Simplify addition or subtraction of a constant by folding the constant into X_add_number. */ - if (op == O_add || op == O_subtract) + if (op == O_add) { if (seg_right == absolute_section) { - if (op == O_add) - final_val += right; - else - final_val -= right; - op = O_symbol; - op_symbol = NULL; + final_val += right; goto do_symbol; } - else if (seg_left == absolute_section && op == O_add) + else if (seg_left == absolute_section) { - op = O_symbol; final_val += left; add_symbol = op_symbol; left = right; - op_symbol = NULL; + seg_left = seg_right; goto do_symbol; } } + else if (op == O_subtract) + { + if (seg_right == absolute_section) + { + final_val -= right; + goto do_symbol; + } + } + + /* Equality and non-equality tests are permitted on anything. + Subtraction, and other comparison operators are permitted if + both operands are in the same section. Otherwise, both + operands must be absolute. We already handled the case of + addition or subtraction of a constant above. This will + probably need to be changed for an object file format which + supports arbitrary expressions, such as IEEE-695. - /* Subtraction is permitted if both operands are in the same - section. Otherwise, both operands must be absolute. We - already handled the case of addition or subtraction of a - constant above. This will probably need to be changed - for an object file format which supports arbitrary - expressions, such as IEEE-695. */ - /* Don't emit messages unless we're finalizing the symbol value, + Don't emit messages unless we're finalizing the symbol value, otherwise we may get the same message multiple times. */ - if ((seg_left != absolute_section - || seg_right != absolute_section) - && (op != O_subtract + if (op != O_eq && op != O_ne + && (seg_left != absolute_section + || seg_right != absolute_section) + && ((op != O_subtract + && op != O_lt && op != O_le && op != O_ge && op != O_gt) || seg_left != seg_right - || seg_left == undefined_section) + || (seg_left == undefined_section + && add_symbol != op_symbol)) && finalize_syms) { char *file; @@ -1085,7 +1111,7 @@ resolve_symbol_value (symp) if ((op == O_divide || op == O_modulus) && right == 0) { /* If seg_right is not absolute_section, then we've - already issued a warning about using a bad symbol. */ + already issued a warning about using a bad symbol. */ if (seg_right == absolute_section && finalize_syms) { char *file; @@ -1114,8 +1140,15 @@ resolve_symbol_value (symp) case O_bit_and: left &= right; break; case O_add: left += right; break; case O_subtract: left -= right; break; - case O_eq: left = left == right ? ~ (offsetT) 0 : 0; break; - case O_ne: left = left != right ? ~ (offsetT) 0 : 0; break; + case O_eq: + case O_ne: + left = (left == right && seg_left == seg_right + && (seg_left != undefined_section + || add_symbol == op_symbol) + ? ~ (offsetT) 0 : 0); + if (symp->sy_value.X_op == O_ne) + left = ~left; + break; case O_lt: left = left < right ? ~ (offsetT) 0 : 0; break; case O_le: left = left <= right ? ~ (offsetT) 0 : 0; break; case O_ge: left = left >= right ? ~ (offsetT) 0 : 0; break; @@ -1547,7 +1580,7 @@ decode_local_label_name (s) if (s[index] != 'L') return s; - for (label_number = 0, p = s + index + 1; isdigit ((unsigned char) *p); ++p) + for (label_number = 0, p = s + index + 1; ISDIGIT (*p); ++p) label_number = (10 * label_number) + *p - '0'; if (*p == DOLLAR_LABEL_CHAR) @@ -1557,7 +1590,7 @@ decode_local_label_name (s) else return s; - for (instance_number = 0, p++; isdigit ((unsigned char) *p); ++p) + for (instance_number = 0, p++; ISDIGIT (*p); ++p) instance_number = (10 * instance_number) + *p - '0'; message_format = _("\"%d\" (instance number %d of a %s label)"); @@ -2146,6 +2179,24 @@ symbol_equated_p (s) return s->sy_value.X_op == O_symbol; } +/* Return whether a symbol is equated to another symbol, and should be + treated specially when writing out relocs. */ + +int +symbol_equated_reloc_p (s) + symbolS *s; +{ + if (LOCAL_SYMBOL_CHECK (s)) + return 0; + /* X_op_symbol, normally not used for O_symbol, is set by + resolve_symbol_value to flag expression syms that have been + equated. */ + return (s->sy_value.X_op == O_symbol + && ((s->sy_resolved && s->sy_value.X_op_symbol != NULL) + || ! S_IS_DEFINED (s) + || S_IS_COMMON (s))); +} + /* Return whether a symbol has a constant value. */ int diff -uprN binutils-2.11.90.0.31/gas/symbols.h binutils-2.11.92.0.5/gas/symbols.h --- binutils-2.11.90.0.31/gas/symbols.h Wed May 23 11:36:05 2001 +++ binutils-2.11.92.0.5/gas/symbols.h Mon Oct 1 15:25:22 2001 @@ -185,6 +185,7 @@ extern void symbol_mark_resolved PARAMS extern int symbol_resolved_p PARAMS ((symbolS *)); extern int symbol_section_p PARAMS ((symbolS *)); extern int symbol_equated_p PARAMS ((symbolS *)); +extern int symbol_equated_reloc_p PARAMS ((symbolS *)); extern int symbol_constant_p PARAMS ((symbolS *)); #ifdef BFD_ASSEMBLER diff -uprN binutils-2.11.90.0.31/gas/testsuite/ChangeLog binutils-2.11.92.0.5/gas/testsuite/ChangeLog --- binutils-2.11.90.0.31/gas/testsuite/ChangeLog Thu Aug 30 14:58:40 2001 +++ binutils-2.11.92.0.5/gas/testsuite/ChangeLog Thu Oct 4 14:35:43 2001 @@ -1,3 +1,104 @@ +2001-10-04 Thiemo Seufer + + * gas/mips/mips-gp64-fp32-pic.d: Use 32bit instructions for addresses. + * gas/mips/mips-gp64-fp32-pic.s: Likewise. + * gas/mips/mips-gp64-fp32.d: Likewise. + * gas/mips/mips-gp64-fp32.s: Likewise. + * gas/mips/mips-gp64-fp64-pic.d: Likewise. + * gas/mips/mips-gp64-fp64-pic.s: Likewise. + * gas/mips/mips-gp64-fp64.d: Likewise. + * gas/mips/mips-gp64-fp64.s: Likewise. + * gas/mips/elempic.d: Likewise. + * gas/mips/ld.d: Likewise. + * gas/mips/uld.d: Likewise. + * gas/mips/usd.d: Likewise. + +2001-09-29 H.J. Lu + + * gas/i386/i386.exp: Run 64bit tests only for "i*86-*-* and + x86_64-*-*. + +2001-09-18 Martin Schwidefsky + + * gas/s390: New directory. + * gas/s390/opcode.d: New file. + * gas/s390/opcode.s: New file. + * gas/s390/opcode64.d: New file. + * gas/s390/opcode64.s: New file. + * gas/s390/operands.d: New file. + * gas/s390/operands.s: New file. + * gas/s390/operands64.d: New file. + * gas/s390/operands64.s: New file. + * gas/s390/reloc.d: New file. + * gas/s390/reloc.s: New file. + * gas/s390/reloc64.d: New file. + * gas/s390/reloc64.s: New file. + * gas/s390/s390.exp: New file. + +2001-09-07 Eric Christopher + + * gas/mips/mips64.d: Change to use isa64. + * gas/mips/mips32.d: Change to use isa32. + +2001-09-07 Thiemo Seufer + + * gas/mips/mips-abi32-pic.s: Remove .set mips4 pseudo-op. + * gas/mips/mips-abi32.s: Likewise. + * gas/mips/mips-gp32-fp32-pic.s: Likewise. + * gas/mips/mips-gp32-fp32.s: Likewise. + * gas/mips/mips-gp32-fp64-pic.s: Likewise. + * gas/mips/mips-gp32-fp64.s: Likewise. + * gas/mips/mips-gp64-fp32-pic.s: Likewise. + * gas/mips/mips-gp64-fp32.s: Likewise. + * gas/mips/mips-gp64-fp64-pic.s: Likewise. + * gas/mips/mips-gp64-fp64.s: Likewise. + +2001-09-07 Thiemo Seufer + + * gas/mips/beq.d: Check branches to external labels. + * gas/mips/beq.s: Likewise. + * gas/mips/bge.d: Likewise. + * gas/mips/bge.s: Likewise. + * gas/mips/bgeu.d: Likewise. + * gas/mips/bgeu.s: Likewise. + * gas/mips/blt.d: Likewise. + * gas/mips/blt.s: Likewise. + * gas/mips/bltu.d: Likewise. + * gas/mips/bltu.s: Likewise. + * gas/mips/elempic.d: Switch from R_MIPS_GNU_REL16_S2 to R_MIPS_PC16. + * gas/mips/empic.d: Likewise. + * gas/mips/empic.s: Likewise. + * gas/mips/telempic.d: Likewise. + * gas/mips/tempic.d: Likewise. + +2001-09-06 Thiemo Seufer + + * gas/mips/tmips16-f.d: New file, testcase for big endian MIPS16 + relocations, tradtional variant. + +2001-08-04 Richard Henderson + + * gas/alpha/alpha.exp: New file. + * gas/alpha/elf-reloc-1.[sd]: New test. + * gas/alpha/elf-reloc-2.[sl]: New test. + * gas/alpha/elf-reloc-3.[sl]: New test. + * gas/alpha/elf-reloc-4.[sd]: New test. + * gas/alpha/fp.exp: Remove file. + * gas/alpha/fp.s: Output to .data not .rdata. + * gas/alpha/fp.d: Adjust to match. + +Tue Sep 4 20:06:09 2001 Jeffrey A Law (law@cygnus.com) + + * gas/all/gas.exp (930509a): Expect failure on the H8/300 ELF port. + + * gas/h8300/ffxx1-elf.d: Update due to recent changes to H8/300 + ELF toolchain. + * gas/h8300/h8300-elf.exp: Likewise. + + * gas/macros/macros.exp: Expect failure on all H8/300 ports. + + * gas/vtable/vtable.exp: Do not run tests on H8/300 ELF ports. + Thu Aug 30 21:58:48 2001 J"orn Rennecke * gas/h8300/h8300.exp (do_h8300_cbranch): Remove invocation. @@ -108,7 +209,7 @@ Wed Aug 29 12:05:13 2001 J"orn Rennecke * gas/mips/mips-gp32-fp32-pic.d: Likewise. * gas/mips/mips-gp32-fp64-pic.d: Likewise. * gas/mips/mips-abi32-pic.d: Likewise. - + 2001-07-21 Thiemo Seufer * mips/lb.d: Reflect disassembler output fixes. @@ -159,7 +260,7 @@ Wed Aug 29 12:05:13 2001 J"orn Rennecke * gas/mips/mips-gp64-fp64-pic.s: Likewise. 2001-08-03 Richard Sandiford - + * gas/mips/elf-rel4.s, gas/mips/elf-rel4.d: New test. * gas/mips/e32-rel4.s, gas/mips/e32-rel4.s: New test. diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/all/gas.exp binutils-2.11.92.0.5/gas/testsuite/gas/all/gas.exp --- binutils-2.11.90.0.31/gas/testsuite/gas/all/gas.exp Sat Jul 14 10:29:15 2001 +++ binutils-2.11.92.0.5/gas/testsuite/gas/all/gas.exp Mon Oct 1 15:25:25 2001 @@ -95,6 +95,7 @@ if { ![istarget hppa*-*-*] && ![istarget setup_xfail "vax*-*-vms*" setup_xfail "mn10300*-*-*" setup_xfail "mn10200*-*-*" + setup_xfail "h8300*-*-elf*" do_930509a } diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/alpha/alpha.exp binutils-2.11.92.0.5/gas/testsuite/gas/alpha/alpha.exp --- binutils-2.11.90.0.31/gas/testsuite/gas/alpha/alpha.exp Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/gas/testsuite/gas/alpha/alpha.exp Mon Oct 1 15:25:25 2001 @@ -0,0 +1,33 @@ +# +# Some generic alpha tests +# + +proc run_list_test { name opts } { + global srcdir subdir + set testname "alpha $name" + set file $srcdir/$subdir/$name + gas_run ${name}.s $opts ">&dump.out" + if { [regexp_diff "dump.out" "${file}.l"] } then { + fail $testname + verbose "output is [file_contents "dump.out"]" 2 + return + } + pass $testname +} + +if { [istarget alpha*-*-*] } then { + + set elf [expr [istarget *-*-elf*] \ + || [istarget *-*-linux*] \ + || [istarget *-*-freebsd*] \ + || [istarget *-*-netbsd*] ] + + if $elf { + run_dump_test "elf-reloc-1" + run_list_test "elf-reloc-2" "" + run_list_test "elf-reloc-3" "" + run_dump_test "elf-reloc-4" + } + + run_dump_test "fp" +} diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/alpha/elf-reloc-1.d binutils-2.11.92.0.5/gas/testsuite/gas/alpha/elf-reloc-1.d --- binutils-2.11.90.0.31/gas/testsuite/gas/alpha/elf-reloc-1.d Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/gas/testsuite/gas/alpha/elf-reloc-1.d Mon Oct 1 15:25:25 2001 @@ -0,0 +1,21 @@ +#objdump: -r +#name: alpha elf-reloc-1 + +.*: file format elf64-alpha + +RELOCATION RECORDS FOR \[\.text\]: +OFFSET TYPE VALUE +0*0000004 ELF_LITERAL a +0*0000000 LITUSE \.text\+0x0*0000002 +0*000000c LITUSE \.text\+0x0*0000001 +0*0000008 ELF_LITERAL b +0*0000010 ELF_LITERAL f +0*0000014 LITUSE \.text\+0x0*0000003 +0*0000014 HINT f +0*0000018 GPREL16 c +0*000001c GPRELHIGH d +0*0000020 GPRELLOW e +0*0000024 GPDISP \.text\+0x0*0000008 +0*0000030 GPDISP \.text\+0xf*ffffff8 + + diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/alpha/elf-reloc-1.s binutils-2.11.92.0.5/gas/testsuite/gas/alpha/elf-reloc-1.s --- binutils-2.11.90.0.31/gas/testsuite/gas/alpha/elf-reloc-1.s Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/gas/testsuite/gas/alpha/elf-reloc-1.s Mon Oct 1 15:25:25 2001 @@ -0,0 +1,16 @@ + .set nomacro + extbl $3, $2, $3 ! lituse_bytoff ! 1 + ldq $2, a($29) !literal!1 + ldq $4, b($29) !literal!2 + ldq_u $3, 0($2) !lituse_base!1 + ldq $27, f($29) !literal!5 + jsr $26, ($27), f !lituse_jsr!5 + + lda $0, c($29) !gprel + ldah $1, d($29) !gprelhigh + lda $1, e($1) !gprellow + + ldah $29, 0($26) !gpdisp!3 + lda $29, 0($29) !gpdisp!4 + lda $29, 0($29) !gpdisp!3 + ldah $29, 0($26) !gpdisp!4 diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/alpha/elf-reloc-2.l binutils-2.11.92.0.5/gas/testsuite/gas/alpha/elf-reloc-2.l --- binutils-2.11.90.0.31/gas/testsuite/gas/alpha/elf-reloc-2.l Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/gas/testsuite/gas/alpha/elf-reloc-2.l Mon Oct 1 15:25:25 2001 @@ -0,0 +1,4 @@ +.*: Assembler messages: +.*:4: Error: too many ldah insns for !gpdisp!3 +.*:5: Error: too many lda insns for !gpdisp!3 +.*:8: Error: both insns for !gpdisp!4 must be in the same section diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/alpha/elf-reloc-2.s binutils-2.11.92.0.5/gas/testsuite/gas/alpha/elf-reloc-2.s --- binutils-2.11.90.0.31/gas/testsuite/gas/alpha/elf-reloc-2.s Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/gas/testsuite/gas/alpha/elf-reloc-2.s Mon Oct 1 15:25:25 2001 @@ -0,0 +1,8 @@ + .text + ldah $29,0($26) !gpdisp!3 + lda $29,0($26) !gpdisp!3 + ldah $29,0($26) !gpdisp!3 + lda $29,0($26) !gpdisp!3 + ldah $29,0($26) !gpdisp!4 + .section .text2 + lda $29,0($26) !gpdisp!4 diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/alpha/elf-reloc-3.l binutils-2.11.92.0.5/gas/testsuite/gas/alpha/elf-reloc-3.l --- binutils-2.11.90.0.31/gas/testsuite/gas/alpha/elf-reloc-3.l Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/gas/testsuite/gas/alpha/elf-reloc-3.l Mon Oct 1 15:25:25 2001 @@ -0,0 +1,3 @@ +.*: Assembler messages: +.*:2: Error: No ldah !gpdisp!2 was found +.*:1: Error: No lda !gpdisp!1 was found diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/alpha/elf-reloc-3.s binutils-2.11.92.0.5/gas/testsuite/gas/alpha/elf-reloc-3.s --- binutils-2.11.90.0.31/gas/testsuite/gas/alpha/elf-reloc-3.s Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/gas/testsuite/gas/alpha/elf-reloc-3.s Mon Oct 1 15:25:25 2001 @@ -0,0 +1,2 @@ + ldah $29,0($26) !gpdisp!1 + lda $29,0($26) !gpdisp!2 diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/alpha/elf-reloc-4.d binutils-2.11.92.0.5/gas/testsuite/gas/alpha/elf-reloc-4.d --- binutils-2.11.90.0.31/gas/testsuite/gas/alpha/elf-reloc-4.d Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/gas/testsuite/gas/alpha/elf-reloc-4.d Mon Oct 1 15:25:25 2001 @@ -0,0 +1,25 @@ +#objdump: -r +#name: alpha elf-reloc-4 + +.*: file format elf64-alpha + +RELOCATION RECORDS FOR \[\.text\]: +OFFSET TYPE VALUE +0*0000000 ELF_LITERAL a +0*0000004 LITUSE \.text\+0x0*0000001 +0*0000008 LITUSE \.text\+0x0*0000002 +0*000000c ELF_LITERAL b +0*0000010 LITUSE \.text\+0x0*0000001 +0*0000014 LITUSE \.text\+0x0*0000002 +0*0000018 ELF_LITERAL c +0*000001c LITUSE \.text\+0x0*0000001 +0*0000020 LITUSE \.text\+0x0*0000002 +0*0000024 LITUSE \.text\+0x0*0000002 +0*000002c LITUSE \.text\+0x0*0000001 +0*0000030 ELF_LITERAL d +0*0000034 LITUSE \.text\+0x0*0000001 +0*0000038 LITUSE \.text\+0x0*0000002 +0*000003c LITUSE \.text\+0x0*0000002 +0*0000044 LITUSE \.text\+0x0*0000001 + + diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/alpha/elf-reloc-4.s binutils-2.11.92.0.5/gas/testsuite/gas/alpha/elf-reloc-4.s --- binutils-2.11.90.0.31/gas/testsuite/gas/alpha/elf-reloc-4.s Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/gas/testsuite/gas/alpha/elf-reloc-4.s Mon Oct 1 15:25:25 2001 @@ -0,0 +1,4 @@ + ldbu $1, a + ldwu $2, b + stb $3, c + stw $4, d diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/alpha/fp.d binutils-2.11.92.0.5/gas/testsuite/gas/alpha/fp.d --- binutils-2.11.90.0.31/gas/testsuite/gas/alpha/fp.d Thu Jun 3 11:02:02 1999 +++ binutils-2.11.92.0.5/gas/testsuite/gas/alpha/fp.d Mon Oct 1 15:25:25 2001 @@ -1,7 +1,9 @@ +#objdump: -s -j .data +#name: alpha fp -.*: file format ecoff-littlealpha +.*: file format .* -Contents of section .rdata: +Contents of section .data: 0000 71a37909 4f930a40 5441789a cd4b881b q.y.O..@TAx..K.. 0010 2a404f93 790971a3 789a5440 5441789a .@O.y.q.x.T@TAx. 0020 00000000 00000000 00000000 00000000 ................ diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/alpha/fp.exp binutils-2.11.92.0.5/gas/testsuite/gas/alpha/fp.exp --- binutils-2.11.90.0.31/gas/testsuite/gas/alpha/fp.exp Thu Jun 3 11:02:02 1999 +++ binutils-2.11.92.0.5/gas/testsuite/gas/alpha/fp.exp Wed Dec 31 16:00:00 1969 @@ -1,15 +0,0 @@ -# -# Alpha OSF/1 tests -# - -if [istarget alpha-*-osf*] then { - set testname "fp constants (part 2)" - if [gas_test_old "fp.s" "" "fp constants (part 1)"] then { - objdump "-s -j .rdata > a.dump" - if { [regexp_diff "a.dump" "$srcdir/$subdir/fp.d"] == 0 } then { - pass $testname - } else { - fail $testname - } - } -} diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/alpha/fp.s binutils-2.11.92.0.5/gas/testsuite/gas/alpha/fp.s --- binutils-2.11.90.0.31/gas/testsuite/gas/alpha/fp.s Thu Jun 3 11:02:02 1999 +++ binutils-2.11.92.0.5/gas/testsuite/gas/alpha/fp.s Mon Oct 1 15:25:25 2001 @@ -1,4 +1,4 @@ - .rdata + .data # These three formats are 8 bytes each. .t_floating 3.32192809488736218171e0 # .byte 0x71, 0xa3, 0x79, 0x09, 0x4f, 0x93, 0x0a, 0x40 diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/h8300/ffxx1-elf.d binutils-2.11.92.0.5/gas/testsuite/gas/h8300/ffxx1-elf.d --- binutils-2.11.90.0.31/gas/testsuite/gas/h8300/ffxx1-elf.d Thu Aug 30 14:58:40 2001 +++ binutils-2.11.92.0.5/gas/testsuite/gas/h8300/ffxx1-elf.d Mon Oct 1 15:25:25 2001 @@ -6,9 +6,8 @@ .*: file format .*h8300.* Disassembly of section .text: -0+0000 04 00 orc #0x0,ccr - 0: R_H8_DIR16 .text[+]0x400 ... + 0: R_H8_DIR16 main 0+0400
f8 7f mov.b #0x7f,r0l 0+0402 28 bb mov.b @0xbb:8,r0l 0+0404 6a 88 ff b9 mov.b r0l,@0xffb9:16 @@ -16,7 +15,9 @@ Disassembly of section .text: 0+040a 6a 88 ff bb mov.b r0l,@0xffbb:16 0+040e 79 01 00 00 mov.w #0x0,r1 0+0412 0b 01 adds #0x1,er1 -0+0414 46 fc bne .-4 \(412\) +0+0414 46 00 bne .0 \(416\) + 415: R_H8_PCREL8 deloop 0+0416 12 88 rotl r0l -0+0418 40 f0 bra .-16 \(40a\) +0+0418 40 00 bra .0 \(41a\) + 419: R_H8_PCREL8 loop ... diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/h8300/h8300-elf.exp binutils-2.11.92.0.5/gas/testsuite/gas/h8300/h8300-elf.exp --- binutils-2.11.90.0.31/gas/testsuite/gas/h8300/h8300-elf.exp Thu Aug 30 14:58:40 2001 +++ binutils-2.11.92.0.5/gas/testsuite/gas/h8300/h8300-elf.exp Mon Oct 1 15:25:25 2001 @@ -11,26 +11,26 @@ proc do_h8300_cbranch {} { # assembled correctly. while 1 { expect { - -re " +\[0-9\]+ 0000 40FE\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0002 40FC\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0004 41FA\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0006 41F8\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0008 42F6\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 000a 43F4\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 000c 44F2\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 000e 44F0\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0010 45EE\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0012 45EC\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0014 46EA\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0016 47E8\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0018 48E6\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 001a 49E4\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 001c 4AE2\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 001e 4BE0\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0020 4CDE\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0022 4DDC\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0024 4EDA\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0026 4FD8\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0000 4000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 4000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 4100\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 4100\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 4200\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000a 4300\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 4400\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000e 4400\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 4500\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0012 4500\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0014 4600\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0016 4700\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0018 4800\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001a 4900\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001c 4A00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001e 4B00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0020 4C00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0022 4D00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0024 4E00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0026 4F00\[^\n\]*\n" { set x [expr $x+1] } timeout { perror "timeout\n; break } eof { break } } @@ -54,7 +54,7 @@ proc do_h8300_branch {} { # assembled correctly. while 1 { expect { - -re " +\[0-9\]+ 0000 55FE\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0000 5500\[^\n\]*\n" { set x [expr $x+1] } -re " +\[0-9\]+ 0002 5A000000\[^\n\]*\n" { set x [expr $x+1] } -re " +\[0-9\]+ 0006 5900\[^\n\]*\n" { set x [expr $x+1] } -re " +\[0-9\]+ 0008 5B00\[^\n\]*\n" { set x [expr $x+1] } @@ -84,46 +84,46 @@ proc do_h8300h_cbranch {} { # assembled correctly. while 1 { expect { - -re " +\[0-9\]+ 0000 40FE\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0002 40FC\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0004 41FA\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0006 41F8\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0008 42F6\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 000a 43F4\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 000c 44F2\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 000e 44F0\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0010 45EE\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0012 45EC\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0014 46EA\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0016 47E8\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0018 48E6\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 001a 49E4\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 001c 4AE2\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 001e 4BE0\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0020 4CDE\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0022 4DDC\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0024 4EDA\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0026 4FD8\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0028 5800FFD4\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 002c 5800FFD0\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0030 5810FFCC\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0034 5810FFC8\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0038 5820FFC4\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 003c 5830FFC0\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0040 5840FFBC\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0044 5840FFB8\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0048 5850FFB4\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 004c 5850FFB0\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0050 5860FFAC\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0054 5870FFA8\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0058 5880FFA4\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 005c 5890FFA0\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0060 58A0FF9C\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0064 58B0FF98\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0068 58C0FF94\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 006c 58D0FF90\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0070 58E0FF8C\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0074 58F0FF88\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0000 4000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 4000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 4100\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 4100\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 4200\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000a 4300\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 4400\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000e 4400\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 4500\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0012 4500\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0014 4600\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0016 4700\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0018 4800\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001a 4900\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001c 4A00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001e 4B00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0020 4C00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0022 4D00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0024 4E00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0026 4F00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0028 58000000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 002c 58000000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0030 58100000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0034 58100000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0038 58200000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 003c 58300000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0040 58400000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0044 58400000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0048 58500000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 004c 58500000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0050 58600000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0054 58700000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0058 58800000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 005c 58900000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0060 58A00000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0064 58B00000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0068 58C00000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 006c 58D00000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0070 58E00000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0074 58F00000\[^\n\]*\n" { set x [expr $x+1] } timeout { perror "timeout\n; break } eof { break } } @@ -147,14 +147,14 @@ proc do_h8300h_branch {} { # assembled correctly. while 1 { expect { - -re " +\[0-9\]+ 0000 55FE\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0002 5C00FFFA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0000 5500\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 5C000000\[^\n\]*\n" { set x [expr $x+1] } -re " +\[0-9\]+ 0006 5A000000\[^\n\]*\n" { set x [expr $x+1] } -re " +\[0-9\]+ 000a 5900\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 000c 5B10\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 5B00\[^\n\]*\n" { set x [expr $x+1] } -re " +\[0-9\]+ 000e 5E000000\[^\n\]*\n" { set x [expr $x+1] } -re " +\[0-9\]+ 0012 5D00\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0014 5F10\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0014 5F00\[^\n\]*\n" { set x [expr $x+1] } timeout { perror "timeout\n; break } eof { break } } @@ -178,46 +178,46 @@ proc do_h8300s_cbranch {} { # assembled correctly. while 1 { expect { - -re " +\[0-9\]+ 0000 40FE\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0002 40FC\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0004 41FA\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0006 41F8\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0008 42F6\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 000a 43F4\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 000c 44F2\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 000e 44F0\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0010 45EE\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0012 45EC\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0014 46EA\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0016 47E8\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0018 48E6\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 001a 49E4\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 001c 4AE2\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 001e 4BE0\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0020 4CDE\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0022 4DDC\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0024 4EDA\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0026 4FD8\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0028 5800FFD4\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 002c 5800FFD0\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0030 5810FFCC\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0034 5810FFC8\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0038 5820FFC4\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 003c 5830FFC0\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0040 5840FFBC\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0044 5840FFB8\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0048 5850FFB4\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 004c 5850FFB0\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0050 5860FFAC\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0054 5870FFA8\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0058 5880FFA4\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 005c 5890FFA0\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0060 58A0FF9C\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0064 58B0FF98\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0068 58C0FF94\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 006c 58D0FF90\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0070 58E0FF8C\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0074 58F0FF88\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0000 4000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 4000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0004 4100\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0006 4100\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0008 4200\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000a 4300\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 4400\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000e 4400\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0010 4500\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0012 4500\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0014 4600\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0016 4700\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0018 4800\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001a 4900\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001c 4A00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 001e 4B00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0020 4C00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0022 4D00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0024 4E00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0026 4F00\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0028 58000000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 002c 58000000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0030 58100000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0034 58100000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0038 58200000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 003c 58300000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0040 58400000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0044 58400000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0048 58500000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 004c 58500000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0050 58600000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0054 58700000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0058 58800000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 005c 58900000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0060 58A00000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0064 58B00000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0068 58C00000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 006c 58D00000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0070 58E00000\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0074 58F00000\[^\n\]*\n" { set x [expr $x+1] } timeout { perror "timeout\n; break } eof { break } } @@ -241,14 +241,14 @@ proc do_h8300s_branch {} { # assembled correctly. while 1 { expect { - -re " +\[0-9\]+ 0000 55FE\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0002 5C00FFFA\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0000 5500\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0002 5C000000\[^\n\]*\n" { set x [expr $x+1] } -re " +\[0-9\]+ 0006 5A000000\[^\n\]*\n" { set x [expr $x+1] } -re " +\[0-9\]+ 000a 5900\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 000c 5B10\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 000c 5B00\[^\n\]*\n" { set x [expr $x+1] } -re " +\[0-9\]+ 000e 5E000000\[^\n\]*\n" { set x [expr $x+1] } -re " +\[0-9\]+ 0012 5D00\[^\n\]*\n" { set x [expr $x+1] } - -re " +\[0-9\]+ 0014 5F10\[^\n\]*\n" { set x [expr $x+1] } + -re " +\[0-9\]+ 0014 5F00\[^\n\]*\n" { set x [expr $x+1] } timeout { perror "timeout\n; break } eof { break } } diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/i386/i386.exp binutils-2.11.92.0.5/gas/testsuite/gas/i386/i386.exp --- binutils-2.11.90.0.31/gas/testsuite/gas/i386/i386.exp Thu Mar 29 17:49:26 2001 +++ binutils-2.11.92.0.5/gas/testsuite/gas/i386/i386.exp Mon Oct 1 15:25:25 2001 @@ -80,7 +80,7 @@ if [expr ([istarget "i*86-*-*"] || [ist set ASFLAGS "$old_ASFLAGS" } -if [gas_64_check] then { +if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check]] then { global ASFLAGS set old_ASFLAGS "$ASFLAGS" diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/macros/macros.exp binutils-2.11.92.0.5/gas/testsuite/gas/macros/macros.exp --- binutils-2.11.90.0.31/gas/testsuite/gas/macros/macros.exp Mon Aug 27 11:44:52 2001 +++ binutils-2.11.92.0.5/gas/testsuite/gas/macros/macros.exp Mon Oct 1 15:25:25 2001 @@ -32,5 +32,6 @@ if { ![istarget hppa*-*-*] || [istarget setup_xfail powerpc-*-aix* setup_xfail sh*-*-* setup_xfail z8k*-*-* + setup_xfail h8300*-*-* run_dump_test strings } diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/mips/beq.d binutils-2.11.92.0.5/gas/testsuite/gas/mips/beq.d --- binutils-2.11.90.0.31/gas/testsuite/gas/mips/beq.d Mon May 21 10:36:59 2001 +++ binutils-2.11.92.0.5/gas/testsuite/gas/mips/beq.d Mon Oct 1 15:25:25 2001 @@ -37,4 +37,10 @@ Disassembly of section .text: 0+2006c <[^>]*> nop 0+20070 <[^>]*> jal 0+0000 [ ]*20070: (MIPS_JMP|JMPADDR|R_MIPS_26) .text +0+20074 <[^>]*> nop +0+20078 <[^>]*> b 0+20078 +[ ]*20078: R_MIPS_PC16 external_label +0+2007c <[^>]*> nop +0+20080 <[^>]*> bal 0+20080 +[ ]*20080: R_MIPS_PC16 external_label ... diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/mips/beq.s binutils-2.11.92.0.5/gas/testsuite/gas/mips/beq.s --- binutils-2.11.90.0.31/gas/testsuite/gas/mips/beq.s Thu Jun 3 11:02:03 1999 +++ binutils-2.11.92.0.5/gas/testsuite/gas/mips/beq.s Mon Oct 1 15:25:25 2001 @@ -22,7 +22,9 @@ text_label: b text_label bal text_label +# Branch to an external label. + b external_label + bal external_label + # Round to a 16 byte boundary, for ease in testing multiple targets. nop - nop - nop diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/mips/bge.d binutils-2.11.92.0.5/gas/testsuite/gas/mips/bge.d --- binutils-2.11.90.0.31/gas/testsuite/gas/mips/bge.d Mon May 21 10:36:59 2001 +++ binutils-2.11.92.0.5/gas/testsuite/gas/mips/bge.d Mon Oct 1 15:25:25 2001 @@ -50,4 +50,20 @@ Disassembly of section .text: 0+00a4 <[^>]*> nop 0+00a8 <[^>]*> slt at,a1,a0 0+00ac <[^>]*> bnezl at,0+0000 +0+00b0 <[^>]*> nop +0+00b4 <[^>]*> slt at,a0,a1 +0+00b8 <[^>]*> beqz at,000000b8 +[ ]*b8: R_MIPS_PC16 external_label +0+00bc <[^>]*> nop +0+00c0 <[^>]*> slt at,a1,a0 +0+00c4 <[^>]*> bnez at,000000c4 +[ ]*c4: R_MIPS_PC16 external_label +0+00c8 <[^>]*> nop +0+00cc <[^>]*> slt at,a0,a1 +0+00d0 <[^>]*> beqzl at,000000d0 +[ ]*d0: R_MIPS_PC16 external_label +0+00d4 <[^>]*> nop +0+00d8 <[^>]*> slt at,a1,a0 +0+00dc <[^>]*> bnezl at,000000dc +[ ]*dc: R_MIPS_PC16 external_label ... diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/mips/bge.s binutils-2.11.92.0.5/gas/testsuite/gas/mips/bge.s --- binutils-2.11.90.0.31/gas/testsuite/gas/mips/bge.s Thu Jun 3 11:02:03 1999 +++ binutils-2.11.92.0.5/gas/testsuite/gas/mips/bge.s Mon Oct 1 15:25:25 2001 @@ -24,6 +24,12 @@ text_label: bgel $4,$5,text_label bgtl $4,$5,text_label +# Branch to an external label. + bge $4,$5,external_label + bgt $4,$5,external_label + bgel $4,$5,external_label + bgtl $4,$5,external_label + # Round to a 16 byte boundary, for ease in testing multiple targets. nop nop diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/mips/bgeu.d binutils-2.11.92.0.5/gas/testsuite/gas/mips/bgeu.d --- binutils-2.11.90.0.31/gas/testsuite/gas/mips/bgeu.d Mon May 21 10:36:59 2001 +++ binutils-2.11.92.0.5/gas/testsuite/gas/mips/bgeu.d Mon Oct 1 15:25:25 2001 @@ -44,4 +44,20 @@ Disassembly of section .text: 0+008c <[^>]*> nop 0+0090 <[^>]*> sltu at,a1,a0 0+0094 <[^>]*> bnezl at,0+0000 +0+0098 <[^>]*> nop +0+009c <[^>]*> sltu at,a0,a1 +0+00a0 <[^>]*> beqz at,000000a0 +[ ]*a0: R_MIPS_PC16 external_label +0+00a4 <[^>]*> nop +0+00a8 <[^>]*> sltu at,a1,a0 +0+00ac <[^>]*> bnez at,000000ac +[ ]*ac: R_MIPS_PC16 external_label +0+00b0 <[^>]*> nop +0+00b4 <[^>]*> sltu at,a0,a1 +0+00b8 <[^>]*> beqzl at,000000b8 +[ ]*b8: R_MIPS_PC16 external_label +0+00bc <[^>]*> nop +0+00c0 <[^>]*> sltu at,a1,a0 +0+00c4 <[^>]*> bnezl at,000000c4 +[ ]*c4: R_MIPS_PC16 external_label ... diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/mips/bgeu.s binutils-2.11.92.0.5/gas/testsuite/gas/mips/bgeu.s --- binutils-2.11.90.0.31/gas/testsuite/gas/mips/bgeu.s Thu Jun 3 11:02:03 1999 +++ binutils-2.11.92.0.5/gas/testsuite/gas/mips/bgeu.s Mon Oct 1 15:25:25 2001 @@ -22,6 +22,12 @@ text_label: bgeul $4,$5,text_label bgtul $4,$5,text_label +# Branch to an external label. + bgeu $4,$5,external_label + bgtu $4,$5,external_label + bgeul $4,$5,external_label + bgtul $4,$5,external_label + # Round to a 16 byte boundary, for ease in testing multiple targets. nop nop diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/mips/blt.d binutils-2.11.92.0.5/gas/testsuite/gas/mips/blt.d --- binutils-2.11.90.0.31/gas/testsuite/gas/mips/blt.d Mon May 21 10:36:59 2001 +++ binutils-2.11.92.0.5/gas/testsuite/gas/mips/blt.d Mon Oct 1 15:25:25 2001 @@ -50,4 +50,20 @@ Disassembly of section .text: 0+00a4 <[^>]*> nop 0+00a8 <[^>]*> slt at,a1,a0 0+00ac <[^>]*> beqzl at,0+0000 +0+00b0 <[^>]*> nop +0+00b4 <[^>]*> slt at,a0,a1 +0+00b8 <[^>]*> bnez at,000000b8 +[ ]*b8: R_MIPS_PC16 external_label +0+00bc <[^>]*> nop +0+00c0 <[^>]*> slt at,a1,a0 +0+00c4 <[^>]*> beqz at,000000c4 +[ ]*c4: R_MIPS_PC16 external_label +0+00c8 <[^>]*> nop +0+00cc <[^>]*> slt at,a0,a1 +0+00d0 <[^>]*> bnezl at,000000d0 +[ ]*d0: R_MIPS_PC16 external_label +0+00d4 <[^>]*> nop +0+00d8 <[^>]*> slt at,a1,a0 +0+00dc <[^>]*> beqzl at,000000dc +[ ]*dc: R_MIPS_PC16 external_label ... diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/mips/blt.s binutils-2.11.92.0.5/gas/testsuite/gas/mips/blt.s --- binutils-2.11.90.0.31/gas/testsuite/gas/mips/blt.s Thu Jun 3 11:02:03 1999 +++ binutils-2.11.92.0.5/gas/testsuite/gas/mips/blt.s Mon Oct 1 15:25:25 2001 @@ -24,6 +24,12 @@ text_label: bltl $4,$5,text_label blel $4,$5,text_label +# Branch to an external label. + blt $4,$5,external_label + ble $4,$5,external_label + bltl $4,$5,external_label + blel $4,$5,external_label + # Round to a 16 byte boundary, for ease in testing multiple targets. nop nop diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/mips/bltu.d binutils-2.11.92.0.5/gas/testsuite/gas/mips/bltu.d --- binutils-2.11.90.0.31/gas/testsuite/gas/mips/bltu.d Mon May 21 10:36:59 2001 +++ binutils-2.11.92.0.5/gas/testsuite/gas/mips/bltu.d Mon Oct 1 15:25:25 2001 @@ -44,4 +44,20 @@ Disassembly of section .text: 0+008c <[^>]*> nop 0+0090 <[^>]*> sltu at,a1,a0 0+0094 <[^>]*> beqzl at,0+0000 +0+0098 <[^>]*> nop +0+009c <[^>]*> sltu at,a0,a1 +0+00a0 <[^>]*> bnez at,000000a0 +[ ]*a0: R_MIPS_PC16 external_label +0+00a4 <[^>]*> nop +0+00a8 <[^>]*> sltu at,a1,a0 +0+00ac <[^>]*> beqz at,000000ac +[ ]*ac: R_MIPS_PC16 external_label +0+00b0 <[^>]*> nop +0+00b4 <[^>]*> sltu at,a0,a1 +0+00b8 <[^>]*> bnezl at,000000b8 +[ ]*b8: R_MIPS_PC16 external_label +0+00bc <[^>]*> nop +0+00c0 <[^>]*> sltu at,a1,a0 +0+00c4 <[^>]*> beqzl at,000000c4 +[ ]*c4: R_MIPS_PC16 external_label ... diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/mips/bltu.s binutils-2.11.92.0.5/gas/testsuite/gas/mips/bltu.s --- binutils-2.11.90.0.31/gas/testsuite/gas/mips/bltu.s Thu Jun 3 11:02:03 1999 +++ binutils-2.11.92.0.5/gas/testsuite/gas/mips/bltu.s Mon Oct 1 15:25:25 2001 @@ -22,6 +22,12 @@ text_label: bltul $4,$5,text_label bleul $4,$5,text_label +# Branch to an external label. + bltu $4,$5,external_label + bleu $4,$5,external_label + bltul $4,$5,external_label + bleul $4,$5,external_label + # Round to a 16 byte boundary, for ease in testing multiple targets. nop nop diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/mips/elempic.d binutils-2.11.92.0.5/gas/testsuite/gas/mips/elempic.d --- binutils-2.11.90.0.31/gas/testsuite/gas/mips/elempic.d Mon Aug 27 11:44:52 2001 +++ binutils-2.11.92.0.5/gas/testsuite/gas/mips/elempic.d Thu Oct 4 14:35:43 2001 @@ -120,7 +120,7 @@ Contents of section \.text: 0070 00010000 00000000 04000000 00000000 .* 0080 4c000000 00000000 54010000 00000000 .* 0090 d0ffffff ffffffff 32000010 33000010 .* - 00a0 0000033c d8006364 0000033c e8006364 .* + 00a0 0000033c d80063[26]4 0000033c e80063[26]4 .* 00b0 cc000000 34000000 cc000000 00000000 .* 00c0 34000000 00000000 00000000 32000010 .* 00d0 33000010 34000324 3c000324 cc000000 .* diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/mips/elf-rel4.d binutils-2.11.92.0.5/gas/testsuite/gas/mips/elf-rel4.d --- binutils-2.11.90.0.31/gas/testsuite/gas/mips/elf-rel4.d Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/gas/testsuite/gas/mips/elf-rel4.d Thu Oct 4 14:35:43 2001 @@ -4,11 +4,11 @@ .*: +file format.* Disassembly of section .text: -0+000 <[^>]*> daddiu a0,gp,0 +0+000 <[^>]*> addiu a0,gp,0 0: R_MIPS_GPREL16 a -0+004 <[^>]*> daddiu a0,gp,4 +0+004 <[^>]*> addiu a0,gp,4 4: R_MIPS_GPREL16 a -0+008 <[^>]*> daddiu a0,gp,8 +0+008 <[^>]*> addiu a0,gp,8 8: R_MIPS_GPREL16 a -0+00c <[^>]*> daddiu a0,gp,12 +0+00c <[^>]*> addiu a0,gp,12 c: R_MIPS_GPREL16 a diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/mips/ld.d binutils-2.11.92.0.5/gas/testsuite/gas/mips/ld.d --- binutils-2.11.90.0.31/gas/testsuite/gas/mips/ld.d Fri Jul 6 09:26:11 2001 +++ binutils-2.11.92.0.5/gas/testsuite/gas/mips/ld.d Thu Oct 4 14:35:43 2001 @@ -628,12 +628,12 @@ Disassembly of section .text: 0+05d0 <[^>]*> sw a1,4\(zero\) 0+05d4 <[^>]*> lui a0,[-0-9x]+ [ ]*5d4: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+05d8 <[^>]*> daddu a0,a0,a1 +0+05d8 <[^>]*> addu a0,a0,a1 0+05dc <[^>]*> ld a0,[-0-9]+\(a0\) [ ]*5dc: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* 0+05e0 <[^>]*> lui at,[-0-9x]+ [ ]*5e0: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+05e4 <[^>]*> daddu at,at,a1 +0+05e4 <[^>]*> addu at,at,a1 0+05e8 <[^>]*> sd a0,[-0-9]+\(at\) [ ]*5e8: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* 0+05ec <[^>]*> nop diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/mips/mips-abi32-pic.s binutils-2.11.92.0.5/gas/testsuite/gas/mips/mips-abi32-pic.s --- binutils-2.11.90.0.31/gas/testsuite/gas/mips/mips-abi32-pic.s Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/gas/testsuite/gas/mips/mips-abi32-pic.s Mon Oct 1 15:25:25 2001 @@ -13,7 +13,6 @@ unshared: .text .ent func func: - .set mips4 .set noreorder .cpload $25 # 0000 lui gp,hi(_gp_disp) # 0004 addiu gp,gp,lo(_gp_disp) diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/mips/mips-abi32.s binutils-2.11.92.0.5/gas/testsuite/gas/mips/mips-abi32.s --- binutils-2.11.90.0.31/gas/testsuite/gas/mips/mips-abi32.s Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/gas/testsuite/gas/mips/mips-abi32.s Mon Oct 1 15:25:25 2001 @@ -13,7 +13,6 @@ unshared: .text func: .set noreorder - .set mips4 li $4, 0x12345678 # 0000 lui a0,0x1234 # 0004 ori a0,a0,0x5678 la $4, shared # 0008 addiu a0,gp,shared diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/mips/mips-gp32-fp32-pic.s binutils-2.11.92.0.5/gas/testsuite/gas/mips/mips-gp32-fp32-pic.s --- binutils-2.11.90.0.31/gas/testsuite/gas/mips/mips-gp32-fp32-pic.s Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/gas/testsuite/gas/mips/mips-gp32-fp32-pic.s Mon Oct 1 15:25:25 2001 @@ -13,7 +13,6 @@ unshared: .text .ent func func: - .set mips4 .set noreorder .cpload $25 # 0000 lui gp,hi(_gp_disp) # 0004 addiu gp,gp,lo(_gp_disp) diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/mips/mips-gp32-fp32.s binutils-2.11.92.0.5/gas/testsuite/gas/mips/mips-gp32-fp32.s --- binutils-2.11.90.0.31/gas/testsuite/gas/mips/mips-gp32-fp32.s Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/gas/testsuite/gas/mips/mips-gp32-fp32.s Mon Oct 1 15:25:25 2001 @@ -13,7 +13,6 @@ unshared: .text func: .set noreorder - .set mips4 li $4, 0x12345678 # 0000 lui a0,0x1234 # 0004 ori a0,a0,0x5678 la $4, shared # 0008 addiu a0,gp,shared diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/mips/mips-gp32-fp64-pic.s binutils-2.11.92.0.5/gas/testsuite/gas/mips/mips-gp32-fp64-pic.s --- binutils-2.11.90.0.31/gas/testsuite/gas/mips/mips-gp32-fp64-pic.s Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/gas/testsuite/gas/mips/mips-gp32-fp64-pic.s Mon Oct 1 15:25:25 2001 @@ -13,7 +13,6 @@ unshared: .text .ent func func: - .set mips4 .set noreorder .cpload $25 # 0000 lui gp,hi(_gp_disp) # 0004 addiu gp,gp,lo(_gp_disp) diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/mips/mips-gp32-fp64.s binutils-2.11.92.0.5/gas/testsuite/gas/mips/mips-gp32-fp64.s --- binutils-2.11.90.0.31/gas/testsuite/gas/mips/mips-gp32-fp64.s Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/gas/testsuite/gas/mips/mips-gp32-fp64.s Mon Oct 1 15:25:25 2001 @@ -13,7 +13,6 @@ unshared: .text func: .set noreorder - .set mips4 li $4, 0x12345678 # 0000 lui a0,0x1234 # 0004 ori a0,a0,0x5678 la $4, shared # 0008 addiu a0,gp,shared diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/mips/mips-gp64-fp32-pic.d binutils-2.11.92.0.5/gas/testsuite/gas/mips/mips-gp64-fp32-pic.d --- binutils-2.11.90.0.31/gas/testsuite/gas/mips/mips-gp64-fp32-pic.d Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/gas/testsuite/gas/mips/mips-gp64-fp32-pic.d Thu Oct 4 14:35:43 2001 @@ -10,101 +10,101 @@ Disassembly of section .text: 0: 3c1c0000 lui gp,0x0 4: 279c0000 addiu gp,gp,0 8: 0399e021 addu gp,gp,t9 - c: ffbc0008 sd gp,8\(sp\) - 10: 009c202d daddu a0,a0,gp + c: afbc0008 sw gp,8\(sp\) + 10: 009c2021 addu a0,a0,gp 14: 3c041234 lui a0,0x1234 18: 34845678 ori a0,a0,0x5678 1c: 8f840000 lw a0,0\(gp\) 20: 00000000 nop - 24: 64840000 daddiu a0,a0,0 + 24: 24840000 addiu a0,a0,0 28: 8f840000 lw a0,0\(gp\) 2c: 00000000 nop - 30: 64840000 daddiu a0,a0,0 + 30: 24840000 addiu a0,a0,0 34: 8f840000 lw a0,0\(gp\) 38: 00000000 nop - 3c: 64840228 daddiu a0,a0,552 + 3c: 24840228 addiu a0,a0,552 40: 10000079 b 228 <[^>]*> 44: 00000000 nop - 48: df990000 ld t9,0\(gp\) + 48: 8f990000 lw t9,0\(gp\) 4c: 00000000 nop - 50: 67390228 daddiu t9,t9,552 + 50: 27390228 addiu t9,t9,552 54: 0320f809 jalr t9 58: 00000000 nop - 5c: dfbc0008 ld gp,8\(sp\) - 60: df840000 ld a0,0\(gp\) + 5c: 8fbc0008 lw gp,8\(sp\) + 60: 8f840000 lw a0,0\(gp\) 64: 00000000 nop - 68: 64840000 daddiu a0,a0,0 + 68: 24840000 addiu a0,a0,0 6c: 8c840000 lw a0,0\(a0\) - 70: df840000 ld a0,0\(gp\) + 70: 8f840000 lw a0,0\(gp\) 74: 00000000 nop - 78: 64840000 daddiu a0,a0,0 + 78: 24840000 addiu a0,a0,0 7c: 8c840000 lw a0,0\(a0\) - 80: df840000 ld a0,0\(gp\) + 80: 8f840000 lw a0,0\(gp\) 84: 00000000 nop - 88: 64840228 daddiu a0,a0,552 + 88: 24840228 addiu a0,a0,552 8c: 8c840000 lw a0,0\(a0\) - 90: df840000 ld a0,0\(gp\) + 90: 8f840000 lw a0,0\(gp\) 94: 00000000 nop - 98: 64840000 daddiu a0,a0,0 + 98: 24840000 addiu a0,a0,0 9c: dc840000 ld a0,0\(a0\) - a0: df840000 ld a0,0\(gp\) + a0: 8f840000 lw a0,0\(gp\) a4: 00000000 nop - a8: 64840000 daddiu a0,a0,0 + a8: 24840000 addiu a0,a0,0 ac: dc840000 ld a0,0\(a0\) - b0: df840000 ld a0,0\(gp\) + b0: 8f840000 lw a0,0\(gp\) b4: 00000000 nop - b8: 64840228 daddiu a0,a0,552 + b8: 24840228 addiu a0,a0,552 bc: dc840000 ld a0,0\(a0\) - c0: df810000 ld at,0\(gp\) + c0: 8f810000 lw at,0\(gp\) c4: 00000000 nop - c8: 64210000 daddiu at,at,0 + c8: 24210000 addiu at,at,0 cc: ac240000 sw a0,0\(at\) - d0: df810000 ld at,0\(gp\) + d0: 8f810000 lw at,0\(gp\) d4: 00000000 nop - d8: 64210000 daddiu at,at,0 + d8: 24210000 addiu at,at,0 dc: ac240000 sw a0,0\(at\) - e0: df810000 ld at,0\(gp\) + e0: 8f810000 lw at,0\(gp\) e4: 00000000 nop - e8: 64210000 daddiu at,at,0 + e8: 24210000 addiu at,at,0 ec: fc240000 sd a0,0\(at\) - f0: df810000 ld at,0\(gp\) + f0: 8f810000 lw at,0\(gp\) f4: 00000000 nop - f8: 64210000 daddiu at,at,0 + f8: 24210000 addiu at,at,0 fc: fc240000 sd a0,0\(at\) - 100: df810000 ld at,0\(gp\) + 100: 8f810000 lw at,0\(gp\) 104: 00000000 nop - 108: 64210000 daddiu at,at,0 + 108: 24210000 addiu at,at,0 10c: 80240000 lb a0,0\(at\) 110: 90210001 lbu at,1\(at\) 114: 00042200 sll a0,a0,0x8 118: 00812025 or a0,a0,at - 11c: df810000 ld at,0\(gp\) + 11c: 8f810000 lw at,0\(gp\) 120: 00000000 nop - 124: 64210000 daddiu at,at,0 + 124: 24210000 addiu at,at,0 128: a0240001 sb a0,1\(at\) 12c: 00042202 srl a0,a0,0x8 130: a0240000 sb a0,0\(at\) 134: 90210001 lbu at,1\(at\) 138: 00042200 sll a0,a0,0x8 13c: 00812025 or a0,a0,at - 140: df810000 ld at,0\(gp\) + 140: 8f810000 lw at,0\(gp\) 144: 00000000 nop - 148: 64210000 daddiu at,at,0 + 148: 24210000 addiu at,at,0 14c: 88240000 lwl a0,0\(at\) 150: 98240003 lwr a0,3\(at\) - 154: df810000 ld at,0\(gp\) + 154: 8f810000 lw at,0\(gp\) 158: 00000000 nop - 15c: 64210000 daddiu at,at,0 + 15c: 24210000 addiu at,at,0 160: a8240000 swl a0,0\(at\) 164: b8240003 swr a0,3\(at\) 168: 3404ffc0 li a0,0xffc0 16c: 000423bc dsll32 a0,a0,0xe - 170: df810000 ld at,0\(gp\) + 170: 8f810000 lw at,0\(gp\) 174: dc240000 ld a0,0\(at\) 178: 3c013ff0 lui at,0x3ff0 17c: 44810800 mtc1 at,\$f1 180: 44800000 mtc1 zero,\$f0 - 184: df810000 ld at,0\(gp\) + 184: 8f810000 lw at,0\(gp\) 188: d4200008 ldc1 \$f0,8\(at\) 18c: 64a40064 daddiu a0,a1,100 190: 2c840001 sltiu a0,a0,1 @@ -113,18 +113,18 @@ Disassembly of section .text: 19c: 00a0202d move a0,a1 1a0: df840000 ld a0,0\(gp\) 1a4: 00000000 nop - 1a8: 64840000 daddiu a0,a0,0 + 1a8: 24840000 addiu a0,a0,0 1ac: df840000 ld a0,0\(gp\) 1b0: 00000000 nop - 1b4: 64840000 daddiu a0,a0,0 - 1b8: df810000 ld at,0\(gp\) + 1b4: 24840000 addiu a0,a0,0 + 1b8: 8f810000 lw at,0\(gp\) 1bc: 00000000 nop - 1c0: 64210000 daddiu at,at,0 + 1c0: 24210000 addiu at,at,0 1c4: 68240000 ldl a0,0\(at\) 1c8: 6c240007 ldr a0,7\(at\) - 1cc: df810000 ld at,0\(gp\) + 1cc: 8f810000 lw at,0\(gp\) 1d0: 00000000 nop - 1d4: 64210000 daddiu at,at,0 + 1d4: 24210000 addiu at,at,0 1d8: b0240000 sdl a0,0\(at\) 1dc: b4240007 sdr a0,7\(at\) 1e0: 3c018000 lui at,0x8000 diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/mips/mips-gp64-fp32-pic.s binutils-2.11.92.0.5/gas/testsuite/gas/mips/mips-gp64-fp32-pic.s --- binutils-2.11.90.0.31/gas/testsuite/gas/mips/mips-gp64-fp32-pic.s Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/gas/testsuite/gas/mips/mips-gp64-fp32-pic.s Thu Oct 4 14:35:43 2001 @@ -13,107 +13,106 @@ unshared: .text .ent func func: - .set mips4 .set noreorder .cpload $25 # 0000 lui gp,hi(_gp_disp) # 0004 addiu gp,gp,lo(_gp_disp) # 0008 addu gp,gp,t9 .set reorder - .cprestore 8 # 000c sd gp,8(sp) - .cpadd $4 # 0010 daddu a0,a0,gp + .cprestore 8 # 000c sw gp,8(sp) + .cpadd $4 # 0010 addu a0,a0,gp li $4, 0x12345678 # 0014 lui a0,0x1234 # 0018 ori a0,a0,0x5678 la $4, shared # 001c lw a0,got(.sdata)(gp) # 0020 nop - # 0024 daddiu a0,a0,lo(shared) + # 0024 addiu a0,a0,lo(shared) la $4, unshared # 0028 lw a0,got(.data)(gp) # 002c nop - # 0030 daddiu a0,a0,lo(unshared) + # 0030 addiu a0,a0,lo(unshared) la $4, end # 0034 lw a0,got(.text)(gp) # 0038 nop - # 003c daddiu a0,a0,lo(end) + # 003c addiu a0,a0,lo(end) j end # 0040 b end # 0044 nop - jal end # 0048 ld t9,got(.text)(gp) + jal end # 0048 lw t9,got(.text)(gp) # 004c nop - # 0050 daddiu t9,t9,lo(end) + # 0050 addiu t9,t9,lo(end) # 0054 jalr t9 # 0058 nop - # 005c ld gp,8(sp) - lw $4, shared # 0060 ld a0,got(.sdata)(gp) + # 005c lw gp,8(sp) + lw $4, shared # 0060 lw a0,got(.sdata)(gp) # 0064 nop - # 0068 daddiu a0,a0,lo(shared) + # 0068 addiu a0,a0,lo(shared) # 006c lw a0,(a0) - lw $4, unshared # 0070 ld a0,got(.data)(gp) + lw $4, unshared # 0070 lw a0,got(.data)(gp) # 0074 nop - # 0078 daddiu a0,a0,lo(unshared) + # 0078 addiu a0,a0,lo(unshared) # 007c lw a0,(a0) - lw $4, end # 0080 ld a0,got(.text)(gp) + lw $4, end # 0080 lw a0,got(.text)(gp) # 0084 nop - # 0088 daddiu a0,a0,lo(end) + # 0088 addiu a0,a0,lo(end) # 008c lw a0,(a0) - ld $4, shared # 0090 ld a0,got(.sdata)(gp) + ld $4, shared # 0090 lw a0,got(.sdata)(gp) # 0094 nop - # 0098 daddiu a0,a0,lo(shared) + # 0098 addiu a0,a0,lo(shared) # 009c ld a0,(a0) - ld $4, unshared # 00a0 ld a0,got(.data)(gp) + ld $4, unshared # 00a0 lw a0,got(.data)(gp) # 00a4 nop - # 00a8 daddiu a0,a0,lo(unshared) + # 00a8 addiu a0,a0,lo(unshared) # 00ac ld a0,(a0) - ld $4, end # 00b0 ld a0,got(.text)(gp) + ld $4, end # 00b0 lw a0,got(.text)(gp) # 00b4 nop - # 00b8 daddiu a0,a0,lo(end) + # 00b8 addiu a0,a0,lo(end) # 00bc ld a0,(a0) - sw $4, shared # 00c0 ld at,got(.sdata)(gp) + sw $4, shared # 00c0 lw at,got(.sdata)(gp) # 00c4 nop - # 00c8 daddiu at,at,lo(shared) + # 00c8 addiu at,at,lo(shared) # 00cc sw a0,0(at) - sw $4, unshared # 00d0 ld at,got(.data)(gp) + sw $4, unshared # 00d0 lw at,got(.data)(gp) # 00d4 nop - # 00d8 daddiu at,at,lo(unshared) + # 00d8 addiu at,at,lo(unshared) # 00dc sw a0,0(at) - sd $4, shared # 00e0 ld at,got(.sdata)(gp) + sd $4, shared # 00e0 lw at,got(.sdata)(gp) # 00e4 nop - # 00e8 daddiu at,at,lo(shared) + # 00e8 addiu at,at,lo(shared) # 00ec sd a0,(at) - sd $4, unshared # 00f0 ld at,got(.data)(gp) + sd $4, unshared # 00f0 lw at,got(.data)(gp) # 00f4 nop - # 00f8 daddiu at,at,lo(unshared) + # 00f8 addiu at,at,lo(unshared) # 00fc sd a0,(at) - ulh $4, unshared # 0100 ld at,got(.data)(gp) + ulh $4, unshared # 0100 lw at,got(.data)(gp) # 0104 nop - # 0108 daddiu at,at,lo(unshared) + # 0108 addiu at,at,lo(unshared) # 010c lb a0,0(at) # 0110 lbu at,1(at) # 0114 sll a0,a0,8 # 0118 or a0,a0,at - ush $4, unshared # 011c ld at,got(.data)(gp) + ush $4, unshared # 011c lw at,got(.data)(gp) # 0120 nop - # 0124 daddiu at,at,lo(unshared) + # 0124 addiu at,at,lo(unshared) # 0128 sb a0,0(at) # 012c srl a0,a0,8 # 0130 sb a0,1(at) # 0134 lbu at,0(at) # 0138 sll a0,a0,8 # 013c or a0,a0,at - ulw $4, unshared # 0140 ld at,got(.data)(gp) + ulw $4, unshared # 0140 lw at,got(.data)(gp) # 0144 nop - # 0148 daddiu at,at,lo(unshared) + # 0148 addiu at,at,lo(unshared) # 014c lwl a0,0(at) # 0150 lwr a0,3(at) - usw $4, unshared # 0154 ld at,got(.data)(gp) + usw $4, unshared # 0154 lw at,got(.data)(gp) # 0158 nop - # 015c daddiu at,at,lo(unshared) + # 015c addiu at,at,lo(unshared) # 0160 swl a0,0(at) # 0164 swr a0,3(at) li.d $4, 1.0 # 0168 li a0,0xffc0 # 016c dsll32 a0,a0,14 - li.d $4, 1.9 # 0170 ld at,got(.rodata)(gp) + li.d $4, 1.9 # 0170 lw at,got(.rodata)(gp) # 0174 ld a0,lo(F1.9)(at) li.d $f0, 1.0 # 0178 lui at,0x3ff0 # 017c mtc1 at,$f1 # 0180 mtc1 zero,$f0 - li.d $f0, 1.9 # 0184 ld at,got(.rodata)(gp) + li.d $f0, 1.9 # 0184 lw at,got(.rodata)(gp) # 0188 ldc1 $f0,lo(L1.9)(at) seq $4, $5, -100 # 018c daddiu a0,a1,100 # 0190 sltiu a0,a0,1 @@ -123,18 +122,18 @@ func: dla $4, shared # 01a0 ld a0,got(.sdata)(gp) # 01a4 nop - # 01a8 daddiu a0,a0,lo(shared) + # 01a8 addiu a0,a0,lo(shared) dla $4, unshared # 01ac ld a0,got(.data)(gp) # 01b0 nop - # 01b4 daddiu a0,a0,lo(unshared) - uld $4, unshared # 01b8 ld at,got(.data)(gp) + # 01b4 addiu a0,a0,lo(unshared) + uld $4, unshared # 01b8 lw at,got(.data)(gp) # 01bc nop - # 01c0 daddiu at,at,lo(unshared) + # 01c0 addiu at,at,lo(unshared) # 01c4 ldl a0,0(at) # 01c8 ldr a0,7(at) - usd $4, unshared # 01cc ld at,got(.data)(gp) + usd $4, unshared # 01cc lw at,got(.data)(gp) # 01d0 nop - # 01d4 daddiu at,at,lo(unshared) + # 01d4 addiu at,at,lo(unshared) # 01d8 sdl a0,0(at) # 01dc sdr a0,7(at) diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/mips/mips-gp64-fp32.d binutils-2.11.92.0.5/gas/testsuite/gas/mips/mips-gp64-fp32.d --- binutils-2.11.90.0.31/gas/testsuite/gas/mips/mips-gp64-fp32.d Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/gas/testsuite/gas/mips/mips-gp64-fp32.d Thu Oct 4 14:35:43 2001 @@ -9,11 +9,11 @@ Disassembly of section .text: 0+000 <[^>]*>: 0: 3c041234 lui a0,0x1234 4: 34845678 ori a0,a0,0x5678 - 8: 6784c000 daddiu a0,gp,-16384 + 8: 2784c000 addiu a0,gp,-16384 c: 3c040000 lui a0,0x0 - 10: 64840000 daddiu a0,a0,0 + 10: 24840000 addiu a0,a0,0 14: 3c040000 lui a0,0x0 - 18: 64840154 daddiu a0,a0,340 + 18: 24840154 addiu a0,a0,340 1c: 08000055 j 154 <[^>]*> 20: 0c000055 jal 154 <[^>]*> 24: 8f84c000 lw a0,-16384\(gp\) @@ -33,13 +33,13 @@ Disassembly of section .text: 5c: 3c010000 lui at,0x0 60: fc240000 sd a0,0\(at\) 64: 3c010000 lui at,0x0 - 68: 64210000 daddiu at,at,0 + 68: 24210000 addiu at,at,0 6c: 80240000 lb a0,0\(at\) 70: 90210001 lbu at,1\(at\) 74: 00042200 sll a0,a0,0x8 78: 00812025 or a0,a0,at 7c: 3c010000 lui at,0x0 - 80: 64210000 daddiu at,at,0 + 80: 24210000 addiu at,at,0 84: a0240001 sb a0,1\(at\) 88: 00042202 srl a0,a0,0x8 8c: a0240000 sb a0,0\(at\) @@ -47,11 +47,11 @@ Disassembly of section .text: 94: 00042200 sll a0,a0,0x8 98: 00812025 or a0,a0,at 9c: 3c010000 lui at,0x0 - a0: 64210000 daddiu at,at,0 + a0: 24210000 addiu at,at,0 a4: 88240000 lwl a0,0\(at\) a8: 98240003 lwr a0,3\(at\) ac: 3c010000 lui at,0x0 - b0: 64210000 daddiu at,at,0 + b0: 24210000 addiu at,at,0 b4: a8240000 swl a0,0\(at\) b8: b8240003 swr a0,3\(at\) bc: 3404ffc0 li a0,0xffc0 @@ -67,15 +67,15 @@ Disassembly of section .text: e4: 64a40064 daddiu a0,a1,100 e8: 0004202b sltu a0,zero,a0 ec: 00a0202d move a0,a1 - f0: 6784c000 daddiu a0,gp,-16384 + f0: 2784c000 addiu a0,gp,-16384 f4: 3c040000 lui a0,0x0 - f8: 64840000 daddiu a0,a0,0 + f8: 24840000 addiu a0,a0,0 fc: 3c010000 lui at,0x0 - 100: 64210000 daddiu at,at,0 + 100: 24210000 addiu at,at,0 104: 68240000 ldl a0,0\(at\) 108: 6c240007 ldr a0,7\(at\) 10c: 3c010000 lui at,0x0 - 110: 64210000 daddiu at,at,0 + 110: 24210000 addiu at,at,0 114: b0240000 sdl a0,0\(at\) 118: b4240007 sdr a0,7\(at\) 11c: 3c018000 lui at,0x8000 diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/mips/mips-gp64-fp32.s binutils-2.11.92.0.5/gas/testsuite/gas/mips/mips-gp64-fp32.s --- binutils-2.11.90.0.31/gas/testsuite/gas/mips/mips-gp64-fp32.s Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/gas/testsuite/gas/mips/mips-gp64-fp32.s Thu Oct 4 14:35:43 2001 @@ -13,14 +13,13 @@ unshared: .text func: .set noreorder - .set mips4 li $4, 0x12345678 # 0000 lui a0,0x1234 # 0004 ori a0,a0,0x5678 - la $4, shared # 0008 daddiu a0,gp,shared + la $4, shared # 0008 addiu a0,gp,shared la $4, unshared # 000c lui a0,hi(unshared) - # 0010 daddiu a0,a0,lo(unshared) + # 0010 addiu a0,a0,lo(unshared) la $4, end # 0014 lui a0,hi(end) - # 0018 daddiu a0,a0,lo(end) + # 0018 addiu a0,a0,lo(end) j end # 001c j end jal end # 0020 jal end lw $4, shared # 0024 lw a0,shared(gp) @@ -40,13 +39,13 @@ func: sd $4, unshared # 005c lui at,hi(unshared) # 0060 sd a0,lo(unshared)(at) ulh $4, unshared # 0064 lui at,hi(unshared) - # 0068 daddiu at,at,lo(unshared) + # 0068 addiu at,at,lo(unshared) # 006c lb a0,0(at) # 0070 lbu at,1(at) # 0074 sll a0,a0,8 # 0078 or a0,a0,at ush $4, unshared # 007c lui at,hi(unshared) - # 0080 daddiu at,at,lo(unshared) + # 0080 addiu at,at,lo(unshared) # 0084 sb a0,1(at) # 0088 srl a0,a0,8 # 008c sb a0,0(at) @@ -54,11 +53,11 @@ func: # 0094 sll a0,a0,8 # 0098 or a0,a0,at ulw $4, unshared # 009c lui at,hi(unshared) - # 00a0 daddiu at,at,lo(unshared) + # 00a0 addiu at,at,lo(unshared) # 00a4 lwl a0,0(at) # 00a8 lwr a0,3(at) usw $4, unshared # 00ac lui at,hi(unshared) - # 00b0 daddiu at,at,lo(unshared) + # 00b0 addiu at,at,lo(unshared) # 00b4 swl a0,0(at) # 00b8 swr a0,3(at) li.d $4, 1.0 # 00bc li a0,0xffc0 @@ -75,15 +74,15 @@ func: # 00e8 sltu a0,zero,a0 move $4, $5 # 00ec move a0,a1 - dla $4, shared # 00f0 daddiu a0,gp,shared + dla $4, shared # 00f0 addiu a0,gp,shared dla $4, unshared # 00f4 lui a0,hi(unshared) - # 00f8 daddiu a0,a0,lo(unshared) + # 00f8 addiu a0,a0,lo(unshared) uld $4, unshared # 00fc lui at,hi(unshared) - # 0100 daddiu at,at,lo(unshared) + # 0100 addiu at,at,lo(unshared) # 0104 ldl a0,0(at) # 0108 ldr a0,7(at) usd $4, unshared # 010c lui at,hi(unshared) - # 0110 daddiu at,at,lo(unshared) + # 0110 addiu at,at,lo(unshared) # 0114 sdl a0,0(at) # 0118 sdr a0,7(at) diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/mips/mips-gp64-fp64-pic.d binutils-2.11.92.0.5/gas/testsuite/gas/mips/mips-gp64-fp64-pic.d --- binutils-2.11.90.0.31/gas/testsuite/gas/mips/mips-gp64-fp64-pic.d Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/gas/testsuite/gas/mips/mips-gp64-fp64-pic.d Thu Oct 4 14:35:43 2001 @@ -10,101 +10,101 @@ Disassembly of section .text: 0: 3c1c0000 lui gp,0x0 4: 279c0000 addiu gp,gp,0 8: 0399e021 addu gp,gp,t9 - c: ffbc0008 sd gp,8\(sp\) - 10: 009c202d daddu a0,a0,gp + c: afbc0008 sw gp,8\(sp\) + 10: 009c2021 addu a0,a0,gp 14: 3c041234 lui a0,0x1234 18: 34845678 ori a0,a0,0x5678 1c: 8f840000 lw a0,0\(gp\) 20: 00000000 nop - 24: 64840000 daddiu a0,a0,0 + 24: 24840000 addiu a0,a0,0 28: 8f840000 lw a0,0\(gp\) 2c: 00000000 nop - 30: 64840000 daddiu a0,a0,0 + 30: 24840000 addiu a0,a0,0 34: 8f840000 lw a0,0\(gp\) 38: 00000000 nop - 3c: 6484022c daddiu a0,a0,556 + 3c: 2484022c addiu a0,a0,556 40: 1000007a b 22c <[^>]*> 44: 00000000 nop - 48: df990000 ld t9,0\(gp\) + 48: 8f990000 lw t9,0\(gp\) 4c: 00000000 nop - 50: 6739022c daddiu t9,t9,556 + 50: 2739022c addiu t9,t9,556 54: 0320f809 jalr t9 58: 00000000 nop - 5c: dfbc0008 ld gp,8\(sp\) - 60: df840000 ld a0,0\(gp\) + 5c: 8fbc0008 lw gp,8\(sp\) + 60: 8f840000 lw a0,0\(gp\) 64: 00000000 nop - 68: 64840000 daddiu a0,a0,0 + 68: 24840000 addiu a0,a0,0 6c: 8c840000 lw a0,0\(a0\) - 70: df840000 ld a0,0\(gp\) + 70: 8f840000 lw a0,0\(gp\) 74: 00000000 nop - 78: 64840000 daddiu a0,a0,0 + 78: 24840000 addiu a0,a0,0 7c: 8c840000 lw a0,0\(a0\) - 80: df840000 ld a0,0\(gp\) + 80: 8f840000 lw a0,0\(gp\) 84: 00000000 nop - 88: 6484022c daddiu a0,a0,556 + 88: 2484022c addiu a0,a0,556 8c: 8c840000 lw a0,0\(a0\) - 90: df840000 ld a0,0\(gp\) + 90: 8f840000 lw a0,0\(gp\) 94: 00000000 nop - 98: 64840000 daddiu a0,a0,0 + 98: 24840000 addiu a0,a0,0 9c: dc840000 ld a0,0\(a0\) - a0: df840000 ld a0,0\(gp\) + a0: 8f840000 lw a0,0\(gp\) a4: 00000000 nop - a8: 64840000 daddiu a0,a0,0 + a8: 24840000 addiu a0,a0,0 ac: dc840000 ld a0,0\(a0\) - b0: df840000 ld a0,0\(gp\) + b0: 8f840000 lw a0,0\(gp\) b4: 00000000 nop - b8: 6484022c daddiu a0,a0,556 + b8: 2484022c addiu a0,a0,556 bc: dc840000 ld a0,0\(a0\) - c0: df810000 ld at,0\(gp\) + c0: 8f810000 lw at,0\(gp\) c4: 00000000 nop - c8: 64210000 daddiu at,at,0 + c8: 24210000 addiu at,at,0 cc: ac240000 sw a0,0\(at\) - d0: df810000 ld at,0\(gp\) + d0: 8f810000 lw at,0\(gp\) d4: 00000000 nop - d8: 64210000 daddiu at,at,0 + d8: 24210000 addiu at,at,0 dc: ac240000 sw a0,0\(at\) - e0: df810000 ld at,0\(gp\) + e0: 8f810000 lw at,0\(gp\) e4: 00000000 nop - e8: 64210000 daddiu at,at,0 + e8: 24210000 addiu at,at,0 ec: fc240000 sd a0,0\(at\) - f0: df810000 ld at,0\(gp\) + f0: 8f810000 lw at,0\(gp\) f4: 00000000 nop - f8: 64210000 daddiu at,at,0 + f8: 24210000 addiu at,at,0 fc: fc240000 sd a0,0\(at\) - 100: df810000 ld at,0\(gp\) + 100: 8f810000 lw at,0\(gp\) 104: 00000000 nop - 108: 64210000 daddiu at,at,0 + 108: 24210000 addiu at,at,0 10c: 80240000 lb a0,0\(at\) 110: 90210001 lbu at,1\(at\) 114: 00042200 sll a0,a0,0x8 118: 00812025 or a0,a0,at - 11c: df810000 ld at,0\(gp\) + 11c: 8f810000 lw at,0\(gp\) 120: 00000000 nop - 124: 64210000 daddiu at,at,0 + 124: 24210000 addiu at,at,0 128: a0240001 sb a0,1\(at\) 12c: 00042202 srl a0,a0,0x8 130: a0240000 sb a0,0\(at\) 134: 90210001 lbu at,1\(at\) 138: 00042200 sll a0,a0,0x8 13c: 00812025 or a0,a0,at - 140: df810000 ld at,0\(gp\) + 140: 8f810000 lw at,0\(gp\) 144: 00000000 nop - 148: 64210000 daddiu at,at,0 + 148: 24210000 addiu at,at,0 14c: 88240000 lwl a0,0\(at\) 150: 98240003 lwr a0,3\(at\) - 154: df810000 ld at,0\(gp\) + 154: 8f810000 lw at,0\(gp\) 158: 00000000 nop - 15c: 64210000 daddiu at,at,0 + 15c: 24210000 addiu at,at,0 160: a8240000 swl a0,0\(at\) 164: b8240003 swr a0,3\(at\) 168: 3404ffc0 li a0,0xffc0 16c: 000423bc dsll32 a0,a0,0xe - 170: df810000 ld at,0\(gp\) + 170: 8f810000 lw at,0\(gp\) 174: dc240000 ld a0,0\(at\) 178: 3401ffc0 li at,0xffc0 17c: 00010bbc dsll32 at,at,0xe 180: 44a10000 dmtc1 at,\$f0 - 184: df810000 ld at,0\(gp\) + 184: 8f810000 lw at,0\(gp\) 188: d4200008 ldc1 \$f0,8\(at\) 18c: 64a40064 daddiu a0,a1,100 190: 2c840001 sltiu a0,a0,1 @@ -113,18 +113,18 @@ Disassembly of section .text: 19c: 00a0202d move a0,a1 1a0: df840000 ld a0,0\(gp\) 1a4: 00000000 nop - 1a8: 64840000 daddiu a0,a0,0 + 1a8: 24840000 addiu a0,a0,0 1ac: df840000 ld a0,0\(gp\) 1b0: 00000000 nop - 1b4: 64840000 daddiu a0,a0,0 - 1b8: df810000 ld at,0\(gp\) + 1b4: 24840000 addiu a0,a0,0 + 1b8: 8f810000 lw at,0\(gp\) 1bc: 00000000 nop - 1c0: 64210000 daddiu at,at,0 + 1c0: 24210000 addiu at,at,0 1c4: 68240000 ldl a0,0\(at\) 1c8: 6c240007 ldr a0,7\(at\) - 1cc: df810000 ld at,0\(gp\) + 1cc: 8f810000 lw at,0\(gp\) 1d0: 00000000 nop - 1d4: 64210000 daddiu at,at,0 + 1d4: 24210000 addiu at,at,0 1d8: b0240000 sdl a0,0\(at\) 1dc: b4240007 sdr a0,7\(at\) 1e0: 3c018000 lui at,0x8000 diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/mips/mips-gp64-fp64-pic.s binutils-2.11.92.0.5/gas/testsuite/gas/mips/mips-gp64-fp64-pic.s --- binutils-2.11.90.0.31/gas/testsuite/gas/mips/mips-gp64-fp64-pic.s Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/gas/testsuite/gas/mips/mips-gp64-fp64-pic.s Thu Oct 4 14:35:43 2001 @@ -13,107 +13,106 @@ unshared: .text .ent func func: - .set mips4 .set noreorder .cpload $25 # 0000 lui gp,hi(_gp_disp) # 0004 addiu gp,gp,lo(_gp_disp) # 0008 addu gp,gp,t9 .set reorder - .cprestore 8 # 000c sd gp,8(sp) - .cpadd $4 # 0010 daddu a0,a0,gp + .cprestore 8 # 000c sw gp,8(sp) + .cpadd $4 # 0010 addu a0,a0,gp li $4, 0x12345678 # 0014 lui a0,0x1234 # 0018 ori a0,a0,0x5678 la $4, shared # 001c lw a0,got(.sdata)(gp) # 0020 nop - # 0024 daddiu a0,a0,lo(shared) + # 0024 addiu a0,a0,lo(shared) la $4, unshared # 0028 lw a0,got(.data)(gp) # 002c nop - # 0030 daddiu a0,a0,lo(unshared) + # 0030 addiu a0,a0,lo(unshared) la $4, end # 0034 lw a0,got(.text)(gp) # 0038 nop - # 003c daddiu a0,a0,lo(end) + # 003c addiu a0,a0,lo(end) j end # 0040 b end # 0044 nop - jal end # 0048 ld t9,got(.text)(gp) + jal end # 0048 lw t9,got(.text)(gp) # 004c nop - # 0050 daddiu t9,t9,lo(end) + # 0050 addiu t9,t9,lo(end) # 0054 jalr t9 # 0058 nop - # 005c ld gp,8(sp) - lw $4, shared # 0060 ld a0,got(.sdata)(gp) + # 005c lw gp,8(sp) + lw $4, shared # 0060 lw a0,got(.sdata)(gp) # 0064 nop - # 0068 daddiu a0,a0,lo(shared) + # 0068 addiu a0,a0,lo(shared) # 006c lw a0,(a0) - lw $4, unshared # 0070 ld a0,got(.data)(gp) + lw $4, unshared # 0070 lw a0,got(.data)(gp) # 0074 nop - # 0078 daddiu a0,a0,lo(unshared) + # 0078 addiu a0,a0,lo(unshared) # 007c lw a0,(a0) - lw $4, end # 0080 ld a0,got(.text)(gp) + lw $4, end # 0080 lw a0,got(.text)(gp) # 0084 nop - # 0088 daddiu a0,a0,lo(end) + # 0088 addiu a0,a0,lo(end) # 008c lw a0,(a0) - ld $4, shared # 0090 ld a0,got(.sdata)(gp) + ld $4, shared # 0090 lw a0,got(.sdata)(gp) # 0094 nop - # 0098 daddiu a0,a0,lo(shared) + # 0098 addiu a0,a0,lo(shared) # 009c ld a0,(a0) - ld $4, unshared # 00a0 ld a0,got(.data)(gp) + ld $4, unshared # 00a0 lw a0,got(.data)(gp) # 00a4 nop - # 00a8 daddiu a0,a0,lo(unshared) + # 00a8 addiu a0,a0,lo(unshared) # 00ac ld a0,(a0) - ld $4, end # 00b0 ld a0,got(.text)(gp) + ld $4, end # 00b0 lw a0,got(.text)(gp) # 00b4 nop - # 00b8 daddiu a0,a0,lo(end) + # 00b8 addiu a0,a0,lo(end) # 00bc ld a0,(a0) - sw $4, shared # 00c0 ld at,got(.sdata)(gp) + sw $4, shared # 00c0 lw at,got(.sdata)(gp) # 00c4 nop - # 00c8 daddiu at,at,lo(shared) + # 00c8 addiu at,at,lo(shared) # 00cc sw a0,0(at) - sw $4, unshared # 00d0 ld at,got(.data)(gp) + sw $4, unshared # 00d0 lw at,got(.data)(gp) # 00d4 nop - # 00d8 daddiu at,at,lo(unshared) + # 00d8 addiu at,at,lo(unshared) # 00dc sw a0,0(at) - sd $4, shared # 00e0 ld at,got(.sdata)(gp) + sd $4, shared # 00e0 lw at,got(.sdata)(gp) # 00e4 nop - # 00e8 daddiu at,at,lo(shared) + # 00e8 addiu at,at,lo(shared) # 00ec sd a0,(at) - sd $4, unshared # 00f0 ld at,got(.data)(gp) + sd $4, unshared # 00f0 lw at,got(.data)(gp) # 00f4 nop - # 00f8 daddiu at,at,lo(unshared) + # 00f8 addiu at,at,lo(unshared) # 00fc sd a0,(at) - ulh $4, unshared # 0100 ld at,got(.data)(gp) + ulh $4, unshared # 0100 lw at,got(.data)(gp) # 0104 nop - # 0108 daddiu at,at,lo(unshared) + # 0108 addiu at,at,lo(unshared) # 010c lb a0,0(at) # 0110 lbu at,1(at) # 0114 sll a0,a0,8 # 0118 or a0,a0,at - ush $4, unshared # 011c ld at,got(.data)(gp) + ush $4, unshared # 011c lw at,got(.data)(gp) # 0120 nop - # 0124 daddiu at,at,lo(unshared) + # 0124 addiu at,at,lo(unshared) # 0128 sb a0,0(at) # 012c srl a0,a0,8 # 0130 sb a0,1(at) # 0134 lbu at,0(at) # 0138 sll a0,a0,8 # 013c or a0,a0,at - ulw $4, unshared # 0140 ld at,got(.data)(gp) + ulw $4, unshared # 0140 lw at,got(.data)(gp) # 0144 nop - # 0148 daddiu at,at,lo(unshared) + # 0148 addiu at,at,lo(unshared) # 014c lwl a0,0(at) # 0150 lwr a0,3(at) - usw $4, unshared # 0154 ld at,got(.data)(gp) + usw $4, unshared # 0154 lw at,got(.data)(gp) # 0158 nop - # 015c daddiu at,at,lo(unshared) + # 015c addiu at,at,lo(unshared) # 0160 swl a0,0(at) # 0164 swr a0,3(at) li.d $4, 1.0 # 0168 li a0,0xffc0 # 016c dsll32 a0,a0,14 - li.d $4, 1.9 # 0170 ld at,got(.rodata)(gp) + li.d $4, 1.9 # 0170 lw at,got(.rodata)(gp) # 0174 ld a0,lo(F1.9)(at) li.d $f0, 1.0 # 0178 li at,0xffc0 # 017c dsll32 at,at,14 # 0180 dmtc1 at,$f0 - li.d $f0, 1.9 # 0184 ld at,got(.rodata)(gp) + li.d $f0, 1.9 # 0184 lw at,got(.rodata)(gp) # 0188 ldc1 $f0,lo(L1.9)(at) seq $4, $5, -100 # 018c daddiu a0,a1,100 # 0190 sltiu a0,a0,1 @@ -123,18 +122,18 @@ func: dla $4, shared # 01a0 ld a0,got(.sdata)(gp) # 01a4 nop - # 01a8 daddiu a0,a0,lo(shared) + # 01a8 addiu a0,a0,lo(shared) dla $4, unshared # 01ac ld a0,got(.data)(gp) # 01b0 nop - # 01b4 daddiu a0,a0,lo(unshared) - uld $4, unshared # 01b8 ld at,got(.data)(gp) + # 01b4 addiu a0,a0,lo(unshared) + uld $4, unshared # 01b8 lw at,got(.data)(gp) # 01bc nop - # 01c0 daddiu at,at,lo(unshared) + # 01c0 addiu at,at,lo(unshared) # 01c4 ldl a0,0(at) # 01c8 ldr a0,7(at) - usd $4, unshared # 01cc ld at,got(.data)(gp) + usd $4, unshared # 01cc lw at,got(.data)(gp) # 01d0 nop - # 01d4 daddiu at,at,lo(unshared) + # 01d4 addiu at,at,lo(unshared) # 01d8 sdl a0,0(at) # 01dc sdr a0,7(at) diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/mips/mips-gp64-fp64.d binutils-2.11.92.0.5/gas/testsuite/gas/mips/mips-gp64-fp64.d --- binutils-2.11.90.0.31/gas/testsuite/gas/mips/mips-gp64-fp64.d Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/gas/testsuite/gas/mips/mips-gp64-fp64.d Thu Oct 4 14:35:43 2001 @@ -9,11 +9,11 @@ Disassembly of section .text: 0+000 <[^>]*>: 0: 3c041234 lui a0,0x1234 4: 34845678 ori a0,a0,0x5678 - 8: 6784c000 daddiu a0,gp,-16384 + 8: 2784c000 addiu a0,gp,-16384 c: 3c040000 lui a0,0x0 - 10: 64840000 daddiu a0,a0,0 + 10: 24840000 addiu a0,a0,0 14: 3c040000 lui a0,0x0 - 18: 64840158 daddiu a0,a0,344 + 18: 24840158 addiu a0,a0,344 1c: 08000056 j 158 <[^>]*> 20: 0c000056 jal 158 <[^>]*> 24: 8f84c000 lw a0,-16384\(gp\) @@ -33,13 +33,13 @@ Disassembly of section .text: 5c: 3c010000 lui at,0x0 60: fc240000 sd a0,0\(at\) 64: 3c010000 lui at,0x0 - 68: 64210000 daddiu at,at,0 + 68: 24210000 addiu at,at,0 6c: 80240000 lb a0,0\(at\) 70: 90210001 lbu at,1\(at\) 74: 00042200 sll a0,a0,0x8 78: 00812025 or a0,a0,at 7c: 3c010000 lui at,0x0 - 80: 64210000 daddiu at,at,0 + 80: 24210000 addiu at,at,0 84: a0240001 sb a0,1\(at\) 88: 00042202 srl a0,a0,0x8 8c: a0240000 sb a0,0\(at\) @@ -47,11 +47,11 @@ Disassembly of section .text: 94: 00042200 sll a0,a0,0x8 98: 00812025 or a0,a0,at 9c: 3c010000 lui at,0x0 - a0: 64210000 daddiu at,at,0 + a0: 24210000 addiu at,at,0 a4: 88240000 lwl a0,0\(at\) a8: 98240003 lwr a0,3\(at\) ac: 3c010000 lui at,0x0 - b0: 64210000 daddiu at,at,0 + b0: 24210000 addiu at,at,0 b4: a8240000 swl a0,0\(at\) b8: b8240003 swr a0,3\(at\) bc: 3404ffc0 li a0,0xffc0 @@ -67,15 +67,15 @@ Disassembly of section .text: e4: 64a40064 daddiu a0,a1,100 e8: 0004202b sltu a0,zero,a0 ec: 00a0202d move a0,a1 - f0: 6784c000 daddiu a0,gp,-16384 + f0: 2784c000 addiu a0,gp,-16384 f4: 3c040000 lui a0,0x0 - f8: 64840000 daddiu a0,a0,0 + f8: 24840000 addiu a0,a0,0 fc: 3c010000 lui at,0x0 - 100: 64210000 daddiu at,at,0 + 100: 24210000 addiu at,at,0 104: 68240000 ldl a0,0\(at\) 108: 6c240007 ldr a0,7\(at\) 10c: 3c010000 lui at,0x0 - 110: 64210000 daddiu at,at,0 + 110: 24210000 addiu at,at,0 114: b0240000 sdl a0,0\(at\) 118: b4240007 sdr a0,7\(at\) 11c: 3c018000 lui at,0x8000 diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/mips/mips-gp64-fp64.s binutils-2.11.92.0.5/gas/testsuite/gas/mips/mips-gp64-fp64.s --- binutils-2.11.90.0.31/gas/testsuite/gas/mips/mips-gp64-fp64.s Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/gas/testsuite/gas/mips/mips-gp64-fp64.s Thu Oct 4 14:35:43 2001 @@ -13,14 +13,13 @@ unshared: .text func: .set noreorder - .set mips4 li $4, 0x12345678 # 0000 lui a0,0x1234 # 0004 ori a0,a0,0x5678 - la $4, shared # 0008 daddiu a0,gp,shared + la $4, shared # 0008 addiu a0,gp,shared la $4, unshared # 000c lui a0,hi(unshared) - # 0010 daddiu a0,a0,lo(unshared) + # 0010 addiu a0,a0,lo(unshared) la $4, end # 0014 lui a0,hi(end) - # 0018 daddiu a0,a0,lo(end) + # 0018 addiu a0,a0,lo(end) j end # 001c j end jal end # 0020 jal end lw $4, shared # 0024 lw a0,shared(gp) @@ -40,13 +39,13 @@ func: sd $4, unshared # 005c lui at,hi(unshared) # 0060 sd a0,lo(unshared)(at) ulh $4, unshared # 0064 lui at,hi(unshared) - # 0068 daddiu at,at,lo(unshared) + # 0068 addiu at,at,lo(unshared) # 006c lb a0,0(at) # 0070 lbu at,1(at) # 0074 sll a0,a0,8 # 0078 or a0,a0,at ush $4, unshared # 007c lui at,hi(unshared) - # 0080 daddiu at,at,lo(unshared) + # 0080 addiu at,at,lo(unshared) # 0084 sb a0,1(at) # 0088 srl a0,a0,8 # 008c sb a0,0(at) @@ -54,11 +53,11 @@ func: # 0094 sll a0,a0,8 # 0098 or a0,a0,at ulw $4, unshared # 009c lui at,hi(unshared) - # 00a0 daddiu at,at,lo(unshared) + # 00a0 addiu at,at,lo(unshared) # 00a4 lwl a0,0(at) # 00a8 lwr a0,3(at) usw $4, unshared # 00ac lui at,hi(unshared) - # 00b0 daddiu at,at,lo(unshared) + # 00b0 addiu at,at,lo(unshared) # 00b4 swl a0,0(at) # 00b8 swr a0,3(at) li.d $4, 1.0 # 00bc li a0,0xffc0 @@ -75,15 +74,15 @@ func: # 00e8 sltu a0,zero,a0 move $4, $5 # 00ec move a0,a1 - dla $4, shared # 00f0 daddiu a0,gp,shared + dla $4, shared # 00f0 addiu a0,gp,shared dla $4, unshared # 00f4 lui a0,hi(unshared) - # 00f8 daddiu a0,a0,lo(unshared) + # 00f8 addiu a0,a0,lo(unshared) uld $4, unshared # 00fc lui at,hi(unshared) - # 0100 daddiu at,at,lo(unshared) + # 0100 addiu at,at,lo(unshared) # 0104 ldl a0,0(at) # 0108 ldr a0,7(at) usd $4, unshared # 010c lui at,hi(unshared) - # 0110 daddiu at,at,lo(unshared) + # 0110 addiu at,at,lo(unshared) # 0114 sdl a0,0(at) # 0118 sdr a0,7(at) diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/mips/mips32.d binutils-2.11.92.0.5/gas/testsuite/gas/mips/mips32.d --- binutils-2.11.90.0.31/gas/testsuite/gas/mips/mips32.d Fri Aug 10 14:08:01 2001 +++ binutils-2.11.92.0.5/gas/testsuite/gas/mips/mips32.d Mon Oct 1 15:25:25 2001 @@ -1,4 +1,4 @@ -#objdump: -dr --prefix-addresses --show-raw-insn -mmips:mips32 +#objdump: -dr --prefix-addresses --show-raw-insn -mmips:isa32 #name: MIPS MIPS32 instructions #as: -mips32 diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/mips/mips64.d binutils-2.11.92.0.5/gas/testsuite/gas/mips/mips64.d --- binutils-2.11.90.0.31/gas/testsuite/gas/mips/mips64.d Fri Aug 10 14:08:01 2001 +++ binutils-2.11.92.0.5/gas/testsuite/gas/mips/mips64.d Mon Oct 1 15:25:25 2001 @@ -1,4 +1,4 @@ -#objdump: -dr --prefix-addresses --show-raw-insn -mmips:mips64 +#objdump: -dr --prefix-addresses --show-raw-insn -mmips:isa64 #name: MIPS MIPS64 instructions #as: -mips64 diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/mips/tmips16-f.d binutils-2.11.92.0.5/gas/testsuite/gas/mips/tmips16-f.d --- binutils-2.11.90.0.31/gas/testsuite/gas/mips/tmips16-f.d Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/gas/testsuite/gas/mips/tmips16-f.d Mon Oct 1 15:25:25 2001 @@ -0,0 +1,34 @@ +#objdump: -rst -mips16 +#name: MIPS16 reloc 2 +#as: -mips16 +#source: mips16-f.s + +# Check MIPS16 reloc processing + +.*: +file format elf.*mips.* + +SYMBOL TABLE: +0+0000000 l d \.text 0+0000000 +0+0000000 l d \.data 0+0000000 +0+0000000 l d \.bss 0+0000000 +0+0000002 l \.text 0+0000000 0xf0 l1 +0+0000000 l d foo 0+0000000 +0+0000000 l d \.reginfo 0+0000000 +0+0000000 l d \.(mdebug|pdr) 0+0000000 + + +RELOCATION RECORDS FOR \[foo\]: +OFFSET [ ]+ TYPE VALUE +0+0000000 R_MIPS_32 l1 + + +Contents of section \.text: + 0000 65006500 65006500 65006500 65006500 .* +Contents of section \.data: +Contents of section \.reginfo: + 0000 00000001 00000000 00000000 00000000 .* + 0010 00000000 00000000 .* +Contents of section \.(mdebug|pdr): +#... +Contents of section foo: + 0000 00000003 00000000 00000000 00000000 .* diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/mips/uld.d binutils-2.11.92.0.5/gas/testsuite/gas/mips/uld.d --- binutils-2.11.90.0.31/gas/testsuite/gas/mips/uld.d Fri Jul 6 09:26:11 2001 +++ binutils-2.11.92.0.5/gas/testsuite/gas/mips/uld.d Thu Oct 4 14:35:43 2001 @@ -29,241 +29,241 @@ Disassembly of section .text: 0+004c <[^>]*> ldr a0,[-0-9]+\(a1\) 0+0050 <[^>]*> lui at,[-0-9x]+ [ ]*50: [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0054 <[^>]*> daddiu at,at,[-0-9]+ +0+0054 <[^>]*> addiu at,at,[-0-9]+ [ ]*54: [A-Z0-9_]*LO[A-Z0-9_]* .data.* 0+0058 <[^>]*> ldl a0,[07]\(at\) 0+005c <[^>]*> ldr a0,[07]\(at\) 0+0060 <[^>]*> lui at,0x0 [ ]*60: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+0064 <[^>]*> daddiu at,at,[-0-9]+ +0+0064 <[^>]*> addiu at,at,[-0-9]+ [ ]*64: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label 0+0068 <[^>]*> ldl a0,[07]\(at\) 0+006c <[^>]*> ldr a0,[07]\(at\) -0+0070 <[^>]*> daddiu at,gp,0 +0+0070 <[^>]*> addiu at,gp,0 [ ]*70: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label 0+0074 <[^>]*> ldl a0,[07]\(at\) 0+0078 <[^>]*> ldr a0,[07]\(at\) 0+007c <[^>]*> lui at,0x0 [ ]*7c: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0080 <[^>]*> daddiu at,at,[-0-9]+ +0+0080 <[^>]*> addiu at,at,[-0-9]+ [ ]*80: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common 0+0084 <[^>]*> ldl a0,[07]\(at\) 0+0088 <[^>]*> ldr a0,[07]\(at\) -0+008c <[^>]*> daddiu at,gp,0 +0+008c <[^>]*> addiu at,gp,0 [ ]*8c: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common 0+0090 <[^>]*> ldl a0,[07]\(at\) 0+0094 <[^>]*> ldr a0,[07]\(at\) 0+0098 <[^>]*> lui at,[-0-9x]+ [ ]*98: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+009c <[^>]*> daddiu at,at,[-0-9]+ +0+009c <[^>]*> addiu at,at,[-0-9]+ [ ]*9c: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* 0+00a0 <[^>]*> ldl a0,[07]\(at\) 0+00a4 <[^>]*> ldr a0,[07]\(at\) -0+00a8 <[^>]*> daddiu at,gp,[-0-9]+ +0+00a8 <[^>]*> addiu at,gp,[-0-9]+ [ ]*a8: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* 0+00ac <[^>]*> ldl a0,[07]\(at\) 0+00b0 <[^>]*> ldr a0,[07]\(at\) 0+00b4 <[^>]*> lui at,0x0 [ ]*b4: [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+00b8 <[^>]*> daddiu at,at,[-0-9]+ +0+00b8 <[^>]*> addiu at,at,[-0-9]+ [ ]*b8: [A-Z0-9_]*LO[A-Z0-9_]* .data.* 0+00bc <[^>]*> ldl a0,[07]\(at\) 0+00c0 <[^>]*> ldr a0,[07]\(at\) 0+00c4 <[^>]*> lui at,0x0 [ ]*c4: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+00c8 <[^>]*> daddiu at,at,[-0-9]+ +0+00c8 <[^>]*> addiu at,at,[-0-9]+ [ ]*c8: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label 0+00cc <[^>]*> ldl a0,[07]\(at\) 0+00d0 <[^>]*> ldr a0,[07]\(at\) -0+00d4 <[^>]*> daddiu at,gp,1 +0+00d4 <[^>]*> addiu at,gp,1 [ ]*d4: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label 0+00d8 <[^>]*> ldl a0,[07]\(at\) 0+00dc <[^>]*> ldr a0,[07]\(at\) 0+00e0 <[^>]*> lui at,0x0 [ ]*e0: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+00e4 <[^>]*> daddiu at,at,[-0-9]+ +0+00e4 <[^>]*> addiu at,at,[-0-9]+ [ ]*e4: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common 0+00e8 <[^>]*> ldl a0,[07]\(at\) 0+00ec <[^>]*> ldr a0,[07]\(at\) -0+00f0 <[^>]*> daddiu at,gp,1 +0+00f0 <[^>]*> addiu at,gp,1 [ ]*f0: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common 0+00f4 <[^>]*> ldl a0,[07]\(at\) 0+00f8 <[^>]*> ldr a0,[07]\(at\) 0+00fc <[^>]*> lui at,0x0 [ ]*fc: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0100 <[^>]*> daddiu at,at,[-0-9]+ +0+0100 <[^>]*> addiu at,at,[-0-9]+ [ ]*100: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* 0+0104 <[^>]*> ldl a0,[07]\(at\) 0+0108 <[^>]*> ldr a0,[07]\(at\) -0+010c <[^>]*> daddiu at,gp,[-0-9]+ +0+010c <[^>]*> addiu at,gp,[-0-9]+ [ ]*10c: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* 0+0110 <[^>]*> ldl a0,[07]\(at\) 0+0114 <[^>]*> ldr a0,[07]\(at\) 0+0118 <[^>]*> lui at,[-0-9x]+ [ ]*118: [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+011c <[^>]*> daddiu at,at,[-0-9]+ +0+011c <[^>]*> addiu at,at,[-0-9]+ [ ]*11c: [A-Z0-9_]*LO[A-Z0-9_]* .data.* 0+0120 <[^>]*> ldl a0,[07]\(at\) 0+0124 <[^>]*> ldr a0,[07]\(at\) 0+0128 <[^>]*> lui at,[-0-9x]+ [ ]*128: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+012c <[^>]*> daddiu at,at,[-0-9]+ +0+012c <[^>]*> addiu at,at,[-0-9]+ [ ]*12c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label 0+0130 <[^>]*> ldl a0,[07]\(at\) 0+0134 <[^>]*> ldr a0,[07]\(at\) 0+0138 <[^>]*> lui at,[-0-9x]+ [ ]*138: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+013c <[^>]*> daddiu at,at,[-0-9]+ +0+013c <[^>]*> addiu at,at,[-0-9]+ [ ]*13c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label 0+0140 <[^>]*> ldl a0,[07]\(at\) 0+0144 <[^>]*> ldr a0,[07]\(at\) 0+0148 <[^>]*> lui at,[-0-9x]+ [ ]*148: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+014c <[^>]*> daddiu at,at,[-0-9]+ +0+014c <[^>]*> addiu at,at,[-0-9]+ [ ]*14c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common 0+0150 <[^>]*> ldl a0,[07]\(at\) 0+0154 <[^>]*> ldr a0,[07]\(at\) 0+0158 <[^>]*> lui at,[-0-9x]+ [ ]*158: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+015c <[^>]*> daddiu at,at,[-0-9]+ +0+015c <[^>]*> addiu at,at,[-0-9]+ [ ]*15c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common 0+0160 <[^>]*> ldl a0,[07]\(at\) 0+0164 <[^>]*> ldr a0,[07]\(at\) 0+0168 <[^>]*> lui at,[-0-9x]+ [ ]*168: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+016c <[^>]*> daddiu at,at,[-0-9]+ +0+016c <[^>]*> addiu at,at,[-0-9]+ [ ]*16c: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* 0+0170 <[^>]*> ldl a0,[07]\(at\) 0+0174 <[^>]*> ldr a0,[07]\(at\) 0+0178 <[^>]*> lui at,[-0-9x]+ [ ]*178: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+017c <[^>]*> daddiu at,at,[-0-9]+ +0+017c <[^>]*> addiu at,at,[-0-9]+ [ ]*17c: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* 0+0180 <[^>]*> ldl a0,[07]\(at\) 0+0184 <[^>]*> ldr a0,[07]\(at\) 0+0188 <[^>]*> lui at,0x0 [ ]*188: [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+018c <[^>]*> daddiu at,at,[-0-9]+ +0+018c <[^>]*> addiu at,at,[-0-9]+ [ ]*18c: [A-Z0-9_]*LO[A-Z0-9_]* .data.* 0+0190 <[^>]*> ldl a0,[07]\(at\) 0+0194 <[^>]*> ldr a0,[07]\(at\) 0+0198 <[^>]*> lui at,0x0 [ ]*198: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+019c <[^>]*> daddiu at,at,[-0-9]+ +0+019c <[^>]*> addiu at,at,[-0-9]+ [ ]*19c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label 0+01a0 <[^>]*> ldl a0,[07]\(at\) 0+01a4 <[^>]*> ldr a0,[07]\(at\) 0+01a8 <[^>]*> lui at,0x0 [ ]*1a8: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+01ac <[^>]*> daddiu at,at,[-0-9]+ +0+01ac <[^>]*> addiu at,at,[-0-9]+ [ ]*1ac: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label 0+01b0 <[^>]*> ldl a0,[07]\(at\) 0+01b4 <[^>]*> ldr a0,[07]\(at\) 0+01b8 <[^>]*> lui at,0x0 [ ]*1b8: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+01bc <[^>]*> daddiu at,at,[-0-9]+ +0+01bc <[^>]*> addiu at,at,[-0-9]+ [ ]*1bc: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common 0+01c0 <[^>]*> ldl a0,[07]\(at\) 0+01c4 <[^>]*> ldr a0,[07]\(at\) 0+01c8 <[^>]*> lui at,0x0 [ ]*1c8: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+01cc <[^>]*> daddiu at,at,[-0-9]+ +0+01cc <[^>]*> addiu at,at,[-0-9]+ [ ]*1cc: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common 0+01d0 <[^>]*> ldl a0,[07]\(at\) 0+01d4 <[^>]*> ldr a0,[07]\(at\) 0+01d8 <[^>]*> lui at,0x0 [ ]*1d8: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+01dc <[^>]*> daddiu at,at,[-0-9]+ +0+01dc <[^>]*> addiu at,at,[-0-9]+ [ ]*1dc: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* 0+01e0 <[^>]*> ldl a0,[07]\(at\) 0+01e4 <[^>]*> ldr a0,[07]\(at\) 0+01e8 <[^>]*> lui at,0x0 [ ]*1e8: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+01ec <[^>]*> daddiu at,at,[-0-9]+ +0+01ec <[^>]*> addiu at,at,[-0-9]+ [ ]*1ec: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* 0+01f0 <[^>]*> ldl a0,[07]\(at\) 0+01f4 <[^>]*> ldr a0,[07]\(at\) 0+01f8 <[^>]*> lui at,[-0-9x]+ [ ]*1f8: [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+01fc <[^>]*> daddiu at,at,[-0-9]+ +0+01fc <[^>]*> addiu at,at,[-0-9]+ [ ]*1fc: [A-Z0-9_]*LO[A-Z0-9_]* .data.* 0+0200 <[^>]*> ldl a0,[07]\(at\) 0+0204 <[^>]*> ldr a0,[07]\(at\) 0+0208 <[^>]*> lui at,[-0-9x]+ [ ]*208: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+020c <[^>]*> daddiu at,at,0 +0+020c <[^>]*> addiu at,at,0 [ ]*20c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label 0+0210 <[^>]*> ldl a0,[07]\(at\) 0+0214 <[^>]*> ldr a0,[07]\(at\) 0+0218 <[^>]*> lui at,[-0-9x]+ [ ]*218: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+021c <[^>]*> daddiu at,at,0 +0+021c <[^>]*> addiu at,at,0 [ ]*21c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label 0+0220 <[^>]*> ldl a0,[07]\(at\) 0+0224 <[^>]*> ldr a0,[07]\(at\) 0+0228 <[^>]*> lui at,[-0-9x]+ [ ]*228: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+022c <[^>]*> daddiu at,at,0 +0+022c <[^>]*> addiu at,at,0 [ ]*22c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common 0+0230 <[^>]*> ldl a0,[07]\(at\) 0+0234 <[^>]*> ldr a0,[07]\(at\) 0+0238 <[^>]*> lui at,[-0-9x]+ [ ]*238: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+023c <[^>]*> daddiu at,at,0 +0+023c <[^>]*> addiu at,at,0 [ ]*23c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common 0+0240 <[^>]*> ldl a0,[07]\(at\) 0+0244 <[^>]*> ldr a0,[07]\(at\) 0+0248 <[^>]*> lui at,[-0-9x]+ [ ]*248: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+024c <[^>]*> daddiu at,at,[-0-9]+ +0+024c <[^>]*> addiu at,at,[-0-9]+ [ ]*24c: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* 0+0250 <[^>]*> ldl a0,[07]\(at\) 0+0254 <[^>]*> ldr a0,[07]\(at\) 0+0258 <[^>]*> lui at,[-0-9x]+ [ ]*258: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+025c <[^>]*> daddiu at,at,[-0-9]+ +0+025c <[^>]*> addiu at,at,[-0-9]+ [ ]*25c: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* 0+0260 <[^>]*> ldl a0,[07]\(at\) 0+0264 <[^>]*> ldr a0,[07]\(at\) 0+0268 <[^>]*> lui at,[-0-9x]+ [ ]*268: [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+026c <[^>]*> daddiu at,at,[-0-9]+ +0+026c <[^>]*> addiu at,at,[-0-9]+ [ ]*26c: [A-Z0-9_]*LO[A-Z0-9_]* .data.* 0+0270 <[^>]*> ldl a0,[07]\(at\) 0+0274 <[^>]*> ldr a0,[07]\(at\) 0+0278 <[^>]*> lui at,[-0-9x]+ [ ]*278: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+027c <[^>]*> daddiu at,at,[-0-9]+ +0+027c <[^>]*> addiu at,at,[-0-9]+ [ ]*27c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label 0+0280 <[^>]*> ldl a0,[07]\(at\) 0+0284 <[^>]*> ldr a0,[07]\(at\) 0+0288 <[^>]*> lui at,[-0-9x]+ [ ]*288: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+028c <[^>]*> daddiu at,at,[-0-9]+ +0+028c <[^>]*> addiu at,at,[-0-9]+ [ ]*28c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label 0+0290 <[^>]*> ldl a0,[07]\(at\) 0+0294 <[^>]*> ldr a0,[07]\(at\) 0+0298 <[^>]*> lui at,[-0-9x]+ [ ]*298: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+029c <[^>]*> daddiu at,at,[-0-9]+ +0+029c <[^>]*> addiu at,at,[-0-9]+ [ ]*29c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common 0+02a0 <[^>]*> ldl a0,[07]\(at\) 0+02a4 <[^>]*> ldr a0,[07]\(at\) 0+02a8 <[^>]*> lui at,[-0-9x]+ [ ]*2a8: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+02ac <[^>]*> daddiu at,at,[-0-9]+ +0+02ac <[^>]*> addiu at,at,[-0-9]+ [ ]*2ac: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common 0+02b0 <[^>]*> ldl a0,[07]\(at\) 0+02b4 <[^>]*> ldr a0,[07]\(at\) 0+02b8 <[^>]*> lui at,[-0-9x]+ [ ]*2b8: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+02bc <[^>]*> daddiu at,at,[-0-9]+ +0+02bc <[^>]*> addiu at,at,[-0-9]+ [ ]*2bc: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* 0+02c0 <[^>]*> ldl a0,[07]\(at\) 0+02c4 <[^>]*> ldr a0,[07]\(at\) 0+02c8 <[^>]*> lui at,[-0-9x]+ [ ]*2c8: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+02cc <[^>]*> daddiu at,at,[-0-9]+ +0+02cc <[^>]*> addiu at,at,[-0-9]+ [ ]*2cc: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* 0+02d0 <[^>]*> ldl a0,[07]\(at\) 0+02d4 <[^>]*> ldr a0,[07]\(at\) diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/mips/usd.d binutils-2.11.92.0.5/gas/testsuite/gas/mips/usd.d --- binutils-2.11.90.0.31/gas/testsuite/gas/mips/usd.d Fri Jul 6 09:26:11 2001 +++ binutils-2.11.92.0.5/gas/testsuite/gas/mips/usd.d Thu Oct 4 14:35:43 2001 @@ -29,241 +29,241 @@ Disassembly of section .text: 0+004c <[^>]*> sdr a0,[-0-9]+\(a1\) 0+0050 <[^>]*> lui at,[-0-9x]+ [ ]*50: [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+0054 <[^>]*> daddiu at,at,[-0-9]+ +0+0054 <[^>]*> addiu at,at,[-0-9]+ [ ]*54: [A-Z0-9_]*LO[A-Z0-9_]* .data.* 0+0058 <[^>]*> sdl a0,[07]\(at\) 0+005c <[^>]*> sdr a0,[07]\(at\) 0+0060 <[^>]*> lui at,[-0-9x]+ [ ]*60: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+0064 <[^>]*> daddiu at,at,[-0-9]+ +0+0064 <[^>]*> addiu at,at,[-0-9]+ [ ]*64: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label 0+0068 <[^>]*> sdl a0,[07]\(at\) 0+006c <[^>]*> sdr a0,[07]\(at\) -0+0070 <[^>]*> daddiu at,gp,0 +0+0070 <[^>]*> addiu at,gp,0 [ ]*70: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label 0+0074 <[^>]*> sdl a0,[07]\(at\) 0+0078 <[^>]*> sdr a0,[07]\(at\) 0+007c <[^>]*> lui at,0x0 [ ]*7c: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+0080 <[^>]*> daddiu at,at,[-0-9]+ +0+0080 <[^>]*> addiu at,at,[-0-9]+ [ ]*80: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common 0+0084 <[^>]*> sdl a0,[07]\(at\) 0+0088 <[^>]*> sdr a0,[07]\(at\) -0+008c <[^>]*> daddiu at,gp,0 +0+008c <[^>]*> addiu at,gp,0 [ ]*8c: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common 0+0090 <[^>]*> sdl a0,[07]\(at\) 0+0094 <[^>]*> sdr a0,[07]\(at\) 0+0098 <[^>]*> lui at,[-0-9x]+ [ ]*98: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+009c <[^>]*> daddiu at,at,[-0-9]+ +0+009c <[^>]*> addiu at,at,[-0-9]+ [ ]*9c: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* 0+00a0 <[^>]*> sdl a0,[07]\(at\) 0+00a4 <[^>]*> sdr a0,[07]\(at\) -0+00a8 <[^>]*> daddiu at,gp,[-0-9]+ +0+00a8 <[^>]*> addiu at,gp,[-0-9]+ [ ]*a8: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* 0+00ac <[^>]*> sdl a0,[07]\(at\) 0+00b0 <[^>]*> sdr a0,[07]\(at\) 0+00b4 <[^>]*> lui at,0x0 [ ]*b4: [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+00b8 <[^>]*> daddiu at,at,[-0-9]+ +0+00b8 <[^>]*> addiu at,at,[-0-9]+ [ ]*b8: [A-Z0-9_]*LO[A-Z0-9_]* .data.* 0+00bc <[^>]*> sdl a0,[07]\(at\) 0+00c0 <[^>]*> sdr a0,[07]\(at\) 0+00c4 <[^>]*> lui at,0x0 [ ]*c4: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+00c8 <[^>]*> daddiu at,at,[-0-9]+ +0+00c8 <[^>]*> addiu at,at,[-0-9]+ [ ]*c8: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label 0+00cc <[^>]*> sdl a0,[07]\(at\) 0+00d0 <[^>]*> sdr a0,[07]\(at\) -0+00d4 <[^>]*> daddiu at,gp,1 +0+00d4 <[^>]*> addiu at,gp,1 [ ]*d4: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_data_label 0+00d8 <[^>]*> sdl a0,[07]\(at\) 0+00dc <[^>]*> sdr a0,[07]\(at\) 0+00e0 <[^>]*> lui at,0x0 [ ]*e0: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+00e4 <[^>]*> daddiu at,at,[-0-9]+ +0+00e4 <[^>]*> addiu at,at,[-0-9]+ [ ]*e4: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common 0+00e8 <[^>]*> sdl a0,[07]\(at\) 0+00ec <[^>]*> sdr a0,[07]\(at\) -0+00f0 <[^>]*> daddiu at,gp,1 +0+00f0 <[^>]*> addiu at,gp,1 [ ]*f0: [A-Z0-9_]*GPREL[A-Z0-9_]* small_external_common 0+00f4 <[^>]*> sdl a0,[07]\(at\) 0+00f8 <[^>]*> sdr a0,[07]\(at\) 0+00fc <[^>]*> lui at,0x0 [ ]*fc: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+0100 <[^>]*> daddiu at,at,[-0-9]+ +0+0100 <[^>]*> addiu at,at,[-0-9]+ [ ]*100: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* 0+0104 <[^>]*> sdl a0,[07]\(at\) 0+0108 <[^>]*> sdr a0,[07]\(at\) -0+010c <[^>]*> daddiu at,gp,[-0-9]+ +0+010c <[^>]*> addiu at,gp,[-0-9]+ [ ]*10c: [A-Z0-9_]*GPREL[A-Z0-9_]* .sbss.* 0+0110 <[^>]*> sdl a0,[07]\(at\) 0+0114 <[^>]*> sdr a0,[07]\(at\) 0+0118 <[^>]*> lui at,[-0-9x]+ [ ]*118: [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+011c <[^>]*> daddiu at,at,[-0-9]+ +0+011c <[^>]*> addiu at,at,[-0-9]+ [ ]*11c: [A-Z0-9_]*LO[A-Z0-9_]* .data.* 0+0120 <[^>]*> sdl a0,[07]\(at\) 0+0124 <[^>]*> sdr a0,[07]\(at\) 0+0128 <[^>]*> lui at,[-0-9x]+ [ ]*128: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+012c <[^>]*> daddiu at,at,[-0-9]+ +0+012c <[^>]*> addiu at,at,[-0-9]+ [ ]*12c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label 0+0130 <[^>]*> sdl a0,[07]\(at\) 0+0134 <[^>]*> sdr a0,[07]\(at\) 0+0138 <[^>]*> lui at,[-0-9x]+ [ ]*138: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+013c <[^>]*> daddiu at,at,[-0-9]+ +0+013c <[^>]*> addiu at,at,[-0-9]+ [ ]*13c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label 0+0140 <[^>]*> sdl a0,[07]\(at\) 0+0144 <[^>]*> sdr a0,[07]\(at\) 0+0148 <[^>]*> lui at,[-0-9x]+ [ ]*148: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+014c <[^>]*> daddiu at,at,[-0-9]+ +0+014c <[^>]*> addiu at,at,[-0-9]+ [ ]*14c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common 0+0150 <[^>]*> sdl a0,[07]\(at\) 0+0154 <[^>]*> sdr a0,[07]\(at\) 0+0158 <[^>]*> lui at,[-0-9x]+ [ ]*158: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+015c <[^>]*> daddiu at,at,[-0-9]+ +0+015c <[^>]*> addiu at,at,[-0-9]+ [ ]*15c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common 0+0160 <[^>]*> sdl a0,[07]\(at\) 0+0164 <[^>]*> sdr a0,[07]\(at\) 0+0168 <[^>]*> lui at,[-0-9x]+ [ ]*168: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+016c <[^>]*> daddiu at,at,[-0-9]+ +0+016c <[^>]*> addiu at,at,[-0-9]+ [ ]*16c: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* 0+0170 <[^>]*> sdl a0,[07]\(at\) 0+0174 <[^>]*> sdr a0,[07]\(at\) 0+0178 <[^>]*> lui at,[-0-9x]+ [ ]*178: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+017c <[^>]*> daddiu at,at,[-0-9]+ +0+017c <[^>]*> addiu at,at,[-0-9]+ [ ]*17c: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* 0+0180 <[^>]*> sdl a0,[07]\(at\) 0+0184 <[^>]*> sdr a0,[07]\(at\) 0+0188 <[^>]*> lui at,0x0 [ ]*188: [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+018c <[^>]*> daddiu at,at,[-0-9]+ +0+018c <[^>]*> addiu at,at,[-0-9]+ [ ]*18c: [A-Z0-9_]*LO[A-Z0-9_]* .data.* 0+0190 <[^>]*> sdl a0,[07]\(at\) 0+0194 <[^>]*> sdr a0,[07]\(at\) 0+0198 <[^>]*> lui at,0x0 [ ]*198: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+019c <[^>]*> daddiu at,at,[-0-9]+ +0+019c <[^>]*> addiu at,at,[-0-9]+ [ ]*19c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label 0+01a0 <[^>]*> sdl a0,[07]\(at\) 0+01a4 <[^>]*> sdr a0,[07]\(at\) 0+01a8 <[^>]*> lui at,0x0 [ ]*1a8: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+01ac <[^>]*> daddiu at,at,[-0-9]+ +0+01ac <[^>]*> addiu at,at,[-0-9]+ [ ]*1ac: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label 0+01b0 <[^>]*> sdl a0,[07]\(at\) 0+01b4 <[^>]*> sdr a0,[07]\(at\) 0+01b8 <[^>]*> lui at,0x0 [ ]*1b8: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+01bc <[^>]*> daddiu at,at,[-0-9]+ +0+01bc <[^>]*> addiu at,at,[-0-9]+ [ ]*1bc: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common 0+01c0 <[^>]*> sdl a0,[07]\(at\) 0+01c4 <[^>]*> sdr a0,[07]\(at\) 0+01c8 <[^>]*> lui at,0x0 [ ]*1c8: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+01cc <[^>]*> daddiu at,at,[-0-9]+ +0+01cc <[^>]*> addiu at,at,[-0-9]+ [ ]*1cc: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common 0+01d0 <[^>]*> sdl a0,[07]\(at\) 0+01d4 <[^>]*> sdr a0,[07]\(at\) 0+01d8 <[^>]*> lui at,0x0 [ ]*1d8: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+01dc <[^>]*> daddiu at,at,[-0-9]+ +0+01dc <[^>]*> addiu at,at,[-0-9]+ [ ]*1dc: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* 0+01e0 <[^>]*> sdl a0,[07]\(at\) 0+01e4 <[^>]*> sdr a0,[07]\(at\) 0+01e8 <[^>]*> lui at,0x0 [ ]*1e8: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+01ec <[^>]*> daddiu at,at,[-0-9]+ +0+01ec <[^>]*> addiu at,at,[-0-9]+ [ ]*1ec: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* 0+01f0 <[^>]*> sdl a0,[07]\(at\) 0+01f4 <[^>]*> sdr a0,[07]\(at\) 0+01f8 <[^>]*> lui at,[-0-9x]+ [ ]*1f8: [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+01fc <[^>]*> daddiu at,at,[-0-9]+ +0+01fc <[^>]*> addiu at,at,[-0-9]+ [ ]*1fc: [A-Z0-9_]*LO[A-Z0-9_]* .data.* 0+0200 <[^>]*> sdl a0,[07]\(at\) 0+0204 <[^>]*> sdr a0,[07]\(at\) 0+0208 <[^>]*> lui at,[-0-9x]+ [ ]*208: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+020c <[^>]*> daddiu at,at,0 +0+020c <[^>]*> addiu at,at,0 [ ]*20c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label 0+0210 <[^>]*> sdl a0,[07]\(at\) 0+0214 <[^>]*> sdr a0,[07]\(at\) 0+0218 <[^>]*> lui at,[-0-9x]+ [ ]*218: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+021c <[^>]*> daddiu at,at,0 +0+021c <[^>]*> addiu at,at,0 [ ]*21c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label 0+0220 <[^>]*> sdl a0,[07]\(at\) 0+0224 <[^>]*> sdr a0,[07]\(at\) 0+0228 <[^>]*> lui at,[-0-9x]+ [ ]*228: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+022c <[^>]*> daddiu at,at,0 +0+022c <[^>]*> addiu at,at,0 [ ]*22c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common 0+0230 <[^>]*> sdl a0,[07]\(at\) 0+0234 <[^>]*> sdr a0,[07]\(at\) 0+0238 <[^>]*> lui at,[-0-9x]+ [ ]*238: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+023c <[^>]*> daddiu at,at,0 +0+023c <[^>]*> addiu at,at,0 [ ]*23c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common 0+0240 <[^>]*> sdl a0,[07]\(at\) 0+0244 <[^>]*> sdr a0,[07]\(at\) 0+0248 <[^>]*> lui at,[-0-9x]+ [ ]*248: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+024c <[^>]*> daddiu at,at,[-0-9]+ +0+024c <[^>]*> addiu at,at,[-0-9]+ [ ]*24c: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* 0+0250 <[^>]*> sdl a0,[07]\(at\) 0+0254 <[^>]*> sdr a0,[07]\(at\) 0+0258 <[^>]*> lui at,[-0-9x]+ [ ]*258: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+025c <[^>]*> daddiu at,at,[-0-9]+ +0+025c <[^>]*> addiu at,at,[-0-9]+ [ ]*25c: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* 0+0260 <[^>]*> sdl a0,[07]\(at\) 0+0264 <[^>]*> sdr a0,[07]\(at\) 0+0268 <[^>]*> lui at,[-0-9x]+ [ ]*268: [A-Z0-9_]*HI[A-Z0-9_]* .data.* -0+026c <[^>]*> daddiu at,at,[-0-9]+ +0+026c <[^>]*> addiu at,at,[-0-9]+ [ ]*26c: [A-Z0-9_]*LO[A-Z0-9_]* .data.* 0+0270 <[^>]*> sdl a0,[07]\(at\) 0+0274 <[^>]*> sdr a0,[07]\(at\) 0+0278 <[^>]*> lui at,[-0-9x]+ [ ]*278: [A-Z0-9_]*HI[A-Z0-9_]* big_external_data_label -0+027c <[^>]*> daddiu at,at,[-0-9]+ +0+027c <[^>]*> addiu at,at,[-0-9]+ [ ]*27c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_data_label 0+0280 <[^>]*> sdl a0,[07]\(at\) 0+0284 <[^>]*> sdr a0,[07]\(at\) 0+0288 <[^>]*> lui at,[-0-9x]+ [ ]*288: [A-Z0-9_]*HI[A-Z0-9_]* small_external_data_label -0+028c <[^>]*> daddiu at,at,[-0-9]+ +0+028c <[^>]*> addiu at,at,[-0-9]+ [ ]*28c: [A-Z0-9_]*LO[A-Z0-9_]* small_external_data_label 0+0290 <[^>]*> sdl a0,[07]\(at\) 0+0294 <[^>]*> sdr a0,[07]\(at\) 0+0298 <[^>]*> lui at,[-0-9x]+ [ ]*298: [A-Z0-9_]*HI[A-Z0-9_]* big_external_common -0+029c <[^>]*> daddiu at,at,[-0-9]+ +0+029c <[^>]*> addiu at,at,[-0-9]+ [ ]*29c: [A-Z0-9_]*LO[A-Z0-9_]* big_external_common 0+02a0 <[^>]*> sdl a0,[07]\(at\) 0+02a4 <[^>]*> sdr a0,[07]\(at\) 0+02a8 <[^>]*> lui at,[-0-9x]+ [ ]*2a8: [A-Z0-9_]*HI[A-Z0-9_]* small_external_common -0+02ac <[^>]*> daddiu at,at,[-0-9]+ +0+02ac <[^>]*> addiu at,at,[-0-9]+ [ ]*2ac: [A-Z0-9_]*LO[A-Z0-9_]* small_external_common 0+02b0 <[^>]*> sdl a0,[07]\(at\) 0+02b4 <[^>]*> sdr a0,[07]\(at\) 0+02b8 <[^>]*> lui at,[-0-9x]+ [ ]*2b8: [A-Z0-9_]*HI[A-Z0-9_]* .bss.* -0+02bc <[^>]*> daddiu at,at,[-0-9]+ +0+02bc <[^>]*> addiu at,at,[-0-9]+ [ ]*2bc: [A-Z0-9_]*LO[A-Z0-9_]* .bss.* 0+02c0 <[^>]*> sdl a0,[07]\(at\) 0+02c4 <[^>]*> sdr a0,[07]\(at\) 0+02c8 <[^>]*> lui at,[-0-9x]+ [ ]*2c8: [A-Z0-9_]*HI[A-Z0-9_]* .sbss.* -0+02cc <[^>]*> daddiu at,at,[-0-9]+ +0+02cc <[^>]*> addiu at,at,[-0-9]+ [ ]*2cc: [A-Z0-9_]*LO[A-Z0-9_]* .sbss.* 0+02d0 <[^>]*> sdl a0,[07]\(at\) 0+02d4 <[^>]*> sdr a0,[07]\(at\) diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/s390/opcode.d binutils-2.11.92.0.5/gas/testsuite/gas/s390/opcode.d --- binutils-2.11.90.0.31/gas/testsuite/gas/s390/opcode.d Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/gas/testsuite/gas/s390/opcode.d Mon Oct 1 15:25:25 2001 @@ -0,0 +1,425 @@ +#name: s390 opcode +#objdump: -drw + +.*: +file format .* + +Disassembly of section .text: + +.* : + 0: 5a 65 af ff [ ]*a %r6,4095\(%r5,%r10\) + 4: 6a 65 af ff [ ]*ad %f6,4095\(%r5,%r10\) + 8: ed 65 af ff 00 1a [ ]*adb %f6,4095\(%r5,%r10\) + e: b3 1a 00 69 [ ]*adbr %f6,%f9 + 12: 2a 69 [ ]*adr %f6,%f9 + 14: 7a 65 af ff [ ]*ae %f6,4095\(%r5,%r10\) + 18: ed 65 af ff 00 0a [ ]*aeb %f6,4095\(%r5,%r10\) + 1e: b3 0a 00 69 [ ]*aebr %f6,%f9 + 22: 3a 69 [ ]*aer %f6,%f9 + 24: 4a 65 af ff [ ]*ah %r6,4095\(%r5,%r10\) + 28: a7 6a 80 01 [ ]*ahi %r6,-32767 + 2c: 5e 65 af ff [ ]*al %r6,4095\(%r5,%r10\) + 30: 1e 69 [ ]*alr %r6,%r9 + 32: fa 58 5f ff af ff [ ]*ap 4095\(6,%r5\),4095\(9,%r10\) + 38: 1a 69 [ ]*ar %r6,%r9 + 3a: 7e 65 af ff [ ]*au %f6,4095\(%r5,%r10\) + 3e: 3e 69 [ ]*aur %f6,%f9 + 40: 6e 65 af ff [ ]*aw %f6,4095\(%r5,%r10\) + 44: 2e 69 [ ]*awr %f6,%f9 + 46: b3 4a 00 69 [ ]*axbr %f6,%f9 + 4a: 36 69 [ ]*axr %f6,%f9 + 4c: 47 f5 af ff [ ]*b 4095\(%r5,%r10\) + 50: b2 40 00 69 [ ]*bakr %r6,%r9 + 54: 45 65 af ff [ ]*bal %r6,4095\(%r5,%r10\) + 58: 05 69 [ ]*balr %r6,%r9 + 5a: 4d 65 af ff [ ]*bas %r6,4095\(%r5,%r10\) + 5e: 0d 69 [ ]*basr %r6,%r9 + 60: 0c 69 [ ]*bassm %r6,%r9 + 62: 47 65 af ff [ ]*blh 4095\(%r5,%r10\) + 66: 07 69 [ ]*blhr %r9 + 68: 46 65 af ff [ ]*bct %r6,4095\(%r5,%r10\) + 6c: 06 69 [ ]*bctr %r6,%r9 + 6e: 47 85 af ff [ ]*be 4095\(%r5,%r10\) + 72: 07 89 [ ]*ber %r9 + 74: 47 25 af ff [ ]*bh 4095\(%r5,%r10\) + 78: 47 a5 af ff [ ]*bhe 4095\(%r5,%r10\) + 7c: 07 a9 [ ]*bher %r9 + 7e: 07 29 [ ]*bhr %r9 + 80: 47 45 af ff [ ]*bl 4095\(%r5,%r10\) + 84: 47 c5 af ff [ ]*ble 4095\(%r5,%r10\) + 88: 07 c9 [ ]*bler %r9 + 8a: 47 65 af ff [ ]*blh 4095\(%r5,%r10\) + 8e: 07 69 [ ]*blhr %r9 + 90: 07 49 [ ]*blr %r9 + 92: 47 45 af ff [ ]*bl 4095\(%r5,%r10\) + 96: 07 49 [ ]*blr %r9 + 98: 47 75 af ff [ ]*bne 4095\(%r5,%r10\) + 9c: 07 79 [ ]*bner %r9 + 9e: 47 d5 af ff [ ]*bnh 4095\(%r5,%r10\) + a2: 47 55 af ff [ ]*bnhe 4095\(%r5,%r10\) + a6: 07 59 [ ]*bnher %r9 + a8: 07 d9 [ ]*bnhr %r9 + aa: 47 b5 af ff [ ]*bnl 4095\(%r5,%r10\) + ae: 47 35 af ff [ ]*bnle 4095\(%r5,%r10\) + b2: 07 39 [ ]*bnler %r9 + b4: 47 95 af ff [ ]*bnlh 4095\(%r5,%r10\) + b8: 07 99 [ ]*bnlhr %r9 + ba: 07 b9 [ ]*bnlr %r9 + bc: 47 b5 af ff [ ]*bnl 4095\(%r5,%r10\) + c0: 07 b9 [ ]*bnlr %r9 + c2: 47 e5 af ff [ ]*bno 4095\(%r5,%r10\) + c6: 07 e9 [ ]*bnor %r9 + c8: 47 d5 af ff [ ]*bnh 4095\(%r5,%r10\) + cc: 07 d9 [ ]*bnhr %r9 + ce: 47 75 af ff [ ]*bne 4095\(%r5,%r10\) + d2: 07 79 [ ]*bner %r9 + d4: 47 15 af ff [ ]*bo 4095\(%r5,%r10\) + d8: 07 19 [ ]*bor %r9 + da: 47 25 af ff [ ]*bh 4095\(%r5,%r10\) + de: 07 29 [ ]*bhr %r9 + e0: 07 f9 [ ]*br %r9 + e2: a7 95 00 00 [ ]*bras %r9,e2 + e6: a7 64 00 00 [ ]*jlh e6 + ea: a7 66 00 00 [ ]*brct %r6,ea + ee: 84 69 00 00 [ ]*brxh %r6,%r9,ee + f2: 85 69 00 00 [ ]*brxle %r6,%r9,f2 + f6: b2 5a 00 69 [ ]*bsa %r6,%r9 + fa: b2 58 00 69 [ ]*bsg %r6,%r9 + fe: 0b 69 [ ]*bsm %r6,%r9 + 100: 86 69 5f ff [ ]*bxh %r6,%r9,4095\(%r5\) + 104: 87 69 5f ff [ ]*bxle %r6,%r9,4095\(%r5\) + 108: 47 85 af ff [ ]*be 4095\(%r5,%r10\) + 10c: 07 89 [ ]*ber %r9 + 10e: 59 65 af ff [ ]*c %r6,4095\(%r5,%r10\) + 112: 69 65 af ff [ ]*cd %f6,4095\(%r5,%r10\) + 116: ed 65 af ff 00 19 [ ]*cdb %f6,4095\(%r5,%r10\) + 11c: b3 19 00 69 [ ]*cdbr %f6,%f9 + 120: b3 95 00 69 [ ]*cdfbr %r6,%f9 + 124: 29 69 [ ]*cdr %f6,%f9 + 126: bb 69 5f ff [ ]*cds %r6,%r9,4095\(%r5\) + 12a: 79 65 af ff [ ]*ce %f6,4095\(%r5,%r10\) + 12e: ed 65 af ff 00 09 [ ]*ceb %f6,4095\(%r5,%r10\) + 134: b3 09 00 69 [ ]*cebr %f6,%f9 + 138: b3 94 00 69 [ ]*cefbr %r6,%f9 + 13c: 39 69 [ ]*cer %f6,%f9 + 13e: b2 1a 5f ff [ ]*cfc 4095\(%r5\) + 142: b3 99 50 69 [ ]*cfdbr %f6,5,%r9 + 146: b3 98 50 69 [ ]*cfebr %f6,5,%r9 + 14a: b3 9a 50 69 [ ]*cfxbr %f6,5,%r9 + 14e: 49 65 af ff [ ]*ch %r6,4095\(%r5,%r10\) + 152: a7 6e 80 01 [ ]*chi %r6,-32767 + 156: b2 41 00 69 [ ]*cksm %r6,%r9 + 15a: 55 65 af ff [ ]*cl %r6,4095\(%r5,%r10\) + 15e: d5 ff 5f ff af ff [ ]*clc 4095\(256,%r5\),4095\(%r10\) + 164: 0f 69 [ ]*clcl %r6,%r9 + 166: a9 69 00 0a [ ]*clcle %r6,%r9,10 + 16a: 95 ff 5f ff [ ]*cli 4095\(%r5\),255 + 16e: bd 6a 5f ff [ ]*clm %r6,10,4095\(%r5\) + 172: 15 69 [ ]*clr %r6,%r9 + 174: b2 5d 00 69 [ ]*clst %r6,%r9 + 178: b2 63 00 69 [ ]*cmpsc %r6,%r9 + 17c: f9 58 5f ff af ff [ ]*cp 4095\(6,%r5\),4095\(9,%r10\) + 182: b2 4d 00 69 [ ]*cpya %a6,%a9 + 186: 19 69 [ ]*cr %r6,%r9 + 188: ba 69 5f ff [ ]*cs %r6,%r9,4095\(%r5\) + 18c: b2 30 00 00 [ ]*csch + 190: b2 50 00 69 [ ]*csp %r6,%r9 + 194: b2 57 00 69 [ ]*cuse %r6,%r9 + 198: b2 a7 00 69 [ ]*cutfu %r6,%r9 + 19c: b2 a6 00 69 [ ]*cuutf %r6,%r9 + 1a0: 4f 65 af ff [ ]*cvb %r6,4095\(%r5,%r10\) + 1a4: 4e 65 af ff [ ]*cvd %r6,4095\(%r5,%r10\) + 1a8: b3 49 00 69 [ ]*cxbr %f6,%f9 + 1ac: b3 96 00 69 [ ]*cxfbr %r6,%f9 + 1b0: 5d 65 af ff [ ]*d %r6,4095\(%r5,%r10\) + 1b4: 6d 65 af ff [ ]*dd %f6,4095\(%r5,%r10\) + 1b8: ed 65 af ff 00 1d [ ]*ddb %f6,4095\(%r5,%r10\) + 1be: b3 1d 00 69 [ ]*ddbr %f6,%f9 + 1c2: 2d 69 [ ]*ddr %f6,%f9 + 1c4: 7d 65 af ff [ ]*de %f6,4095\(%r5,%r10\) + 1c8: ed 65 af ff 00 0d [ ]*deb %f6,4095\(%r5,%r10\) + 1ce: b3 0d 00 69 [ ]*debr %f6,%f9 + 1d2: 3d 69 [ ]*der %f6,%f9 + 1d4: 83 69 5f ff [ ]*diag %r6,%r9,4095\(%r5\) + 1d8: b3 5b 9a 65 [ ]*didbr %f6,%f9,%f5,10 + 1dc: b3 53 9a 65 [ ]*diebr %f6,%f9,%f5,10 + 1e0: fd 58 5f ff af ff [ ]*dp 4095\(6,%r5\),4095\(9,%r10\) + 1e6: 1d 69 [ ]*dr %r6,%r9 + 1e8: b3 4d 00 69 [ ]*dxbr %f6,%f9 + 1ec: b2 2d 00 60 [ ]*dxr %f6 + 1f0: b2 4f 00 69 [ ]*ear %r6,%a9 + 1f4: de ff 5f ff af ff [ ]*ed 4095\(256,%r5\),4095\(%r10\) + 1fa: df ff 5f ff af ff [ ]*edmk 4095\(256,%r5\),4095\(%r10\) + 200: b3 8c 00 69 [ ]*efpc %r6,%r9 + 204: b2 26 00 60 [ ]*epar %r6 + 208: b2 49 00 69 [ ]*ereg %r6,%r9 + 20c: b2 27 00 60 [ ]*esar %r6 + 210: b2 4a 00 69 [ ]*esta %r6,%r9 + 214: 44 60 5f ff [ ]*ex %r6,4095\(%r5\) + 218: b3 5f 50 69 [ ]*fidbr %f6,5,%f9 + 21c: b3 57 50 69 [ ]*fiebr %f6,5,%f9 + 220: b3 47 50 69 [ ]*fixbr %f6,5,%f9 + 224: 24 69 [ ]*hdr %f6,%f9 + 226: 34 69 [ ]*her %f6,%f9 + 228: b2 31 00 00 [ ]*hsch + 22c: b2 24 00 60 [ ]*iac %r6 + 230: 43 65 af ff [ ]*ic %r6,4095\(%r5,%r10\) + 234: bf 6a 5f ff [ ]*icm %r6,10,4095\(%r5\) + 238: b2 0b 00 00 [ ]*ipk + 23c: b2 22 00 60 [ ]*ipm %r6 + 240: b2 21 00 69 [ ]*ipte %r6,%r9 + 244: b2 29 00 69 [ ]*iske %r6,%r9 + 248: b2 23 00 69 [ ]*ivsk %r6,%r9 + 24c: a7 f4 00 00 [ ]*j 24c + 250: a7 84 00 00 [ ]*je 250 + 254: a7 24 00 00 [ ]*jh 254 + 258: a7 a4 00 00 [ ]*jhe 258 + 25c: a7 44 00 00 [ ]*jl 25c + 260: a7 c4 00 00 [ ]*jle 260 + 264: a7 64 00 00 [ ]*jlh 264 + 268: a7 44 00 00 [ ]*jl 268 + 26c: a7 74 00 00 [ ]*jne 26c + 270: a7 54 00 00 [ ]*jnhe 270 + 274: a7 b4 00 00 [ ]*jnl 274 + 278: a7 34 00 00 [ ]*jnle 278 + 27c: a7 94 00 00 [ ]*jnlh 27c + 280: a7 b4 00 00 [ ]*jnl 280 + 284: a7 e4 00 00 [ ]*jno 284 + 288: a7 d4 00 00 [ ]*jnh 288 + 28c: a7 74 00 00 [ ]*jne 28c + 290: a7 14 00 00 [ ]*jo 290 + 294: a7 24 00 00 [ ]*jh 294 + 298: a7 84 00 00 [ ]*je 298 + 29c: ed 65 af ff 00 18 [ ]*kdb %f6,4095\(%r5,%r10\) + 2a2: b3 18 00 69 [ ]*kdbr %f6,%f9 + 2a6: ed 65 af ff 00 08 [ ]*keb %f6,4095\(%r5,%r10\) + 2ac: b3 08 00 69 [ ]*kebr %f6,%f9 + 2b0: b3 48 00 69 [ ]*kxbr %f6,%f9 + 2b4: 58 65 af ff [ ]*l %r6,4095\(%r5,%r10\) + 2b8: 41 65 af ff [ ]*la %r6,4095\(%r5,%r10\) + 2bc: 51 65 af ff [ ]*lae %r6,4095\(%r5,%r10\) + 2c0: 9a 69 5f ff [ ]*lam %a6,%a9,4095\(%r5\) + 2c4: e5 00 5f ff af ff [ ]*lasp 4095\(%r5\),4095\(%r10\) + 2ca: b3 13 00 69 [ ]*lcdbr %f6,%f9 + 2ce: 23 69 [ ]*lcdr %f6,%f9 + 2d0: b3 03 00 69 [ ]*lcebr %f6,%f9 + 2d4: 33 69 [ ]*lcer %f6,%f9 + 2d6: 13 69 [ ]*lcr %r6,%r9 + 2d8: b7 69 5f ff [ ]*lctl %c6,%c9,4095\(%r5\) + 2dc: b3 43 00 69 [ ]*lcxbr %f6,%f9 + 2e0: 68 60 5f ff [ ]*ld %f6,4095\(%r5\) + 2e4: ed 60 5f ff 00 04 [ ]*ldeb %f6,4095\(%r5\) + 2ea: b3 04 00 69 [ ]*ldebr %f6,%f9 + 2ee: 28 69 [ ]*ldr %f6,%f9 + 2f0: b3 45 00 69 [ ]*ldxbr %f6,%f9 + 2f4: 78 60 5f ff [ ]*le %f6,4095\(%r5\) + 2f8: b3 44 00 69 [ ]*ledbr %f6,%f9 + 2fc: 38 69 [ ]*ler %f6,%f9 + 2fe: b3 46 00 69 [ ]*lexbr %f6,%f9 + 302: b2 9d 5f ff [ ]*lfpc 4095\(%r5\) + 306: 48 60 5f ff [ ]*lh %r6,4095\(%r5\) + 30a: a7 68 80 01 [ ]*lhi %r6,-32767 + 30e: 98 69 5f ff [ ]*lm %r6,%r9,4095\(%r5\) + 312: b3 11 00 69 [ ]*lndbr %f6,%f9 + 316: 21 69 [ ]*lndr %f6,%f9 + 318: b3 01 00 69 [ ]*lnebr %f6,%f9 + 31c: 31 69 [ ]*lner %f6,%f9 + 31e: 11 69 [ ]*lnr %r6,%r9 + 320: b3 41 00 69 [ ]*lnxbr %f6,%f9 + 324: b3 10 00 69 [ ]*lpdbr %f6,%f9 + 328: 20 69 [ ]*lpdr %f6,%f9 + 32a: b3 00 00 69 [ ]*lpebr %f6,%f9 + 32e: 30 69 [ ]*lper %f6,%f9 + 330: 10 69 [ ]*lpr %r6,%r9 + 332: 82 00 5f ff [ ]*lpsw 4095\(%r5\) + 336: b3 40 00 69 [ ]*lpxbr %f6,%f9 + 33a: 18 69 [ ]*lr %r6,%r9 + 33c: b1 65 af ff [ ]*lra %r6,4095\(%r5,%r10\) + 340: 25 69 [ ]*lrdr %f6,%f9 + 342: 35 69 [ ]*lrer %f6,%f9 + 344: b3 12 00 69 [ ]*ltdbr %f6,%f9 + 348: 22 69 [ ]*ltdr %f6,%f9 + 34a: b3 02 00 69 [ ]*ltebr %f6,%f9 + 34e: 32 69 [ ]*lter %f6,%f9 + 350: 12 69 [ ]*ltr %r6,%r9 + 352: b3 42 00 69 [ ]*ltxbr %f6,%f9 + 356: b2 4b 00 69 [ ]*lura %r6,%r9 + 35a: ed 65 af ff 00 05 [ ]*lxdb %f6,4095\(%r5,%r10\) + 360: b3 05 00 69 [ ]*lxdbr %f6,%f9 + 364: ed 65 af ff 00 06 [ ]*lxeb %f6,4095\(%r5,%r10\) + 36a: b3 06 00 69 [ ]*lxebr %f6,%f9 + 36e: 5c 65 af ff [ ]*m %r6,4095\(%r5,%r10\) + 372: ed 95 af ff 60 1e [ ]*madb %f6,%f9,4095\(%r5,%r10\) + 378: b3 1e 60 95 [ ]*madbr %f6,%f9,%f5 + 37c: ed 95 af ff 60 0e [ ]*maeb %f6,%f9,4095\(%r5,%r10\) + 382: b3 0e 60 95 [ ]*maebr %f6,%f9,%f5 + 386: af 06 5f ff [ ]*mc 4095\(%r5\),6 + 38a: 6c 65 af ff [ ]*md %f6,4095\(%r5,%r10\) + 38e: ed 65 af ff 00 1c [ ]*mdb %f6,4095\(%r5,%r10\) + 394: b3 1c 00 69 [ ]*mdbr %f6,%f9 + 398: ed 65 af ff 00 0c [ ]*mdeb %f6,4095\(%r5,%r10\) + 39e: b3 0c 00 69 [ ]*mdebr %f6,%f9 + 3a2: 2c 69 [ ]*mdr %f6,%f9 + 3a4: 7c 65 af ff [ ]*me %f6,4095\(%r5,%r10\) + 3a8: ed 65 af ff 00 17 [ ]*meeb %f6,4095\(%r5,%r10\) + 3ae: b3 17 00 69 [ ]*meebr %f6,%f9 + 3b2: 3c 69 [ ]*mer %f6,%f9 + 3b4: 4c 65 af ff [ ]*mh %r6,4095\(%r5,%r10\) + 3b8: a7 6c 80 01 [ ]*mhi %r6,-32767 + 3bc: fc ff 5f ff af ff [ ]*mp 4095\(16,%r5\),4095\(16,%r10\) + 3c2: 1c 69 [ ]*mr %r6,%r9 + 3c4: 71 65 af ff [ ]*ms %r6,4095\(%r5,%r10\) + 3c8: b2 32 5f ff [ ]*msch 4095\(%r5\) + 3cc: ed 95 af ff 60 1f [ ]*msdb %f6,%f9,4095\(%r5,%r10\) + 3d2: b3 1f 60 95 [ ]*msdbr %f6,%f9,%f5 + 3d6: ed 95 af ff 60 0f [ ]*mseb %f6,%f9,4095\(%r5,%r10\) + 3dc: b3 0f 60 95 [ ]*msebr %f6,%f9,%f5 + 3e0: b2 52 00 69 [ ]*msr %r6,%r9 + 3e4: b2 47 00 60 [ ]*msta %r6 + 3e8: d2 ff 5f ff af ff [ ]*mvc 4095\(256,%r5\),4095\(%r10\) + 3ee: e5 0f 5f ff af ff [ ]*mvcdk 4095\(%r5\),4095\(%r10\) + 3f4: e8 ff 5f ff af ff [ ]*mvcin 4095\(256,%r5\),4095\(%r10\) + 3fa: d9 69 5f ff af ff [ ]*mvck 4095\(%r6,%r5\),4095\(%r10\),%r9 + 400: 0e 69 [ ]*mvcl %r6,%r9 + 402: a8 69 00 0a [ ]*mvcle %r6,%r9,10 + 406: da 69 5f ff af ff [ ]*mvcp 4095\(%r6,%r5\),4095\(%r10\),%r9 + 40c: db 69 5f ff af ff [ ]*mvcs 4095\(%r6,%r5\),4095\(%r10\),%r9 + 412: e5 0e 5f ff af ff [ ]*mvcsk 4095\(%r5\),4095\(%r10\) + 418: 92 ff 5f ff [ ]*mvi 4095\(%r5\),255 + 41c: d1 ff 5f ff af ff [ ]*mvn 4095\(256,%r5\),4095\(%r10\) + 422: f1 ff 5f ff af ff [ ]*mvo 4095\(16,%r5\),4095\(16,%r10\) + 428: b2 54 00 69 [ ]*mvpg %r6,%r9 + 42c: b2 55 00 69 [ ]*mvst %r6,%r9 + 430: d3 ff 5f ff af ff [ ]*mvz 4095\(256,%r5\),4095\(%r10\) + 436: b3 4c 00 69 [ ]*mxbr %f6,%f9 + 43a: 67 65 af ff [ ]*mxd %f6,4095\(%r5,%r10\) + 43e: ed 65 af ff 00 07 [ ]*mxdb %f6,4095\(%r5,%r10\) + 444: b3 07 00 69 [ ]*mxdbr %f6,%f9 + 448: 27 69 [ ]*mxdr %f6,%f9 + 44a: 26 69 [ ]*mxr %f6,%f9 + 44c: 54 65 af ff [ ]*n %r6,4095\(%r5,%r10\) + 450: d4 ff 5f ff af ff [ ]*nc 4095\(256,%r5\),4095\(%r10\) + 456: 94 ff 5f ff [ ]*ni 4095\(%r5\),255 + 45a: 47 05 af ff [ ]*bc 0,4095\(%r5,%r10\) + 45e: 07 06 [ ]*bcr 0,%r6 + 460: 14 69 [ ]*nr %r6,%r9 + 462: 56 65 af ff [ ]*o %r6,4095\(%r5,%r10\) + 466: d6 ff 5f ff af ff [ ]*oc 4095\(256,%r5\),4095\(%r10\) + 46c: 96 ff 5f ff [ ]*oi 4095\(%r5\),255 + 470: 16 69 [ ]*or %r6,%r9 + 472: f2 ff 5f ff af ff [ ]*pack 4095\(16,%r5\),4095\(16,%r10\) + 478: b2 48 00 00 [ ]*palb + 47c: b2 18 5f ff [ ]*pc 4095\(%r5\) + 480: ee 69 5f ff af ff [ ]*plo %r6,4095\(%r5\),%r9,4095\(%r10\) + 486: 01 01 [ ]*pr + 488: b2 28 00 69 [ ]*pt %r6,%r9 + 48c: b2 0d 00 00 [ ]*ptlb + 490: b2 3b 00 00 [ ]*rchp + 494: b2 77 5f ff [ ]*rp 4095\(%r5\) + 498: b2 2a 00 69 [ ]*rrbe %r6,%r9 + 49c: b2 38 00 00 [ ]*rsch + 4a0: 5b 65 af ff [ ]*s %r6,4095\(%r5,%r10\) + 4a4: b2 19 5f ff [ ]*sac 4095\(%r5\) + 4a8: b2 79 5f ff [ ]*sacf 4095\(%r5\) + 4ac: b2 37 00 00 [ ]*sal + 4b0: b2 4e 00 69 [ ]*sar %a6,%r9 + 4b4: b2 3c 00 00 [ ]*schm + 4b8: b2 04 5f ff [ ]*sck 4095\(%r5\) + 4bc: b2 06 5f ff [ ]*sckc 4095\(%r5\) + 4c0: 01 07 [ ]*sckpf + 4c2: 6b 65 af ff [ ]*sd %f6,4095\(%r5,%r10\) + 4c6: ed 65 af ff 00 1b [ ]*sdb %f6,4095\(%r5,%r10\) + 4cc: b3 1b 00 69 [ ]*sdbr %f6,%f9 + 4d0: 2b 69 [ ]*sdr %f6,%f9 + 4d2: 7b 65 af ff [ ]*se %f6,4095\(%r5,%r10\) + 4d6: ed 65 af ff 00 0b [ ]*seb %f6,4095\(%r5,%r10\) + 4dc: b3 0b 00 69 [ ]*sebr %f6,%f9 + 4e0: 3b 69 [ ]*ser %f6,%f9 + 4e2: b3 84 00 69 [ ]*sfpc %r6,%r9 + 4e6: 4b 65 af ff [ ]*sh %r6,4095\(%r5,%r10\) + 4ea: b2 14 5f ff [ ]*sie 4095\(%r5\) + 4ee: b2 74 5f ff [ ]*siga 4095\(%r5\) + 4f2: ae 69 5f ff [ ]*sigp %r6,%r9,4095\(%r5\) + 4f6: 5f 65 af ff [ ]*sl %r6,4095\(%r5,%r10\) + 4fa: 8b 60 5f ff [ ]*sla %r6,4095\(%r5\) + 4fe: 8f 60 5f ff [ ]*slda %r6,4095\(%r5\) + 502: 8d 60 5f ff [ ]*sldl %r6,4095\(%r5\) + 506: 89 60 5f ff [ ]*sll %r6,4095\(%r5\) + 50a: 1f 69 [ ]*slr %r6,%r9 + 50c: fb ff 5f ff af ff [ ]*sp 4095\(16,%r5\),4095\(16,%r10\) + 512: b2 0a 5f ff [ ]*spka 4095\(%r5\) + 516: 04 60 [ ]*spm %r6 + 518: b2 08 5f ff [ ]*spt 4095\(%r5\) + 51c: b2 10 5f ff [ ]*spx 4095\(%r5\) + 520: ed 65 af ff 00 15 [ ]*sqdb %f6,4095\(%r5,%r10\) + 526: b3 15 00 69 [ ]*sqdbr %f6,%f9 + 52a: b2 44 00 60 [ ]*sqdr %f6 + 52e: ed 65 af ff 00 14 [ ]*sqeb %f6,4095\(%r5,%r10\) + 534: b3 14 00 69 [ ]*sqebr %f6,%f9 + 538: b2 45 00 60 [ ]*sqer %f6 + 53c: b3 16 00 69 [ ]*sqxbr %f6,%f9 + 540: 1b 69 [ ]*sr %r6,%r9 + 542: 8a 60 5f ff [ ]*sra %r6,4095\(%r5\) + 546: 8e 60 5f ff [ ]*srda %r6,4095\(%r5\) + 54a: 8c 60 5f ff [ ]*srdl %r6,4095\(%r5\) + 54e: 88 60 5f ff [ ]*srl %r6,4095\(%r5\) + 552: b2 99 5f ff [ ]*srnm 4095\(%r5\) + 556: f0 fa 5f ff af ff [ ]*srp 4095\(16,%r5\),4095\(%r10\),10 + 55c: b2 5e 00 69 [ ]*srst %r6,%r9 + 560: b2 25 00 60 [ ]*ssar %r6 + 564: b2 33 5f ff [ ]*ssch 4095\(%r5\) + 568: b2 2b 00 69 [ ]*sske %r6,%r9 + 56c: 80 00 5f ff [ ]*ssm 4095\(%r5\) + 570: 50 65 af ff [ ]*st %r6,4095\(%r5,%r10\) + 574: 9b 69 5f ff [ ]*stam %a6,%a9,4095\(%r5\) + 578: b2 12 5f ff [ ]*stap 4095\(%r5\) + 57c: 42 65 af ff [ ]*stc %r6,4095\(%r5,%r10\) + 580: b2 05 5f ff [ ]*stck 4095\(%r5\) + 584: b2 07 5f ff [ ]*stckc 4095\(%r5\) + 588: be 6f 5f ff [ ]*stcm %r6,15,4095\(%r5\) + 58c: b2 3a 5f ff [ ]*stcps 4095\(%r5\) + 590: b2 39 5f ff [ ]*stcrw 4095\(%r5\) + 594: b6 69 5f ff [ ]*stctl %c6,%c9,4095\(%r5\) + 598: 60 65 af ff [ ]*std %f6,4095\(%r5,%r10\) + 59c: 70 65 af ff [ ]*ste %f6,4095\(%r5,%r10\) + 5a0: b2 9c 5f ff [ ]*stfpc 4095\(%r5\) + 5a4: 40 65 af ff [ ]*sth %r6,4095\(%r5,%r10\) + 5a8: b2 02 5f ff [ ]*stidp 4095\(%r5\) + 5ac: 90 69 5f ff [ ]*stm %r6,%r9,4095\(%r5\) + 5b0: ac ff 5f ff [ ]*stnsm 4095\(%r5\),255 + 5b4: ad ff 5f ff [ ]*stosm 4095\(%r5\),255 + 5b8: b2 09 5f ff [ ]*stpt 4095\(%r5\) + 5bc: b2 11 5f ff [ ]*stpx 4095\(%r5\) + 5c0: b2 34 5f ff [ ]*stsch 4095\(%r5\) + 5c4: b2 7d 5f ff [ ]*stsi 4095\(%r5\) + 5c8: b2 46 00 69 [ ]*stura %r6,%r9 + 5cc: 7f 65 af ff [ ]*su %f6,4095\(%r5,%r10\) + 5d0: 3f 69 [ ]*sur %f6,%f9 + 5d2: 0a ff [ ]*svc 255 + 5d4: 6f 65 af ff [ ]*sw %f6,4095\(%r5,%r10\) + 5d8: 2f 69 [ ]*swr %f6,%f9 + 5da: b3 4b 00 69 [ ]*sxbr %f6,%f9 + 5de: 37 69 [ ]*sxr %f6,%f9 + 5e0: b2 4c 00 69 [ ]*tar %a6,%r9 + 5e4: b2 2c 00 06 [ ]*tb %r6 + 5e8: ed 65 af ff 00 11 [ ]*tcdb %f6,4095\(%r5,%r10\) + 5ee: ed 65 af ff 00 10 [ ]*tceb %f6,4095\(%r5,%r10\) + 5f4: ed 65 af ff 00 12 [ ]*tcxb %f6,4095\(%r5,%r10\) + 5fa: 91 ff 5f ff [ ]*tm 4095\(%r5\),255 + 5fe: a7 60 ff ff [ ]*tmh %r6,65535 + 602: a7 61 ff ff [ ]*tml %r6,65535 + 606: b2 36 5f ff [ ]*tpi 4095\(%r5\) + 60a: e5 01 5f ff af ff [ ]*tprot 4095\(%r5\),4095\(%r10\) + 610: dc ff 5f ff af ff [ ]*tr 4095\(256,%r5\),4095\(%r10\) + 616: 99 69 5f ff [ ]*trace %r6,%r9,4095\(%r5\) + 61a: 01 ff [ ]*trap2 + 61c: b2 ff 5f ff [ ]*trap4 4095\(%r5\) + 620: dd ff 5f ff af ff [ ]*trt 4095\(256,%r5\),4095\(%r10\) + 626: 93 00 5f ff [ ]*ts 4095\(%r5\) + 62a: b2 35 5f ff [ ]*tsch 4095\(%r5\) + 62e: f3 ff 5f ff af ff [ ]*unpk 4095\(16,%r5\),4095\(16,%r10\) + 634: 01 02 [ ]*upt + 636: 57 65 af ff [ ]*x %r6,4095\(%r5,%r10\) + 63a: d7 ff 5f ff af ff [ ]*xc 4095\(256,%r5\),4095\(%r10\) + 640: 97 ff 5f ff [ ]*xi 4095\(%r5\),255 + 644: 17 69 [ ]*xr %r6,%r9 + 646: f8 ff 5f ff af ff [ ]*zap 4095\(16,%r5\),4095\(16,%r10\) diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/s390/opcode.s binutils-2.11.92.0.5/gas/testsuite/gas/s390/opcode.s --- binutils-2.11.90.0.31/gas/testsuite/gas/s390/opcode.s Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/gas/testsuite/gas/s390/opcode.s Mon Oct 1 15:25:25 2001 @@ -0,0 +1,419 @@ +.text +foo: + a %r6,4095(%r5,%r10) + ad %f6,4095(%r5,%r10) + adb %f6,4095(%r5,%r10) + adbr %f6,%f9 + adr %f6,%f9 + ae %f6,4095(%r5,%r10) + aeb %f6,4095(%r5,%r10) + aebr %f6,%f9 + aer %f6,%f9 + ah %r6,4095(%r5,%r10) + ahi %r6,-32767 + al %r6,4095(%r5,%r10) + alr %r6,%r9 + ap 4095(6,%r5),4095(9,%r10) + ar %r6,%r9 + au %f6,4095(%r5,%r10) + aur %f6,%f9 + aw %f6,4095(%r5,%r10) + awr %f6,%f9 + axbr %f6,%f9 + axr %f6,%f9 + b 4095(%r5,%r10) + bakr %r6,%r9 + bal %r6,4095(%r5,%r10) + balr %r6,%r9 + bas %r6,4095(%r5,%r10) + basr %r6,%r9 + bassm %r6,%r9 + bc 6,4095(%r5,%r10) + bcr 6,%r9 + bct %r6,4095(%r5,%r10) + bctr %r6,%r9 + be 4095(%r5,%r10) + ber %r9 + bh 4095(%r5,%r10) + bhe 4095(%r5,%r10) + bher %r9 + bhr %r9 + bl 4095(%r5,%r10) + ble 4095(%r5,%r10) + bler %r9 + blh 4095(%r5,%r10) + blhr %r9 + blr %r9 + bm 4095(%r5,%r10) + bmr %r9 + bne 4095(%r5,%r10) + bner %r9 + bnh 4095(%r5,%r10) + bnhe 4095(%r5,%r10) + bnher %r9 + bnhr %r9 + bnl 4095(%r5,%r10) + bnle 4095(%r5,%r10) + bnler %r9 + bnlh 4095(%r5,%r10) + bnlhr %r9 + bnlr %r9 + bnm 4095(%r5,%r10) + bnmr %r9 + bno 4095(%r5,%r10) + bnor %r9 + bnp 4095(%r5,%r10) + bnpr %r9 + bnz 4095(%r5,%r10) + bnzr %r9 + bo 4095(%r5,%r10) + bor %r9 + bp 4095(%r5,%r10) + bpr %r9 + br %r9 + bras %r9,. + brc 6,. + brct 6,. + brxh %r6,%r9,. + brxle %r6,%r9,. + bsa %r6,%r9 + bsg %r6,%r9 + bsm %r6,%r9 + bxh %r6,%r9,4095(%r5) + bxle %r6,%r9,4095(%r5) + bz 4095(%r5,%r10) + bzr %r9 + c %r6,4095(%r5,%r10) + cd %f6,4095(%r5,%r10) + cdb %f6,4095(%r5,%r10) + cdbr %f6,%f9 + cdfbr %r6,%f9 + cdr %f6,%f9 + cds %r6,%r9,4095(%r5) + ce %f6,4095(%r5,%r10) + ceb %f6,4095(%r5,%r10) + cebr %f6,%f9 + cefbr %r6,%f9 + cer %f6,%f9 + cfc 4095(%r5) + cfdbr %f6,5,%r9 + cfebr %f6,5,%r9 + cfxbr %f6,5,%r9 + ch %r6,4095(%r5,%r10) + chi %r6,-32767 + cksm %r6,%r9 + cl %r6,4095(%r5,%r10) + clc 4095(256,%r5),4095(%r10) + clcl %r6,%r9 + clcle %r6,%r9,10 + cli 4095(%r5),255 + clm %r6,10,4095(%r5) + clr %r6,%r9 + clst %r6,%r9 + cmpsc %r6,%r9 + cp 4095(6,%r5),4095(9,%r10) + cpya %a6,%a9 + cr %r6,%r9 + cs %r6,%r9,4095(%r5) + csch + csp %r6,%r9 + cuse %r6,%r9 + cutfu %r6,%r9 + cuutf %r6,%r9 + cvb %r6,4095(%r5,%r10) + cvd %r6,4095(%r5,%r10) + cxbr %f6,%f9 + cxfbr %r6,%f9 + d %r6,4095(%r5,%r10) + dd %f6,4095(%r5,%r10) + ddb %f6,4095(%r5,%r10) + ddbr %f6,%f9 + ddr %f6,%f9 + de %f6,4095(%r5,%r10) + deb %f6,4095(%r5,%r10) + debr %f6,%f9 + der %f6,%f9 + diag %r6,%r9,4095(%r5) + didbr %f6,%r9,%r5,10 + diebr %f6,%r9,%r5,10 + dp 4095(6,%r5),4095(9,%r10) + dr %r6,%r9 + dxbr %f6,%f9 + dxr %f6 + ear %r6,%a9 + ed 4095(256,%r5),4095(%r10) + edmk 4095(256,%r5),4095(%r10) + efpc %r6,%r9 + epar %r6 + ereg %r6,%r9 + esar %r6 + esta %r6,%r9 + ex %r6,4095(%r5) + fidbr %r6,5,%r9 + fiebr %r6,5,%r9 + fixbr %r6,5,%r9 + hdr %f6,%f9 + her %f6,%f9 + hsch + iac %r6 + ic %r6,4095(%r5,%r10) + icm %r6,10,4095(%r5) + ipk + ipm %r6 + ipte %r6,%r9 + iske %r6,%r9 + ivsk %r6,%r9 + j . + je . + jh . + jhe . + jl . + jle . + jlh . + jm . + jne . + jnhe . + jnl . + jnle . + jnlh . + jnm . + jno . + jnp . + jnz . + jo . + jp . + jz . + kdb %f6,4095(%r5,%r10) + kdbr %f6,%f9 + keb %f6,4095(%r5,%r10) + kebr %f6,%f9 + kxbr %f6,%f9 + l %r6,4095(%r5,%r10) + la %r6,4095(%r5,%r10) + lae %r6,4095(%r5,%r10) + lam %a6,%a9,4095(%r5) + lasp 4095(%r5),4095(%r10) + lcdbr %f6,%f9 + lcdr %f6,%f9 + lcebr %f6,%f9 + lcer %f6,%f9 + lcr %r6,%r9 + lctl %c6,%c9,4095(%r5) + lcxbr %f6,%f9 + ld %f6,4095(%r5) + ldeb %f6,4095(%r5) + ldebr %f6,%f9 + ldr %f6,%f9 + ldxbr %f6,%f9 + le %f6,4095(%r5) + ledbr %f6,%f9 + ler %f6,%f9 + lexbr %f6,%f9 + lfpc 4095(%r5) + lh %r6,4095(%r5) + lhi %r6,-32767 + lm %r6,%r9,4095(%r5) + lndbr %f6,%f9 + lndr %f6,%f9 + lnebr %f6,%f9 + lner %f6,%f9 + lnr %r6,%r9 + lnxbr %f6,%f9 + lpdbr %f6,%f9 + lpdr %f6,%f9 + lpebr %f6,%f9 + lper %f6,%f9 + lpr %r6,%r9 + lpsw 4095(%r5) + lpxbr %f6,%f9 + lr %r6,%r9 + lra %r6,4095(%r5,%r10) + lrdr %f6,%f9 + lrer %f6,%f9 + ltdbr %f6,%f9 + ltdr %f6,%f9 + ltebr %f6,%f9 + lter %f6,%f9 + ltr %r6,%r9 + ltxbr %f6,%f9 + lura %r6,%r9 + lxdb %f6,4095(%r5,%r10) + lxdbr %f6,%f9 + lxeb %f6,4095(%r5,%r10) + lxebr %f6,%f9 + m %r6,4095(%r5,%r10) + madb %f6,%f9,4095(%r5,%r10) + madbr %f6,%f9,%f5 + maeb %f6,%f9,4095(%r5,%r10) + maebr %f6,%f9,%f5 + mc 4095(%r5),6 + md %f6,4095(%r5,%r10) + mdb %f6,4095(%f5,%f10) + mdbr %f6,%f9 + mdeb %f6,4095(%f5,%f10) + mdebr %f6,%f9 + mdr %f6,%f9 + me %f6,4095(%r5,%r10) + meeb %f6,4095(%r5,%r10) + meebr %f6,%f9 + mer %f6,%f9 + mh %r6,4095(%r5,%r10) + mhi %r6,-32767 + mp 4095(16,%r5),4095(16,%r10) + mr %r6,%r9 + ms %r6,4095(%r5,%r10) + msch 4095(%r5) + msdb %f6,%f9,4095(%r5,%r10) + msdbr %f6,%f9,%f5 + mseb %f6,%f9,4095(%r5,%r10) + msebr %f6,%f9,%f5 + msr %r6,%r9 + msta %r6 + mvc 4095(256,%r5),4095(%r10) + mvcdk 4095(%r5),4095(%r10) + mvcin 4095(256,%r5),4095(%r10) + mvck 4095(%r6,%r5),4095(%r10),%r9 + mvcl %r6,%r9 + mvcle %r6,%r9,10 + mvcp 4095(%r6,%r5),4095(%r10),%r9 + mvcs 4095(%r6,%r5),4095(%r10),%r9 + mvcsk 4095(%r5),4095(%r10) + mvi 4095(%r5),255 + mvn 4095(256,%r5),4095(%r10) + mvo 4095(16,%r5),4095(16,%r10) + mvpg %r6,%r9 + mvst %r6,%r9 + mvz 4095(256,%r5),4095(%r10) + mxbr %f6,%f9 + mxd %f6,4095(%r5,%r10) + mxdb %f6,4095(%r5,%r10) + mxdbr %f6,%f9 + mxdr %r6,%r9 + mxr %r6,%r9 + n %r6,4095(%r5,%r10) + nc 4095(256,%r5),4095(%r10) + ni 4095(%r5),255 + nop 4095(%r5,%r10) + nopr %r6 + nr %r6,%r9 + o %r6,4095(%r5,%r10) + oc 4095(256,%r5),4095(%r10) + oi 4095(%r5),255 + or %r6,%r9 + pack 4095(16,%r5),4095(16,%r10) + palb + pc 4095(%r5) + plo %r6,4095(%r5),%r9,4095(%r10) + pr + pt %r6,%r9 + ptlb + rchp + rp 4095(%r5) + rrbe %r6,%r9 + rsch + s %r6,4095(%r5,%r10) + sac 4095(%r5) + sacf 4095(%r5) + sal + sar %a6,%r9 + schm + sck 4095(%r5) + sckc 4095(%r5) + sckpf + sd %f6,4095(%r5,%r10) + sdb %f6,4095(%r5,%r10) + sdbr %f6,%f9 + sdr %f6,%f9 + se %f6,4095(%r5,%r10) + seb %f6,4095(%r5,%r10) + sebr %f6,%f9 + ser %r6,%r9 + sfpc %r6,%r9 + sh %r6,4095(%r5,%r10) + sie 4095(%r5) + siga 4095(%r5) + sigp %r6,%r9,4095(%r5) + sl %r6,4095(%r5,%r10) + sla %r6,4095(%r5) + slda %r6,4095(%r5) + sldl %r6,4095(%r5) + sll %r6,4095(%r5) + slr %r6,%r9 + sp 4095(16,%r5),4095(16,%r10) + spka 4095(%r5) + spm %r6 + spt 4095(%r5) + spx 4095(%r5) + sqdb %f6,4095(%r5,%r10) + sqdbr %f6,%f9 + sqdr %f6 + sqeb %f6,4095(%r5,%r10) + sqebr %f6,%f9 + sqer %f6 + sqxbr %f6,%f9 + sr %r6,%r9 + sra %r6,4095(%r5) + srda %r6,4095(%r5) + srdl %r6,4095(%r5) + srl %r6,4095(%r5) + srnm 4095(%r5) + srp 4095(16,%r5),4095(%r10),10 + srst %r6,%r9 + ssar %r6 + ssch 4095(%r5) + sske %r6,%r9 + ssm 4095(%r5) + st %r6,4095(%r5,%r10) + stam %a6,%a9,4095(%r5) + stap 4095(%r5) + stc %r6,4095(%r5,%r10) + stck 4095(%r5) + stckc 4095(%r5) + stcm %r6,15,4095(%r5) + stcps 4095(%r5) + stcrw 4095(%r5) + stctl %c6,%c9,4095(%r5) + std %f6,4095(%r5,%r10) + ste %f6,4095(%r5,%r10) + stfpc 4095(%r5) + sth %r6,4095(%r5,%r10) + stidp 4095(%r5) + stm %r6,%r9,4095(%r5) + stnsm 4095(%r5),255 + stosm 4095(%r5),255 + stpt 4095(%r5) + stpx 4095(%r5) + stsch 4095(%r5) + stsi 4095(%r5) + stura %r6,%r9 + su %f6,4095(%r5,%r10) + sur %r6,%r9 + svc 255 + sw %f6,4095(%r5,%r10) + swr %f6,%f9 + sxbr %f6,%f9 + sxr %r6,%r9 + tar %a6,%r9 + tb %r6 + tcdb %f6,4095(%r5,%r10) + tceb %f6,4095(%r5,%r10) + tcxb %f6,4095(%r5,%r10) + tm 4095(%r5),255 + tmh %r6,65535 + tml %r6,65535 + tpi 4095(%r5) + tprot 4095(%r5),4095(%r10) + tr 4095(256,%r5),4095(%r10) + trace %r6,%r9,4095(%r5) + trap2 + trap4 4095(%r5) + trt 4095(256,%r5),4095(%r10) + ts 4095(%r5) + tsch 4095(%r5) + unpk 4095(16,%r5),4095(16,%r10) + upt + x %r6,4095(%r5,%r10) + xc 4095(256,%r5),4095(%r10) + xi 4095(%r5),255 + xr %r6,%r9 + zap 4095(16,%r5),4095(16,%r10) diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/s390/opcode64.d binutils-2.11.92.0.5/gas/testsuite/gas/s390/opcode64.d --- binutils-2.11.90.0.31/gas/testsuite/gas/s390/opcode64.d Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/gas/testsuite/gas/s390/opcode64.d Mon Oct 1 15:25:25 2001 @@ -0,0 +1,211 @@ +#name: s390x opcode +#objdump: -drw + +.*: +file format .* + +Disassembly of section .text: + +.* : + 0: e3 95 af ff 00 08 [ ]*ag %r9,4095\(%r5,%r10\) + 6: e3 95 af ff 00 18 [ ]*agf %r9,4095\(%r5,%r10\) + c: b9 18 00 96 [ ]*agfr %r9,%r6 + 10: a7 9b 80 01 [ ]*aghi %r9,-32767 + 14: b9 08 00 96 [ ]*agr %r9,%r6 + 18: e3 95 af ff 00 98 [ ]*alc %r9,4095\(%r5,%r10\) + 1e: e3 95 af ff 00 88 [ ]*alcg %r9,4095\(%r5,%r10\) + 24: b9 88 00 96 [ ]*alcgr %r9,%r6 + 28: b9 98 00 96 [ ]*alcr %r9,%r6 + 2c: e3 95 af ff 00 0a [ ]*alg %r9,4095\(%r5,%r10\) + 32: e3 95 af ff 00 1a [ ]*algf %r9,4095\(%r5,%r10\) + 38: b9 1a 00 96 [ ]*algfr %r9,%r6 + 3c: b9 0a 00 96 [ ]*algr %r9,%r6 + 40: e3 65 af ff 00 46 [ ]*bctg %r6,4095\(%r5,%r10\) + 46: b9 46 00 69 [ ]*bctgr %r6,%r9 + 4a: c0 65 00 00 00 00 [ ]*brasl %r6,4a + 50: c0 f4 00 00 00 00 [ ]*jg 50 + 56: a7 67 00 00 [ ]*brctg %r6,56 + 5a: ec 69 00 00 00 44 [ ]*brxhg %r6,%r9,5a + 60: ec 69 00 00 00 45 [ ]*brxlg %r6,%r9,60 + 66: eb 69 5f ff 00 44 [ ]*bxhg %r6,%r9,4095\(%r5\) + 6c: eb 69 5f ff 00 45 [ ]*bxleg %r6,%r9,4095\(%r5\) + 72: b3 a5 00 69 [ ]*cdgbr %r6,%r9 + 76: b3 c5 00 69 [ ]*cdgr %r6,%r9 + 7a: eb 69 5f ff 00 3e [ ]*cdsg %r6,%r9,4095\(%r5\) + 80: b3 a4 00 69 [ ]*cegbr %r6,%r9 + 84: b3 c4 00 69 [ ]*cegr %r6,%r9 + 88: e3 65 af ff 00 20 [ ]*cg %r6,4095\(%r5,%r10\) + 8e: b3 a9 f0 69 [ ]*cgdbr %f6,15,%r9 + 92: b3 c9 90 65 [ ]*cgdr %f6,9,%r5 + 96: b3 a8 f0 69 [ ]*cgebr %f6,15,%r9 + 9a: b3 c8 90 65 [ ]*cger %f6,9,%r5 + 9e: e3 65 af ff 00 30 [ ]*cgf %r6,4095\(%r5,%r10\) + a4: b9 30 00 69 [ ]*cgfr %r6,%r9 + a8: a7 6f 80 01 [ ]*cghi %r6,-32767 + ac: b9 20 00 69 [ ]*cgr %r6,%r9 + b0: b3 aa f0 69 [ ]*cgxbr %f6,15,%r9 + b4: b3 ca 90 65 [ ]*cgxr %f6,9,%r5 + b8: e3 65 af ff 00 21 [ ]*clg %r6,4095\(%r5,%r10\) + be: e3 65 af ff 00 31 [ ]*clgf %r6,4095\(%r5,%r10\) + c4: b9 31 00 69 [ ]*clgfr %r6,%r9 + c8: b9 21 00 69 [ ]*clgr %r6,%r9 + cc: eb 6a 5f ff 00 20 [ ]*clmh %r6,10,4095\(%r5\) + d2: eb 69 5f ff 00 30 [ ]*csg %r6,%r9,4095\(%r5\) + d8: e3 65 af ff 00 0e [ ]*cvbg %r6,4095\(%r5,%r10\) + de: e3 65 af ff 00 2e [ ]*cvdg %r6,4095\(%r5,%r10\) + e4: b3 a6 00 69 [ ]*cxgbr %r6,%r9 + e8: b3 c6 00 69 [ ]*cxgr %r6,%r9 + ec: e3 65 af ff 00 97 [ ]*dl %r6,4095\(%r5,%r10\) + f2: e3 65 af ff 00 87 [ ]*dlg %r6,4095\(%r5,%r10\) + f8: b9 87 00 69 [ ]*dlgr %r6,%r9 + fc: b9 97 00 69 [ ]*dlr %r6,%r9 + 100: e3 65 af ff 00 0d [ ]*dsg %r6,4095\(%r5,%r10\) + 106: e3 65 af ff 00 1d [ ]*dsgf %r6,4095\(%r5,%r10\) + 10c: b9 1d 00 69 [ ]*dsgfr %r6,%r9 + 110: b9 0d 00 69 [ ]*dsgr %r6,%r9 + 114: b9 8d 00 69 [ ]*epsw %r6,%r9 + 118: b9 0e 00 69 [ ]*eregg %r6,%r9 + 11c: b9 9d 00 60 [ ]*esea %r6 + 120: eb 6a 5f ff 00 80 [ ]*icmh %r6,10,4095\(%r5\) + 126: a5 60 ff ff [ ]*iihh %r6,65535 + 12a: a5 61 ff ff [ ]*iihl %r6,65535 + 12e: a5 62 ff ff [ ]*iilh %r6,65535 + 132: a5 63 ff ff [ ]*iill %r6,65535 + 136: c0 f4 00 00 00 00 [ ]*jg 136 + 13c: c0 84 00 00 00 00 [ ]*jge 13c + 142: c0 24 00 00 00 00 [ ]*jgh 142 + 148: c0 a4 00 00 00 00 [ ]*jghe 148 + 14e: c0 44 00 00 00 00 [ ]*jgl 14e + 154: c0 c4 00 00 00 00 [ ]*jgle 154 + 15a: c0 64 00 00 00 00 [ ]*jglh 15a + 160: c0 44 00 00 00 00 [ ]*jgl 160 + 166: c0 74 00 00 00 00 [ ]*jgne 166 + 16c: c0 d4 00 00 00 00 [ ]*jgnh 16c + 172: c0 54 00 00 00 00 [ ]*jgnhe 172 + 178: c0 b4 00 00 00 00 [ ]*jgnl 178 + 17e: c0 34 00 00 00 00 [ ]*jgnle 17e + 184: c0 94 00 00 00 00 [ ]*jgnlh 184 + 18a: c0 b4 00 00 00 00 [ ]*jgnl 18a + 190: c0 e4 00 00 00 00 [ ]*jgno 190 + 196: c0 d4 00 00 00 00 [ ]*jgnh 196 + 19c: c0 74 00 00 00 00 [ ]*jgne 19c + 1a2: c0 14 00 00 00 00 [ ]*jgo 1a2 + 1a8: c0 24 00 00 00 00 [ ]*jgh 1a8 + 1ae: c0 84 00 00 00 00 [ ]*jge 1ae + 1b4: c0 60 00 00 00 00 [ ]*larl %r6,1b4 + 1ba: b9 13 00 69 [ ]*lcgfr %r6,%r9 + 1be: b9 03 00 69 [ ]*lcgr %r6,%r9 + 1c2: eb 69 5f ff 00 2f [ ]*lctlg %r6,%r9,4095\(%r5\) + 1c8: e3 65 af ff 00 04 [ ]*lg %r6,4095\(%r5,%r10\) + 1ce: e3 65 af ff 00 14 [ ]*lgf %r6,4095\(%r5,%r10\) + 1d4: b9 14 00 69 [ ]*lgfr %r6,%r9 + 1d8: e3 65 af ff 00 15 [ ]*lgh %r6,4095\(%r5,%r10\) + 1de: a7 69 80 01 [ ]*lghi %r6,-32767 + 1e2: b9 04 00 69 [ ]*lgr %r6,%r9 + 1e6: e3 65 af ff 00 90 [ ]*llgc %r6,4095\(%r5,%r10\) + 1ec: e3 65 af ff 00 16 [ ]*llgf %r6,4095\(%r5,%r10\) + 1f2: b9 16 00 69 [ ]*llgfr %r6,%r9 + 1f6: e3 65 af ff 00 91 [ ]*llgh %r6,4095\(%r5,%r10\) + 1fc: e3 65 af ff 00 17 [ ]*llgt %r6,4095\(%r5,%r10\) + 202: b9 17 00 69 [ ]*llgtr %r6,%r9 + 206: a5 6c ff ff [ ]*llihh %r6,65535 + 20a: a5 6d ff ff [ ]*llihl %r6,65535 + 20e: a5 6e ff ff [ ]*llilh %r6,65535 + 212: a5 6f ff ff [ ]*llill %r6,65535 + 216: ef 69 5f ff af ff [ ]*lmd %r6,%r9,4095\(%r5\),4095\(%r10\) + 21c: eb 69 5f ff 00 04 [ ]*lmg %r6,%r9,4095\(%r5\) + 222: eb 69 5f ff 00 96 [ ]*lmh %r6,%r9,4095\(%r5\) + 228: b9 11 00 69 [ ]*lngfr %r6,%r9 + 22c: b9 01 00 69 [ ]*lngr %r6,%r9 + 230: b9 10 00 69 [ ]*lpgfr %r6,%r9 + 234: b9 00 00 69 [ ]*lpgr %r6,%r9 + 238: e3 65 af ff 00 8f [ ]*lpq %r6,4095\(%r5,%r10\) + 23e: b2 b2 5f ff [ ]*lpswe 4095\(%r5\) + 242: e3 65 af ff 00 03 [ ]*lrag %r6,4095\(%r5,%r10\) + 248: e3 65 af ff 00 1e [ ]*lrv %r6,4095\(%r5,%r10\) + 24e: e3 65 af ff 00 0f [ ]*lrvg %r6,4095\(%r5,%r10\) + 254: b9 0f 00 69 [ ]*lrvgr %r6,%r9 + 258: e3 65 af ff 00 1f [ ]*lrvh %r6,4095\(%r5,%r10\) + 25e: b9 1f 00 69 [ ]*lrvr %r6,%r9 + 262: b9 12 00 69 [ ]*ltgfr %r6,%r9 + 266: b9 02 00 69 [ ]*ltgr %r6,%r9 + 26a: b9 05 00 69 [ ]*lurag %r6,%r9 + 26e: b3 75 00 60 [ ]*lzdr %r6 + 272: b3 74 00 60 [ ]*lzer %r6 + 276: b3 76 00 60 [ ]*lzxr %r6 + 27a: a7 6d 80 01 [ ]*mghi %r6,-32767 + 27e: e3 65 af ff 00 96 [ ]*ml %r6,4095\(%r5,%r10\) + 284: e3 65 af ff 00 86 [ ]*mlg %r6,4095\(%r5,%r10\) + 28a: b9 86 00 69 [ ]*mlgr %r6,%r9 + 28e: b9 96 00 69 [ ]*mlr %r6,%r9 + 292: e3 65 af ff 00 0c [ ]*msg %r6,4095\(%r5,%r10\) + 298: e3 65 af ff 00 1c [ ]*msgf %r6,4095\(%r5,%r10\) + 29e: b9 1c 00 69 [ ]*msgfr %r6,%r9 + 2a2: b9 0c 00 69 [ ]*msgr %r6,%r9 + 2a6: eb 69 5f ff 00 8e [ ]*mvclu %r6,%r9,4095\(%r5\) + 2ac: e3 65 af ff 00 80 [ ]*ng %r6,4095\(%r5,%r10\) + 2b2: b9 80 00 69 [ ]*ngr %r6,%r9 + 2b6: a5 64 ff ff [ ]*nihh %r6,65535 + 2ba: a5 65 ff ff [ ]*nihl %r6,65535 + 2be: a5 66 ff ff [ ]*nilh %r6,65535 + 2c2: a5 67 ff ff [ ]*nill %r6,65535 + 2c6: e3 65 af ff 00 81 [ ]*og %r6,4095\(%r5,%r10\) + 2cc: b9 81 00 69 [ ]*ogr %r6,%r9 + 2d0: a5 68 ff ff [ ]*oihh %r6,65535 + 2d4: a5 69 ff ff [ ]*oihl %r6,65535 + 2d8: a5 6a ff ff [ ]*oilh %r6,65535 + 2dc: a5 6b ff ff [ ]*oill %r6,65535 + 2e0: e9 ff 5f ff af ff [ ]*pka 4095\(256,%r5\),4095\(%r10\) + 2e6: e1 ff 5f ff af ff [ ]*pku 4095\(256,%r5\),4095\(%r10\) + 2ec: eb 69 5f ff 00 1d [ ]*rll %r6,%r9,4095\(%r5\) + 2f2: eb 69 5f ff 00 1c [ ]*rllg %r6,%r9,4095\(%r5\) + 2f8: 01 0c [ ]*sam24 + 2fa: 01 0d [ ]*sam31 + 2fc: 01 0e [ ]*sam64 + 2fe: e3 65 af ff 00 09 [ ]*sg %r6,4095\(%r5,%r10\) + 304: e3 65 af ff 00 19 [ ]*sgf %r6,4095\(%r5,%r10\) + 30a: b9 19 00 69 [ ]*sgfr %r6,%r9 + 30e: b9 09 00 69 [ ]*sgr %r6,%r9 + 312: eb 69 5f ff 00 0b [ ]*slag %r6,%r9,4095\(%r5\) + 318: e3 65 af ff 00 99 [ ]*slb %r6,4095\(%r5,%r10\) + 31e: e3 65 af ff 00 89 [ ]*slbg %r6,4095\(%r5,%r10\) + 324: b9 89 00 69 [ ]*slbgr %r6,%r9 + 328: b9 99 00 69 [ ]*slbr %r6,%r9 + 32c: e3 65 af ff 00 0b [ ]*slg %r6,4095\(%r5,%r10\) + 332: e3 65 af ff 00 1b [ ]*slgf %r6,4095\(%r5,%r10\) + 338: b9 1b 00 69 [ ]*slgfr %r6,%r9 + 33c: b9 0b 00 69 [ ]*slgr %r6,%r9 + 340: eb 69 5f ff 00 0d [ ]*sllg %r6,%r9,4095\(%r5\) + 346: eb 69 5f ff 00 0a [ ]*srag %r6,%r9,4095\(%r5\) + 34c: eb 69 5f ff 00 0c [ ]*srlg %r6,%r9,4095\(%r5\) + 352: b2 78 5f ff [ ]*stcke 4095\(%r5\) + 356: eb 6a 5f ff 00 2c [ ]*stcmh %r6,10,4095\(%r5\) + 35c: eb 69 5f ff 00 25 [ ]*stctg %r6,%r9,4095\(%r5\) + 362: b2 b1 5f ff [ ]*stfl 4095\(%r5\) + 366: e3 65 af ff 00 24 [ ]*stg %r6,4095\(%r5,%r10\) + 36c: eb 69 5f ff 00 24 [ ]*stmg %r6,%r9,4095\(%r5\) + 372: eb 69 5f ff 00 26 [ ]*stmh %r6,%r9,4095\(%r5\) + 378: e3 65 af ff 00 8e [ ]*stpq %r6,4095\(%r5,%r10\) + 37e: e5 00 5f ff 9f ff [ ]*lasp 4095\(%r5\),4095\(%r9\) + 384: e3 65 af ff 00 3e [ ]*strv %r6,4095\(%r5,%r10\) + 38a: e3 65 af ff 00 2f [ ]*strvg %r6,4095\(%r5,%r10\) + 390: e3 65 af ff 00 3f [ ]*strvh %r6,4095\(%r5,%r10\) + 396: b9 25 00 69 [ ]*sturg %r6,%r9 + 39a: 01 0b [ ]*tam + 39c: b3 51 f0 69 [ ]*tbdr %f6,15,%f9 + 3a0: b3 50 f0 69 [ ]*tbedr %f6,15,%f9 + 3a4: b3 58 00 69 [ ]*thder %r6,%r9 + 3a8: b3 59 00 69 [ ]*thdr %r6,%r9 + 3ac: a7 62 ff ff [ ]*tmhh %r6,65535 + 3b0: a7 63 ff ff [ ]*tmhl %r6,65535 + 3b4: a7 60 ff ff [ ]*tmh %r6,65535 + 3b8: a7 61 ff ff [ ]*tml %r6,65535 + 3bc: eb 69 5f ff 00 0f [ ]*tracg %r6,%r9,4095\(%r5\) + 3c2: b2 a5 00 69 [ ]*tre %r6,%r9 + 3c6: b9 93 00 69 [ ]*troo %r6,%r9 + 3ca: b9 92 00 69 [ ]*trot %r6,%r9 + 3ce: b9 91 00 69 [ ]*trto %r6,%r9 + 3d2: b9 90 00 69 [ ]*trtt %r6,%r9 + 3d6: ea ff 5f ff af ff [ ]*unpka 4095\(256,%r5\),4095\(%r10\) + 3dc: e2 ff 5f ff af ff [ ]*unpku 4095\(256,%r5\),4095\(%r10\) + 3e2: e3 65 af ff 00 82 [ ]*xg %r6,4095\(%r5,%r10\) + 3e8: b9 82 00 69 [ ]*xgr %r6,%r9 diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/s390/opcode64.s binutils-2.11.92.0.5/gas/testsuite/gas/s390/opcode64.s --- binutils-2.11.90.0.31/gas/testsuite/gas/s390/opcode64.s Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/gas/testsuite/gas/s390/opcode64.s Mon Oct 1 15:25:25 2001 @@ -0,0 +1,205 @@ +.text +foo: + ag %r9,4095(%r5,%r10) + agf %r9,4095(%r5,%r10) + agfr %r9,%r6 + aghi %r9,-32767 + agr %r9,%r6 + alc %r9,4095(%r5,%r10) + alcg %r9,4095(%r5,%r10) + alcgr %r9,%r6 + alcr %r9,%r6 + alg %r9,4095(%r5,%r10) + algf %r9,4095(%r5,%r10) + algfr %r9,%r6 + algr %r9,%r6 + bctg %r6,4095(%r5,%r10) + bctgr %r6,%r9 + brasl %r6,. + brcl 15,. + brctg %r6,. + brxhg %r6,%r9,. + brxlg %r6,%r9,. + bxhg %r6,%r9,4095(%r5) + bxleg %r6,%r9,4095(%r5) + cdgbr %r6,%r9 + cdgr %r6,%r9 + cdsg %r6,%r9,4095(%r5) + cegbr %r6,%r9 + cegr %r6,%r9 + cg %r6,4095(%r5,%r10) + cgdbr %r6,15,%r9 + cgdr %f6,9,%r5 + cgebr %r6,15,%r9 + cger %f6,9,%r5 + cgf %r6,4095(%r5,%r10) + cgfr %r6,%r9 + cghi %r6,-32767 + cgr %r6,%r9 + cgxbr %r6,15,%r9 + cgxr %f6,9,%r5 + clg %r6,4095(%r5,%r10) + clgf %r6,4095(%r5,%r10) + clgfr %r6,%r9 + clgr %r6,%r9 + clmh %r6,10,4095(%r5) + csg %r6,%r9,4095(%r5) + cvbg %r6,4095(%r5,%r10) + cvdg %r6,4095(%r5,%r10) + cxgbr %r6,%r9 + cxgr %r6,%r9 + dl %r6,4095(%r5,%r10) + dlg %r6,4095(%r5,%r10) + dlgr %r6,%r9 + dlr %r6,%r9 + dsg %r6,4095(%r5,%r10) + dsgf %r6,4095(%r5,%r10) + dsgfr %r6,%r9 + dsgr %r6,%r9 + epsw %r6,%r9 + eregg %r6,%r9 + esea %r6 + icmh %r6,10,4095(%r5) + iihh %r6,65535 + iihl %r6,65535 + iilh %r6,65535 + iill %r6,65535 + jg . + jge . + jgh . + jghe . + jgl . + jgle . + jglh . + jgm . + jgne . + jgnh . + jgnhe . + jgnl . + jgnle . + jgnlh . + jgnm . + jgno . + jgnp . + jgnz . + jgo . + jgp . + jgz . + larl %r6,. + lcgfr %r6,%r9 + lcgr %r6,%r9 + lctlg %r6,%r9,4095(%r5) + lg %r6,4095(%r5,%r10) + lgf %r6,4095(%r5,%r10) + lgfr %r6,%r9 + lgh %r6,4095(%r5,%r10) + lghi %r6,-32767 + lgr %r6,%r9 + llgc %r6,4095(%r5,%r10) + llgf %r6,4095(%r5,%r10) + llgfr %r6,%r9 + llgh %r6,4095(%r5,%r10) + llgt %r6,4095(%r5,%r10) + llgtr %r6,%r9 + llihh %r6,65535 + llihl %r6,65535 + llilh %r6,65535 + llill %r6,65535 + lmd %r6,%r9,4095(%r5),4095(%r10) + lmg %r6,%r9,4095(%r5) + lmh %r6,%r9,4095(%r5) + lngfr %r6,%r9 + lngr %r6,%r9 + lpgfr %r6,%r9 + lpgr %r6,%r9 + lpq %r6,4095(%r5,%r10) + lpswe 4095(%r5) + lrag %r6,4095(%r5,%r10) + lrv %r6,4095(%r5,%r10) + lrvg %r6,4095(%r5,%r10) + lrvgr %r6,%r9 + lrvh %r6,4095(%r5,%r10) + lrvr %r6,%r9 + ltgfr %r6,%r9 + ltgr %r6,%r9 + lurag %r6,%r9 + lzdr %r6 + lzer %r6 + lzxr %r6 + mghi %r6,-32767 + ml %r6,4095(%r5,%r10) + mlg %r6,4095(%r5,%r10) + mlgr %r6,%r9 + mlr %r6,%r9 + msg %r6,4095(%r5,%r10) + msgf %r6,4095(%r5,%r10) + msgfr %r6,%r9 + msgr %r6,%r9 + mvclu %r6,%r9,4095(%r5) + ng %r6,4095(%r5,%r10) + ngr %r6,%r9 + nihh %r6,65535 + nihl %r6,65535 + nilh %r6,65535 + nill %r6,65535 + og %r6,4095(%r5,%r10) + ogr %r6,%r9 + oihh %r6,65535 + oihl %r6,65535 + oilh %r6,65535 + oill %r6,65535 + pka 4095(256,%r5),4095(%r10) + pku 4095(256,%r5),4095(%r10) + rll %r6,%r9,4095(%r5) + rllg %r6,%r9,4095(%r5) + sam24 + sam31 + sam64 + sg %r6,4095(%r5,%r10) + sgf %r6,4095(%r5,%r10) + sgfr %r6,%r9 + sgr %r6,%r9 + slag %r6,%r9,4095(%r5) + slb %r6,4095(%r5,%r10) + slbg %r6,4095(%r5,%r10) + slbgr %r6,%r9 + slbr %r6,%r9 + slg %r6,4095(%r5,%r10) + slgf %r6,4095(%r5,%r10) + slgfr %r6,%r9 + slgr %r6,%r9 + sllg %r6,%r9,4095(%r5) + srag %r6,%r9,4095(%r5) + srlg %r6,%r9,4095(%r5) + stcke 4095(%r5) + stcmh %r6,10,4095(%r5) + stctg %r6,%r9,4095(%r5) + stfl 4095(%r5) + stg %r6,4095(%r5,%r10) + stmg %r6,%r9,4095(%r5) + stmh %r6,%r9,4095(%r5) + stpq %r6,4095(%r5,%r10) + strag 4095(%r5),4095(%r9) + strv %r6,4095(%r5,%r10) + strvg %r6,4095(%r5,%r10) + strvh %r6,4095(%r5,%r10) + sturg %r6,%r9 + tam + tbdr %r6,15,%r9 + tbedr %r6,15,%r9 + thder %r6,%r9 + thdr %r6,%r9 + tmhh %r6,65535 + tmhl %r6,65535 + tmlh %r6,65535 + tmll %r6,65535 + tracg %r6,%r9,4095(%r5) + tre %r6,%r9 + troo %r6,%r9 + trot %r6,%r9 + trto %r6,%r9 + trtt %r6,%r9 + unpka 4095(256,%r5),4095(%r10) + unpku 4095(256,%r5),4095(%r10) + xg %r6,4095(%r5,%r10) + xgr %r6,%r9 diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/s390/operands.d binutils-2.11.92.0.5/gas/testsuite/gas/s390/operands.d --- binutils-2.11.90.0.31/gas/testsuite/gas/s390/operands.d Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/gas/testsuite/gas/s390/operands.d Mon Oct 1 15:25:25 2001 @@ -0,0 +1,23 @@ +#name: s390 operands +#objdump: -dr + +.*: +file format .* + +Disassembly of section .text: + +.* : + 0: 01 01 [ ]*pr + 2: a7 1a 80 01 [ ]*ahi %r1,-32767 + 6: 18 12 [ ]*lr %r1,%r2 + 8: b2 5e 00 12 [ ]*srst %r1,%r2 + c: b3 5b 93 12 [ ]*didbr %f1,%f9,%f2,3 + 10: ba 12 40 03 [ ]*cs %r1,%r2,3\(%r4\) + 14: 84 12 00 00 [ ]*brxh %r1,%r2,14 +[ ]*16: R_390_PC16DBL test_rsi\+0x2 + 18: 58 13 40 02 [ ]*l %r1,2\(%r3,%r4\) + 1c: ed 10 30 02 00 1a [ ]*adb %f1,2\(%r3\) + 22: ed 24 50 03 10 1e [ ]*madb %f1,%f2,3\(%r4,%r5\) + 28: b2 33 20 01 [ ]*ssch 1\(%r2\) + 2c: 92 03 20 01 [ ]*mvi 1\(%r2\),3 + 30: d2 26 30 01 50 04 [ ]*mvc 1\(39,%r3\),4\(%r5\) + 36: e5 01 20 01 40 03 [ ]*tprot 1\(%r2\),3\(%r4\) diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/s390/operands.s binutils-2.11.92.0.5/gas/testsuite/gas/s390/operands.s --- binutils-2.11.90.0.31/gas/testsuite/gas/s390/operands.s Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/gas/testsuite/gas/s390/operands.s Mon Oct 1 15:25:25 2001 @@ -0,0 +1,16 @@ +.text +foo: + .insn e,0x0101 + .insn ri,0xa70a0000,%r1,-32767 + .insn rr,0x1800,%r1,%r2 + .insn rre,0xb25e0000,%r1,%r2 + .insn rrf,0xb35b0000,%f1,%f2,9,%f3 + .insn rs,0xba000000,%r1,%r2,3(%r4) + .insn rsi,0x84000000,%r1,%r2,test_rsi + .insn rx,0x58000000,%r1,2(%r3,%r4) + .insn rxe,0xed000000001a,%f1,2(%r3) + .insn rxf,0xed000000001e,%f1,%f2,3(%r4,%r5) + .insn s,0xb2330000,1(%r2) + .insn si,0x92000000,1(%r2),3 + .insn ss,0xd20000000000,1(2,%r3),4(%r5),6 + .insn sse,0xe50100000000,1(%r2),3(%r4) diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/s390/operands64.d binutils-2.11.92.0.5/gas/testsuite/gas/s390/operands64.d --- binutils-2.11.90.0.31/gas/testsuite/gas/s390/operands64.d Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/gas/testsuite/gas/s390/operands64.d Mon Oct 1 15:25:25 2001 @@ -0,0 +1,14 @@ +#name: s390x operands +#objdump: -dr + +.*: +file format .* + +Disassembly of section .text: + +.* : + 0: ec 12 00 00 00 45 [ ]*brxlg %r1,%r2,0 +[ ]*2: R_390_PC16DBL test_rie\+0x2 + 6: c0 e5 00 00 00 00 [ ]*brasl %r14,6 +[ ]*8: R_390_PC32DBL test_ril\+0x2 + c: eb 12 40 03 00 0d [ ]*sllg %r1,%r2,3\(%r4\) + 12: 07 07 [ ]*bcr 0,%r7 diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/s390/operands64.s binutils-2.11.92.0.5/gas/testsuite/gas/s390/operands64.s --- binutils-2.11.90.0.31/gas/testsuite/gas/s390/operands64.s Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/gas/testsuite/gas/s390/operands64.s Mon Oct 1 15:25:25 2001 @@ -0,0 +1,6 @@ +.text +foo: + .insn rie,0xec0000000045,%r1,%r2,test_rie + .insn ril,0xc00500000000,%r14,test_ril + .insn rse,0xeb000000000d,%r1,%r2,3(%r4) + diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/s390/reloc.d binutils-2.11.92.0.5/gas/testsuite/gas/s390/reloc.d --- binutils-2.11.90.0.31/gas/testsuite/gas/s390/reloc.d Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/gas/testsuite/gas/s390/reloc.d Mon Oct 1 15:25:25 2001 @@ -0,0 +1,31 @@ +#name: s390 reloc +#objdump: -dr + +.*: +file format .* + +Disassembly of section .text: + +.* : + 0: d2 00 10 00 20 00 [ ]*mvc 0\(1,%r1\),0\(%r2\) +[ ]*1: R_390_8 test_R_390_8 + 6: 58 01 20 00 [ ]*l %r0,0\(%r1,%r2\) +[ ]*8: R_390_12 test_R_390_12 + a: a7 08 00 00 [ ]*lhi %r0,0 +[ ]*c: R_390_16 test_R_390_16 +[ ]*... +[ ]*e: R_390_32 test_R_390_32 +[ ]*12: R_390_PC32 test_R_390_PC32\+0x12 + 16: 58 01 20 00 [ ]*l %r0,0\(%r1,%r2\) +[ ]*18: R_390_GOT12 test_R_390_GOT12 +[ ]*... +[ ]*1a: R_390_GOT32 test_R_390_GOT32 +[ ]*1e: R_390_PLT32 test_R_390_PLT32 + 22: a7 08 00 00 [ ]*lhi %r0,0 +[ ]*24: R_390_GOT16 test_R_390_GOT16 + 26: a7 08 00 00 [ ]*lhi %r0,0 +[ ]*28: R_390_16 test_R_390_PC16\+0x26 + 2a: a7 e5 00 00 [ ]*bras %r14,2a +[ ]*2c: R_390_PC16DBL test_R_390_PC16DBL\+0x2 + 2e: a7 e5 00 00 [ ]*bras %r14,2e +[ ]*30: R_390_PC16DBL test_R_390_PLT16DBL\+0x2 + 32: 07 07 [ ]*bcr 0,%r7 diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/s390/reloc.s binutils-2.11.92.0.5/gas/testsuite/gas/s390/reloc.s --- binutils-2.11.90.0.31/gas/testsuite/gas/s390/reloc.s Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/gas/testsuite/gas/s390/reloc.s Mon Oct 1 15:25:25 2001 @@ -0,0 +1,14 @@ +.text +foo: + mvc 0(test_R_390_8,%r1),0(%r2) + l %r0,test_R_390_12(%r1,%r2) + lhi %r0,test_R_390_16 + .long test_R_390_32 + .long test_R_390_PC32-foo + l %r0,test_R_390_GOT12@GOT(%r1,%r2) + .long test_R_390_GOT32@GOT + .long test_R_390_PLT32@PLT + lhi %r0,test_R_390_GOT16@GOT + lhi %r0,test_R_390_PC16-foo + bras %r14,test_R_390_PC16DBL + bras %r14,test_R_390_PLT16DBL diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/s390/reloc64.d binutils-2.11.92.0.5/gas/testsuite/gas/s390/reloc64.d --- binutils-2.11.90.0.31/gas/testsuite/gas/s390/reloc64.d Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/gas/testsuite/gas/s390/reloc64.d Mon Oct 1 15:25:25 2001 @@ -0,0 +1,20 @@ +#name: s390x reloc +#objdump: -dr + +.*: +file format .* + +Disassembly of section .text: + +.* : + 0: c0 e5 00 00 00 00 [ ]*brasl %r14,0 +[ ]*2: R_390_PC32DBL test_R_390_PC32DBL\+0x2 + 6: c0 e5 00 00 00 00 [ ]*brasl %r14,6 +[ ]*8: R_390_PC32DBL test_R_390_PLT32DBL\+0x2 +[ ]*... +[ ]*c: R_390_64 test_R_390_64 +[ ]*14: R_390_PC64 test_R_390_PC64\+0x14 +[ ]*1c: R_390_GOT64 test_R_390_GOT64 +[ ]*24: R_390_PLT64 test_R_390_PLT64 + 2c: c0 10 00 00 00 00 [ ]*larl %r1,2c +[ ]*2e: R_390_GOTENT test_R_390_GOTENT\+0x2 + 32: 07 07 [ ]*bcr 0,%r7 diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/s390/reloc64.s binutils-2.11.92.0.5/gas/testsuite/gas/s390/reloc64.s --- binutils-2.11.90.0.31/gas/testsuite/gas/s390/reloc64.s Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/gas/testsuite/gas/s390/reloc64.s Mon Oct 1 15:25:25 2001 @@ -0,0 +1,9 @@ +.text +foo: + brasl %r14,test_R_390_PC32DBL + brasl %r14,test_R_390_PLT32DBL + .quad test_R_390_64 + .quad test_R_390_PC64-foo + .quad test_R_390_GOT64@GOT + .quad test_R_390_PLT64@PLT + larl %r1,test_R_390_GOTENT@GOT diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/s390/s390.exp binutils-2.11.92.0.5/gas/testsuite/gas/s390/s390.exp --- binutils-2.11.90.0.31/gas/testsuite/gas/s390/s390.exp Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/gas/testsuite/gas/s390/s390.exp Mon Oct 1 15:25:25 2001 @@ -0,0 +1,35 @@ +# +# s390/s390x tests +# +proc run_list_test { name opts } { + global srcdir subdir + set testname "s390 $name" + set file $srcdir/$subdir/$name + gas_run ${name}.s $opts ">&dump.out" + if { [regexp_diff "dump.out" "${file}.l"] } then { + fail $testname + verbose "output is [file_contents "dump.out"]" 2 + exit + return + } + pass $testname +} + +if [expr [istarget "s390-*-*"] || [istarget "s390x-*-*"]] then { + + run_dump_test "opcode" + run_dump_test "reloc" + run_dump_test "operands" + +# # PIC is only supported on ELF targets. +# if { ([istarget "*-*-elf*"] || [istarget "*-*-linux*"] ) } then { +# run_dump_test "s390pic" +# } +} + +if [istarget "s390x-*-*"] then { + + run_dump_test "opcode64" + run_dump_test "reloc64" + run_dump_test "operands64" +} diff -uprN binutils-2.11.90.0.31/gas/testsuite/gas/vtable/vtable.exp binutils-2.11.92.0.5/gas/testsuite/gas/vtable/vtable.exp --- binutils-2.11.90.0.31/gas/testsuite/gas/vtable/vtable.exp Tue Jun 19 11:57:57 2001 +++ binutils-2.11.92.0.5/gas/testsuite/gas/vtable/vtable.exp Mon Oct 1 15:25:25 2001 @@ -26,6 +26,7 @@ if { ( [istarget "*-*-elf*"] || [istar || [istarget "arc*-*-*"] || [istarget "alpha*-*-*"] || [istarget "sparc64*-*-*"] + || [istarget "h8300*-*-*"] || [istarget "d30v-*-*"] } then { return } diff -uprN binutils-2.11.90.0.31/gas/write.c binutils-2.11.92.0.5/gas/write.c --- binutils-2.11.90.0.31/gas/write.c Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/gas/write.c Mon Oct 1 15:25:22 2001 @@ -769,8 +769,7 @@ adjust_reloc_syms (abfd, sec, xxx) /* If this symbol is equated to an undefined symbol, convert the fixup to being against that symbol. */ - if (sym != NULL && symbol_equated_p (sym) - && (! S_IS_DEFINED (sym) || S_IS_COMMON (sym))) + if (sym != NULL && symbol_equated_reloc_p (sym)) { fixp->fx_offset += symbol_get_value_expression (sym)->X_add_number; sym = symbol_get_value_expression (sym)->X_add_symbol; @@ -983,11 +982,10 @@ write_relocs (abfd, sec, xxx) } /* If this is an undefined symbol which was equated to another - symbol, then use generate the reloc against the latter symbol + symbol, then generate the reloc against the latter symbol rather than the former. */ sym = fixp->fx_addsy; - while (symbol_equated_p (sym) - && (! S_IS_DEFINED (sym) || S_IS_COMMON (sym))) + while (symbol_equated_reloc_p (sym)) { symbolS *n; @@ -1059,8 +1057,7 @@ write_relocs (abfd, sec, xxx) symbol, then generate the reloc against the latter symbol rather than the former. */ sym = fixp->fx_addsy; - while (symbol_equated_p (sym) - && (! S_IS_DEFINED (sym) || S_IS_COMMON (sym))) + while (symbol_equated_reloc_p (sym)) sym = symbol_get_value_expression (sym)->X_add_symbol; fixp->fx_addsy = sym; @@ -1368,7 +1365,7 @@ set_symtab () asymbol **asympp; symbolS *symp; boolean result; - extern PTR bfd_alloc PARAMS ((bfd *, size_t)); + extern PTR bfd_alloc PARAMS ((bfd *, bfd_size_type)); /* Count symbols. We can't rely on a count made by the loop in write_object_file, because *_frob_file may add a new symbol or @@ -1380,9 +1377,9 @@ set_symtab () if (nsyms) { int i; + bfd_size_type amt = (bfd_size_type) nsyms * sizeof (asymbol *); - asympp = (asymbol **) bfd_alloc (stdoutput, - nsyms * sizeof (asymbol *)); + asympp = (asymbol **) bfd_alloc (stdoutput, amt); symp = symbol_rootP; for (i = 0; i < nsyms; i++, symp = symbol_next (symp)) { @@ -1883,8 +1880,8 @@ write_object_file () obj_emit_strings (&next_object_file_charP); #ifdef BFD_HEADERS - bfd_seek (stdoutput, 0, 0); - bfd_write (the_object_file, 1, object_file_size, stdoutput); + bfd_seek (stdoutput, (file_ptr) 0, 0); + bfd_bwrite (the_object_file, (bfd_size_type) object_file_size, stdoutput); #else /* Write the data to the file. */ @@ -1960,8 +1957,7 @@ write_object_file () /* Skip symbols which were equated to undefined or common symbols. */ - if (symbol_equated_p (symp) - && (! S_IS_DEFINED (symp) || S_IS_COMMON (symp))) + if (symbol_equated_reloc_p (symp)) { symbol_remove (symp, &symbol_rootP, &symbol_lastP); continue; @@ -2264,6 +2260,12 @@ relax_segment (segment_frag_root, segmen break; case rs_machine_dependent: + /* If fr_symbol is an expression, this call to + resolve_symbol_value sets up the correct segment, which will + likely be needed in md_estimate_size_before_relax. */ + if (fragP->fr_symbol) + resolve_symbol_value (fragP->fr_symbol); + address += md_estimate_size_before_relax (fragP, segment); break; diff -uprN binutils-2.11.90.0.31/gettext.m4 binutils-2.11.92.0.5/gettext.m4 --- binutils-2.11.90.0.31/gettext.m4 Sat Sep 2 12:25:53 2000 +++ binutils-2.11.92.0.5/gettext.m4 Thu Oct 4 14:35:42 2001 @@ -256,8 +256,8 @@ __argz_count __argz_stringify __argz_nex dnl Generate list of files to be processed by xgettext which will dnl be included in po/Makefile. But only do this if the po directory - dnl exists in srcdir. - if test -d $srcdir/po; then + dnl exists in srcdir and contains POTFILES.in. + if test -f $srcdir/po/POTFILES.in; then test -d po || mkdir po if test "x$srcdir" != "x."; then if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then diff -uprN binutils-2.11.90.0.31/gprof/ChangeLog binutils-2.11.92.0.5/gprof/ChangeLog --- binutils-2.11.90.0.31/gprof/ChangeLog Fri Aug 10 14:08:01 2001 +++ binutils-2.11.92.0.5/gprof/ChangeLog Thu Oct 4 14:35:43 2001 @@ -1,3 +1,24 @@ +2001-10-03 Alan Modra + + * configure: Regenerate. + +2001-10-02 Alan Modra + + * Makefile.am (Makefile): Depend on bfd/configure.in. + Run "make dep-am". + * Makefile.in: Regenerate. + +2001-09-18 Bruno Haible + + * gprof.c (main): For gettext, also set the LC_CTYPE locate facet. + * sym_ids.c: Include "safe-ctype.h" instead of . + (parse_spec): Use ISDIGIT instead of isdigit. + +2001-09-18 Alan Modra + + * sparc.c (sparc_find_call): Warning fix. + * alpha.c (alpha_find_call): Likewise. + 2001-08-09 Alan Modra * alpha.c: Add missing prototypes. diff -uprN binutils-2.11.90.0.31/gprof/Makefile.am binutils-2.11.92.0.5/gprof/Makefile.am --- binutils-2.11.90.0.31/gprof/Makefile.am Tue Jun 19 11:57:57 2001 +++ binutils-2.11.92.0.5/gprof/Makefile.am Thu Oct 4 14:35:43 2001 @@ -69,6 +69,8 @@ gprof.1: $(srcdir)/gprof.texi (rm -f $@.T$$$$ && exit 1) rm -f gprof.pod +Makefile: $(BFDDIR)/configure.in + # Targets to rebuild dependencies in this Makefile. # Have to get rid of DEP1 here so that "$?" later includes all sources. DEP: dep.sed $(gprof_SOURCES) $(noinst_HEADERS) gconfig.h @@ -121,53 +123,57 @@ basic_blocks.o: basic_blocks.c basic_blo $(INCDIR)/ansidecl.h $(BFDDIR)/sysdep.h ../bfd/config.h \ $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h gconfig.h \ $(INCDIR)/bin-bugs.h source.h search_list.h symtab.h \ - ../bfd/bfd.h corefile.h gmon_io.h gmon.h gmon_out.h \ - $(INCDIR)/libiberty.h sym_ids.h + ../bfd/bfd.h $(INCDIR)/symcat.h corefile.h gmon_io.h \ + gmon.h gmon_out.h $(INCDIR)/libiberty.h sym_ids.h call_graph.o: call_graph.c cg_arcs.h gprof.h $(INCDIR)/ansidecl.h \ $(BFDDIR)/sysdep.h ../bfd/config.h $(INCDIR)/fopen-same.h \ $(INCDIR)/filenames.h gconfig.h $(INCDIR)/bin-bugs.h \ - symtab.h ../bfd/bfd.h source.h search_list.h call_graph.h \ - corefile.h gmon_io.h gmon.h gmon_out.h sym_ids.h + symtab.h ../bfd/bfd.h $(INCDIR)/symcat.h source.h search_list.h \ + call_graph.h corefile.h gmon_io.h gmon.h gmon_out.h \ + sym_ids.h cg_arcs.o: cg_arcs.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \ gprof.h $(BFDDIR)/sysdep.h ../bfd/config.h $(INCDIR)/fopen-same.h \ $(INCDIR)/filenames.h gconfig.h $(INCDIR)/bin-bugs.h \ - call_graph.h symtab.h ../bfd/bfd.h source.h search_list.h \ - cg_arcs.h cg_dfn.h cg_print.h utils.h sym_ids.h + call_graph.h symtab.h ../bfd/bfd.h $(INCDIR)/symcat.h \ + source.h search_list.h cg_arcs.h cg_dfn.h cg_print.h \ + utils.h sym_ids.h cg_dfn.o: cg_dfn.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \ gprof.h $(BFDDIR)/sysdep.h ../bfd/config.h $(INCDIR)/fopen-same.h \ $(INCDIR)/filenames.h gconfig.h $(INCDIR)/bin-bugs.h \ - cg_arcs.h symtab.h ../bfd/bfd.h source.h search_list.h \ - cg_dfn.h utils.h + cg_arcs.h symtab.h ../bfd/bfd.h $(INCDIR)/symcat.h \ + source.h search_list.h cg_dfn.h utils.h cg_print.o: cg_print.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \ cg_arcs.h gprof.h $(BFDDIR)/sysdep.h ../bfd/config.h \ $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h gconfig.h \ - $(INCDIR)/bin-bugs.h symtab.h ../bfd/bfd.h source.h \ - search_list.h cg_print.h hist.h utils.h + $(INCDIR)/bin-bugs.h symtab.h ../bfd/bfd.h $(INCDIR)/symcat.h \ + source.h search_list.h cg_print.h hist.h utils.h corefile.o: corefile.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \ gprof.h $(BFDDIR)/sysdep.h ../bfd/config.h $(INCDIR)/fopen-same.h \ $(INCDIR)/filenames.h gconfig.h $(INCDIR)/bin-bugs.h \ - corefile.h ../bfd/bfd.h symtab.h source.h search_list.h + corefile.h ../bfd/bfd.h $(INCDIR)/symcat.h symtab.h \ + source.h search_list.h gmon_io.o: gmon_io.c cg_arcs.h gprof.h $(INCDIR)/ansidecl.h \ $(BFDDIR)/sysdep.h ../bfd/config.h $(INCDIR)/fopen-same.h \ $(INCDIR)/filenames.h gconfig.h $(INCDIR)/bin-bugs.h \ - symtab.h ../bfd/bfd.h source.h search_list.h basic_blocks.h \ - corefile.h call_graph.h gmon_io.h gmon.h gmon_out.h \ - hertz.h hist.h $(INCDIR)/libiberty.h + symtab.h ../bfd/bfd.h $(INCDIR)/symcat.h source.h search_list.h \ + basic_blocks.h corefile.h call_graph.h gmon_io.h gmon.h \ + gmon_out.h hertz.h hist.h $(INCDIR)/libiberty.h gprof.o: gprof.c $(INCDIR)/getopt.h $(INCDIR)/libiberty.h \ $(INCDIR)/ansidecl.h gprof.h $(BFDDIR)/sysdep.h ../bfd/config.h \ $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h gconfig.h \ $(INCDIR)/bin-bugs.h basic_blocks.h source.h search_list.h \ - symtab.h ../bfd/bfd.h call_graph.h cg_arcs.h cg_print.h \ - corefile.h gmon_io.h gmon.h hertz.h hist.h sym_ids.h \ - $(INCDIR)/demangle.h + symtab.h ../bfd/bfd.h $(INCDIR)/symcat.h call_graph.h \ + cg_arcs.h cg_print.h corefile.h gmon_io.h gmon.h hertz.h \ + hist.h sym_ids.h $(INCDIR)/demangle.h hertz.o: hertz.c hertz.h gprof.h $(INCDIR)/ansidecl.h \ $(BFDDIR)/sysdep.h ../bfd/config.h $(INCDIR)/fopen-same.h \ $(INCDIR)/filenames.h gconfig.h $(INCDIR)/bin-bugs.h hist.o: hist.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \ gprof.h $(BFDDIR)/sysdep.h ../bfd/config.h $(INCDIR)/fopen-same.h \ $(INCDIR)/filenames.h gconfig.h $(INCDIR)/bin-bugs.h \ - corefile.h ../bfd/bfd.h gmon_io.h gmon.h gmon_out.h \ - hist.h symtab.h source.h search_list.h sym_ids.h utils.h + corefile.h ../bfd/bfd.h $(INCDIR)/symcat.h gmon_io.h \ + gmon.h gmon_out.h hist.h symtab.h source.h search_list.h \ + sym_ids.h utils.h source.o: source.c gprof.h $(INCDIR)/ansidecl.h $(BFDDIR)/sysdep.h \ ../bfd/config.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h \ gconfig.h $(INCDIR)/bin-bugs.h $(INCDIR)/libiberty.h \ @@ -179,36 +185,41 @@ search_list.o: search_list.c $(INCDIR)/l symtab.o: symtab.c gprof.h $(INCDIR)/ansidecl.h $(BFDDIR)/sysdep.h \ ../bfd/config.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h \ gconfig.h $(INCDIR)/bin-bugs.h cg_arcs.h symtab.h ../bfd/bfd.h \ - source.h search_list.h corefile.h + $(INCDIR)/symcat.h source.h search_list.h corefile.h sym_ids.o: sym_ids.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \ - cg_arcs.h gprof.h $(BFDDIR)/sysdep.h ../bfd/config.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h gconfig.h \ - $(INCDIR)/bin-bugs.h symtab.h ../bfd/bfd.h source.h \ - search_list.h sym_ids.h + $(INCDIR)/safe-ctype.h cg_arcs.h gprof.h $(BFDDIR)/sysdep.h \ + ../bfd/config.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h \ + gconfig.h $(INCDIR)/bin-bugs.h symtab.h ../bfd/bfd.h \ + $(INCDIR)/symcat.h source.h search_list.h sym_ids.h utils.o: utils.c gprof.h $(BFDDIR)/sysdep.h ../bfd/config.h \ $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h gconfig.h \ $(INCDIR)/bin-bugs.h cg_arcs.h symtab.h ../bfd/bfd.h \ - source.h search_list.h + $(INCDIR)/symcat.h source.h search_list.h i386.o: i386.c gprof.h $(INCDIR)/ansidecl.h $(BFDDIR)/sysdep.h \ ../bfd/config.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h \ gconfig.h $(INCDIR)/bin-bugs.h cg_arcs.h symtab.h ../bfd/bfd.h \ - source.h search_list.h corefile.h hist.h + $(INCDIR)/symcat.h source.h search_list.h corefile.h \ + hist.h alpha.o: alpha.c gprof.h $(INCDIR)/ansidecl.h $(BFDDIR)/sysdep.h \ ../bfd/config.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h \ gconfig.h $(INCDIR)/bin-bugs.h cg_arcs.h symtab.h ../bfd/bfd.h \ - source.h search_list.h corefile.h hist.h + $(INCDIR)/symcat.h source.h search_list.h corefile.h \ + hist.h vax.o: vax.c gprof.h $(INCDIR)/ansidecl.h $(BFDDIR)/sysdep.h \ ../bfd/config.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h \ gconfig.h $(INCDIR)/bin-bugs.h cg_arcs.h symtab.h ../bfd/bfd.h \ - source.h search_list.h corefile.h hist.h + $(INCDIR)/symcat.h source.h search_list.h corefile.h \ + hist.h tahoe.o: tahoe.c gprof.h $(INCDIR)/ansidecl.h $(BFDDIR)/sysdep.h \ ../bfd/config.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h \ gconfig.h $(INCDIR)/bin-bugs.h cg_arcs.h symtab.h ../bfd/bfd.h \ - source.h search_list.h corefile.h hist.h + $(INCDIR)/symcat.h source.h search_list.h corefile.h \ + hist.h sparc.o: sparc.c gprof.h $(INCDIR)/ansidecl.h $(BFDDIR)/sysdep.h \ ../bfd/config.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h \ gconfig.h $(INCDIR)/bin-bugs.h cg_arcs.h symtab.h ../bfd/bfd.h \ - source.h search_list.h corefile.h hist.h + $(INCDIR)/symcat.h source.h search_list.h corefile.h \ + hist.h flat_bl.o: flat_bl.c bsd_callg_bl.o: bsd_callg_bl.c fsf_callg_bl.o: fsf_callg_bl.c diff -uprN binutils-2.11.90.0.31/gprof/Makefile.in binutils-2.11.92.0.5/gprof/Makefile.in --- binutils-2.11.90.0.31/gprof/Makefile.in Tue Jun 19 11:57:57 2001 +++ binutils-2.11.92.0.5/gprof/Makefile.in Thu Oct 4 14:35:43 2001 @@ -186,13 +186,14 @@ MANS = $(man_MANS) NROFF = nroff HEADERS = $(noinst_HEADERS) -DIST_COMMON = ./stamp-h.in ChangeLog Makefile.am Makefile.in TODO \ -acconfig.h acinclude.m4 aclocal.m4 configure configure.in gconfig.in +DIST_COMMON = README ./stamp-h.in ChangeLog Makefile.am Makefile.in \ +TODO acconfig.h acinclude.m4 aclocal.m4 configure configure.in \ +gconfig.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = gtar +TAR = tar GZIP_ENV = --best SOURCES = $(gprof_SOURCES) OBJECTS = $(gprof_OBJECTS) @@ -733,6 +734,8 @@ gprof.1: $(srcdir)/gprof.texi (rm -f $@.T$$$$ && exit 1) rm -f gprof.pod +Makefile: $(BFDDIR)/configure.in + # Targets to rebuild dependencies in this Makefile. # Have to get rid of DEP1 here so that "$?" later includes all sources. DEP: dep.sed $(gprof_SOURCES) $(noinst_HEADERS) gconfig.h @@ -783,53 +786,57 @@ basic_blocks.o: basic_blocks.c basic_blo $(INCDIR)/ansidecl.h $(BFDDIR)/sysdep.h ../bfd/config.h \ $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h gconfig.h \ $(INCDIR)/bin-bugs.h source.h search_list.h symtab.h \ - ../bfd/bfd.h corefile.h gmon_io.h gmon.h gmon_out.h \ - $(INCDIR)/libiberty.h sym_ids.h + ../bfd/bfd.h $(INCDIR)/symcat.h corefile.h gmon_io.h \ + gmon.h gmon_out.h $(INCDIR)/libiberty.h sym_ids.h call_graph.o: call_graph.c cg_arcs.h gprof.h $(INCDIR)/ansidecl.h \ $(BFDDIR)/sysdep.h ../bfd/config.h $(INCDIR)/fopen-same.h \ $(INCDIR)/filenames.h gconfig.h $(INCDIR)/bin-bugs.h \ - symtab.h ../bfd/bfd.h source.h search_list.h call_graph.h \ - corefile.h gmon_io.h gmon.h gmon_out.h sym_ids.h + symtab.h ../bfd/bfd.h $(INCDIR)/symcat.h source.h search_list.h \ + call_graph.h corefile.h gmon_io.h gmon.h gmon_out.h \ + sym_ids.h cg_arcs.o: cg_arcs.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \ gprof.h $(BFDDIR)/sysdep.h ../bfd/config.h $(INCDIR)/fopen-same.h \ $(INCDIR)/filenames.h gconfig.h $(INCDIR)/bin-bugs.h \ - call_graph.h symtab.h ../bfd/bfd.h source.h search_list.h \ - cg_arcs.h cg_dfn.h cg_print.h utils.h sym_ids.h + call_graph.h symtab.h ../bfd/bfd.h $(INCDIR)/symcat.h \ + source.h search_list.h cg_arcs.h cg_dfn.h cg_print.h \ + utils.h sym_ids.h cg_dfn.o: cg_dfn.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \ gprof.h $(BFDDIR)/sysdep.h ../bfd/config.h $(INCDIR)/fopen-same.h \ $(INCDIR)/filenames.h gconfig.h $(INCDIR)/bin-bugs.h \ - cg_arcs.h symtab.h ../bfd/bfd.h source.h search_list.h \ - cg_dfn.h utils.h + cg_arcs.h symtab.h ../bfd/bfd.h $(INCDIR)/symcat.h \ + source.h search_list.h cg_dfn.h utils.h cg_print.o: cg_print.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \ cg_arcs.h gprof.h $(BFDDIR)/sysdep.h ../bfd/config.h \ $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h gconfig.h \ - $(INCDIR)/bin-bugs.h symtab.h ../bfd/bfd.h source.h \ - search_list.h cg_print.h hist.h utils.h + $(INCDIR)/bin-bugs.h symtab.h ../bfd/bfd.h $(INCDIR)/symcat.h \ + source.h search_list.h cg_print.h hist.h utils.h corefile.o: corefile.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \ gprof.h $(BFDDIR)/sysdep.h ../bfd/config.h $(INCDIR)/fopen-same.h \ $(INCDIR)/filenames.h gconfig.h $(INCDIR)/bin-bugs.h \ - corefile.h ../bfd/bfd.h symtab.h source.h search_list.h + corefile.h ../bfd/bfd.h $(INCDIR)/symcat.h symtab.h \ + source.h search_list.h gmon_io.o: gmon_io.c cg_arcs.h gprof.h $(INCDIR)/ansidecl.h \ $(BFDDIR)/sysdep.h ../bfd/config.h $(INCDIR)/fopen-same.h \ $(INCDIR)/filenames.h gconfig.h $(INCDIR)/bin-bugs.h \ - symtab.h ../bfd/bfd.h source.h search_list.h basic_blocks.h \ - corefile.h call_graph.h gmon_io.h gmon.h gmon_out.h \ - hertz.h hist.h $(INCDIR)/libiberty.h + symtab.h ../bfd/bfd.h $(INCDIR)/symcat.h source.h search_list.h \ + basic_blocks.h corefile.h call_graph.h gmon_io.h gmon.h \ + gmon_out.h hertz.h hist.h $(INCDIR)/libiberty.h gprof.o: gprof.c $(INCDIR)/getopt.h $(INCDIR)/libiberty.h \ $(INCDIR)/ansidecl.h gprof.h $(BFDDIR)/sysdep.h ../bfd/config.h \ $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h gconfig.h \ $(INCDIR)/bin-bugs.h basic_blocks.h source.h search_list.h \ - symtab.h ../bfd/bfd.h call_graph.h cg_arcs.h cg_print.h \ - corefile.h gmon_io.h gmon.h hertz.h hist.h sym_ids.h \ - $(INCDIR)/demangle.h + symtab.h ../bfd/bfd.h $(INCDIR)/symcat.h call_graph.h \ + cg_arcs.h cg_print.h corefile.h gmon_io.h gmon.h hertz.h \ + hist.h sym_ids.h $(INCDIR)/demangle.h hertz.o: hertz.c hertz.h gprof.h $(INCDIR)/ansidecl.h \ $(BFDDIR)/sysdep.h ../bfd/config.h $(INCDIR)/fopen-same.h \ $(INCDIR)/filenames.h gconfig.h $(INCDIR)/bin-bugs.h hist.o: hist.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \ gprof.h $(BFDDIR)/sysdep.h ../bfd/config.h $(INCDIR)/fopen-same.h \ $(INCDIR)/filenames.h gconfig.h $(INCDIR)/bin-bugs.h \ - corefile.h ../bfd/bfd.h gmon_io.h gmon.h gmon_out.h \ - hist.h symtab.h source.h search_list.h sym_ids.h utils.h + corefile.h ../bfd/bfd.h $(INCDIR)/symcat.h gmon_io.h \ + gmon.h gmon_out.h hist.h symtab.h source.h search_list.h \ + sym_ids.h utils.h source.o: source.c gprof.h $(INCDIR)/ansidecl.h $(BFDDIR)/sysdep.h \ ../bfd/config.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h \ gconfig.h $(INCDIR)/bin-bugs.h $(INCDIR)/libiberty.h \ @@ -841,36 +848,41 @@ search_list.o: search_list.c $(INCDIR)/l symtab.o: symtab.c gprof.h $(INCDIR)/ansidecl.h $(BFDDIR)/sysdep.h \ ../bfd/config.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h \ gconfig.h $(INCDIR)/bin-bugs.h cg_arcs.h symtab.h ../bfd/bfd.h \ - source.h search_list.h corefile.h + $(INCDIR)/symcat.h source.h search_list.h corefile.h sym_ids.o: sym_ids.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \ - cg_arcs.h gprof.h $(BFDDIR)/sysdep.h ../bfd/config.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h gconfig.h \ - $(INCDIR)/bin-bugs.h symtab.h ../bfd/bfd.h source.h \ - search_list.h sym_ids.h + $(INCDIR)/safe-ctype.h cg_arcs.h gprof.h $(BFDDIR)/sysdep.h \ + ../bfd/config.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h \ + gconfig.h $(INCDIR)/bin-bugs.h symtab.h ../bfd/bfd.h \ + $(INCDIR)/symcat.h source.h search_list.h sym_ids.h utils.o: utils.c gprof.h $(BFDDIR)/sysdep.h ../bfd/config.h \ $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h gconfig.h \ $(INCDIR)/bin-bugs.h cg_arcs.h symtab.h ../bfd/bfd.h \ - source.h search_list.h + $(INCDIR)/symcat.h source.h search_list.h i386.o: i386.c gprof.h $(INCDIR)/ansidecl.h $(BFDDIR)/sysdep.h \ ../bfd/config.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h \ gconfig.h $(INCDIR)/bin-bugs.h cg_arcs.h symtab.h ../bfd/bfd.h \ - source.h search_list.h corefile.h hist.h + $(INCDIR)/symcat.h source.h search_list.h corefile.h \ + hist.h alpha.o: alpha.c gprof.h $(INCDIR)/ansidecl.h $(BFDDIR)/sysdep.h \ ../bfd/config.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h \ gconfig.h $(INCDIR)/bin-bugs.h cg_arcs.h symtab.h ../bfd/bfd.h \ - source.h search_list.h corefile.h hist.h + $(INCDIR)/symcat.h source.h search_list.h corefile.h \ + hist.h vax.o: vax.c gprof.h $(INCDIR)/ansidecl.h $(BFDDIR)/sysdep.h \ ../bfd/config.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h \ gconfig.h $(INCDIR)/bin-bugs.h cg_arcs.h symtab.h ../bfd/bfd.h \ - source.h search_list.h corefile.h hist.h + $(INCDIR)/symcat.h source.h search_list.h corefile.h \ + hist.h tahoe.o: tahoe.c gprof.h $(INCDIR)/ansidecl.h $(BFDDIR)/sysdep.h \ ../bfd/config.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h \ gconfig.h $(INCDIR)/bin-bugs.h cg_arcs.h symtab.h ../bfd/bfd.h \ - source.h search_list.h corefile.h hist.h + $(INCDIR)/symcat.h source.h search_list.h corefile.h \ + hist.h sparc.o: sparc.c gprof.h $(INCDIR)/ansidecl.h $(BFDDIR)/sysdep.h \ ../bfd/config.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h \ gconfig.h $(INCDIR)/bin-bugs.h cg_arcs.h symtab.h ../bfd/bfd.h \ - source.h search_list.h corefile.h hist.h + $(INCDIR)/symcat.h source.h search_list.h corefile.h \ + hist.h flat_bl.o: flat_bl.c bsd_callg_bl.o: bsd_callg_bl.c fsf_callg_bl.o: fsf_callg_bl.c diff -uprN binutils-2.11.90.0.31/gprof/alpha.c binutils-2.11.92.0.5/gprof/alpha.c --- binutils-2.11.90.0.31/gprof/alpha.c Fri Aug 10 14:08:01 2001 +++ binutils-2.11.92.0.5/gprof/alpha.c Mon Oct 1 15:25:25 2001 @@ -127,7 +127,7 @@ alpha_find_call (parent, p_lowpc, p_high { DBG (CALLDEBUG, printf (_("[find_call] 0x%lx: jsr%s \n"), - (unsigned long) pc - delta, + (unsigned long) pc - (unsigned long) delta, pc->j.func == Jxx_FUNC_JSR ? "" : "_coroutine")); arc_add (parent, &indirect_child, (unsigned long) 0); } @@ -136,7 +136,7 @@ alpha_find_call (parent, p_lowpc, p_high case OP_BSR: DBG (CALLDEBUG, printf (_("[find_call] 0x%lx: bsr"), - (unsigned long) pc - delta)); + (unsigned long) pc - (unsigned long) delta)); /* * Regular PC relative addressing. Check that this is the * address of a function. The linker sometimes redirects diff -uprN binutils-2.11.90.0.31/gprof/configure binutils-2.11.92.0.5/gprof/configure --- binutils-2.11.90.0.31/gprof/configure Mon May 21 11:39:53 2001 +++ binutils-2.11.92.0.5/gprof/configure Thu Oct 4 14:35:43 2001 @@ -4169,7 +4169,7 @@ fi l= - if test -d $srcdir/po; then + if test -f $srcdir/po/POTFILES.in; then test -d po || mkdir po if test "x$srcdir" != "x."; then if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then diff -uprN binutils-2.11.90.0.31/gprof/gprof.c binutils-2.11.92.0.5/gprof/gprof.c --- binutils-2.11.90.0.31/gprof/gprof.c Sat Mar 17 12:48:06 2001 +++ binutils-2.11.92.0.5/gprof/gprof.c Mon Oct 1 15:25:25 2001 @@ -177,6 +177,9 @@ DEFUN (main, (argc, argv), int argc AND #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) setlocale (LC_MESSAGES, ""); #endif +#if defined (HAVE_SETLOCALE) + setlocale (LC_CTYPE, ""); +#endif bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); diff -uprN binutils-2.11.90.0.31/gprof/sparc.c binutils-2.11.92.0.5/gprof/sparc.c --- binutils-2.11.90.0.31/gprof/sparc.c Fri Aug 10 14:08:01 2001 +++ binutils-2.11.92.0.5/gprof/sparc.c Mon Oct 1 15:25:25 2001 @@ -64,7 +64,7 @@ sparc_find_call (parent, p_lowpc, p_high { DBG (CALLDEBUG, printf ("[find_call] 0x%lx: callf", - (unsigned long) instr - delta)); + (unsigned long) instr - (unsigned long) delta)); /* * Regular pc relative addressing check that this is the * address of a function. diff -uprN binutils-2.11.90.0.31/gprof/sym_ids.c binutils-2.11.92.0.5/gprof/sym_ids.c --- binutils-2.11.90.0.31/gprof/sym_ids.c Thu Mar 15 14:56:33 2001 +++ binutils-2.11.92.0.5/gprof/sym_ids.c Mon Oct 1 15:25:25 2001 @@ -19,9 +19,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include - #include "libiberty.h" +#include "safe-ctype.h" #include "cg_arcs.h" #include "sym_ids.h" @@ -123,7 +122,7 @@ DEFUN (parse_spec, (spec, sym), char *sp if (strlen (spec)) { - if (isdigit ((unsigned char) spec[0])) + if (ISDIGIT (spec[0])) sym->line_num = atoi (spec); else sym->name = spec; @@ -139,7 +138,7 @@ DEFUN (parse_spec, (spec, sym), char *sp if (!sym->file) sym->file = &non_existent_file; } - else if (isdigit ((unsigned char) *spec)) + else if (ISDIGIT (*spec)) { sym->line_num = atoi (spec); } diff -uprN binutils-2.11.90.0.31/include/ChangeLog binutils-2.11.92.0.5/include/ChangeLog --- binutils-2.11.90.0.31/include/ChangeLog Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/include/ChangeLog Thu Oct 4 14:35:43 2001 @@ -1,3 +1,33 @@ +2001-10-03 Vassili Karpov + + * bfdlink.h (struct bfd_link_info): Add nocopyreloc field. + +2001-09-24 Kaveh R. Ghazi + + * libiberty.h (reconcat): New function. + +2001-09-18 Kaveh R. Ghazi + + * libiberty.h (concat, concat_length, concat_copy, concat_copy2, + ACONCAT): Improve comments. + +2001-09-18 Alan Modra + + * objalloc.h (OBJALLOC_ALIGN): Define using offsetof. + +2001-09-17 Kaveh R. Ghazi + + * libiberty.h (concat_length, concat_copy, concat_copy2, + libiberty_concat_ptr, ACONCAT): New. + + * libiberty.h (ASTRDUP): New macro. + libiberty_optr, libiberty_nptr, libiberty_len): Declare. + +2001-09-17 Kaveh R. Ghazi + + * libiberty.h (ASTRDUP): New macro. + libiberty_optr, libiberty_nptr, libiberty_len): Declare. + 2001-08-29 Kaveh R. Ghazi * ansidecl.h: Update comments reflecting previous change. diff -uprN binutils-2.11.90.0.31/include/aout/ChangeLog binutils-2.11.92.0.5/include/aout/ChangeLog --- binutils-2.11.90.0.31/include/aout/ChangeLog Thu Mar 15 14:53:02 2001 +++ binutils-2.11.92.0.5/include/aout/ChangeLog Mon Oct 1 15:25:25 2001 @@ -1,3 +1,11 @@ +2001-09-18 Alan Modra + + * aout64.h: Formatting fixes. + (N_TXTADDR): Evaluate to a bfd_vma. + (N_DATADDR): Avoid negative unsigned warning. + * hp300hpux.h: Formatting fixes. + (N_DATADDR): Avoid negative unsigned warning. + Mon Apr 3 13:29:08 2000 Hans-Peter Nilsson * aout64.h (RELOC_EXT_BITS_EXTERN_BIG): Wrap definition in #ifndef. diff -uprN binutils-2.11.90.0.31/include/aout/aout64.h binutils-2.11.92.0.5/include/aout/aout64.h --- binutils-2.11.90.0.31/include/aout/aout64.h Thu Mar 15 14:53:02 2001 +++ binutils-2.11.92.0.5/include/aout/aout64.h Mon Oct 1 15:25:25 2001 @@ -131,7 +131,8 @@ struct external_exec /* This macro is only relevant for ZMAGIC files; QMAGIC always has the header in the text. */ #ifndef N_HEADER_IN_TEXT -#define N_HEADER_IN_TEXT(x) (((x).a_entry & (TARGET_PAGE_SIZE-1)) >= EXEC_BYTES_SIZE) +#define N_HEADER_IN_TEXT(x) \ + (((x).a_entry & (TARGET_PAGE_SIZE-1)) >= EXEC_BYTES_SIZE) #endif /* Sun shared libraries, not linux. This macro is only relevant for ZMAGIC @@ -151,15 +152,17 @@ struct external_exec #ifndef N_TXTADDR #define N_TXTADDR(x) \ - (/* The address of a QMAGIC file is always one page in, */ \ - /* with the header in the text. */ \ - N_IS_QMAGIC (x) ? TARGET_PAGE_SIZE + EXEC_BYTES_SIZE : \ - N_MAGIC(x) != ZMAGIC ? 0 : /* object file or NMAGIC */\ - N_SHARED_LIB(x) ? 0 : \ - N_HEADER_IN_TEXT(x) ? \ - TEXT_START_ADDR + EXEC_BYTES_SIZE : /* no padding */\ - TEXT_START_ADDR /* a page of padding */\ - ) + (/* The address of a QMAGIC file is always one page in, */ \ + /* with the header in the text. */ \ + N_IS_QMAGIC (x) \ + ? (bfd_vma) TARGET_PAGE_SIZE + EXEC_BYTES_SIZE \ + : (N_MAGIC (x) != ZMAGIC \ + ? (bfd_vma) 0 /* object file or NMAGIC */ \ + : (N_SHARED_LIB (x) \ + ? (bfd_vma) 0 \ + : (N_HEADER_IN_TEXT (x) \ + ? (bfd_vma) TEXT_START_ADDR + EXEC_BYTES_SIZE \ + : (bfd_vma) TEXT_START_ADDR)))) #endif /* If N_HEADER_IN_TEXT is not true for ZMAGIC, there is some padding @@ -177,14 +180,15 @@ struct external_exec /* Offset in an a.out of the start of the text section. */ #ifndef N_TXTOFF -#define N_TXTOFF(x) \ - (/* For {O,N,Q}MAGIC, no padding. */ \ - N_MAGIC(x) != ZMAGIC ? EXEC_BYTES_SIZE : \ - N_SHARED_LIB(x) ? 0 : \ - N_HEADER_IN_TEXT(x) ? \ - EXEC_BYTES_SIZE : /* no padding */\ - ZMAGIC_DISK_BLOCK_SIZE /* a page of padding */\ - ) +#define N_TXTOFF(x) \ + (/* For {O,N,Q}MAGIC, no padding. */ \ + N_MAGIC (x) != ZMAGIC \ + ? EXEC_BYTES_SIZE \ + : (N_SHARED_LIB (x) \ + ? 0 \ + : (N_HEADER_IN_TEXT (x) \ + ? EXEC_BYTES_SIZE /* no padding */ \ + : ZMAGIC_DISK_BLOCK_SIZE /* a page of padding */))) #endif /* Size of the text section. It's always as stated, except that we offset it to `undo' the adjustment to N_TXTADDR and N_TXTOFF @@ -193,25 +197,28 @@ struct external_exec exec header to be part of the text segment.) */ #ifndef N_TXTSIZE #define N_TXTSIZE(x) \ - (/* For QMAGIC, we don't consider the header part of the text section. */\ - N_IS_QMAGIC (x) ? (x).a_text - EXEC_BYTES_SIZE : \ - (N_MAGIC(x) != ZMAGIC || N_SHARED_LIB(x)) ? (x).a_text : \ - N_HEADER_IN_TEXT(x) ? \ - (x).a_text - EXEC_BYTES_SIZE: /* no padding */\ - (x).a_text /* a page of padding */\ - ) + (/* For QMAGIC, we don't consider the header part of the text section. */\ + N_IS_QMAGIC (x) \ + ? (x).a_text - EXEC_BYTES_SIZE \ + : ((N_MAGIC (x) != ZMAGIC || N_SHARED_LIB (x)) \ + ? (x).a_text \ + : (N_HEADER_IN_TEXT (x) \ + ? (x).a_text - EXEC_BYTES_SIZE /* no padding */ \ + : (x).a_text /* a page of padding */ ))) #endif /* The address of the data segment in virtual memory. It is the text segment address, plus text segment size, rounded up to a N_SEGSIZE boundary for pure or pageable files. */ #ifndef N_DATADDR #define N_DATADDR(x) \ - (N_MAGIC(x)==OMAGIC? (N_TXTADDR(x)+N_TXTSIZE(x)) \ - : (N_SEGSIZE(x) + ((N_TXTADDR(x)+N_TXTSIZE(x)-1) & ~(N_SEGSIZE(x)-1)))) + (N_MAGIC (x) == OMAGIC \ + ? (N_TXTADDR (x) + N_TXTSIZE (x)) \ + : (N_SEGSIZE (x) + ((N_TXTADDR (x) + N_TXTSIZE (x) - 1) \ + & ~ (bfd_vma) (N_SEGSIZE (x) - 1)))) #endif /* The address of the BSS segment -- immediately after the data segment. */ -#define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data) +#define N_BSSADDR(x) (N_DATADDR (x) + (x).a_data) /* Offsets of the various portions of the file after the text segment. */ @@ -228,21 +235,19 @@ struct external_exec for NMAGIC. */ #ifndef N_DATOFF -#define N_DATOFF(x) \ - (N_TXTOFF(x) + N_TXTSIZE(x)) +#define N_DATOFF(x) ( N_TXTOFF (x) + N_TXTSIZE (x) ) #endif - #ifndef N_TRELOFF -#define N_TRELOFF(x) ( N_DATOFF(x) + (x).a_data ) +#define N_TRELOFF(x) ( N_DATOFF (x) + (x).a_data ) #endif #ifndef N_DRELOFF -#define N_DRELOFF(x) ( N_TRELOFF(x) + (x).a_trsize ) +#define N_DRELOFF(x) ( N_TRELOFF (x) + (x).a_trsize ) #endif #ifndef N_SYMOFF -#define N_SYMOFF(x) ( N_DRELOFF(x) + (x).a_drsize ) +#define N_SYMOFF(x) ( N_DRELOFF (x) + (x).a_drsize ) #endif #ifndef N_STROFF -#define N_STROFF(x) ( N_SYMOFF(x) + (x).a_syms ) +#define N_STROFF(x) ( N_SYMOFF (x) + (x).a_syms ) #endif /* Symbols */ diff -uprN binutils-2.11.90.0.31/include/aout/hp300hpux.h binutils-2.11.92.0.5/include/aout/hp300hpux.h --- binutils-2.11.90.0.31/include/aout/hp300hpux.h Sun Mar 18 17:49:37 2001 +++ binutils-2.11.92.0.5/include/aout/hp300hpux.h Mon Oct 1 15:25:25 2001 @@ -1,5 +1,5 @@ /* Special version of for use under hp-ux. - Copyright 1988, 1993, 1995 Free Software Foundation, Inc. */ + Copyright 1988, 1993, 1995, 2001 Free Software Foundation, Inc. */ struct hp300hpux_exec_bytes { @@ -73,13 +73,13 @@ struct hp300hpux_header_extension #define N_BADMAG(x) ((_N_BADMAG (x)) || (_N_BADMACH (x))) #define N_DATADDR(x) \ - ((N_MAGIC(x)==OMAGIC || N_MAGIC(x)==HPUX_DOT_O_MAGIC) ? \ - (N_TXTADDR(x)+N_TXTSIZE(x)) \ - : (N_SEGSIZE(x) + ((N_TXTADDR(x)+N_TXTSIZE(x)-1) & ~(N_SEGSIZE(x)-1)))) - -#define _N_BADMACH(x) \ -(((N_MACHTYPE (x)) != HP9000S200_ID) && \ - ((N_MACHTYPE (x)) != HP98x6_ID)) + ((N_MAGIC (x) == OMAGIC || N_MAGIC (x) == HPUX_DOT_O_MAGIC) \ + ? (N_TXTADDR (x) + N_TXTSIZE (x)) \ + : (N_SEGSIZE (x) + ((N_TXTADDR (x) + N_TXTSIZE (x) - 1) \ + & ~ (bfd_vma) (N_SEGSIZE (x) - 1)))) + +#define _N_BADMACH(x) \ + (((N_MACHTYPE (x)) != HP9000S200_ID) && ((N_MACHTYPE (x)) != HP98x6_ID)) #define _N_BADMAG(x) (N_MAGIC(x) != HPUX_DOT_O_MAGIC \ && N_MAGIC(x) != OMAGIC \ diff -uprN binutils-2.11.90.0.31/include/bfdlink.h binutils-2.11.92.0.5/include/bfdlink.h --- binutils-2.11.90.0.31/include/bfdlink.h Mon Aug 27 11:44:52 2001 +++ binutils-2.11.92.0.5/include/bfdlink.h Thu Oct 4 14:35:43 2001 @@ -294,6 +294,10 @@ struct bfd_link_info and sorted so that relocs against the same symbol come together. */ boolean combreloc; + /* True if executable should not contain copy relocs. + Setting this true may result in a non-sharable text segment. */ + boolean nocopyreloc; + /* How many spare .dynamic DT_NULL entries should be added? */ unsigned int spare_dynamic_tags; }; diff -uprN binutils-2.11.90.0.31/include/coff/ChangeLog binutils-2.11.92.0.5/include/coff/ChangeLog --- binutils-2.11.90.0.31/include/coff/ChangeLog Mon Aug 27 11:44:52 2001 +++ binutils-2.11.92.0.5/include/coff/ChangeLog Mon Oct 1 15:25:25 2001 @@ -1,3 +1,22 @@ +2001-09-21 Nick Clifton + + * ti.h (GET_SCNHDR_PAGE): Fix compile time warning. + +2001-09-18 Alan Modra + + * external.h (GET_LINENO_LNNO): Use H_GET_32/16. + (PUT_LINENO_LNNO): Use H_PUT_32/16. + * m88k.h (GET_LNSZ_SIZE, GET_LNSZ_LNNO, GET_SCN_NRELOC, + GET_SCN_NLINNO): Use H_GET_32. + (PUT_LNSZ_LNNO, PUT_LNSZ_SIZE, PUT_SCN_NRELOC, PUT_SCN_NLINNO): + Use H_PUT_32. + * ti.h: Formatting fixes. Make use of H_GET_* and H_PUT_* throughout. + * xcoff.h: White space changes. + +2001-09-05 Tom Rix + + * xcoff.h : Add XCOFF_SYSCALL32 and XCOFF_SYSCALL64 hash table flags. + 2001-08-27 Andreas Jaeger * xcoff.h (struct __rtinit): Make proper prototype for rtl. diff -uprN binutils-2.11.90.0.31/include/coff/external.h binutils-2.11.92.0.5/include/coff/external.h --- binutils-2.11.90.0.31/include/coff/external.h Tue Mar 27 08:47:44 2001 +++ binutils-2.11.92.0.5/include/coff/external.h Mon Oct 1 15:25:25 2001 @@ -113,12 +113,12 @@ struct external_lineno #define LINESZ (4 + L_LNNO_SIZE) #if L_LNNO_SIZE == 4 -#define GET_LINENO_LNNO(abfd, ext) bfd_h_get_32 (abfd, (bfd_byte *) (ext->l_lnno)); -#define PUT_LINENO_LNNO(abfd, val, ext) bfd_h_put_32 (abfd, val, (bfd_byte *) (ext->l_lnno)); +#define GET_LINENO_LNNO H_GET_32 +#define PUT_LINENO_LNNO H_PUT_32 #endif #if L_LNNO_SIZE == 2 -#define GET_LINENO_LNNO(abfd, ext) bfd_h_get_16 (abfd, (bfd_byte *) (ext->l_lnno)); -#define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_16 (abfd,val, (bfd_byte *) (ext->l_lnno)); +#define GET_LINENO_LNNO H_GET_16 +#define PUT_LINENO_LNNO H_PUT_16 #endif #endif /* not DO_NOT_DEFINE_LINENO */ diff -uprN binutils-2.11.90.0.31/include/coff/m88k.h binutils-2.11.92.0.5/include/coff/m88k.h --- binutils-2.11.90.0.31/include/coff/m88k.h Tue Mar 27 08:47:43 2001 +++ binutils-2.11.92.0.5/include/coff/m88k.h Mon Oct 1 15:25:25 2001 @@ -158,20 +158,22 @@ union external_auxent } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ }; -#define GET_FCN_LNNOPTR(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *)ext->x_sym.x_fcnary.x_fcn.x_lnnoptr) -#define GET_FCN_ENDNDX(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx) -#define PUT_FCN_LNNOPTR(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr) -#define PUT_FCN_ENDNDX(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx) -#define GET_LNSZ_SIZE(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_size) -#define GET_LNSZ_LNNO(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_lnno) -#define PUT_LNSZ_LNNO(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_lnno) -#define PUT_LNSZ_SIZE(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_size) -#define GET_SCN_SCNLEN(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_scn.x_scnlen) -#define GET_SCN_NRELOC(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_scn.x_nreloc) -#define GET_SCN_NLINNO(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_scn.x_nlinno) -#define PUT_SCN_SCNLEN(abfd,in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_scn.x_scnlen) -#define PUT_SCN_NRELOC(abfd,in, ext) bfd_h_put_32(abfd, in, (bfd_byte *)ext->x_scn.x_nreloc) -#define PUT_SCN_NLINNO(abfd,in, ext) bfd_h_put_32(abfd,in, (bfd_byte *) ext->x_scn.x_nlinno) +#define GET_LNSZ_SIZE(abfd, ext) \ + H_GET_32 (abfd, ext->x_sym.x_misc.x_lnsz.x_size) +#define GET_LNSZ_LNNO(abfd, ext) \ + H_GET_32 (abfd, ext->x_sym.x_misc.x_lnsz.x_lnno) +#define PUT_LNSZ_LNNO(abfd, in, ext) \ + H_PUT_32 (abfd, in, ext->x_sym.x_misc.x_lnsz.x_lnno) +#define PUT_LNSZ_SIZE(abfd, in, ext) \ + H_PUT_32 (abfd, in, ext->x_sym.x_misc.x_lnsz.x_size) +#define GET_SCN_NRELOC(abfd, ext) \ + H_GET_32 (abfd, ext->x_scn.x_nreloc) +#define GET_SCN_NLINNO(abfd, ext) \ + H_GET_32 (abfd, ext->x_scn.x_nlinno) +#define PUT_SCN_NRELOC(abfd, in, ext) \ + H_PUT_32 (abfd, in, ext->x_scn.x_nreloc) +#define PUT_SCN_NLINNO(abfd, in, ext) \ + H_PUT_32 (abfd,in, ext->x_scn.x_nlinno) #define SYMENT struct external_syment #define SYMESZ 20 diff -uprN binutils-2.11.90.0.31/include/coff/ti.h binutils-2.11.92.0.5/include/coff/ti.h --- binutils-2.11.90.0.31/include/coff/ti.h Thu Mar 15 14:53:05 2001 +++ binutils-2.11.92.0.5/include/coff/ti.h Mon Oct 1 15:25:25 2001 @@ -91,17 +91,23 @@ struct external_filehdr /* we need to read/write an extra field in the coff file header */ #ifndef COFF_ADJUST_FILEHDR_IN_POST -#define COFF_ADJUST_FILEHDR_IN_POST(abfd,src,dst) \ -do { ((struct internal_filehdr *)(dst))->f_target_id = \ -bfd_h_get_16(abfd, (bfd_byte *)(((FILHDR *)(src))->f_target_id)); \ -} while(0) +#define COFF_ADJUST_FILEHDR_IN_POST(abfd, src, dst) \ + do \ + { \ + ((struct internal_filehdr *)(dst))->f_target_id = \ + H_GET_16 (abfd, ((FILHDR *)(src))->f_target_id); \ + } \ + while (0) #endif #ifndef COFF_ADJUST_FILEHDR_OUT_POST -#define COFF_ADJUST_FILEHDR_OUT_POST(abfd,src,dst) \ -do { bfd_h_put_16(abfd, ((struct internal_filehdr *)(src))->f_target_id, \ - (bfd_byte *)(((FILHDR *)(dst))->f_target_id)); \ -} while(0) +#define COFF_ADJUST_FILEHDR_OUT_POST(abfd, src, dst) \ + do \ + { \ + H_PUT_16 (abfd, ((struct internal_filehdr *)(src))->f_target_id, \ + ((FILHDR *)(dst))->f_target_id); \ + } \ + while (0) #endif #define FILHDR struct external_filehdr @@ -200,53 +206,59 @@ struct external_scnhdr { Assume we're dealing with the COFF2 scnhdr structure, and adjust accordingly */ -#define GET_SCNHDR_NRELOC(ABFD,PTR) \ -(COFF2_P(ABFD) ? bfd_h_get_32 (ABFD,PTR) : bfd_h_get_16 (ABFD, PTR)) -#define PUT_SCNHDR_NRELOC(ABFD,VAL,PTR) \ -(COFF2_P(ABFD) ? bfd_h_put_32 (ABFD,VAL,PTR) : bfd_h_put_16 (ABFD,VAL,PTR)) -#define GET_SCNHDR_NLNNO(ABFD,PTR) \ -(COFF2_P(ABFD) ? bfd_h_get_32 (ABFD,PTR) : bfd_h_get_16 (ABFD, (PTR)-2)) -#define PUT_SCNHDR_NLNNO(ABFD,VAL,PTR) \ -(COFF2_P(ABFD) ? bfd_h_put_32 (ABFD,VAL,PTR) : bfd_h_put_16 (ABFD,VAL,(PTR)-2)) -#define GET_SCNHDR_FLAGS(ABFD,PTR) \ -(COFF2_P(ABFD) ? bfd_h_get_32 (ABFD,PTR) : bfd_h_get_16 (ABFD, (PTR)-4)) -#define PUT_SCNHDR_FLAGS(ABFD,VAL,PTR) \ -(COFF2_P(ABFD) ? bfd_h_put_32 (ABFD,VAL,PTR) : bfd_h_put_16 (ABFD,VAL,(PTR)-4)) -#define GET_SCNHDR_PAGE(ABFD,PTR) \ -(COFF2_P(ABFD) ? bfd_h_get_16 (ABFD,PTR) : bfd_h_get_8 (ABFD, (PTR)-7)) +#define GET_SCNHDR_NRELOC(ABFD, PTR) \ + (COFF2_P (ABFD) ? H_GET_32 (ABFD, PTR) : H_GET_16 (ABFD, PTR)) +#define PUT_SCNHDR_NRELOC(ABFD, VAL, PTR) \ + (COFF2_P (ABFD) ? H_PUT_32 (ABFD, VAL, PTR) : H_PUT_16 (ABFD, VAL, PTR)) +#define GET_SCNHDR_NLNNO(ABFD, PTR) \ + (COFF2_P (ABFD) ? H_GET_32 (ABFD, PTR) : H_GET_16 (ABFD, (PTR) -2)) +#define PUT_SCNHDR_NLNNO(ABFD, VAL, PTR) \ + (COFF2_P (ABFD) ? H_PUT_32 (ABFD, VAL, PTR) : H_PUT_16 (ABFD, VAL, (PTR) -2)) +#define GET_SCNHDR_FLAGS(ABFD, PTR) \ + (COFF2_P (ABFD) ? H_GET_32 (ABFD, PTR) : H_GET_16 (ABFD, (PTR) -4)) +#define PUT_SCNHDR_FLAGS(ABFD, VAL, PTR) \ + (COFF2_P (ABFD) ? H_PUT_32 (ABFD, VAL, PTR) : H_PUT_16 (ABFD, VAL, (PTR) -4)) +#define GET_SCNHDR_PAGE(ABFD, PTR) \ + (COFF2_P (ABFD) ? H_GET_16 (ABFD, PTR) : (unsigned) H_GET_8 (ABFD, (PTR) -7)) /* on output, make sure that the "reserved" field is zero */ -#define PUT_SCNHDR_PAGE(ABFD,VAL,PTR) \ -(COFF2_P(ABFD) ? bfd_h_put_16 (ABFD,VAL,PTR) : \ -bfd_h_put_8 (ABFD,VAL,(PTR)-7), bfd_h_put_8 (ABFD, 0, (PTR)-8)) +#define PUT_SCNHDR_PAGE(ABFD, VAL, PTR) \ + (COFF2_P (ABFD) \ + ? H_PUT_16 (ABFD, VAL, PTR) \ + : H_PUT_8 (ABFD, VAL, (PTR) -7), H_PUT_8 (ABFD, 0, (PTR) -8)) /* TI COFF stores section size as number of bytes (address units, not octets), so adjust to be number of octets, which is what BFD expects */ -#define GET_SCNHDR_SIZE(ABFD,SZP) \ -(bfd_h_get_32(ABFD,SZP)*bfd_octets_per_byte(ABFD)) -#define PUT_SCNHDR_SIZE(ABFD,SZ,SZP) \ -bfd_h_put_32(ABFD,(SZ)/bfd_octets_per_byte(ABFD),SZP) - -#define COFF_ADJUST_SCNHDR_IN_POST(ABFD,EXT,INT) \ -do { ((struct internal_scnhdr *)(INT))->s_page = \ -GET_SCNHDR_PAGE(ABFD,(bfd_byte *)((SCNHDR *)(EXT))->s_page); \ -} while(0) +#define GET_SCNHDR_SIZE(ABFD, SZP) \ + (H_GET_32 (ABFD, SZP) * bfd_octets_per_byte (ABFD)) +#define PUT_SCNHDR_SIZE(ABFD, SZ, SZP) \ + H_PUT_32 (ABFD, (SZ) / bfd_octets_per_byte (ABFD), SZP) + +#define COFF_ADJUST_SCNHDR_IN_POST(ABFD, EXT, INT) \ + do \ + { \ + ((struct internal_scnhdr *)(INT))->s_page = \ + GET_SCNHDR_PAGE (ABFD, ((SCNHDR *)(EXT))->s_page); \ + } \ + while (0) /* The line number and reloc overflow checking in coff_swap_scnhdr_out in coffswap.h doesn't use PUT_X for s_nlnno and s_nreloc. Due to different sized v0/v1/v2 section headers, we have to re-write these fields. */ -#define COFF_ADJUST_SCNHDR_OUT_POST(ABFD,INT,EXT) \ -do { \ -PUT_SCNHDR_NLNNO(ABFD,((struct internal_scnhdr *)(INT))->s_nlnno,\ - (bfd_byte *)((SCNHDR *)(EXT))->s_nlnno); \ -PUT_SCNHDR_NRELOC(ABFD,((struct internal_scnhdr *)(INT))->s_nreloc,\ - (bfd_byte *)((SCNHDR *)(EXT))->s_nreloc); \ -PUT_SCNHDR_FLAGS(ABFD,((struct internal_scnhdr *)(INT))->s_flags, \ - (bfd_byte *)((SCNHDR *)(EXT))->s_flags); \ -PUT_SCNHDR_PAGE(ABFD,((struct internal_scnhdr *)(INT))->s_page, \ - (bfd_byte *)((SCNHDR *)(EXT))->s_page); \ -} while(0) +#define COFF_ADJUST_SCNHDR_OUT_POST(ABFD, INT, EXT) \ + do \ + { \ + PUT_SCNHDR_NLNNO (ABFD, ((struct internal_scnhdr *)(INT))->s_nlnno, \ + ((SCNHDR *)(EXT))->s_nlnno); \ + PUT_SCNHDR_NRELOC (ABFD, ((struct internal_scnhdr *)(INT))->s_nreloc,\ + ((SCNHDR *)(EXT))->s_nreloc); \ + PUT_SCNHDR_FLAGS (ABFD, ((struct internal_scnhdr *)(INT))->s_flags, \ + ((SCNHDR *)(EXT))->s_flags); \ + PUT_SCNHDR_PAGE (ABFD, ((struct internal_scnhdr *)(INT))->s_page, \ + ((SCNHDR *)(EXT))->s_page); \ + } \ + while (0) /* Page macros @@ -386,40 +398,45 @@ union external_auxent { #define AUXESZ 18 /* section lengths are in target bytes (not host bytes) */ -#define GET_SCN_SCNLEN(ABFD,EXT) \ -(bfd_h_get_32(ABFD,(bfd_byte *)(EXT)->x_scn.x_scnlen)*bfd_octets_per_byte(ABFD)) -#define PUT_SCN_SCNLEN(ABFD,INT,EXT) \ -bfd_h_put_32(ABFD,(INT)/bfd_octets_per_byte(ABFD),\ - (bfd_byte *)(EXT)->x_scn.x_scnlen) +#define GET_SCN_SCNLEN(ABFD, EXT) \ + (H_GET_32 (ABFD, (EXT)->x_scn.x_scnlen) * bfd_octets_per_byte (ABFD)) +#define PUT_SCN_SCNLEN(ABFD, INT, EXT) \ + H_PUT_32 (ABFD, (INT) / bfd_octets_per_byte (ABFD), (EXT)->x_scn.x_scnlen) /* lnsz size is in bits in COFF file, in bytes in BFD */ #define GET_LNSZ_SIZE(abfd, ext) \ -(bfd_h_get_16(abfd, (bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_size) / \ - (class != C_FIELD ? 8 : 1)) + (H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_size) / (class != C_FIELD ? 8 : 1)) #define PUT_LNSZ_SIZE(abfd, in, ext) \ - bfd_h_put_16(abfd, ((class != C_FIELD) ? (in)*8 : (in)), \ - (bfd_byte*) ext->x_sym.x_misc.x_lnsz.x_size) + H_PUT_16 (abfd, ((class != C_FIELD) ? (in) * 8 : (in)), \ + ext->x_sym.x_misc.x_lnsz.x_size) /* TI COFF stores offsets for MOS and MOU in bits; BFD expects bytes */ -#define COFF_ADJUST_SYM_IN_POST(ABFD,EXT,INT) \ -do { struct internal_syment *dst = (struct internal_syment *)(INT); \ -if (dst->n_sclass == C_MOS || dst->n_sclass == C_MOU) dst->n_value /= 8; \ -} while (0) - -#define COFF_ADJUST_SYM_OUT_POST(ABFD,INT,EXT) \ -do { struct internal_syment *src = (struct internal_syment *)(INT); \ -SYMENT *dst = (SYMENT *)(EXT); \ -if(src->n_sclass == C_MOU || src->n_sclass == C_MOS) \ -bfd_h_put_32(abfd,src->n_value * 8,(bfd_byte *)dst->e_value); \ -} while (0) +#define COFF_ADJUST_SYM_IN_POST(ABFD, EXT, INT) \ + do \ + { \ + struct internal_syment *dst = (struct internal_syment *)(INT); \ + if (dst->n_sclass == C_MOS || dst->n_sclass == C_MOU) \ + dst->n_value /= 8; \ + } \ + while (0) + +#define COFF_ADJUST_SYM_OUT_POST(ABFD, INT, EXT) \ + do \ + { \ + struct internal_syment *src = (struct internal_syment *)(INT); \ + SYMENT *dst = (SYMENT *)(EXT); \ + if (src->n_sclass == C_MOU || src->n_sclass == C_MOS) \ + H_PUT_32 (abfd, src->n_value * 8, dst->e_value); \ + } \ + while (0) /* Detect section-relative absolute symbols so they get flagged with a sym index of -1. */ -#define SECTION_RELATIVE_ABSOLUTE_SYMBOL_P(RELOC,SECT) \ -((*(RELOC)->sym_ptr_ptr)->section->output_section == (SECT) \ - && (RELOC)->howto->name[0] == 'A') +#define SECTION_RELATIVE_ABSOLUTE_SYMBOL_P(RELOC, SECT) \ + ((*(RELOC)->sym_ptr_ptr)->section->output_section == (SECT) \ + && (RELOC)->howto->name[0] == 'A') /********************** RELOCATION DIRECTIVES **********************/ diff -uprN binutils-2.11.90.0.31/include/coff/xcoff.h binutils-2.11.92.0.5/include/coff/xcoff.h --- binutils-2.11.90.0.31/include/coff/xcoff.h Mon Aug 27 11:44:52 2001 +++ binutils-2.11.92.0.5/include/coff/xcoff.h Mon Oct 1 15:25:25 2001 @@ -1,6 +1,7 @@ /* Internal format of XCOFF object file data structures for BFD. - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001 + Free Software Foundation, Inc. Written by Ian Lance Taylor , Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -122,6 +123,8 @@ /* 14 ??? */ #define XMC_TC0 15 /* Read-write TOC anchor */ #define XMC_TD 16 /* Read-write data in TOC */ +#define XMC_SV64 17 /* Read-only 64 bit supervisor call */ +#define XMC_SV3264 18 /* Read-only 32 or 64 bit supervisor call */ /* The ldhdr structure. This appears at the start of the .loader section. */ @@ -305,6 +308,11 @@ struct xcoff_link_hash_entry * XCOFF_RTINIT * Symbol is the __rtinit symbol * + * XCOFF_SYSCALL32 + * Symbol is an imported 32 bit syscall + * + * XCOFF_SYSCALL64 + * Symbol is an imported 64 bit syscall */ #define XCOFF_REF_REGULAR 0x00000001 @@ -322,7 +330,8 @@ struct xcoff_link_hash_entry #define XCOFF_DESCRIPTOR 0x00001000 #define XCOFF_MULTIPLY_DEFINED 0x00002000 #define XCOFF_RTINIT 0x00004000 - +#define XCOFF_SYSCALL32 0x00008000 +#define XCOFF_SYSCALL64 0x00010000 /* The XCOFF linker hash table. */ @@ -417,7 +426,7 @@ struct xcoff_loader_info /* In case we're on a 32-bit machine, construct a 64-bit "-1" value from smaller values. Start with zero, widen, *then* decrement. */ -#define MINUS_ONE (((bfd_vma)0) - 1) +#define MINUS_ONE (((bfd_vma) 0) - 1) /* diff -uprN binutils-2.11.90.0.31/include/elf/ChangeLog binutils-2.11.92.0.5/include/elf/ChangeLog --- binutils-2.11.90.0.31/include/elf/ChangeLog Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/include/elf/ChangeLog Mon Oct 1 15:25:25 2001 @@ -1,3 +1,31 @@ +2001-09-18 Alan Modra + + * internal.h (elf_internal_rela): Make r_addend a bfd_vma. + +2001-09-13 Alexandre Oliva + + * common.h (EM_OPENRISC_OLD): Renamed the old EM_OPENRISC entry. + +2001-09-12 Alexandre Oliva + + * common.h (EM_AVR_OLD): Renamed from... + (EM_AVR): this, redefined as in the current ELF standard. + (EM_PJ_OLD): Renamed from... + (EM_PJ): this, redefined as in the current ELF standard. + (EM_R30, EM_D10V, EM_D30V, EM_V850, EM_M32R, EM_MN10300, + EM_MN10200, EM_OPENRISC, EM_ARC_A5, EM_XTENSA): Defined as in + the current ELF standard. + (EM_CYGNUS_ARC): Removed, unused for a long time. + +2001-09-04 Richard Henderson + + * alpha.h (R_ALPHA_OP*, R_ALPHA_IMMED*, R_ALPHA_GPVALUE): Remove. + (R_ALPHA_GPREL16): Rename from R_ALPHA_IMMED_GP_16. + +2001-08-30 Eric Christopher + + * mips.h: Remove E_MIPS_MACH_MIPS32_4K. + 2001-08-29 Jeff Law * h8.h (EF_H8_MACH): New mask for encoded machine type. @@ -14,7 +42,7 @@ Tue Aug 26 23:32:34 2001 J"orn Rennecke 2001-06-30 Daniel Berlin - * dwarf2.h: Remerge with gcc version, + * dwarf2.h: Remerge with gcc version, including all new DWARF 2.1 extensions. 2001-06-29 James Cownie @@ -59,7 +87,7 @@ Tue Aug 26 23:32:34 2001 J"orn Rennecke 2001-04-20 Johan Rydberg * openrisc.h: New file. - * common.h (EM_OPENRISC): New constant. + * common.h (EM_OPENRISC): New constant. 2001-04-23 Bo Thorsen diff -uprN binutils-2.11.90.0.31/include/elf/alpha.h binutils-2.11.92.0.5/include/elf/alpha.h --- binutils-2.11.90.0.31/include/elf/alpha.h Thu Mar 15 14:53:06 2001 +++ binutils-2.11.92.0.5/include/elf/alpha.h Mon Oct 1 15:25:25 2001 @@ -80,23 +80,15 @@ START_RELOC_NUMBERS (elf_alpha_reloc_typ RELOC_NUMBER (R_ALPHA_SREL32, 10) /* PC relative 32 bit */ RELOC_NUMBER (R_ALPHA_SREL64, 11) /* PC relative 64 bit */ -/* Inherited these from ECOFF, but they are not particularly useful - and are depreciated. And not implemented in the BFD, btw. */ - RELOC_NUMBER (R_ALPHA_OP_PUSH, 12) /* OP stack push */ - RELOC_NUMBER (R_ALPHA_OP_STORE, 13) /* OP stack pop and store */ - RELOC_NUMBER (R_ALPHA_OP_PSUB, 14) /* OP stack subtract */ - RELOC_NUMBER (R_ALPHA_OP_PRSHIFT, 15) /* OP stack right shift */ + /* Skip 12 - 16; deprecated ECOFF relocs. */ - RELOC_NUMBER (R_ALPHA_GPVALUE, 16) - RELOC_NUMBER (R_ALPHA_GPRELHIGH, 17) - RELOC_NUMBER (R_ALPHA_GPRELLOW, 18) - RELOC_NUMBER (R_ALPHA_IMMED_GP_16, 19) - RELOC_NUMBER (R_ALPHA_IMMED_GP_HI32, 20) - RELOC_NUMBER (R_ALPHA_IMMED_SCN_HI32, 21) - RELOC_NUMBER (R_ALPHA_IMMED_BR_HI32, 22) - RELOC_NUMBER (R_ALPHA_IMMED_LO32, 23) + RELOC_NUMBER (R_ALPHA_GPRELHIGH, 17) /* GP relative 32 bit, high 16 bits */ + RELOC_NUMBER (R_ALPHA_GPRELLOW, 18) /* GP relative 32 bit, low 16 bits */ + RELOC_NUMBER (R_ALPHA_GPREL16, 19) /* GP relative 16 bit */ -/* These relocations are specific to shared libraries. */ + /* Skip 20 - 23; deprecated ECOFF relocs. */ + + /* These relocations are specific to shared libraries. */ RELOC_NUMBER (R_ALPHA_COPY, 24) /* Copy symbol at runtime */ RELOC_NUMBER (R_ALPHA_GLOB_DAT, 25) /* Create GOT entry */ RELOC_NUMBER (R_ALPHA_JMP_SLOT, 26) /* Create PLT entry */ diff -uprN binutils-2.11.90.0.31/include/elf/common.h binutils-2.11.92.0.5/include/elf/common.h --- binutils-2.11.90.0.31/include/elf/common.h Mon May 21 11:39:54 2001 +++ binutils-2.11.92.0.5/include/elf/common.h Mon Oct 1 15:25:25 2001 @@ -162,6 +162,18 @@ Foundation, Inc., 59 Temple Place - Suit #define EM_MMIX 80 /* Donald Knuth's educational 64-bit processor */ #define EM_HUANY 81 /* Harvard's machine-independent format */ #define EM_PRISM 82 /* SiTera Prism */ +#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */ +#define EM_FR30 84 /* Fujitsu FR30 */ +#define EM_D10V 85 /* Mitsubishi D10V */ +#define EM_D30V 86 /* Mitsubishi D30V */ +#define EM_V850 87 /* NEC v850 */ +#define EM_M32R 88 /* Mitsubishi M32R */ +#define EM_MN10300 89 /* Matsushita MN10300 */ +#define EM_MN10200 90 /* Matsushita MN10200 */ +#define EM_PJ 91 /* picoJava */ +#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */ +#define EM_ARC_A5 93 /* ARC Cores Tangent-A5 */ +#define EM_XTENSA 94 /* Tensilica Xtensa Architecture */ /* If it is necessary to assign new unofficial EM_* values, please pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the chances of collision @@ -175,7 +187,7 @@ Foundation, Inc., 59 Temple Place - Suit unofficial e_machine number should eventually ask registry@sco.com for an officially blessed number to be added to the list above. */ -#define EM_PJ 99 /* picoJava */ +#define EM_PJ_OLD 99 /* picoJava */ /* Cygnus PowerPC ELF backend. Written in the absence of an ABI. */ #define EM_CYGNUS_POWERPC 0x9025 @@ -187,9 +199,6 @@ Foundation, Inc., 59 Temple Place - Suit /* Old version of PowerPC, this should be removed shortly. */ #define EM_PPC_OLD 17 -/* Cygnus ARC ELF backend. Written in the absence of an ABI. */ -#define EM_CYGNUS_ARC 0x9040 - /* Cygnus M32R ELF backend. Written in the absence of an ABI. */ #define EM_CYGNUS_M32R 0x9041 @@ -218,11 +227,11 @@ Foundation, Inc., 59 Temple Place - Suit /* AVR magic number Written in the absense of an ABI. */ -#define EM_AVR 0x1057 +#define EM_AVR_OLD 0x1057 /* OpenRISC magic number Written in the absense of an ABI. */ -#define EM_OPENRISC 0x3426 +#define EM_OPENRISC_OLD 0x3426 /* See the above comment before you add a new EM_* value here. */ diff -uprN binutils-2.11.90.0.31/include/elf/internal.h binutils-2.11.92.0.5/include/elf/internal.h --- binutils-2.11.90.0.31/include/elf/internal.h Thu Mar 15 14:53:07 2001 +++ binutils-2.11.92.0.5/include/elf/internal.h Mon Oct 1 15:25:25 2001 @@ -1,5 +1,5 @@ /* ELF support for BFD. - Copyright 1991, 1992, 1993, 1994, 1995, 1997, 1998, 2000 + Copyright 1991, 1992, 1993, 1994, 1995, 1997, 1998, 2000, 2001 Free Software Foundation, Inc. Written by Fred Fish @ Cygnus Support, from information published @@ -153,7 +153,7 @@ typedef struct elf_internal_rel { typedef struct elf_internal_rela { bfd_vma r_offset; /* Location at which to apply the action */ bfd_vma r_info; /* Index and Type of relocation */ - bfd_signed_vma r_addend; /* Constant addend used to compute value */ + bfd_vma r_addend; /* Constant addend used to compute value */ } Elf_Internal_Rela; #define elf32_internal_rela elf_internal_rela diff -uprN binutils-2.11.90.0.31/include/elf/mips.h binutils-2.11.92.0.5/include/elf/mips.h --- binutils-2.11.90.0.31/include/elf/mips.h Sat May 12 00:05:59 2001 +++ binutils-2.11.92.0.5/include/elf/mips.h Mon Oct 1 15:25:25 2001 @@ -172,12 +172,10 @@ END_RELOC_NUMBERS (R_MIPS_maxext) the rest are open. */ #define E_MIPS_MACH_3900 0x00810000 - #define E_MIPS_MACH_4010 0x00820000 #define E_MIPS_MACH_4100 0x00830000 #define E_MIPS_MACH_4650 0x00850000 #define E_MIPS_MACH_4111 0x00880000 -#define E_MIPS_MACH_MIPS32_4K 0x00890000 #define E_MIPS_MACH_SB1 0x008a0000 /* Processor specific section indices. These sections do not actually diff -uprN binutils-2.11.90.0.31/include/libiberty.h binutils-2.11.92.0.5/include/libiberty.h --- binutils-2.11.90.0.31/include/libiberty.h Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/include/libiberty.h Mon Oct 1 15:25:25 2001 @@ -85,11 +85,53 @@ extern char *basename (); extern const char *lbasename PARAMS ((const char *)); -/* Concatenate an arbitrary number of strings, up to (char *) NULL. - Allocates memory using xmalloc. */ +/* Concatenate an arbitrary number of strings. You must pass NULL as + the last argument of this function, to terminate the list of + strings. Allocates memory using xmalloc. */ extern char *concat PARAMS ((const char *, ...)) ATTRIBUTE_MALLOC; +/* Concatenate an arbitrary number of strings. You must pass NULL as + the last argument of this function, to terminate the list of + strings. Allocates memory using xmalloc. The first argument is + not one of the strings to be concatenated, but if not NULL is a + pointer to be freed after the new string is created, similar to the + way xrealloc works. */ + +extern char *reconcat PARAMS ((char *, const char *, ...)) ATTRIBUTE_MALLOC; + +/* Determine the length of concatenating an arbitrary number of + strings. You must pass NULL as the last argument of this function, + to terminate the list of strings. */ + +extern unsigned long concat_length PARAMS ((const char *, ...)); + +/* Concatenate an arbitrary number of strings into a SUPPLIED area of + memory. You must pass NULL as the last argument of this function, + to terminate the list of strings. The supplied memory is assumed + to be large enough. */ + +extern char *concat_copy PARAMS ((char *, const char *, ...)); + +/* Concatenate an arbitrary number of strings into a GLOBAL area of + memory. You must pass NULL as the last argument of this function, + to terminate the list of strings. The supplied memory is assumed + to be large enough. */ + +extern char *concat_copy2 PARAMS ((const char *, ...)); + +/* This is the global area used by concat_copy2. */ + +extern char *libiberty_concat_ptr; + +/* Concatenate an arbitrary number of strings. You must pass NULL as + the last argument of this function, to terminate the list of + strings. Allocates memory using alloca. The arguments are + evaluated twice! */ +#define ACONCAT(ACONCAT_PARAMS) \ + (libiberty_concat_ptr = alloca (concat_length ACONCAT_PARAMS + 1), \ + concat_copy2 ACONCAT_PARAMS) + /* Check whether two file descriptors refer to the same file. */ extern int fdmatch PARAMS ((int fd1, int fd2)); @@ -246,12 +288,25 @@ extern PTR C_alloca PARAMS((size_t)); #if GCC_VERSION >= 2000 && !defined USE_C_ALLOCA # define alloca(x) __builtin_alloca(x) # undef C_ALLOCA +# define ASTRDUP(X) \ + (__extension__ ({ const char *const libiberty_optr = (X); \ + const unsigned long libiberty_len = strlen (libiberty_optr) + 1; \ + char *const libiberty_nptr = alloca (libiberty_len); \ + (char *) memcpy (libiberty_nptr, libiberty_optr, libiberty_len); })) #else # define alloca(x) C_alloca(x) # undef USE_C_ALLOCA # define USE_C_ALLOCA 1 # undef C_ALLOCA # define C_ALLOCA 1 +extern const char *libiberty_optr; +extern char *libiberty_nptr; +extern unsigned long libiberty_len; +# define ASTRDUP(X) \ + (libiberty_optr = (X), \ + libiberty_len = strlen (libiberty_optr) + 1, \ + libiberty_nptr = alloca (libiberty_len), \ + (char *) memcpy (libiberty_nptr, libiberty_optr, libiberty_len)) #endif #ifdef __cplusplus diff -uprN binutils-2.11.90.0.31/include/nlm/ChangeLog binutils-2.11.92.0.5/include/nlm/ChangeLog --- binutils-2.11.90.0.31/include/nlm/ChangeLog Thu Jun 3 11:02:09 1999 +++ binutils-2.11.92.0.5/include/nlm/ChangeLog Thu Oct 4 14:35:43 2001 @@ -1,3 +1,9 @@ +2001-10-02 Alan Modra + + * common.h (NLM_CAT, NLM_CAT3): Don't define. + (NLM_CAT4): Update conditions under which this is defined. Document + why CONCAT4 can't be used. + Fri May 6 13:31:04 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) * external.h (nlmNAME(External_Custom_Header)): Add length, diff -uprN binutils-2.11.90.0.31/include/nlm/common.h binutils-2.11.92.0.5/include/nlm/common.h --- binutils-2.11.90.0.31/include/nlm/common.h Thu Mar 15 14:53:09 2001 +++ binutils-2.11.92.0.5/include/nlm/common.h Thu Oct 4 14:35:43 2001 @@ -1,5 +1,5 @@ /* NLM (NetWare Loadable Module) support for BFD. - Copyright 1993 Free Software Foundation, Inc. + Copyright 1993, 2001 Free Software Foundation, Inc. Written by Fred Fish @ Cygnus Support @@ -23,31 +23,6 @@ Foundation, Inc., 59 Temple Place - Suit /* This file is part of NLM support for BFD, and contains the portions that are common to both the internal and external representations. */ -/* Semi-portable string concatenation in cpp. - The NLM_CAT4 hack is to avoid a problem with some strict ANSI C - preprocessors. The problem is, "32_" or "64_" are not a valid - preprocessing tokens, and we don't want extra underscores (e.g., - "nlm_32_"). The XNLM_CAT2 macro will cause the inner NLM_CAT macros - to be evaluated first, producing still-valid pp-tokens. Then the - final concatenation can be done. (Sigh.) */ - -#ifdef SABER -# define NLM_CAT(a,b) a##b -# define NLM_CAT3(a,b,c) a##b##c -# define NLM_CAT4(a,b,c,d) a##b##c##d -#else -# ifdef __STDC__ -# define NLM_CAT(a,b) a##b -# define NLM_CAT3(a,b,c) a##b##c -# define XNLM_CAT2(a,b) NLM_CAT(a,b) -# define NLM_CAT4(a,b,c,d) XNLM_CAT2(NLM_CAT(a,b),NLM_CAT(c,d)) -# else -# define NLM_CAT(a,b) a/**/b -# define NLM_CAT3(a,b,c) a/**/b/**/c -# define NLM_CAT4(a,b,c,d) a/**/b/**/c/**/d -# endif -#endif - /* If NLM_ARCH_SIZE is not defined, default to 32. NLM_ARCH_SIZE is optionally defined by the application. */ @@ -55,6 +30,30 @@ Foundation, Inc., 59 Temple Place - Suit # define NLM_ARCH_SIZE 32 #endif +/* Due to horrible details of ANSI macro expansion, we can't use CONCAT4 + for NLM_NAME. CONCAT2 is used in BFD_JUMP_TABLE macros, and some of + them will expand to tokens that themselves are macros defined in terms + of NLM_NAME. If NLM_NAME were defined using CONCAT4 (which is itself + defined in bfd-in.h using CONCAT2), ANSI preprocessor rules say that + the CONCAT2 within NLM_NAME should not be expanded. + So use another name. */ +#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE) +#ifdef SABER +#define NLM_CAT4(a,b,c,d) a##b##c##d +#else +/* This hack is to avoid a problem with some strict ANSI C preprocessors. + The problem is, "32_" is not a valid preprocessing token, and we don't + want extra underscores (e.g., "nlm_32_"). The NLM_XCAT2 macro will + cause the inner CAT2 macros to be evaluated first, producing + still-valid pp-tokens. Then the final concatenation can be done. */ +#define NLM_CAT2(a,b) a##b +#define NLM_XCAT2(a,b) NLM_CAT2(a,b) +#define NLM_CAT4(a,b,c,d) NLM_XCAT2(NLM_CAT2(a,b),NLM_CAT2(c,d)) +#endif +#else +#define NLM_CAT4(a,b,c,d) a/**/b/**/c/**/d +#endif + #if NLM_ARCH_SIZE == 32 # define NLM_TARGET_LONG_SIZE 4 # define NLM_TARGET_ADDRESS_SIZE 4 diff -uprN binutils-2.11.90.0.31/include/objalloc.h binutils-2.11.92.0.5/include/objalloc.h --- binutils-2.11.90.0.31/include/objalloc.h Thu Jun 3 11:02:08 1999 +++ binutils-2.11.92.0.5/include/objalloc.h Mon Oct 1 15:25:25 2001 @@ -1,5 +1,5 @@ /* objalloc.h -- routines to allocate memory for objects - Copyright 1997 Free Software Foundation, Inc. + Copyright 1997, 2001 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Solutions. This program is free software; you can redistribute it and/or modify it @@ -56,12 +56,11 @@ struct objalloc_align { char x; double d #ifndef offsetof #include #endif -#define OBJALLOC_ALIGN \ - ((ptrdiff_t) ((char *) &((struct objalloc_align *) 0)->d - (char *) 0)) -#else -#define OBJALLOC_ALIGN \ - ((long) ((char *) &((struct objalloc_align *) 0)->d - (char *) 0)) #endif +#ifndef offsetof +#define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER) +#endif +#define OBJALLOC_ALIGN offsetof (struct objalloc_align, d) /* Create an objalloc structure. Returns NULL if malloc fails. */ diff -uprN binutils-2.11.90.0.31/include/opcode/ChangeLog binutils-2.11.92.0.5/include/opcode/ChangeLog --- binutils-2.11.90.0.31/include/opcode/ChangeLog Mon Aug 27 11:44:52 2001 +++ binutils-2.11.92.0.5/include/opcode/ChangeLog Mon Oct 1 15:25:25 2001 @@ -1,3 +1,19 @@ +2001-09-27 Nick Clifton + + * v850.h: Remove spurious comment. + +2001-09-21 Nick Clifton + + * h8300.h: Fix compile time warning messages + +2001-09-04 Richard Henderson + + * alpha.h (struct alpha_operand): Pack elements into bitfields. + +2001-08-31 Eric Christopher + + * mips.h: Remove CPU_MIPS32_4K. + 2001-08-27 Torbjorn Granlund * ppc.h (PPC_OPERAND_DS): Define. diff -uprN binutils-2.11.90.0.31/include/opcode/alpha.h binutils-2.11.92.0.5/include/opcode/alpha.h --- binutils-2.11.90.0.31/include/opcode/alpha.h Wed Oct 27 09:22:38 1999 +++ binutils-2.11.92.0.5/include/opcode/alpha.h Mon Oct 1 15:25:25 2001 @@ -81,16 +81,16 @@ extern const unsigned alpha_num_opcodes; struct alpha_operand { /* The number of bits in the operand. */ - int bits; + unsigned int bits : 5; /* How far the operand is left shifted in the instruction. */ - int shift; + unsigned int shift : 5; /* The default relocation type for this operand. */ - int default_reloc; + signed int default_reloc : 16; /* One bit syntax flags. */ - unsigned flags; + unsigned int flags : 16; /* Insertion function. This is used by the assembler. To insert an operand value into an instruction, check this field. diff -uprN binutils-2.11.90.0.31/include/opcode/h8300.h binutils-2.11.92.0.5/include/opcode/h8300.h --- binutils-2.11.90.0.31/include/opcode/h8300.h Fri Mar 23 13:53:29 2001 +++ binutils-2.11.92.0.5/include/opcode/h8300.h Mon Oct 1 15:25:25 2001 @@ -594,7 +594,7 @@ struct h8_opcode h8_opcodes[] = NEW_SOP(O(O_STMAC,SL),1,2,"stmac"),{{MACREG,RD32,E}},{{0x0,0x2,MACREG,RD32,E}} EOP, NEW_SOP(O(O_LDM,SL),0,6,"ldm.l"),{{RSINC, RS32, E}},{{ 0x0,0x1,IGNORE,0x0,0x6,0xD,0x7,IGNORE,E}}EOP, NEW_SOP(O(O_STM,SL),0,6,"stm.l"),{{RS32, RDDEC, E}},{{0x0,0x1,IGNORE,0x0,0x6,0xD,0xF,IGNORE,E}}EOP, - { 0 } + {0, 0, 0, NULL, {{0,0,0}}, {{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}, 0, 0, 0, 0} }; #else extern struct h8_opcode h8_opcodes[]; diff -uprN binutils-2.11.90.0.31/include/opcode/mips.h binutils-2.11.92.0.5/include/opcode/mips.h --- binutils-2.11.90.0.31/include/opcode/mips.h Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/include/opcode/mips.h Mon Oct 1 15:25:25 2001 @@ -361,7 +361,6 @@ struct mips_opcode #define CPU_R12000 12000 #define CPU_MIPS16 16 #define CPU_MIPS32 32 -#define CPU_MIPS32_4K 3204113 /* 32, 04, octal 'K'. */ #define CPU_MIPS5 5 #define CPU_MIPS64 64 #define CPU_SB1 12310201 /* octal 'SB', 01. */ diff -uprN binutils-2.11.90.0.31/include/opcode/v850.h binutils-2.11.92.0.5/include/opcode/v850.h --- binutils-2.11.90.0.31/include/opcode/v850.h Thu Mar 15 14:53:17 2001 +++ binutils-2.11.92.0.5/include/opcode/v850.h Mon Oct 1 15:25:25 2001 @@ -1,5 +1,5 @@ /* v850.h -- Header file for NEC V850 opcode table - Copyright 1996, 1997 Free Software Foundation, Inc. + Copyright 1996, 1997, 2001 Free Software Foundation, Inc. Written by J.T. Conklin, Cygnus Support This file is part of GDB, GAS, and the GNU binutils. @@ -153,7 +153,6 @@ extern const struct v850_operand v850_op /* The register specified must not be r0 */ #define V850_NOT_R0 0x80 -/* CYGNUS LOCAL v850e */ /* push/pop type instruction, V850E specific. */ #define V850E_PUSH_POP 0x100 diff -uprN binutils-2.11.90.0.31/ld/ChangeLog binutils-2.11.92.0.5/ld/ChangeLog --- binutils-2.11.90.0.31/ld/ChangeLog Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/ld/ChangeLog Fri Oct 5 14:11:21 2001 @@ -1,6 +1,240 @@ +2001-10-05 H.J. Lu + + * genscripts.sh: Fix a typo in the last change. + +2001-10-05 Jakub Jelinek + + * emultempl/elf32.em (gld_*_list_options): Include -z combreloc and + -z nocombreloc in usage. + +2001-10-03 Jim Blandy + + * genscripts.sh: Include a comment at the top of each generated + script, explaining its purpose. + +2001-10-03 Vassili Karpov + + * emultempl/elf32.em (parse_args): Handle -z nocopyreloc. + * NEWS: Mention -z nocopyreloc. + * ld.texinfo (Options): Describe nocopyreloc. + +2001-10-03 Alan Modra + + * configure: Regenerate. + +2001-10-02 Alan Modra + + * ldver.h (ld_program_version): Remove declaration. + * lexsup.c (parse_args): Move printing of copyright message.. + * ldver.c (ldversion): .. to here. + Use BFD_VERSION_STRING in place of BFD_VERSION. + (ld_program_version): Remove. + * Makefile.am (Makefile): Depend on bfd/configure.in. + Run "make dep-am". + * Makefile.in: Regenerate. + +2001-09-30 Hans-Peter Nilsson + + * Makefile.am: Update dependencies with "make dep-am". + * Makefile.in: Regenerate. + +2001-09-29 John Reiser + + * ldlang.c (lang_common): Conditionally inhibit Common allocation. + * lexsup.c: Add --no-define-common commandline option. + * ldgram.y: Add INHIBIT_COMMON_ALLOCATION script command. + * ldlex.l: Likewise. + * ld.h: Add command_line.inhibit_common_definition. + * ldmain.c (main): Initialize. + * ld.texinfo: Document. + +2001-09-26 Alan Modra + + * ldmisc.c (USE_STDARG): Remove. + (info_msg): Define using VPARAMS, VA_OPEN, VA_FIXEDARG, VA_CLOSE. + (einfo): Likewise. + (minfo): Likewise. + (lfinfo): Likewise. + + * ldmisc.h: Remove #ifdef ANSI_PROTOTYPES and non-ansi + declarations. Update copyright. + +2001-09-24 Charles Wilson + + * pe-dll.c: Remove obsoleted declaration of + pe_get_data_import_dll_name. + (pe_create_import_fixup): Fix thinko. + + * ld.texinfo(enable-auto-import): Clarify the explanation. + +2001-09-24 Nick Clifton + + * pe-dll.c (pe_create_import_fixup): Revert previous patch. + * emultemp/pe.em (pe_data_import_dll): Move definition outside of + DLL_SUPPORT controlled code. + +2001-09-24 Charles Wilson + + * emultempl/pe.em(pe_data_import_dll): Make static. + (pe_get_data_import_dll_name): New accessor function. + * pe-dll.c(pe_create_import_fixup): call + pe_get_data_import_dll_name() from pe.em, instead of + directly accessing pe_data_import_dll variable from pe.em. + +2001-09-18 Bruno Haible + + * deffilep.y: Include "safe-ctype.h" instead of . + (def_file_add_directive): Use ISSPACE instead of isspace. + (def_lex): Use ISDIGIT/ISXDIGIT/ISALPHA/ISALNUM instead of + isdigit/isxdigit/isalpha/isalnum. + * emultempl/aix.em: Include "safe-ctype.h" instead of . + (gld${EMULATION_NAME}_read_file): Use ISSPACE instead of isspace. + * emultempl/elf32.em: Include "safe-ctype.h" instead of . + (gld${EMULATION_NAME}_place_orphan): Use ISALNUM instead of + isalnum. + * emultempl/gld960c.em: Include "safe-ctype.h" instead of . + (gld960_set_output_arch): Use ISUPPER/TOLOWER instead of + isupper/tolower. + * emultempl/sunos.em: Include "safe-ctype.h" instead of . + (gld${EMULATION_NAME}_search_dir): Use ISDIGIT instead of isdigit. + * ldctor.c: Include "safe-ctype.h" instead of . + (ctor_prio): Use ISDIGIT instead of isdigit. + * ldfile.c: Include "safe-ctype.h" instead of . + (ldfile_open_file_search): Use ISALPHA instead of isalpha. + (ldfile_add_arch): Use ISUPPER/TOLOWER instead of + isupper/tolower. + * ldlang.c: Include "safe-ctype.h" instead of . + (stricpy): Use TOLOWER instead of isupper/tolower. + (lang_leave_overlay_section): Use ISALNUM instead of isalnum. + * ldlex.l: Include "safe-ctype.h" instead of . + (lex_warn_invalid): Use ISPRINT instead of isprint. + * ldmain.c: Include "safe-ctype.h" instead of . + (main): For gettext, also set the LC_CTYPE locate facet. + (add_keepsyms_file): Use ISSPACE instead of isspace. + * lexsup.c: Include "safe-ctype.h" instead of . + (is_num, parse_args): Use ISDIGIT instead of isdigit. + * mpw-elfmips.c: Include "safe-ctype.h" instead of . + (gldelf32ebmip_place_orphan): Use ISALNUM instead of isalnum. + * mpw-eppcmac.c: Include "safe-ctype.h" instead of . + (gldppcmacos_read_file): Use ISSPACE instead of isspace. + * pe-dll.c: Include "safe-ctype.h" instead of . + (quoteput): Use ISSPACE instead of isspace. + (pe_dll_generate_implib, pe_process_import_defs): Use ISALNUM + instead of isalnum. + +2001-09-18 Alan Modra + + * deffilep.y (def_stash_module): Constify "name" param. + + * pe-dll.c: Replace CONST with const throughout. + (quick_symbol): Constify "n1", "n2", "n3" params. + (make_singleton_name_thunk): Constify "import" param. Make + "buffer_len" a size_t. + (make_import_fixup_entry): Constify "name", "fixup_name", + "dll_symname" params. + (pe_get16): Cast args of bfd_seek. Replace bfd_read with bfd_bread. + (pe_get32): Likewise. + (pe_implied_import_dll): Likewise. + + * emultempl/beos.em (sort_by_file_name): Constify "ra", "rb". + (sort_by_section_name): Likewise. + + * emultempl/pe.em: Move defines for arm_epoc_pe before bfd.h included. + (make_import_fixup): Cast printf arg, rel->address to long rather + than int. + (gld_${EMULATION_NAME}_after_open): Don't compare NULL against int. + +2001-09-15 Alan Modra + + * ldmain.c (main): Rename BufferSize to ld_bufsz because HPUX + defines BufferSize. Increase buffer size by one. + +2001-09-14 Ralf Habacker + + * pe-dll.c (pe_walk_relocs_of_symbol): Fix memory leak. + +2001-09-14 Kevin Lo + + * configure.tgt: Add arm-openbsd target. + +2001-09-12 H.J. Lu + + * Makefile.am (ALL_EMULATIONS): Move eelf64ppc.o and + eelf64lppc.o to ... + (ALL_64_EMULATIONS): Here. + * Makefile.in: Regenerated. + +2001-09-12 Paul Sokolovsky + + * emultempl/pe.em(make_import_fixup): change signature to + take asection as well as arelec; we need this for proper + error reporting. Only call pe_create_import_fixup() if + there is no attempt to add a constant addend to the reloc; + otherwise, report error condition. + * pe-dll.c(pe_walk_relocs_of_symbol): change signature, + since final argument is a pointer to make_import_fixup(). + Change call to cb() to match make_import_fixup() signature. + (make_import_fixup_mark): make buffer_len unsigned. + * pe-dll.h: change signature of pe_walk_relocs_of_symbol. + +2001-09-12 Charles Wilson + + * ld.texinfo: add verbose documentation for auto-import + direct-addressing workaround, to compliment the terse + error message. + +2001-09-12 Andrew MacLeod + + * scripttempl/v850.sc: Add gcc_except_table sections. + +Fri Sep 7 11:34:24 2001 Jeffrey A Law (law@cygnus.com) + + * emulparams/h8300helf.sh: Move stack to a much higher memory address. + * emulparams/h8300self.sh: Similarly. + +2001-09-05 Danny Smith + + * ld.texinfo (Options, --stack): Correct default value for stack + reserve. + +2001-09-05 Tom Rix + + * emultempl/aix.em : Handle import file XMC_XO and syscall symbols. + +2001-09-03 Andreas Jaeger + + * emultempl/beos.em: Declare prototypes for comparions functions, + adjust definitions. + +2001-09-02 Andreas Jaeger + + * emultempl/aix.em: Add missing prototype. + * emultempl/lnk960.em: Likewise. + * emultempl/vanilla.em: Likewise. + * emultempl/armcoff.em: Likewise. + * emultempl/armelf_oabi.em: Likewise. + * emultempl/beos.em: Likewise. + * emultempl/gld960c.em: Likewise. + * emultempl/gld960.em: Likewise. + + * emulparams/elf64alpha.sh (PARSE_AND_LIST_PROLOGUE): Add parameter + for prototype declaration. + +2001-08-31 Eric Christopher + Jason Eckhardt + + * ldmain.c (get_emulation): Add support for -mips32 and -mips64. + +2001-08-31 Andreas Jaeger + + * emultempl/pe.em: Add missing prototypes. + (gld_${EMULATION_NAME}_after_open): Remove extra args to + pe_find_data_imports. + (pr_sym): Add unused attribute. + 2001-08-29 Joel Sherrill - * configure.tgt (i[3456]86-*-rtems*, m68*-*-rtems*): Change + * configure.tgt (i[3456]86-*-rtems*, m68*-*-rtems*): Change default from coff to elf. 2001-08-29 Jeff Law diff -uprN binutils-2.11.90.0.31/ld/Makefile.am binutils-2.11.92.0.5/ld/Makefile.am --- binutils-2.11.90.0.31/ld/Makefile.am Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/ld/Makefile.am Thu Oct 4 14:35:43 2001 @@ -159,8 +159,6 @@ ALL_EMULATIONS = \ eelf32ppc.o \ eelf32ppclinux.o \ eelf32ppcsim.o \ - eelf64ppc.o \ - eelf64lppc.o \ eelf_i386.o \ eelf_i386_be.o \ eelf_i386_chaos.o \ @@ -267,6 +265,8 @@ ALL_64_EMULATIONS = \ eelf64btsmip.o \ eelf64ltsmip.o \ eelf64hppa.o \ + eelf64ppc.o \ + eelf64lppc.o \ eaixppc64.o \ ehppa64linux.o @@ -1012,6 +1012,8 @@ DISTCLEANFILES = tdirs site.exp site.bak distclean-local: rm -rf ldscripts +Makefile: $(BFDDIR)/configure.in + # Targets to rebuild dependencies in this Makefile. # Have to get rid of DEP1 here so that "$?" later includes all of $(CFILES). DEP: dep.sed $(CFILES) $(HFILES) $(GENERATED_CFILES) $(GENERATED_HFILES) config.h @@ -1058,70 +1060,77 @@ dep-am: DEP # DO NOT DELETE THIS LINE -- mkdep uses it. # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. ldctor.o: ldctor.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \ - ld.h $(INCDIR)/bin-bugs.h ldexp.h ldlang.h ldmisc.h \ - ldgram.h ldmain.h ldctor.h + $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h ld.h $(INCDIR)/bin-bugs.h \ + ldexp.h ldlang.h ldmisc.h ldgram.h ldmain.h ldctor.h ldemul.o: ldemul.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h ld.h $(INCDIR)/bin-bugs.h \ - ldmisc.h ldexp.h ldlang.h ldfile.h ldemul.h ldmain.h \ - ldemul-list.h + $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \ + ld.h $(INCDIR)/bin-bugs.h ldmisc.h ldexp.h ldlang.h \ + ldfile.h ldemul.h ldmain.h ldemul-list.h ldexp.o: ldexp.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \ - ld.h $(INCDIR)/bin-bugs.h ldmain.h ldmisc.h ldexp.h \ - ldgram.h ldlang.h $(INCDIR)/libiberty.h + $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/bfdlink.h ld.h $(INCDIR)/bin-bugs.h ldmain.h \ + ldmisc.h ldexp.h ldgram.h ldlang.h $(INCDIR)/libiberty.h ldfile.o: ldfile.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \ - ld.h $(INCDIR)/bin-bugs.h ldmisc.h ldexp.h ldlang.h \ - ldfile.h ldmain.h ldgram.h ldlex.h ldemul.h $(INCDIR)/libiberty.h + $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h ld.h $(INCDIR)/bin-bugs.h \ + ldmisc.h ldexp.h ldlang.h ldfile.h ldmain.h ldgram.h \ + ldlex.h ldemul.h $(INCDIR)/libiberty.h ldlang.o: ldlang.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ - $(INCDIR)/obstack.h $(INCDIR)/bfdlink.h ld.h $(INCDIR)/bin-bugs.h \ - ldmain.h ldgram.h ldexp.h ldlang.h ldlex.h ldmisc.h \ - ldctor.h ldfile.h ldemul.h $(INCDIR)/fnmatch.h $(INCDIR)/demangle.h + $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h \ + $(INCDIR)/bfdlink.h ld.h $(INCDIR)/bin-bugs.h ldmain.h \ + ldgram.h ldexp.h ldlang.h ldlex.h ldmisc.h ldctor.h \ + ldfile.h ldemul.h $(INCDIR)/fnmatch.h $(INCDIR)/demangle.h ldmain.o: ldmain.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ - $(INCDIR)/progress.h $(INCDIR)/bfdlink.h $(INCDIR)/filenames.h \ - ld.h $(INCDIR)/bin-bugs.h ldmain.h ldmisc.h ldwrite.h \ - ldgram.h ldexp.h ldlang.h ldlex.h ldfile.h ldemul.h \ - ldctor.h + $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/libiberty.h $(INCDIR)/progress.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/filenames.h ld.h $(INCDIR)/bin-bugs.h \ + ldmain.h ldmisc.h ldwrite.h ldgram.h ldexp.h ldlang.h \ + ldlex.h ldfile.h ldemul.h ldctor.h ldmisc.o: ldmisc.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ - $(INCDIR)/demangle.h ld.h $(INCDIR)/bin-bugs.h ldmisc.h \ - ldexp.h ldlang.h ldgram.h ldlex.h ldmain.h ldfile.h + $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/libiberty.h $(INCDIR)/demangle.h ld.h $(INCDIR)/bin-bugs.h \ + ldmisc.h ldexp.h ldlang.h ldgram.h ldlex.h ldmain.h \ + ldfile.h ldver.o: ldver.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h ld.h $(INCDIR)/bin-bugs.h \ - ldver.h ldexp.h ldlang.h ldfile.h ldemul.h ldmain.h + $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \ + ld.h $(INCDIR)/bin-bugs.h ldver.h ldexp.h ldlang.h \ + ldfile.h ldemul.h ldmain.h ldwrite.o: ldwrite.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/libiberty.h ld.h $(INCDIR)/bin-bugs.h ldexp.h \ - ldlang.h ldwrite.h ldmisc.h ldgram.h ldmain.h + $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h ld.h $(INCDIR)/bin-bugs.h \ + ldexp.h ldlang.h ldwrite.h ldmisc.h ldgram.h ldmain.h lexsup.o: lexsup.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ - $(INCDIR)/bfdlink.h ld.h $(INCDIR)/bin-bugs.h ldmain.h \ - ldmisc.h ldexp.h ldlang.h ldgram.h ldlex.h ldfile.h \ - ldver.h ldemul.h $(INCDIR)/demangle.h -mri.o: mri.c ../bfd/bfd.h $(INCDIR)/ansidecl.h sysdep.h \ - config.h $(INCDIR)/fopen-same.h ld.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h \ + ld.h $(INCDIR)/bin-bugs.h ldmain.h ldmisc.h ldexp.h \ + ldlang.h ldgram.h ldlex.h ldfile.h ldver.h ldemul.h \ + $(INCDIR)/demangle.h +mri.o: mri.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \ + sysdep.h config.h $(INCDIR)/fopen-same.h ld.h $(INCDIR)/bin-bugs.h \ ldexp.h ldlang.h ldmisc.h mri.h ldgram.h $(INCDIR)/libiberty.h ldcref.o: ldcref.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/libiberty.h ld.h $(INCDIR)/bin-bugs.h ldmain.h \ - ldmisc.h ldexp.h ldlang.h + $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h ld.h $(INCDIR)/bin-bugs.h \ + ldmain.h ldmisc.h ldexp.h ldlang.h pe-dll.o: pe-dll.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/libiberty.h ld.h $(INCDIR)/bin-bugs.h ldexp.h \ - ldlang.h ldwrite.h ldmisc.h ldgram.h ldmain.h ldfile.h \ - ldemul.h $(INCDIR)/coff/internal.h ../bfd/libcoff.h \ - deffile.h pe-dll.h + $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h \ + ld.h $(INCDIR)/bin-bugs.h ldexp.h ldlang.h ldwrite.h \ + ldmisc.h ldgram.h ldmain.h ldfile.h ldemul.h $(INCDIR)/coff/internal.h \ + ../bfd/libcoff.h deffile.h pe-dll.h ldgram.o: ldgram.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \ - ld.h $(INCDIR)/bin-bugs.h ldexp.h ldver.h ldlang.h \ - ldfile.h ldemul.h ldmisc.h ldmain.h mri.h ldctor.h \ - ldlex.h -ldlex.o: ldlex.c ../bfd/bfd.h sysdep.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/bfdlink.h ld.h $(INCDIR)/bin-bugs.h ldexp.h \ + ldver.h ldlang.h ldfile.h ldemul.h ldmisc.h ldmain.h \ + mri.h ldctor.h ldlex.h +ldlex.o: ldlex.c ../bfd/bfd.h $(INCDIR)/symcat.h sysdep.h \ + config.h $(INCDIR)/fopen-same.h $(INCDIR)/safe-ctype.h \ ld.h $(INCDIR)/bin-bugs.h ldgram.h ldmisc.h ldexp.h \ ldlang.h ldfile.h ldlex.h ldmain.h $(INCDIR)/libiberty.h deffilep.o: deffilep.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \ - ../bfd/bfd.h sysdep.h config.h $(INCDIR)/fopen-same.h \ - ld.h $(INCDIR)/bin-bugs.h ldmisc.h deffile.h + $(INCDIR)/safe-ctype.h ../bfd/bfd.h $(INCDIR)/symcat.h \ + sysdep.h config.h $(INCDIR)/fopen-same.h ld.h $(INCDIR)/bin-bugs.h \ + ldmisc.h deffile.h # IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff -uprN binutils-2.11.90.0.31/ld/Makefile.in binutils-2.11.92.0.5/ld/Makefile.in --- binutils-2.11.90.0.31/ld/Makefile.in Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/ld/Makefile.in Thu Oct 4 14:35:43 2001 @@ -267,8 +267,6 @@ ALL_EMULATIONS = \ eelf32ppc.o \ eelf32ppclinux.o \ eelf32ppcsim.o \ - eelf64ppc.o \ - eelf64lppc.o \ eelf_i386.o \ eelf_i386_be.o \ eelf_i386_chaos.o \ @@ -376,6 +374,8 @@ ALL_64_EMULATIONS = \ eelf64btsmip.o \ eelf64ltsmip.o \ eelf64hppa.o \ + eelf64ppc.o \ + eelf64lppc.o \ eaixppc64.o \ ehppa64linux.o @@ -481,7 +481,7 @@ deffilep.c ldgram.c ldlex.c DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = gtar +TAR = tar GZIP_ENV = --best SOURCES = $(ld_new_SOURCES) $(EXTRA_ld_new_SOURCES) OBJECTS = $(ld_new_OBJECTS) @@ -1703,6 +1703,8 @@ diststuff: info $(EXTRA_DIST) distclean-local: rm -rf ldscripts +Makefile: $(BFDDIR)/configure.in + # Targets to rebuild dependencies in this Makefile. # Have to get rid of DEP1 here so that "$?" later includes all of $(CFILES). DEP: dep.sed $(CFILES) $(HFILES) $(GENERATED_CFILES) $(GENERATED_HFILES) config.h @@ -1749,72 +1751,79 @@ dep-am: DEP # DO NOT DELETE THIS LINE -- mkdep uses it. # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. ldctor.o: ldctor.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \ - ld.h $(INCDIR)/bin-bugs.h ldexp.h ldlang.h ldmisc.h \ - ldgram.h ldmain.h ldctor.h + $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h ld.h $(INCDIR)/bin-bugs.h \ + ldexp.h ldlang.h ldmisc.h ldgram.h ldmain.h ldctor.h ldemul.o: ldemul.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h ld.h $(INCDIR)/bin-bugs.h \ - ldmisc.h ldexp.h ldlang.h ldfile.h ldemul.h ldmain.h \ - ldemul-list.h + $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \ + ld.h $(INCDIR)/bin-bugs.h ldmisc.h ldexp.h ldlang.h \ + ldfile.h ldemul.h ldmain.h ldemul-list.h ldexp.o: ldexp.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \ - ld.h $(INCDIR)/bin-bugs.h ldmain.h ldmisc.h ldexp.h \ - ldgram.h ldlang.h $(INCDIR)/libiberty.h + $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/bfdlink.h ld.h $(INCDIR)/bin-bugs.h ldmain.h \ + ldmisc.h ldexp.h ldgram.h ldlang.h $(INCDIR)/libiberty.h ldfile.o: ldfile.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \ - ld.h $(INCDIR)/bin-bugs.h ldmisc.h ldexp.h ldlang.h \ - ldfile.h ldmain.h ldgram.h ldlex.h ldemul.h $(INCDIR)/libiberty.h + $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h ld.h $(INCDIR)/bin-bugs.h \ + ldmisc.h ldexp.h ldlang.h ldfile.h ldmain.h ldgram.h \ + ldlex.h ldemul.h $(INCDIR)/libiberty.h ldlang.o: ldlang.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ - $(INCDIR)/obstack.h $(INCDIR)/bfdlink.h ld.h $(INCDIR)/bin-bugs.h \ - ldmain.h ldgram.h ldexp.h ldlang.h ldlex.h ldmisc.h \ - ldctor.h ldfile.h ldemul.h $(INCDIR)/fnmatch.h $(INCDIR)/demangle.h + $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h \ + $(INCDIR)/bfdlink.h ld.h $(INCDIR)/bin-bugs.h ldmain.h \ + ldgram.h ldexp.h ldlang.h ldlex.h ldmisc.h ldctor.h \ + ldfile.h ldemul.h $(INCDIR)/fnmatch.h $(INCDIR)/demangle.h ldmain.o: ldmain.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ - $(INCDIR)/progress.h $(INCDIR)/bfdlink.h $(INCDIR)/filenames.h \ - ld.h $(INCDIR)/bin-bugs.h ldmain.h ldmisc.h ldwrite.h \ - ldgram.h ldexp.h ldlang.h ldlex.h ldfile.h ldemul.h \ - ldctor.h + $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/libiberty.h $(INCDIR)/progress.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/filenames.h ld.h $(INCDIR)/bin-bugs.h \ + ldmain.h ldmisc.h ldwrite.h ldgram.h ldexp.h ldlang.h \ + ldlex.h ldfile.h ldemul.h ldctor.h ldmisc.o: ldmisc.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ - $(INCDIR)/demangle.h ld.h $(INCDIR)/bin-bugs.h ldmisc.h \ - ldexp.h ldlang.h ldgram.h ldlex.h ldmain.h ldfile.h + $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/libiberty.h $(INCDIR)/demangle.h ld.h $(INCDIR)/bin-bugs.h \ + ldmisc.h ldexp.h ldlang.h ldgram.h ldlex.h ldmain.h \ + ldfile.h ldver.o: ldver.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h ld.h $(INCDIR)/bin-bugs.h \ - ldver.h ldexp.h ldlang.h ldfile.h ldemul.h ldmain.h + $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \ + ld.h $(INCDIR)/bin-bugs.h ldver.h ldexp.h ldlang.h \ + ldfile.h ldemul.h ldmain.h ldwrite.o: ldwrite.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/libiberty.h ld.h $(INCDIR)/bin-bugs.h ldexp.h \ - ldlang.h ldwrite.h ldmisc.h ldgram.h ldmain.h + $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h ld.h $(INCDIR)/bin-bugs.h \ + ldexp.h ldlang.h ldwrite.h ldmisc.h ldgram.h ldmain.h lexsup.o: lexsup.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ - $(INCDIR)/bfdlink.h ld.h $(INCDIR)/bin-bugs.h ldmain.h \ - ldmisc.h ldexp.h ldlang.h ldgram.h ldlex.h ldfile.h \ - ldver.h ldemul.h $(INCDIR)/demangle.h -mri.o: mri.c ../bfd/bfd.h $(INCDIR)/ansidecl.h sysdep.h \ - config.h $(INCDIR)/fopen-same.h ld.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h \ + ld.h $(INCDIR)/bin-bugs.h ldmain.h ldmisc.h ldexp.h \ + ldlang.h ldgram.h ldlex.h ldfile.h ldver.h ldemul.h \ + $(INCDIR)/demangle.h +mri.o: mri.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \ + sysdep.h config.h $(INCDIR)/fopen-same.h ld.h $(INCDIR)/bin-bugs.h \ ldexp.h ldlang.h ldmisc.h mri.h ldgram.h $(INCDIR)/libiberty.h ldcref.o: ldcref.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/libiberty.h ld.h $(INCDIR)/bin-bugs.h ldmain.h \ - ldmisc.h ldexp.h ldlang.h + $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h ld.h $(INCDIR)/bin-bugs.h \ + ldmain.h ldmisc.h ldexp.h ldlang.h pe-dll.o: pe-dll.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/libiberty.h ld.h $(INCDIR)/bin-bugs.h ldexp.h \ - ldlang.h ldwrite.h ldmisc.h ldgram.h ldmain.h ldfile.h \ - ldemul.h $(INCDIR)/coff/internal.h ../bfd/libcoff.h \ - deffile.h pe-dll.h + $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h \ + ld.h $(INCDIR)/bin-bugs.h ldexp.h ldlang.h ldwrite.h \ + ldmisc.h ldgram.h ldmain.h ldfile.h ldemul.h $(INCDIR)/coff/internal.h \ + ../bfd/libcoff.h deffile.h pe-dll.h ldgram.o: ldgram.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \ - ld.h $(INCDIR)/bin-bugs.h ldexp.h ldver.h ldlang.h \ - ldfile.h ldemul.h ldmisc.h ldmain.h mri.h ldctor.h \ - ldlex.h -ldlex.o: ldlex.c ../bfd/bfd.h sysdep.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/bfdlink.h ld.h $(INCDIR)/bin-bugs.h ldexp.h \ + ldver.h ldlang.h ldfile.h ldemul.h ldmisc.h ldmain.h \ + mri.h ldctor.h ldlex.h +ldlex.o: ldlex.c ../bfd/bfd.h $(INCDIR)/symcat.h sysdep.h \ + config.h $(INCDIR)/fopen-same.h $(INCDIR)/safe-ctype.h \ ld.h $(INCDIR)/bin-bugs.h ldgram.h ldmisc.h ldexp.h \ ldlang.h ldfile.h ldlex.h ldmain.h $(INCDIR)/libiberty.h deffilep.o: deffilep.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \ - ../bfd/bfd.h sysdep.h config.h $(INCDIR)/fopen-same.h \ - ld.h $(INCDIR)/bin-bugs.h ldmisc.h deffile.h + $(INCDIR)/safe-ctype.h ../bfd/bfd.h $(INCDIR)/symcat.h \ + sysdep.h config.h $(INCDIR)/fopen-same.h ld.h $(INCDIR)/bin-bugs.h \ + ldmisc.h deffile.h # IF YOU PUT ANYTHING HERE IT WILL GO AWAY # Tell versions [3.59,3.63) of GNU make to not export all variables. diff -uprN binutils-2.11.90.0.31/ld/NEWS binutils-2.11.92.0.5/ld/NEWS --- binutils-2.11.90.0.31/ld/NEWS Mon Aug 27 11:44:52 2001 +++ binutils-2.11.92.0.5/ld/NEWS Thu Oct 4 14:35:43 2001 @@ -1,4 +1,7 @@ -*- text -*- +* Support for -z nocopyreloc in the x86 ELF linker, which disables + production of copy relocs. Warning: using this option may result in + non-sharable applications. * Support for -z combreloc in the ELF linker, which puts dynamic relocations against the same symbol together, so that dynamic linker diff -uprN binutils-2.11.90.0.31/ld/configure binutils-2.11.92.0.5/ld/configure --- binutils-2.11.90.0.31/ld/configure Fri Aug 10 14:08:01 2001 +++ binutils-2.11.92.0.5/ld/configure Thu Oct 4 14:35:43 2001 @@ -4193,7 +4193,7 @@ fi l= - if test -d $srcdir/po; then + if test -f $srcdir/po/POTFILES.in; then test -d po || mkdir po if test "x$srcdir" != "x."; then if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then diff -uprN binutils-2.11.90.0.31/ld/configure.tgt binutils-2.11.92.0.5/ld/configure.tgt --- binutils-2.11.90.0.31/ld/configure.tgt Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/ld/configure.tgt Mon Oct 1 15:25:25 2001 @@ -197,6 +197,7 @@ arm-*-coff) targ_emul=armcoff ;; arm-*-vxworks) targ_emul=armcoff ;; arm-*-freebsd*) targ_emul=armelf ;; arm-*-netbsd*) targ_emul=armnbsd ;; +arm-*-openbsd*) targ_emul=armnbsd ;; arm-*-rtems*) targ_emul=armelf ;; arm-*-elf) targ_emul=armelf ;; arm-*-oabi) targ_emul=armelf_oabi ;; diff -uprN binutils-2.11.90.0.31/ld/deffilep.y binutils-2.11.92.0.5/ld/deffilep.y --- binutils-2.11.90.0.31/ld/deffilep.y Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/ld/deffilep.y Mon Oct 1 15:25:25 2001 @@ -1,6 +1,7 @@ %{ /* deffilep.y - parser for .def files */ -/* Copyright 1995, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. +/* Copyright 1995, 1997, 1998, 1999, 2000, 2001 + Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -19,8 +20,8 @@ along with this program; if not, write t Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include -#include #include "libiberty.h" +#include "safe-ctype.h" #include "bfd.h" #include "sysdep.h" #include "ld.h" @@ -83,7 +84,7 @@ static void def_heapsize PARAMS ((int, i static void def_import PARAMS ((const char *, const char *, const char *, const char *, int)); static void def_library PARAMS ((const char *, int)); -static def_file_module *def_stash_module PARAMS ((def_file *, char *)); +static def_file_module *def_stash_module PARAMS ((def_file *, const char *)); static void def_name PARAMS ((const char *, int)); static void def_section PARAMS ((const char *, int)); static void def_section_alt PARAMS ((const char *, const char *)); @@ -495,7 +496,7 @@ def_file_add_export (def, external_name, static def_file_module * def_stash_module (def, name) def_file *def; - char *name; + const char *name; { def_file_module *s; for (s=def->modules; s; s=s->next) @@ -532,7 +533,7 @@ def_file_add_import (def, name, module, if (name) i->name = xstrdup (name); if (module) - i->module = def_stash_module(def, module); + i->module = def_stash_module (def, module); i->ordinal = ordinal; if (internal_name) i->internal_name = xstrdup (internal_name); @@ -571,10 +572,10 @@ def_file_add_directive (my_def, param, l while (param < pend) { - while (param < pend && isspace (*param)) + while (param < pend && ISSPACE (*param)) param++; for (tend = param + 1; - tend < pend && !(isspace (tend[-1]) && *tend == '-'); + tend < pend && !(ISSPACE (tend[-1]) && *tend == '-'); tend++); for (i = 0; diropts[i].param; i++) @@ -948,10 +949,10 @@ def_lex () /* must be something else */ saw_newline = 0; - if (isdigit (c)) + if (ISDIGIT (c)) { bufptr = 0; - while (c != EOF && (isxdigit (c) || (c == 'x'))) + while (c != EOF && (ISXDIGIT (c) || (c == 'x'))) { put_buf (c); c = def_getc (); @@ -965,10 +966,10 @@ def_lex () return NUMBER; } - if (isalpha (c) || strchr ("$:-_?", c)) + if (ISALPHA (c) || strchr ("$:-_?", c)) { bufptr = 0; - while (c != EOF && (isalnum (c) || strchr ("$:-_?/@", c))) + while (c != EOF && (ISALNUM (c) || strchr ("$:-_?/@", c))) { put_buf (c); c = def_getc (); diff -uprN binutils-2.11.90.0.31/ld/emulparams/elf64alpha.sh binutils-2.11.92.0.5/ld/emulparams/elf64alpha.sh --- binutils-2.11.90.0.31/ld/emulparams/elf64alpha.sh Mon Dec 4 18:34:01 2000 +++ binutils-2.11.92.0.5/ld/emulparams/elf64alpha.sh Mon Oct 1 15:25:25 2001 @@ -24,7 +24,7 @@ PARSE_AND_LIST_PROLOGUE=' static int elf64alpha_32bit = 0; struct ld_emulation_xfer_struct ld_elf64alpha_emulation; -static void gld_elf64alpha_finish (); +static void gld_elf64alpha_finish PARAMS ((void)); ' PARSE_AND_LIST_LONGOPTS=' diff -uprN binutils-2.11.90.0.31/ld/emulparams/h8300helf.sh binutils-2.11.92.0.5/ld/emulparams/h8300helf.sh --- binutils-2.11.90.0.31/ld/emulparams/h8300helf.sh Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/ld/emulparams/h8300helf.sh Mon Oct 1 15:25:25 2001 @@ -8,5 +8,5 @@ TEMPLATE_NAME=elf32 EMBEDDED=yes OTHER_RELOCATING_SECTIONS=' -.stack 0xfefc : { _stack = .; *(.stack) } +.stack 0x2fefc : { _stack = .; *(.stack) } ' diff -uprN binutils-2.11.90.0.31/ld/emulparams/h8300self.sh binutils-2.11.92.0.5/ld/emulparams/h8300self.sh --- binutils-2.11.90.0.31/ld/emulparams/h8300self.sh Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/ld/emulparams/h8300self.sh Mon Oct 1 15:25:25 2001 @@ -8,5 +8,5 @@ TEMPLATE_NAME=elf32 EMBEDDED=yes OTHER_RELOCATING_SECTIONS=' -.stack 0xfefc : { _stack = .; *(.stack) } +.stack 0x2fefc : { _stack = .; *(.stack) } ' diff -uprN binutils-2.11.90.0.31/ld/emultempl/aix.em binutils-2.11.92.0.5/ld/emultempl/aix.em --- binutils-2.11.90.0.31/ld/emultempl/aix.em Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/ld/emultempl/aix.em Mon Oct 1 15:25:25 2001 @@ -36,12 +36,11 @@ Foundation, Inc., 59 Temple Place - Suit #include "bfd.h" #include "sysdep.h" #include "libiberty.h" +#include "safe-ctype.h" #include "getopt.h" #include "obstack.h" #include "bfdlink.h" -#include - #include "ld.h" #include "ldmain.h" #include "ldmisc.h" @@ -65,6 +64,8 @@ static void gld${EMULATION_NAME}_find_re PARAMS ((lang_statement_union_type *)); static void gld${EMULATION_NAME}_find_exp_assignment PARAMS ((etree_type *)); static char *gld${EMULATION_NAME}_get_script PARAMS ((int *isfile)); +static boolean gld${EMULATION_NAME}_unrecognized_file + PARAMS ((lang_input_statement_type *)); /* The file alignment required for each section. */ static unsigned long file_align; @@ -106,7 +107,6 @@ struct export_symbol_list { struct export_symbol_list *next; const char *name; - boolean syscall; }; static struct export_symbol_list *export_symbols; @@ -640,7 +640,7 @@ gld${EMULATION_NAME}_before_allocation ( h = bfd_link_hash_lookup (link_info.hash, el->name, false, false, false); if (h == NULL) einfo ("%P%F: bfd_link_hash_lookup of export symbol failed: %E\n"); - if (! bfd_xcoff_export_symbol (output_bfd, &link_info, h, el->syscall)) + if (! bfd_xcoff_export_symbol (output_bfd, &link_info, h)) einfo ("%P%F: bfd_xcoff_export_symbol failed: %E\n"); } @@ -840,8 +840,7 @@ static int change_symbol_mode (char *inp return 0; } - -static int is_syscall (char *input) +static int is_syscall(char *input, unsigned int *flag) { /* * 1 : yes @@ -850,45 +849,44 @@ static int is_syscall (char *input) */ unsigned int bit; char *string; - - char *syscall_string[] = { - "svc", /* 0x01 */ - "svc32", /* 0x02 */ - "svc3264", /* 0x04 */ - "svc64", /* 0x08 */ - "syscall", /* 0x10 */ - "syscall32", /* 0x20 */ - "syscall3264", /* 0x40 */ - "syscall64", /* 0x80 */ - NULL + + struct sc { + char *syscall_string; + unsigned int flag; + } s [] = { + { "svc" /* 0x01 */, XCOFF_SYSCALL32 }, + { "svc32" /* 0x02 */, XCOFF_SYSCALL32 }, + { "svc3264" /* 0x04 */, XCOFF_SYSCALL32 | XCOFF_SYSCALL64 }, + { "svc64" /* 0x08 */, XCOFF_SYSCALL64 }, + { "syscall" /* 0x10 */, XCOFF_SYSCALL32 }, + { "syscall32" /* 0x20 */, XCOFF_SYSCALL32 }, + { "syscall3264" /* 0x40 */, XCOFF_SYSCALL32 | XCOFF_SYSCALL64 }, + { "syscall64" /* 0x80 */, XCOFF_SYSCALL64 }, + { NULL, 0 }, }; - for (bit = 0; ;bit++) - { + *flag = 0; - string = syscall_string[bit]; - if (NULL == string) - { - return -1; - } + for (bit = 0; ;bit++) { + + string = s[bit].syscall_string; + if (NULL == string) { + return -1; + } - if (0 == strcmp (input, string)) - { - if (1 << bit & ${SYSCALL_MASK}) - { - return 1; - } - else - { - return 0; - } - } + if (0 == strcmp(input, string)) { + if (1 << bit & ${SYSCALL_MASK}) { + *flag = s[bit].flag; + return 1; + } else { + return 0; + } } + } /* should not be here */ return -1; } - /* Read an import or export file. For an import file, this is called by the before_allocation emulation routine. For an export file, this is called by the parse_args emulation routine. */ @@ -937,7 +935,7 @@ gld${EMULATION_NAME}_read_file (filename { char *s; char *symname; - boolean syscall; + unsigned int syscall_flag = 0; bfd_vma address; struct bfd_link_hash_entry *h; @@ -951,7 +949,7 @@ gld${EMULATION_NAME}_read_file (filename ++lineno; s = (char *) obstack_base (o); - while (isspace ((unsigned char) *s)) + while (ISSPACE (*s)) ++s; if (*s == '\0' || *s == '*' @@ -966,7 +964,7 @@ gld${EMULATION_NAME}_read_file (filename if (*s == '#' && s[1] == '!') { s += 2; - while (isspace ((unsigned char) *s)) + while (ISSPACE (*s)) ++s; if (*s == '\0') { @@ -987,7 +985,8 @@ gld${EMULATION_NAME}_read_file (filename keep = true; imppath = s; file = NULL; - while (! isspace ((unsigned char) *s) && *s != '(' && *s != '\0') + while (! ISSPACE (*s) + && *s != '(' && *s != '\0') { if (*s == '/') file = s + 1; @@ -1007,7 +1006,7 @@ gld${EMULATION_NAME}_read_file (filename } cs = *s; *s = '\0'; - while (isspace ((unsigned char) cs)) + while (ISSPACE (cs)) { ++s; cs = *s; @@ -1040,10 +1039,10 @@ gld${EMULATION_NAME}_read_file (filename { /* This is a symbol to be imported or exported. */ symname = s; - syscall = false; + syscall_flag = 0; address = (bfd_vma) -1; - while (! isspace ((unsigned char) *s) && *s != '\0') + while (! ISSPACE (*s) && *s != '\0') ++s; if (*s != '\0') { @@ -1051,16 +1050,16 @@ gld${EMULATION_NAME}_read_file (filename *s++ = '\0'; - while (isspace ((unsigned char) *s)) + while (ISSPACE (*s)) ++s; se = s; - while (! isspace ((unsigned char) *se) && *se != '\0') + while (! ISSPACE (*se) && *se != '\0') ++se; if (*se != '\0') { *se++ = '\0'; - while (isspace ((unsigned char) *se)) + while (ISSPACE (*se)) ++se; if (*se != '\0') einfo ("%s%d: warning: syntax error in import/export file\n", @@ -1072,29 +1071,21 @@ gld${EMULATION_NAME}_read_file (filename int status; char *end; - status = is_syscall (s); - - switch (status) - { - case 1: - /* this is a system call */ - syscall = true; - break; - - case 0: - /* ignore this system call */ - break; - - default: - /* not a system call, check for address */ - address = strtoul (s, &end, 0); - if (*end != '\0') - { - einfo ("%s:%d: warning: syntax error in import/export file\n", - filename, lineno); - - } - } + status = is_syscall(s, &syscall_flag); + + if (0 > status) { + /* not a system call, check for address */ + address = strtoul (s, &end, 0); + + /* not a system call, check for address */ + address = strtoul (s, &end, 0); + if (*end != '\0') + { + einfo ("%s:%d: warning: syntax error in import/export file\n", + filename, lineno); + + } + } } } @@ -1107,7 +1098,6 @@ gld${EMULATION_NAME}_read_file (filename xmalloc (sizeof (struct export_symbol_list))); n->next = export_symbols; n->name = xstrdup (symname); - n->syscall = syscall; export_symbols = n; } else @@ -1123,7 +1113,7 @@ gld${EMULATION_NAME}_read_file (filename { if (! bfd_xcoff_import_symbol (output_bfd, &link_info, h, address, imppath, impfile, - impmember)) + impmember, syscall_flag)) einfo ("%X%s:%d: failed to import symbol %s: %E\n", filename, lineno, symname); } diff -uprN binutils-2.11.90.0.31/ld/emultempl/armcoff.em binutils-2.11.92.0.5/ld/emultempl/armcoff.em --- binutils-2.11.90.0.31/ld/emultempl/armcoff.em Thu Mar 15 14:57:09 2001 +++ binutils-2.11.92.0.5/ld/emultempl/armcoff.em Mon Oct 1 15:25:25 2001 @@ -4,7 +4,7 @@ cat >e${EMULATION_NAME}.c <e${EMULATION_NAME}.c < pe.SectionAlignment) { @@ -455,11 +458,11 @@ gld_${EMULATION_NAME}_after_open() static int sort_by_file_name (a, b) - void *a; - void *b; + const PTR a; + const PTR b; { - lang_statement_union_type **ra = a; - lang_statement_union_type **rb = b; + const lang_statement_union_type *const *ra = a; + const lang_statement_union_type *const *rb = b; int i, a_sec, b_sec; i = strcmp ((*ra)->input_section.ifile->the_bfd->my_archive->filename, @@ -472,19 +475,19 @@ sort_by_file_name (a, b) if (i != 0) return i; /* the tail idata4/5 are the only ones without relocs to an - idata$6 section unless we are importing by ordinal, + idata$6 section unless we are importing by ordinal, so sort them to last to terminate the IAT and HNT properly. if no reloc this one is import by ordinal so we have to sort by section contents */ if ( ((*ra)->input_section.section->reloc_count + (*rb)->input_section.section->reloc_count) ) { - i = (((*ra)->input_section.section->reloc_count > + i = (((*ra)->input_section.section->reloc_count > (*rb)->input_section.section->reloc_count) ? -1 : 0); if ( i != 0) return i; - return (((*ra)->input_section.section->reloc_count > + return (((*ra)->input_section.section->reloc_count > (*rb)->input_section.section->reloc_count) ? 0 : 1); } else @@ -492,12 +495,12 @@ sort_by_file_name (a, b) if ( (strcmp( (*ra)->input_section.section->name, ".idata$6") == 0) ) return 0; /* don't sort .idata$6 or .idata$7 FIXME dlltool eliminate .idata$7 */ - if (! bfd_get_section_contents ((*ra)->input_section.ifile->the_bfd, + if (! bfd_get_section_contents ((*ra)->input_section.ifile->the_bfd, (*ra)->input_section.section, &a_sec, (file_ptr) 0, (bfd_size_type)sizeof(a_sec))) einfo ("%F%B: Can't read contents of section .idata: %E\n", (*ra)->input_section.ifile->the_bfd); - if (! bfd_get_section_contents ((*rb)->input_section.ifile->the_bfd, + if (! bfd_get_section_contents ((*rb)->input_section.ifile->the_bfd, (*rb)->input_section.section, &b_sec, (file_ptr) 0, (bfd_size_type)sizeof(b_sec) )) einfo ("%F%B: Can't read contents of section .idata: %E\n", (*rb)->input_section.ifile->the_bfd); @@ -512,11 +515,11 @@ return 0; static int sort_by_section_name (a, b) - void *a; - void *b; + const PTR a; + const PTR b; { - lang_statement_union_type **ra = a; - lang_statement_union_type **rb = b; + const lang_statement_union_type *const *ra = a; + const lang_statement_union_type *const *rb = b; int i; i = strcmp ((*ra)->input_section.section->name, (*rb)->input_section.section->name); @@ -541,7 +544,7 @@ static lang_statement_union_type ** sort_sections_1 (startptr, next_after, count, sort_func) lang_statement_union_type **startptr,*next_after; int count; - int (*sort_func) (); + int (*sort_func) PARAMS ((const PTR, const PTR)); { lang_statement_union_type **vec; lang_statement_union_type *p; @@ -671,7 +674,7 @@ sort_sections (s) } } -static void +static void gld_${EMULATION_NAME}_before_allocation() { extern lang_statement_list_type *stat_ptr; @@ -828,7 +831,7 @@ EOF sc="-f stringify.sed" cat >>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c < +#include "safe-ctype.h" #include "bfdlink.h" @@ -1210,7 +1209,7 @@ gld${EMULATION_NAME}_place_orphan (file, /* If the name of the section is representable in C, then create symbols to mark the start and the end of the section. */ for (ps = outsecname; *ps != '\0'; ps++) - if (! isalnum ((unsigned char) *ps) && *ps != '_') + if (! ISALNUM (*ps) && *ps != '_') break; if (*ps == '\0') { @@ -1541,6 +1540,8 @@ cat >>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <e${EMULATION_NAME}.c <e${EMULATION_NAME}.c < #include "bfd.h" #include "sysdep.h" #include "libiberty.h" +#include "safe-ctype.h" #include "bfdlink.h" #include "ld.h" @@ -41,6 +41,11 @@ Software Foundation, 59 Temple Place - S #include "ldfile.h" #include "ldemul.h" +static void gld960_before_parse PARAMS ((void)); +static void gld960_set_output_arch PARAMS ((void)); +static char *gld960_choose_target PARAMS ((void)); +static char *gld960_get_script PARAMS ((int *)); + #ifdef GNU960 static void @@ -91,8 +96,7 @@ gld960_set_output_arch() s = concat ("i960:", ldfile_output_machine_name, (char *) NULL); for (s1 = s; *s1 != '\0'; s1++) - if (isupper ((unsigned char) *s1)) - *s1 = tolower ((unsigned char) *s1); + *s1 = TOLOWER (*s1); ldfile_set_output_arch (s); free (s); } diff -uprN binutils-2.11.90.0.31/ld/emultempl/lnk960.em binutils-2.11.92.0.5/ld/emultempl/lnk960.em --- binutils-2.11.90.0.31/ld/emultempl/lnk960.em Sat Mar 17 12:48:14 2001 +++ binutils-2.11.92.0.5/ld/emultempl/lnk960.em Mon Oct 1 15:25:25 2001 @@ -2,7 +2,7 @@ # It does some substitutions. cat >e${EMULATION_NAME}.c < -#define TARGET_IS_${EMULATION_NAME} - /* Permit the emulation parameters to override the default section alignment by setting OVERRIDE_SECTION_ALIGNMENT. FIXME: This makes it seem that include/coff/internal.h should not define @@ -94,15 +104,6 @@ Foundation, Inc., 59 Temple Place - Suit #define PE_DEF_FILE_ALIGNMENT 0x00000200 #endif -#ifdef TARGET_IS_arm_epoc_pe -#define bfd_arm_pe_allocate_interworking_sections \ - bfd_arm_epoc_pe_allocate_interworking_sections -#define bfd_arm_pe_get_bfd_for_interworking \ - bfd_arm_epoc_pe_get_bfd_for_interworking -#define bfd_arm_pe_process_before_allocation \ - bfd_arm_epoc_pe_process_before_allocation -#endif - static void gld_${EMULATION_NAME}_set_symbols PARAMS ((void)); static void gld_${EMULATION_NAME}_after_open PARAMS ((void)); static void gld_${EMULATION_NAME}_before_parse PARAMS ((void)); @@ -115,8 +116,30 @@ static boolean gld_${EMULATION_NAME}_pla static char *gld_${EMULATION_NAME}_get_script PARAMS ((int *)); static int gld_${EMULATION_NAME}_parse_args PARAMS ((int, char **)); static void gld_${EMULATION_NAME}_finish PARAMS ((void)); -static boolean gld_${EMULATION_NAME}_open_dynamic_archive +static boolean gld_${EMULATION_NAME}_open_dynamic_archive PARAMS ((const char *, search_dirs_type *, lang_input_statement_type *)); +static void gld_${EMULATION_NAME}_list_options PARAMS ((FILE *)); +static void set_pe_name PARAMS ((char *, long)); +static void set_pe_subsystem PARAMS ((void)); +static void set_pe_value PARAMS ((char *)); +static void set_pe_stack_heap PARAMS ((char *, char *)); + +#ifdef DLL_SUPPORT +static boolean pe_undef_cdecl_match + PARAMS ((struct bfd_link_hash_entry *, PTR)); +static void pe_fixup_stdcalls PARAMS ((void)); +static int make_import_fixup PARAMS ((arelent *, asection *)); +static void pe_find_data_imports PARAMS ((void)); +#endif + +static boolean pr_sym PARAMS ((struct bfd_hash_entry *, PTR string)); +static boolean gld_${EMULATION_NAME}_unrecognized_file + PARAMS ((lang_input_statement_type *)); +static boolean gld_${EMULATION_NAME}_recognized_file + PARAMS ((lang_input_statement_type *)); +static int gld_${EMULATION_NAME}_find_potential_libraries + PARAMS ((char *, lang_input_statement_type *)); + static struct internal_extra_pe_aouthdr pe; static int dll; @@ -204,7 +227,7 @@ static struct option longopts[] = { {"base-file", required_argument, NULL, OPTION_BASE_FILE}, {"dll", no_argument, NULL, OPTION_DLL}, {"file-alignment", required_argument, NULL, OPTION_FILE_ALIGNMENT}, - {"heap", required_argument, NULL, OPTION_HEAP}, + {"heap", required_argument, NULL, OPTION_HEAP}, {"image-base", required_argument, NULL, OPTION_IMAGE_BASE}, {"major-image-version", required_argument, NULL, OPTION_MAJOR_IMAGE_VERSION}, {"major-os-version", required_argument, NULL, OPTION_MAJOR_OS_VERSION}, @@ -357,7 +380,7 @@ set_pe_subsystem () const char *sver; int len; int i; - static const struct + static const struct { const char *name; const int value; @@ -430,7 +453,7 @@ set_pe_subsystem () return; } } - + einfo (_("%P%F: invalid subsystem type %s\n"), optarg); } @@ -439,12 +462,12 @@ set_pe_subsystem () static void set_pe_value (name) char *name; - + { char *end; - + set_pe_name (name, strtoul (optarg, &end, 0)); - + if (end == optarg) einfo (_("%P%F: invalid hex number for PE parameter '%s'\n"), optarg); @@ -457,7 +480,7 @@ set_pe_stack_heap (resname, comname) char *comname; { set_pe_value (resname); - + if (*optarg == ',') { optarg++; @@ -510,10 +533,10 @@ gld_${EMULATION_NAME}_parse_args(argc, a break; /* PE options */ - case OPTION_HEAP: + case OPTION_HEAP: set_pe_stack_heap ("__size_of_heap_reserve__", "__size_of_heap_commit__"); break; - case OPTION_STACK: + case OPTION_STACK: set_pe_stack_heap ("__size_of_stack_reserve__", "__size_of_stack_commit__"); break; case OPTION_SUBSYSTEM: @@ -614,7 +637,7 @@ gld_${EMULATION_NAME}_parse_args(argc, a #ifdef DLL_SUPPORT -static unsigned long +static unsigned long strhash (const char *str) { const unsigned char *s; @@ -701,7 +724,7 @@ gld_${EMULATION_NAME}_set_symbols () } /* Restore the pointer. */ stat_ptr = save; - + if (pe.FileAlignment > pe.SectionAlignment) { @@ -732,6 +755,13 @@ gld_${EMULATION_NAME}_after_parse () ldlang_add_undef (entry_symbol); } +/* pe-dll.c directly accesses pe_data_import_dll, + so it must be defined outside of #ifdef DLL_SUPPORT. + Note - this variable is deliberately not initialised. + This allows it to be treated as a common varaible, and only + exist in one incarnation in a multiple target enabled linker. */ +char * pe_data_import_dll; + #ifdef DLL_SUPPORT static struct bfd_link_hash_entry *pe_undef_found_sym; @@ -758,11 +788,11 @@ pe_fixup_stdcalls () static int gave_warning_message = 0; struct bfd_link_hash_entry *undef, *sym; char *at; - if (pe_dll_extra_pe_debug) + if (pe_dll_extra_pe_debug) { printf ("%s\n", __FUNCTION__); } - + for (undef = link_info.hash->undefs; undef; undef=undef->next) if (undef->type == bfd_link_hash_undefined) { @@ -823,25 +853,39 @@ pe_fixup_stdcalls () } static int -make_import_fixup (rel) +make_import_fixup (rel, s) arelent *rel; + asection *s; { struct symbol_cache_entry *sym = *rel->sym_ptr_ptr; -/* - bfd *b; -*/ - if (pe_dll_extra_pe_debug) + if (pe_dll_extra_pe_debug) { - printf ("arelent: %s@%#x: add=%li\n", sym->name, - (int) rel->address, rel->addend); + printf ("arelent: %s@%#lx: add=%li\n", sym->name, + (long) rel->address, (long) rel->addend); } - pe_create_import_fixup (rel); + + { + int addend = 0; + if (!bfd_get_section_contents(s->owner, s, &addend, rel->address, sizeof(addend))) + { + einfo (_("%C: Cannot get section contents - auto-import exception\n"), + s->owner, s, rel->address); + } + + if (addend == 0) + pe_create_import_fixup (rel); + else + { + einfo (_("%C: variable '%T' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details.\n"), + s->owner, s, rel->address, sym->name); + einfo ("%X"); + } + } + return 1; } -char *pe_data_import_dll; - static void pe_find_data_imports () { @@ -852,7 +896,7 @@ pe_find_data_imports () { /* C++ symbols are *long* */ char buf[4096]; - if (pe_dll_extra_pe_debug) + if (pe_dll_extra_pe_debug) { printf ("%s:%s\n", __FUNCTION__, undef->root.string); } @@ -863,31 +907,31 @@ pe_find_data_imports () { einfo (_("Warning: resolving %s by linking to %s (auto-import)\n"), undef->root.string, buf); - { + { bfd *b = sym->u.def.section->owner; asymbol **symbols; int nsyms, symsize, i; - + symsize = bfd_get_symtab_upper_bound (b); symbols = (asymbol **) xmalloc (symsize); nsyms = bfd_canonicalize_symtab (b, symbols); for (i = 0; i < nsyms; i++) { - if (memcmp(symbols[i]->name, "__head_", + if (memcmp(symbols[i]->name, "__head_", sizeof ("__head_") - 1)) continue; if (pe_dll_extra_pe_debug) { printf ("->%s\n", symbols[i]->name); } - pe_data_import_dll = (char*) (symbols[i]->name + + pe_data_import_dll = (char*) (symbols[i]->name + sizeof ("__head_") - 1); break; } } - pe_walk_relocs_of_symbol (&link_info, undef->root.string, + pe_walk_relocs_of_symbol (&link_info, undef->root.string, make_import_fixup); /* let's differentiate it somehow from defined */ @@ -907,9 +951,9 @@ pe_find_data_imports () static boolean pr_sym (h, string) struct bfd_hash_entry *h; - PTR string; + PTR string ATTRIBUTE_UNUSED; { - if (pe_dll_extra_pe_debug) + if (pe_dll_extra_pe_debug) { printf("+%s\n",h->string); } @@ -921,7 +965,7 @@ static void gld_${EMULATION_NAME}_after_open () { - if (pe_dll_extra_pe_debug) + if (pe_dll_extra_pe_debug) { bfd *a; struct bfd_link_hash_entry *sym; @@ -936,12 +980,12 @@ gld_${EMULATION_NAME}_after_open () printf("*%s\n",a->filename); } } - + /* Pass the wacky PE command line options into the output bfd. FIXME: This should be done via a function, rather than by including an internal BFD header. */ - - if (coff_data (output_bfd) == NULL || coff_data (output_bfd)->pe == NULL) + + if (coff_data (output_bfd) == NULL || coff_data (output_bfd)->pe == 0) einfo (_("%F%P: PE operations on non PE file.\n")); pe_data (output_bfd)->pe_opthdr = pe; @@ -951,7 +995,7 @@ gld_${EMULATION_NAME}_after_open () if (pe_enable_stdcall_fixup) /* -1=warn or 1=disable */ pe_fixup_stdcalls (); - pe_find_data_imports (output_bfd, &link_info); + pe_find_data_imports (); pe_process_import_defs(output_bfd, &link_info); if (link_info.shared) @@ -1002,7 +1046,7 @@ gld_${EMULATION_NAME}_after_open () { int idata2 = 0, reloc_count=0, is_imp = 0; asection *sec; - + /* See if this is an import library thunk. */ for (sec = is->the_bfd->sections; sec; sec = sec->next) { @@ -1012,7 +1056,7 @@ gld_${EMULATION_NAME}_after_open () is_imp = 1; reloc_count += sec->reloc_count; } - + if (is_imp && !idata2 && reloc_count) { /* It is, look for the reference to head and see if it's @@ -1025,22 +1069,22 @@ gld_${EMULATION_NAME}_after_open () asymbol **symbols; arelent **relocs; int nrelocs; - + symsize = bfd_get_symtab_upper_bound (is->the_bfd); if (symsize < 1) break; relsize = bfd_get_reloc_upper_bound (is->the_bfd, sec); if (relsize < 1) break; - + symbols = (asymbol **) xmalloc (symsize); - symsize = bfd_canonicalize_symtab (is->the_bfd, symbols); + symsize = bfd_canonicalize_symtab (is->the_bfd, symbols); if (symsize < 0) { einfo ("%X%P: unable to process symbols: %E"); return; } - + relocs = (arelent **) xmalloc ((size_t) relsize); nrelocs = bfd_canonicalize_reloc (is->the_bfd, sec, relocs, symbols); @@ -1050,39 +1094,39 @@ gld_${EMULATION_NAME}_after_open () einfo ("%X%P: unable to process relocs: %E"); return; } - + for (i = 0; i < nrelocs; i++) { struct symbol_cache_entry *s; struct bfd_link_hash_entry * blhe; bfd *other_bfd; char *n; - + s = (relocs[i]->sym_ptr_ptr)[0]; - + if (s->flags & BSF_LOCAL) continue; - + /* Thunk section with reloc to another bfd. */ blhe = bfd_link_hash_lookup (link_info.hash, s->name, false, false, true); - + if (blhe == NULL || blhe->type != bfd_link_hash_defined) continue; - + other_bfd = blhe->u.def.section->owner; - + if (strcmp (is->the_bfd->my_archive->filename, other_bfd->my_archive->filename) == 0) continue; - + /* Rename this implib to match the other. */ n = (char *) xmalloc (strlen (other_bfd->my_archive->filename) + 1); - + strcpy (n, other_bfd->my_archive->filename); - + is->the_bfd->my_archive->filename = n; } @@ -1160,7 +1204,7 @@ gld_${EMULATION_NAME}_after_open () } } -static void +static void gld_${EMULATION_NAME}_before_allocation() { #ifdef TARGET_IS_ppcpe @@ -1302,7 +1346,7 @@ gld_${EMULATION_NAME}_unrecognized_file( } #endif return false; - + } static boolean @@ -1341,7 +1385,7 @@ gld_${EMULATION_NAME}_finish () if (thumb_entry_symbol != NULL) { h = bfd_link_hash_lookup (link_info.hash, thumb_entry_symbol, false, false, true); - + if (h != (struct bfd_link_hash_entry *) NULL && (h->type == bfd_link_hash_defined || h->type == bfd_link_hash_defweak) @@ -1349,23 +1393,23 @@ gld_${EMULATION_NAME}_finish () { static char buffer[32]; bfd_vma val; - + /* Special procesing is required for a Thumb entry symbol. The bottom bit of its address must be set. */ val = (h->u.def.value + bfd_get_section_vma (output_bfd, h->u.def.section->output_section) + h->u.def.section->output_offset); - + val |= 1; - + /* Now convert this value into a string and store it in entry_symbol where the lang_finish() function will pick it up. */ buffer[0] = '0'; buffer[1] = 'x'; - + sprintf_vma (buffer + 2, val); - + if (entry_symbol != NULL && entry_from_cmdline) einfo (_("%P: warning: '--thumb-entry %s' is overriding '-e %s'\n"), thumb_entry_symbol, entry_symbol); @@ -1390,7 +1434,7 @@ gld_${EMULATION_NAME}_finish () pe_exe_fill_sections (output_bfd, &link_info); } #endif - + if (pe_out_def_filename) pe_dll_generate_def_file (pe_out_def_filename); #endif /* DLL_SUPPORT */ @@ -1568,7 +1612,7 @@ gld_${EMULATION_NAME}_place_orphan (file { char *symname; etree_type *e_align; - + symname = (char *) xmalloc (ps - outsecname + sizeof "___start_"); sprintf (symname, "___start_%s", outsecname); e_align = exp_unop (ALIGN_K, @@ -1576,7 +1620,7 @@ gld_${EMULATION_NAME}_place_orphan (file lang_add_assignment (exp_assop ('=', symname, e_align)); } } - + if (link_info.relocateable || (s->flags & (SEC_LOAD | SEC_ALLOC)) == 0) address = exp_intop ((bfd_vma) 0); else @@ -1607,7 +1651,7 @@ gld_${EMULATION_NAME}_place_orphan (file stat_ptr back where we want it. */ if (place != NULL) stat_ptr = &add; - + symname = (char *) xmalloc (ps - outsecname + sizeof "___stop_"); sprintf (symname, "___stop_%s", outsecname); lang_add_assignment (exp_assop ('=', symname, @@ -1755,7 +1799,7 @@ gld_${EMULATION_NAME}_open_dynamic_archi filename = entry->filename; string = (char *) xmalloc (strlen (search->name) - + strlen (filename) + + strlen (filename) + sizeof "/lib.a.dll" #ifdef DLL_SUPPORT + (pe_dll_search_prefix ? strlen (pe_dll_search_prefix) : 0) @@ -1789,7 +1833,7 @@ gld_${EMULATION_NAME}_open_dynamic_archi { #ifdef DLL_SUPPORT if (pe_dll_search_prefix) - { + { /* Try "foo.dll" (preferred dll name, if specified) */ sprintf (string, "%s/%s%s.dll", search->name, pe_dll_search_prefix, filename); if (! ldfile_try_open_bfd (string, entry)) @@ -1809,7 +1853,7 @@ gld_${EMULATION_NAME}_open_dynamic_archi } } else /* pe_dll_search_prefix not specified */ -#endif +#endif { /* Try "libfoo.dll" (preferred dll name) */ sprintf (string, "%s/lib%s.dll", search->name, filename); @@ -1850,7 +1894,7 @@ EOF sc="-f stringify.sed" cat >>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c < - #include "bfd.h" #include "sysdep.h" #include "bfdlink.h" #include "libiberty.h" +#include "safe-ctype.h" #include "ld.h" #include "ldmain.h" @@ -311,13 +310,13 @@ gld${EMULATION_NAME}_search_dir (dirname if (entry->d_name[6 + len] == '\0') ; else if (entry->d_name[6 + len] == '.' - && isdigit ((unsigned char) entry->d_name[7 + len])) + && ISDIGIT (entry->d_name[7 + len])) ; else continue; for (s = entry->d_name + 6 + len; *s != '\0'; s++) - if (*s != '.' && ! isdigit ((unsigned char) *s)) + if (*s != '.' && ! ISDIGIT (*s)) break; if (*s != '\0') continue; diff -uprN binutils-2.11.90.0.31/ld/emultempl/vanilla.em binutils-2.11.92.0.5/ld/emultempl/vanilla.em --- binutils-2.11.90.0.31/ld/emultempl/vanilla.em Thu Mar 15 14:57:13 2001 +++ binutils-2.11.92.0.5/ld/emultempl/vanilla.em Mon Oct 1 15:25:25 2001 @@ -2,7 +2,7 @@ # It does some substitutions. cat >e${EMULATION_NAME}.c < ldscripts/${EMULATION_NAME}.xr LD_FLAG=u DATA_ALIGNMENT=${DATA_ALIGNMENT_u} CONSTRUCTING=" " -( . ${srcdir}/emulparams/${EMULATION_NAME}.sh +( echo "/* Script for ld -Ur: link w/out relocation, do create constructors */" + . ${srcdir}/emulparams/${EMULATION_NAME}.sh . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xu LD_FLAG= DATA_ALIGNMENT=${DATA_ALIGNMENT_} RELOCATING=" " -( . ${srcdir}/emulparams/${EMULATION_NAME}.sh +( echo "/* Default linker script, for normal executables */" + . ${srcdir}/emulparams/${EMULATION_NAME}.sh . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.x LD_FLAG=n DATA_ALIGNMENT=${DATA_ALIGNMENT_n} TEXT_START_ADDR=${NONPAGED_TEXT_START_ADDR-${TEXT_START_ADDR}} -( . ${srcdir}/emulparams/${EMULATION_NAME}.sh +( echo "/* Script for -n: mix text and data on same page */" + . ${srcdir}/emulparams/${EMULATION_NAME}.sh . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xn LD_FLAG=N DATA_ALIGNMENT=${DATA_ALIGNMENT_N} -( . ${srcdir}/emulparams/${EMULATION_NAME}.sh +( echo "/* Script for -N: mix text and data on same page; don't align data */" + . ${srcdir}/emulparams/${EMULATION_NAME}.sh . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xbn @@ -145,7 +150,8 @@ if test -n "$GENERATE_COMBRELOC_SCRIPT"; DATA_ALIGNMENT=${DATA_ALIGNMENT_c-${DATA_ALIGNMENT_}} LD_FLAG=c COMBRELOC=ldscripts/${EMULATION_NAME}.xc.tmp - ( . ${srcdir}/emulparams/${EMULATION_NAME}.sh + ( echo "/* Script for -z combreloc: combine and sort reloc sections */" + . ${srcdir}/emulparams/${EMULATION_NAME}.sh . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xc rm -f ${COMBRELOC} @@ -157,14 +163,17 @@ if test -n "$GENERATE_SHLIB_SCRIPT"; the DATA_ALIGNMENT=${DATA_ALIGNMENT_s-${DATA_ALIGNMENT_}} CREATE_SHLIB=" " # Note that TEXT_START_ADDR is set to NONPAGED_TEXT_START_ADDR. - ( . ${srcdir}/emulparams/${EMULATION_NAME}.sh + ( + echo "/* Script for ld --shared: link shared library */" + . ${srcdir}/emulparams/${EMULATION_NAME}.sh . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xs if test -n "$GENERATE_COMBRELOC_SCRIPT"; then LD_FLAG=cshared DATA_ALIGNMENT=${DATA_ALIGNMENT_sc-${DATA_ALIGNMENT}} COMBRELOC=ldscripts/${EMULATION_NAME}.xc.tmp - ( . ${srcdir}/emulparams/${EMULATION_NAME}.sh + ( echo "/* Script for --shared -z combreloc: shared library, combine & sort relocs */" + . ${srcdir}/emulparams/${EMULATION_NAME}.sh . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xsc rm -f ${COMBRELOC} diff -uprN binutils-2.11.90.0.31/ld/ld.h binutils-2.11.92.0.5/ld/ld.h --- binutils-2.11.90.0.31/ld/ld.h Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/ld/ld.h Mon Oct 1 15:25:25 2001 @@ -102,6 +102,9 @@ typedef struct user_section_struct { typedef struct { /* 1 => assign space to common symbols even if `relocatable_output'. */ boolean force_common_definition; + + /* 1 => do not assign addresses to common symbols. */ + boolean inhibit_common_definition; boolean relax; /* Name of runtime interpreter to invoke. */ diff -uprN binutils-2.11.90.0.31/ld/ld.texinfo binutils-2.11.92.0.5/ld/ld.texinfo --- binutils-2.11.90.0.31/ld/ld.texinfo Mon Aug 27 11:44:52 2001 +++ binutils-2.11.92.0.5/ld/ld.texinfo Thu Oct 4 14:35:43 2001 @@ -840,8 +840,9 @@ for Solaris compatibility. @item -z @var{keyword} The recognized keywords are @code{initfirst}, @code{interpose}, @code{loadfltr}, @code{nodefaultlib}, @code{nodelete}, @code{nodlopen}, -@code{nodump}, @code{now}, @code{origin}, @code{combreloc} and -@code{nocombreloc}. The other keywords are +@code{nodump}, @code{now}, @code{origin}, @code{combreloc}, @code{nocombreloc} +and @code{nocopyreloc}. +The other keywords are ignored for Solaris compatibility. @code{initfirst} marks the object to be initialized first at runtime before any other objects. @code{interpose} marks the object that its symbol table interposes @@ -858,6 +859,7 @@ of this object will ignore any default l @code{combreloc} combines multiple reloc sections and sorts them to make dynamic symbol lookup caching possible. @code{nocombreloc} disables multiple reloc sections combining. +@code{nocopyreloc} disables production of copy relocs. @kindex -( @cindex groups of archives @@ -950,6 +952,24 @@ sorted by name. For each symbol, a list symbol is defined, the first file listed is the location of the definition. The remaining files contain references to the symbol. +@cindex common allocation +@kindex --no-define-common +@item --no-define-common +This option inhibits the assignment of addresses to common symbols. +The script command @code{INHIBIT_COMMON_ALLOCATION} has the same effect. +@xref{Miscellaneous Commands}. + +The @samp{--no-define-common} option allows decoupling +the decision to assign addresses to Common symbols from the choice +of the output file type; otherwise a non-Relocatable output type +forces assigning addresses to Common symbols. +Using @samp{--no-define-common} allows Common symbols that are referenced +from a shared library to be assigned addresses only in the main program. +This eliminates the unused duplicate space in the shared library, +and also prevents any possible confusion over resolving to the wrong +duplicate when there are many dynamic modules with specialized search +paths for runtime symbol resolution. + @cindex symbols, from command line @kindex --defsym @var{symbol}=@var{exp} @item --defsym @var{symbol}=@var{expression} @@ -1726,9 +1746,118 @@ uwin, pw, etc. For instance, cygwin DLL @kindex --enable-auto-import @item --enable-auto-import -Do sophisticalted linking of @code{_symbol} to @code{__imp__symbol} for +Do sophisticated linking of @code{_symbol} to @code{__imp__symbol} for DATA imports from DLLs, and create the necessary thunking symbols when -building the DLLs with those DATA exports. +building the DLLs with those DATA exports. This generally will 'just +work' -- but sometimes you may see this message: + +"variable '' can't be auto-imported. Please read the +documentation for ld's @code{--enable-auto-import} for details." + +This message occurs when some (sub)expression accesses an address +ultimately given by the sum of two constants (Win32 import tables only +allow one). Instances where this may occur include accesses to member +fields of struct variables imported from a DLL, as well as using a +constant index into an array variable imported from a DLL. Any +multiword variable (arrays, structs, long long, etc) may trigger +this error condition. However, regardless of the exact data type +of the offending exported variable, ld will always detect it, issue +the warning, and exit. + +There are several ways to address this difficulty, regardless of the +data type of the exported variable: + +One solution is to force one of the 'constants' to be a variable -- +that is, unknown and un-optimizable at compile time. For arrays, +there are two possibilities: a) make the indexee (the array's address) +a variable, or b) make the 'constant' index a variable. Thus: + +@example +extern type extern_array[]; +extern_array[1] --> + @{ volatile type *t=extern_array; t[1] @} +@end example + +or + +@example +extern type extern_array[]; +extern_array[1] --> + @{ volatile int t=1; extern_array[t] @} +@end example + +For structs (and most other multiword data types) the only option +is to make the struct itself (or the long long, or the ...) variable: + +@example +extern struct s extern_struct; +extern_struct.field --> + @{ volatile struct s *t=&extern_struct; t->field @} +@end example + +or + +@example +extern long long extern_ll; +extern_ll --> + @{ volatile long long * local_ll=&extern_ll; *local_ll @} +@end example + +A second method of dealing with this difficulty is to abandon +'auto-import' for the offending symbol and mark it with +@code{__declspec(dllimport)}. However, in practice that +requires using compile-time #defines to indicate whether you are +building a DLL, building client code that will link to the DLL, or +merely building/linking to a static library. In making the choice +between the various methods of resolving the 'direct address with +constant offset' problem, you should consider typical real-world usage: + +Original: +@example +--foo.h +extern int arr[]; +--foo.c +#include "foo.h" +void main(int argc, char **argv)@{ + printf("%d\n",arr[1]); +@} +@end example + +Solution 1: +@example +--foo.h +extern int arr[]; +--foo.c +#include "foo.h" +void main(int argc, char **argv)@{ + /* This workaround is for win32 and cygwin; do not "optimize" */ + volatile int *parr = arr; + printf("%d\n",parr[1]); +@} +@end example + +Solution 2: +@example +--foo.h +/* Note: auto-export is assumed (no __declspec(dllexport)) */ +#if (defined(_WIN32) || defined(__CYGWIN__)) && \ + !(defined(FOO_BUILD_DLL) || defined(FOO_STATIC)) +#define FOO_IMPORT __declspec(dllimport) +#else +#define FOO_IMPORT +#endif +extern FOO_IMPORT int arr[]; +--foo.c +#include "foo.h" +void main(int argc, char **argv)@{ + printf("%d\n",arr[1]); +@} +@end example + +A third way to avoid this problem is to re-code your +library to use a functional interface rather than a data interface +for the offending variables (e.g. set_foo() and get_foo() accessor +functions). @kindex --disable-auto-import @item --disable-auto-import @@ -1749,7 +1878,7 @@ addresses which are a multiple of this n @item --stack @var{reserve} @itemx --stack @var{reserve},@var{commit} Specify the amount of memory to reserve (and optionally commit) to be -used as stack for this program. The default is 32Mb reserved, 4K +used as stack for this program. The default is 2Mb reserved, 4K committed. @kindex --subsystem @@ -2202,6 +2331,13 @@ This command has the same effect as the to make @code{ld} assign space to common symbols even if a relocatable output file is specified (@samp{-r}). +@item INHIBIT_COMMON_ALLOCATION +@kindex INHIBIT_COMMON_ALLOCATION +@cindex common allocation in linker script +This command has the same effect as the @samp{--no-define-common} +command-line option: to make @code{ld} omit the assignment of addresses +to common symbols even for a non-relocatable output file. + @item NOCROSSREFS(@var{section} @var{section} @dots{}) @kindex NOCROSSREFS(@var{sections}) @cindex cross references diff -uprN binutils-2.11.90.0.31/ld/ldctor.c binutils-2.11.92.0.5/ld/ldctor.c --- binutils-2.11.90.0.31/ld/ldctor.c Thu Mar 15 14:56:50 2001 +++ binutils-2.11.92.0.5/ld/ldctor.c Mon Oct 1 15:25:25 2001 @@ -1,5 +1,5 @@ /* ldctor.c -- constructor support routines - Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 + Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. By Steve Chamberlain @@ -23,8 +23,7 @@ Software Foundation, 59 Temple Place - S #include "bfd.h" #include "sysdep.h" #include "bfdlink.h" - -#include +#include "safe-ctype.h" #include "ld.h" #include "ldexp.h" @@ -146,7 +145,7 @@ ctor_prio (name) return -1; if (name[1] != 'I' && name[1] != 'D') return -1; - if (! isdigit ((unsigned char) name[3])) + if (! ISDIGIT (name[3])) return -1; return atoi (name + 3); diff -uprN binutils-2.11.90.0.31/ld/ldfile.c binutils-2.11.92.0.5/ld/ldfile.c --- binutils-2.11.90.0.31/ld/ldfile.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/ld/ldfile.c Mon Oct 1 15:25:25 2001 @@ -24,6 +24,7 @@ Software Foundation, 59 Temple Place - S #include "bfd.h" #include "sysdep.h" #include "bfdlink.h" +#include "safe-ctype.h" #include "ld.h" #include "ldmisc.h" #include "ldexp.h" @@ -35,8 +36,6 @@ Software Foundation, 59 Temple Place - S #include "ldemul.h" #include "libiberty.h" -#include - const char *ldfile_input_filename; boolean ldfile_assumed_script = false; const char *ldfile_output_machine_name = ""; @@ -189,7 +188,7 @@ ldfile_try_open_file (arch, entry, searc else if (entry->filename[0] == '/' || entry->filename[0] == '.' #if defined (__MSDOS__) || defined (_WIN32) || entry->filename[0] == '\\' - || (isalpha (entry->filename[0]) + || (ISALPHA (entry->filename[0]) && entry->filename[1] == ':') #endif ) @@ -486,8 +485,7 @@ ldfile_add_arch (in_name) new->next = (search_arch_type *) NULL; while (*name) { - if (isupper ((unsigned char) *name)) - *name = tolower ((unsigned char) *name); + *name = TOLOWER (*name); name++; } *search_arch_tail_ptr = new; diff -uprN binutils-2.11.90.0.31/ld/ldgram.y binutils-2.11.92.0.5/ld/ldgram.y --- binutils-2.11.90.0.31/ld/ldgram.y Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/ld/ldgram.y Mon Oct 1 15:25:25 2001 @@ -125,6 +125,7 @@ static int error_index; %token SECTIONS PHDRS SORT %token '{' '}' %token SIZEOF_HEADERS OUTPUT_FORMAT FORCE_COMMON_ALLOCATION OUTPUT_ARCH +%token INHIBIT_COMMON_ALLOCATION %token SIZEOF_HEADERS %token INCLUDE %token MEMORY DEFSYMEND @@ -321,6 +322,8 @@ ifile_p1: { ldfile_set_output_arch($3); } | FORCE_COMMON_ALLOCATION { command_line.force_common_definition = true ; } + | INHIBIT_COMMON_ALLOCATION + { command_line.inhibit_common_definition = true ; } | INPUT '(' input_list ')' | GROUP { lang_enter_group (); } diff -uprN binutils-2.11.90.0.31/ld/ldlang.c binutils-2.11.92.0.5/ld/ldlang.c --- binutils-2.11.90.0.31/ld/ldlang.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/ld/ldlang.c Mon Oct 1 15:25:25 2001 @@ -23,6 +23,7 @@ Software Foundation, 59 Temple Place - S #include "bfd.h" #include "sysdep.h" #include "libiberty.h" +#include "safe-ctype.h" #include "obstack.h" #include "bfdlink.h" @@ -39,8 +40,6 @@ Software Foundation, 59 Temple Place - S #include "fnmatch.h" #include "demangle.h" -#include - /* FORWARDS */ static lang_statement_union_type *new_statement PARAMS ((enum statement_enum, size_t, lang_statement_list_type *)); @@ -1014,11 +1013,8 @@ section_already_linked (abfd, sec, data) /* Set the output_section field so that lang_add_section does not create a lang_input_section structure for this - section. Since there might be a symbol in the section - being discarded, we must retain a pointer to the section - which we are really going to use. */ + section. */ sec->output_section = bfd_abs_section_ptr; - sec->kept_section = l->sec; return; } @@ -1618,12 +1614,7 @@ stricpy (dest, src) char c; while ((c = *src++) != 0) - { - if (isupper ((unsigned char) c)) - c = tolower (c); - - *dest++ = c; - } + *dest++ = TOLOWER (c); *dest = 0; } @@ -3559,6 +3550,8 @@ lang_check () static void lang_common () { + if (command_line.inhibit_common_definition) + return; if (link_info.relocateable && ! command_line.force_common_definition) return; @@ -4786,7 +4779,7 @@ lang_leave_overlay_section (fill, phdrs) clean = xmalloc (strlen (name) + 1); s2 = clean; for (s1 = name; *s1 != '\0'; s1++) - if (isalnum ((unsigned char) *s1) || *s1 == '_') + if (ISALNUM (*s1) || *s1 == '_') *s2++ = *s1; *s2 = '\0'; diff -uprN binutils-2.11.90.0.31/ld/ldlex.l binutils-2.11.92.0.5/ld/ldlex.l --- binutils-2.11.90.0.31/ld/ldlex.l Wed May 2 14:53:15 2001 +++ binutils-2.11.92.0.5/ld/ldlex.l Mon Oct 1 15:25:25 2001 @@ -1,6 +1,6 @@ %{ -/* Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 +/* Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of GLD, the Gnu Linker. @@ -28,7 +28,6 @@ This was written by steve chamberlain #include #include -#include #ifdef MPW /* Prevent enum redefinition problems. */ @@ -37,6 +36,7 @@ This was written by steve chamberlain #include "bfd.h" #include "sysdep.h" +#include "safe-ctype.h" #include "ld.h" #include "ldgram.h" #include "ldmisc.h" @@ -260,6 +260,7 @@ V_IDENTIFIER [*?.$_a-zA-Z]([*?.$_a-zA-Z0 "CREATE_OBJECT_SYMBOLS" { RTOKEN(CREATE_OBJECT_SYMBOLS);} "CONSTRUCTORS" { RTOKEN( CONSTRUCTORS);} "FORCE_COMMON_ALLOCATION" { RTOKEN(FORCE_COMMON_ALLOCATION);} +"INHIBIT_COMMON_ALLOCATION" { RTOKEN(INHIBIT_COMMON_ALLOCATION);} "SECTIONS" { RTOKEN(SECTIONS);} "FILL" { RTOKEN(FILL);} "STARTUP" { RTOKEN(STARTUP);} @@ -658,7 +659,7 @@ lex_warn_invalid (where, what) einfo ("%F%s: file not recognized: %E\n", ldfile_input_filename); } - if (! isprint ((unsigned char) *what)) + if (! ISPRINT (*what)) { sprintf (buf, "\\%03o", (unsigned int) *what); what = buf; diff -uprN binutils-2.11.90.0.31/ld/ldmain.c binutils-2.11.92.0.5/ld/ldmain.c --- binutils-2.11.90.0.31/ld/ldmain.c Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/ld/ldmain.c Mon Oct 1 15:25:25 2001 @@ -1,5 +1,5 @@ /* Main program of GNU linker. - Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 + Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Written by Steve Chamberlain steve@cygnus.com @@ -23,7 +23,7 @@ Software Foundation, 59 Temple Place - S #include "bfd.h" #include "sysdep.h" #include -#include +#include "safe-ctype.h" #include "libiberty.h" #include "progress.h" #include "bfdlink.h" @@ -169,6 +169,9 @@ main (argc, argv) #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) setlocale (LC_MESSAGES, ""); #endif +#if defined (HAVE_SETLOCALE) + setlocale (LC_CTYPE, ""); +#endif bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); @@ -202,6 +205,7 @@ main (argc, argv) config.split_by_reloc = (unsigned) -1; config.split_by_file = (bfd_size_type) -1; command_line.force_common_definition = false; + command_line.inhibit_common_definition = false; command_line.interpreter = NULL; command_line.rpath = NULL; command_line.warn_mismatch = true; @@ -348,12 +352,12 @@ main (argc, argv) if (saved_script_handle) { - static const int BufferSize = 8192; + static const int ld_bufsz = 8193; size_t n; - char *buf = xmalloc (BufferSize); + char *buf = xmalloc (ld_bufsz); rewind (saved_script_handle); - while ((n = fread (buf, 1, BufferSize - 1, saved_script_handle)) > 0) + while ((n = fread (buf, 1, ld_bufsz - 1, saved_script_handle)) > 0) { buf [n] = 0; info_msg (buf); @@ -562,6 +566,8 @@ get_emulation (argc, argv) else if (strcmp (argv[i], "-mips1") == 0 || strcmp (argv[i], "-mips2") == 0 || strcmp (argv[i], "-mips3") == 0 + || strcmp (argv[i], "-mips32") == 0 + || strcmp (argv[i], "-mips64") == 0 || strcmp (argv[i], "-mips4") == 0 || strcmp (argv[i], "-mips5") == 0) { @@ -768,14 +774,14 @@ add_keepsyms_file (filename) c = getc (file); while (c != EOF) { - while (isspace (c)) + while (ISSPACE (c)) c = getc (file); if (c != EOF) { size_t len = 0; - while (! isspace (c) && c != EOF) + while (! ISSPACE (c) && c != EOF) { buf[len] = c; ++len; diff -uprN binutils-2.11.90.0.31/ld/ldmisc.c binutils-2.11.92.0.5/ld/ldmisc.c --- binutils-2.11.90.0.31/ld/ldmisc.c Wed May 2 15:25:18 2001 +++ binutils-2.11.92.0.5/ld/ldmisc.c Mon Oct 1 15:25:25 2001 @@ -27,10 +27,8 @@ Software Foundation, 59 Temple Place - S #ifdef ANSI_PROTOTYPES #include -#define USE_STDARG 1 #else #include -#define USE_STDARG 0 #endif #include "ld.h" @@ -412,51 +410,25 @@ vfinfo (fp, fmt, arg) would hosed by LynxOS, which defines that name in its libc.) */ void -#if USE_STDARG -info_msg (const char *fmt, ...) -#else -info_msg (va_alist) - va_dcl -#endif +info_msg VPARAMS ((const char *fmt, ...)) { - va_list arg; - -#if ! USE_STDARG - const char *fmt; - - va_start (arg); - fmt = va_arg (arg, const char *); -#else - va_start (arg, fmt); -#endif + VA_OPEN (arg, fmt); + VA_FIXEDARG (arg, const char *, fmt); vfinfo (stdout, fmt, arg); - va_end (arg); + VA_CLOSE (arg); } /* ('e' for error.) Format info message and print on stderr. */ void -#if USE_STDARG -einfo (const char *fmt, ...) -#else -einfo (va_alist) - va_dcl -#endif +einfo VPARAMS ((const char *fmt, ...)) { - va_list arg; - -#if ! USE_STDARG - const char *fmt; - - va_start (arg); - fmt = va_arg (arg, const char *); -#else - va_start (arg, fmt); -#endif + VA_OPEN (arg, fmt); + VA_FIXEDARG (arg, const char *, fmt); vfinfo (stderr, fmt, arg); - va_end (arg); + VA_CLOSE (arg); } void @@ -470,50 +442,24 @@ info_assert (file, line) /* ('m' for map) Format info message and print on map. */ void -#if USE_STDARG -minfo (const char *fmt, ...) -#else -minfo (va_alist) - va_dcl -#endif +minfo VPARAMS ((const char *fmt, ...)) { - va_list arg; - -#if ! USE_STDARG - const char *fmt; - va_start (arg); - fmt = va_arg (arg, const char *); -#else - va_start (arg, fmt); -#endif + VA_OPEN (arg, fmt); + VA_FIXEDARG (arg, const char *, fmt); vfinfo (config.map_file, fmt, arg); - va_end (arg); + VA_CLOSE (arg); } void -#if USE_STDARG -lfinfo (FILE *file, const char *fmt, ...) -#else -lfinfo (va_alist) - va_dcl -#endif +lfinfo VPARAMS ((FILE *file, const char *fmt, ...)) { - va_list arg; - -#if ! USE_STDARG - FILE *file; - const char *fmt; - - va_start (arg); - file = va_arg (arg, FILE *); - fmt = va_arg (arg, const char *); -#else - va_start (arg, fmt); -#endif + VA_OPEN (arg, fmt); + VA_FIXEDARG (arg, FILE *, file); + VA_FIXEDARG (arg, const char *, fmt); vfinfo (file, fmt, arg); - va_end (arg); + VA_CLOSE (arg); } /* Functions to print the link map. */ diff -uprN binutils-2.11.90.0.31/ld/ldmisc.h binutils-2.11.92.0.5/ld/ldmisc.h --- binutils-2.11.90.0.31/ld/ldmisc.h Wed May 2 14:53:15 2001 +++ binutils-2.11.92.0.5/ld/ldmisc.h Mon Oct 1 15:25:25 2001 @@ -1,5 +1,5 @@ /* ldmisc.h - - Copyright 1991, 1992, 1993, 1994, 1996, 1997 + Copyright 1991, 1992, 1993, 1994, 1996, 1997, 2001 Free Software Foundation, Inc. This file is part of GLD, the Gnu Linker. @@ -15,28 +15,17 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with GLD; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with GLD; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. */ #ifndef LDMISC_H #define LDMISC_H -#ifdef ANSI_PROTOTYPES extern void einfo PARAMS ((const char *, ...)); extern void minfo PARAMS ((const char *, ...)); extern void info_msg PARAMS ((const char *, ...)); extern void lfinfo PARAMS ((FILE *, const char *, ...)); -#else -/* VARARGS*/ -extern void einfo (); -/* VARARGS*/ -extern void minfo (); -/* VARARGS*/ -extern void info_msg (); -/*VARARGS*/ -extern void lfinfo (); -#endif - extern void info_assert PARAMS ((const char *, unsigned int)); extern void yyerror PARAMS ((const char *)); extern PTR xmalloc PARAMS ((size_t)); diff -uprN binutils-2.11.90.0.31/ld/ldver.c binutils-2.11.92.0.5/ld/ldver.c --- binutils-2.11.90.0.31/ld/ldver.c Thu Mar 15 14:56:56 2001 +++ binutils-2.11.92.0.5/ld/ldver.c Thu Oct 4 14:35:43 2001 @@ -1,5 +1,5 @@ /* ldver.c -- Print linker version. - Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000 + Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2001 Free Software Foundation, Inc. This file is part of GLD, the Gnu Linker. @@ -30,16 +30,22 @@ Foundation, Inc., 59 Temple Place - Suit #include "ldemul.h" #include "ldmain.h" -const char *ld_program_version = VERSION; - void ldversion (noisy) int noisy; { - fprintf (stdout, _("GNU ld version %s (with BFD %s)\n"), - ld_program_version, BFD_VERSION); + /* Output for noisy == 2 is intended to follow the GNU standards. */ + fprintf (stdout, _("GNU ld version %s\n"), BFD_VERSION_STRING); + + if (noisy & 2) + { + printf (_("Copyright 2001 Free Software Foundation, Inc.\n")); + printf (_("\ +This program is free software; you may redistribute it under the terms of\n\ +the GNU General Public License. This program has absolutely no warranty.\n")); + } - if (noisy) + if (noisy & 1) { ld_emulation_xfer_type **ptr = ld_emulations; diff -uprN binutils-2.11.90.0.31/ld/ldver.h binutils-2.11.92.0.5/ld/ldver.h --- binutils-2.11.90.0.31/ld/ldver.h Thu Mar 15 14:56:56 2001 +++ binutils-2.11.92.0.5/ld/ldver.h Thu Oct 4 14:35:43 2001 @@ -17,6 +17,4 @@ You should have received a copy of the G along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -extern const char *ld_program_version; - void ldversion PARAMS ((int)); diff -uprN binutils-2.11.90.0.31/ld/lexsup.c binutils-2.11.92.0.5/ld/lexsup.c --- binutils-2.11.90.0.31/ld/lexsup.c Mon Aug 27 11:44:52 2001 +++ binutils-2.11.92.0.5/ld/lexsup.c Thu Oct 4 14:35:43 2001 @@ -25,7 +25,7 @@ Software Foundation, 59 Temple Place - S #include "libiberty.h" #include #include -#include +#include "safe-ctype.h" #include "getopt.h" #include "bfdlink.h" #include "ld.h" @@ -133,7 +133,8 @@ int parsing_defsym = 0; #define OPTION_ALLOW_SHLIB_UNDEFINED (OPTION_TARGET_HELP + 1) #define OPTION_DISCARD_NONE (OPTION_ALLOW_SHLIB_UNDEFINED + 1) #define OPTION_SPARE_DYNAMIC_TAGS (OPTION_DISCARD_NONE + 1) -#define OPTION_MULTILIB_DIR (OPTION_SPARE_DYNAMIC_TAGS + 1) +#define OPTION_NO_DEFINE_COMMON (OPTION_SPARE_DYNAMIC_TAGS + 1) +#define OPTION_MULTILIB_DIR (OPTION_NO_DEFINE_COMMON + 1) /* The long options. This structure is used for both the option parsing and the help text. */ @@ -317,6 +318,8 @@ static const struct ld_option ld_options '\0', N_("FILE"), N_("Write a map file"), ONE_DASH }, { {"multilib-dir", required_argument, NULL, OPTION_MULTILIB_DIR}, '\0', N_("PATH"), N_("Specify a target directory"), TWO_DASHES }, + { {"no-define-common", no_argument, NULL, OPTION_NO_DEFINE_COMMON}, + '\0', NULL, N_("Do not define Common storage"), TWO_DASHES }, { {"no-demangle", no_argument, NULL, OPTION_NO_DEMANGLE }, '\0', NULL, N_("Do not demangle symbol names"), TWO_DASHES }, { {"no-keep-memory", no_argument, NULL, OPTION_NO_KEEP_MEMORY}, @@ -425,7 +428,7 @@ is_num (string, min, max, err) for (; *string; ++string) { - if (! isdigit (*string)) + if (! ISDIGIT (*string)) { result = err; break; @@ -511,7 +514,7 @@ parse_args (argc, argv) for (i = 1; i < argc; i++) if (strcmp (argv[i], "-G") == 0 && (i + 1 >= argc - || ! isdigit ((unsigned char) argv[i + 1][0]))) + || ! ISDIGIT (argv[i + 1][0]))) argv[i] = (char *) "--shared"; /* Because we permit long options to start with a single dash, and @@ -749,6 +752,9 @@ parse_args (argc, argv) config.magic_demand_paged = false; config.dynamic_link = false; break; + case OPTION_NO_DEFINE_COMMON: + command_line.inhibit_common_definition = true; + break; case OPTION_NO_DEMANGLE: demangling = false; break; @@ -1002,22 +1008,7 @@ parse_args (argc, argv) version_printed = true; break; case OPTION_VERSION: - /* This output is intended to follow the GNU standards document. */ - printf ("GNU ld %s\n", ld_program_version); - printf (_("Copyright 2001 Free Software Foundation, Inc.\n")); - printf (_("\ -This program is free software; you may redistribute it under the terms of\n\ -the GNU General Public License. This program has absolutely no warranty.\n")); - { - ld_emulation_xfer_type **ptr = ld_emulations; - - printf (_(" Supported emulations:\n")); - while (*ptr) - { - printf (" %s\n", (*ptr)->emulation_name); - ptr++; - } - } + ldversion (2); xexit (0); break; case OPTION_VERSION_SCRIPT: diff -uprN binutils-2.11.90.0.31/ld/mpw-elfmips.c binutils-2.11.92.0.5/ld/mpw-elfmips.c --- binutils-2.11.90.0.31/ld/mpw-elfmips.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/ld/mpw-elfmips.c Mon Oct 1 15:25:25 2001 @@ -26,8 +26,7 @@ Foundation, Inc., 59 Temple Place - Suit #include "bfd.h" #include "sysdep.h" - -#include +#include "safe-ctype.h" #include "bfdlink.h" @@ -667,7 +666,7 @@ gldelf32ebmip_place_orphan (file, s) /* If the name of the section is representable in C, then create symbols to mark the start and the end of the section. */ for (ps = secname; *ps != '\0'; ps++) - if (! isalnum (*ps) && *ps != '_') + if (! ISALNUM (*ps) && *ps != '_') break; if (*ps == '\0' && config.build_constructors) { diff -uprN binutils-2.11.90.0.31/ld/mpw-eppcmac.c binutils-2.11.92.0.5/ld/mpw-eppcmac.c --- binutils-2.11.90.0.31/ld/mpw-eppcmac.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/ld/mpw-eppcmac.c Mon Oct 1 15:25:25 2001 @@ -1,7 +1,7 @@ /* This file is is generated by a shell script. DO NOT EDIT! */ /* AIX emulation code for ppcmacos - Copyright 1991, 1993, 1995, 1996, 1997, 2000 + Copyright 1991, 1993, 1995, 1996, 1997, 2000, 2001 Free Software Foundation, Inc. Written by Steve Chamberlain AIX support by Ian Lance Taylor @@ -27,11 +27,10 @@ Foundation, Inc., 59 Temple Place - Suit #include "bfd.h" #include "sysdep.h" #include "libiberty.h" +#include "safe-ctype.h" #include "getopt.h" #include "bfdlink.h" -#include - #include "ld.h" #include "ldmain.h" #include "ldmisc.h" @@ -708,7 +707,7 @@ gldppcmacos_read_file (filename, import) ++lineno; s = (char *) obstack_base (o); - while (isspace ((unsigned char) *s)) + while (ISSPACE (*s)) ++s; if (*s == '\0' || *s == '*' @@ -722,7 +721,7 @@ gldppcmacos_read_file (filename, import) if (*s == '#' && s[1] == '!') { s += 2; - while (isspace ((unsigned char) *s)) + while (ISSPACE (*s)) ++s; if (*s == '\0') { @@ -743,7 +742,7 @@ gldppcmacos_read_file (filename, import) keep = true; imppath = s; file = NULL; - while (! isspace ((unsigned char) *s) && *s != '(' && *s != '\0') + while (! ISSPACE (*s) && *s != '(' && *s != '\0') { if (*s == '/') file = s + 1; @@ -763,7 +762,7 @@ gldppcmacos_read_file (filename, import) } cs = *s; *s = '\0'; - while (isspace ((unsigned char) cs)) + while (ISSPACE (cs)) { ++s; cs = *s; @@ -797,7 +796,7 @@ gldppcmacos_read_file (filename, import) syscall = false; address = (bfd_vma) -1; - while (! isspace ((unsigned char) *s) && *s != '\0') + while (! ISSPACE (*s) && *s != '\0') ++s; if (*s != '\0') { @@ -805,16 +804,16 @@ gldppcmacos_read_file (filename, import) *s++ = '\0'; - while (isspace ((unsigned char) *s)) + while (ISSPACE (*s)) ++s; se = s; - while (! isspace ((unsigned char) *se) && *se != '\0') + while (! ISSPACE (*se) && *se != '\0') ++se; if (*se != '\0') { *se++ = '\0'; - while (isspace ((unsigned char) *se)) + while (ISSPACE (*se)) ++se; if (*se != '\0') einfo (_("%s%d: warning: syntax error in import/export file\n"), diff -uprN binutils-2.11.90.0.31/ld/pe-dll.c binutils-2.11.92.0.5/ld/pe-dll.c --- binutils-2.11.90.0.31/ld/pe-dll.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/ld/pe-dll.c Mon Oct 1 15:25:25 2001 @@ -23,9 +23,9 @@ #include "sysdep.h" #include "bfdlink.h" #include "libiberty.h" +#include "safe-ctype.h" #include -#include #include "ld.h" #include "ldexp.h" @@ -41,101 +41,91 @@ #include "deffile.h" #include "pe-dll.h" -/************************************************************************ +/* This file turns a regular Windows PE image into a DLL. Because of + the complexity of this operation, it has been broken down into a + number of separate modules which are all called by the main function + at the end of this file. This function is not re-entrant and is + normally only called once, so static variables are used to reduce + the number of parameters and return values required. + + See also: ld/emultempl/pe.em. */ + +/* Auto-import feature by Paul Sokolovsky + + Quick facts: + + 1. With this feature on, DLL clients can import variables from DLL + without any concern from their side (for example, without any source + code modifications). + + 2. This is done completely in bounds of the PE specification (to be fair, + there's a place where it pokes nose out of, but in practise it works). + So, resulting module can be used with any other PE compiler/linker. + + 3. Auto-import is fully compatible with standard import method and they + can be mixed together. + + 4. Overheads: space: 8 bytes per imported symbol, plus 20 for each + reference to it; load time: negligible; virtual/physical memory: should be + less than effect of DLL relocation, and I sincerely hope it doesn't affect + DLL sharability (too much). + + Idea + + The obvious and only way to get rid of dllimport insanity is to make client + access variable directly in the DLL, bypassing extra dereference. I.e., + whenever client contains someting like + + mov dll_var,%eax, + + address of dll_var in the command should be relocated to point into loaded + DLL. The aim is to make OS loader do so, and than make ld help with that. + Import section of PE made following way: there's a vector of structures + each describing imports from particular DLL. Each such structure points + to two other parellel vectors: one holding imported names, and one which + will hold address of corresponding imported name. So, the solution is + de-vectorize these structures, making import locations be sparse and + pointing directly into code. Before continuing, it is worth a note that, + while authors strives to make PE act ELF-like, there're some other people + make ELF act PE-like: elfvector, ;-) . + + Implementation + + For each reference of data symbol to be imported from DLL (to set of which + belong symbols with name , if __imp_ is found in implib), the + import fixup entry is generated. That entry is of type + IMAGE_IMPORT_DESCRIPTOR and stored in .idata$3 subsection. Each + fixup entry contains pointer to symbol's address within .text section + (marked with __fuN_ symbol, where N is integer), pointer to DLL name + (so, DLL name is referenced by multiple entries), and pointer to symbol + name thunk. Symbol name thunk is singleton vector (__nm_th_) + pointing to IMAGE_IMPORT_BY_NAME structure (__nm_) directly + containing imported name. Here comes that "om the edge" problem mentioned + above: PE specification rambles that name vector (OriginalFirstThunk) + should run in parallel with addresses vector (FirstThunk), i.e. that they + should have same number of elements and terminated with zero. We violate + this, since FirstThunk points directly into machine code. But in practise, + OS loader implemented the sane way: it goes thru OriginalFirstThunk and + puts addresses to FirstThunk, not something else. It once again should be + noted that dll and symbol name structures are reused across fixup entries + and should be there anyway to support standard import stuff, so sustained + overhead is 20 bytes per reference. Other question is whether having several + IMAGE_IMPORT_DESCRIPTORS for the same DLL is possible. Answer is yes, it is + done even by native compiler/linker (libth32's functions are in fact reside + in windows9x kernel32.dll, so if you use it, you have two + IMAGE_IMPORT_DESCRIPTORS for kernel32.dll). Yet other question is whether + referencing the same PE structures several times is valid. The answer is why + not, prohibitting that (detecting violation) would require more work on + behalf of loader than not doing it. - This file turns a regular Windows PE image into a DLL. Because of - the complexity of this operation, it has been broken down into a - number of separate modules which are all called by the main function - at the end of this file. This function is not re-entrant and is - normally only called once, so static variables are used to reduce - the number of parameters and return values required. - - See also: ld/emultempl/pe.em - - ************************************************************************/ - -/************************************************************************ - - Auto-import feature by Paul Sokolovsky - - Quick facts: - - 1. With this feature on, DLL clients can import variables from DLL - without any concern from their side (for example, without any source - code modifications). - - 2. This is done completely in bounds of the PE specification (to be fair, - there's a place where it pokes nose out of, but in practise it works). - So, resulting module can be used with any other PE compiler/linker. - - 3. Auto-import is fully compatible with standard import method and they - can be mixed together. - - 4. Overheads: space: 8 bytes per imported symbol, plus 20 for each - reference to it; load time: negligible; virtual/physical memory: should be - less than effect of DLL relocation, and I sincerely hope it doesn't affect - DLL sharability (too much). - - Idea - - The obvious and only way to get rid of dllimport insanity is to make client - access variable directly in the DLL, bypassing extra dereference. I.e., - whenever client contains someting like - - mov dll_var,%eax, - - address of dll_var in the command should be relocated to point into loaded - DLL. The aim is to make OS loader do so, and than make ld help with that. - Import section of PE made following way: there's a vector of structures - each describing imports from particular DLL. Each such structure points - to two other parellel vectors: one holding imported names, and one which - will hold address of corresponding imported name. So, the solution is - de-vectorize these structures, making import locations be sparse and - pointing directly into code. Before continuing, it is worth a note that, - while authors strives to make PE act ELF-like, there're some other people - make ELF act PE-like: elfvector, ;-) . - - Implementation - - For each reference of data symbol to be imported from DLL (to set of which - belong symbols with name , if __imp_ is found in implib), the - import fixup entry is generated. That entry is of type - IMAGE_IMPORT_DESCRIPTOR and stored in .idata$3 subsection. Each - fixup entry contains pointer to symbol's address within .text section - (marked with __fuN_ symbol, where N is integer), pointer to DLL name - (so, DLL name is referenced by multiple entries), and pointer to symbol - name thunk. Symbol name thunk is singleton vector (__nm_th_) - pointing to IMAGE_IMPORT_BY_NAME structure (__nm_) directly - containing imported name. Here comes that "om the edge" problem mentioned - above: PE specification rambles that name vector (OriginalFirstThunk) - should run in parallel with addresses vector (FirstThunk), i.e. that they - should have same number of elements and terminated with zero. We violate - this, since FirstThunk points directly into machine code. But in practise, - OS loader implemented the sane way: it goes thru OriginalFirstThunk and - puts addresses to FirstThunk, not something else. It once again should be - noted that dll and symbol name structures are reused across fixup entries - and should be there anyway to support standard import stuff, so sustained - overhead is 20 bytes per reference. Other question is whether having several - IMAGE_IMPORT_DESCRIPTORS for the same DLL is possible. Answer is yes, it is - done even by native compiler/linker (libth32's functions are in fact reside - in windows9x kernel32.dll, so if you use it, you have two - IMAGE_IMPORT_DESCRIPTORS for kernel32.dll). Yet other question is whether - referencing the same PE structures several times is valid. The answer is why - not, prohibitting that (detecting violation) would require more work on - behalf of loader than not doing it. - - - See also: ld/emultempl/pe.em - - ************************************************************************/ + See also: ld/emultempl/pe.em. */ static void -add_bfd_to_link (bfd *abfd, CONST char *name, - struct bfd_link_info *link_info); +add_bfd_to_link PARAMS ((bfd *, const char *, struct bfd_link_info *)); -/* for emultempl/pe.em */ +/* For emultempl/pe.em. */ -def_file *pe_def_file = 0; +def_file * pe_def_file = 0; int pe_dll_export_everything = 0; int pe_dll_do_default_excludes = 1; int pe_dll_kill_ats = 0; @@ -144,39 +134,40 @@ int pe_dll_warn_dup_exports = 0; int pe_dll_compat_implib = 0; int pe_dll_extra_pe_debug = 0; -/************************************************************************ - - static variables and types - - ************************************************************************/ +/* Static variables and types. */ static bfd_vma image_base; - static bfd *filler_bfd; static struct sec *edata_s, *reloc_s; static unsigned char *edata_d, *reloc_d; static size_t edata_sz, reloc_sz; -typedef struct { - char *target_name; - char *object_target; - unsigned int imagebase_reloc; - int pe_arch; - int bfd_arch; - int underscored; -} pe_details_type; +typedef struct + { + char *target_name; + char *object_target; + unsigned int imagebase_reloc; + int pe_arch; + int bfd_arch; + int underscored; + } +pe_details_type; -typedef struct { - char *name; - int len; -} autofilter_entry_type; +typedef struct + { + char *name; + int len; + } +autofilter_entry_type; #define PE_ARCH_i386 1 #define PE_ARCH_sh 2 #define PE_ARCH_mips 3 #define PE_ARCH_arm 4 +#define PE_ARCH_arm_epoc 5 -static pe_details_type pe_detail_list[] = { +static pe_details_type pe_detail_list[] = +{ { "pei-i386", "pe-i386", @@ -209,12 +200,21 @@ static pe_details_type pe_detail_list[] bfd_arch_arm, 0 }, + { + "epoc-pei-arm-little", + "epoc-pe-arm-little", + 11 /* ARM_RVA32 */, + PE_ARCH_arm_epoc, + bfd_arch_arm, + 0 + }, { NULL, NULL, 0, 0, 0, 0 } }; static pe_details_type *pe_details; -static autofilter_entry_type autofilter_symbollist[] = { +static autofilter_entry_type autofilter_symbollist[] = +{ { "DllMain@12", 10 }, { "DllEntryPoint@0", 15 }, { "DllMainCRTStartup@12", 20 }, @@ -224,25 +224,32 @@ static autofilter_entry_type autofilter_ { "impure_ptr", 10 }, { NULL, 0 } }; -/* Do not specify library suffix explicitly, to allow for dllized versions */ -static autofilter_entry_type autofilter_liblist[] = { + +/* Do not specify library suffix explicitly, to allow for dllized versions. */ +static autofilter_entry_type autofilter_liblist[] = +{ { "libgcc.", 7 }, { "libstdc++.", 10 }, { "libmingw32.", 11 }, { NULL, 0 } }; -static autofilter_entry_type autofilter_objlist[] = { + +static autofilter_entry_type autofilter_objlist[] = +{ { "crt0.o", 6 }, { "crt1.o", 6 }, { "crt2.o", 6 }, { NULL, 0 } }; -static autofilter_entry_type autofilter_symbolprefixlist[] = { -/* { "__imp_", 6 }, */ -/* Do __imp_ explicitly to save time */ + +static autofilter_entry_type autofilter_symbolprefixlist[] = +{ + /* { "__imp_", 6 }, */ + /* Do __imp_ explicitly to save time. */ { "__rtti_", 7 }, { "__builtin_", 10 }, - { "_head_", 6 }, /* don't export symbols specifying internal DLL layout */ + /* Don't export symbols specifying internal DLL layout. */ + { "_head_", 6 }, { "_fmode", 6 }, { "_impure_ptr", 11 }, { "cygwin_attach_dll", 17 }, @@ -253,7 +260,9 @@ static autofilter_entry_type autofilter_ { "environ", 7 }, { NULL, 0 } }; -static autofilter_entry_type autofilter_symbolsuffixlist[] = { + +static autofilter_entry_type autofilter_symbolsuffixlist[] = +{ { "_iname", 6 }, { NULL, 0 } }; @@ -272,14 +281,16 @@ static void generate_reloc PARAMS ((bfd static void quoteput PARAMS ((char *, FILE *, int)); static asection *quick_section PARAMS ((bfd *, const char *, int, int)); static void quick_symbol - PARAMS ((bfd *, char *, char *, char *, asection *, int, int)); + PARAMS ((bfd *, const char *, const char *, const char *, + asection *, int, int)); static void quick_reloc PARAMS ((bfd *, int, int, int)); static bfd *make_head PARAMS ((bfd *)); static bfd *make_tail PARAMS ((bfd *)); static bfd *make_one PARAMS ((def_file_export *, bfd *)); -static bfd *make_singleton_name_thunk PARAMS ((char *, bfd *)); +static bfd *make_singleton_name_thunk PARAMS ((const char *, bfd *)); static char *make_import_fixup_mark PARAMS ((arelent *)); -static bfd *make_import_fixup_entry PARAMS ((char *, char *, char *, bfd *)); +static bfd *make_import_fixup_entry + PARAMS ((const char *, const char *, const char *, bfd *)); static unsigned int pe_get16 PARAMS ((bfd *, int)); static unsigned int pe_get32 PARAMS ((bfd *, int)); static unsigned int pe_as32 PARAMS ((void *)); @@ -289,6 +300,7 @@ pe_dll_id_target (target) const char *target; { int i; + for (i = 0; pe_detail_list[i].target_name; i++) if (strcmp (pe_detail_list[i].target_name, target) == 0 || strcmp (pe_detail_list[i].object_target, target) == 0) @@ -300,18 +312,16 @@ pe_dll_id_target (target) exit (1); } -/************************************************************************ - - Helper functions for qsort. Relocs must be sorted so that we can write - them out by pages. +/* Helper functions for qsort. Relocs must be sorted so that we can write + them out by pages. */ - ************************************************************************/ - -typedef struct { - bfd_vma vma; - char type; - short extra; -} reloc_data_type; +typedef struct + { + bfd_vma vma; + char type; + short extra; + } +reloc_data_type; static int reloc_sort (va, vb) @@ -319,6 +329,7 @@ reloc_sort (va, vb) { bfd_vma a = ((reloc_data_type *) va)->vma; bfd_vma b = ((reloc_data_type *) vb)->vma; + return (a > b) ? 1 : ((a < b) ? -1 : 0); } @@ -328,14 +339,11 @@ pe_export_sort (va, vb) { def_file_export *a = (def_file_export *) va; def_file_export *b = (def_file_export *) vb; + return strcmp (a->name, b->name); } -/************************************************************************ - - Read and process the .DEF file - - ************************************************************************/ +/* Read and process the .DEF file. */ /* These correspond to the entries in pe_def_file->exports[]. I use exported_symbol_sections[i] to tag whether or not the symbol was @@ -343,7 +351,6 @@ pe_export_sort (va, vb) static bfd_vma *exported_symbol_offsets; static struct sec **exported_symbol_sections; - static int export_table_size; static int count_exported; static int count_exported_byname; @@ -352,10 +359,12 @@ static const char *dll_name; static int min_ordinal, max_ordinal; static int *exported_symbols; -typedef struct exclude_list_struct { - char *string; - struct exclude_list_struct *next; -} exclude_list_struct; +typedef struct exclude_list_struct + { + char *string; + struct exclude_list_struct *next; + } +exclude_list_struct; static struct exclude_list_struct *excludes = 0; @@ -384,10 +393,9 @@ pe_dll_add_excludes (new_excludes) free (local_copy); } -/* - abfd is a bfd containing n (or NULL) - It can be used for contextual checks. -*/ +/* abfd is a bfd containing n (or NULL) + It can be used for contextual checks. */ + static int auto_export (abfd, d, n) bfd *abfd; @@ -398,26 +406,29 @@ auto_export (abfd, d, n) struct exclude_list_struct *ex; autofilter_entry_type *afptr; - /* we should not re-export imported stuff */ + /* We should not re-export imported stuff. */ if (strncmp (n, "_imp__", 6) == 0) return 0; for (i = 0; i < d->num_exports; i++) if (strcmp (d->exports[i].name, n) == 0) return 0; + if (pe_dll_do_default_excludes) { + char * p; + int len; + if (pe_dll_extra_pe_debug) - { - printf ("considering exporting: %s, abfd=%p, abfd->my_arc=%p\n", - n, abfd, abfd->my_archive); - } + printf ("considering exporting: %s, abfd=%p, abfd->my_arc=%p\n", + n, abfd, abfd->my_archive); /* First of all, make context checks: - Don't export anything from libgcc */ + Don't export anything from libgcc. */ if (abfd && abfd->my_archive) { afptr = autofilter_liblist; + while (afptr->name) { if (strstr (abfd->my_archive->filename, afptr->name)) @@ -426,60 +437,62 @@ auto_export (abfd, d, n) } } - /* Next, exclude symbols from certain startup objects */ - { - char *p; - afptr = autofilter_objlist; - while (afptr->name) - { - if (abfd && - (p = strstr (abfd->filename, afptr->name)) && - (*(p + afptr->len - 1) == 0)) - return 0; - afptr++; - } - } + /* Next, exclude symbols from certain startup objects. */ + afptr = autofilter_objlist; + + while (afptr->name) + { + if (abfd && + (p = strstr (abfd->filename, afptr->name)) && + (*(p + afptr->len - 1) == 0)) + return 0; + + afptr ++; + } /* Don't try to blindly exclude all symbols that begin with '__'; this was tried and - it is too restrictive */ + it is too restrictive. */ - /* Then, exclude specific symbols */ + /* Then, exclude specific symbols. */ afptr = autofilter_symbollist; while (afptr->name) { if (strcmp (n, afptr->name) == 0) return 0; - afptr++; + + afptr ++; } - /* Next, exclude symbols starting with ... */ + /* Next, exclude symbols starting with ... */ afptr = autofilter_symbolprefixlist; while (afptr->name) { if (strncmp (n, afptr->name, afptr->len) == 0) return 0; - afptr++; + + afptr ++; } - /* Finally, exclude symbols ending with ... */ - { - int len = strlen(n); - afptr = autofilter_symbolsuffixlist; - while (afptr->name) - { - if ((len >= afptr->len) && - /* add 1 to insure match with trailing '\0' */ - strncmp (n + len - afptr->len, afptr->name, - afptr->len + 1) == 0) - return 0; - afptr++; - } - } + /* Finally, exclude symbols ending with ... */ + len = strlen (n); + afptr = autofilter_symbolsuffixlist; + while (afptr->name) + { + if ((len >= afptr->len) && + /* Add 1 to insure match with trailing '\0'. */ + strncmp (n + len - afptr->len, afptr->name, + afptr->len + 1) == 0) + return 0; + + afptr ++; + } } + for (ex = excludes; ex; ex = ex->next) if (strcmp (n, ex->string) == 0) return 0; + return 1; } @@ -499,7 +512,6 @@ process_def_file (abfd, info) /* First, run around to all the objects looking for the .drectve sections, and push those into the def file too. */ - for (b = info->input_bfds; b; b = b->link_next) { s = bfd_get_section_by_name (b, ".drectve"); @@ -507,6 +519,7 @@ process_def_file (abfd, info) { int size = bfd_get_section_size_before_reloc (s); char *buf = xmalloc (size); + bfd_get_section_contents (b, s, buf, 0, size); def_file_add_directive (pe_def_file, buf, size); free (buf); @@ -514,7 +527,6 @@ process_def_file (abfd, info) } /* Now, maybe export everything else the default way. */ - if (pe_dll_export_everything || pe_def_file->num_exports == 0) { for (b = info->input_bfds; b; b = b->link_next) @@ -530,18 +542,18 @@ process_def_file (abfd, info) { /* We should export symbols which are either global or not anything at all. (.bss data is the latter) - We should not export undefined symbols - */ + We should not export undefined symbols. */ if (symbols[j]->section != &bfd_und_section && ((symbols[j]->flags & BSF_GLOBAL) || (symbols[j]->flags == BFD_FORT_COMM_DEFAULT_VALUE))) { const char *sn = symbols[j]->name; - /* we should not re-export imported stuff */ + /* We should not re-export imported stuff. */ { char *name = (char *) xmalloc (strlen (sn) + 2 + 6); sprintf (name, "%s%s", U("_imp_"), sn); + blhe = bfd_link_hash_lookup (info->hash, name, false, false, false); free (name); @@ -552,11 +564,12 @@ process_def_file (abfd, info) if (*sn == '_') sn++; + if (auto_export (b, pe_def_file, sn)) { def_file_export *p; p=def_file_add_export (pe_def_file, sn, 0, -1); - /* Fill data flag properly, from dlltool.c */ + /* Fill data flag properly, from dlltool.c. */ p->flag_data = !(symbols[j]->flags & BSF_FUNCTION); } } @@ -568,7 +581,6 @@ process_def_file (abfd, info) #define NE pe_def_file->num_exports /* Canonicalize the export list. */ - if (pe_dll_kill_ats) { for (i = 0; i < NE; i++) @@ -579,6 +591,7 @@ process_def_file (abfd, info) pointing to the same memory as name, or might not have. */ char *tmp = xstrdup (pe_def_file->exports[i].name); + *(strchr (tmp, '@')) = 0; pe_def_file->exports[i].name = tmp; } @@ -592,6 +605,7 @@ process_def_file (abfd, info) if (strchr (pe_def_file->exports[i].name, '@')) { char *tmp = xstrdup (pe_def_file->exports[i].name); + *(strchr (tmp, '@')) = 0; if (auto_export (NULL, pe_def_file, tmp)) def_file_add_export (pe_def_file, tmp, @@ -638,6 +652,7 @@ process_def_file (abfd, info) einfo (_("Warning, duplicate EXPORT: %s\n"), e[j - 1].name); } + if (e[i].ordinal != -1) e[j - 1].ordinal = e[i].ordinal; e[j - 1].flag_private |= e[i].flag_private; @@ -657,6 +672,7 @@ process_def_file (abfd, info) for (i = 0; i < NE; i++) { char *name = (char *) xmalloc (strlen (pe_def_file->exports[i].internal_name) + 2); + if (pe_details->underscored) { *name = '_'; @@ -717,11 +733,7 @@ process_def_file (abfd, info) } } -/************************************************************************ - - Build the bfd that will contain .edata and .reloc sections - - ************************************************************************/ +/* Build the bfd that will contain .edata and .reloc sections. */ static void build_filler_bfd (include_edata) @@ -770,16 +782,13 @@ build_filler_bfd (include_edata) einfo ("%X%P: can not create .reloc section: %E\n"); return; } + bfd_set_section_size (filler_bfd, reloc_s, 0); ldlang_add_file (filler_file); } -/************************************************************************ - - Gather all the exported symbols and build the .edata section - - ************************************************************************/ +/* Gather all the exported symbols and build the .edata section. */ static void generate_edata (abfd, info) @@ -792,19 +801,15 @@ generate_edata (abfd, info) /* First, we need to know how many exported symbols there are, and what the range of ordinals is. */ - if (pe_def_file->name) - { - dll_name = pe_def_file->name; - } + dll_name = pe_def_file->name; else { dll_name = abfd->filename; + for (dlnp = dll_name; *dlnp; dlnp++) - { - if (*dlnp == '\\' || *dlnp == '/' || *dlnp == ':') - dll_name = dlnp + 1; - } + if (*dlnp == '\\' || *dlnp == '/' || *dlnp == ':') + dll_name = dlnp + 1; } if (count_with_ordinals && max_ordinal > count_exported) @@ -817,8 +822,8 @@ generate_edata (abfd, info) min_ordinal = 1; max_ordinal = count_exported; } - export_table_size = max_ordinal - min_ordinal + 1; + export_table_size = max_ordinal - min_ordinal + 1; exported_symbols = (int *) xmalloc (export_table_size * sizeof (int)); for (i = 0; i < export_table_size; i++) exported_symbols[i] = -1; @@ -832,6 +837,7 @@ generate_edata (abfd, info) { int ei = pe_def_file->exports[i].ordinal - min_ordinal; int pi = exported_symbols[ei]; + if (pi != -1) { /* xgettext:c-format */ @@ -852,15 +858,15 @@ generate_edata (abfd, info) if (pe_def_file->exports[i].ordinal == -1) { while (exported_symbols[next_ordinal - min_ordinal] != -1) - next_ordinal++; + next_ordinal ++; + exported_symbols[next_ordinal - min_ordinal] = i; pe_def_file->exports[i].ordinal = next_ordinal; } /* OK, now we can allocate some memory. */ - - edata_sz = (40 /* directory */ - + 4 * export_table_size /* addresses */ + edata_sz = (40 /* directory */ + + 4 * export_table_size /* addresses */ + 4 * count_exported_byname /* name ptrs */ + 2 * count_exported_byname /* ordinals */ + name_table_size + strlen (dll_name) + 1); @@ -880,6 +886,7 @@ fill_exported_offsets (abfd, info) for (i = 0; i < pe_def_file->num_exports; i++) { char *name = (char *) xmalloc (strlen (pe_def_file->exports[i].internal_name) + 2); + if (pe_details->underscored) { *name = '_'; @@ -893,9 +900,8 @@ fill_exported_offsets (abfd, info) false, false, true); if (blhe && (blhe->type == bfd_link_hash_defined)) - { - exported_symbol_offsets[i] = blhe->u.def.value; - } + exported_symbol_offsets[i] = blhe->u.def.value; + free (name); } } @@ -933,6 +939,7 @@ fill_edata (abfd, info) bfd_put_16 (abfd, pe_def_file->version_major, edata_d + 8); bfd_put_16 (abfd, pe_def_file->version_minor, edata_d + 10); } + bfd_put_32 (abfd, ERVA (enamestr), edata_d + 12); strcpy (enamestr, dll_name); enamestr += strlen (enamestr) + 1; @@ -950,6 +957,7 @@ fill_edata (abfd, info) for (i = 0; i < export_table_size; i++) { int s = exported_symbols[i]; + if (s != -1) { struct sec *ssec = exported_symbol_sections[s]; @@ -960,6 +968,7 @@ fill_edata (abfd, info) bfd_put_32 (abfd, srva - image_base, (void *) (eaddresses + ord - min_ordinal)); + if (!pe_def_file->exports[s].flag_noname) { char *ename = pe_def_file->exports[s].name; @@ -981,33 +990,33 @@ static struct sec *current_sec; void pe_walk_relocs_of_symbol (info, name, cb) struct bfd_link_info *info; - CONST char *name; - int (*cb) (arelent *); + const char *name; + int (*cb) (arelent *, asection *); { bfd *b; - struct sec *s; + asection *s; for (b = info->input_bfds; b; b = b->link_next) { - arelent **relocs; - int relsize, nrelocs, i; + asymbol **symbols; + int nsyms, symsize; + + symsize = bfd_get_symtab_upper_bound (b); + symbols = (asymbol **) xmalloc (symsize); + nsyms = bfd_canonicalize_symtab (b, symbols); for (s = b->sections; s; s = s->next) { - asymbol **symbols; - int nsyms, symsize; + arelent **relocs; + int relsize, nrelocs, i; int flags = bfd_get_section_flags (b, s); - /* Skip discarded linkonce sections */ + /* Skip discarded linkonce sections. */ if (flags & SEC_LINK_ONCE && s->output_section == bfd_abs_section_ptr) continue; - current_sec=s; - - symsize = bfd_get_symtab_upper_bound (b); - symbols = (asymbol **) xmalloc (symsize); - nsyms = bfd_canonicalize_symtab (b, symbols); + current_sec = s; relsize = bfd_get_reloc_upper_bound (b, s); relocs = (arelent **) xmalloc ((size_t) relsize); @@ -1016,9 +1025,13 @@ pe_walk_relocs_of_symbol (info, name, cb for (i = 0; i < nrelocs; i++) { struct symbol_cache_entry *sym = *relocs[i]->sym_ptr_ptr; - if (!strcmp(name,sym->name)) cb(relocs[i]); + + if (!strcmp (name, sym->name)) + cb (relocs[i], s); } + free (relocs); + /* Warning: the allocated symbols are remembered in BFD and reused later, so don't free them! */ /* free (symbols); */ @@ -1026,11 +1039,7 @@ pe_walk_relocs_of_symbol (info, name, cb } } -/************************************************************************ - - Gather all the relocations and build the .reloc section - - ************************************************************************/ +/* Gather all the relocations and build the .reloc section. */ static void generate_reloc (abfd, info) @@ -1107,6 +1116,7 @@ generate_reloc (abfd, info) { bfd_vma sym_vma; struct symbol_cache_entry *sym = *relocs[i]->sym_ptr_ptr; + sym_vma = (relocs[i]->addend + sym->value + sym->section->vma @@ -1160,7 +1170,6 @@ generate_reloc (abfd, info) /* At this point, we have total_relocs relocation addresses in reloc_addresses, which are all suitable for the .reloc section. We must now create the new sections. */ - qsort (reloc_data, total_relocs, sizeof (*reloc_data), reloc_sort); for (i = 0; i < total_relocs; i++) @@ -1169,7 +1178,7 @@ generate_reloc (abfd, info) if (this_page != sec_page) { - reloc_sz = (reloc_sz + 3) & ~3; /* 4-byte align */ + reloc_sz = (reloc_sz + 3) & ~3; /* 4-byte align. */ reloc_sz += 8; sec_page = this_page; } @@ -1179,54 +1188,59 @@ generate_reloc (abfd, info) if (reloc_data[i].type == 4) reloc_sz += 2; } - reloc_sz = (reloc_sz + 3) & ~3; /* 4-byte align */ - + + reloc_sz = (reloc_sz + 3) & ~3; /* 4-byte align. */ reloc_d = (unsigned char *) xmalloc (reloc_sz); - sec_page = (unsigned long) (-1); reloc_sz = 0; page_ptr = (unsigned long) (-1); page_count = 0; + for (i = 0; i < total_relocs; i++) { unsigned long rva = reloc_data[i].vma - image_base; unsigned long this_page = (rva & ~0xfff); + if (this_page != sec_page) { while (reloc_sz & 3) reloc_d[reloc_sz++] = 0; + if (page_ptr != (unsigned long) (-1)) bfd_put_32 (abfd, reloc_sz - page_ptr, reloc_d + page_ptr + 4); + bfd_put_32 (abfd, this_page, reloc_d + reloc_sz); page_ptr = reloc_sz; reloc_sz += 8; sec_page = this_page; page_count = 0; } + bfd_put_16 (abfd, (rva & 0xfff) + (reloc_data[i].type << 12), reloc_d + reloc_sz); reloc_sz += 2; + if (reloc_data[i].type == 4) { bfd_put_16 (abfd, reloc_data[i].extra, reloc_d + reloc_sz); reloc_sz += 2; } + page_count++; } + while (reloc_sz & 3) reloc_d[reloc_sz++] = 0; + if (page_ptr != (unsigned long) (-1)) bfd_put_32 (abfd, reloc_sz - page_ptr, reloc_d + page_ptr + 4); + while (reloc_sz < reloc_s->_raw_size) reloc_d[reloc_sz++] = 0; } -/************************************************************************ - - Given the exiting def_file structure, print out a .DEF file that - corresponds to it. - - ************************************************************************/ +/* Given the exiting def_file structure, print out a .DEF file that + corresponds to it. */ static void quoteput (s, f, needs_quotes) @@ -1235,24 +1249,29 @@ quoteput (s, f, needs_quotes) int needs_quotes; { char *cp; + for (cp = s; *cp; cp++) if (*cp == '\'' || *cp == '"' || *cp == '\\' - || isspace ((unsigned char) *cp) + || ISSPACE (*cp) || *cp == ',' || *cp == ';') needs_quotes = 1; + if (needs_quotes) { putc ('"', f); + while (*s) { if (*s == '"' || *s == '\\') putc ('\\', f); + putc (*s, f); s++; } + putc ('"', f); } else @@ -1265,12 +1284,11 @@ pe_dll_generate_def_file (pe_out_def_fil { int i; FILE *out = fopen (pe_out_def_filename, "w"); + if (out == NULL) - { - /* xgettext:c-format */ - einfo (_("%s: Can't open output def file %s\n"), - program_name, pe_out_def_filename); - } + /* xgettext:c-format */ + einfo (_("%s: Can't open output def file %s\n"), + program_name, pe_out_def_filename); if (pe_def_file) { @@ -1280,7 +1298,9 @@ pe_dll_generate_def_file (pe_out_def_fil fprintf (out, "LIBRARY "); else fprintf (out, "NAME "); + quoteput (pe_def_file->name, out, 1); + if (pe_data (output_bfd)->pe_opthdr.ImageBase) fprintf (out, " BASE=0x%lx", (unsigned long) pe_data (output_bfd)->pe_opthdr.ImageBase); @@ -1308,6 +1328,7 @@ pe_dll_generate_def_file (pe_out_def_fil pe_def_file->stack_reserve, pe_def_file->stack_commit); else if (pe_def_file->stack_reserve != -1) fprintf (out, "STACKSIZE 0x%x\n", pe_def_file->stack_reserve); + if (pe_def_file->heap_commit != -1) fprintf (out, "HEAPSIZE 0x%x,0x%x\n", pe_def_file->heap_reserve, pe_def_file->heap_commit); @@ -1317,23 +1338,30 @@ pe_dll_generate_def_file (pe_out_def_fil if (pe_def_file->num_section_defs > 0) { fprintf (out, "\nSECTIONS\n\n"); + for (i = 0; i < pe_def_file->num_section_defs; i++) { fprintf (out, " "); quoteput (pe_def_file->section_defs[i].name, out, 0); + if (pe_def_file->section_defs[i].class) { fprintf (out, " CLASS "); quoteput (pe_def_file->section_defs[i].class, out, 0); } + if (pe_def_file->section_defs[i].flag_read) fprintf (out, " READ"); + if (pe_def_file->section_defs[i].flag_write) fprintf (out, " WRITE"); + if (pe_def_file->section_defs[i].flag_execute) fprintf (out, " EXECUTE"); + if (pe_def_file->section_defs[i].flag_shared) fprintf (out, " SHARED"); + fprintf (out, "\n"); } } @@ -1341,24 +1369,31 @@ pe_dll_generate_def_file (pe_out_def_fil if (pe_def_file->num_exports > 0) { fprintf (out, "EXPORTS\n"); + for (i = 0; i < pe_def_file->num_exports; i++) { def_file_export *e = pe_def_file->exports + i; fprintf (out, " "); quoteput (e->name, out, 0); + if (e->internal_name && strcmp (e->internal_name, e->name)) { fprintf (out, " = "); quoteput (e->internal_name, out, 0); } + if (e->ordinal != -1) fprintf (out, " @%d", e->ordinal); + if (e->flag_private) fprintf (out, " PRIVATE"); + if (e->flag_constant) fprintf (out, " CONSTANT"); + if (e->flag_noname) fprintf (out, " NONAME"); + if (e->flag_data) fprintf (out, " DATA"); @@ -1369,22 +1404,27 @@ pe_dll_generate_def_file (pe_out_def_fil if (pe_def_file->num_imports > 0) { fprintf (out, "\nIMPORTS\n\n"); + for (i = 0; i < pe_def_file->num_imports; i++) { def_file_import *im = pe_def_file->imports + i; fprintf (out, " "); + if (im->internal_name && (!im->name || strcmp (im->internal_name, im->name))) { quoteput (im->internal_name, out, 0); fprintf (out, " = "); } + quoteput (im->module->name, out, 0); fprintf (out, "."); + if (im->name) quoteput (im->name, out, 0); else fprintf (out, "%d", im->ordinal); + fprintf (out, "\n"); } } @@ -1393,17 +1433,11 @@ pe_dll_generate_def_file (pe_out_def_fil fprintf (out, _("; no contents available\n")); if (fclose (out) == EOF) - { - /* xgettext:c-format */ - einfo (_("%P: Error closing file `%s'\n"), pe_out_def_filename); - } + /* xgettext:c-format */ + einfo (_("%P: Error closing file `%s'\n"), pe_out_def_filename); } -/************************************************************************ - - Generate the import library - - ************************************************************************/ +/* Generate the import library. */ static asymbol **symtab; static int symptr; @@ -1442,15 +1476,16 @@ quick_section (abfd, name, flags, align) static void quick_symbol (abfd, n1, n2, n3, sec, flags, addr) bfd *abfd; - char *n1; - char *n2; - char *n3; + const char *n1; + const char *n2; + const char *n3; asection *sec; int flags; int addr; { asymbol *sym; char *name = (char *) xmalloc (strlen (n1) + strlen (n2) + strlen (n3) + 1); + strcpy (name, n1); strcat (name, n2); strcat (name, n3); @@ -1491,6 +1526,7 @@ static void save_relocs (asection *sec) { int i; + sec->relocation = reltab; sec->reloc_count = relcount; sec->orelocation = (arelent **) xmalloc ((relcount + 1) * sizeof (arelent *)); @@ -1502,24 +1538,22 @@ save_relocs (asection *sec) relcount = relsize = 0; } -/* - * .section .idata$2 - * .global __head_my_dll - * __head_my_dll: - * .rva hname - * .long 0 - * .long 0 - * .rva __my_dll_iname - * .rva fthunk - * - * .section .idata$5 - * .long 0 - * fthunk: - * - * .section .idata$4 - * .long 0 - * hname: - */ +/* .section .idata$2 + .global __head_my_dll + __head_my_dll: + .rva hname + .long 0 + .long 0 + .rva __my_dll_iname + .rva fthunk + + .section .idata$5 + .long 0 + fthunk: + + .section .idata$4 + .long 0 + hname: */ static bfd * make_head (parent) @@ -1559,7 +1593,7 @@ make_head (parent) d2 = (unsigned char *) xmalloc (20); id2->contents = d2; memset (d2, 0, 20); - d2[0] = d2[16] = 4; /* reloc addend */ + d2[0] = d2[16] = 4; /* Reloc addend. */ quick_reloc (abfd, 0, BFD_RELOC_RVA, 2); quick_reloc (abfd, 12, BFD_RELOC_RVA, 4); quick_reloc (abfd, 16, BFD_RELOC_RVA, 1); @@ -1585,16 +1619,14 @@ make_head (parent) return abfd; } -/* - * .section .idata$4 - * .long 0 - * .section .idata$5 - * .long 0 - * .section idata$7 - * .global __my_dll_iname - *__my_dll_iname: - * .asciz "my.dll" - */ +/* .section .idata$4 + .long 0 + .section .idata$5 + .long 0 + .section idata$7 + .global __my_dll_iname + __my_dll_iname: + .asciz "my.dll" */ static bfd * make_tail (parent) @@ -1652,55 +1684,52 @@ make_tail (parent) return abfd; } -/* - * .text - * .global _function - * .global ___imp_function - * .global __imp__function - *_function: - * jmp *__imp__function: - * - * .section idata$7 - * .long __head_my_dll - * - * .section .idata$5 - *___imp_function: - *__imp__function: - *iat? - * .section .idata$4 - *iat? - * .section .idata$6 - *ID: - * .short - * .asciz "function" xlate? (add underscore, kill at) - */ +/* .text + .global _function + .global ___imp_function + .global __imp__function + _function: + jmp *__imp__function: + + .section idata$7 + .long __head_my_dll + + .section .idata$5 + ___imp_function: + __imp__function: + iat? + .section .idata$4 + iat? + .section .idata$6 + ID: + .short + .asciz "function" xlate? (add underscore, kill at) */ -static unsigned char jmp_ix86_bytes[] = { +static unsigned char jmp_ix86_bytes[] = +{ 0xff, 0x25, 0x00, 0x00, 0x00, 0x00, 0x90, 0x90 }; -/* - *_function: - * mov.l ip+8,r0 - * mov.l @r0,r0 - * jmp @r0 - * nop - * .dw __imp_function - */ +/* _function: + mov.l ip+8,r0 + mov.l @r0,r0 + jmp @r0 + nop + .dw __imp_function */ -static unsigned char jmp_sh_bytes[] = { +static unsigned char jmp_sh_bytes[] = +{ 0x01, 0xd0, 0x02, 0x60, 0x2b, 0x40, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00 }; -/* - *_function: - * lui $t0, - * lw $t0, - * jr $t0 - * nop - */ +/* _function: + lui $t0, + lw $t0, + jr $t0 + nop */ -static unsigned char jmp_mips_bytes[] = { +static unsigned char jmp_mips_bytes[] = +{ 0x00, 0x00, 0x08, 0x3c, 0x00, 0x00, 0x08, 0x8d, 0x08, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 }; @@ -1732,6 +1761,8 @@ make_one (exp, parent) jmp_bytes = jmp_mips_bytes; jmp_byte_count = sizeof (jmp_mips_bytes); break; + default: + abort (); } oname = (char *) xmalloc (20); @@ -1756,35 +1787,38 @@ make_one (exp, parent) quick_symbol (abfd, U (""), exp->internal_name, "", tx, BSF_GLOBAL, 0); quick_symbol (abfd, U ("_head_"), dll_symname, "", UNDSEC, BSF_GLOBAL, 0); quick_symbol (abfd, U ("_imp__"), exp->internal_name, "", id5, BSF_GLOBAL, 0); - /* symbol to reference ord/name of imported symbol, used to implement - auto-import */ + /* Symbol to reference ord/name of imported + symbol, used to implement auto-import. */ quick_symbol (abfd, U("_nm__"), exp->internal_name, "", id6, BSF_GLOBAL, 0); if (pe_dll_compat_implib) quick_symbol (abfd, U ("__imp_"), exp->internal_name, "", id5, BSF_GLOBAL, 0); if (! exp->flag_data) - { - bfd_set_section_size (abfd, tx, jmp_byte_count); - td = (unsigned char *) xmalloc (jmp_byte_count); - tx->contents = td; - memcpy (td, jmp_bytes, jmp_byte_count); - switch (pe_details->pe_arch) - { - case PE_ARCH_i386: - quick_reloc (abfd, 2, BFD_RELOC_32, 2); - break; - case PE_ARCH_sh: - quick_reloc (abfd, 8, BFD_RELOC_32, 2); - break; - case PE_ARCH_mips: - quick_reloc (abfd, 0, BFD_RELOC_HI16_S, 2); - quick_reloc (abfd, 0, BFD_RELOC_LO16, 0); /* MIPS_R_PAIR */ - quick_reloc (abfd, 4, BFD_RELOC_LO16, 2); - break; - } - save_relocs (tx); - } + { + bfd_set_section_size (abfd, tx, jmp_byte_count); + td = (unsigned char *) xmalloc (jmp_byte_count); + tx->contents = td; + memcpy (td, jmp_bytes, jmp_byte_count); + + switch (pe_details->pe_arch) + { + case PE_ARCH_i386: + quick_reloc (abfd, 2, BFD_RELOC_32, 2); + break; + case PE_ARCH_sh: + quick_reloc (abfd, 8, BFD_RELOC_32, 2); + break; + case PE_ARCH_mips: + quick_reloc (abfd, 0, BFD_RELOC_HI16_S, 2); + quick_reloc (abfd, 0, BFD_RELOC_LO16, 0); /* MIPS_R_PAIR */ + quick_reloc (abfd, 4, BFD_RELOC_LO16, 2); + break; + default: + abort (); + } + save_relocs (tx); + } bfd_set_section_size (abfd, id7, 4); d7 = (unsigned char *) xmalloc (4); @@ -1797,6 +1831,7 @@ make_one (exp, parent) d5 = (unsigned char *) xmalloc (4); id5->contents = d5; memset (d5, 0, 4); + if (exp->flag_noname) { d5[0] = exp->ordinal; @@ -1813,6 +1848,7 @@ make_one (exp, parent) d4 = (unsigned char *) xmalloc (4); id4->contents = d4; memset (d4, 0, 4); + if (exp->flag_noname) { d4[0] = exp->ordinal; @@ -1859,11 +1895,10 @@ make_one (exp, parent) static bfd * make_singleton_name_thunk (import, parent) - char *import; + const char *import; bfd *parent; { - /* name thunks go to idata$4 */ - + /* Name thunks go to idata$4. */ asection *id4; unsigned char *d4; char *oname; @@ -1905,10 +1940,10 @@ static char * make_import_fixup_mark (rel) arelent *rel; { - /* we convert reloc to symbol, for later reference */ + /* We convert reloc to symbol, for later reference. */ static int counter; static char *fixup_name = NULL; - static int buffer_len = 0; + static size_t buffer_len = 0; struct symbol_cache_entry *sym = *rel->sym_ptr_ptr; @@ -1922,13 +1957,13 @@ make_import_fixup_mark (rel) } if (strlen (sym->name) + 25 > buffer_len) - /* assume 25 chars for "__fu" + counter + "_". If counter is + /* Assume 25 chars for "__fu" + counter + "_". If counter is bigger than 20 digits long, we've got worse problems than - overflowing this buffer... */ + overflowing this buffer... */ { free (fixup_name); - /* new buffer size is length of symbol, plus 25, but then - rounded up to the nearest multiple of 128 */ + /* New buffer size is length of symbol, plus 25, but then + rounded up to the nearest multiple of 128. */ buffer_len = ((strlen (sym->name) + 25) + 127) & ~127; fixup_name = (char *) xmalloc (buffer_len); } @@ -1940,29 +1975,25 @@ make_import_fixup_mark (rel) rel->address, NULL, true, false, (struct bfd_link_hash_entry **) &myh); -/* - printf("type:%d\n",myh->type); - printf("%s\n",myh->root.u.def.section->name); -*/ +#if 0 + printf ("type:%d\n", myh->type); + printf ("%s\n", myh->root.u.def.section->name); +#endif return fixup_name; } - -/* - * .section .idata$3 - * .rva __nm_thnk_SYM (singleton thunk with name of func) - * .long 0 - * .long 0 - * .rva __my_dll_iname (name of dll) - * .rva __fuNN_SYM (pointer to reference (address) in text) - * - */ +/* .section .idata$3 + .rva __nm_thnk_SYM (singleton thunk with name of func) + .long 0 + .long 0 + .rva __my_dll_iname (name of dll) + .rva __fuNN_SYM (pointer to reference (address) in text) */ static bfd * make_import_fixup_entry (name, fixup_name, dll_symname,parent) - char *name; - char *fixup_name; - char *dll_symname; + const char *name; + const char *fixup_name; + const char *dll_symname; bfd *parent; { asection *id3; @@ -1984,9 +2015,10 @@ make_import_fixup_entry (name, fixup_nam symptr = 0; symtab = (asymbol **) xmalloc (6 * sizeof (asymbol *)); id3 = quick_section (abfd, ".idata$3", SEC_HAS_CONTENTS, 2); -/* - quick_symbol (abfd, U("_head_"), dll_symname, "", id2, BSF_GLOBAL, 0); -*/ + +#if 0 + quick_symbol (abfd, U ("_head_"), dll_symname, "", id2, BSF_GLOBAL, 0); +#endif quick_symbol (abfd, U ("_nm_thnk_"), name, "", UNDSEC, BSF_GLOBAL, 0); quick_symbol (abfd, U (""), dll_symname, "_iname", UNDSEC, BSF_GLOBAL, 0); quick_symbol (abfd, "", fixup_name, "", UNDSEC, BSF_GLOBAL, 0); @@ -2016,7 +2048,7 @@ pe_create_import_fixup (rel) char buf[300]; struct symbol_cache_entry *sym = *rel->sym_ptr_ptr; struct bfd_link_hash_entry *name_thunk_sym; - CONST char *name = sym->name; + const char *name = sym->name; char *fixup_name = make_import_fixup_mark (rel); sprintf (buf, U ("_nm_thnk_%s"), name); @@ -2028,13 +2060,15 @@ pe_create_import_fixup (rel) bfd *b = make_singleton_name_thunk (name, output_bfd); add_bfd_to_link (b, b->filename, &link_info); - /* If we ever use autoimport, we have to cast text section writable */ + /* If we ever use autoimport, we have to cast text section writable. */ config.text_read_only = false; } { - extern char *pe_data_import_dll; - bfd *b = make_import_fixup_entry (name, fixup_name, pe_data_import_dll, + extern char * pe_data_import_dll; + char * dll_symname = pe_data_import_dll ? pe_data_import_dll : "unknown"; + + bfd *b = make_import_fixup_entry (name, fixup_name, dll_symname, output_bfd); add_bfd_to_link (b, b->filename, &link_info); } @@ -2055,7 +2089,7 @@ pe_dll_generate_implib (def, impfilename dll_filename = (def->name) ? def->name : dll_name; dll_symname = xstrdup (dll_filename); for (i = 0; dll_symname[i]; i++) - if (!isalnum ((unsigned char) dll_symname[i])) + if (!ISALNUM (dll_symname[i])) dll_symname[i] = '_'; unlink (impfilename); @@ -2076,7 +2110,6 @@ pe_dll_generate_implib (def, impfilename outarch->has_armap = 1; /* Work out a reasonable size of things to put onto one line. */ - ar_head = make_head (outarch); for (i = 0; i < def->num_exports; i++) @@ -2084,6 +2117,7 @@ pe_dll_generate_implib (def, impfilename /* The import library doesn't know about the internal name. */ char *internal = def->exports[i].internal_name; bfd *n; + def->exports[i].internal_name = def->exports[i].name; n = make_one (def->exports + i, outarch); n->next = head; @@ -2097,7 +2131,6 @@ pe_dll_generate_implib (def, impfilename return; /* Now stick them all into the archive. */ - ar_head->next = head; ar_tail->next = ar_head; head = ar_tail; @@ -2119,15 +2152,17 @@ pe_dll_generate_implib (def, impfilename static void add_bfd_to_link (abfd, name, link_info) bfd *abfd; - CONST char *name; + const char *name; struct bfd_link_info *link_info; { lang_input_statement_type *fake_file; + fake_file = lang_add_input_file (name, lang_input_file_is_fake_enum, NULL); fake_file->the_bfd = abfd; ldlang_add_file (fake_file); + if (!bfd_link_add_symbols (abfd, link_info)) einfo ("%Xaddsym %s: %s\n", name, bfd_errmsg (bfd_get_error ())); } @@ -2138,6 +2173,7 @@ pe_process_import_defs (output_bfd, link struct bfd_link_info *link_info; { def_file_module *module; + pe_dll_id_target (bfd_get_target (output_bfd)); if (!pe_def_file) @@ -2150,7 +2186,7 @@ pe_process_import_defs (output_bfd, link dll_filename = module->name; dll_symname = xstrdup (module->name); for (i = 0; dll_symname[i]; i++) - if (!isalnum (dll_symname[i])) + if (!ISALNUM (dll_symname[i])) dll_symname[i] = '_'; do_this_dll = 0; @@ -2206,13 +2242,9 @@ pe_process_import_defs (output_bfd, link } } -/************************************************************************ - - We were handed a *.DLL file. Parse it and turn it into a set of - IMPORTS directives in the def file. Return true if the file was - handled, false if not. - - ************************************************************************/ +/* We were handed a *.DLL file. Parse it and turn it into a set of + IMPORTS directives in the def file. Return true if the file was + handled, false if not. */ static unsigned int pe_get16 (abfd, where) @@ -2220,8 +2252,9 @@ pe_get16 (abfd, where) int where; { unsigned char b[2]; - bfd_seek (abfd, where, SEEK_SET); - bfd_read (b, 1, 2, abfd); + + bfd_seek (abfd, (file_ptr) where, SEEK_SET); + bfd_bread (b, (bfd_size_type) 2, abfd); return b[0] + (b[1] << 8); } @@ -2231,8 +2264,9 @@ pe_get32 (abfd, where) int where; { unsigned char b[4]; - bfd_seek (abfd, where, SEEK_SET); - bfd_read (b, 1, 4, abfd); + + bfd_seek (abfd, (file_ptr) where, SEEK_SET); + bfd_bread (b, (bfd_size_type) 4, abfd); return b[0] + (b[1] << 8) + (b[2] << 16) + (b[3] << 24); } @@ -2243,6 +2277,7 @@ pe_as16 (ptr) void *ptr; { unsigned char *b = ptr; + return b[0] + (b[1] << 8); } @@ -2253,6 +2288,7 @@ pe_as32 (ptr) void *ptr; { unsigned char *b = ptr; + return b[0] + (b[1] << 8) + (b[2] << 16) + (b[3] << 24); } @@ -2269,13 +2305,13 @@ pe_implied_import_dll (filename) /* No, I can't use bfd here. kernel32.dll puts its export table in the middle of the .rdata section. */ - dll = bfd_openr (filename, pe_details->target_name); if (!dll) { einfo ("%Xopen %s: %s\n", filename, bfd_errmsg (bfd_get_error ())); return false; } + /* PEI dlls seem to be bfd_objects. */ if (!bfd_check_format (dll, bfd_object)) { @@ -2291,14 +2327,17 @@ pe_implied_import_dll (filename) pe_header_offset = pe_get32 (dll, 0x3c); opthdr_ofs = pe_header_offset + 4 + 20; num_entries = pe_get32 (dll, opthdr_ofs + 92); - if (num_entries < 1) /* no exports */ + + if (num_entries < 1) /* No exports. */ return false; + export_rva = pe_get32 (dll, opthdr_ofs + 96); export_size = pe_get32 (dll, opthdr_ofs + 100); nsections = pe_get16 (dll, pe_header_offset + 4 + 2); secptr = (pe_header_offset + 4 + 20 + pe_get16 (dll, pe_header_offset + 4 + 16)); expptr = 0; + for (i = 0; i < nsections; i++) { char sname[8]; @@ -2306,8 +2345,10 @@ pe_implied_import_dll (filename) unsigned long vaddr = pe_get32 (dll, secptr1 + 12); unsigned long vsize = pe_get32 (dll, secptr1 + 16); unsigned long fptr = pe_get32 (dll, secptr1 + 20); - bfd_seek (dll, secptr1, SEEK_SET); - bfd_read (sname, 1, 8, dll); + + bfd_seek (dll, (file_ptr) secptr1, SEEK_SET); + bfd_bread (sname, (bfd_size_type) 8, dll); + if (vaddr <= export_rva && vaddr + vsize > export_rva) { expptr = fptr + (export_rva - vaddr); @@ -2318,8 +2359,8 @@ pe_implied_import_dll (filename) } expdata = (unsigned char *) xmalloc (export_size); - bfd_seek (dll, expptr, SEEK_SET); - bfd_read (expdata, 1, export_size, dll); + bfd_seek (dll, (file_ptr) expptr, SEEK_SET); + bfd_bread (expdata, (bfd_size_type) export_size, dll); erva = expdata - export_rva; if (pe_def_file == 0) @@ -2329,10 +2370,12 @@ pe_implied_import_dll (filename) name_rvas = pe_as32 (expdata + 32); ordinals = pe_as32 (expdata + 36); ordbase = pe_as32 (expdata + 16); + for (i = 0; i < nexp; i++) { unsigned long name_rva = pe_as32 (erva + name_rvas + i * 4); def_file_import *imp; + imp = def_file_add_import (pe_def_file, erva + name_rva, dll_name, i, 0); } @@ -2340,14 +2383,10 @@ pe_implied_import_dll (filename) return true; } -/************************************************************************ - - These are the main functions, called from the emulation. The first - is called after the bfds are read, so we can guess at how much space - we need. The second is called after everything is placed, so we - can put the right values in place. - - ************************************************************************/ +/* These are the main functions, called from the emulation. The first + is called after the bfds are read, so we can guess at how much space + we need. The second is called after everything is placed, so we + can put the right values in place. */ void pe_dll_build_sections (abfd, info) diff -uprN binutils-2.11.90.0.31/ld/pe-dll.h binutils-2.11.92.0.5/ld/pe-dll.h --- binutils-2.11.90.0.31/ld/pe-dll.h Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/ld/pe-dll.h Mon Oct 1 15:25:25 2001 @@ -48,7 +48,7 @@ extern void pe_exe_fill_sections PARAMS extern void pe_walk_relocs_of_symbol PARAMS ((struct bfd_link_info * info, CONST char *name, - int (*cb) (arelent *))); + int (*cb) (arelent *, asection *))); extern void pe_create_import_fixup PARAMS ((arelent * rel)); #endif /* PE_DLL_H */ diff -uprN binutils-2.11.90.0.31/ld/scripttempl/v850.sc binutils-2.11.92.0.5/ld/scripttempl/v850.sc --- binutils-2.11.90.0.31/ld/scripttempl/v850.sc Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/ld/scripttempl/v850.sc Mon Oct 1 15:25:25 2001 @@ -42,6 +42,8 @@ SECTIONS .rela.data : { *(.rela.data) } .rel.rodata : { *(.rel.rodata) } .rela.rodata : { *(.rela.rodata) } + .rel.gcc_except_table : { *(.rel.gcc_except_table) } + .rela.gcc_except_table : { *(.rela.gcc_except_table) } .rel.got : { *(.rel.got) } .rela.got : { *(.rela.got) } .rel.ctors : { *(.rel.ctors) } @@ -120,6 +122,8 @@ SECTIONS KEEP (*(.jcr)) } + .gcc_except_table : { *(.gcc_except_table) } + .got : { *(.got.plt) *(.got) } .dynamic : { *(.dynamic) } diff -uprN binutils-2.11.90.0.31/ld/testsuite/ChangeLog binutils-2.11.92.0.5/ld/testsuite/ChangeLog --- binutils-2.11.90.0.31/ld/testsuite/ChangeLog Mon Aug 27 11:44:52 2001 +++ binutils-2.11.92.0.5/ld/testsuite/ChangeLog Mon Oct 1 15:25:25 2001 @@ -1,3 +1,69 @@ +2001-09-29 Hans-Peter Nilsson + + * ld-linkonce/linkonce.exp: New file. + * ld-linkonce/x.s, ld-linkonce/y.s, ld-linkonce/zeroeh.ld, + ld-linkonce/zeroehl32.d: New test. + +2001-09-25 H.J. Lu + + * ld-elfweak/dso.dsym: Updated for alpha. + * ld-elfweak/dsodata.dsym: Likewise. + * ld-elfweak/strong.sym: Likewise. + * ld-elfweak/strongcomm.sym: Likewise. + * ld-elfweak/strongdata.sym: Likewise. + +2001-09-15 Hans-Peter Nilsson + + * lib/ld-lib.exp (run_dump_test): Handle new option + "objcopy_linked_file". Return after failing, if errors were + expected but none were found. + (slurp_options): Support underscores in option names. + +2001-09-14 H.J. Lu + + * ld-elfweak/bar.c: Updated. + * ld-elfweak/bar1a.c: Likewise. + * ld-elfweak/main.c: Likewise. + * ld-elfweak/main1.c: Likewise. + * ld-elfweak/elfweak.exp: Likewise. + * ld-elfweak/weakdata.dsym: Updated. + +2001-09-11 H.J. Lu + + * ld-elfweak/elfweak.exp (build_lib): Take a list of object + files. + (build_exec): Likewise. + Add more tests and make some xfail. + + * ld-elfweak/dso.dsym: Support symbol versioning. + * ld-elfweak/dsow.dsym: Likewise. + + * ld-elfweak/main1.c: New. + * ld-elfweak/bar1a.c: Likewise. + * ld-elfweak/bar1b.c: Likewise. + * ld-elfweak/bar1c.c: Likewise. + * ld-elfweak/foo1a.c: Likewise. + * ld-elfweak/foo1b.c: Likewise. + * ld-elfweak/dsodata.dsym: Likewise. + * ld-elfweak/dsowdata.dsym: Likewise. + * ld-elfweak/weakdata.dsym: Likewise. + * ld-elfweak/strongcomm.sym: Likewise. + * ld-elfweak/strongdata.sym: Likewise. + * ld-elfweak/weakdata.dat: Likewise. + * ld-elfweak/strongdata.dat: Likewise. + +2001-09-10 H.J. Lu + + * ld-elfweak/elfweak.exp: New. + * ld-elfweak/bar.c: Likewise. + * ld-elfweak/foo.c: Likewise. + * ld-elfweak/main.c: Likewise. + * ld-elfweak/dso.dsym: Likewise. + * ld-elfweak/dsow.dsym: Likewise. + * ld-elfweak/strong.sym: Likewise. + * ld-elfweak/strong.dat: Likewise. + * ld-elfweak/weak.dat: Likewise. + 2001-08-27 Alan Modra Linus Nordberg diff -uprN binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/bar.c binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/bar.c --- binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/bar.c Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/bar.c Mon Oct 1 15:25:26 2001 @@ -0,0 +1,16 @@ +#include + +extern void foo (); +extern void foobar (); + +void +foo () +{ + printf ("strong foo\n"); +} + +void +foobar () +{ + foo (); +} diff -uprN binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/bar1a.c binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/bar1a.c --- binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/bar1a.c Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/bar1a.c Mon Oct 1 15:25:26 2001 @@ -0,0 +1,26 @@ +#include + +extern int deallocate_foo; + +extern int * bar (); +extern int * foo (); +extern void abort (); +extern void foobar (); + +void +foobar () +{ + if (&deallocate_foo != bar () || &deallocate_foo != foo ()) + abort (); + + if (deallocate_foo) + printf ("weak deallocate_foo\n"); + else + printf ("strong deallocate_foo\n"); +} + +int * +bar() +{ + return &deallocate_foo; +} diff -uprN binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/bar1b.c binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/bar1b.c --- binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/bar1b.c Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/bar1b.c Mon Oct 1 15:25:26 2001 @@ -0,0 +1,7 @@ +int deallocate_foo = 0; + +int * +bar() +{ + return &deallocate_foo; +} diff -uprN binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/bar1c.c binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/bar1c.c --- binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/bar1c.c Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/bar1c.c Mon Oct 1 15:25:26 2001 @@ -0,0 +1,7 @@ +int deallocate_foo; + +int * +bar() +{ + return &deallocate_foo; +} diff -uprN binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/dso.dsym binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/dso.dsym --- binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/dso.dsym Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/dso.dsym Mon Oct 1 15:25:26 2001 @@ -0,0 +1 @@ +[0-9a-f]*[ ]+g[ ]+DF[ ]+.text[ ]+[0-9a-f]*[ ]+(Base[ ]+|[ ]*)(0x[0-9a-f]+|)[ ]*foo diff -uprN binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/dsodata.dsym binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/dsodata.dsym --- binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/dsodata.dsym Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/dsodata.dsym Mon Oct 1 15:25:26 2001 @@ -0,0 +1,2 @@ +[0-9a-f]*[ ]+g[ ]+DO[ ]+.(s|)data[ ]+[0-9a-f]*[ ]+(Base[ ]+|[ ]*)deallocate_foo +[0-9a-f]*[ ]+g[ ]+DF[ ]+.text[ ]+[0-9a-f]*[ ]+(Base[ ]+|[ ]*)(0x[0-9a-f]*|)[ ]*foo diff -uprN binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/dsow.dsym binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/dsow.dsym --- binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/dsow.dsym Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/dsow.dsym Mon Oct 1 15:25:26 2001 @@ -0,0 +1 @@ +[0-9a-f]*[ ]+w[ ]+DF[ ]+.text[ ]+[0-9a-f]*[ ]+(Base[ ]+|[ ]*)foo diff -uprN binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/dsowdata.dsym binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/dsowdata.dsym --- binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/dsowdata.dsym Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/dsowdata.dsym Mon Oct 1 15:25:26 2001 @@ -0,0 +1 @@ +[0-9a-f]*[ ]+w[ ]+DO[ ]+.data[ ]+[0-9a-f]*[ ]+(Base[ ]+|[ ]*)deallocate_foo diff -uprN binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/elfweak.exp binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/elfweak.exp --- binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/elfweak.exp Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/elfweak.exp Mon Oct 1 15:25:26 2001 @@ -0,0 +1,476 @@ +# Expect script for ld-weak tests +# Copyright 2001 Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# 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. +# +# Written by H.J. Lu (hjl@gnu.org) +# Eric Youngdale (eric@andante.jic.com) +# + +# This test can only be run if ld generates native executables. +if ![isnative] then {return} + +# This test can only be run on a couple of ELF platforms. +# Square bracket expressions seem to confuse istarget. +# This is similar to the test that is used in ld-shared, BTW. +if { ![istarget i?86-*-sysv4*] \ + && ![istarget i?86-*-unixware] \ + && ![istarget i?86-*-elf*] \ + && ![istarget i?86-*-linux*] \ + && ![istarget ia64-*-elf*] \ + && ![istarget ia64-*-linux*] \ + && ![istarget m68k-*-linux*] \ + && ![istarget mips*-*-irix5*] \ + && ![istarget powerpc-*-elf*] \ + && ![istarget powerpc-*-linux*] \ + && ![istarget powerpc-*-sysv4*] \ + && ![istarget sparc*-*-elf] \ + && ![istarget sparc*-*-solaris2*] \ + && ![istarget sparc*-*-linux*] \ + && ![istarget arm*-*-linux*] \ + && ![istarget mips*-*-linux*] \ + && ![istarget alpha*-*-linux*] } { + return +} + +if { [istarget i?86-*-linux*aout*] \ + || [istarget i?86-*-linux*oldld*] \ + || [istarget m68k-*-linux*aout*] } { + return +} + +if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } { + return +} + +set diff diff +set tmpdir tmpdir +set DOBJDUMP_FLAGS --dynamic-syms +set SOBJDUMP_FLAGS --syms +set shared --shared + +# +# objdump_symstuff +# Dump non-dynamic symbol stuff and make sure that it is sane. +# +proc objdump_symstuff { objdump object expectfile } { + global SOBJDUMP_FLAGS + global version_output + global diff + global tmpdir + + if ![info exists SOBJDUMP_FLAGS] { set SOBJDUMP_FLAGS "" } + + verbose -log "$objdump $SOBJDUMP_FLAGS $object | grep foo$ > $tmpdir/objdump.out" + + catch "exec $objdump $SOBJDUMP_FLAGS $object | grep foo$ > $tmpdir/objdump.out" exec_output + set exec_output [prune_warnings $exec_output] + if [string match "" $exec_output] then { + +# Now do a line-by-line comparison to effectively diff the darned things +# The stuff coming from the expectfile is actually a regex, so we can +# skip over the actual addresses and so forth. This is currently very +# simpleminded - it expects a one-to-one correspondence in terms of line +# numbers. + + if [file exists $expectfile] then { + set file_a [open $expectfile r] + } else { + perror "$expectfile doesn't exist" + return 0 + } + + if [file exists $tmpdir/objdump.out] then { + set file_b [open $tmpdir/objdump.out r] + } else { + perror "$tmpdir/objdump.out doesn't exist" + return 0 + } + + verbose "# Diff'ing: $expectfile $tmpdir/objdump.out" 2 + + set eof -1 + set differences 0 + + while { [gets $file_a line] != $eof } { + if [regexp "^#.*$" $line] then { + continue + } else { + lappend list_a $line + } + } + close $file_a + + while { [gets $file_b line] != $eof } { + if [regexp "^#.*$" $line] then { + continue + } else { + lappend list_b $line + } + } + close $file_b + + for { set i 0 } { $i < [llength $list_a] } { incr i } { + set line_a [lindex $list_a $i] + set line_b [lindex $list_b $i] + + + verbose "\t$expectfile: $i: $line_a" 3 + verbose "\t/tmp/objdump.out: $i: $line_b" 3 + if [regexp $line_a $line_b] then { + continue + } else { + verbose -log "\t$expectfile: $i: $line_a" + verbose -log "\t$tmpdir/objdump.out: $i: $line_b" + + return 0 + } + } + + if { [llength $list_a] != [llength $list_b] } { + verbose -log "Line count" + return 0 + } + + if $differences<1 then { + return 1 + } + + return 0 + } else { + verbose -log "$exec_output" + return 0 + } + +} + +# +# objdump_dymsymstuff +# Dump dynamic symbol stuff and make sure that it is sane. +# +proc objdump_dynsymstuff { objdump object expectfile } { + global DOBJDUMP_FLAGS + global version_output + global diff + global tmpdir + + if ![info exists DOBJDUMP_FLAGS] { set DOBJDUMP_FLAGS "" } + + verbose -log "$objdump $DOBJDUMP_FLAGS $object | grep foo$ > $tmpdir/objdump.out" + + catch "exec $objdump $DOBJDUMP_FLAGS $object | grep foo$ > $tmpdir/objdump.out" exec_output + set exec_output [prune_warnings $exec_output] + if [string match "" $exec_output] then { + +# Now do a line-by-line comparison to effectively diff the darned things +# The stuff coming from the expectfile is actually a regex, so we can +# skip over the actual addresses and so forth. This is currently very +# simpleminded - it expects a one-to-one correspondence in terms of line +# numbers. + + if [file exists $expectfile] then { + set file_a [open $expectfile r] + } else { + warning "$expectfile doesn't exist" + return 0 + } + + if [file exists $tmpdir/objdump.out] then { + set file_b [open $tmpdir/objdump.out r] + } else { + fail "$tmpdir/objdump.out doesn't exist" + return 0 + } + + verbose "# Diff'ing: $expectfile $tmpdir/objdump.out" 2 + + set eof -1 + set differences 0 + + while { [gets $file_a line] != $eof } { + if [regexp "^#.*$" $line] then { + continue + } else { + lappend list_a $line + } + } + close $file_a + + while { [gets $file_b line] != $eof } { + if [regexp "^#.*$" $line] then { + continue + } else { + lappend list_b $line + } + } + close $file_b + + for { set i 0 } { $i < [llength $list_b] } { incr i } { + set line_b [lindex $list_b $i] + +# The tests are rigged so that we should never export a symbol with the +# word 'hide' in it. Thus we just search for it, and bail if we find it. + if [regexp "hide" $line_b] then { + verbose -log "\t$tmpdir/objdump.out: $i: $line_b" + + return 0 + } + + verbose "\t$expectfile: $i: $line_b" 3 + + # We can't assume that the sort is consistent across + # systems, so we must check each regexp. When we find a + # regexp, we null it out, so we don't match it twice. + for { set j 0 } { $j < [llength $list_a] } { incr j } { + set line_a [lindex $list_a $j] + + if [regexp $line_a $line_b] then { + lreplace $list_a $j $j "CAN NOT MATCH" + break + } + } + + if { $j >= [llength $list_a] } { + verbose -log "\t$tmpdir/objdump.out: $i: $line_b" + + return 0 + } + } + + if { [llength $list_a] != [llength $list_b] } { + verbose -log "Line count" + return 0 + } + + if $differences<1 then { + return 1 + } + + return 0 + } else { + verbose -log "$exec_output" + return 0 + } + +} + +proc build_lib {test libname objs dynsymexp} { + global ld + global objdump + global tmpdir + global shared + global srcdir + global subdir + + set files "" + foreach obj $objs { + set files "$files $tmpdir/$obj" + } + + if {![ld_link $ld $tmpdir/$libname.so "$shared $files"]} { + fail $test + return + } + + if {![objdump_dynsymstuff $objdump $tmpdir/$libname.so $srcdir/$subdir/$dynsymexp]} { + fail $test + return + } + pass $test +} + +proc build_exec { test execname objs flags dat dynsymexp symexp} { + global ld + global objdump + global tmpdir + global shared + global srcdir + global subdir + global exec_output + + set files "" + foreach obj $objs { + set files "$files $tmpdir/$obj" + } + + if {![ld_link $ld $tmpdir/$execname "$flags $files"]} { + fail "$test" + return + } + + if {![string match "" $dynsymexp]} then { + if {![objdump_dynsymstuff $objdump $tmpdir/$execname $srcdir/$subdir/$dynsymexp]} { + fail $test + return + } + } + + if {![string match "" $symexp]} then { + if {![objdump_symstuff $objdump $tmpdir/$execname $srcdir/$subdir/$symexp]} { + fail $test + return + } + } + + # Run the resulting program + send_log "$tmpdir/$execname >$tmpdir/$execname.out\n" + verbose "$tmpdir/$execname >$tmpdir/$execname.out" + catch "exec $tmpdir/$execname >$tmpdir/$execname.out" exec_output + if ![string match "" $exec_output] then { + send_log "$exec_output\n" + verbose "$exec_output" + fail $test + return + } + + send_log "diff $tmpdir/$execname.out $srcdir/$subdir/$dat.dat\n" + verbose "diff $tmpdir/$execname.out $srcdir/$subdir/$dat.dat" + catch "exec diff $tmpdir/$execname.out $srcdir/$subdir/$dat.dat" exec_output + set exec_output [prune_warnings $exec_output] + + if {![string match "" $exec_output]} then { + send_log "$exec_output\n" + verbose "$exec_output" + fail $test + return + } + + pass $test +} + +if [istarget mips*-*-*] { + set picflag "" +} else { + # Unfortunately, the gcc argument is -fpic and the cc argument is + # -KPIC. We have to try both. + set picflag "-fpic" + send_log "$CC $picflag\n" + verbose "$CC $picflag" + catch "exec $CC $picflag" exec_output + send_log "$exec_output\n" + verbose "--" "$exec_output" + if { [string match "*illegal option*" $exec_output] \ + || [string match "*option ignored*" $exec_output] \ + || [string match "*unrecognized option*" $exec_output] \ + || [string match "*passed to ld*" $exec_output] } { + if [istarget *-*-sunos4*] { + set picflag "-pic" + } else { + set picflag "-KPIC" + } + } +} +verbose "Using $picflag to compile PIC code" + +if ![ld_compile "$CC $CFLAGS $picflag" $srcdir/$subdir/foo.c $tmpdir/foo.o] { + unresolved "ELF weak" + return +} + +if ![ld_compile "$CC $CFLAGS $picflag" $srcdir/$subdir/bar.c $tmpdir/bar.o] { + unresolved "ELF weak" + return +} + +if ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/main.c $tmpdir/main.o] { + unresolved "ELF weak" + return +} + +if {![ld_link $ld $tmpdir/libbar.so "$shared $tmpdir/bar.o"]} { + fail "ELF weak" + return +} + +if ![ld_compile "$CC $CFLAGS $picflag" $srcdir/$subdir/foo1a.c $tmpdir/foo1a.o] { + unresolved "ELF weak" + return +} + +if ![ld_compile "$CC $CFLAGS $picflag" $srcdir/$subdir/foo1b.c $tmpdir/foo1b.o] { + unresolved "ELF weak" + return +} + +if ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/bar1a.c $tmpdir/bar1a.o] { + unresolved "ELF weak" + return +} + +if ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/bar1b.c $tmpdir/bar1b.o] { + unresolved "ELF weak" + return +} + +if ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/bar1c.c $tmpdir/bar1c.o] { + unresolved "ELF weak" + return +} + +if ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/main1.c $tmpdir/main1.o] { + unresolved "ELF weak" + return +} + +if {![ld_link $ld $tmpdir/libfoo1a.so "$shared $tmpdir/foo1a.o"]} { + fail "ELF weak" + return +} + +if {![ld_link $ld $tmpdir/libfoo1b.so "$shared $tmpdir/foo1b.o"]} { + fail "ELF weak" + return +} + +if {![ld_link $ld $tmpdir/libbar1a.so "$shared $tmpdir/bar1a.o $tmpdir/libfoo1a.so"]} { + fail "ELF weak" + return +} + +build_lib "ELF DSO weak func first" libfoo "foo.o bar.o" dso.dsym +build_lib "ELF DSO weak func last" libfoo "bar.o foo.o" dso.dsym +setup_xfail "*-*-*" +build_lib "ELF DSO weak func first DSO" libfoo "foo.o libbar.so" dsow.dsym +setup_xfail "*-*-*" +build_lib "ELF DSO weak func last DSO" libfoo "libbar.so foo.o" dsow.dsym +build_exec "ELF weak func first" foo "main.o bar.o" "" strong "" strong.sym +build_exec "ELF weak func last" foo "bar.o main.o" "" strong "" strong.sym +setup_xfail "*-*-*" +build_exec "ELF weak func first DSO" foo "main.o libbar.so" "-rpath ." weak weak.dsym "" +setup_xfail "*-*-*" +build_exec "ELF weak func last DSO" foo "libbar.so main.o" "-rpath ." weak weak.dsym "" + +build_lib "ELF DSO weak data first" libfoo "bar1a.o foo1a.o" dsodata.dsym +build_lib "ELF DSO weak data last" libfoo "foo1a.o bar1a.o" dsodata.dsym +setup_xfail "*-*-*" +build_lib "ELF DSO weak data first DSO" libfoo "main1.o libfoo1a.so" dsowdata.dsym +setup_xfail "*-*-*" +build_lib "ELF DSO weak data last DSO" libfoo "libfoo1a.so main1.o" dsowdata.dsym +setup_xfail "*-*-*" +build_lib "ELF DSO weak data first DSO common" libfoo "main1.o libfoo1b.so" dsowdata.dsym +setup_xfail "*-*-*" +build_lib "ELF DSO weak data last DSO common" libfoo "libfoo1b.so main1.o" dsowdata.dsym +build_exec "ELF weak data first" foo "main1.o bar1a.o foo1a.o" "" strongdata "" strongdata.sym +build_exec "ELF weak data last" foo "foo1a.o main1.o bar1a.o" "" strongdata "" strongdata.sym +build_exec "ELF weak data first common" foo "main1.o bar1a.o foo1b.o" "" strongdata "" strongcomm.sym +build_exec "ELF weak data last common" foo "foo1b.o main1.o bar1a.o" "" strongdata "" strongcomm.sym +setup_xfail "*-*-*" +build_exec "ELF weak data first DSO" foo "main1.o libbar1a.so libfoo1a.so" "-rpath ." weakdata weakdata.dsym "" +setup_xfail "*-*-*" +build_exec "ELF weak data last DSO" foo "libfoo1a.so main1.o libbar1a.so" "-rpath ." weakdata weakdata.dsym "" +setup_xfail "*-*-*" +build_exec "ELF weak data first DSO common" foo "main1.o libbar1a.so libfoo1b.so" "-rpath ." weakdata weakdata.dsym "" +setup_xfail "*-*-*" +build_exec "ELF weak data last DSO common" foo "libfoo1b.so main1.o libbar1a.so" "-rpath ." weakdata weakdata.dsym "" diff -uprN binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/foo.c binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/foo.c --- binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/foo.c Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/foo.c Mon Oct 1 15:25:26 2001 @@ -0,0 +1,8 @@ +#pragma weak foo + +extern void foo (); + +void +foo () +{ +} diff -uprN binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/foo1a.c binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/foo1a.c --- binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/foo1a.c Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/foo1a.c Mon Oct 1 15:25:26 2001 @@ -0,0 +1,7 @@ +int deallocate_foo = 0; + +int * +foo () +{ + return &deallocate_foo; +} diff -uprN binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/foo1b.c binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/foo1b.c --- binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/foo1b.c Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/foo1b.c Mon Oct 1 15:25:26 2001 @@ -0,0 +1,7 @@ +int deallocate_foo; + +int * +foo () +{ + return &deallocate_foo; +} diff -uprN binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/main.c binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/main.c --- binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/main.c Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/main.c Mon Oct 1 15:25:26 2001 @@ -0,0 +1,19 @@ +#include + +#pragma weak foo + +extern void foo (); +extern void foobar (); + +void +foo () +{ + printf ("weak foo\n"); +} + +int +main () +{ + foobar (); + return 0; +} diff -uprN binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/main1.c binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/main1.c --- binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/main1.c Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/main1.c Mon Oct 1 15:25:26 2001 @@ -0,0 +1,11 @@ +#pragma weak deallocate_foo +int deallocate_foo = 1; + +extern void foobar (); + +int +main () +{ + foobar (); + return 0; +} diff -uprN binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/strong.dat binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/strong.dat --- binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/strong.dat Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/strong.dat Mon Oct 1 15:25:26 2001 @@ -0,0 +1 @@ +strong foo diff -uprN binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/strong.sym binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/strong.sym --- binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/strong.sym Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/strong.sym Mon Oct 1 15:25:26 2001 @@ -0,0 +1 @@ +[0-9a-f]*[ ]+g[ ]+F[ ]+.text[ ]+[0-9a-f]*[ ]+(0x[0-9a-f]*|)[ ]*foo diff -uprN binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/strongcomm.sym binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/strongcomm.sym --- binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/strongcomm.sym Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/strongcomm.sym Mon Oct 1 15:25:26 2001 @@ -0,0 +1,2 @@ +[0-9a-f]*[ ]+g[ ]+O[ ]+.(s|)bss[ ]+[0-9a-f]*[ ]+deallocate_foo +[0-9a-f]*[ ]+g[ ]+F[ ]+.text[ ]+[0-9a-f]*[ ]+(0x[0-9a-f]*|)[ ]*foo diff -uprN binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/strongdata.dat binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/strongdata.dat --- binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/strongdata.dat Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/strongdata.dat Mon Oct 1 15:25:26 2001 @@ -0,0 +1 @@ +strong deallocate_foo diff -uprN binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/strongdata.sym binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/strongdata.sym --- binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/strongdata.sym Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/strongdata.sym Mon Oct 1 15:25:26 2001 @@ -0,0 +1,2 @@ +[0-9a-f]*[ ]+g[ ]+O[ ]+.(s|)data[ ]+[0-9a-f]*[ ]+deallocate_foo +[0-9a-f]*[ ]+g[ ]+F[ ]+.text[ ]+[0-9a-f]*[ ]+(0x[0-9a-f]*|)[ ]*foo diff -uprN binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/weak.dat binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/weak.dat --- binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/weak.dat Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/weak.dat Mon Oct 1 15:25:26 2001 @@ -0,0 +1 @@ +weak foo diff -uprN binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/weak.dsym binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/weak.dsym --- binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/weak.dsym Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/weak.dsym Mon Oct 1 15:25:26 2001 @@ -0,0 +1 @@ +[0-9a-f]*[ ]+w[ ]+DF[ ]+.text[ ]+[0-9a-f]*[ ]+(Base[ ]+|[ ]*)foo diff -uprN binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/weakdata.dat binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/weakdata.dat --- binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/weakdata.dat Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/weakdata.dat Mon Oct 1 15:25:26 2001 @@ -0,0 +1 @@ +weak deallocate_foo diff -uprN binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/weakdata.dsym binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/weakdata.dsym --- binutils-2.11.90.0.31/ld/testsuite/ld-elfweak/weakdata.dsym Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/ld/testsuite/ld-elfweak/weakdata.dsym Mon Oct 1 15:25:26 2001 @@ -0,0 +1 @@ +[0-9a-f]*[ ]+w[ ]+DO[ ]+.data[ ]+[0-9a-f]*[ ]+(Base[ ]+|[ ]*)deallocate_foo diff -uprN binutils-2.11.90.0.31/ld/testsuite/ld-linkonce/linkonce.exp binutils-2.11.92.0.5/ld/testsuite/ld-linkonce/linkonce.exp --- binutils-2.11.90.0.31/ld/testsuite/ld-linkonce/linkonce.exp Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/ld/testsuite/ld-linkonce/linkonce.exp Mon Oct 1 15:25:26 2001 @@ -0,0 +1,35 @@ +# Expect script for ld linkonce tests +# Copyright 2001 Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# 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. +# +# Written by Hans-Peter Nilsson (hp@axis.com) +# + +# Test for ELF here (or really, .gnu.linkonce functionality), so we don't +# have to qualify on ELF specifically in every .d-file. + +if { ![istarget *-*-linux*] && ![istarget *-*-gnu] && ![istarget *-*-elf] } { + return +} + +load_lib ld-lib.exp + +set rd_test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]] +for { set i 0 } { $i < [llength $rd_test_list] } { incr i } { + # We need to strip the ".d", but can leave the dirname. + verbose [file rootname [lindex $rd_test_list $i]] + run_dump_test [file rootname [lindex $rd_test_list $i]] +} diff -uprN binutils-2.11.90.0.31/ld/testsuite/ld-linkonce/x.s binutils-2.11.92.0.5/ld/testsuite/ld-linkonce/x.s --- binutils-2.11.90.0.31/ld/testsuite/ld-linkonce/x.s Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/ld/testsuite/ld-linkonce/x.s Mon Oct 1 15:25:26 2001 @@ -0,0 +1,26 @@ +;# Main file, x.s, with the program (_start) referring to two +;# linkonce functions fn and fn2. The functions fn and fn2 are +;# supposed to be equivalent of C++ template instantiations; the +;# main file instantiates fn. There's the equivalent of an FDE +;# entry in .eh_frame, referring to fn via a local label. + + .text + .global _start +_start: + .long fn + .long fn2 + + .section .gnu.linkonce.t.fn,"ax",@progbits + .weak fn + .type fn,@function +fn: +.La: + .long 1 + .long 2 +.Lb: + .size fn,.Lb-.La + + .section .eh_frame,"aw",@progbits + .long 2 + .long .La + .long .Lb-.La diff -uprN binutils-2.11.90.0.31/ld/testsuite/ld-linkonce/y.s binutils-2.11.92.0.5/ld/testsuite/ld-linkonce/y.s --- binutils-2.11.90.0.31/ld/testsuite/ld-linkonce/y.s Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/ld/testsuite/ld-linkonce/y.s Mon Oct 1 15:25:26 2001 @@ -0,0 +1,33 @@ +;# Library file y.s has linkonce entries for fn and fn2. Note +;# that this version of fn has different code, as if compiled +;# with different optimization flags than the one in x.s (not +;# important for this test, though). The reference from +;# .eh_frame to the linkonce-excluded fn2 must be zero, or g++ +;# EH will not work. + + .section .gnu.linkonce.t.fn2,"ax",@progbits + .weak fn2 + .type fn2,@function +fn2: +.Lc: + .long 3 +.Ld: + .size fn2,.Ld-.Lc + + .section .gnu.linkonce.t.fn,"ax",@progbits + .weak fn + .type fn,@function +fn: +.Le: + .long 4 +.Lf: + .size fn,.Lf-.Le + + .section .eh_frame,"aw",@progbits + .long 7 + .long .Lc + .long .Ld-.Lc + + .long 0x6066 + .long .Le + .long .Lf-.Le diff -uprN binutils-2.11.90.0.31/ld/testsuite/ld-linkonce/zeroeh.ld binutils-2.11.92.0.5/ld/testsuite/ld-linkonce/zeroeh.ld --- binutils-2.11.90.0.31/ld/testsuite/ld-linkonce/zeroeh.ld Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/ld/testsuite/ld-linkonce/zeroeh.ld Mon Oct 1 15:25:26 2001 @@ -0,0 +1,4 @@ +SECTIONS { + .text 0xa00 : { *(.text); *(.gnu.linkonce.t.*) } + .eh_frame 0x2000 : { *(.eh_frame) } +} diff -uprN binutils-2.11.90.0.31/ld/testsuite/ld-linkonce/zeroehl32.d binutils-2.11.92.0.5/ld/testsuite/ld-linkonce/zeroehl32.d --- binutils-2.11.90.0.31/ld/testsuite/ld-linkonce/zeroehl32.d Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/ld/testsuite/ld-linkonce/zeroehl32.d Mon Oct 1 15:25:26 2001 @@ -0,0 +1,18 @@ +#source: x.s +#source: y.s +#ld: -Ttext 0xa00 -T $srcdir/$subdir/zeroeh.ld +#objdump: -s +#target: cris-*-elf cris-*-linux* i?86-*-elf i?86-*-linux* + +# The word at address 201c, for the linkonce-excluded section, must be zero. + +.*: file format elf32.* + +Contents of section \.text: + 0a00 080a0000 100a0000 01000000 02000000 .* + 0a10 03000000 .* +Contents of section \.eh_frame: + 2000 02000000 080a0000 08000000 07000000 .* + 2010 100a0000 04000000 66600000 00000000 .* + 2020 04000000 .* +#pass diff -uprN binutils-2.11.90.0.31/ld/testsuite/lib/ld-lib.exp binutils-2.11.92.0.5/ld/testsuite/lib/ld-lib.exp --- binutils-2.11.90.0.31/ld/testsuite/lib/ld-lib.exp Thu Jul 26 18:02:55 2001 +++ binutils-2.11.92.0.5/ld/testsuite/lib/ld-lib.exp Mon Oct 1 15:25:26 2001 @@ -434,6 +434,12 @@ proc simple_diff { file_1 file_2 } { # Link assembled files using FLAGS, in the order of the "source" # directives, when using multiple files. # +# objcopy_linked_file: FLAGS +# Run objcopy on the linked file with the specified flags. +# This lets you transform the linked file using objcopy, before the +# result is analyzed by an analyzer program specified below (which +# may in turn *also* be objcopy). +# # PROG: PROGRAM-NAME # The name of the program to run to analyze the .o file produced # by the assembler or the linker output. This can be omitted; @@ -503,6 +509,7 @@ proc run_dump_test { name } { } set dumpfile tmpdir/dump.out set run_ld 0 + set run_objcopy 0 set opts(as) {} set opts(ld) {} set opts(xfail) {} @@ -516,6 +523,7 @@ proc run_dump_test { name } { set opts(PROG) {} set opts(source) {} set opts(error) {} + set opts(objcopy_linked_file) {} set asflags{${file}.s} {} foreach i $opt_array { @@ -552,6 +560,10 @@ proc run_dump_test { name } { if { $opt_name == "ld" } { set run_ld 1 } + # Likewise objcopy_linked_file. + if { $opt_name == "objcopy_linked_file" } { + set run_objcopy 1 + } } } set opts($opt_name) [concat $opts($opt_name) $opt_val] @@ -683,7 +695,7 @@ proc run_dump_test { name } { verbose -log "failed with: <$comp_output>, expected: <$opts(error)>" send_log "$comp_output\n" verbose "$comp_output" 3 - if { $opts(error) != "" } { + if { $opts(error) != "" && $run_objcopy == 0 } { if [regexp $opts(error) $comp_output] { pass $testname return @@ -692,6 +704,33 @@ proc run_dump_test { name } { fail $testname return } + + if { $run_objcopy } { + set infile $objfile + set objfile "tmpdir/dump1" + + # Note that we don't use OBJCOPYFLAGS here; any flags must be + # explicitly specified. + set cmd "$OBJCOPY $opts(objcopy_linked_file) $infile $objfile" + + send_log "$cmd\n" + set cmdret [catch "exec $cmd" comp_output] + set comp_output [prune_warnings $comp_output] + + if { $cmdret != 0 || ![string match "" $comp_output] } then { + verbose -log "failed with: <$comp_output>, expected: <$opts(error)>" + send_log "$comp_output\n" + verbose "$comp_output" 3 + if { $opts(error) != "" } { + if [regexp $opts(error) $comp_output] { + pass $testname + return + } + } + fail $testname + return + } + } } else { set objfile "tmpdir/dump0.o" } @@ -699,6 +738,7 @@ proc run_dump_test { name } { # We must not have expected failure if we get here. if { $opts(error) != "" } { fail $testname + return } if { [which $binary] == 0 } { @@ -754,8 +794,8 @@ proc slurp_options { file } { set ws {[ ]*} set nws {[^ ]*} # whitespace is ignored anywhere except within the options list; - # option names are alphabetic only - set pat "^#${ws}(\[a-zA-Z\]*)$ws:${ws}(.*)$ws\$" + # option names are alphabetic plus underscore only. + set pat "^#${ws}(\[a-zA-Z_\]*)$ws:${ws}(.*)$ws\$" while { [gets $f line] != -1 } { set line [string trim $line] # Whitespace here is space-tab. diff -uprN binutils-2.11.90.0.31/libiberty/ChangeLog binutils-2.11.92.0.5/libiberty/ChangeLog --- binutils-2.11.90.0.31/libiberty/ChangeLog Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/libiberty/ChangeLog Mon Oct 1 15:25:26 2001 @@ -1,3 +1,91 @@ +2001-09-29 DJ Delorie + + * configure: Regenerate. + +2001-09-28 Kaveh R. Ghazi + + * concat.c: Include stdlib.h. + +2001-09-27 Eli Zaretskii + + * libiberty.texi: (Top level): Add syncodeindex pg. Add + @dircategory and @direntry directives. Add @finalout. + (many nodes): Lose the next,prev,up pointers on the @nide line. + (Using, Supplemental Functions, Replacement Functions): Fix + markup. + (Functions): Move around, to allow makeinfo to build the manual + without next,prev,up pointers in thye node lines. + (Licenses): Fix typos. + + * index.c, rindex.c, strchr.c, strerror.c, strrchr.c, strstr.c, + strtol.c, xatexit.c, xexit.c, xmalloc.c: Fix spelling and markup. + * functions.texi: Regenerate. + + * copying-lib.texi: Lose the next,prev,up pointers on the @node + line. + +2001-09-27 DJ Delorie + + * configure.in: Don't use in-tree texinfo, because libiberty must + be built before it. Check for makeinfo version 4 or higher. + * functions.texi: Regenerate. + +2001-09-20 DJ Delorie + Phil Edwards + + * configure.in (MAKEINFO, PERL): Detect these. + (--enable-maintainer-mode): Add. + * configure: Regenerate. + * Makefile.in (MAKEINFO, PERL): Define. + (libiberty.info, libiberty.dvi, libiberty.html): New. + (CFILES): Add bsearch.c. + (CONFIGURED_OFILES): New, list of objects configure might add. + (maint-missing, maint-buildall): New, for maintainers only. + (clean, mostlyclean): Add info/dvi/html files. + * libiberty.texi, copying-lib.texi, obstacks.texi, functions.texi: New. + * gather-docs: New, for maintainers. + * maint-tool: New, for maintainers. + * alloca.c, atexit.c, basename.c, bcmp.c, bcopy.c, bsearch.c, + bzero.c, calloc.c, clock.c, configure.in, configure, getcwd.c, + getpagesize.c, getpwd.c, index.c, memchr.c, memcmp.c, memcpy.c, + memmove.c, memset.c, putenv.c, rename.c, rindex.c, setenv.c, + sigsetmask.c, strcasecmp.c, strchr.c, strdup.c, strerror.c, + strncasecmp.c, strncmp.c, strrchr.c, strstr.c, strtod.c, strtol.c, + tmpnam.c, vfork.c, vprintf.c, waitpid.c, xatexit.c, xexit.c, + xmalloc.c, xmemdup.c, xstrdup.c, xstrerror.c: Add or update + documentation. + +2001-09-25 Kaveh R. Ghazi + + * concat.c (reconcat): Fix for traditional C. + +2001-09-24 Kaveh R. Ghazi + + * concat.c (reconcat): New function. + +2001-09-17 Kaveh R. Ghazi + + * concat.c (vconcat_length, vconcat_copy, concat_length, + concat_copy, concat_copy2): New functions. + (concat): Use vconcat_length/vconcat_copy. + + * alloca.c (libiberty_optr, libiberty_nptr, libiberty_len): + Define. + +2001-09-17 Kaveh R. Ghazi + + * alloca.c (libiberty_optr, libiberty_nptr, libiberty_len): + Define. + +2001-09-04 Kaveh R. Ghazi + + * asprintf.c: Don't define USE_STDARG. Use VPARAMS, VA_OPEN, + VA_FIXEDARG & VA_CLOSE. + + * vasprintf.c: Check HAVE_STRING_H when including string.h. + (checkit): Delete redundant prototype. Add ATTRIBUTE_PRINTF_1. + Use VA_OPEN, VA_FIXEDARG & VA_CLOSE. Free allocated string. + 2001-08-27 Kaveh R. Ghazi * concat.c (concat): Use VPARAMS, VA_OPEN, VA_FIXEDARG & VA_CLOSE. diff -uprN binutils-2.11.90.0.31/libiberty/Makefile.in binutils-2.11.92.0.5/libiberty/Makefile.in --- binutils-2.11.90.0.31/libiberty/Makefile.in Mon Aug 27 11:44:52 2001 +++ binutils-2.11.92.0.5/libiberty/Makefile.in Mon Oct 1 15:25:26 2001 @@ -1,6 +1,6 @@ # # Makefile -# Copyright (C) 1990, 91-99, 2000 +# Copyright (C) 1990, 91-99, 2000, 2001 # Free Software Foundation # # This file is part of the libiberty library. @@ -57,6 +57,8 @@ CFLAGS = @CFLAGS@ LIBCFLAGS = $(CFLAGS) LOADLIBES = @LIBS@ RANLIB = @RANLIB@ +MAKEINFO = @MAKEINFO@ +PERL = @PERL@ PICFLAG = @@ -95,6 +97,7 @@ FLAGS_TO_PASS = \ # Subdirectories to recurse into. We need to override this during cleaning SUBDIRS = testsuite +# FIXME: add @BUILD_INFO@ once we're sure it works for everyone. all: stamp-picdir $(TARGETLIB) needed-list required-list all-subdir @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all @@ -113,16 +116,11 @@ COMPILE.c = $(CC) -c @DEFS@ $(LIBCFLAGS) else true; fi $(COMPILE.c) $< -info: info-subdir -install-info: install-info-subdir -clean-info: clean-info-subdir -dvi: dvi-subdir - # NOTE: If you add new files to the library, add them to this list # (alphabetical), and add them to REQUIRED_OFILES or funcs in # configure.in. CFILES = asprintf.c alloca.c argv.c atexit.c basename.c bcmp.c bcopy.c \ - bzero.c calloc.c choose-temp.c clock.c concat.c cplus-dem.c \ + bsearch.c bzero.c calloc.c choose-temp.c clock.c concat.c cplus-dem.c \ cp-demangle.c dyn-string.c fdmatch.c fnmatch.c ffs.c getcwd.c \ getpwd.c getopt.c getopt1.c getpagesize.c getruntime.c \ floatformat.c hashtab.c hex.c index.c insque.c lbasename.c \ @@ -145,12 +143,55 @@ REQUIRED_OFILES = argv.o alloca.o choose splay-tree.o strerror.o strsignal.o xatexit.o xexit.o xmalloc.o \ xmemdup.o xstrdup.o xstrerror.o ternary.o fibheap.o +# These are all the objects that configure may add to the library via +# $funcs. This list exists here only for "make maint-missing". +CONFIGURED_OFILES = asprintf.o atexit.o basename.o bcmp.o bcopy.o \ + bsearch.o bzero.o calloc.o clock.o ffs.o getcwd.o \ + getpagesize.o index.o insque.o memchr.o memcmp.o memcpy.o \ + memmove.o memset.o mkstemps.o putenv.o random.o rename.o \ + rindex.o setenv.o sigsetmask.o strcasecmp.o strchr.o strdup.o \ + strncasecmp.o strncmp.o strrchr.o strstr.o strtod.o strtol.o \ + strtoul.o tmpnam.o vasprintf.o vfork.o vfprintf.o vprintf.o \ + vsprintf.o waitpid.o + $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) -rm -f $(TARGETLIB) $(AR) $(AR_FLAGS) $(TARGETLIB) \ $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) $(RANLIB) $(TARGETLIB) +info: libiberty.info info-subdir +install-info: install-info-subdir +clean-info: clean-info-subdir +dvi: libiberty.dvi dvi-subdir +html: libiberty.html + +TEXISRC = \ + $(srcdir)/libiberty.texi \ + $(srcdir)/copying-lib.texi \ + $(srcdir)/obstacks.texi \ + $(srcdir)/functions.texi + +# Additional files that have texi snippets that need to be collected +# and sorted. +TEXIFILES = + +libiberty.info : $(srcdir)/libiberty.texi $(TEXISRC) + $(MAKEINFO) -I$(srcdir) $(srcdir)/libiberty.texi + +libiberty.dvi : $(srcdir)/libiberty.texi $(TEXISRC) + texi2dvi $(srcdir)/libiberty.texi + +libiberty.html : $(srcdir)/libiberty.texi $(TEXISRC) + $(MAKEINFO) --html -I$(srcdir) $(srcdir)/libiberty.texi + +@MAINT@$(srcdir)/functions.texi : stamp-functions +@MAINT@ @true + +@MAINT@stamp-functions : $(CFILES) $(TEXIFILES) $(srcdir)/gather-docs Makefile +@MAINT@@HAVE_PERL@ $(PERL) $(srcdir)/gather-docs $(srcdir) $(srcdir)/functions.texi $(CFILES) $(TEXIFILES) +@MAINT@ echo stamp > stamp-functions + INSTALL_DEST = @INSTALL_DEST@ install: install_to_$(INSTALL_DEST) install-subdir @@ -209,6 +250,14 @@ demangle: ls: @echo Makefile $(CFILES) +# Various targets for maintainers. + +maint-missing : + @$(PERL) $(srcdir)/maint-tool -s $(srcdir) missing $(CFILES) $(REQUIRED_OFILES) $(CONFIGURED_OFILES) + +maint-buildall : $(REQUIRED_OFILES) $(CONFIGURED_OFILES) + @true + # Need to deal with profiled libraries, too. # Cleaning has to be done carefully to ensure that we don't clean our SUBDIRS @@ -217,10 +266,15 @@ mostlyclean: mostlyclean-subdir -rm -rf *.o pic core errs \#* *.E a.out -rm -f needed.awk needed2.awk errors dummy needed-list config.h stamp-* -rm -f $(CONFIG_H) $(NEEDED_LIST) stamp-picdir + -rm -f libiberty.aux libiberty.cp libiberty.cps libiberty.fn libiberty.ky + -rm -f libiberty.log libiberty.tmp libiberty.tps libiberty.pg + -rm -f libiberty.pgs libiberty.toc libiberty.tp libiberty.tpl libiberty.vr + -rm -f libtexi.stamp @$(MULTICLEAN) multi-clean DO=mostlyclean clean: clean-subdir $(MAKE) SUBDIRS="" mostlyclean -rm -f *.a required-list tmpmulti.out + -rm -f libiberty.dvi libiberty.info* libiberty.html @$(MULTICLEAN) multi-clean DO=clean distclean: distclean-subdir $(MAKE) SUBDIRS="" clean diff -uprN binutils-2.11.90.0.31/libiberty/alloca.c binutils-2.11.92.0.5/libiberty/alloca.c --- binutils-2.11.90.0.31/libiberty/alloca.c Fri Mar 9 11:16:14 2001 +++ binutils-2.11.92.0.5/libiberty/alloca.c Mon Oct 1 15:25:26 2001 @@ -21,6 +21,27 @@ allocating any. It is a good idea to use alloca(0) in your main control loop, etc. to force garbage collection. */ +/* + +@deftypefn Replacement void* alloca (size_t) + +This function allocates memory which will be automatically reclaimed +after the procedure exits. The @libib{} implementation does not free +the memory immediately but will do so eventually during subsequent +calls to this function. Memory is allocated using @code{xmalloc} under +normal circumstances. + +The header file @file{alloca-conf.h} can be used in conjunction with the +GNU Autoconf test @code{AC_FUNC_ALLOCA} to test for and properly make +available this function. The @code{AC_FUNC_ALLOCA} test requires that +client code use a block of preprocessor code to be safe (see the Autoconf +manual for more); this header incorporates that logic and more, including +the possibility of a GCC builtin function. + +@end deftypefn + +*/ + #ifdef HAVE_CONFIG_H #include #endif @@ -34,6 +55,12 @@ #include #endif +/* These variables are used by the ASTRDUP implementation that relies + on C_alloca. */ +const char *libiberty_optr; +char *libiberty_nptr; +unsigned long libiberty_len; + /* If your stack is a linked list of frames, you have to provide an "address metric" ADDRESS_FUNCTION macro. */ diff -uprN binutils-2.11.90.0.31/libiberty/asprintf.c binutils-2.11.92.0.5/libiberty/asprintf.c --- binutils-2.11.90.0.31/libiberty/asprintf.c Thu Jun 3 11:02:11 1999 +++ binutils-2.11.92.0.5/libiberty/asprintf.c Mon Oct 1 15:25:26 2001 @@ -22,36 +22,20 @@ Boston, MA 02111-1307, USA. */ #include "ansidecl.h" #include "libiberty.h" -#if defined (ANSI_PROTOTYPES) || defined (ALMOST_STDC) -#define USE_STDARG -#endif - -#ifdef USE_STDARG +#ifdef ANSI_PROTOTYPES #include #else #include #endif -/* VARARGS */ -#ifdef USE_STDARG -int -asprintf (char **buf, const char *fmt, ...) -#else int -asprintf (buf, fmt, va_alist) - char **buf; - const char *fmt; - va_dcl -#endif +asprintf VPARAMS ((char **buf, const char *fmt, ...)) { int status; - va_list ap; -#ifdef USE_STDARG - va_start (ap, fmt); -#else - va_start (ap); -#endif + VA_OPEN (ap, fmt); + VA_FIXEDARG (ap, char **, buf); + VA_FIXEDARG (ap, const char *, fmt); status = vasprintf (buf, fmt, ap); - va_end (ap); + VA_CLOSE (ap); return status; } diff -uprN binutils-2.11.90.0.31/libiberty/atexit.c binutils-2.11.92.0.5/libiberty/atexit.c --- binutils-2.11.90.0.31/libiberty/atexit.c Thu Jun 3 11:02:11 1999 +++ binutils-2.11.92.0.5/libiberty/atexit.c Mon Oct 1 15:25:26 2001 @@ -1,6 +1,16 @@ /* Wrapper to implement ANSI C's atexit using SunOS's on_exit. */ /* This function is in the public domain. --Mike Stump. */ +/* + +@deftypefn Supplemental int atexit (void (*@var{f})()) + +Causes function @var{f} to be called at exit. Returns 0. + +@end deftypefn + +*/ + #include "config.h" #ifdef HAVE_ON_EXIT diff -uprN binutils-2.11.90.0.31/libiberty/basename.c binutils-2.11.92.0.5/libiberty/basename.c --- binutils-2.11.90.0.31/libiberty/basename.c Mon Dec 11 11:23:59 2000 +++ binutils-2.11.92.0.5/libiberty/basename.c Mon Oct 1 15:25:26 2001 @@ -2,20 +2,14 @@ This file is in the public domain. */ /* -NAME - basename -- return pointer to last component of a pathname -SYNOPSIS - char *basename (const char *name) +@deftypefn Supplemental char* basename (const char *@var{name}) + +Returns a pointer to the last component of pathname @var{name}. +Behavior is undefined if the pathname ends in a directory separator. + +@end deftypefn -DESCRIPTION - Given a pointer to a string containing a typical pathname - (/usr/src/cmd/ls/ls.c for example), returns a pointer to the - last component of the pathname ("ls.c" in this case). - -BUGS - Presumes a UNIX or DOS/Windows style path with UNIX or DOS/Windows - style separators. */ #include "ansidecl.h" diff -uprN binutils-2.11.90.0.31/libiberty/bcmp.c binutils-2.11.92.0.5/libiberty/bcmp.c --- binutils-2.11.90.0.31/libiberty/bcmp.c Thu Jun 3 11:02:11 1999 +++ binutils-2.11.92.0.5/libiberty/bcmp.c Mon Oct 1 15:25:26 2001 @@ -3,28 +3,15 @@ /* -NAME +@deftypefn Supplemental int bcmp (char *@var{x}, char *@var{y}, int @var{count}) - bcmp -- compare two memory regions +Compares the first @var{count} bytes of two areas of memory. Returns +zero if they are the same, non-zero otherwise. Returns zero if +@var{count} is zero. A non-zero result only indicates a difference, +it does not indicate any sorting order (say, by having a positive +result mean @var{x} sorts before @var{y}). -SYNOPSIS - - int bcmp (char *from, char *to, int count) - -DESCRIPTION - - Compare two memory regions and return zero if they are identical, - non-zero otherwise. If count is zero, return zero. - -NOTES - - No guarantee is made about the non-zero returned value. In - particular, the results may be signficantly different than - strcmp(), where the return value is guaranteed to be less than, - equal to, or greater than zero, according to lexicographical - sorting of the compared regions. - -BUGS +@end deftypefn */ diff -uprN binutils-2.11.90.0.31/libiberty/bcopy.c binutils-2.11.92.0.5/libiberty/bcopy.c --- binutils-2.11.90.0.31/libiberty/bcopy.c Thu Jun 3 11:02:11 1999 +++ binutils-2.11.92.0.5/libiberty/bcopy.c Mon Oct 1 15:25:26 2001 @@ -1,19 +1,11 @@ /* bcopy -- copy memory regions of arbitary length -NAME - bcopy -- copy memory regions of arbitrary length +@deftypefn Supplemental void bcopy (char *@var{in}, char *@var{out}, int @var{length}) -SYNOPSIS - void bcopy (char *in, char *out, int length) +Copies @var{length} bytes from memory region @var{in} to region +@var{out}. The use of @code{bcopy} is deprecated in new programs. -DESCRIPTION - Copy LENGTH bytes from memory region pointed to by IN to memory - region pointed to by OUT. - -BUGS - Significant speed improvements can be made in some cases by - implementing copies of multiple bytes simultaneously, or unrolling - the copy loop. +@end deftypefn */ diff -uprN binutils-2.11.90.0.31/libiberty/bsearch.c binutils-2.11.92.0.5/libiberty/bsearch.c --- binutils-2.11.90.0.31/libiberty/bsearch.c Fri Dec 29 12:29:18 2000 +++ binutils-2.11.92.0.5/libiberty/bsearch.c Mon Oct 1 15:25:26 2001 @@ -28,6 +28,23 @@ * SUCH DAMAGE. */ +/* + +@deftypefn Supplemental void* bsearch (const void *@var{key}, const void *@var{base}, size_t @var{nmemb}, size_t @var{size}, int (*@var{compar})(const void *, const void *)) + +Performs a search over an array of @var{nmemb} elements pointed to by +@var{base} for a member that matches the object pointed to by @var{key}. +The size of each member is specified by @var{size}. The array contents +should be sorted in ascending order according to the @var{compar} +comparison function. This routine should take two arguments pointing to +the @var{key} and to an array member, in that order, and should return an +integer less than, equal to, or greater than zero if the @var{key} object +is respectively less than, matching, or greater than the array member. + +@end deftypefn + +*/ + #include "config.h" #include "ansidecl.h" #include /* size_t */ diff -uprN binutils-2.11.90.0.31/libiberty/bzero.c binutils-2.11.92.0.5/libiberty/bzero.c --- binutils-2.11.90.0.31/libiberty/bzero.c Thu Jun 3 11:02:11 1999 +++ binutils-2.11.92.0.5/libiberty/bzero.c Mon Oct 1 15:25:26 2001 @@ -2,19 +2,13 @@ This function is in the public domain. */ /* -NAME - bzero -- zero the contents of a specified memory region -SYNOPSIS - void bzero (char *to, int count) +@deftypefn Supplemental void bzero (char *@var{mem}, int @var{count}) -DESCRIPTION - Zero COUNT bytes of memory pointed to by TO. +Zeros @var{count} bytes starting at @var{mem}. Use of this function +is deprecated in favor of @code{memset}. -BUGS - Significant speed enhancements may be made in some environments - by zeroing more than a single byte at a time, or by unrolling the - loop. +@end deftypefn */ diff -uprN binutils-2.11.90.0.31/libiberty/calloc.c binutils-2.11.92.0.5/libiberty/calloc.c --- binutils-2.11.90.0.31/libiberty/calloc.c Thu Feb 24 11:11:27 2000 +++ binutils-2.11.92.0.5/libiberty/calloc.c Mon Oct 1 15:25:26 2001 @@ -1,5 +1,16 @@ /* calloc -- allocate memory which has been initialized to zero. This function is in the public domain. */ + +/* + +@deftypefn Supplemental void* calloc (size_t @var{nelem}, size_t @var{elsize}) + +Uses @code{malloc} to allocate storage for @var{nelem} objects of +@var{elsize} bytes each, then zeros the memory. + +@end deftypefn + +*/ #include "ansidecl.h" #include "libiberty.h" diff -uprN binutils-2.11.90.0.31/libiberty/clock.c binutils-2.11.92.0.5/libiberty/clock.c --- binutils-2.11.90.0.31/libiberty/clock.c Thu Jun 3 11:02:11 1999 +++ binutils-2.11.92.0.5/libiberty/clock.c Mon Oct 1 15:25:26 2001 @@ -22,6 +22,18 @@ the resulting executable to be covered b This exception does not however invalidate any other reasons why the executable file might be covered by the GNU General Public License. */ +/* + +@deftypefn Supplemental long clock () + +Returns an approximation of the CPU time used by the process as a +@code{clock_t}; divide this number by @samp{CLOCKS_PER_SEC} to get the +number of seconds used. + +@end deftypefn + +*/ + #include "config.h" #ifdef HAVE_GETRUSAGE diff -uprN binutils-2.11.90.0.31/libiberty/concat.c binutils-2.11.92.0.5/libiberty/concat.c --- binutils-2.11.90.0.31/libiberty/concat.c Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/libiberty/concat.c Mon Oct 1 15:25:26 2001 @@ -74,38 +74,126 @@ NOTES # endif # endif +#if HAVE_STDLIB_H +#include +#endif + +static inline unsigned long vconcat_length PARAMS ((const char *, va_list)); +static inline unsigned long +vconcat_length (first, args) + const char *first; + va_list args; +{ + unsigned long length = 0; + const char *arg; + + for (arg = first; arg ; arg = va_arg (args, const char *)) + length += strlen (arg); + + return length; +} + +static inline char *vconcat_copy PARAMS ((char *, const char *, va_list)); +static inline char * +vconcat_copy (dst, first, args) + char *dst; + const char *first; + va_list args; +{ + char *end = dst; + const char *arg; + + for (arg = first; arg ; arg = va_arg (args, const char *)) + { + unsigned long length = strlen (arg); + memcpy (end, arg, length); + end += length; + } + *end = '\000'; + + return dst; +} + +unsigned long +concat_length VPARAMS ((const char *first, ...)) +{ + unsigned long length; + + VA_OPEN (args, first); + VA_FIXEDARG (args, const char *, first); + length = vconcat_length (first, args); + VA_CLOSE (args); + + return length; +} + +char * +concat_copy VPARAMS ((char *dst, const char *first, ...)) +{ + char *save_dst; + + VA_OPEN (args, first); + VA_FIXEDARG (args, char *, dst); + VA_FIXEDARG (args, const char *, first); + vconcat_copy (dst, first, args); + save_dst = dst; /* With K&R C, dst goes out of scope here. */ + VA_CLOSE (args); + + return save_dst; +} + +char *libiberty_concat_ptr; + +char * +concat_copy2 VPARAMS ((const char *first, ...)) +{ + VA_OPEN (args, first); + VA_FIXEDARG (args, const char *, first); + vconcat_copy (libiberty_concat_ptr, first, args); + VA_CLOSE (args); + + return libiberty_concat_ptr; +} + char * concat VPARAMS ((const char *first, ...)) { - register size_t length; - register char *newstr; - register char *end; - register const char *arg; + char *newstr; /* First compute the size of the result and get sufficient memory. */ VA_OPEN (args, first); VA_FIXEDARG (args, const char *, first); - - length = 0; - for (arg = first; arg ; arg = va_arg (args, const char *)) - length += strlen (arg); + newstr = (char *) xmalloc (vconcat_length (first, args) + 1); + VA_CLOSE (args); + /* Now copy the individual pieces to the result string. */ + VA_OPEN (args, first); + VA_FIXEDARG (args, const char *, first); + vconcat_copy (newstr, first, args); VA_CLOSE (args); - newstr = (char *) xmalloc (length + 1); + return newstr; +} + +char * +reconcat VPARAMS ((char *optr, const char *first, ...)) +{ + char *newstr; - /* Now copy the individual pieces to the result string. */ + /* First compute the size of the result and get sufficient memory. */ VA_OPEN (args, first); + VA_FIXEDARG (args, char *, optr); VA_FIXEDARG (args, const char *, first); + newstr = (char *) xmalloc (vconcat_length (first, args) + 1); + VA_CLOSE (args); - end = newstr; - for (arg = first; arg ; arg = va_arg (args, const char *)) - { - length = strlen (arg); - memcpy (end, arg, length); - end += length; - } - *end = '\000'; + /* Now copy the individual pieces to the result string. */ + VA_OPEN (args, first); + VA_FIXEDARG (args, char *, optr); + VA_FIXEDARG (args, const char *, first); + vconcat_copy (newstr, first, args); + if (optr) /* Done before VA_CLOSE so optr stays in scope for K&R C. */ + free (optr); VA_CLOSE (args); return newstr; diff -uprN binutils-2.11.90.0.31/libiberty/configure binutils-2.11.92.0.5/libiberty/configure --- binutils-2.11.90.0.31/libiberty/configure Mon Aug 27 11:44:52 2001 +++ binutils-2.11.92.0.5/libiberty/configure Mon Oct 1 15:25:26 2001 @@ -17,6 +17,10 @@ ac_help="$ac_help --with-cross-host=HOST Configuring with a cross compiler" ac_help="$ac_help --with-newlib Configuring with newlib" +ac_help="$ac_help + --enable-maintainer-mode + enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -581,13 +585,114 @@ ac_configure=$ac_aux_dir/configure # Thi +echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 +echo "configure:590: checking whether to enable maintainer-specific portions of Makefiles" >&5 + # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval="$enable_maintainer_mode" + maintainer_mode=$enableval +else + maintainer_mode=no +fi + + +echo "$ac_t""$maintainer_mode" 1>&6 + +if test "$maintainer_mode" = "yes"; then + MAINT='' + NOTMAINT='#' +else + MAINT='#' + NOTMAINT='' +fi + +# Do we have a single-tree copy of texinfo? Even if we do, we can't +# rely on it - libiberty is built before texinfo. +# Extract the first word of "makeinfo", so it can be a program name with args. +set dummy makeinfo; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:615: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_MAKEINFO'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$MAKEINFO"; then + ac_cv_prog_MAKEINFO="$MAKEINFO" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_MAKEINFO="makeinfo" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +MAKEINFO="$ac_cv_prog_MAKEINFO" +if test -n "$MAKEINFO"; then + echo "$ac_t""$MAKEINFO" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +BUILD_INFO=info +case x"`$MAKEINFO --version | grep 'GNU texinfo'`" in + x*\ [1-3].* ) + MAKEINFO="@echo $MAKEINFO is too old, 4.0 or newer required ;true" + BUILD_INFO= + echo "configure: warning: +*** Makeinfo is too old. Info documentation will not be built." 1>&2 + ;; +esac + + + +# Extract the first word of "perl", so it can be a program name with args. +set dummy perl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:656: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_PERL'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$PERL"; then + ac_cv_prog_PERL="$PERL" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_PERL="perl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +PERL="$ac_cv_prog_PERL" +if test -n "$PERL"; then + echo "$ac_t""$PERL" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test x"$PERL" = x""; then + HAVE_PERL='#' +else + HAVE_PERL='' +fi + + + # Make sure we can run config.sub. if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:591: checking host system type" >&5 +echo "configure:696: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -610,7 +715,7 @@ echo "$ac_t""$host" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:614: checking build system type" >&5 +echo "configure:719: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -636,7 +741,7 @@ fi # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:640: checking for $ac_word" >&5 +echo "configure:745: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -668,7 +773,7 @@ fi # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:672: checking for $ac_word" >&5 +echo "configure:777: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -700,7 +805,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:704: checking for $ac_word" >&5 +echo "configure:809: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -737,7 +842,7 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:741: checking for $ac_word" >&5 +echo "configure:846: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -767,7 +872,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:771: checking for $ac_word" >&5 +echo "configure:876: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -816,7 +921,7 @@ fi fi echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:820: checking whether we are using GNU C" >&5 +echo "configure:925: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -825,7 +930,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:829: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:934: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -841,7 +946,7 @@ if test $ac_cv_prog_gcc = yes; then ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:845: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:950: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -872,7 +977,7 @@ fi echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:876: checking for POSIXized ISC" >&5 +echo "configure:981: checking for POSIXized ISC" >&5 if test -d /etc/conf/kconfig.d && grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 then @@ -893,12 +998,12 @@ else fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:897: checking for working const" >&5 +echo "configure:1002: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1056: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -968,21 +1073,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:972: checking for inline" >&5 +echo "configure:1077: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1091: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -1025,7 +1130,7 @@ esac # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1029: checking for a BSD compatible install" >&5 +echo "configure:1134: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1086,7 +1191,7 @@ host_makefile_frag=${frag} # able to link anything, it had better be able to at least compile # something. echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1090: checking how to run the C preprocessor" >&5 +echo "configure:1195: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1101,13 +1206,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1111: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1216: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1118,13 +1223,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1128: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1233: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1135,13 +1240,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1145: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1250: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1169,17 +1274,17 @@ for ac_hdr in sys/file.h sys/param.h lim do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1173: checking for $ac_hdr" >&5 +echo "configure:1278: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1183: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1288: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1206,12 +1311,12 @@ fi done echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:1210: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:1315: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1227,7 +1332,7 @@ wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:1231: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1336: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -1248,12 +1353,12 @@ EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:1252: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:1357: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1262,7 +1367,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:1266: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1371: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -1284,19 +1389,19 @@ fi echo $ac_n "checking whether errno must be declared""... $ac_c" 1>&6 -echo "configure:1288: checking whether errno must be declared" >&5 +echo "configure:1393: checking whether errno must be declared" >&5 if eval "test \"`echo '$''{'libiberty_cv_declare_errno'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { int x = errno; ; return 0; } EOF -if { (eval echo configure:1300: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1405: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libiberty_cv_declare_errno=no else @@ -1318,12 +1423,12 @@ fi echo $ac_n "checking whether weak symbol works""... $ac_c" 1>&6 -echo "configure:1322: checking whether weak symbol works" >&5 +echo "configure:1427: checking whether weak symbol works" >&5 if eval "test \"`echo '$''{'libiberty_cv_have_weak_symbol'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1441: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libiberty_cv_have_weak_symbol=no else @@ -1356,14 +1461,14 @@ if test $libiberty_cv_have_weak_symbol = # demangler may use dlopen. echo $ac_n "checking for library containing dlopen""... $ac_c" 1>&6 -echo "configure:1360: checking for library containing dlopen" >&5 +echo "configure:1465: checking for library containing dlopen" >&5 if eval "test \"`echo '$''{'ac_cv_search_dlopen'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_func_search_save_LIBS="$LIBS" ac_cv_search_dlopen="no" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1483: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_dlopen="none required" else @@ -1385,7 +1490,7 @@ rm -f conftest* test "$ac_cv_search_dlopen" = "no" && for i in dl; do LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1505: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_dlopen="-l$i" break @@ -1482,12 +1587,12 @@ if test "x" = "y"; then for ac_func in asprintf atexit basename bcmp bcopy bsearch bzero calloc clock do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1486: checking for $ac_func" >&5 +echo "configure:1591: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1619: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1537,12 +1642,12 @@ done for ac_func in getcwd getpagesize index insque mkstemps memchr memcmp memcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1541: checking for $ac_func" >&5 +echo "configure:1646: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1674: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1592,12 +1697,12 @@ done for ac_func in memmove memset putenv random rename rindex sigsetmask do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1596: checking for $ac_func" >&5 +echo "configure:1701: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1729: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1647,12 +1752,12 @@ done for ac_func in strcasecmp setenv strchr strdup strncasecmp strrchr strstr do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1651: checking for $ac_func" >&5 +echo "configure:1756: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1784: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1702,12 +1807,12 @@ done for ac_func in strtod strtol strtoul tmpnam vasprintf vfprintf vprintf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1706: checking for $ac_func" >&5 +echo "configure:1811: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1839: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1757,12 +1862,12 @@ done for ac_func in vsprintf waitpid getrusage on_exit psignal strerror strsignal do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1761: checking for $ac_func" >&5 +echo "configure:1866: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1894: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1812,12 +1917,12 @@ done for ac_func in sysconf times sbrk gettimeofday ffs do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1816: checking for $ac_func" >&5 +echo "configure:1921: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1949: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2037,7 +2142,7 @@ if test -z "${setobjs}"; then # We haven't set the list of objects yet. Use the standard autoconf # tests. This will only work if the compiler works. echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2041: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:2146: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -2048,12 +2153,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 2052 "configure" +#line 2157 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:2057: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2162: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -2079,19 +2184,19 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2083: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2188: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross for ac_func in $funcs do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2090: checking for $ac_func" >&5 +echo "configure:2195: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2223: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2141,12 +2246,12 @@ done echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:2145: checking whether alloca needs Cray hooks" >&5 +echo "configure:2250: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2175: checking for $ac_func" >&5 +echo "configure:2280: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2308: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2225,7 +2330,7 @@ fi fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:2229: checking stack direction for C alloca" >&5 +echo "configure:2334: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2233,7 +2338,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2361: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -2273,12 +2378,12 @@ EOF echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:2277: checking for ANSI C header files" >&5 +echo "configure:2382: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2286,7 +2391,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2290: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2395: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2303,7 +2408,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -2321,7 +2426,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -2342,7 +2447,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -2353,7 +2458,7 @@ if (XOR (islower (i), ISLOWER (i)) || to exit (0); } EOF -if { (eval echo configure:2357: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2462: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -2377,12 +2482,12 @@ EOF fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:2381: checking for pid_t" >&5 +echo "configure:2486: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -2411,17 +2516,17 @@ fi ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 -echo "configure:2415: checking for vfork.h" >&5 +echo "configure:2520: checking for vfork.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2425: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2530: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2446,18 +2551,18 @@ else fi echo $ac_n "checking for working vfork""... $ac_c" 1>&6 -echo "configure:2450: checking for working vfork" >&5 +echo "configure:2555: checking for working vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then echo $ac_n "checking for vfork""... $ac_c" 1>&6 -echo "configure:2456: checking for vfork" >&5 +echo "configure:2561: checking for vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2589: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_vfork=yes" else @@ -2502,7 +2607,7 @@ fi ac_cv_func_vfork_works=$ac_cv_func_vfork else cat > conftest.$ac_ext < @@ -2597,7 +2702,7 @@ main() { } } EOF -if { (eval echo configure:2601: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2706: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_vfork_works=yes else @@ -2624,19 +2729,19 @@ fi fi for v in $vars; do echo $ac_n "checking for $v""... $ac_c" 1>&6 -echo "configure:2628: checking for $v" >&5 +echo "configure:2733: checking for $v" >&5 if eval "test \"`echo '$''{'libiberty_cv_var_$v'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2745: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "libiberty_cv_var_$v=yes" else @@ -2662,12 +2767,12 @@ EOF for ac_func in $checkfuncs do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2666: checking for $ac_func" >&5 +echo "configure:2771: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2720,17 +2825,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2724: checking for $ac_hdr" >&5 +echo "configure:2829: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2734: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2839: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2759,12 +2864,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2763: checking for $ac_func" >&5 +echo "configure:2868: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2896: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2812,7 +2917,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:2816: checking for working mmap" >&5 +echo "configure:2921: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2820,7 +2925,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3069: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -2984,7 +3089,7 @@ fi echo $ac_n "checking for working strncmp""... $ac_c" 1>&6 -echo "configure:2988: checking for working strncmp" >&5 +echo "configure:3093: checking for working strncmp" >&5 if eval "test \"`echo '$''{'ac_cv_func_strncmp_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2992,7 +3097,7 @@ else ac_cv_func_strncmp_works=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3162: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_strncmp_works=yes else @@ -3217,6 +3322,12 @@ s%@includedir@%$includedir%g s%@oldincludedir@%$oldincludedir%g s%@infodir@%$infodir%g s%@mandir@%$mandir%g +s%@MAINT@%$MAINT%g +s%@NOTMAINT@%$NOTMAINT%g +s%@MAKEINFO@%$MAKEINFO%g +s%@BUILD_INFO@%$BUILD_INFO%g +s%@PERL@%$PERL%g +s%@HAVE_PERL@%$HAVE_PERL%g s%@host@%$host%g s%@host_alias@%$host_alias%g s%@host_cpu@%$host_cpu%g diff -uprN binutils-2.11.90.0.31/libiberty/configure.in binutils-2.11.92.0.5/libiberty/configure.in --- binutils-2.11.90.0.31/libiberty/configure.in Mon Aug 27 11:44:52 2001 +++ binutils-2.11.92.0.5/libiberty/configure.in Mon Oct 1 15:25:26 2001 @@ -26,6 +26,52 @@ else fi AC_CONFIG_AUX_DIR($libiberty_topdir) +dnl Very limited version of automake's enable-maintainer-mode + +AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode is disabled by default + AC_ARG_ENABLE(maintainer-mode, +[ --enable-maintainer-mode + enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + maintainer_mode=$enableval, + maintainer_mode=no) + +AC_MSG_RESULT($maintainer_mode) + +if test "$maintainer_mode" = "yes"; then + MAINT='' + NOTMAINT='#' +else + MAINT='#' + NOTMAINT='' +fi +AC_SUBST(MAINT)dnl +AC_SUBST(NOTMAINT)dnl + +# Do we have a single-tree copy of texinfo? Even if we do, we can't +# rely on it - libiberty is built before texinfo. +AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, ) +BUILD_INFO=info +case x"`$MAKEINFO --version | grep 'GNU texinfo'`" in + x*\ [[1-3]].* ) + MAKEINFO="@echo $MAKEINFO is too old, 4.0 or newer required ;true" + BUILD_INFO= + AC_MSG_WARN([ +*** Makeinfo is too old. Info documentation will not be built.]) + ;; +esac +AC_SUBST(MAKEINFO) +AC_SUBST(BUILD_INFO) + +AC_CHECK_PROG(PERL, perl, perl, ) +if test x"$PERL" = x""; then + HAVE_PERL='#' +else + HAVE_PERL='' +fi +AC_SUBST(HAVE_PERL) + AC_CANONICAL_HOST dnl When we start using automake: diff -uprN binutils-2.11.90.0.31/libiberty/copying-lib.texi binutils-2.11.92.0.5/libiberty/copying-lib.texi --- binutils-2.11.90.0.31/libiberty/copying-lib.texi Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/libiberty/copying-lib.texi Mon Oct 1 15:25:26 2001 @@ -0,0 +1,565 @@ +@node Library Copying +@appendixsec GNU LESSER GENERAL PUBLIC LICENSE + +@cindex LGPL, Lesser General Public License +@center Version 2.1, February 1999 + +@display +Copyright @copyright{} 1991, 1999 Free Software Foundation, Inc. +59 Temple Place -- Suite 330, Boston, MA 02111-1307, USA + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts +as the successor of the GNU Library Public License, version 2, hence the +version number 2.1.] +@end display + +@appendixsubsec Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software---to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software---typically libraries---of the Free +Software Foundation and other authors who decide to use it. You can use +it too, but we suggest you first think carefully about whether this +license or the ordinary General Public License is the better strategy to +use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of it +in new free programs; and that you are informed that you can do these +things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the @dfn{Lesser} General Public License because it +does @emph{Less} to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +``work based on the library'' and a ``work that uses the library''. The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + +@iftex +@appendixsubsec TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION +@end iftex +@ifinfo +@center GNU LESSER GENERAL PUBLIC LICENSE +@center TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION +@end ifinfo + +@enumerate 0 +@item +This License Agreement applies to any software library or other program +which contains a notice placed by the copyright holder or other +authorized party saying it may be distributed under the terms of this +Lesser General Public License (also called ``this License''). Each +licensee is addressed as ``you''. + + A ``library'' means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The ``Library'', below, refers to any such software library or work +which has been distributed under these terms. A ``work based on the +Library'' means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term ``modification''.) + + ``Source code'' for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + +@item +You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + +@item +You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + +@enumerate a +@item +The modified work must itself be a software library. + +@item +You must cause the files modified to carry prominent notices +stating that you changed the files and the date of any change. + +@item +You must cause the whole of the work to be licensed at no +charge to all third parties under the terms of this License. + +@item +If a facility in the modified Library refers to a function or a +table of data to be supplied by an application program that uses +the facility, other than as an argument passed when the facility +is invoked, then you must make a good faith effort to ensure that, +in the event an application does not supply such function or +table, the facility still operates, and performs whatever part of +its purpose remains meaningful. + +(For example, a function in a library to compute square roots has +a purpose that is entirely well-defined independent of the +application. Therefore, Subsection 2d requires that any +application-supplied function or table used by this function must +be optional: if the application does not supply it, the square +root function must still compute square roots.) +@end enumerate + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + +@item +You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + +@item +You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + +@item +A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a ``work that uses the Library''. Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a ``work that uses the Library'' with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a ``work that uses the +library''. The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a ``work that uses the Library'' uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + +@item +As an exception to the Sections above, you may also combine or +link a ``work that uses the Library'' with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + +@enumerate a +@item +Accompany the work with the complete corresponding +machine-readable source code for the Library including whatever +changes were used in the work (which must be distributed under +Sections 1 and 2 above); and, if the work is an executable linked +with the Library, with the complete machine-readable ``work that +uses the Library'', as object code and/or source code, so that the +user can modify the Library and then relink to produce a modified +executable containing the modified Library. (It is understood +that the user who changes the contents of definitions files in the +Library will not necessarily be able to recompile the application +to use the modified definitions.) + +@item +Use a suitable shared library mechanism for linking with the Library. A +suitable mechanism is one that (1) uses at run time a copy of the +library already present on the user's computer system, rather than +copying library functions into the executable, and (2) will operate +properly with a modified version of the library, if the user installs +one, as long as the modified version is interface-compatible with the +version that the work was made with. + +@item +Accompany the work with a written offer, valid for at +least three years, to give the same user the materials +specified in Subsection 6a, above, for a charge no more +than the cost of performing this distribution. + +@item +If distribution of the work is made by offering access to copy +from a designated place, offer equivalent access to copy the above +specified materials from the same place. + +@item +Verify that the user has already received a copy of these +materials or that you have already sent this user a copy. +@end enumerate + + For an executable, the required form of the ``work that uses the +Library'' must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies the +executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + +@item +You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + +@enumerate a +@item +Accompany the combined library with a copy of the same work +based on the Library, uncombined with any other library +facilities. This must be distributed under the terms of the +Sections above. + +@item +Give prominent notice with the combined library of the fact +that part of it is a work based on the Library, and explaining +where to find the accompanying uncombined form of the same work. +@end enumerate + +@item +You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + +@item +You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + +@item +Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + +@item +If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + +@item +If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + +@item +The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +``any later version'', you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + +@item +If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + +@iftex +@heading NO WARRANTY +@end iftex +@ifinfo +@center NO WARRANTY +@end ifinfo + +@item +BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY ``AS IS'' WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +@item +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. +@end enumerate + +@iftex +@heading END OF TERMS AND CONDITIONS +@end iftex +@ifinfo +@center END OF TERMS AND CONDITIONS +@end ifinfo + +@page +@appendixsubsec How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +``copyright'' line and a pointer to where the full notice is found. + +@smallexample +@var{one line to give the library's name and an idea of what it does.} +Copyright (C) @var{year} @var{name of author} + +This library is free software; you can redistribute it and/or modify it +under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or (at +your option) any later version. + +This library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, +USA. +@end smallexample + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a ``copyright disclaimer'' for the library, if +necessary. Here is a sample; alter the names: + +@smallexample +Yoyodyne, Inc., hereby disclaims all copyright interest in the library +`Frob' (a library for tweaking knobs) written by James Random Hacker. + +@var{signature of Ty Coon}, 1 April 1990 +Ty Coon, President of Vice +@end smallexample + +That's all there is to it! diff -uprN binutils-2.11.90.0.31/libiberty/functions.texi binutils-2.11.92.0.5/libiberty/functions.texi --- binutils-2.11.90.0.31/libiberty/functions.texi Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/libiberty/functions.texi Mon Oct 1 15:25:26 2001 @@ -0,0 +1,516 @@ +@c Automatically generated from *.c and others (the comments before +@c each entry tell you which file and where in that file). DO NOT EDIT! +@c Edit the *.c files, configure with --enable-maintainer-mode, +@c and let gather-docs build you a new copy. + +@c alloca.c:26 +@deftypefn Replacement void* alloca (size_t) + +This function allocates memory which will be automatically reclaimed +after the procedure exits. The @libib{} implementation does not free +the memory immediately but will do so eventually during subsequent +calls to this function. Memory is allocated using @code{xmalloc} under +normal circumstances. + +The header file @file{alloca-conf.h} can be used in conjunction with the +GNU Autoconf test @code{AC_FUNC_ALLOCA} to test for and properly make +available this function. The @code{AC_FUNC_ALLOCA} test requires that +client code use a block of preprocessor code to be safe (see the Autoconf +manual for more); this header incorporates that logic and more, including +the possibility of a GCC builtin function. + +@end deftypefn + +@c atexit.c:6 +@deftypefn Supplemental int atexit (void (*@var{f})()) + +Causes function @var{f} to be called at exit. Returns 0. + +@end deftypefn + +@c basename.c:6 +@deftypefn Supplemental char* basename (const char *@var{name}) + +Returns a pointer to the last component of pathname @var{name}. +Behavior is undefined if the pathname ends in a directory separator. + +@end deftypefn + +@c bcmp.c:6 +@deftypefn Supplemental int bcmp (char *@var{x}, char *@var{y}, int @var{count}) + +Compares the first @var{count} bytes of two areas of memory. Returns +zero if they are the same, non-zero otherwise. Returns zero if +@var{count} is zero. A non-zero result only indicates a difference, +it does not indicate any sorting order (say, by having a positive +result mean @var{x} sorts before @var{y}). + +@end deftypefn + +@c bcopy.c:3 +@deftypefn Supplemental void bcopy (char *@var{in}, char *@var{out}, int @var{length}) + +Copies @var{length} bytes from memory region @var{in} to region +@var{out}. The use of @code{bcopy} is deprecated in new programs. + +@end deftypefn + +@c bsearch.c:33 +@deftypefn Supplemental void* bsearch (const void *@var{key}, const void *@var{base}, size_t @var{nmemb}, size_t @var{size}, int (*@var{compar})(const void *, const void *)) + +Performs a search over an array of @var{nmemb} elements pointed to by +@var{base} for a member that matches the object pointed to by @var{key}. +The size of each member is specified by @var{size}. The array contents +should be sorted in ascending order according to the @var{compar} +comparison function. This routine should take two arguments pointing to +the @var{key} and to an array member, in that order, and should return an +integer less than, equal to, or greater than zero if the @var{key} object +is respectively less than, matching, or greater than the array member. + +@end deftypefn + +@c bzero.c:6 +@deftypefn Supplemental void bzero (char *@var{mem}, int @var{count}) + +Zeros @var{count} bytes starting at @var{mem}. Use of this function +is deprecated in favor of @code{memset}. + +@end deftypefn + +@c calloc.c:6 +@deftypefn Supplemental void* calloc (size_t @var{nelem}, size_t @var{elsize}) + +Uses @code{malloc} to allocate storage for @var{nelem} objects of +@var{elsize} bytes each, then zeros the memory. + +@end deftypefn + +@c clock.c:27 +@deftypefn Supplemental long clock () + +Returns an approximation of the CPU time used by the process as a +@code{clock_t}; divide this number by @samp{CLOCKS_PER_SEC} to get the +number of seconds used. + +@end deftypefn + +@c strerror.c:566 +@deftypefn Replacement int errno_max (void) + +Returns the maximum @code{errno} value for which a corresponding +symbolic name or message is available. Note that in the case where we +use the @code{sys_errlist} supplied by the system, it is possible for +there to be more symbolic names than messages, or vice versa. In +fact, the manual page for @code{perror(3C)} explicitly warns that one +should check the size of the table (@code{sys_nerr}) before indexing +it, since new error codes may be added to the system before they are +added to the table. Thus @code{sys_nerr} might be smaller than value +implied by the largest @code{errno} value defined in @file{errno.h}. + +We return the maximum value that can be used to obtain a meaningful +symbolic name or message. + +@end deftypefn + +@c getcwd.c:6 +@deftypefn Supplemental char* getcwd (char *@var{pathname}, @var{len}) + +Copy the absolute pathname for the current working directory into +@var{pathname}, which is assumed to point to a buffer of at least +@var{len} bytes, and return a pointer to the buffer. If the current +directory's path doesn't fit in @var{len} characters, the result is +NULL and @var{errno} is set. If @var{pathname} is a null pointer, +@code{getcwd} will obtain @var{len} bytes of space using +@code{malloc}. + +@end deftypefn + +@c getpagesize.c:5 +@deftypefn Supplemental int getpagesize () + +Returns the number of bytes in a page of memory. This is the +granularity of many of the system memory management routines. No +guarantee is made as to whether or not it is the same as the basic +memory management hardware page size. + +@end deftypefn + +@c getpwd.c:5 +@deftypefn Supplemental char* getpwd () + +Returns the current working directory. This implementation caches the +result on the assumption that the process will not call @code{chdir} +between calls to @code{getpwd}. + +@end deftypefn + +@c index.c:5 +@deftypefn Supplemental char* index (char *@var{s}, int @var{c}) + +Returns a pointer to the first occurrence of the character @var{c} in +the string @var{s}, or NULL if not found. The use of @code{index} is +deprecated in new programs in favor of @code{strchr}. + +@end deftypefn + +@c memchr.c:3 +@deftypefn Supplemental void* memchr (const void *@var{s}, int @var{c}, size_t @var{n}) + +This function searches memory starting at @code{*}@var{src} for the +character @var{c}. The search only ends with the first occurrence of +@var{c}, or after @var{length} characters; in particular, a null +character does not terminate the search. If the character @var{c} is +found within @var{length} characters of @code{*}@var{src}, a pointer +to the character is returned. If @var{c} is not found, then NULL is +returned. + +@end deftypefn + +@c memcmp.c:6 +@deftypefn Supplemental int memcmp (const void *@var{x}, const void *@var{y}, size_t @var{count}) + +Compares the first @var{count} bytes of two areas of memory. Returns +zero if they are the same, a value less than zero if @var{x} is +lexically less than @var{y}, or a value greater than zero if @var{x} +is lexically greater than @var{y}. Note that lexical order is determined +as if comparing unsigned char arrays. + +@end deftypefn + +@c memcpy.c:6 +@deftypefn Supplemental void* memcpy (void *@var{out}, const void *@var{in}, size_t @var{length}) + +Copies @var{length} bytes from memory region @var{in} to region +@var{out}. Returns a pointer to @var{out}. + +@end deftypefn + +@c memmove.c:6 +@deftypefn Supplemental void* memmove (void *@var{from}, const void *@var{to}, size_t @var{count}) + +Copies @var{count} bytes from memory area @var{from} to memory area +@var{to}, returning a pointer to @var{to}. + +@end deftypefn + +@c memset.c:6 +@deftypefn Supplemental void* memset (void *@var{s}, int @var{c}, size_t @var{count}) + +Sets the first @var{count} bytes of @var{s} to the constant byte +@var{c}, returning a pointer to @var{s}. + +@end deftypefn + +@c putenv.c:21 +@deftypefn Supplemental int putenv (const char *@var{string}) + +Uses @code{setenv} or @code{unsetenv} to put @var{string} into +the environment or remove it. If @var{string} is of the form +@samp{name=value} the string is added; if no `=' is present the +name is unset/removed. + +@end deftypefn + +@c rename.c:6 +@deftypefn Supplemental int rename (const char *@var{old}, const char *@var{new}) + +Renames a file from @var{old} to @var{new}. If @var{new} already +exists, it is removed. + +@end deftypefn + +@c rindex.c:5 +@deftypefn Supplemental char* rindex (const char *@var{s}, int @var{c}) + +Returns a pointer to the last occurrence of the character @var{c} in +the string @var{s}, or NULL if not found. The use of @code{rindex} is +deprecated in new programs in favor of @code{strrchr}. + +@end deftypefn + +@c setenv.c:22 +@deftypefn Supplemental int setenv (const char *@var{name}, const char *@var{value}, int @var{overwrite}) +@deftypefnx Supplemental void unsetenv (const char *@var{name}) + +@code{setenv} adds @var{name} to the environment with value +@var{value}. If the name was already present in the environment, +the new value will be stored only if @var{overwrite} is non-zero. +The companion @code{unsetenv} function removes @var{name} from the +environment. This implementation is not safe for multithreaded code. + +@end deftypefn + +@c sigsetmask.c:8 +@deftypefn Supplemental int sigsetmask (int @var{set}) + +Sets the signal mask to the one provided in @var{set} and returns +the old mask (which, for libiberty's implementation, will always +be the value @code{1}). + +@end deftypefn + +@c strcasecmp.c:15 +@deftypefn Supplemental int strcasecmp (const char *@var{s1}, const char *@var{s2}) + +A case-insensitive @code{strcmp}. + +@end deftypefn + +@c strchr.c:6 +@deftypefn Supplemental char* strchr (const char *@var{s}, int @var{c}) + +Returns a pointer to the first occurrence of the character @var{c} in +the string @var{s}, or NULL if not found. If @var{c} is itself the +null character, the results are undefined. + +@end deftypefn + +@c strdup.c:3 +@deftypefn Supplemental char* strdup (const char *@var{s}) + +Returns a pointer to a copy of @var{s} in memory obtained from +@code{malloc}, or NULL if insufficient memory was available. + +@end deftypefn + +@c strerror.c:670 +@deftypefn Replacement const char* strerrno (int @var{errnum}) + +Given an error number returned from a system call (typically returned +in @code{errno}), returns a pointer to a string containing the +symbolic name of that error number, as found in @file{errno.h}. + +If the supplied error number is within the valid range of indices for +symbolic names, but no name is available for the particular error +number, then returns the string @samp{"Error @var{num}"}, where @var{num} +is the error number. + +If the supplied error number is not within the range of valid +indices, then returns NULL. + +The contents of the location pointed to are only guaranteed to be +valid until the next call to @code{strerrno}. + +@end deftypefn + +@c strerror.c:602 +@deftypefn Replacement char* strerror (int @var{errnoval}) + +Maps an @code{errno} number to an error message string, the contents +of which are implementation defined. On systems which have the +external variables @code{sys_nerr} and @code{sys_errlist}, these +strings will be the same as the ones used by @code{perror}. + +If the supplied error number is within the valid range of indices for +the @code{sys_errlist}, but no message is available for the particular +error number, then returns the string @samp{"Error @var{num}"}, where +@var{num} is the error number. + +If the supplied error number is not a valid index into +@code{sys_errlist}, returns NULL. + +The returned string is only guaranteed to be valid only until the +next call to @code{strerror}. + +@end deftypefn + +@c strncasecmp.c:15 +@deftypefn Supplemental int strncasecmp (const char *@var{s1}, const char *@var{s2}) + +A case-insensitive @code{strncmp}. + +@end deftypefn + +@c strncmp.c:6 +@deftypefn Supplemental int strncmp (const char *@var{s1}, const char *@var{s2}, size_t @var{n}) + +Compares the first @var{n} bytes of two strings, returning a value as +@code{strcmp}. + +@end deftypefn + +@c strrchr.c:6 +@deftypefn Supplemental char* strrchr (const char *@var{s}, int @var{c}) + +Returns a pointer to the last occurrence of the character @var{c} in +the string @var{s}, or NULL if not found. If @var{c} is itself the +null character, the results are undefined. + +@end deftypefn + +@c strstr.c:6 +@deftypefn Supplemental char* strstr (const char *@var{string}, const char *@var{sub}) + +This function searches for the substring @var{sub} in the string +@var{string}, not including the terminating null characters. A pointer +to the first occurrence of @var{sub} is returned, or NULL if the +substring is absent. If @var{sub} points to a string with zero +length, the function returns @var{string}. + +@end deftypefn + +@c strtod.c:27 +@deftypefn Supplemental double strtod (const char *@var{string}, char **@var{endptr}) + +This ANSI C function converts the initial portion of @var{string} to a +@code{double}. If @var{endptr} is not NULL, a pointer to the +character after the last character used in the conversion is stored in +the location referenced by @var{endptr}. If no conversion is +performed, zero is returned and the value of @var{string} is stored in +the location referenced by @var{endptr}. + +@end deftypefn + +@c strerror.c:730 +@deftypefn Replacement int strtoerrno (const char *@var{name}) + +Given the symbolic name of a error number (e.g., @code{EACCESS}), map it +to an errno value. If no translation is found, returns 0. + +@end deftypefn + +@c strtol.c:33 +@deftypefn Supplemental {long int} strtol (const char *@var{string}, char **@var{endptr}, int @var{base}) + +The @code{strtol} function converts the string in @var{string} to a +long integer value according to the given @var{base}, which must be +between 2 and 36 inclusive, or be the special value 0. If @var{base} +is 0, @code{strtol} will look for the prefixes @code{0} and @code{0x} +to indicate bases 8 and 16, respectively, else default to base 10. +When the base is 16 (either explicitly or implicitly), a prefix of +@code{0x} is allowed. The handling of @var{endptr} is as that of +@code{strtod} above. + +@end deftypefn + +@c tmpnam.c:3 +@deftypefn Supplemental char* tmpnam (char *@var{s}) + +This function attempts to create a name for a temporary file, which +will be a valid file name yet not exist when @code{tmpnam} checks for +it. @var{s} must point to a buffer of at least @code{L_tmpnam} bytes, +or be NULL. Use of this function creates a security risk, and it must +not be used in new projects. Use @code{mkstemp} instead. + +@end deftypefn + +@c vfork.c:6 +@deftypefn Supplemental int vfork () + +Emulates @code{vfork} by calling @code{fork} and returning its value. + +@end deftypefn + +@c vprintf.c:3 +@deftypefn Supplemental int vprintf (const char *@var{format}, va_list @var{ap}) +@deftypefnx Supplemental int vfprintf (FILE *@var{stream}, const char *@var{format}, va_list @var{ap}) +@deftypefnx Supplemental int vsprintf (char *@var{str}, const char *@var{format}, va_list @var{ap}) + +These functions are the same as @code{printf}, @code{fprintf}, and +@code{sprintf}, respectively, except that they are called with a +@code{va_list} instead of a variable number of arguments. Note that +they do not call @code{va_end}; this is the application's +responsibility. In @libib{} they are implemented in terms of the +nonstandard but common function @code{_doprnt}. + +@end deftypefn + +@c waitpid.c:3 +@deftypefn Supplemental int waitpid (int @var{pid}, int *@var{status}, int) + +This is a wrapper around the @code{wait} function. Any ``special'' +values of @var{pid} depend on your implementation of @code{wait}, as +does the return value. The third argument is unused in @libib{}. + +@end deftypefn + +@c xatexit.c:11 +@deftypefun int xatexit (void (*@var{fn}) (void)) + +Behaves as the standard @code{atexit} function, but with no limit on +the number of registered functions. Returns 0 on success, or -1 on +failure. If you use @code{xatexit} to register functions, you must use +@code{xexit} to terminate your program. + +@end deftypefun + +@c xmalloc.c:38 +@deftypefn Replacement void* xcalloc (size_t, size_t) + +Allocate memory without fail, and set it to zero. This routine functions +like @code{calloc}, but will behave the same as @code{xmalloc} if memory +cannot be found. + +@end deftypefn + +@c xexit.c:22 +@deftypefn Replacement void xexit (int @var{code}) + +Terminates the program. If any functions have been registered with +the @code{xatexit} replacement function, they will be called first. +Termination is handled via the system's normal @code{exit} call. + +@end deftypefn + +@c xmalloc.c:22 +@deftypefn Replacement void* xmalloc (size_t) + +Allocate memory without fail. If @code{malloc} fails, this will print +a message to @code{stderr} (using the name set by +@code{xmalloc_set_program_name}, +if any) and then call @code{xexit}. Note that it is therefore safe for +a program to contain @code{#define malloc xmalloc} in its source. + +@end deftypefn + +@c xmalloc.c:53 +@deftypefn Replacement void xmalloc_failed (size_t) + +This function is not meant to be called by client code, and is listed +here for completeness only. If any of the allocation routines fail, this +function will be called to print an error message and terminate execution. + +@end deftypefn + +@c xmalloc.c:46 +@deftypefn Replacement void xmalloc_set_program_name (const char *@var{name}) + +You can use this to set the name of the program used by +@code{xmalloc_failed} when printing a failure message. + +@end deftypefn + +@c xmemdup.c:7 +@deftypefn Replacement void* xmemdup (void *@var{input}, size_t @var{copy_size}, size_t @var{alloc_size}) + +Duplicates a region of memory without fail. First, @var{alloc_size} bytes +are allocated, then @var{copy_size} bytes from @var{input} are copied into +it, and the new memory is returned. If fewer bytes are copied than were +allocated, the remaining memory is zeroed. + +@end deftypefn + +@c xmalloc.c:32 +@deftypefn Replacement void* xrealloc (void*, size_t) +Reallocate memory without fail. This routine functions like @code{realloc}, +but will behave the same as @code{xmalloc} if memory cannot be found. + +@end deftypefn + +@c xstrdup.c:7 +@deftypefn Replacement char* xstrdup (const char *@var{s}) + +Duplicates a character string without fail, using @code{xmalloc} to +obtain memory. + +@end deftypefn + +@c xstrerror.c:7 +@deftypefn Replacement char* xstrerror (int @var{errnum}) + +Behaves exactly like the standard @code{strerror} function, but +will never return a NULL pointer. + +@end deftypefn + + diff -uprN binutils-2.11.90.0.31/libiberty/gather-docs binutils-2.11.92.0.5/libiberty/gather-docs --- binutils-2.11.90.0.31/libiberty/gather-docs Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/libiberty/gather-docs Mon Oct 1 15:25:26 2001 @@ -0,0 +1,128 @@ +#!/usr/bin/perl +# -*- perl -*- + +# Copyright (C) 2001 +# Free Software Foundation +# +# This file is part of the libiberty library. +# Libiberty is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# Libiberty is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with libiberty; see the file COPYING.LIB. If not, +# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. +# +# Originally written by DJ Delorie + + + +# This program looks for texinfo snippets in source files and other +# files, and builds per-category files with entries sorted in +# alphabetical order. + +# The syntax it looks for is lines starting with '@def' in *.c and +# other files (see TEXIFILES in Makefile.in). Entries are terminated +# at the next @def* (which begins a new entry) or, for C files, a line +# that begins with '*/' without leading spaces (this assumes that the +# texinfo snippet is within a C-style /* */ comment). + +# + + + +if ($ARGV[0] eq "-v") { + $verbose = 1; + shift; +} + +$srcdir = shift; +$outfile = shift; + +if ($outfile !~ /\S/ || ! -f "$srcdir/Makefile.in" ) { + print STDERR "Usage: gather-docs [-v] srcdir outfile.txi [files with snippets in them ...]\n"; + exit 1; +} + +$errors = 0; + +for $in (@ARGV) { + + if (!open(IN, "$srcdir/$in")) { + print STDERR "Cannot open $srcdir/$in for reading: $!\n"; + $errors ++; + + } else { + $first = 1; + $pertinent = 0; + $man_mode = 0; + $line = 0; + + while () { + $line ++; + $pertinent = 1 if /^\@def[a-z]*[a-wyz] /; + $pertinent = 0 if /^\*\//; + next unless $pertinent; + + if (/^\@def[a-z]*[a-wyz] /) { + + ($name) = m/[^\(]* ([^\( \t\r\n]+) *\(/; + $name =~ s/[ ]*$//; + $key = $name; + $key =~ tr/A-Z/a-z/; + $key =~ s/[^a-z0-9]+/ /g; + $name{$key} = $node; + $lines{$key} = ''; + $src_file{$key} = $in; + $src_line{$key} = $line; + print "\nReading $in :" if $verbose && $first; + $first = 0; + print " $name" if $verbose; + $node_lines{$key} .= $_; + + } else { + $node_lines{$key} .= $_; + } + + $pertinent = 0 if /^\@end def/; + } + close (IN); + } +} + +print "\n" if $verbose; +exit $errors if $errors; + +if (!open (OUT, "> $outfile")) { + print STDERR "Cannot open $outfile for writing: $!\n"; + $errors ++; + next; +} +print "Writing $outfile\n" if $verbose; + +print OUT "\@c Automatically generated from *.c and others (the comments before\n"; +print OUT "\@c each entry tell you which file and where in that file). DO NOT EDIT!\n"; +print OUT "\@c Edit the *.c files, configure with --enable-maintainer-mode,\n"; +print OUT "\@c and let gather-docs build you a new copy.\n\n"; + +for $key (sort keys %name) { + print OUT "\@c $src_file{$key}:$src_line{$key}\n"; + print OUT $node_lines{$key}; + print OUT "\n"; +} + +if (! print OUT "\n") { + print STDERR "Disk full writing $srcdir/$cat.texi\n"; + $errors ++; +} + +close (OUT); + +exit $errors; diff -uprN binutils-2.11.90.0.31/libiberty/getcwd.c binutils-2.11.92.0.5/libiberty/getcwd.c --- binutils-2.11.90.0.31/libiberty/getcwd.c Thu Jul 27 17:56:11 2000 +++ binutils-2.11.92.0.5/libiberty/getcwd.c Mon Oct 1 15:25:26 2001 @@ -2,24 +2,18 @@ This function is in the public domain. */ /* -NAME - getcwd -- get absolute pathname for current working directory -SYNOPSIS - char *getcwd (char pathname[len], len) +@deftypefn Supplemental char* getcwd (char *@var{pathname}, @var{len}) -DESCRIPTION - Copy the absolute pathname for the current working directory into - the supplied buffer and return a pointer to the buffer. If the - current directory's path doesn't fit in LEN characters, the result - is NULL and errno is set. - - If pathname is a null pointer, getcwd() will obtain size bytes of - space using malloc. - -BUGS - Emulated via the getwd() call, which is reasonable for most - systems that do not have getcwd(). +Copy the absolute pathname for the current working directory into +@var{pathname}, which is assumed to point to a buffer of at least +@var{len} bytes, and return a pointer to the buffer. If the current +directory's path doesn't fit in @var{len} characters, the result is +NULL and @var{errno} is set. If @var{pathname} is a null pointer, +@code{getcwd} will obtain @var{len} bytes of space using +@code{malloc}. + +@end deftypefn */ diff -uprN binutils-2.11.90.0.31/libiberty/getpagesize.c binutils-2.11.92.0.5/libiberty/getpagesize.c --- binutils-2.11.90.0.31/libiberty/getpagesize.c Thu Jun 3 11:02:12 1999 +++ binutils-2.11.92.0.5/libiberty/getpagesize.c Mon Oct 1 15:25:26 2001 @@ -2,20 +2,14 @@ /* -NAME +@deftypefn Supplemental int getpagesize () - getpagesize -- return the number of bytes in page of memory +Returns the number of bytes in a page of memory. This is the +granularity of many of the system memory management routines. No +guarantee is made as to whether or not it is the same as the basic +memory management hardware page size. -SYNOPSIS - - int getpagesize (void) - -DESCRIPTION - - Returns the number of bytes in a page of memory. This is the - granularity of many of the system memory management routines. - No guarantee is made as to whether or not it is the same as the - basic memory management hardware page size. +@end deftypefn BUGS diff -uprN binutils-2.11.90.0.31/libiberty/getpwd.c binutils-2.11.92.0.5/libiberty/getpwd.c --- binutils-2.11.90.0.31/libiberty/getpwd.c Thu Feb 24 11:11:29 2000 +++ binutils-2.11.92.0.5/libiberty/getpwd.c Mon Oct 1 15:25:26 2001 @@ -1,5 +1,17 @@ /* getpwd.c - get the working directory */ +/* + +@deftypefn Supplemental char* getpwd () + +Returns the current working directory. This implementation caches the +result on the assumption that the process will not call @code{chdir} +between calls to @code{getpwd}. + +@end deftypefn + +*/ + #ifdef HAVE_CONFIG_H #include "config.h" #endif diff -uprN binutils-2.11.90.0.31/libiberty/index.c binutils-2.11.92.0.5/libiberty/index.c --- binutils-2.11.90.0.31/libiberty/index.c Thu Jun 3 11:02:12 1999 +++ binutils-2.11.92.0.5/libiberty/index.c Mon Oct 1 15:25:26 2001 @@ -1,5 +1,17 @@ /* Stub implementation of (obsolete) index(). */ +/* + +@deftypefn Supplemental char* index (char *@var{s}, int @var{c}) + +Returns a pointer to the first occurrence of the character @var{c} in +the string @var{s}, or NULL if not found. The use of @code{index} is +deprecated in new programs in favor of @code{strchr}. + +@end deftypefn + +*/ + extern char * strchr(); char * diff -uprN binutils-2.11.90.0.31/libiberty/libiberty.texi binutils-2.11.92.0.5/libiberty/libiberty.texi --- binutils-2.11.90.0.31/libiberty/libiberty.texi Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/libiberty/libiberty.texi Mon Oct 1 15:25:26 2001 @@ -0,0 +1,324 @@ +\input texinfo @c -*-texinfo-*- +@c %**start of header +@setfilename libiberty.info +@settitle @sc{gnu} libiberty +@c %**end of header + +@syncodeindex fn cp +@syncodeindex vr cp +@syncodeindex pg cp + +@finalout +@c %**end of header + +@dircategory GNU libraries +@direntry +* Libiberty: (libiberty). Library of utility functions which + are missing or broken on some systems. +@end direntry + +@macro libib +@code{libiberty} +@end macro + +@c The edition date is written in three locations. Search for 'thedate'. +@ifinfo +This manual describes the GNU @libib library of utility subroutines. +This edition accompanies GCC 3, September 2001. + +Copyright @copyright{} 2001 Free Software Foundation, Inc. + + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.1 + or any later version published by the Free Software Foundation; + with no Invariant Sections, with no Front-Cover Texts, and with no + Back-Cover Texts. A copy of the license is included in the + section entitled ``GNU Free Documentation License''. + +@ignore +Permission is granted to process this file through TeX and print the +results, provided the printed document carries a copying permission +notice identical to this one except for the removal of this paragraph +(this paragraph not being relevant to the printed manual). + +@end ignore +@end ifinfo + + +@c The edition date is written in three locations. Search for 'thedate'. +@titlepage +@title @sc{gnu} libiberty +@subtitle September 2001 +@subtitle for GCC 3 +@author Phil Edwards et al. +@page + + +@vskip 0pt plus 1filll +Copyright @copyright{} 2001 Free Software Foundation, Inc. + + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.1 + or any later version published by the Free Software Foundation; + with no Invariant Sections, with no Front-Cover Texts, and with no + Back-Cover Texts. A copy of the license is included in the + section entitled ``GNU Free Documentation License''. + +@end titlepage + + +@ifnottex +@node Top,Using,, +@top Introduction + +The @libib{} library is a collection of subroutines used by various +GNU programs. It is available under the Library General Public +License; for more information, see @ref{Library Copying}. + +@c The edition date is written in three locations. Search for 'thedate'. +This edition accompanies GCC 3, September 2001. + +@end ifnottex + +@menu +* Using:: How to use libiberty in your code. + +* Overview:: Overview of available function groups. + +* Functions:: Available functions, macros, and global variables. + +* Obstacks:: Object Stacks. + +* Licenses:: The various licenses under which libiberty sources are + distributed. + +* Index:: Index of functions and categories. +@end menu + +@node Using +@chapter Using +@cindex using libiberty +@cindex libiberty usage +@cindex how to use + +@c THIS SECTION IS CRAP AND NEEDS REWRITING BADLY. + +To date, @libib{} is generally not installed on its own. It has evolved +over years but does not have its own version number nor release schedule. + +Possibly the easiest way to use @libib{} in your projects is to drop the +@libib{} code into your project's sources, and to build the library along +with your own sources; the library would then be linked in at the end. This +prevents any possible version mismatches with other copies of libiberty +elsewhere on the system. + +Passing @option{--enable-install-libiberty} to the @command{configure} +script when building @libib{} causes the header files and archive library +to be installed when @kbd{make install} is run. This option also takes +an (optional) argument to specify the installation location, in the same +manner as @option{--prefix}. + +For your own projects, an approach which offers stability and flexibility +is to include @libib{} with your code, but allow the end user to optionally +choose to use a previously-installed version instead. In this way the +user may choose (for example) to install @libib{} as part of GCC, and use +that version for all software built with that compiler. (This approach +has proven useful with software using the GNU @code{readline} library.) + +Making use of @libib{} code usually requires that you include one or more +header files from the @libib{} distribution. (They will be named as +necessary in the function descriptions.) At link time, you will need to +add @option{-liberty} to your link command invocation. + + +@node Overview +@chapter Overview + +Functions contained in @libib{} can be divided into three general categories. + + +@menu +* Supplemental Functions:: Providing functions which don't exist + on older operating systems. + +* Replacement Functions:: These functions are sometimes buggy or + unpredictable on some operating systems. + +* Extensions:: Functions which provide useful extensions + or safety wrappers around existing code. +@end menu + +@node Supplemental Functions +@section Supplemental Functions +@cindex supplemental functions +@cindex functions, supplemental +@cindex functions, missing + +Certain operating systems do not provide functions which have since +become standardized, or at least common. For example, the Single +Unix Specification Version 2 requires that the @code{basename} +function be provided, but an OS which predates that specification +might not have this function. This should not prevent well-written +code from running on such a system. + +Similarly, some functions exist only among a particular ``flavor'' +or ``family'' of operating systems. As an example, the @code{bzero} +function is often not present on systems outside the BSD-derived +family of systems. + +Many such functions are provided in @libib{}. They are quickly +listed here with little description, as systems which lack them +become less and less common. Each function @var{foo} is implemented +in @file{@var{foo}.c} but not declared in any @libib{} header file; more +comments and caveats for each function's implementation are often +available in the source file. Generally, the function can simply +be declared as @code{extern}. + + + +@node Replacement Functions +@section Replacement Functions +@cindex replacement functions +@cindex functions, replacement + +Some functions have extremely limited implementations on different +platforms. Other functions are tedious to use correctly; for example, +proper use of @code{malloc} calls for the return value to be checked and +appropriate action taken if memory has been exhausted. A group of +``replacement functions'' is available in @libib{} to address these issues +for some of the most commonly used subroutines. + +All of these functions are declared in the @file{libiberty.h} header +file. Many of the implementations will use preprocessor macros set by +GNU Autoconf, if you decide to make use of that program. Some of these +functions may call one another. + + +@menu +* Memory Allocation:: Testing and handling failed memory + requests automatically. +* Exit Handlers:: Calling routines on program exit. +* Error Reporting:: Mapping errno and signal numbers to + more useful string formats. +@end menu + +@node Memory Allocation +@subsection Memory Allocation +@cindex memory allocation + +The functions beginning with the letter @samp{x} are wrappers around +standard functions; the functions provided by the system environment +are called and their results checked before the results are passed back +to client code. If the standard functions fail, these wrappers will +terminate the program. Thus, these versions can be used with impunity. + + +@node Exit Handlers +@subsection Exit Handlers +@cindex exit handlers + +The existence and implementation of the @code{atexit} routine varies +amongst the flavors of Unix. @libib{} provides an unvarying dependable +implementation via @code{xatexit} and @code{xexit}. + + +@node Error Reporting +@subsection Error Reporting +@cindex error reporting + +These are a set of routines to facilitate programming with the system +@code{errno} interface. The @libib{} source file @file{strerror.c} +contains a good deal of documentation for these functions. + +@c signal stuff + + +@node Extensions +@section Extensions +@cindex extensions +@cindex functions, extension + +@libib{} includes additional functionality above and beyond standard +functions, which has proven generically useful in GNU programs, such as +obstacks and regex. These functions are often copied from other +projects as they gain popularity, and are included here to provide a +central location from which to use, maintain, and distribute them. + +@menu +* Obstacks:: Stacks of arbitrary objects. +@end menu + +@c This is generated from the glibc manual using a make-obstacks-texi.sh +@c script of Phil's. Hope it's accurate. +@include obstacks.texi + +@node Functions +@chapter Function, Variable, and Macro Listing. +@include functions.texi + +@node Licenses +@appendix Licenses + +@menu + +* Library Copying:: The GNU Library General Public License +* BSD:: Regents of the University of California + +@end menu + +@c This takes care of Library Copying. It is the copying-lib.texi from the +@c GNU web site, with its @node line altered to make makeinfo shut up. +@include copying-lib.texi + +@page +@node BSD +@appendixsec BSD + +Copyright @copyright{} 1990 Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +@enumerate + +@item +Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +@item +Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +@item +[rescinded 22 July 1999] + +@item +Neither the name of the University nor the names of its contributors +may be used to endorse or promote products derived from this software +without specific prior written permission. + +@end enumerate + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +@node Index +@unnumbered Index + +@printindex cp + +@contents +@bye + diff -uprN binutils-2.11.90.0.31/libiberty/maint-tool binutils-2.11.92.0.5/libiberty/maint-tool --- binutils-2.11.90.0.31/libiberty/maint-tool Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/libiberty/maint-tool Mon Oct 1 15:25:26 2001 @@ -0,0 +1,75 @@ +#!/usr/bin/perl +# -*- perl -*- + +# Copyright (C) 2001 +# Free Software Foundation +# +# This file is part of the libiberty library. +# Libiberty is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# Libiberty is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with libiberty; see the file COPYING.LIB. If not, +# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. +# +# Originally written by DJ Delorie + + +# This is a trivial script which checks the lists of C and O files in +# the Makefile for consistency. + +$mode = shift; +$srcdir = "."; + +if ($mode eq "-s") { + $srcdir = shift; + $mode = shift; +} + +&missing() if $mode eq "missing"; + +exit 0; + +###################################################################### + +sub missing { + + opendir(S, $srcdir); + while ($f = readdir S) { + $have{$f} = 1; + } + closedir(S); + opendir(S, "."); + while ($f = readdir S) { + $have{$f} = 1; + } + closedir(S); + + for $a (@ARGV) { + $listed{$a} = 1; + $have{$a} = 0; + } + + for $f (sort keys %have) { + next unless $have{$f}; + if ($f =~ /\.c$/) { + print "S $f\n"; + } + } + for $f (sort keys %listed) { + if ($f =~ /(.*)\.c$/) { + $base = $1; + if (! $listed{"$base.o"}) { + print "O $f\n"; + } + } + } +} diff -uprN binutils-2.11.90.0.31/libiberty/memchr.c binutils-2.11.92.0.5/libiberty/memchr.c --- binutils-2.11.90.0.31/libiberty/memchr.c Wed Mar 28 09:57:51 2001 +++ binutils-2.11.92.0.5/libiberty/memchr.c Mon Oct 1 15:25:26 2001 @@ -1,37 +1,16 @@ /* -FUNCTION - <>---find character in memory -INDEX - memchr +@deftypefn Supplemental void* memchr (const void *@var{s}, int @var{c}, size_t @var{n}) -ANSI_SYNOPSIS - #include - void *memchr(const void *<[src]>, int <[c]>, size_t <[length]>); +This function searches memory starting at @code{*}@var{src} for the +character @var{c}. The search only ends with the first occurrence of +@var{c}, or after @var{length} characters; in particular, a null +character does not terminate the search. If the character @var{c} is +found within @var{length} characters of @code{*}@var{src}, a pointer +to the character is returned. If @var{c} is not found, then NULL is +returned. -TRAD_SYNOPSIS - #include - void *memchr(<[src]>, <[c]>, <[length]>) - void *<[src]>; - void *<[c]>; - size_t <[length]>; - -DESCRIPTION - This function searches memory starting at <<*<[src]>>> for the - character <[c]>. The search only ends with the first - occurrence of <[c]>, or after <[length]> characters; in - particular, <> does not terminate the search. - -RETURNS - If the character <[c]> is found within <[length]> characters - of <<*<[src]>>>, a pointer to the character is returned. If - <[c]> is not found, then <> is returned. - -PORTABILITY -<> requires no supporting OS subroutines. - -QUICKREF - memchr ansi pure +@end deftypefn */ diff -uprN binutils-2.11.90.0.31/libiberty/memcmp.c binutils-2.11.92.0.5/libiberty/memcmp.c --- binutils-2.11.90.0.31/libiberty/memcmp.c Thu Jun 15 14:07:56 2000 +++ binutils-2.11.92.0.5/libiberty/memcmp.c Mon Oct 1 15:25:26 2001 @@ -2,16 +2,17 @@ This function is in the public domain. */ /* -NAME - memcmp -- compare two memory regions -SYNOPSIS - int memcmp (const void *from, const void *to, size_t count) +@deftypefn Supplemental int memcmp (const void *@var{x}, const void *@var{y}, size_t @var{count}) + +Compares the first @var{count} bytes of two areas of memory. Returns +zero if they are the same, a value less than zero if @var{x} is +lexically less than @var{y}, or a value greater than zero if @var{x} +is lexically greater than @var{y}. Note that lexical order is determined +as if comparing unsigned char arrays. + +@end deftypefn -DESCRIPTION - Compare two memory regions and return less than, - equal to, or greater than zero, according to lexicographical - ordering of the compared regions. */ #include diff -uprN binutils-2.11.90.0.31/libiberty/memcpy.c binutils-2.11.92.0.5/libiberty/memcpy.c --- binutils-2.11.90.0.31/libiberty/memcpy.c Thu Jun 3 11:02:12 1999 +++ binutils-2.11.92.0.5/libiberty/memcpy.c Mon Oct 1 15:25:26 2001 @@ -2,15 +2,14 @@ This function is in the public domain. */ /* -NAME - memcpy -- copy memory regions of arbitary length -SYNOPSIS - void* memcpy (void *out, const void *in, size_t n); +@deftypefn Supplemental void* memcpy (void *@var{out}, const void *@var{in}, size_t @var{length}) + +Copies @var{length} bytes from memory region @var{in} to region +@var{out}. Returns a pointer to @var{out}. + +@end deftypefn -DESCRIPTION - Copy LENGTH bytes from memory region pointed to by IN to memory - region pointed to by OUT. */ #include diff -uprN binutils-2.11.90.0.31/libiberty/memmove.c binutils-2.11.92.0.5/libiberty/memmove.c --- binutils-2.11.90.0.31/libiberty/memmove.c Thu Jun 3 11:02:12 1999 +++ binutils-2.11.92.0.5/libiberty/memmove.c Mon Oct 1 15:25:26 2001 @@ -1,5 +1,17 @@ /* Wrapper to implement ANSI C's memmove using BSD's bcopy. */ /* This function is in the public domain. --Per Bothner. */ + +/* + +@deftypefn Supplemental void* memmove (void *@var{from}, const void *@var{to}, size_t @var{count}) + +Copies @var{count} bytes from memory area @var{from} to memory area +@var{to}, returning a pointer to @var{to}. + +@end deftypefn + +*/ + #include #ifdef __STDC__ #include diff -uprN binutils-2.11.90.0.31/libiberty/memset.c binutils-2.11.92.0.5/libiberty/memset.c --- binutils-2.11.90.0.31/libiberty/memset.c Thu Jun 3 11:02:12 1999 +++ binutils-2.11.92.0.5/libiberty/memset.c Mon Oct 1 15:25:26 2001 @@ -1,6 +1,17 @@ /* memset This implementation is in the public domain. */ +/* + +@deftypefn Supplemental void* memset (void *@var{s}, int @var{c}, size_t @var{count}) + +Sets the first @var{count} bytes of @var{s} to the constant byte +@var{c}, returning a pointer to @var{s}. + +@end deftypefn + +*/ + #include #ifdef __STDC__ #include diff -uprN binutils-2.11.90.0.31/libiberty/obstacks.texi binutils-2.11.92.0.5/libiberty/obstacks.texi --- binutils-2.11.90.0.31/libiberty/obstacks.texi Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/libiberty/obstacks.texi Mon Oct 1 15:25:26 2001 @@ -0,0 +1,758 @@ +@node Obstacks,Licenses,Functions,Top +@chapter Obstacks +@cindex obstacks + +An @dfn{obstack} is a pool of memory containing a stack of objects. You +can create any number of separate obstacks, and then allocate objects in +specified obstacks. Within each obstack, the last object allocated must +always be the first one freed, but distinct obstacks are independent of +each other. + +Aside from this one constraint of order of freeing, obstacks are totally +general: an obstack can contain any number of objects of any size. They +are implemented with macros, so allocation is usually very fast as long as +the objects are usually small. And the only space overhead per object is +the padding needed to start each object on a suitable boundary. + +@menu +* Creating Obstacks:: How to declare an obstack in your program. +* Preparing for Obstacks:: Preparations needed before you can + use obstacks. +* Allocation in an Obstack:: Allocating objects in an obstack. +* Freeing Obstack Objects:: Freeing objects in an obstack. +* Obstack Functions:: The obstack functions are both + functions and macros. +* Growing Objects:: Making an object bigger by stages. +* Extra Fast Growing:: Extra-high-efficiency (though more + complicated) growing objects. +* Status of an Obstack:: Inquiries about the status of an obstack. +* Obstacks Data Alignment:: Controlling alignment of objects in obstacks. +* Obstack Chunks:: How obstacks obtain and release chunks; + efficiency considerations. +* Summary of Obstacks:: +@end menu + +@node Creating Obstacks +@section Creating Obstacks + +The utilities for manipulating obstacks are declared in the header +file @file{obstack.h}. +@pindex obstack.h + +@comment obstack.h +@comment GNU +@deftp {Data Type} {struct obstack} +An obstack is represented by a data structure of type @code{struct +obstack}. This structure has a small fixed size; it records the status +of the obstack and how to find the space in which objects are allocated. +It does not contain any of the objects themselves. You should not try +to access the contents of the structure directly; use only the functions +described in this chapter. +@end deftp + +You can declare variables of type @code{struct obstack} and use them as +obstacks, or you can allocate obstacks dynamically like any other kind +of object. Dynamic allocation of obstacks allows your program to have a +variable number of different stacks. (You can even allocate an +obstack structure in another obstack, but this is rarely useful.) + +All the functions that work with obstacks require you to specify which +obstack to use. You do this with a pointer of type @code{struct obstack +*}. In the following, we often say ``an obstack'' when strictly +speaking the object at hand is such a pointer. + +The objects in the obstack are packed into large blocks called +@dfn{chunks}. The @code{struct obstack} structure points to a chain of +the chunks currently in use. + +The obstack library obtains a new chunk whenever you allocate an object +that won't fit in the previous chunk. Since the obstack library manages +chunks automatically, you don't need to pay much attention to them, but +you do need to supply a function which the obstack library should use to +get a chunk. Usually you supply a function which uses @code{malloc} +directly or indirectly. You must also supply a function to free a chunk. +These matters are described in the following section. + +@node Preparing for Obstacks +@section Preparing for Using Obstacks + +Each source file in which you plan to use the obstack functions +must include the header file @file{obstack.h}, like this: + +@smallexample +#include +@end smallexample + +@findex obstack_chunk_alloc +@findex obstack_chunk_free +Also, if the source file uses the macro @code{obstack_init}, it must +declare or define two functions or macros that will be called by the +obstack library. One, @code{obstack_chunk_alloc}, is used to allocate +the chunks of memory into which objects are packed. The other, +@code{obstack_chunk_free}, is used to return chunks when the objects in +them are freed. These macros should appear before any use of obstacks +in the source file. + +Usually these are defined to use @code{malloc} via the intermediary +@code{xmalloc} (@pxref{Unconstrained Allocation, , , libc, The GNU C Library Reference Manual}). This is done with +the following pair of macro definitions: + +@smallexample +#define obstack_chunk_alloc xmalloc +#define obstack_chunk_free free +@end smallexample + +@noindent +Though the memory you get using obstacks really comes from @code{malloc}, +using obstacks is faster because @code{malloc} is called less often, for +larger blocks of memory. @xref{Obstack Chunks}, for full details. + +At run time, before the program can use a @code{struct obstack} object +as an obstack, it must initialize the obstack by calling +@code{obstack_init}. + +@comment obstack.h +@comment GNU +@deftypefun int obstack_init (struct obstack *@var{obstack-ptr}) +Initialize obstack @var{obstack-ptr} for allocation of objects. This +function calls the obstack's @code{obstack_chunk_alloc} function. If +allocation of memory fails, the function pointed to by +@code{obstack_alloc_failed_handler} is called. The @code{obstack_init} +function always returns 1 (Compatibility notice: Former versions of +obstack returned 0 if allocation failed). +@end deftypefun + +Here are two examples of how to allocate the space for an obstack and +initialize it. First, an obstack that is a static variable: + +@smallexample +static struct obstack myobstack; +@dots{} +obstack_init (&myobstack); +@end smallexample + +@noindent +Second, an obstack that is itself dynamically allocated: + +@smallexample +struct obstack *myobstack_ptr + = (struct obstack *) xmalloc (sizeof (struct obstack)); + +obstack_init (myobstack_ptr); +@end smallexample + +@comment obstack.h +@comment GNU +@defvar obstack_alloc_failed_handler +The value of this variable is a pointer to a function that +@code{obstack} uses when @code{obstack_chunk_alloc} fails to allocate +memory. The default action is to print a message and abort. +You should supply a function that either calls @code{exit} +(@pxref{Program Termination, , , libc, The GNU C Library Reference Manual}) or @code{longjmp} (@pxref{Non-Local +Exits, , , libc, The GNU C Library Reference Manual}) and doesn't return. + +@smallexample +void my_obstack_alloc_failed (void) +@dots{} +obstack_alloc_failed_handler = &my_obstack_alloc_failed; +@end smallexample + +@end defvar + +@node Allocation in an Obstack +@section Allocation in an Obstack +@cindex allocation (obstacks) + +The most direct way to allocate an object in an obstack is with +@code{obstack_alloc}, which is invoked almost like @code{malloc}. + +@comment obstack.h +@comment GNU +@deftypefun {void *} obstack_alloc (struct obstack *@var{obstack-ptr}, int @var{size}) +This allocates an uninitialized block of @var{size} bytes in an obstack +and returns its address. Here @var{obstack-ptr} specifies which obstack +to allocate the block in; it is the address of the @code{struct obstack} +object which represents the obstack. Each obstack function or macro +requires you to specify an @var{obstack-ptr} as the first argument. + +This function calls the obstack's @code{obstack_chunk_alloc} function if +it needs to allocate a new chunk of memory; it calls +@code{obstack_alloc_failed_handler} if allocation of memory by +@code{obstack_chunk_alloc} failed. +@end deftypefun + +For example, here is a function that allocates a copy of a string @var{str} +in a specific obstack, which is in the variable @code{string_obstack}: + +@smallexample +struct obstack string_obstack; + +char * +copystring (char *string) +@{ + size_t len = strlen (string) + 1; + char *s = (char *) obstack_alloc (&string_obstack, len); + memcpy (s, string, len); + return s; +@} +@end smallexample + +To allocate a block with specified contents, use the function +@code{obstack_copy}, declared like this: + +@comment obstack.h +@comment GNU +@deftypefun {void *} obstack_copy (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size}) +This allocates a block and initializes it by copying @var{size} +bytes of data starting at @var{address}. It calls +@code{obstack_alloc_failed_handler} if allocation of memory by +@code{obstack_chunk_alloc} failed. +@end deftypefun + +@comment obstack.h +@comment GNU +@deftypefun {void *} obstack_copy0 (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size}) +Like @code{obstack_copy}, but appends an extra byte containing a null +character. This extra byte is not counted in the argument @var{size}. +@end deftypefun + +The @code{obstack_copy0} function is convenient for copying a sequence +of characters into an obstack as a null-terminated string. Here is an +example of its use: + +@smallexample +char * +obstack_savestring (char *addr, int size) +@{ + return obstack_copy0 (&myobstack, addr, size); +@} +@end smallexample + +@noindent +Contrast this with the previous example of @code{savestring} using +@code{malloc} (@pxref{Basic Allocation, , , libc, The GNU C Library Reference Manual}). + +@node Freeing Obstack Objects +@section Freeing Objects in an Obstack +@cindex freeing (obstacks) + +To free an object allocated in an obstack, use the function +@code{obstack_free}. Since the obstack is a stack of objects, freeing +one object automatically frees all other objects allocated more recently +in the same obstack. + +@comment obstack.h +@comment GNU +@deftypefun void obstack_free (struct obstack *@var{obstack-ptr}, void *@var{object}) +If @var{object} is a null pointer, everything allocated in the obstack +is freed. Otherwise, @var{object} must be the address of an object +allocated in the obstack. Then @var{object} is freed, along with +everything allocated in @var{obstack} since @var{object}. +@end deftypefun + +Note that if @var{object} is a null pointer, the result is an +uninitialized obstack. To free all memory in an obstack but leave it +valid for further allocation, call @code{obstack_free} with the address +of the first object allocated on the obstack: + +@smallexample +obstack_free (obstack_ptr, first_object_allocated_ptr); +@end smallexample + +Recall that the objects in an obstack are grouped into chunks. When all +the objects in a chunk become free, the obstack library automatically +frees the chunk (@pxref{Preparing for Obstacks}). Then other +obstacks, or non-obstack allocation, can reuse the space of the chunk. + +@node Obstack Functions +@section Obstack Functions and Macros +@cindex macros + +The interfaces for using obstacks may be defined either as functions or +as macros, depending on the compiler. The obstack facility works with +all C compilers, including both @w{ISO C} and traditional C, but there are +precautions you must take if you plan to use compilers other than GNU C. + +If you are using an old-fashioned @w{non-ISO C} compiler, all the obstack +``functions'' are actually defined only as macros. You can call these +macros like functions, but you cannot use them in any other way (for +example, you cannot take their address). + +Calling the macros requires a special precaution: namely, the first +operand (the obstack pointer) may not contain any side effects, because +it may be computed more than once. For example, if you write this: + +@smallexample +obstack_alloc (get_obstack (), 4); +@end smallexample + +@noindent +you will find that @code{get_obstack} may be called several times. +If you use @code{*obstack_list_ptr++} as the obstack pointer argument, +you will get very strange results since the incrementation may occur +several times. + +In @w{ISO C}, each function has both a macro definition and a function +definition. The function definition is used if you take the address of the +function without calling it. An ordinary call uses the macro definition by +default, but you can request the function definition instead by writing the +function name in parentheses, as shown here: + +@smallexample +char *x; +void *(*funcp) (); +/* @r{Use the macro}. */ +x = (char *) obstack_alloc (obptr, size); +/* @r{Call the function}. */ +x = (char *) (obstack_alloc) (obptr, size); +/* @r{Take the address of the function}. */ +funcp = obstack_alloc; +@end smallexample + +@noindent +This is the same situation that exists in @w{ISO C} for the standard library +functions. @xref{Macro Definitions, , , libc, The GNU C Library Reference Manual}. + +@strong{Warning:} When you do use the macros, you must observe the +precaution of avoiding side effects in the first operand, even in @w{ISO C}. + +If you use the GNU C compiler, this precaution is not necessary, because +various language extensions in GNU C permit defining the macros so as to +compute each argument only once. + +@node Growing Objects +@section Growing Objects +@cindex growing objects (in obstacks) +@cindex changing the size of a block (obstacks) + +Because memory in obstack chunks is used sequentially, it is possible to +build up an object step by step, adding one or more bytes at a time to the +end of the object. With this technique, you do not need to know how much +data you will put in the object until you come to the end of it. We call +this the technique of @dfn{growing objects}. The special functions +for adding data to the growing object are described in this section. + +You don't need to do anything special when you start to grow an object. +Using one of the functions to add data to the object automatically +starts it. However, it is necessary to say explicitly when the object is +finished. This is done with the function @code{obstack_finish}. + +The actual address of the object thus built up is not known until the +object is finished. Until then, it always remains possible that you will +add so much data that the object must be copied into a new chunk. + +While the obstack is in use for a growing object, you cannot use it for +ordinary allocation of another object. If you try to do so, the space +already added to the growing object will become part of the other object. + +@comment obstack.h +@comment GNU +@deftypefun void obstack_blank (struct obstack *@var{obstack-ptr}, int @var{size}) +The most basic function for adding to a growing object is +@code{obstack_blank}, which adds space without initializing it. +@end deftypefun + +@comment obstack.h +@comment GNU +@deftypefun void obstack_grow (struct obstack *@var{obstack-ptr}, void *@var{data}, int @var{size}) +To add a block of initialized space, use @code{obstack_grow}, which is +the growing-object analogue of @code{obstack_copy}. It adds @var{size} +bytes of data to the growing object, copying the contents from +@var{data}. +@end deftypefun + +@comment obstack.h +@comment GNU +@deftypefun void obstack_grow0 (struct obstack *@var{obstack-ptr}, void *@var{data}, int @var{size}) +This is the growing-object analogue of @code{obstack_copy0}. It adds +@var{size} bytes copied from @var{data}, followed by an additional null +character. +@end deftypefun + +@comment obstack.h +@comment GNU +@deftypefun void obstack_1grow (struct obstack *@var{obstack-ptr}, char @var{c}) +To add one character at a time, use the function @code{obstack_1grow}. +It adds a single byte containing @var{c} to the growing object. +@end deftypefun + +@comment obstack.h +@comment GNU +@deftypefun void obstack_ptr_grow (struct obstack *@var{obstack-ptr}, void *@var{data}) +Adding the value of a pointer one can use the function +@code{obstack_ptr_grow}. It adds @code{sizeof (void *)} bytes +containing the value of @var{data}. +@end deftypefun + +@comment obstack.h +@comment GNU +@deftypefun void obstack_int_grow (struct obstack *@var{obstack-ptr}, int @var{data}) +A single value of type @code{int} can be added by using the +@code{obstack_int_grow} function. It adds @code{sizeof (int)} bytes to +the growing object and initializes them with the value of @var{data}. +@end deftypefun + +@comment obstack.h +@comment GNU +@deftypefun {void *} obstack_finish (struct obstack *@var{obstack-ptr}) +When you are finished growing the object, use the function +@code{obstack_finish} to close it off and return its final address. + +Once you have finished the object, the obstack is available for ordinary +allocation or for growing another object. + +This function can return a null pointer under the same conditions as +@code{obstack_alloc} (@pxref{Allocation in an Obstack}). +@end deftypefun + +When you build an object by growing it, you will probably need to know +afterward how long it became. You need not keep track of this as you grow +the object, because you can find out the length from the obstack just +before finishing the object with the function @code{obstack_object_size}, +declared as follows: + +@comment obstack.h +@comment GNU +@deftypefun int obstack_object_size (struct obstack *@var{obstack-ptr}) +This function returns the current size of the growing object, in bytes. +Remember to call this function @emph{before} finishing the object. +After it is finished, @code{obstack_object_size} will return zero. +@end deftypefun + +If you have started growing an object and wish to cancel it, you should +finish it and then free it, like this: + +@smallexample +obstack_free (obstack_ptr, obstack_finish (obstack_ptr)); +@end smallexample + +@noindent +This has no effect if no object was growing. + +@cindex shrinking objects +You can use @code{obstack_blank} with a negative size argument to make +the current object smaller. Just don't try to shrink it beyond zero +length---there's no telling what will happen if you do that. + +@node Extra Fast Growing +@section Extra Fast Growing Objects +@cindex efficiency and obstacks + +The usual functions for growing objects incur overhead for checking +whether there is room for the new growth in the current chunk. If you +are frequently constructing objects in small steps of growth, this +overhead can be significant. + +You can reduce the overhead by using special ``fast growth'' +functions that grow the object without checking. In order to have a +robust program, you must do the checking yourself. If you do this checking +in the simplest way each time you are about to add data to the object, you +have not saved anything, because that is what the ordinary growth +functions do. But if you can arrange to check less often, or check +more efficiently, then you make the program faster. + +The function @code{obstack_room} returns the amount of room available +in the current chunk. It is declared as follows: + +@comment obstack.h +@comment GNU +@deftypefun int obstack_room (struct obstack *@var{obstack-ptr}) +This returns the number of bytes that can be added safely to the current +growing object (or to an object about to be started) in obstack +@var{obstack} using the fast growth functions. +@end deftypefun + +While you know there is room, you can use these fast growth functions +for adding data to a growing object: + +@comment obstack.h +@comment GNU +@deftypefun void obstack_1grow_fast (struct obstack *@var{obstack-ptr}, char @var{c}) +The function @code{obstack_1grow_fast} adds one byte containing the +character @var{c} to the growing object in obstack @var{obstack-ptr}. +@end deftypefun + +@comment obstack.h +@comment GNU +@deftypefun void obstack_ptr_grow_fast (struct obstack *@var{obstack-ptr}, void *@var{data}) +The function @code{obstack_ptr_grow_fast} adds @code{sizeof (void *)} +bytes containing the value of @var{data} to the growing object in +obstack @var{obstack-ptr}. +@end deftypefun + +@comment obstack.h +@comment GNU +@deftypefun void obstack_int_grow_fast (struct obstack *@var{obstack-ptr}, int @var{data}) +The function @code{obstack_int_grow_fast} adds @code{sizeof (int)} bytes +containing the value of @var{data} to the growing object in obstack +@var{obstack-ptr}. +@end deftypefun + +@comment obstack.h +@comment GNU +@deftypefun void obstack_blank_fast (struct obstack *@var{obstack-ptr}, int @var{size}) +The function @code{obstack_blank_fast} adds @var{size} bytes to the +growing object in obstack @var{obstack-ptr} without initializing them. +@end deftypefun + +When you check for space using @code{obstack_room} and there is not +enough room for what you want to add, the fast growth functions +are not safe. In this case, simply use the corresponding ordinary +growth function instead. Very soon this will copy the object to a +new chunk; then there will be lots of room available again. + +So, each time you use an ordinary growth function, check afterward for +sufficient space using @code{obstack_room}. Once the object is copied +to a new chunk, there will be plenty of space again, so the program will +start using the fast growth functions again. + +Here is an example: + +@smallexample +@group +void +add_string (struct obstack *obstack, const char *ptr, int len) +@{ + while (len > 0) + @{ + int room = obstack_room (obstack); + if (room == 0) + @{ + /* @r{Not enough room. Add one character slowly,} + @r{which may copy to a new chunk and make room.} */ + obstack_1grow (obstack, *ptr++); + len--; + @} + else + @{ + if (room > len) + room = len; + /* @r{Add fast as much as we have room for.} */ + len -= room; + while (room-- > 0) + obstack_1grow_fast (obstack, *ptr++); + @} + @} +@} +@end group +@end smallexample + +@node Status of an Obstack +@section Status of an Obstack +@cindex obstack status +@cindex status of obstack + +Here are functions that provide information on the current status of +allocation in an obstack. You can use them to learn about an object while +still growing it. + +@comment obstack.h +@comment GNU +@deftypefun {void *} obstack_base (struct obstack *@var{obstack-ptr}) +This function returns the tentative address of the beginning of the +currently growing object in @var{obstack-ptr}. If you finish the object +immediately, it will have that address. If you make it larger first, it +may outgrow the current chunk---then its address will change! + +If no object is growing, this value says where the next object you +allocate will start (once again assuming it fits in the current +chunk). +@end deftypefun + +@comment obstack.h +@comment GNU +@deftypefun {void *} obstack_next_free (struct obstack *@var{obstack-ptr}) +This function returns the address of the first free byte in the current +chunk of obstack @var{obstack-ptr}. This is the end of the currently +growing object. If no object is growing, @code{obstack_next_free} +returns the same value as @code{obstack_base}. +@end deftypefun + +@comment obstack.h +@comment GNU +@deftypefun int obstack_object_size (struct obstack *@var{obstack-ptr}) +This function returns the size in bytes of the currently growing object. +This is equivalent to + +@smallexample +obstack_next_free (@var{obstack-ptr}) - obstack_base (@var{obstack-ptr}) +@end smallexample +@end deftypefun + +@node Obstacks Data Alignment +@section Alignment of Data in Obstacks +@cindex alignment (in obstacks) + +Each obstack has an @dfn{alignment boundary}; each object allocated in +the obstack automatically starts on an address that is a multiple of the +specified boundary. By default, this boundary is 4 bytes. + +To access an obstack's alignment boundary, use the macro +@code{obstack_alignment_mask}, whose function prototype looks like +this: + +@comment obstack.h +@comment GNU +@deftypefn Macro int obstack_alignment_mask (struct obstack *@var{obstack-ptr}) +The value is a bit mask; a bit that is 1 indicates that the corresponding +bit in the address of an object should be 0. The mask value should be one +less than a power of 2; the effect is that all object addresses are +multiples of that power of 2. The default value of the mask is 3, so that +addresses are multiples of 4. A mask value of 0 means an object can start +on any multiple of 1 (that is, no alignment is required). + +The expansion of the macro @code{obstack_alignment_mask} is an lvalue, +so you can alter the mask by assignment. For example, this statement: + +@smallexample +obstack_alignment_mask (obstack_ptr) = 0; +@end smallexample + +@noindent +has the effect of turning off alignment processing in the specified obstack. +@end deftypefn + +Note that a change in alignment mask does not take effect until +@emph{after} the next time an object is allocated or finished in the +obstack. If you are not growing an object, you can make the new +alignment mask take effect immediately by calling @code{obstack_finish}. +This will finish a zero-length object and then do proper alignment for +the next object. + +@node Obstack Chunks +@section Obstack Chunks +@cindex efficiency of chunks +@cindex chunks + +Obstacks work by allocating space for themselves in large chunks, and +then parceling out space in the chunks to satisfy your requests. Chunks +are normally 4096 bytes long unless you specify a different chunk size. +The chunk size includes 8 bytes of overhead that are not actually used +for storing objects. Regardless of the specified size, longer chunks +will be allocated when necessary for long objects. + +The obstack library allocates chunks by calling the function +@code{obstack_chunk_alloc}, which you must define. When a chunk is no +longer needed because you have freed all the objects in it, the obstack +library frees the chunk by calling @code{obstack_chunk_free}, which you +must also define. + +These two must be defined (as macros) or declared (as functions) in each +source file that uses @code{obstack_init} (@pxref{Creating Obstacks}). +Most often they are defined as macros like this: + +@smallexample +#define obstack_chunk_alloc malloc +#define obstack_chunk_free free +@end smallexample + +Note that these are simple macros (no arguments). Macro definitions with +arguments will not work! It is necessary that @code{obstack_chunk_alloc} +or @code{obstack_chunk_free}, alone, expand into a function name if it is +not itself a function name. + +If you allocate chunks with @code{malloc}, the chunk size should be a +power of 2. The default chunk size, 4096, was chosen because it is long +enough to satisfy many typical requests on the obstack yet short enough +not to waste too much memory in the portion of the last chunk not yet used. + +@comment obstack.h +@comment GNU +@deftypefn Macro int obstack_chunk_size (struct obstack *@var{obstack-ptr}) +This returns the chunk size of the given obstack. +@end deftypefn + +Since this macro expands to an lvalue, you can specify a new chunk size by +assigning it a new value. Doing so does not affect the chunks already +allocated, but will change the size of chunks allocated for that particular +obstack in the future. It is unlikely to be useful to make the chunk size +smaller, but making it larger might improve efficiency if you are +allocating many objects whose size is comparable to the chunk size. Here +is how to do so cleanly: + +@smallexample +if (obstack_chunk_size (obstack_ptr) < @var{new-chunk-size}) + obstack_chunk_size (obstack_ptr) = @var{new-chunk-size}; +@end smallexample + +@node Summary of Obstacks +@section Summary of Obstack Functions + +Here is a summary of all the functions associated with obstacks. Each +takes the address of an obstack (@code{struct obstack *}) as its first +argument. + +@table @code +@item void obstack_init (struct obstack *@var{obstack-ptr}) +Initialize use of an obstack. @xref{Creating Obstacks}. + +@item void *obstack_alloc (struct obstack *@var{obstack-ptr}, int @var{size}) +Allocate an object of @var{size} uninitialized bytes. +@xref{Allocation in an Obstack}. + +@item void *obstack_copy (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size}) +Allocate an object of @var{size} bytes, with contents copied from +@var{address}. @xref{Allocation in an Obstack}. + +@item void *obstack_copy0 (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size}) +Allocate an object of @var{size}+1 bytes, with @var{size} of them copied +from @var{address}, followed by a null character at the end. +@xref{Allocation in an Obstack}. + +@item void obstack_free (struct obstack *@var{obstack-ptr}, void *@var{object}) +Free @var{object} (and everything allocated in the specified obstack +more recently than @var{object}). @xref{Freeing Obstack Objects}. + +@item void obstack_blank (struct obstack *@var{obstack-ptr}, int @var{size}) +Add @var{size} uninitialized bytes to a growing object. +@xref{Growing Objects}. + +@item void obstack_grow (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size}) +Add @var{size} bytes, copied from @var{address}, to a growing object. +@xref{Growing Objects}. + +@item void obstack_grow0 (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size}) +Add @var{size} bytes, copied from @var{address}, to a growing object, +and then add another byte containing a null character. @xref{Growing +Objects}. + +@item void obstack_1grow (struct obstack *@var{obstack-ptr}, char @var{data-char}) +Add one byte containing @var{data-char} to a growing object. +@xref{Growing Objects}. + +@item void *obstack_finish (struct obstack *@var{obstack-ptr}) +Finalize the object that is growing and return its permanent address. +@xref{Growing Objects}. + +@item int obstack_object_size (struct obstack *@var{obstack-ptr}) +Get the current size of the currently growing object. @xref{Growing +Objects}. + +@item void obstack_blank_fast (struct obstack *@var{obstack-ptr}, int @var{size}) +Add @var{size} uninitialized bytes to a growing object without checking +that there is enough room. @xref{Extra Fast Growing}. + +@item void obstack_1grow_fast (struct obstack *@var{obstack-ptr}, char @var{data-char}) +Add one byte containing @var{data-char} to a growing object without +checking that there is enough room. @xref{Extra Fast Growing}. + +@item int obstack_room (struct obstack *@var{obstack-ptr}) +Get the amount of room now available for growing the current object. +@xref{Extra Fast Growing}. + +@item int obstack_alignment_mask (struct obstack *@var{obstack-ptr}) +The mask used for aligning the beginning of an object. This is an +lvalue. @xref{Obstacks Data Alignment}. + +@item int obstack_chunk_size (struct obstack *@var{obstack-ptr}) +The size for allocating chunks. This is an lvalue. @xref{Obstack Chunks}. + +@item void *obstack_base (struct obstack *@var{obstack-ptr}) +Tentative starting address of the currently growing object. +@xref{Status of an Obstack}. + +@item void *obstack_next_free (struct obstack *@var{obstack-ptr}) +Address just after the end of the currently growing object. +@xref{Status of an Obstack}. +@end table + diff -uprN binutils-2.11.90.0.31/libiberty/putenv.c binutils-2.11.92.0.5/libiberty/putenv.c --- binutils-2.11.90.0.31/libiberty/putenv.c Thu Feb 24 11:11:29 2000 +++ binutils-2.11.92.0.5/libiberty/putenv.c Mon Oct 1 15:25:26 2001 @@ -16,6 +16,19 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/* + +@deftypefn Supplemental int putenv (const char *@var{string}) + +Uses @code{setenv} or @code{unsetenv} to put @var{string} into +the environment or remove it. If @var{string} is of the form +@samp{name=value} the string is added; if no `=' is present the +name is unset/removed. + +@end deftypefn + +*/ + #if defined (_AIX) && !defined (__GNUC__) #pragma alloca #endif diff -uprN binutils-2.11.90.0.31/libiberty/rename.c binutils-2.11.92.0.5/libiberty/rename.c --- binutils-2.11.90.0.31/libiberty/rename.c Thu Jul 27 17:56:11 2000 +++ binutils-2.11.92.0.5/libiberty/rename.c Mon Oct 1 15:25:26 2001 @@ -1,7 +1,16 @@ /* rename -- rename a file This function is in the public domain. */ -/* Rename a file. */ +/* + +@deftypefn Supplemental int rename (const char *@var{old}, const char *@var{new}) + +Renames a file from @var{old} to @var{new}. If @var{new} already +exists, it is removed. + +@end deftypefn + +*/ #ifdef HAVE_CONFIG_H #include "config.h" diff -uprN binutils-2.11.90.0.31/libiberty/rindex.c binutils-2.11.92.0.5/libiberty/rindex.c --- binutils-2.11.90.0.31/libiberty/rindex.c Thu Jun 3 11:02:12 1999 +++ binutils-2.11.92.0.5/libiberty/rindex.c Mon Oct 1 15:25:26 2001 @@ -1,5 +1,17 @@ /* Stub implementation of (obsolete) rindex(). */ +/* + +@deftypefn Supplemental char* rindex (const char *@var{s}, int @var{c}) + +Returns a pointer to the last occurrence of the character @var{c} in +the string @var{s}, or NULL if not found. The use of @code{rindex} is +deprecated in new programs in favor of @code{strrchr}. + +@end deftypefn + +*/ + extern char *strrchr (); char * diff -uprN binutils-2.11.90.0.31/libiberty/setenv.c binutils-2.11.92.0.5/libiberty/setenv.c --- binutils-2.11.90.0.31/libiberty/setenv.c Sat Oct 14 18:06:12 2000 +++ binutils-2.11.92.0.5/libiberty/setenv.c Mon Oct 1 15:25:26 2001 @@ -16,6 +16,22 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* + +@deftypefn Supplemental int setenv (const char *@var{name}, const char *@var{value}, int @var{overwrite}) +@deftypefnx Supplemental void unsetenv (const char *@var{name}) + +@code{setenv} adds @var{name} to the environment with value +@var{value}. If the name was already present in the environment, +the new value will be stored only if @var{overwrite} is non-zero. +The companion @code{unsetenv} function removes @var{name} from the +environment. This implementation is not safe for multithreaded code. + +@end deftypefn + +*/ + #if HAVE_CONFIG_H # include #endif diff -uprN binutils-2.11.90.0.31/libiberty/sigsetmask.c binutils-2.11.92.0.5/libiberty/sigsetmask.c --- binutils-2.11.90.0.31/libiberty/sigsetmask.c Sat Oct 14 18:06:12 2000 +++ binutils-2.11.92.0.5/libiberty/sigsetmask.c Mon Oct 1 15:25:26 2001 @@ -3,8 +3,17 @@ Contributed by Cygnus Support. This file is in the public doamin. */ -/* Set the current signal mask to the set provided, and return the - previous value */ +/* + +@deftypefn Supplemental int sigsetmask (int @var{set}) + +Sets the signal mask to the one provided in @var{set} and returns +the old mask (which, for libiberty's implementation, will always +be the value @code{1}). + +@end deftypefn + +*/ #define _POSIX_SOURCE #include diff -uprN binutils-2.11.90.0.31/libiberty/strcasecmp.c binutils-2.11.92.0.5/libiberty/strcasecmp.c --- binutils-2.11.90.0.31/libiberty/strcasecmp.c Thu Jun 3 11:02:12 1999 +++ binutils-2.11.92.0.5/libiberty/strcasecmp.c Mon Oct 1 15:25:26 2001 @@ -10,6 +10,16 @@ * is provided ``as is'' without express or implied warranty. */ +/* + +@deftypefn Supplemental int strcasecmp (const char *@var{s1}, const char *@var{s2}) + +A case-insensitive @code{strcmp}. + +@end deftypefn + +*/ + #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)strcasecmp.c 5.5 (Berkeley) 11/24/87"; #endif /* LIBC_SCCS and not lint */ diff -uprN binutils-2.11.90.0.31/libiberty/strchr.c binutils-2.11.92.0.5/libiberty/strchr.c --- binutils-2.11.90.0.31/libiberty/strchr.c Thu Jun 3 11:02:12 1999 +++ binutils-2.11.92.0.5/libiberty/strchr.c Mon Oct 1 15:25:26 2001 @@ -2,19 +2,15 @@ This function is in the public domain. */ /* -NAME - strchr -- return pointer to first occurance of a character -SYNOPSIS - char *strchr (const char *s, int c) +@deftypefn Supplemental char* strchr (const char *@var{s}, int @var{c}) + +Returns a pointer to the first occurrence of the character @var{c} in +the string @var{s}, or NULL if not found. If @var{c} is itself the +null character, the results are undefined. + +@end deftypefn -DESCRIPTION - Returns a pointer to the first occurance of character C in - string S, or a NULL pointer if no occurance is found. - -BUGS - Behavior when character is the null character is implementation - dependent. */ #include diff -uprN binutils-2.11.90.0.31/libiberty/strdup.c binutils-2.11.92.0.5/libiberty/strdup.c --- binutils-2.11.90.0.31/libiberty/strdup.c Thu Jun 3 11:02:12 1999 +++ binutils-2.11.92.0.5/libiberty/strdup.c Mon Oct 1 15:25:26 2001 @@ -1,3 +1,14 @@ +/* + +@deftypefn Supplemental char* strdup (const char *@var{s}) + +Returns a pointer to a copy of @var{s} in memory obtained from +@code{malloc}, or NULL if insufficient memory was available. + +@end deftypefn + +*/ + char * strdup(s) char *s; diff -uprN binutils-2.11.90.0.31/libiberty/strerror.c binutils-2.11.92.0.5/libiberty/strerror.c --- binutils-2.11.90.0.31/libiberty/strerror.c Tue Jun 19 11:57:59 2001 +++ binutils-2.11.92.0.5/libiberty/strerror.c Mon Oct 1 15:25:26 2001 @@ -562,28 +562,23 @@ init_error_tables () /* -NAME - errno_max -- return the max errno value +@deftypefn Replacement int errno_max (void) -SYNOPSIS +Returns the maximum @code{errno} value for which a corresponding +symbolic name or message is available. Note that in the case where we +use the @code{sys_errlist} supplied by the system, it is possible for +there to be more symbolic names than messages, or vice versa. In +fact, the manual page for @code{perror(3C)} explicitly warns that one +should check the size of the table (@code{sys_nerr}) before indexing +it, since new error codes may be added to the system before they are +added to the table. Thus @code{sys_nerr} might be smaller than value +implied by the largest @code{errno} value defined in @file{errno.h}. - int errno_max (); +We return the maximum value that can be used to obtain a meaningful +symbolic name or message. -DESCRIPTION - - Returns the maximum errno value for which a corresponding symbolic - name or message is available. Note that in the case where - we use the sys_errlist supplied by the system, it is possible for - there to be more symbolic names than messages, or vice versa. - In fact, the manual page for perror(3C) explicitly warns that one - should check the size of the table (sys_nerr) before indexing it, - since new error codes may be added to the system before they are - added to the table. Thus sys_nerr might be smaller than value - implied by the largest errno value defined in . - - We return the maximum value that can be used to obtain a meaningful - symbolic name or message. +@end deftypefn */ @@ -604,31 +599,25 @@ errno_max () /* -NAME - - strerror -- map an error number to an error message string +@deftypefn Replacement char* strerror (int @var{errnoval}) -SYNOPSIS +Maps an @code{errno} number to an error message string, the contents +of which are implementation defined. On systems which have the +external variables @code{sys_nerr} and @code{sys_errlist}, these +strings will be the same as the ones used by @code{perror}. - char *strerror (int errnoval) +If the supplied error number is within the valid range of indices for +the @code{sys_errlist}, but no message is available for the particular +error number, then returns the string @samp{"Error @var{num}"}, where +@var{num} is the error number. -DESCRIPTION +If the supplied error number is not a valid index into +@code{sys_errlist}, returns NULL. - Maps an errno number to an error message string, the contents of - which are implementation defined. On systems which have the external - variables sys_nerr and sys_errlist, these strings will be the same - as the ones used by perror(). +The returned string is only guaranteed to be valid only until the +next call to @code{strerror}. - If the supplied error number is within the valid range of indices - for the sys_errlist, but no message is available for the particular - error number, then returns the string "Error NUM", where NUM is the - error number. - - If the supplied error number is not a valid index into sys_errlist, - returns NULL. - - The returned string is only guaranteed to be valid only until the - next call to strerror. +@end deftypefn */ @@ -678,32 +667,24 @@ strerror (errnoval) /* -NAME - - strerrno -- map an error number to a symbolic name string +@deftypefn Replacement const char* strerrno (int @var{errnum}) -SYNOPSIS +Given an error number returned from a system call (typically returned +in @code{errno}), returns a pointer to a string containing the +symbolic name of that error number, as found in @file{errno.h}. - const char *strerrno (int errnoval) +If the supplied error number is within the valid range of indices for +symbolic names, but no name is available for the particular error +number, then returns the string @samp{"Error @var{num}"}, where @var{num} +is the error number. -DESCRIPTION +If the supplied error number is not within the range of valid +indices, then returns NULL. - Given an error number returned from a system call (typically - returned in errno), returns a pointer to a string containing the - symbolic name of that error number, as found in . +The contents of the location pointed to are only guaranteed to be +valid until the next call to @code{strerrno}. - If the supplied error number is within the valid range of indices - for symbolic names, but no name is available for the particular - error number, then returns the string "Error NUM", where NUM is - the error number. - - If the supplied error number is not within the range of valid - indices, then returns NULL. - -BUGS - - The contents of the location pointed to are only guaranteed to be - valid until the next call to strerrno. +@end deftypefn */ @@ -746,18 +727,12 @@ strerrno (errnoval) /* -NAME - - strtoerrno -- map a symbolic errno name to a numeric value - -SYNOPSIS - - int strtoerrno (char *name) +@deftypefn Replacement int strtoerrno (const char *@var{name}) -DESCRIPTION +Given the symbolic name of a error number (e.g., @code{EACCESS}), map it +to an errno value. If no translation is found, returns 0. - Given the symbolic name of a error number, map it to an errno value. - If no translation is found, returns 0. +@end deftypefn */ diff -uprN binutils-2.11.90.0.31/libiberty/strncasecmp.c binutils-2.11.92.0.5/libiberty/strncasecmp.c --- binutils-2.11.90.0.31/libiberty/strncasecmp.c Thu Jun 3 11:02:12 1999 +++ binutils-2.11.92.0.5/libiberty/strncasecmp.c Mon Oct 1 15:25:26 2001 @@ -10,6 +10,16 @@ * is provided ``as is'' without express or implied warranty. */ +/* + +@deftypefn Supplemental int strncasecmp (const char *@var{s1}, const char *@var{s2}) + +A case-insensitive @code{strncmp}. + +@end deftypefn + +*/ + #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)strcasecmp.c 5.5 (Berkeley) 11/24/87"; #endif /* LIBC_SCCS and not lint */ diff -uprN binutils-2.11.90.0.31/libiberty/strncmp.c binutils-2.11.92.0.5/libiberty/strncmp.c --- binutils-2.11.90.0.31/libiberty/strncmp.c Thu Jun 15 14:07:56 2000 +++ binutils-2.11.92.0.5/libiberty/strncmp.c Mon Oct 1 15:25:26 2001 @@ -1,6 +1,17 @@ /* strncmp -- compare two strings, stop after n bytes. This function is in the public domain. */ +/* + +@deftypefn Supplemental int strncmp (const char *@var{s1}, const char *@var{s2}, size_t @var{n}) + +Compares the first @var{n} bytes of two strings, returning a value as +@code{strcmp}. + +@end deftypefn + +*/ + #include #ifdef __STDC__ #include diff -uprN binutils-2.11.90.0.31/libiberty/strrchr.c binutils-2.11.92.0.5/libiberty/strrchr.c --- binutils-2.11.90.0.31/libiberty/strrchr.c Thu Jun 3 11:02:12 1999 +++ binutils-2.11.92.0.5/libiberty/strrchr.c Mon Oct 1 15:25:26 2001 @@ -2,19 +2,15 @@ This function is in the public domain. */ /* -NAME - strrchr -- return pointer to last occurance of a character -SYNOPSIS - char *strrchr (const char *s, int c) +@deftypefn Supplemental char* strrchr (const char *@var{s}, int @var{c}) + +Returns a pointer to the last occurrence of the character @var{c} in +the string @var{s}, or NULL if not found. If @var{c} is itself the +null character, the results are undefined. + +@end deftypefn -DESCRIPTION - Returns a pointer to the last occurance of character C in - string S, or a NULL pointer if no occurance is found. - -BUGS - Behavior when character is the null character is implementation - dependent. */ #include diff -uprN binutils-2.11.90.0.31/libiberty/strstr.c binutils-2.11.92.0.5/libiberty/strstr.c --- binutils-2.11.90.0.31/libiberty/strstr.c Thu Jun 3 11:02:12 1999 +++ binutils-2.11.92.0.5/libiberty/strstr.c Mon Oct 1 15:25:26 2001 @@ -3,24 +3,16 @@ /* -NAME +@deftypefn Supplemental char* strstr (const char *@var{string}, const char *@var{sub}) - strstr -- locate first occurance of a substring +This function searches for the substring @var{sub} in the string +@var{string}, not including the terminating null characters. A pointer +to the first occurrence of @var{sub} is returned, or NULL if the +substring is absent. If @var{sub} points to a string with zero +length, the function returns @var{string}. -SYNOPSIS +@end deftypefn - #include - - char *strstr (char *s1, char *s2) - -DESCRIPTION - - Locates the first occurance in the string pointed to by S1 of - the string pointed to by S2. Returns a pointer to the substring - found, or a NULL pointer if not found. If S2 points to a string - with zero length, the function returns S1. - -BUGS */ diff -uprN binutils-2.11.90.0.31/libiberty/strtod.c binutils-2.11.92.0.5/libiberty/strtod.c --- binutils-2.11.90.0.31/libiberty/strtod.c Thu Dec 21 16:34:58 2000 +++ binutils-2.11.92.0.5/libiberty/strtod.c Mon Oct 1 15:25:26 2001 @@ -22,6 +22,21 @@ the resulting executable to be covered b This exception does not however invalidate any other reasons why the executable file might be covered by the GNU General Public License. */ +/* + +@deftypefn Supplemental double strtod (const char *@var{string}, char **@var{endptr}) + +This ANSI C function converts the initial portion of @var{string} to a +@code{double}. If @var{endptr} is not NULL, a pointer to the +character after the last character used in the conversion is stored in +the location referenced by @var{endptr}. If no conversion is +performed, zero is returned and the value of @var{string} is stored in +the location referenced by @var{endptr}. + +@end deftypefn + +*/ + #include "ansidecl.h" #include "safe-ctype.h" diff -uprN binutils-2.11.90.0.31/libiberty/strtol.c binutils-2.11.92.0.5/libiberty/strtol.c --- binutils-2.11.90.0.31/libiberty/strtol.c Mon Dec 11 11:24:00 2000 +++ binutils-2.11.92.0.5/libiberty/strtol.c Mon Oct 1 15:25:26 2001 @@ -28,6 +28,23 @@ * SUCH DAMAGE. */ +/* + +@deftypefn Supplemental {long int} strtol (const char *@var{string}, char **@var{endptr}, int @var{base}) + +The @code{strtol} function converts the string in @var{string} to a +long integer value according to the given @var{base}, which must be +between 2 and 36 inclusive, or be the special value 0. If @var{base} +is 0, @code{strtol} will look for the prefixes @code{0} and @code{0x} +to indicate bases 8 and 16, respectively, else default to base 10. +When the base is 16 (either explicitly or implicitly), a prefix of +@code{0x} is allowed. The handling of @var{endptr} is as that of +@code{strtod} above. + +@end deftypefn + +*/ + #ifdef HAVE_CONFIG_H #include "config.h" #endif diff -uprN binutils-2.11.90.0.31/libiberty/tmpnam.c binutils-2.11.92.0.5/libiberty/tmpnam.c --- binutils-2.11.90.0.31/libiberty/tmpnam.c Thu Feb 24 11:11:29 2000 +++ binutils-2.11.92.0.5/libiberty/tmpnam.c Mon Oct 1 15:25:26 2001 @@ -1,3 +1,17 @@ +/* + +@deftypefn Supplemental char* tmpnam (char *@var{s}) + +This function attempts to create a name for a temporary file, which +will be a valid file name yet not exist when @code{tmpnam} checks for +it. @var{s} must point to a buffer of at least @code{L_tmpnam} bytes, +or be NULL. Use of this function creates a security risk, and it must +not be used in new projects. Use @code{mkstemp} instead. + +@end deftypefn + +*/ + #include #ifndef L_tmpnam diff -uprN binutils-2.11.90.0.31/libiberty/vasprintf.c binutils-2.11.92.0.5/libiberty/vasprintf.c --- binutils-2.11.90.0.31/libiberty/vasprintf.c Sat Oct 14 18:06:13 2000 +++ binutils-2.11.92.0.5/libiberty/vasprintf.c Mon Oct 1 15:25:26 2001 @@ -28,7 +28,9 @@ Boston, MA 02111-1307, USA. */ #include #endif #include +#ifdef HAVE_STRING_H #include +#endif #ifdef HAVE_STDLIB_H #include #else @@ -142,29 +144,22 @@ vasprintf (result, format, args) } #ifdef TEST -static void checkit PARAMS ((const char *, ...)); - -static void -checkit VPARAMS ((const char* format, ...)) +static void ATTRIBUTE_PRINTF_1 +checkit VPARAMS ((const char *format, ...)) { - va_list args; char *result; -#ifndef ANSI_PROTOTYPES - const char *format; -#endif - - VA_START (args, format); - -#ifndef ANSI_PROTOTYPES - format = va_arg (args, const char *); -#endif - + VA_OPEN (args, format); + VA_FIXEDARG (args, const char *, format); vasprintf (&result, format, args); + VA_CLOSE (args); + if (strlen (result) < (size_t) global_total_width) printf ("PASS: "); else printf ("FAIL: "); printf ("%d %s\n", global_total_width, result); + + free (result); } extern int main PARAMS ((void)); diff -uprN binutils-2.11.90.0.31/libiberty/vfork.c binutils-2.11.92.0.5/libiberty/vfork.c --- binutils-2.11.90.0.31/libiberty/vfork.c Sat Oct 14 18:06:13 2000 +++ binutils-2.11.92.0.5/libiberty/vfork.c Mon Oct 1 15:25:26 2001 @@ -1,6 +1,16 @@ /* Emulate vfork using just plain fork, for systems without a real vfork. This function is in the public domain. */ +/* + +@deftypefn Supplemental int vfork () + +Emulates @code{vfork} by calling @code{fork} and returning its value. + +@end deftypefn + +*/ + #include "ansidecl.h" extern int fork PARAMS ((void)); diff -uprN binutils-2.11.90.0.31/libiberty/vprintf.c binutils-2.11.92.0.5/libiberty/vprintf.c --- binutils-2.11.90.0.31/libiberty/vprintf.c Thu Jun 3 11:02:12 1999 +++ binutils-2.11.92.0.5/libiberty/vprintf.c Mon Oct 1 15:25:26 2001 @@ -1,3 +1,20 @@ +/* + +@deftypefn Supplemental int vprintf (const char *@var{format}, va_list @var{ap}) +@deftypefnx Supplemental int vfprintf (FILE *@var{stream}, const char *@var{format}, va_list @var{ap}) +@deftypefnx Supplemental int vsprintf (char *@var{str}, const char *@var{format}, va_list @var{ap}) + +These functions are the same as @code{printf}, @code{fprintf}, and +@code{sprintf}, respectively, except that they are called with a +@code{va_list} instead of a variable number of arguments. Note that +they do not call @code{va_end}; this is the application's +responsibility. In @libib{} they are implemented in terms of the +nonstandard but common function @code{_doprnt}. + +@end deftypefn + +*/ + #ifdef __STDC__ #include #else diff -uprN binutils-2.11.90.0.31/libiberty/waitpid.c binutils-2.11.92.0.5/libiberty/waitpid.c --- binutils-2.11.90.0.31/libiberty/waitpid.c Thu Jul 27 17:56:11 2000 +++ binutils-2.11.92.0.5/libiberty/waitpid.c Mon Oct 1 15:25:26 2001 @@ -1,3 +1,15 @@ +/* + +@deftypefn Supplemental int waitpid (int @var{pid}, int *@var{status}, int) + +This is a wrapper around the @code{wait} function. Any ``special'' +values of @var{pid} depend on your implementation of @code{wait}, as +does the return value. The third argument is unused in @libib{}. + +@end deftypefn + +*/ + #ifdef HAVE_CONFIG_H #include "config.h" #endif diff -uprN binutils-2.11.90.0.31/libiberty/xatexit.c binutils-2.11.92.0.5/libiberty/xatexit.c --- binutils-2.11.90.0.31/libiberty/xatexit.c Thu Jun 3 11:02:12 1999 +++ binutils-2.11.92.0.5/libiberty/xatexit.c Mon Oct 1 15:25:26 2001 @@ -5,6 +5,20 @@ * %sccs.include.redist.c% */ + +/* + +@deftypefun int xatexit (void (*@var{fn}) (void)) + +Behaves as the standard @code{atexit} function, but with no limit on +the number of registered functions. Returns 0 on success, or -1 on +failure. If you use @code{xatexit} to register functions, you must use +@code{xexit} to terminate your program. + +@end deftypefun + +*/ + /* Adapted from newlib/libc/stdlib/{,at}exit.[ch]. If you use xatexit, you must call xexit instead of exit. */ diff -uprN binutils-2.11.90.0.31/libiberty/xexit.c binutils-2.11.92.0.5/libiberty/xexit.c --- binutils-2.11.90.0.31/libiberty/xexit.c Sat Oct 14 18:06:13 2000 +++ binutils-2.11.92.0.5/libiberty/xexit.c Mon Oct 1 15:25:26 2001 @@ -17,6 +17,18 @@ License along with libiberty; see the fi to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/* + +@deftypefn Replacement void xexit (int @var{code}) + +Terminates the program. If any functions have been registered with +the @code{xatexit} replacement function, they will be called first. +Termination is handled via the system's normal @code{exit} call. + +@end deftypefn + +*/ + #ifdef HAVE_CONFIG_H #include "config.h" #endif diff -uprN binutils-2.11.90.0.31/libiberty/xmalloc.c binutils-2.11.92.0.5/libiberty/xmalloc.c --- binutils-2.11.90.0.31/libiberty/xmalloc.c Mon Dec 4 16:33:30 2000 +++ binutils-2.11.92.0.5/libiberty/xmalloc.c Mon Oct 1 15:25:26 2001 @@ -17,6 +17,49 @@ License along with libiberty; see the fi not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/* + +@deftypefn Replacement void* xmalloc (size_t) + +Allocate memory without fail. If @code{malloc} fails, this will print +a message to @code{stderr} (using the name set by +@code{xmalloc_set_program_name}, +if any) and then call @code{xexit}. Note that it is therefore safe for +a program to contain @code{#define malloc xmalloc} in its source. + +@end deftypefn + +@deftypefn Replacement void* xrealloc (void*, size_t) +Reallocate memory without fail. This routine functions like @code{realloc}, +but will behave the same as @code{xmalloc} if memory cannot be found. + +@end deftypefn + +@deftypefn Replacement void* xcalloc (size_t, size_t) + +Allocate memory without fail, and set it to zero. This routine functions +like @code{calloc}, but will behave the same as @code{xmalloc} if memory +cannot be found. + +@end deftypefn + +@deftypefn Replacement void xmalloc_set_program_name (const char *@var{name}) + +You can use this to set the name of the program used by +@code{xmalloc_failed} when printing a failure message. + +@end deftypefn + +@deftypefn Replacement void xmalloc_failed (size_t) + +This function is not meant to be called by client code, and is listed +here for completeness only. If any of the allocation routines fail, this +function will be called to print an error message and terminate execution. + +@end deftypefn + +*/ + #ifdef HAVE_CONFIG_H #include "config.h" #endif diff -uprN binutils-2.11.90.0.31/libiberty/xmemdup.c binutils-2.11.92.0.5/libiberty/xmemdup.c --- binutils-2.11.90.0.31/libiberty/xmemdup.c Mon May 29 22:35:50 2000 +++ binutils-2.11.92.0.5/libiberty/xmemdup.c Mon Oct 1 15:25:26 2001 @@ -2,6 +2,19 @@ This trivial function is in the public domain. Jeff Garzik, September 1999. */ +/* + +@deftypefn Replacement void* xmemdup (void *@var{input}, size_t @var{copy_size}, size_t @var{alloc_size}) + +Duplicates a region of memory without fail. First, @var{alloc_size} bytes +are allocated, then @var{copy_size} bytes from @var{input} are copied into +it, and the new memory is returned. If fewer bytes are copied than were +allocated, the remaining memory is zeroed. + +@end deftypefn + +*/ + #ifdef HAVE_CONFIG_H #include "config.h" #endif diff -uprN binutils-2.11.90.0.31/libiberty/xstrdup.c binutils-2.11.92.0.5/libiberty/xstrdup.c --- binutils-2.11.90.0.31/libiberty/xstrdup.c Thu Feb 24 11:11:29 2000 +++ binutils-2.11.92.0.5/libiberty/xstrdup.c Mon Oct 1 15:25:26 2001 @@ -2,6 +2,17 @@ This trivial function is in the public domain. Ian Lance Taylor, Cygnus Support, December 1995. */ +/* + +@deftypefn Replacement char* xstrdup (const char *@var{s}) + +Duplicates a character string without fail, using @code{xmalloc} to +obtain memory. + +@end deftypefn + +*/ + #include #ifdef HAVE_CONFIG_H #include "config.h" diff -uprN binutils-2.11.90.0.31/libiberty/xstrerror.c binutils-2.11.92.0.5/libiberty/xstrerror.c --- binutils-2.11.90.0.31/libiberty/xstrerror.c Thu Jun 3 11:02:12 1999 +++ binutils-2.11.92.0.5/libiberty/xstrerror.c Mon Oct 1 15:25:26 2001 @@ -2,6 +2,17 @@ Fri Jun 16 18:30:00 1995 Pat Rankin This code is in the public domain. */ +/* + +@deftypefn Replacement char* xstrerror (int @var{errnum}) + +Behaves exactly like the standard @code{strerror} function, but +will never return a NULL pointer. + +@end deftypefn + +*/ + #include #include "libiberty.h" diff -uprN binutils-2.11.90.0.31/mips/ChangeLog binutils-2.11.92.0.5/mips/ChangeLog --- binutils-2.11.90.0.31/mips/ChangeLog Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/mips/ChangeLog Fri Oct 5 14:11:21 2001 @@ -1,3 +1,30 @@ +2001-10-05 H.J. Lu + + * README: Remove binutils-mips64.patch and gas-mips.patch. + Apply gas-mips-kernel.patch. + +2001-10-04 H.J. Lu + + * binutils-mips64.patch: Updated. + +2001-09-25 H.J. Lu + + * binutils-mips64.patch: Updated. + + * README: Remove gas-mips-kernel.patch. + Apply binutils-mips64.patch and gas-mips.patch. + +2001-09-19 H.J. Lu + + * gas-mips-kernel.patch: New. + + * README: Remove binutils-mips64.patch and gas-mips.patch. + Apply gas-mips-kernel.patch. + +2001-09-07 H.J. Lu + + * binutils-mips64.patch: Updated. + 2001-08-30 H.J. Lu * README: Remove binutils-mips-reloc.patch. diff -uprN binutils-2.11.90.0.31/mips/README binutils-2.11.92.0.5/mips/README --- binutils-2.11.90.0.31/mips/README Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/mips/README Fri Oct 5 14:11:21 2001 @@ -14,7 +14,6 @@ dir=`dirname $0` -patch -p1 -b --suffix .mips64 < $dir/binutils-mips64.patch && \ -patch -p0 -b --suffix .mips < $dir/gas-mips.patch +patch -p0 -b --suffix .kernel < $dir/gas-mips-kernel.patch find -name "*.rej" | grep rej && exit 1 find -name "*.orig" | xargs rm -fv diff -uprN binutils-2.11.90.0.31/mips/binutils-mips64.patch binutils-2.11.92.0.5/mips/binutils-mips64.patch --- binutils-2.11.90.0.31/mips/binutils-mips64.patch Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/mips/binutils-mips64.patch Thu Oct 4 14:35:43 2001 @@ -1,25 +1,6 @@ ---- binutils/bfd/config.bfd.mips64 Thu Aug 30 08:38:01 2001 -+++ binutils/bfd/config.bfd Thu Aug 30 08:46:43 2001 -@@ -686,6 +686,16 @@ case "${targ}" in - targ_defvec=bfd_elf32_littlemips_vec - targ_selvecs="bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec ecoff_little_vec ecoff_big_vec" - ;; -+#ifdef BFD64 -+ mips64*el*-*-linux-gnu*) -+ targ_defvec=bfd_elf64_tradlittlemips_vec -+ targ_selvecs="bfd_elf64_tradbigmips_vec bfd_elf32_tradbigmips_vec bfd_elf32_tradlittlemips_vec ecoff_little_vec ecoff_big_vec" -+ ;; -+ mips64*-*-linux-gnu*) -+ targ_defvec=bfd_elf64_tradbigmips_vec -+ targ_selvecs="bfd_elf64_tradlittlemips_vec bfd_elf32_tradlittlemips_vec bfd_elf32_tradbigmips_vec ecoff_big_vec ecoff_little_vec" -+ ;; -+#endif - mips*el*-*-linux-gnu*) - targ_defvec=bfd_elf32_tradlittlemips_vec - targ_selvecs="bfd_elf32_tradbigmips_vec bfd_elf64_tradlittlemips_vec bfd_elf64_tradbigmips_vec ecoff_little_vec ecoff_big_vec" ---- binutils/bfd/elf32-mips.c.mips64 Thu Aug 30 08:38:16 2001 -+++ binutils/bfd/elf32-mips.c Thu Aug 30 08:46:43 2001 -@@ -1989,7 +1989,9 @@ static CONST struct elf_reloc_map mips_r +--- binutils/bfd/elf32-mips.c.mips64 Thu Oct 4 12:33:37 2001 ++++ binutils/bfd/elf32-mips.c Thu Oct 4 13:01:09 2001 +@@ -1986,7 +1986,9 @@ static const struct elf_reloc_map mips_r { BFD_RELOC_MIPS_SUB, R_MIPS_SUB }, { BFD_RELOC_MIPS_GOT_PAGE, R_MIPS_GOT_PAGE }, { BFD_RELOC_MIPS_GOT_OFST, R_MIPS_GOT_OFST }, @@ -30,7 +11,7 @@ }; /* Given a BFD reloc type, return a howto structure. */ -@@ -5600,7 +5602,7 @@ mips_elf_sort_hash_table (info, max_loca +@@ -5585,7 +5587,7 @@ mips_elf_sort_hash_table (info, max_loca mips_elf_sort_hash_table_f, &hsd); @@ -39,9 +20,9 @@ accomodate both the GOT and non-GOT symbols. */ BFD_ASSERT (hsd.max_non_got_dynindx <= hsd.min_got_dynindx); ---- binutils/bfd/elf64-mips.c.mips64 Fri Aug 17 09:17:31 2001 -+++ binutils/bfd/elf64-mips.c Thu Aug 30 08:46:44 2001 -@@ -1278,11 +1278,11 @@ mips_elf64_be_swap_reloc_in (abfd, src, +--- binutils/bfd/elf64-mips.c.mips64 Wed Oct 3 08:42:37 2001 ++++ binutils/bfd/elf64-mips.c Thu Oct 4 13:01:09 2001 +@@ -1227,11 +1227,11 @@ mips_elf64_be_swap_reloc_in (abfd, src, &mirel); dst[0].r_offset = mirel.r_offset; @@ -56,7 +37,7 @@ } /* Swap in a MIPS 64-bit Rela reloc. */ -@@ -1300,14 +1300,16 @@ mips_elf64_be_swap_reloca_in (abfd, src, +@@ -1249,14 +1249,16 @@ mips_elf64_be_swap_reloca_in (abfd, src, &mirela); dst[0].r_offset = mirela.r_offset; @@ -76,7 +57,7 @@ } /* Swap out a MIPS 64-bit Rel reloc. */ -@@ -1321,8 +1323,8 @@ mips_elf64_be_swap_reloc_out (abfd, src, +@@ -1270,8 +1272,8 @@ mips_elf64_be_swap_reloc_out (abfd, src, Elf64_Mips_Internal_Rel mirel; mirel.r_offset = src->r_offset; @@ -87,7 +68,7 @@ mirel.r_type2 = R_MIPS_NONE; mirel.r_ssym = STN_UNDEF; mirel.r_type3 = R_MIPS_NONE; -@@ -1342,9 +1344,9 @@ mips_elf64_be_swap_reloca_out (abfd, src +@@ -1291,9 +1293,9 @@ mips_elf64_be_swap_reloca_out (abfd, src Elf64_Mips_Internal_Rela mirela; mirela.r_offset = src->r_offset; @@ -99,7 +80,7 @@ mirela.r_type2 = R_MIPS_NONE; mirela.r_ssym = STN_UNDEF; mirela.r_type3 = R_MIPS_NONE; -@@ -1385,7 +1387,9 @@ static CONST struct elf_reloc_map mips_r +@@ -1334,7 +1336,9 @@ static const struct elf_reloc_map mips_r { BFD_RELOC_MIPS_SUB, R_MIPS_SUB }, { BFD_RELOC_MIPS_GOT_PAGE, R_MIPS_GOT_PAGE }, { BFD_RELOC_MIPS_GOT_OFST, R_MIPS_GOT_OFST }, @@ -110,7 +91,7 @@ }; /* Given a BFD reloc type, return a howto structure. */ -@@ -2085,7 +2089,7 @@ const struct elf_size_info mips_elf64_si +@@ -2037,7 +2041,7 @@ const struct elf_size_info mips_elf64_si sizeof (Elf64_External_Dyn), sizeof (Elf_External_Note), 4, /* hash-table entry size */ @@ -119,7 +100,7 @@ 64, /* arch_size */ 8, /* file_align */ ELFCLASS64, -@@ -2189,6 +2193,10 @@ const struct elf_size_info mips_elf64_si +@@ -2146,6 +2150,10 @@ const struct elf_size_info mips_elf64_si _bfd_archive_coff_generic_stat_arch_elt #define bfd_elf64_archive_update_armap_timestamp \ _bfd_archive_coff_update_armap_timestamp @@ -130,9 +111,9 @@ #include "elf64-target.h" ---- binutils/configure.in.mips64 Thu May 24 23:17:50 2001 -+++ binutils/configure.in Thu Aug 30 08:46:44 2001 -@@ -854,13 +854,12 @@ case "${target}" in +--- binutils/configure.in.mips64 Wed Sep 19 09:31:08 2001 ++++ binutils/configure.in Thu Oct 4 13:01:09 2001 +@@ -856,13 +856,12 @@ case "${target}" in noconfigdirs="$noconfigdirs ld gprof emacs target-libgloss" ;; mips*-*-irix6*) @@ -147,30 +128,9 @@ ;; mips*-dec-bsd*) noconfigdirs="$noconfigdirs gprof target-libgloss target-libffi" ---- binutils/gas/config/tc-mips.c.mips64 Thu Aug 30 08:38:52 2001 -+++ binutils/gas/config/tc-mips.c Thu Aug 30 08:46:44 2001 -@@ -109,6 +109,10 @@ extern int target_big_endian; - 64 bit [e.g. --target=mips64-elf]. */ - static int mips_64; - -+/* 1 if we should use the new 32 bit MIPS ELF ABI specified by SGI, 0 if -+ we should use the old MIPS ELF ABI. This has no meaning to ECOFF. */ -+static int mips_abi2; -+ - /* The default target format to use. */ - - const char * -@@ -274,6 +278,9 @@ static int mips_32bit_abi = 0; - (HAVE_32BIT_GPRS \ - || bfd_arch_bits_per_address (stdoutput) == 32) - -+#define HAVE_32BIT_LOAD_ADDRESSES \ -+ (HAVE_32BIT_ADDRESSES || mips_abi2) -+ - /* Whether the processor uses hardware interlocks to protect - reads from the HI and LO registers, and thus does not - require nops to be inserted. */ -@@ -450,11 +457,38 @@ static struct frag *prev_insn_frag; +--- binutils/gas/config/tc-mips.c.mips64 Thu Oct 4 08:46:25 2001 ++++ binutils/gas/config/tc-mips.c Thu Oct 4 13:50:14 2001 +@@ -429,11 +429,38 @@ static struct frag *prev_insn_frag; /* The offset into prev_insn_frag for the previous instruction. */ static long prev_insn_where; @@ -211,7 +171,7 @@ /* Non-zero if the previous instruction was in a delay slot. */ static int prev_insn_is_delay_slot; -@@ -664,7 +698,7 @@ static void mips16_mark_labels PARAMS (( +@@ -643,7 +670,7 @@ static void mips16_mark_labels PARAMS (( static void append_insn PARAMS ((char *place, struct mips_cl_insn * ip, expressionS * p, @@ -220,19 +180,19 @@ boolean)); static void mips_no_prev_insn PARAMS ((int)); static void mips_emit_delays PARAMS ((boolean)); -@@ -696,8 +730,10 @@ static void mips16_ip PARAMS ((char *str +@@ -675,7 +702,10 @@ static void mips16_ip PARAMS ((char *str static void mips16_immed PARAMS ((char *, unsigned int, int, offsetT, boolean, boolean, boolean, unsigned long *, boolean *, unsigned short *)); -static int my_getSmallExpression PARAMS ((expressionS * ep, char *str)); +static void get_op_reloc PARAMS ((struct mips_reloc *reloc, char *str)); - static void my_getExpression PARAMS ((expressionS * ep, char *str)); +static void my_getSmallExpression PARAMS ((expressionS * ep, -+ struct mips_reloc *, char *str)); ++ struct mips_reloc *, ++ char *str)); + static void my_getExpression PARAMS ((expressionS * ep, char *str)); + static int support_64bit_objects PARAMS((void)); static symbolS *get_symbol PARAMS ((void)); - static void mips_align PARAMS ((int to, int fill, symbolS *label)); - static void s_align PARAMS ((int)); -@@ -729,19 +765,6 @@ static const char *mips_cpu_to_str PARAM +@@ -709,19 +739,6 @@ static const char *mips_cpu_to_str PARAM static int validate_mips_insn PARAMS ((const struct mips_opcode *)); static void show PARAMS ((FILE *, char *, int *, int *)); @@ -252,7 +212,7 @@ /* Table and functions used to map between CPU/ISA names, and ISA levels, and CPU numbers. */ -@@ -888,12 +911,15 @@ static expressionS offset_expr; +@@ -868,12 +885,15 @@ static expressionS offset_expr; /* Relocs associated with imm_expr and offset_expr. */ @@ -271,16 +231,7 @@ /* These are set by mips16_ip if an explicit extension is used. */ -@@ -1217,7 +1243,7 @@ md_begin () - if (strcmp (TARGET_OS, "elf") != 0) - flags |= SEC_ALLOC | SEC_LOAD; - -- if (! mips_64) -+ if (! mips_64 || ! mips_abi2) - { - sec = subseg_new (".reginfo", (subsegT) 0); - -@@ -1293,10 +1319,13 @@ md_assemble (str) +@@ -1305,10 +1325,13 @@ md_assemble (str) struct mips_cl_insn insn; imm_expr.X_op = O_absent; @@ -296,7 +247,7 @@ if (mips_opts.mips16) mips16_ip (str, &insn); -@@ -1323,12 +1352,13 @@ md_assemble (str) +@@ -1335,12 +1358,13 @@ md_assemble (str) else { if (imm_expr.X_op != O_absent) @@ -313,7 +264,7 @@ } } -@@ -1480,12 +1510,12 @@ append_insn (place, ip, address_expr, re +@@ -1492,12 +1516,12 @@ append_insn (place, ip, address_expr, re char *place; struct mips_cl_insn *ip; expressionS *address_expr; @@ -328,7 +279,7 @@ int nops = 0; /* Mark instruction labels in mips16 mode. */ -@@ -1831,16 +1861,16 @@ append_insn (place, ip, address_expr, re +@@ -1843,16 +1867,16 @@ append_insn (place, ip, address_expr, re } } @@ -348,7 +299,7 @@ == BFD_RELOC_MIPS16_JMP)), make_expr_symbol (address_expr), (offsetT) 0, (char *) NULL); -@@ -1849,7 +1879,7 @@ append_insn (place, ip, address_expr, re +@@ -1861,7 +1885,7 @@ append_insn (place, ip, address_expr, re f = place; else if (mips_opts.mips16 && ! ip->use_extend @@ -357,7 +308,7 @@ { /* Make sure there is enough room to swap this instruction with a following jump instruction. */ -@@ -1866,12 +1896,13 @@ append_insn (place, ip, address_expr, re +@@ -1878,12 +1902,13 @@ append_insn (place, ip, address_expr, re f = frag_more (4); } @@ -374,7 +325,7 @@ { case BFD_RELOC_32: ip->insn_opcode |= address_expr->X_add_number; -@@ -1908,33 +1939,52 @@ append_insn (place, ip, address_expr, re +@@ -1924,34 +1949,53 @@ append_insn (place, ip, address_expr, re else { need_reloc: @@ -385,11 +336,13 @@ { - fixp = fix_new_exp (frag_now, f - frag_now->fr_literal, 4, - address_expr, -- reloc_type == BFD_RELOC_16_PCREL_S2, +- (reloc_type == BFD_RELOC_16_PCREL +- || reloc_type == BFD_RELOC_16_PCREL_S2), - reloc_type); + fix.fixp = fix_new_exp (frag_now, f - frag_now->fr_literal, 4, + address_expr, -+ reloc_type->r1 == BFD_RELOC_16_PCREL_S2, ++ (reloc_type->r1 == BFD_RELOC_16_PCREL ++ || reloc_type->r1 == BFD_RELOC_16_PCREL_S2), + reloc_type->r1); if (unmatched_hi) { @@ -436,7 +389,7 @@ { md_number_to_chars (f, ip->insn_opcode >> 16, 2); md_number_to_chars (f + 2, ip->insn_opcode & 0xffff, 2); -@@ -2218,7 +2268,7 @@ append_insn (place, ip, address_expr, re +@@ -2235,7 +2279,7 @@ append_insn (place, ip, address_expr, re /* If the previous instruction had a fixup in mips16 mode, we can not swap. This normally means that the previous instruction was a 4 byte branch anyhow. */ @@ -445,7 +398,7 @@ /* If the previous instruction is a sync, sync.l, or sync.p, we can not swap. */ || (prev_pinfo & INSN_SYNC)) -@@ -2244,15 +2294,36 @@ append_insn (place, ip, address_expr, re +@@ -2261,15 +2305,36 @@ append_insn (place, ip, address_expr, re memcpy (temp, prev_f, 4); memcpy (prev_f, f, 4); memcpy (f, temp, 4); @@ -488,7 +441,7 @@ } } else -@@ -2260,13 +2331,13 @@ append_insn (place, ip, address_expr, re +@@ -2277,13 +2342,13 @@ append_insn (place, ip, address_expr, re char *prev_f; char temp[2]; @@ -505,7 +458,7 @@ memcpy (f, temp, 2); } else -@@ -2274,10 +2345,18 @@ append_insn (place, ip, address_expr, re +@@ -2291,10 +2356,18 @@ append_insn (place, ip, address_expr, re memcpy (f, f + 2, 2); memcpy (f + 2, temp, 2); } @@ -527,7 +480,7 @@ } } -@@ -2295,8 +2374,10 @@ append_insn (place, ip, address_expr, re +@@ -2312,8 +2385,10 @@ append_insn (place, ip, address_expr, re prev_insn.insn_mo = &dummy_opcode; } @@ -540,7 +493,7 @@ prev_insn_extended = 0; } else if (pinfo & INSN_COND_BRANCH_LIKELY) -@@ -2309,8 +2390,10 @@ append_insn (place, ip, address_expr, re +@@ -2326,8 +2401,10 @@ append_insn (place, ip, address_expr, re /* Update the previous insn information. */ prev_prev_insn = *ip; prev_insn.insn_mo = &dummy_opcode; @@ -553,7 +506,7 @@ prev_insn_extended = 0; } else -@@ -2327,11 +2410,11 @@ append_insn (place, ip, address_expr, re +@@ -2344,11 +2421,11 @@ append_insn (place, ip, address_expr, re is not in a delay slot. */ prev_insn_is_delay_slot = 0; @@ -568,7 +521,7 @@ } prev_prev_insn_unreordered = prev_insn_unreordered; -@@ -2347,7 +2430,7 @@ append_insn (place, ip, address_expr, re +@@ -2364,7 +2441,7 @@ append_insn (place, ip, address_expr, re PC relative relocs. */ prev_prev_insn = prev_insn; prev_insn = *ip; @@ -577,7 +530,7 @@ prev_prev_insn_unreordered = prev_insn_unreordered; prev_insn_unreordered = 1; } -@@ -2387,7 +2470,8 @@ mips_no_prev_insn (preserve) +@@ -2404,7 +2481,8 @@ mips_no_prev_insn (preserve) prev_insn_is_delay_slot = 0; prev_insn_unreordered = 0; prev_insn_extended = 0; @@ -587,7 +540,7 @@ prev_prev_insn_unreordered = 0; mips_clear_insn_labels (); } -@@ -2527,6 +2611,7 @@ macro_build (place, counter, ep, name, f +@@ -2544,6 +2622,7 @@ macro_build (place, counter, ep, name, f #endif { struct mips_cl_insn insn; @@ -595,7 +548,7 @@ bfd_reloc_code_real_type r; va_list args; -@@ -2656,6 +2741,8 @@ macro_build (place, counter, ep, name, f +@@ -2673,6 +2752,8 @@ macro_build (place, counter, ep, name, f r = (bfd_reloc_code_real_type) va_arg (args, int); assert (r == BFD_RELOC_MIPS_GPREL || r == BFD_RELOC_MIPS_LITERAL @@ -604,7 +557,7 @@ || r == BFD_RELOC_LO16 || r == BFD_RELOC_MIPS_GOT16 || r == BFD_RELOC_MIPS_CALL16 -@@ -2672,6 +2759,7 @@ macro_build (place, counter, ep, name, f +@@ -2689,6 +2770,7 @@ macro_build (place, counter, ep, name, f || (ep->X_op == O_symbol && (r == BFD_RELOC_HI16_S || r == BFD_RELOC_HI16 @@ -612,7 +565,7 @@ || r == BFD_RELOC_MIPS_GOT_HI16 || r == BFD_RELOC_MIPS_CALL_HI16)) || (ep->X_op == O_subtract -@@ -2719,7 +2807,10 @@ macro_build (place, counter, ep, name, f +@@ -2739,7 +2821,10 @@ macro_build (place, counter, ep, name, f va_end (args); assert (r == BFD_RELOC_UNUSED ? ep == NULL : ep != NULL); @@ -624,7 +577,7 @@ } static void -@@ -2732,6 +2823,7 @@ mips16_macro_build (place, counter, ep, +@@ -2752,6 +2837,7 @@ mips16_macro_build (place, counter, ep, va_list args; { struct mips_cl_insn insn; @@ -632,7 +585,7 @@ bfd_reloc_code_real_type r; r = BFD_RELOC_UNUSED; -@@ -2845,7 +2937,10 @@ mips16_macro_build (place, counter, ep, +@@ -2865,7 +2951,10 @@ mips16_macro_build (place, counter, ep, assert (r == BFD_RELOC_UNUSED ? ep == NULL : ep != NULL); @@ -644,7 +597,7 @@ } /* -@@ -2860,6 +2955,7 @@ macro_build_lui (place, counter, ep, reg +@@ -2880,6 +2969,7 @@ macro_build_lui (place, counter, ep, reg { expressionS high_expr; struct mips_cl_insn insn; @@ -652,7 +605,7 @@ bfd_reloc_code_real_type r; CONST char *name = "lui"; CONST char *fmt = "t,u"; -@@ -2906,14 +3002,17 @@ macro_build_lui (place, counter, ep, reg +@@ -2926,14 +3016,17 @@ macro_build_lui (place, counter, ep, reg assert (strcmp (name, insn.insn_mo->name) == 0); assert (strcmp (fmt, insn.insn_mo->args) == 0); @@ -672,34 +625,7 @@ } /* set_at() -@@ -3366,7 +3465,7 @@ load_address (counter, reg, ep) - ep->X_add_number = 0; - frag_grow (20); - macro_build ((char *) NULL, counter, ep, -- HAVE_32BIT_ADDRESSES ? "lw" : "ld", -+ HAVE_32BIT_LOAD_ADDRESSES ? "lw" : "ld", - "t,o(b)", reg, (int) BFD_RELOC_MIPS_GOT16, GP); - macro_build ((char *) NULL, counter, (expressionS *) NULL, "nop", ""); - p = frag_var (rs_machine_dependent, 4, 0, -@@ -3413,7 +3512,7 @@ load_address (counter, reg, ep) - HAVE_32BIT_ADDRESSES ? "addu" : "daddu", - "d,v,t", reg, reg, GP); - macro_build ((char *) NULL, counter, ep, -- HAVE_32BIT_ADDRESSES ? "lw" : "ld", -+ HAVE_32BIT_LOAD_ADDRESSES ? "lw" : "ld", - "t,o(b)", reg, (int) BFD_RELOC_MIPS_GOT_LO16, reg); - p = frag_var (rs_machine_dependent, 12 + off, 0, - RELAX_ENCODE (12, 12 + off, off, 8 + off, 0, -@@ -3428,7 +3527,7 @@ load_address (counter, reg, ep) - macro_build (p, counter, (expressionS *) NULL, "nop", ""); - p += 4; - } -- macro_build (p, counter, ep, HAVE_32BIT_ADDRESSES ? "lw" : "ld", -+ macro_build (p, counter, ep, HAVE_32BIT_LOAD_ADDRESSES ? "lw" : "ld", - "t,o(b)", reg, (int) BFD_RELOC_MIPS_GOT16, GP); - p += 4; - macro_build (p, counter, (expressionS *) NULL, "nop", ""); -@@ -4241,12 +4340,48 @@ macro (ip) +@@ -4261,12 +4354,48 @@ macro (ip) offset_expr.X_add_symbol, (offsetT) 0, (char *) NULL); } @@ -711,7 +637,7 @@ - "t,r,j", tempreg, tempreg, (int) BFD_RELOC_LO16); + + if (bfd_arch_bits_per_address (stdoutput) == 32 -+ || ! mips_64 ++ || mips_abi != N64_ABI + || ! ISA_HAS_64BIT_REGS (mips_opts.isa)) + { + if (dbl && ! ISA_HAS_64BIT_REGS (mips_opts.isa)) @@ -754,45 +680,18 @@ } else if (mips_pic == SVR4_PIC && ! mips_big_got) { -@@ -4648,7 +4783,9 @@ macro (ip) +@@ -4668,7 +4797,9 @@ macro (ip) macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "jalr", "d,s", dreg, sreg); - if (mips_cprestore_offset < 0) -+ if (mips_abi2) ++ if (HAVE_NEWABI) + /* Callee-saved. */ ; + else if (mips_cprestore_offset < 0) as_warn (_("No .cprestore pseudo-op used in PIC code")); else { -@@ -4695,7 +4832,7 @@ macro (ip) - if (! mips_big_got) - { - macro_build ((char *) NULL, &icnt, &offset_expr, -- HAVE_32BIT_ADDRESSES ? "lw" : "ld", -+ HAVE_32BIT_LOAD_ADDRESSES ? "lw" : "ld", - "t,o(b)", PIC_CALL_REG, - (int) BFD_RELOC_MIPS_CALL16, GP); - macro_build ((char *) NULL, &icnt, (expressionS *) NULL, -@@ -4719,7 +4856,7 @@ macro (ip) - HAVE_32BIT_ADDRESSES ? "addu" : "daddu", - "d,v,t", PIC_CALL_REG, PIC_CALL_REG, GP); - macro_build ((char *) NULL, &icnt, &offset_expr, -- HAVE_32BIT_ADDRESSES ? "lw" : "ld", -+ HAVE_32BIT_LOAD_ADDRESSES ? "lw" : "ld", - "t,o(b)", PIC_CALL_REG, - (int) BFD_RELOC_MIPS_CALL_LO16, PIC_CALL_REG); - macro_build ((char *) NULL, &icnt, (expressionS *) NULL, -@@ -4735,7 +4872,7 @@ macro (ip) - p += 4; - } - macro_build (p, &icnt, &offset_expr, -- HAVE_32BIT_ADDRESSES ? "lw" : "ld", -+ HAVE_32BIT_LOAD_ADDRESSES ? "lw" : "ld", - "t,o(b)", PIC_CALL_REG, - (int) BFD_RELOC_MIPS_GOT16, GP); - p += 4; -@@ -4997,11 +5134,41 @@ macro (ip) +@@ -5017,11 +5148,41 @@ macro (ip) (char *) NULL); used_at = 0; } @@ -804,7 +703,7 @@ + + + if (bfd_arch_bits_per_address (stdoutput) == 32 -+ || ! mips_64 ++ || mips_abi != N64_ABI + || ! ISA_HAS_64BIT_REGS (mips_opts.isa) + || offset_expr.X_op == O_constant) + { @@ -839,16 +738,7 @@ } else { -@@ -5058,7 +5225,7 @@ macro (ip) - as_bad (_("PIC code offset overflow (max 16 signed bits)")); - frag_grow (20); - macro_build ((char *) NULL, &icnt, &offset_expr, -- HAVE_32BIT_ADDRESSES ? "lw" : "ld", -+ HAVE_32BIT_LOAD_ADDRESSES ? "lw" : "ld", - "t,o(b)", tempreg, (int) BFD_RELOC_MIPS_GOT16, GP); - macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "nop", ""); - p = frag_var (rs_machine_dependent, 4, 0, -@@ -7032,7 +7199,7 @@ mips_ip (str, ip) +@@ -7054,7 +7215,7 @@ mips_ip (str, ip) insn_error = NULL; for (args = insn->args;; ++args) { @@ -857,7 +747,7 @@ ++s; switch (*args) { -@@ -7681,33 +7848,32 @@ mips_ip (str, ip) +@@ -7704,33 +7865,32 @@ mips_ip (str, ip) case 'i': /* 16 bit unsigned immediate */ case 'j': /* 16 bit signed immediate */ @@ -910,7 +800,7 @@ || ((imm_expr.X_add_number < 0 || imm_expr.X_add_number >= 0x10000) && imm_expr.X_op == O_constant)) -@@ -7740,7 +7906,8 @@ mips_ip (str, ip) +@@ -7763,7 +7923,8 @@ mips_ip (str, ip) max = 0x8000; else max = 0x10000; @@ -920,7 +810,7 @@ || ((imm_expr.X_add_number < -0x8000 || imm_expr.X_add_number >= max) && imm_expr.X_op == O_constant) -@@ -7757,11 +7924,14 @@ mips_ip (str, ip) +@@ -7780,11 +7941,14 @@ mips_ip (str, ip) as_bad (_("16 bit expression not in range -32768..32767")); } } @@ -936,7 +826,7 @@ /* If this value won't fit into a 16 bit offset, then go find a macro that will generate the 32 bit offset -@@ -7774,7 +7944,7 @@ mips_ip (str, ip) +@@ -7797,7 +7961,7 @@ mips_ip (str, ip) fashion is that the macro function doesn't expect to see anything which can be handled in a single constant instruction. */ @@ -945,7 +835,7 @@ && (offset_expr.X_op != O_constant || offset_expr.X_add_number >= 0x8000 || offset_expr.X_add_number < -0x8000) -@@ -7784,14 +7954,28 @@ mips_ip (str, ip) +@@ -7807,14 +7971,28 @@ mips_ip (str, ip) != S_GET_SEGMENT (offset_expr.X_op_symbol)))) break; @@ -980,7 +870,7 @@ s = expr_end; continue; -@@ -7802,32 +7986,36 @@ mips_ip (str, ip) +@@ -7828,32 +8006,36 @@ mips_ip (str, ip) continue; case 'u': /* upper 16 bits */ @@ -1034,7 +924,7 @@ s = expr_end; continue; -@@ -8260,7 +8448,7 @@ mips16_ip (str, ip) +@@ -8286,7 +8468,7 @@ mips16_ip (str, ip) explicit extensions correctly. */ imm_expr.X_op = O_constant; imm_expr.X_add_number = 0; @@ -1043,7 +933,7 @@ continue; } -@@ -8268,7 +8456,7 @@ mips16_ip (str, ip) +@@ -8294,7 +8476,7 @@ mips16_ip (str, ip) } /* We need to relax this instruction. */ @@ -1052,7 +942,7 @@ s = expr_end; continue; -@@ -8616,151 +8804,34 @@ mips16_immed (file, line, type, val, war +@@ -8642,151 +8824,34 @@ mips16_immed (file, line, type, val, war } @@ -1075,41 +965,41 @@ - if (*str == '(') - c = S_EX_NONE; - else if (str[0] == '%' -- && tolower(str[1]) == 'l' -- && tolower(str[2]) == 'o' +- && TOLOWER (str[1]) == 'l' +- && TOLOWER (str[2]) == 'o' - && str[3] == '(') - { - c = S_EX_LO; - str += sizeof ("%lo(") - 2; - } - else if (str[0] == '%' -- && tolower(str[1]) == 'h' -- && tolower(str[2]) == 'i' +- && TOLOWER (str[1]) == 'h' +- && TOLOWER (str[2]) == 'i' - && str[3] == '(') - { - c = S_EX_HI; - str += sizeof ("%hi(") - 2; - } - else if (str[0] == '%' -- && tolower(str[1]) == 'h' -- && tolower(str[2]) == 'i' -- && tolower(str[3]) == 'g' -- && tolower(str[4]) == 'h' -- && tolower(str[5]) == 'e' -- && tolower(str[6]) == 'r' +- && TOLOWER (str[1]) == 'h' +- && TOLOWER (str[2]) == 'i' +- && TOLOWER (str[3]) == 'g' +- && TOLOWER (str[4]) == 'h' +- && TOLOWER (str[5]) == 'e' +- && TOLOWER (str[6]) == 'r' - && str[7] == '(') - { - c = S_EX_HIGHER; - str += sizeof ("%higher(") - 2; - } - else if (str[0] == '%' -- && tolower(str[1]) == 'h' -- && tolower(str[2]) == 'i' -- && tolower(str[3]) == 'g' -- && tolower(str[4]) == 'h' -- && tolower(str[5]) == 'e' -- && tolower(str[6]) == 's' -- && tolower(str[7]) == 't' +- && TOLOWER (str[1]) == 'h' +- && TOLOWER (str[2]) == 'i' +- && TOLOWER (str[3]) == 'g' +- && TOLOWER (str[4]) == 'h' +- && TOLOWER (str[5]) == 'e' +- && TOLOWER (str[6]) == 's' +- && TOLOWER (str[7]) == 't' - && str[8] == '(') - { - c = S_EX_HIGHEST; @@ -1118,21 +1008,21 @@ -/* currently unsupported */ -#if 0 - else if (str[0] == '%' -- && tolower(str[1]) == 'g' -- && tolower(str[2]) == 'p' -- && tolower(str[3]) == '_' -- && tolower(str[4]) == 'r' -- && tolower(str[5]) == 'e' -- && tolower(str[6]) == 'l' +- && TOLOWER (str[1]) == 'g' +- && TOLOWER (str[2]) == 'p' +- && TOLOWER (str[3]) == '_' +- && TOLOWER (str[4]) == 'r' +- && TOLOWER (str[5]) == 'e' +- && TOLOWER (str[6]) == 'l' - && str[7] == '(') - { - c = S_EX_GPREL; - str += sizeof ("%gp_rel(") - 2; - } - else if (str[0] == '%' -- && tolower(str[1]) == 'n' -- && tolower(str[2]) == 'e' -- && tolower(str[3]) == 'g' +- && TOLOWER (str[1]) == 'n' +- && TOLOWER (str[2]) == 'e' +- && TOLOWER (str[3]) == 'g' - && str[4] == '(') - { - c = S_EX_NEG; @@ -1157,9 +1047,9 @@ + /* Handle the case with no explicit offset */ + if (str[0] == '(' && str[1] == '$') { -- if (isdigit ((unsigned char) sp[-2])) +- if (ISDIGIT (sp[-2])) - { -- for (sp -= 3; sp >= str && isdigit ((unsigned char) *sp); sp--) +- for (sp -= 3; sp >= str && ISDIGIT (*sp); sp--) - ; - if (*sp == '$' && sp > str && sp[-1] == '(') - { @@ -1224,65 +1114,7 @@ } static void -@@ -8938,13 +9009,15 @@ struct option md_longopts[] = - #define OPTION_CALL_SHARED (OPTION_ELF_BASE + 0) - #define OPTION_NON_SHARED (OPTION_ELF_BASE + 1) - #define OPTION_XGOT (OPTION_ELF_BASE + 2) --#define OPTION_32 (OPTION_ELF_BASE + 3) --#define OPTION_64 (OPTION_ELF_BASE + 4) -+#define OPTION_32 (OPTION_ELF_BASE + 3) -+#define OPTION_N32 (OPTION_ELF_BASE + 4) -+#define OPTION_64 (OPTION_ELF_BASE + 5) - {"KPIC", no_argument, NULL, OPTION_CALL_SHARED}, - {"call_shared", no_argument, NULL, OPTION_CALL_SHARED}, - {"non_shared", no_argument, NULL, OPTION_NON_SHARED}, - {"xgot", no_argument, NULL, OPTION_XGOT}, - {"32", no_argument, NULL, OPTION_32}, -+ {"n32", no_argument, NULL, OPTION_N32}, - {"64", no_argument, NULL, OPTION_64}, - #endif - -@@ -9215,6 +9288,11 @@ md_parse_option (c, arg) - mips_64 = 0; - break; - -+ case OPTION_N32: -+ mips_abi2 = 1; -+ mips_abi_string = "n32"; -+ break; -+ - case OPTION_64: - { - const char **list, **l; -@@ -9233,7 +9311,9 @@ md_parse_option (c, arg) - if (*l == NULL) - as_fatal (_("No compiled in support for 64 bit object file format")); - free (list); -+ mips_abi_string = "64"; - mips_64 = 1; -+ mips_abi2 = 1; - } - break; - #endif /* OBJ_ELF */ -@@ -9277,6 +9357,7 @@ md_parse_option (c, arg) - { - mips_abi_string = arg; - mips_32bit_abi = (strcmp (arg, "32") == 0); -+ mips_abi2 = (strcmp (arg, "n32") == 0); - } - break; - -@@ -9407,7 +9488,8 @@ MIPS options:\n\ - -non_shared do not generate position independent code\n\ - -xgot assume a 32 bit GOT\n\ - -32 create 32 bit object file (default)\n\ ---64 create 64 bit object file\n")); -+-64 create 64 bit object file\n\ -+-n32 create N32 bit object file\n")); - #endif - } - -@@ -9552,7 +9634,10 @@ mips_frob_file () +@@ -9590,7 +9655,10 @@ mips_frob_file () /* When generating embedded PIC code we must keep all PC relative relocations, in case the linker has to relax a call. We also need @@ -1294,18 +1126,18 @@ int mips_force_relocation (fixp) -@@ -9562,6 +9647,10 @@ mips_force_relocation (fixp) +@@ -9600,6 +9668,10 @@ mips_force_relocation (fixp) || fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY) return 1; -+ if (mips_abi2 ++ if (HAVE_NEWABI + && S_GET_SEGMENT (fixp->fx_addsy) == bfd_abs_section_ptr) + return 1; + return (mips_pic == EMBEDDED_PIC && (fixp->fx_pcrel || SWITCH_TABLE (fixp) -@@ -9683,6 +9772,8 @@ md_apply_fix (fixP, valueP) +@@ -9722,6 +9794,8 @@ md_apply_fix (fixP, valueP) case BFD_RELOC_MIPS_JMP: case BFD_RELOC_HI16: case BFD_RELOC_HI16_S: @@ -1314,7 +1146,7 @@ case BFD_RELOC_MIPS_GPREL: case BFD_RELOC_MIPS_LITERAL: case BFD_RELOC_MIPS_CALL16: -@@ -9692,6 +9783,7 @@ md_apply_fix (fixP, valueP) +@@ -9731,6 +9805,7 @@ md_apply_fix (fixP, valueP) case BFD_RELOC_MIPS_GOT_LO16: case BFD_RELOC_MIPS_CALL_HI16: case BFD_RELOC_MIPS_CALL_LO16: @@ -1322,7 +1154,7 @@ case BFD_RELOC_MIPS16_GPREL: if (fixP->fx_pcrel) as_bad_where (fixP->fx_file, fixP->fx_line, -@@ -10486,8 +10578,9 @@ s_cpload (ignore) +@@ -10573,8 +10648,9 @@ s_cpload (ignore) expressionS ex; int icnt = 0; @@ -1330,11 +1162,11 @@ - if (mips_pic != SVR4_PIC) + /* If we are not generating SVR4 PIC code or if we're not using the + caller-saved gp convention, .cpload is ignored. */ -+ if (mips_pic != SVR4_PIC || mips_abi2) ++ if (mips_pic != SVR4_PIC || HAVE_NEWABI) { s_ignore (0); return; -@@ -10526,8 +10619,9 @@ s_cprestore (ignore) +@@ -10613,8 +10689,9 @@ s_cprestore (ignore) expressionS ex; int icnt = 0; @@ -1342,11 +1174,11 @@ - if (mips_pic != SVR4_PIC) + /* If we are not generating SVR4 PIC code or if we're not using the + caller-saved gp convention, .cprestore is ignored. */ -+ if (mips_pic != SVR4_PIC || mips_abi2) ++ if (mips_pic != SVR4_PIC || HAVE_NEWABI) { s_ignore (0); return; -@@ -10778,7 +10872,7 @@ nopic_need_relax (sym, before_relaxing) +@@ -10865,7 +10942,7 @@ nopic_need_relax (sym, before_relaxing) if (sym == 0) return 0; @@ -1355,7 +1187,7 @@ { const char *symname; int change; -@@ -11183,6 +11277,8 @@ tc_gen_reloc (section, fixp) +@@ -11269,6 +11346,8 @@ tc_gen_reloc (section, fixp) asection *section ATTRIBUTE_UNUSED; fixS *fixp; { @@ -1364,7 +1196,7 @@ static arelent *retval[4]; arelent *reloc; bfd_reloc_code_real_type code; -@@ -11190,8 +11286,21 @@ tc_gen_reloc (section, fixp) +@@ -11276,8 +11355,21 @@ tc_gen_reloc (section, fixp) reloc = retval[0] = (arelent *) xmalloc (sizeof (arelent)); retval[1] = NULL; @@ -1372,7 +1204,7 @@ + && fixp->fx_where == fixp->fx_next->fx_where + && fixp->fx_frag == fixp->fx_next->fx_frag) + { -+ assert (mips_abi2); ++ assert (HAVE_NEWABI); + combo = true; + } + else @@ -1386,7 +1218,7 @@ reloc->address = fixp->fx_frag->fr_address + fixp->fx_where; if (mips_pic == EMBEDDED_PIC -@@ -11250,7 +11359,8 @@ tc_gen_reloc (section, fixp) +@@ -11336,7 +11428,8 @@ tc_gen_reloc (section, fixp) || fixp->fx_r_type == BFD_RELOC_MIPS_GOT_HI16 || fixp->fx_r_type == BFD_RELOC_MIPS_GOT_LO16 || fixp->fx_r_type == BFD_RELOC_MIPS_CALL_HI16 @@ -1396,7 +1228,7 @@ { arelent *reloc2; -@@ -11533,6 +11643,188 @@ md_convert_frag (abfd, asec, fragp) +@@ -11619,6 +11712,188 @@ md_convert_frag (abfd, asec, fragp) } } @@ -1418,7 +1250,7 @@ + bfd_reloc_code_real_type reloc_type[3]; + int relocs; + -+ while (isspace ((unsigned char) *str)) ++ while (ISSPACE ((unsigned char) *str)) + str++; + + relocs = 0; @@ -1459,7 +1291,7 @@ + + *str++ = ' '; + -+ if (!isalpha ((unsigned char) *str)) ++ if (!ISALPHA ((unsigned char) *str)) + { + as_bad (_("missing relocation type in %%-relocation")); + return; @@ -1474,7 +1306,7 @@ + int npars; + char *s; + -+ if (mips_abi2 == 0 && ops[i].abi2) ++ if (! HAVE_NEWABI && ops[i].abi2) + { + as_bad (_("relocation type %%%s depends on N32/N64"), + ops[i].name); @@ -1512,7 +1344,7 @@ + break; + } + } -+ else if (!isspace ((unsigned char) *s)) ++ else if (!ISSPACE ((unsigned char) *s)) + reloc_has_arg = 1; + s++; + } @@ -1585,9 +1417,9 @@ #ifdef OBJ_ELF /* This function is called after the relocs have been generated. ---- binutils/ld/configure.tgt.mips64 Thu Aug 30 08:39:22 2001 -+++ binutils/ld/configure.tgt Thu Aug 30 08:46:44 2001 -@@ -292,6 +292,12 @@ mips*el-*-rtems*) targ_emul=elf32elmip ; +--- binutils/ld/configure.tgt.mips64 Fri Sep 14 17:05:36 2001 ++++ binutils/ld/configure.tgt Thu Oct 4 13:01:09 2001 +@@ -293,6 +293,12 @@ mips*el-*-rtems*) targ_emul=elf32elmip ; mips*-*-rtems*) targ_emul=elf32ebmip ;; mips*el-*-vxworks*) targ_emul=elf32elmip ;; mips*-*-vxworks*) targ_emul=elf32ebmip ;; diff -uprN binutils-2.11.90.0.31/mips/gas-mips-kernel.patch binutils-2.11.92.0.5/mips/gas-mips-kernel.patch --- binutils-2.11.90.0.31/mips/gas-mips-kernel.patch Wed Dec 31 16:00:00 1969 +++ binutils-2.11.92.0.5/mips/gas-mips-kernel.patch Mon Oct 1 15:25:26 2001 @@ -0,0 +1,21 @@ +2001-09-18 H.J. Lu + + * config/tc-mips.c (nopic_need_relax): Check + USE_GLOBAL_POINTER_OPT only if g_switch_value > 0. + +Index: gas/config/tc-mips.c +=================================================================== +RCS file: /work/cvs/gnu/binutils/gas/config/tc-mips.c,v +retrieving revision 1.57 +diff -u -p -r1.57 tc-mips.c +--- gas/config/tc-mips.c 2001/09/19 06:23:41 1.57 ++++ gas/config/tc-mips.c 2001/09/19 06:26:57 +@@ -10844,7 +10844,7 @@ nopic_need_relax (sym, before_relaxing) + if (sym == 0) + return 0; + +- if (USE_GLOBAL_POINTER_OPT) ++ if (USE_GLOBAL_POINTER_OPT && g_switch_value > 0) + { + const char *symname; + int change; diff -uprN binutils-2.11.90.0.31/opcodes/ChangeLog binutils-2.11.92.0.5/opcodes/ChangeLog --- binutils-2.11.90.0.31/opcodes/ChangeLog Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/opcodes/ChangeLog Thu Oct 4 14:35:43 2001 @@ -1,3 +1,135 @@ +2001-10-03 Alan Modra + + * po/POTFILES.in: Regenerate. + * configure: Regenerate. + +2001-10-02 Alan Modra + + * Makefile.am (Makefile): Depend on bfd/configure.in. + Run "make dep-am". + * Makefile.in: Regenerate. + +2001-09-30 John Healy + + * cgen-ibld.in (insert_1): Switched bfd_get_bits and bfd_set_bits + calls to cgen_get_insn_value and cgen_put_insn_value calls. + (extract_1): Switched bfd_get_bits call to cgen_get_insn_value call. + +2001-09-30 Hans-Peter Nilsson + + * Makefile.am: Update dependencies with "make dep-am". + * Makefile.in: Regenerate. + +2001-09-26 Alan Modra + + * arc-dis.c: Formatting fixes. + (my_sprintf): Define using VPARAMS, VA_OPEN, VA_FIXEDARG, VA_CLOSE. + +2001-09-21 Bruno Haible + + * arc-dis.c: Don't include . + * openrisc-desc.c: Likewise. + * openrisc-ibld.c: Likewise. + +2001-09-20 Nick Clifton + + * fr30-opc.c: Fix compile time warning messages. + * i370-opc.c: Fix compile time warning messages. + * i960-dis.c: Fix compile time warning messages. + * m32r-asm.c: Fix compile time warning messages. + * m32r-desc.c: Fix compile time warning messages. + * m32r-dis.c: Fix compile time warning messages. + * m32r-ibld.c: Fix compile time warning messages. + * m32r-opc.c: Fix compile time warning messages. + * m32r-opinst.c: Fix compile time warning messages. + * ns32k-dis.c: Fix compile time warning messages. + * openrisc-asm.c: Fix compile time warning messages. + * openrisc-desc.c: Fix compile time warning messages. + * openrisc-dis.c: Fix compile time warning messages. + * openrisc-ibld.c: Fix compile time warning messages. + * openrisc-opc.c: Fix compile time warning messages. + * pdp11-dis.c: Fix compile time warning messages. + * tic54x-dis.c: Fix compile time warning messages. + * v850-opc.c: Fix compile time warning messages. + * vax-dis.c: Fix compile time warning messages. + * w65-opc.h: Fix compile time warning messages. + * z8k-opc.h: Fix compile time warning messages. + * z8kgen.c: Fix compile time warning messages. + +2001-09-19 Nick Clifton + + * arm-dis.c: Fix compile time warning messages. + * cgen-asm.c: Fix compile time warning messages. + * cgen-dis.c: Fix compile time warning messages. + * cris-dis.c: Fix compile time warning messages. + * d10v-dis.c: Fix compile time warning messages. + * fr30-asm.c: Fix compile time warning messages. + * fr30-desc.c: Fix compile time warning messages. + * fr30-dis.c: Fix compile time warning messages. + * fr30-ibld.c: Fix compile time warning messages. + +2001-09-18 Bruno Haible + + * cgen-asm.c: Include "safe-ctype.h" instead of . + (cgen_parse_keyword): Use ISALNUM instead of isalnum. + * cgen-opc.c: Include "safe-ctype.h" instead of . + (cgen_keyword_lookup_name): Use ISALPHA/TOLOWER instead of + isalpha/tolower. + (cgen_keyword_add): Use ISALNUM instead of isalnum. + (hash_keyword_name): Use TOLOWER instead of tolower. + * fr30-asm.c: Include "safe-ctype.h" instead of . + (parse_insn_normal): Use TOLOWER/ISSPACE instead of + tolower/isspace. + (fr30_cgen_assemble_insn): Use ISSPACE instead of isspace. + * fr30-desc.c: Don't include . + * fr30-ibld.c: Likewise. + * ia64-gen.c: Include "safe-ctype.h" instead of . + (load_insn_classes, parse_resource_users, load_depfile): Use + ISSPACE instead of isspace. + * m32r-asm.c: Include "safe-ctype.h" instead of . + (parse_insn_normal): Use TOLOWER/ISSPACE instead of + tolower/isspace. + (m32r_cgen_assemble_insn): Use ISSPACE instead of isspace. + * m32r-desc.c: Don't include . + * m32r-ibld.c: Likewise. + * openrisc-asm.c: Include "safe-ctype.h" instead of . + (parse_insn_normal): Use TOLOWER/ISSPACE instead of + tolower/isspace. + (openrisc_cgen_assemble_insn): Use ISSPACE instead of isspace. + +2001-09-18 Martin Schwidefsky + + * Makefile.am: Add rules and dependencies to create the s/390 opcode + table out of s390-opc.txt automatically. + * configure.in: Add BFD_CC_FOR_BUILD to allow CC_FOR_BUILD to be used. + * s390-mkopc.c (dumpTable): Change output to create a complete file. + * s390-opc.c: New improved opcode format macros and remove the + pregenerated opcode table. + * s390-opc.txt: Adapt to new improved opcode format macros. + +2001-09-14 David Schleef + + * ppc-opc.c (VXA, VXA_MASK): Fix mask bits. + +2001-09-04 Alan Modra + + * i386-dis.c (grps): Don't print the implicit al/ax/eax register + for opcode 0xf6 or 0xf7 forms of mul, imul, div, idiv insns. + +2001-08-31 Eric Christopher + Jason Eckhardt + + * mips-dis.c: Add support for bfd_mach_mipsisa32 and + bfd_mach_mipsisa64. Remove bfd_mach_mips32, bfd_mach_mips32_4k, + bfd_mach_mips64. + +2001-08-31 Andreas Jaeger + + * tic54x-opc.c: Add default initializers to avoid warnings. + + * arc-opc.c: Include "sysdep.h" to get stdio.h as include file. + * arc-ext.c: Likewise. + 2001-08-28 matthew gren * ppc-opc.c (icbt): Order correctly. diff -uprN binutils-2.11.90.0.31/opcodes/Makefile.am binutils-2.11.92.0.5/opcodes/Makefile.am --- binutils-2.11.90.0.31/opcodes/Makefile.am Thu Jul 26 18:02:55 2001 +++ binutils-2.11.92.0.5/opcodes/Makefile.am Thu Oct 4 14:35:43 2001 @@ -109,6 +109,7 @@ CFILES = \ pj-opc.c \ ppc-dis.c \ ppc-opc.c \ + s390-mkopc.c \ s390-opc.c \ s390-dis.c \ sh-dis.c \ @@ -305,6 +306,14 @@ ia64-gen.o: ia64-gen.c ia64-opc.c ia64-o ia64-asmtab.c: @MAINT@ ia64-gen ia64-ic.tbl ia64-raw.tbl ia64-waw.tbl ia64-war.tbl here=`pwd`; cd $(srcdir); $$here/ia64-gen > ia64-asmtab.c +s390-mkopc: s390-mkopc.c + $(CC_FOR_BUILD) -o s390-mkopc $(srcdir)/s390-mkopc.c + +s390-opc.tab: s390-mkopc s390-opc.txt + ./s390-mkopc < $(srcdir)/s390-opc.txt > s390-opc.tab + +Makefile: $(BFDDIR)/configure.in + # This dependency stuff is copied from BFD. DEP: dep.sed $(CFILES) $(HFILES) config.h @@ -353,53 +362,60 @@ dep-am: DEP # DO NOT DELETE THIS LINE -- mkdep uses it. # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. a29k-dis.lo: a29k-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/opcode/a29k.h + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/a29k.h alpha-dis.lo: alpha-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/opcode/alpha.h + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/alpha.h alpha-opc.lo: alpha-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/opcode/alpha.h $(BFD_H) opintl.h + $(INCDIR)/opcode/alpha.h $(BFD_H) $(INCDIR)/symcat.h \ + opintl.h arc-dis.lo: arc-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \ - $(INCDIR)/opcode/arc.h $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/elf/arc.h $(INCDIR)/elf/reloc-macros.h opintl.h \ - arc-dis.h arc-ext.h -arc-opc.lo: arc-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/arc.h -arc-ext.lo: arc-ext.c $(BFD_H) $(INCDIR)/ansidecl.h \ - arc-ext.h $(INCDIR)/libiberty.h -arm-dis.lo: arm-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) arm-opc.h $(INCDIR)/coff/internal.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h opintl.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/symcat.h $(INCDIR)/opcode/arc.h $(BFDDIR)/elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h + $(INCDIR)/bfdlink.h $(INCDIR)/elf/arc.h $(INCDIR)/elf/reloc-macros.h \ + opintl.h arc-dis.h arc-ext.h +arc-opc.lo: arc-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/opcode/arc.h +arc-ext.lo: arc-ext.c sysdep.h config.h $(INCDIR)/ansidecl.h \ + $(BFD_H) $(INCDIR)/symcat.h arc-ext.h $(INCDIR)/libiberty.h +arm-dis.lo: arm-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h arm-opc.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + opintl.h $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/arm.h \ + $(INCDIR)/elf/reloc-macros.h avr-dis.lo: avr-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) opintl.h $(INCDIR)/opcode/avr.h + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h opintl.h \ + $(INCDIR)/opcode/avr.h cgen-asm.lo: cgen-asm.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/libiberty.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/cgen.h \ - opintl.h + $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h $(BFD_H) \ + $(INCDIR)/symcat.h $(INCDIR)/opcode/cgen.h opintl.h cgen-dis.lo: cgen-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/libiberty.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/cgen.h cgen-opc.lo: cgen-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/libiberty.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/cgen.h + $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h $(BFD_H) \ + $(INCDIR)/symcat.h $(INCDIR)/opcode/cgen.h cris-dis.lo: cris-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \ - $(INCDIR)/ansidecl.h sysdep.h config.h $(INCDIR)/opcode/cris.h \ - $(INCDIR)/libiberty.h + $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h sysdep.h config.h \ + $(INCDIR)/opcode/cris.h $(INCDIR)/libiberty.h cris-opc.lo: cris-opc.c $(INCDIR)/opcode/cris.h d10v-dis.lo: d10v-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/opcode/d10v.h $(INCDIR)/dis-asm.h $(BFD_H) + $(INCDIR)/opcode/d10v.h $(INCDIR)/dis-asm.h $(BFD_H) \ + $(INCDIR)/symcat.h d10v-opc.lo: d10v-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/d10v.h d30v-dis.lo: d30v-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/d30v.h $(INCDIR)/dis-asm.h $(BFD_H) \ - opintl.h + $(INCDIR)/symcat.h opintl.h d30v-opc.lo: d30v-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/d30v.h dis-buf.lo: dis-buf.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) opintl.h + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h opintl.h disassemble.lo: disassemble.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h fr30-asm.lo: fr30-asm.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(BFD_H) $(INCDIR)/symcat.h fr30-desc.h $(INCDIR)/opcode/cgen.h \ - fr30-opc.h opintl.h + $(INCDIR)/safe-ctype.h $(BFD_H) $(INCDIR)/symcat.h \ + fr30-desc.h $(INCDIR)/opcode/cgen.h fr30-opc.h opintl.h \ + $(INCDIR)/xregex.h $(INCDIR)/xregex2.h $(INCDIR)/libiberty.h fr30-desc.lo: fr30-desc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(BFD_H) $(INCDIR)/symcat.h fr30-desc.h $(INCDIR)/opcode/cgen.h \ fr30-opc.h opintl.h $(INCDIR)/libiberty.h @@ -414,23 +430,26 @@ fr30-opc.lo: fr30-opc.c sysdep.h config. fr30-opc.h $(INCDIR)/libiberty.h h8300-dis.lo: h8300-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/h8300.h $(INCDIR)/dis-asm.h $(BFD_H) \ - opintl.h + $(INCDIR)/symcat.h opintl.h h8500-dis.lo: h8500-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - h8500-opc.h $(INCDIR)/dis-asm.h $(BFD_H) opintl.h + h8500-opc.h $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h \ + opintl.h hppa-dis.lo: hppa-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) $(BFDDIR)/libhppa.h $(INCDIR)/opcode/hppa.h + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(BFDDIR)/libhppa.h \ + $(INCDIR)/opcode/hppa.h i370-dis.lo: i370-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/opcode/i370.h + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/i370.h i370-opc.lo: i370-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/i370.h i386-dis.lo: i386-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \ - $(INCDIR)/ansidecl.h sysdep.h config.h opintl.h + $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h sysdep.h config.h \ + opintl.h i860-dis.lo: i860-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \ - $(INCDIR)/ansidecl.h $(INCDIR)/opcode/i860.h + $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h $(INCDIR)/opcode/i860.h i960-dis.lo: i960-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h ia64-dis.lo: ia64-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \ - $(INCDIR)/ansidecl.h $(INCDIR)/opcode/ia64.h + $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h $(INCDIR)/opcode/ia64.h ia64-opc-a.lo: ia64-opc-a.c ia64-opc.h $(INCDIR)/opcode/ia64.h ia64-opc-b.lo: ia64-opc-b.c ia64-opc.h $(INCDIR)/opcode/ia64.h ia64-opc-f.lo: ia64-opc-f.c ia64-opc.h $(INCDIR)/opcode/ia64.h @@ -441,13 +460,14 @@ ia64-opc.lo: ia64-opc.c $(INCDIR)/anside sysdep.h config.h ia64-asmtab.h $(INCDIR)/opcode/ia64.h \ ia64-asmtab.c ia64-gen.lo: ia64-gen.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ - sysdep.h config.h ia64-opc.h $(INCDIR)/opcode/ia64.h \ - ia64-opc-a.c ia64-opc-i.c ia64-opc-m.c ia64-opc-b.c \ - ia64-opc-f.c ia64-opc-x.c ia64-opc-d.c + $(INCDIR)/safe-ctype.h sysdep.h config.h ia64-opc.h \ + $(INCDIR)/opcode/ia64.h ia64-opc-a.c ia64-opc-i.c ia64-opc-m.c \ + ia64-opc-b.c ia64-opc-f.c ia64-opc-x.c ia64-opc-d.c ia64-asmtab.lo: ia64-asmtab.c m32r-asm.lo: m32r-asm.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(BFD_H) $(INCDIR)/symcat.h m32r-desc.h $(INCDIR)/opcode/cgen.h \ - m32r-opc.h opintl.h + $(INCDIR)/safe-ctype.h $(BFD_H) $(INCDIR)/symcat.h \ + m32r-desc.h $(INCDIR)/opcode/cgen.h m32r-opc.h opintl.h \ + $(INCDIR)/xregex.h $(INCDIR)/xregex2.h $(INCDIR)/libiberty.h m32r-desc.lo: m32r-desc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(BFD_H) $(INCDIR)/symcat.h m32r-desc.h $(INCDIR)/opcode/cgen.h \ m32r-opc.h opintl.h $(INCDIR)/libiberty.h @@ -464,21 +484,22 @@ m32r-opinst.lo: m32r-opinst.c sysdep.h c $(BFD_H) $(INCDIR)/symcat.h m32r-desc.h $(INCDIR)/opcode/cgen.h \ m32r-opc.h m68hc11-dis.lo: m68hc11-dis.c $(INCDIR)/ansidecl.h \ - $(INCDIR)/opcode/m68hc11.h $(INCDIR)/dis-asm.h $(BFD_H) + $(INCDIR)/opcode/m68hc11.h $(INCDIR)/dis-asm.h $(BFD_H) \ + $(INCDIR)/symcat.h m68hc11-opc.lo: m68hc11-opc.c $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/m68hc11.h m68k-dis.lo: m68k-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/floatformat.h \ + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/floatformat.h \ opintl.h $(INCDIR)/opcode/m68k.h m68k-opc.lo: m68k-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/m68k.h m88k-dis.lo: m88k-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/opcode/m88k.h \ + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/m88k.h \ opintl.h mcore-dis.lo: mcore-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - mcore-opc.h $(INCDIR)/dis-asm.h $(BFD_H) + mcore-opc.h $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h mips-dis.lo: mips-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/opcode/mips.h \ + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/mips.h \ opintl.h $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h @@ -488,20 +509,21 @@ mips16-opc.lo: mips16-opc.c sysdep.h con $(INCDIR)/opcode/mips.h m10200-dis.lo: m10200-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/mn10200.h $(INCDIR)/dis-asm.h $(BFD_H) \ - opintl.h + $(INCDIR)/symcat.h opintl.h m10200-opc.lo: m10200-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/mn10200.h m10300-dis.lo: m10300-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/mn10300.h $(INCDIR)/dis-asm.h $(BFD_H) \ - opintl.h + $(INCDIR)/symcat.h opintl.h m10300-opc.lo: m10300-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/mn10300.h ns32k-dis.lo: ns32k-dis.c $(BFD_H) $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/dis-asm.h $(INCDIR)/opcode/ns32k.h \ - opintl.h + $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/dis-asm.h \ + $(INCDIR)/opcode/ns32k.h opintl.h openrisc-asm.lo: openrisc-asm.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(BFD_H) $(INCDIR)/symcat.h openrisc-desc.h $(INCDIR)/opcode/cgen.h \ - openrisc-opc.h opintl.h + $(INCDIR)/safe-ctype.h $(BFD_H) $(INCDIR)/symcat.h \ + openrisc-desc.h $(INCDIR)/opcode/cgen.h openrisc-opc.h \ + opintl.h $(INCDIR)/xregex.h $(INCDIR)/xregex2.h $(INCDIR)/libiberty.h openrisc-desc.lo: openrisc-desc.c sysdep.h config.h \ $(INCDIR)/ansidecl.h $(BFD_H) $(INCDIR)/symcat.h openrisc-desc.h \ $(INCDIR)/opcode/cgen.h openrisc-opc.h opintl.h $(INCDIR)/libiberty.h @@ -515,48 +537,54 @@ openrisc-ibld.lo: openrisc-ibld.c sysdep openrisc-opc.lo: openrisc-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(BFD_H) $(INCDIR)/symcat.h openrisc-desc.h $(INCDIR)/opcode/cgen.h \ openrisc-opc.h $(INCDIR)/libiberty.h -pdp11-dis.lo: pdp11-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \ - $(INCDIR)/ansidecl.h $(INCDIR)/opcode/pdp11.h +pdp11-dis.lo: pdp11-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/pdp11.h pdp11-opc.lo: pdp11-opc.c $(INCDIR)/opcode/pdp11.h pj-dis.lo: pj-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/opcode/pj.h $(INCDIR)/dis-asm.h $(BFD_H) + $(INCDIR)/opcode/pj.h $(INCDIR)/dis-asm.h $(BFD_H) \ + $(INCDIR)/symcat.h pj-opc.lo: pj-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/pj.h ppc-dis.lo: ppc-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/opcode/ppc.h + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/ppc.h ppc-opc.lo: ppc-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/ppc.h opintl.h -s390-opc.lo: s390-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/s390.h +s390-mkopc.lo: s390-mkopc.c +s390-opc.lo: s390-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/s390.h \ + s390-opc.tab s390-dis.lo: s390-dis.c $(INCDIR)/ansidecl.h sysdep.h \ - config.h $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/opcode/s390.h + config.h $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h \ + $(INCDIR)/opcode/s390.h sh-dis.lo: sh-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - sh-opc.h $(INCDIR)/dis-asm.h $(BFD_H) + sh-opc.h $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h sparc-dis.lo: sparc-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/sparc.h $(INCDIR)/dis-asm.h $(BFD_H) \ - $(INCDIR)/libiberty.h opintl.h + $(INCDIR)/symcat.h $(INCDIR)/libiberty.h opintl.h sparc-opc.lo: sparc-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/sparc.h tic30-dis.lo: tic30-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/opcode/tic30.h + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/tic30.h tic54x-dis.lo: tic54x-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/opcode/tic54x.h \ + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/tic54x.h \ $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h tic54x-opc.lo: tic54x-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/tic54x.h tic80-dis.lo: tic80-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/opcode/tic80.h $(INCDIR)/dis-asm.h $(BFD_H) + $(INCDIR)/opcode/tic80.h $(INCDIR)/dis-asm.h $(BFD_H) \ + $(INCDIR)/symcat.h tic80-opc.lo: tic80-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/tic80.h v850-dis.lo: v850-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/v850.h $(INCDIR)/dis-asm.h $(BFD_H) \ - opintl.h + $(INCDIR)/symcat.h opintl.h v850-opc.lo: v850-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/v850.h opintl.h vax-dis.lo: vax-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/opcode/vax.h $(INCDIR)/dis-asm.h $(BFD_H) + $(INCDIR)/opcode/vax.h $(INCDIR)/dis-asm.h $(BFD_H) \ + $(INCDIR)/symcat.h w65-dis.lo: w65-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - w65-opc.h $(INCDIR)/dis-asm.h $(BFD_H) + w65-opc.h $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h z8k-dis.lo: z8k-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) z8k-opc.h + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h z8k-opc.h z8kgen.lo: z8kgen.c sysdep.h config.h $(INCDIR)/ansidecl.h # IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff -uprN binutils-2.11.90.0.31/opcodes/Makefile.in binutils-2.11.92.0.5/opcodes/Makefile.in --- binutils-2.11.90.0.31/opcodes/Makefile.in Thu Jul 26 18:02:55 2001 +++ binutils-2.11.92.0.5/opcodes/Makefile.in Thu Oct 4 14:35:43 2001 @@ -220,6 +220,7 @@ CFILES = \ pj-opc.c \ ppc-dis.c \ ppc-opc.c \ + s390-mkopc.c \ s390-opc.c \ s390-dis.c \ sh-dis.c \ @@ -816,6 +817,14 @@ ia64-gen.o: ia64-gen.c ia64-opc.c ia64-o ia64-asmtab.c: @MAINT@ ia64-gen ia64-ic.tbl ia64-raw.tbl ia64-waw.tbl ia64-war.tbl here=`pwd`; cd $(srcdir); $$here/ia64-gen > ia64-asmtab.c +s390-mkopc: s390-mkopc.c + $(CC_FOR_BUILD) -o s390-mkopc $(srcdir)/s390-mkopc.c + +s390-opc.tab: s390-mkopc s390-opc.txt + ./s390-mkopc < $(srcdir)/s390-opc.txt > s390-opc.tab + +Makefile: $(BFDDIR)/configure.in + # This dependency stuff is copied from BFD. DEP: dep.sed $(CFILES) $(HFILES) config.h @@ -864,53 +873,60 @@ dep-am: DEP # DO NOT DELETE THIS LINE -- mkdep uses it. # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. a29k-dis.lo: a29k-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/opcode/a29k.h + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/a29k.h alpha-dis.lo: alpha-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/opcode/alpha.h + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/alpha.h alpha-opc.lo: alpha-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/opcode/alpha.h $(BFD_H) opintl.h + $(INCDIR)/opcode/alpha.h $(BFD_H) $(INCDIR)/symcat.h \ + opintl.h arc-dis.lo: arc-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \ - $(INCDIR)/opcode/arc.h $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/elf/arc.h $(INCDIR)/elf/reloc-macros.h opintl.h \ - arc-dis.h arc-ext.h -arc-opc.lo: arc-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/arc.h -arc-ext.lo: arc-ext.c $(BFD_H) $(INCDIR)/ansidecl.h \ - arc-ext.h $(INCDIR)/libiberty.h -arm-dis.lo: arm-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) arm-opc.h $(INCDIR)/coff/internal.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h opintl.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/symcat.h $(INCDIR)/opcode/arc.h $(BFDDIR)/elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h + $(INCDIR)/bfdlink.h $(INCDIR)/elf/arc.h $(INCDIR)/elf/reloc-macros.h \ + opintl.h arc-dis.h arc-ext.h +arc-opc.lo: arc-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/opcode/arc.h +arc-ext.lo: arc-ext.c sysdep.h config.h $(INCDIR)/ansidecl.h \ + $(BFD_H) $(INCDIR)/symcat.h arc-ext.h $(INCDIR)/libiberty.h +arm-dis.lo: arm-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h arm-opc.h \ + $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ + opintl.h $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/arm.h \ + $(INCDIR)/elf/reloc-macros.h avr-dis.lo: avr-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) opintl.h $(INCDIR)/opcode/avr.h + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h opintl.h \ + $(INCDIR)/opcode/avr.h cgen-asm.lo: cgen-asm.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/libiberty.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/cgen.h \ - opintl.h + $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h $(BFD_H) \ + $(INCDIR)/symcat.h $(INCDIR)/opcode/cgen.h opintl.h cgen-dis.lo: cgen-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/libiberty.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/cgen.h cgen-opc.lo: cgen-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/libiberty.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/cgen.h + $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h $(BFD_H) \ + $(INCDIR)/symcat.h $(INCDIR)/opcode/cgen.h cris-dis.lo: cris-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \ - $(INCDIR)/ansidecl.h sysdep.h config.h $(INCDIR)/opcode/cris.h \ - $(INCDIR)/libiberty.h + $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h sysdep.h config.h \ + $(INCDIR)/opcode/cris.h $(INCDIR)/libiberty.h cris-opc.lo: cris-opc.c $(INCDIR)/opcode/cris.h d10v-dis.lo: d10v-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/opcode/d10v.h $(INCDIR)/dis-asm.h $(BFD_H) + $(INCDIR)/opcode/d10v.h $(INCDIR)/dis-asm.h $(BFD_H) \ + $(INCDIR)/symcat.h d10v-opc.lo: d10v-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/d10v.h d30v-dis.lo: d30v-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/d30v.h $(INCDIR)/dis-asm.h $(BFD_H) \ - opintl.h + $(INCDIR)/symcat.h opintl.h d30v-opc.lo: d30v-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/d30v.h dis-buf.lo: dis-buf.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) opintl.h + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h opintl.h disassemble.lo: disassemble.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h fr30-asm.lo: fr30-asm.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(BFD_H) $(INCDIR)/symcat.h fr30-desc.h $(INCDIR)/opcode/cgen.h \ - fr30-opc.h opintl.h + $(INCDIR)/safe-ctype.h $(BFD_H) $(INCDIR)/symcat.h \ + fr30-desc.h $(INCDIR)/opcode/cgen.h fr30-opc.h opintl.h \ + $(INCDIR)/xregex.h $(INCDIR)/xregex2.h $(INCDIR)/libiberty.h fr30-desc.lo: fr30-desc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(BFD_H) $(INCDIR)/symcat.h fr30-desc.h $(INCDIR)/opcode/cgen.h \ fr30-opc.h opintl.h $(INCDIR)/libiberty.h @@ -925,23 +941,26 @@ fr30-opc.lo: fr30-opc.c sysdep.h config. fr30-opc.h $(INCDIR)/libiberty.h h8300-dis.lo: h8300-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/h8300.h $(INCDIR)/dis-asm.h $(BFD_H) \ - opintl.h + $(INCDIR)/symcat.h opintl.h h8500-dis.lo: h8500-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - h8500-opc.h $(INCDIR)/dis-asm.h $(BFD_H) opintl.h + h8500-opc.h $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h \ + opintl.h hppa-dis.lo: hppa-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) $(BFDDIR)/libhppa.h $(INCDIR)/opcode/hppa.h + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(BFDDIR)/libhppa.h \ + $(INCDIR)/opcode/hppa.h i370-dis.lo: i370-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/opcode/i370.h + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/i370.h i370-opc.lo: i370-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/i370.h i386-dis.lo: i386-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \ - $(INCDIR)/ansidecl.h sysdep.h config.h opintl.h + $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h sysdep.h config.h \ + opintl.h i860-dis.lo: i860-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \ - $(INCDIR)/ansidecl.h $(INCDIR)/opcode/i860.h + $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h $(INCDIR)/opcode/i860.h i960-dis.lo: i960-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h ia64-dis.lo: ia64-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \ - $(INCDIR)/ansidecl.h $(INCDIR)/opcode/ia64.h + $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h $(INCDIR)/opcode/ia64.h ia64-opc-a.lo: ia64-opc-a.c ia64-opc.h $(INCDIR)/opcode/ia64.h ia64-opc-b.lo: ia64-opc-b.c ia64-opc.h $(INCDIR)/opcode/ia64.h ia64-opc-f.lo: ia64-opc-f.c ia64-opc.h $(INCDIR)/opcode/ia64.h @@ -952,13 +971,14 @@ ia64-opc.lo: ia64-opc.c $(INCDIR)/anside sysdep.h config.h ia64-asmtab.h $(INCDIR)/opcode/ia64.h \ ia64-asmtab.c ia64-gen.lo: ia64-gen.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ - sysdep.h config.h ia64-opc.h $(INCDIR)/opcode/ia64.h \ - ia64-opc-a.c ia64-opc-i.c ia64-opc-m.c ia64-opc-b.c \ - ia64-opc-f.c ia64-opc-x.c ia64-opc-d.c + $(INCDIR)/safe-ctype.h sysdep.h config.h ia64-opc.h \ + $(INCDIR)/opcode/ia64.h ia64-opc-a.c ia64-opc-i.c ia64-opc-m.c \ + ia64-opc-b.c ia64-opc-f.c ia64-opc-x.c ia64-opc-d.c ia64-asmtab.lo: ia64-asmtab.c m32r-asm.lo: m32r-asm.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(BFD_H) $(INCDIR)/symcat.h m32r-desc.h $(INCDIR)/opcode/cgen.h \ - m32r-opc.h opintl.h + $(INCDIR)/safe-ctype.h $(BFD_H) $(INCDIR)/symcat.h \ + m32r-desc.h $(INCDIR)/opcode/cgen.h m32r-opc.h opintl.h \ + $(INCDIR)/xregex.h $(INCDIR)/xregex2.h $(INCDIR)/libiberty.h m32r-desc.lo: m32r-desc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(BFD_H) $(INCDIR)/symcat.h m32r-desc.h $(INCDIR)/opcode/cgen.h \ m32r-opc.h opintl.h $(INCDIR)/libiberty.h @@ -975,21 +995,22 @@ m32r-opinst.lo: m32r-opinst.c sysdep.h c $(BFD_H) $(INCDIR)/symcat.h m32r-desc.h $(INCDIR)/opcode/cgen.h \ m32r-opc.h m68hc11-dis.lo: m68hc11-dis.c $(INCDIR)/ansidecl.h \ - $(INCDIR)/opcode/m68hc11.h $(INCDIR)/dis-asm.h $(BFD_H) + $(INCDIR)/opcode/m68hc11.h $(INCDIR)/dis-asm.h $(BFD_H) \ + $(INCDIR)/symcat.h m68hc11-opc.lo: m68hc11-opc.c $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/m68hc11.h m68k-dis.lo: m68k-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/floatformat.h \ + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/floatformat.h \ opintl.h $(INCDIR)/opcode/m68k.h m68k-opc.lo: m68k-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/m68k.h m88k-dis.lo: m88k-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/opcode/m88k.h \ + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/m88k.h \ opintl.h mcore-dis.lo: mcore-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - mcore-opc.h $(INCDIR)/dis-asm.h $(BFD_H) + mcore-opc.h $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h mips-dis.lo: mips-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/opcode/mips.h \ + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/mips.h \ opintl.h $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h @@ -999,20 +1020,21 @@ mips16-opc.lo: mips16-opc.c sysdep.h con $(INCDIR)/opcode/mips.h m10200-dis.lo: m10200-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/mn10200.h $(INCDIR)/dis-asm.h $(BFD_H) \ - opintl.h + $(INCDIR)/symcat.h opintl.h m10200-opc.lo: m10200-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/mn10200.h m10300-dis.lo: m10300-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/mn10300.h $(INCDIR)/dis-asm.h $(BFD_H) \ - opintl.h + $(INCDIR)/symcat.h opintl.h m10300-opc.lo: m10300-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/mn10300.h ns32k-dis.lo: ns32k-dis.c $(BFD_H) $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/dis-asm.h $(INCDIR)/opcode/ns32k.h \ - opintl.h + $(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/dis-asm.h \ + $(INCDIR)/opcode/ns32k.h opintl.h openrisc-asm.lo: openrisc-asm.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(BFD_H) $(INCDIR)/symcat.h openrisc-desc.h $(INCDIR)/opcode/cgen.h \ - openrisc-opc.h opintl.h + $(INCDIR)/safe-ctype.h $(BFD_H) $(INCDIR)/symcat.h \ + openrisc-desc.h $(INCDIR)/opcode/cgen.h openrisc-opc.h \ + opintl.h $(INCDIR)/xregex.h $(INCDIR)/xregex2.h $(INCDIR)/libiberty.h openrisc-desc.lo: openrisc-desc.c sysdep.h config.h \ $(INCDIR)/ansidecl.h $(BFD_H) $(INCDIR)/symcat.h openrisc-desc.h \ $(INCDIR)/opcode/cgen.h openrisc-opc.h opintl.h $(INCDIR)/libiberty.h @@ -1026,49 +1048,55 @@ openrisc-ibld.lo: openrisc-ibld.c sysdep openrisc-opc.lo: openrisc-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(BFD_H) $(INCDIR)/symcat.h openrisc-desc.h $(INCDIR)/opcode/cgen.h \ openrisc-opc.h $(INCDIR)/libiberty.h -pdp11-dis.lo: pdp11-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \ - $(INCDIR)/ansidecl.h $(INCDIR)/opcode/pdp11.h +pdp11-dis.lo: pdp11-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/pdp11.h pdp11-opc.lo: pdp11-opc.c $(INCDIR)/opcode/pdp11.h pj-dis.lo: pj-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/opcode/pj.h $(INCDIR)/dis-asm.h $(BFD_H) + $(INCDIR)/opcode/pj.h $(INCDIR)/dis-asm.h $(BFD_H) \ + $(INCDIR)/symcat.h pj-opc.lo: pj-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/pj.h ppc-dis.lo: ppc-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/opcode/ppc.h + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/ppc.h ppc-opc.lo: ppc-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/ppc.h opintl.h -s390-opc.lo: s390-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/s390.h +s390-mkopc.lo: s390-mkopc.c +s390-opc.lo: s390-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/s390.h \ + s390-opc.tab s390-dis.lo: s390-dis.c $(INCDIR)/ansidecl.h sysdep.h \ - config.h $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/opcode/s390.h + config.h $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h \ + $(INCDIR)/opcode/s390.h sh-dis.lo: sh-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - sh-opc.h $(INCDIR)/dis-asm.h $(BFD_H) + sh-opc.h $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h sparc-dis.lo: sparc-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/sparc.h $(INCDIR)/dis-asm.h $(BFD_H) \ - $(INCDIR)/libiberty.h opintl.h + $(INCDIR)/symcat.h $(INCDIR)/libiberty.h opintl.h sparc-opc.lo: sparc-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/sparc.h tic30-dis.lo: tic30-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/opcode/tic30.h + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/tic30.h tic54x-dis.lo: tic54x-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/opcode/tic54x.h \ + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/tic54x.h \ $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h tic54x-opc.lo: tic54x-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/tic54x.h tic80-dis.lo: tic80-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/opcode/tic80.h $(INCDIR)/dis-asm.h $(BFD_H) + $(INCDIR)/opcode/tic80.h $(INCDIR)/dis-asm.h $(BFD_H) \ + $(INCDIR)/symcat.h tic80-opc.lo: tic80-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/tic80.h v850-dis.lo: v850-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/v850.h $(INCDIR)/dis-asm.h $(BFD_H) \ - opintl.h + $(INCDIR)/symcat.h opintl.h v850-opc.lo: v850-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/v850.h opintl.h vax-dis.lo: vax-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/opcode/vax.h $(INCDIR)/dis-asm.h $(BFD_H) + $(INCDIR)/opcode/vax.h $(INCDIR)/dis-asm.h $(BFD_H) \ + $(INCDIR)/symcat.h w65-dis.lo: w65-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - w65-opc.h $(INCDIR)/dis-asm.h $(BFD_H) + w65-opc.h $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h z8k-dis.lo: z8k-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) z8k-opc.h + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h z8k-opc.h z8kgen.lo: z8kgen.c sysdep.h config.h $(INCDIR)/ansidecl.h # IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff -uprN binutils-2.11.90.0.31/opcodes/arc-dis.c binutils-2.11.92.0.5/opcodes/arc-dis.c --- binutils-2.11.90.0.31/opcodes/arc-dis.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/opcodes/arc-dis.c Mon Oct 1 15:25:26 2001 @@ -26,7 +26,6 @@ #include #include "opintl.h" -#include #include #include "arc-dis.h" #include "arc-ext.h" @@ -46,13 +45,13 @@ treated as signed for bit shifting purposes: */ #define FIELDD(word) (BITS (((signed int)word), 0, 8)) -#define PUT_NEXT_WORD_IN(a) \ - do \ - { \ - if (is_limm == 1 && !NEXT_WORD (1)) \ - mwerror (state, _("Illegal limm reference in last instruction!\n")); \ - a = state->words[1]; \ - } \ +#define PUT_NEXT_WORD_IN(a) \ + do \ + { \ + if (is_limm == 1 && !NEXT_WORD (1)) \ + mwerror (state, _("Illegal limm reference in last instruction!\n")); \ + a = state->words[1]; \ + } \ while (0) #define CHECK_FLAG_COND_NULLIFY() \ @@ -98,7 +97,7 @@ #define CHECK_FIELD_A() \ do \ { \ - fieldA = FIELDA(state->words[0]); \ + fieldA = FIELDA (state->words[0]); \ if (fieldA > 60) \ { \ fieldAisReg = 0; \ @@ -234,20 +233,22 @@ post_address (state, addr) return ""; } +static void my_sprintf PARAMS ((struct arcDisState *, char *, const char *, + ...)); + static void -my_sprintf ( - struct arcDisState * state, - char * buf, - const char * format, - ...) +my_sprintf VPARAMS ((struct arcDisState *state, char *buf, const char *format, + ...)) { char *bp; const char *p; int size, leading_zero, regMap[2]; long auxNum; - va_list ap; - va_start (ap, format); + VA_OPEN (ap, format); + VA_FIXEDARG (ap, struct arcDisState *, state); + VA_FIXEDARG (ap, char *, buf); + VA_FIXEDARG (ap, const char *, format); bp = buf; *bp = 0; @@ -259,8 +260,8 @@ my_sprintf ( while (1) switch (*p++) { - case 0: - goto DOCOMM; /* (return) */ + case 0: + goto DOCOMM; /* (return) */ default: *bp++ = p[-1]; break; @@ -410,6 +411,7 @@ my_sprintf ( } DOCOMM: *bp = 0; + VA_CLOSE (ap); } static void @@ -436,7 +438,8 @@ write_comments_(state, shimm, is_limm, l strcpy (state->commentBuffer, comment_prefix); else strcat (state->commentBuffer, ", "); - strncat (state->commentBuffer, state->comm[i], sizeof (state->commentBuffer)); + strncat (state->commentBuffer, state->comm[i], + sizeof (state->commentBuffer)); } } } @@ -725,7 +728,7 @@ dsmOneArcInst (addr, state) instrName = instruction_name (state, state->_opcode, FIELDC (state->words[0]), - & flags); + &flags); if (!instrName) { instrName = "???"; @@ -840,14 +843,16 @@ dsmOneArcInst (addr, state) if (!repeatsOp) WRITE_FORMAT_COMMA_x (C); WRITE_NOP_COMMENT (); - my_sprintf (state, state->operandBuffer, formatString, fieldA, fieldB, fieldC); + my_sprintf (state, state->operandBuffer, formatString, + fieldA, fieldB, fieldC); } else { WRITE_FORMAT_x (B); if (!repeatsOp) WRITE_FORMAT_COMMA_x (C); - my_sprintf (state, state->operandBuffer, formatString, fieldB, fieldC); + my_sprintf (state, state->operandBuffer, formatString, + fieldB, fieldC); } write_comments (); break; @@ -863,7 +868,8 @@ dsmOneArcInst (addr, state) WRITE_FORMAT_x (A); WRITE_FORMAT_COMMA_x (B); WRITE_NOP_COMMENT (); - my_sprintf (state, state->operandBuffer, formatString, fieldA, fieldB); + my_sprintf (state, state->operandBuffer, formatString, + fieldA, fieldB); } else { @@ -895,16 +901,17 @@ dsmOneArcInst (addr, state) /* This address could be a label we know. Convert it. */ if (state->_opcode != op_LPC /* LP */) { - add_target (fieldA); /* For debugger. */ - state->flow = state->_opcode == op_BLC /* BL */ - ? direct_call - : direct_jump; - /* indirect calls are achieved by "lr blink,[status]; - lr dest<- func addr; j [dest]" */ + add_target (fieldA); /* For debugger. */ + state->flow = state->_opcode == op_BLC /* BL */ + ? direct_call + : direct_jump; + /* indirect calls are achieved by "lr blink,[status]; + lr dest<- func addr; j [dest]" */ } strcat (formatString, "%s"); /* address/label name */ - my_sprintf (state, state->operandBuffer, formatString, post_address (state, fieldA)); + my_sprintf (state, state->operandBuffer, formatString, + post_address (state, fieldA)); write_comments (); break; @@ -987,7 +994,8 @@ dsmOneArcInst (addr, state) fieldB = fieldC; WRITE_FORMAT_x_RB (C); - my_sprintf (state, state->operandBuffer, formatString, fieldA, fieldB, fieldC); + my_sprintf (state, state->operandBuffer, formatString, + fieldA, fieldB, fieldC); write_comments (); break; @@ -1032,7 +1040,8 @@ dsmOneArcInst (addr, state) else WRITE_FORMAT_RB (); } - my_sprintf (state, state->operandBuffer, formatString, fieldA, fieldB, fieldC); + my_sprintf (state, state->operandBuffer, formatString, + fieldA, fieldB, fieldC); write_comments (); break; @@ -1044,7 +1053,7 @@ dsmOneArcInst (addr, state) /* [B,A offset] */ if (dbg) printf("7:b reg %d %x off %x\n", - fieldBisReg,fieldB,fieldA); + fieldBisReg,fieldB,fieldA); state->_ea_present = 1; state->_offset = fieldA; if (fieldBisReg) @@ -1077,7 +1086,8 @@ dsmOneArcInst (addr, state) else WRITE_FORMAT_RB(); } - my_sprintf (state, state->operandBuffer, formatString, fieldC, fieldB, fieldA); + my_sprintf (state, state->operandBuffer, formatString, + fieldC, fieldB, fieldA); write_comments2(fieldA); break; case 8: @@ -1144,7 +1154,7 @@ _coreRegName(arg, regval) static const char * _auxRegName(void *_this ATTRIBUTE_UNUSED, int regval) { - return arcExtMap_auxRegName(regval); + return arcExtMap_auxRegName(regval); } @@ -1152,14 +1162,14 @@ _auxRegName(void *_this ATTRIBUTE_UNUSED static const char * _condCodeName(void *_this ATTRIBUTE_UNUSED, int regval) { - return arcExtMap_condCodeName(regval); + return arcExtMap_condCodeName(regval); } /* Returns the name the user specified extension instruction. */ static const char * _instName (void *_this ATTRIBUTE_UNUSED, int majop, int minop, int *flags) { - return arcExtMap_instName(majop, minop, flags); + return arcExtMap_instName(majop, minop, flags); } /* Decode an instruction returning the size of the instruction diff -uprN binutils-2.11.90.0.31/opcodes/arc-ext.c binutils-2.11.92.0.5/opcodes/arc-ext.c --- binutils-2.11.90.0.31/opcodes/arc-ext.c Thu Mar 15 14:52:00 2001 +++ binutils-2.11.92.0.5/opcodes/arc-ext.c Mon Oct 1 15:25:26 2001 @@ -1,4 +1,4 @@ -/* ARC target-dependent stuff. Extension structure access functions +/* ARC target-dependent stuff. Extension structure access functions Copyright 1995, 1997, 2000, 2001 Free Software Foundation, Inc. This file is part of GDB. @@ -17,6 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "sysdep.h" #include #include #include "bfd.h" @@ -29,9 +30,9 @@ static struct arcExtMap arc_extension_ma /* Get the name of an extension instruction. */ const char * -arcExtMap_instName(int opcode, int minor, int *flags) +arcExtMap_instName(int opcode, int minor, int *flags) { - if (opcode == 3) + if (opcode == 3) { /* FIXME: ??? need to also check 0/1/2 in bit0 for (3f) brk/sleep/swi */ if (minor < 0x09 || minor == 0x3f) @@ -53,7 +54,7 @@ arcExtMap_instName(int opcode, int minor /* Get the name of an extension core register. */ const char * -arcExtMap_coreRegName(int value) +arcExtMap_coreRegName(int value) { if (value < 32) return 0; @@ -63,7 +64,7 @@ arcExtMap_coreRegName(int value) /* Get the name of an extension condition code. */ const char * -arcExtMap_condCodeName(int value) +arcExtMap_condCodeName(int value) { if (value < 16) return 0; @@ -88,7 +89,7 @@ arcExtMap_auxRegName(long address) /* Recursively free auxilliary register strcture pointers until the list is empty. */ -static void +static void clean_aux_registers(struct ExtAuxRegister *r) { if (r -> next) @@ -98,14 +99,14 @@ clean_aux_registers(struct ExtAuxRegiste free(r -> next); r ->next = NULL; } - else + else free(r -> name); } - + /* Free memory that has been allocated for the extensions. */ -static void -cleanup_ext_map(void) +static void +cleanup_ext_map(void) { struct ExtAuxRegister *r; struct ExtInstruction *insn; @@ -113,45 +114,45 @@ cleanup_ext_map(void) /* clean aux reg structure */ r = arc_extension_map.auxRegisters; - if (r) + if (r) { (clean_aux_registers(r)); free(r); } - + /* clean instructions */ - for (i = 0; i < NUM_EXT_INST; i++) + for (i = 0; i < NUM_EXT_INST; i++) { insn = arc_extension_map.instructions[i]; if (insn) free(insn->name); } - + /* clean core reg struct */ - for (i = 0; i < NUM_EXT_CORE; i++) + for (i = 0; i < NUM_EXT_CORE; i++) { if (arc_extension_map.coreRegisters[i]) free(arc_extension_map.coreRegisters[i]); } - + for (i = 0; i < NUM_EXT_COND; i++) { if (arc_extension_map.condCodes[i]) free(arc_extension_map.condCodes[i]); } - - memset(&arc_extension_map, 0, sizeof(struct arcExtMap)); + + memset(&arc_extension_map, 0, sizeof(struct arcExtMap)); } -int -arcExtMap_add(void *base, unsigned long length) +int +arcExtMap_add(void *base, unsigned long length) { unsigned char *block = base; unsigned char *p = block; - + /* Clean up and reset everything if needed. */ cleanup_ext_map(); - while (p && p < (block + length)) + while (p && p < (block + length)) { /* p[0] == length of record p[1] == type of record @@ -170,7 +171,7 @@ arcExtMap_add(void *base, unsigned long if (p[0] == 0) return -1; - + switch (p[1]) { case EXT_INSTRUCTION: @@ -178,9 +179,9 @@ arcExtMap_add(void *base, unsigned long char opcode = p[2]; char minor = p[3]; char * insn_name = (char *) xmalloc(( (int)*p-5) * sizeof(char)); - struct ExtInstruction * insn = + struct ExtInstruction * insn = (struct ExtInstruction *) xmalloc(sizeof(struct ExtInstruction)); - + if (opcode==3) opcode = 0x1f - 0x10 + minor - 0x09 + 1; else @@ -191,8 +192,8 @@ arcExtMap_add(void *base, unsigned long arc_extension_map.instructions[(int) opcode] = insn; } break; - - case EXT_CORE_REGISTER: + + case EXT_CORE_REGISTER: { char * core_name = (char *) xmalloc(((int)*p-3) * sizeof(char)); @@ -200,19 +201,19 @@ arcExtMap_add(void *base, unsigned long arc_extension_map.coreRegisters[p[2]-32] = core_name; } break; - - case EXT_COND_CODE: + + case EXT_COND_CODE: { char * cc_name = (char *) xmalloc( ((int)*p-3) * sizeof(char)); strcpy(cc_name, (p+3)); arc_extension_map.condCodes[p[2]-16] = cc_name; - } + } break; - - case EXT_AUX_REGISTER: + + case EXT_AUX_REGISTER: { /* trickier -- need to store linked list to these */ - struct ExtAuxRegister *newAuxRegister = + struct ExtAuxRegister *newAuxRegister = (struct ExtAuxRegister *)malloc(sizeof(struct ExtAuxRegister)); char * aux_name = (char *) xmalloc ( ((int)*p-6) * sizeof(char)); @@ -223,14 +224,14 @@ arcExtMap_add(void *base, unsigned long arc_extension_map.auxRegisters = newAuxRegister; } break; - + default: return -1; - + } p += p[0]; /* move to next record */ } - + return 0; } diff -uprN binutils-2.11.90.0.31/opcodes/arc-opc.c binutils-2.11.92.0.5/opcodes/arc-opc.c --- binutils-2.11.90.0.31/opcodes/arc-opc.c Sat Jun 23 00:05:22 2001 +++ binutils-2.11.92.0.5/opcodes/arc-opc.c Mon Oct 1 15:25:26 2001 @@ -17,6 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "sysdep.h" #include #include "ansidecl.h" #include "opcode/arc.h" diff -uprN binutils-2.11.90.0.31/opcodes/arm-dis.c binutils-2.11.92.0.5/opcodes/arm-dis.c --- binutils-2.11.90.0.31/opcodes/arm-dis.c Thu Jul 26 18:02:55 2001 +++ binutils-2.11.92.0.5/opcodes/arm-dis.c Mon Oct 1 15:25:26 2001 @@ -1105,7 +1105,7 @@ the -M switch:\n")); for (i = NUM_ARM_REGNAMES; i--;) fprintf (stream, " reg-names-%s %*c%s\n", regnames[i].name, - 14 - strlen (regnames[i].name), ' ', + (int)(14 - strlen (regnames[i].name)), ' ', regnames[i].description); fprintf (stream, " force-thumb Assume all insns are Thumb insns\n"); diff -uprN binutils-2.11.90.0.31/opcodes/cgen-asm.c binutils-2.11.92.0.5/opcodes/cgen-asm.c --- binutils-2.11.90.0.31/opcodes/cgen-asm.c Fri Jul 6 09:26:11 2001 +++ binutils-2.11.92.0.5/opcodes/cgen-asm.c Mon Oct 1 15:25:26 2001 @@ -1,6 +1,6 @@ /* CGEN generic assembler support code. - Copyright 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of the GNU Binutils and GDB, the GNU debugger. @@ -20,14 +20,18 @@ #include "sysdep.h" #include -#include #include "ansidecl.h" #include "libiberty.h" +#include "safe-ctype.h" #include "bfd.h" #include "symcat.h" #include "opcode/cgen.h" #include "opintl.h" +static CGEN_INSN_LIST * hash_insn_array PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *, int, int, CGEN_INSN_LIST **, CGEN_INSN_LIST *)); +static CGEN_INSN_LIST * hash_insn_list PARAMS ((CGEN_CPU_DESC, const CGEN_INSN_LIST *, CGEN_INSN_LIST **, CGEN_INSN_LIST *)); +static void build_asm_hash_table PARAMS ((CGEN_CPU_DESC)); + /* Set the cgen_parse_operand_fn callback. */ void @@ -221,8 +225,7 @@ cgen_parse_keyword (cd, strp, keyword_ta /* Allow letters, digits, and any special characters. */ while (((p - start) < (int) sizeof (buf)) && *p - && (isalnum ((unsigned char) *p) - || strchr (keyword_table->nonalpha_chars, *p))) + && (ISALNUM (*p) || strchr (keyword_table->nonalpha_chars, *p))) ++p; if (p - start >= (int) sizeof (buf)) diff -uprN binutils-2.11.90.0.31/opcodes/cgen-dis.c binutils-2.11.92.0.5/opcodes/cgen-dis.c --- binutils-2.11.90.0.31/opcodes/cgen-dis.c Thu Mar 15 14:52:01 2001 +++ binutils-2.11.92.0.5/opcodes/cgen-dis.c Mon Oct 1 15:25:26 2001 @@ -27,6 +27,10 @@ #include "symcat.h" #include "opcode/cgen.h" +static CGEN_INSN_LIST * hash_insn_array PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *, int, int, CGEN_INSN_LIST **, CGEN_INSN_LIST *)); +static CGEN_INSN_LIST * hash_insn_list PARAMS ((CGEN_CPU_DESC, const CGEN_INSN_LIST *, CGEN_INSN_LIST **, CGEN_INSN_LIST *)); +static void build_dis_hash_table PARAMS ((CGEN_CPU_DESC)); + /* Subroutine of build_dis_hash_table to add INSNS to the hash table. COUNT is the number of elements in INSNS. diff -uprN binutils-2.11.90.0.31/opcodes/cgen-ibld.in binutils-2.11.92.0.5/opcodes/cgen-ibld.in --- binutils-2.11.90.0.31/opcodes/cgen-ibld.in Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/opcodes/cgen-ibld.in Mon Oct 1 15:25:26 2001 @@ -78,7 +78,7 @@ insert_1 (cd, value, start, length, word int shift; int big_p = CGEN_CPU_INSN_ENDIAN (cd) == CGEN_ENDIAN_BIG; - x = bfd_get_bits (bufp, word_length, big_p); + x = cgen_get_insn_value (cd, bufp, word_length); /* Written this way to avoid undefined behaviour. */ mask = (((1L << (length - 1)) - 1) << 1) | 1; @@ -88,7 +88,7 @@ insert_1 (cd, value, start, length, word shift = (word_length - (start + length)); x = (x & ~(mask << shift)) | ((value & mask) << shift); - bfd_put_bits ((bfd_vma) x, bufp, word_length, big_p); + cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x); } #endif /* ! CGEN_INT_INSN_P */ @@ -365,7 +365,7 @@ extract_1 (cd, ex_info, start, length, w int shift; int big_p = CGEN_CPU_INSN_ENDIAN (cd) == CGEN_ENDIAN_BIG; - x = bfd_get_bits (bufp, word_length, big_p); + x = cgen_get_insn_value (cd, bufp, word_length); if (CGEN_INSN_LSB0_P) shift = (start + 1) - length; diff -uprN binutils-2.11.90.0.31/opcodes/cgen-opc.c binutils-2.11.92.0.5/opcodes/cgen-opc.c --- binutils-2.11.90.0.31/opcodes/cgen-opc.c Sat Jul 14 10:29:16 2001 +++ binutils-2.11.92.0.5/opcodes/cgen-opc.c Mon Oct 1 15:25:26 2001 @@ -20,10 +20,10 @@ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "sysdep.h" -#include #include #include "ansidecl.h" #include "libiberty.h" +#include "safe-ctype.h" #include "bfd.h" #include "symcat.h" #include "opcode/cgen.h" @@ -69,9 +69,7 @@ cgen_keyword_lookup_name (kt, name) while (*p && (*p == *n - || (isalpha ((unsigned char) *p) - && (tolower ((unsigned char) *p) - == tolower ((unsigned char) *n))))) + || (ISALPHA (*p) && (TOLOWER (*p) == TOLOWER (*n))))) ++n, ++p; if (!*p && !*n) @@ -135,7 +133,7 @@ cgen_keyword_add (kt, ke) kt->null_entry = ke; for (i = 1; i < strlen (ke->name); i++) - if (! isalnum ((unsigned char) ke->name[i]) + if (! ISALNUM (ke->name[i]) && ! strchr (kt->nonalpha_chars, ke->name[i])) { size_t idx = strlen (kt->nonalpha_chars); @@ -232,7 +230,7 @@ hash_keyword_name (kt, name, case_sensit hash = (hash * 97) + (unsigned char) *name; else for (hash = 0; *name; ++name) - hash = (hash * 97) + (unsigned char) tolower (*name); + hash = (hash * 97) + (unsigned char) TOLOWER (*name); return hash % kt->hash_table_size; } diff -uprN binutils-2.11.90.0.31/opcodes/configure binutils-2.11.92.0.5/opcodes/configure --- binutils-2.11.90.0.31/opcodes/configure Fri Aug 10 14:08:01 2001 +++ binutils-2.11.92.0.5/opcodes/configure Thu Oct 4 14:35:43 2001 @@ -55,6 +55,7 @@ program_suffix=NONE program_transform_name=s,x,x, silent= site= +sitefile= srcdir= target=NONE verbose= @@ -169,6 +170,7 @@ Configuration: --help print this message --no-create do not create output files --quiet, --silent do not print \`checking...' messages + --site-file=FILE use FILE as the site file --version print the version of autoconf that created configure Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX @@ -339,6 +341,11 @@ EOF -site=* | --site=* | --sit=*) site="$ac_optarg" ;; + -site-file | --site-file | --site-fil | --site-fi | --site-f) + ac_prev=sitefile ;; + -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*) + sitefile="$ac_optarg" ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) @@ -504,12 +511,16 @@ fi srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` # Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" +if test -z "$sitefile"; then + if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi fi +else + CONFIG_SITE="$sitefile" fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then @@ -548,12 +559,12 @@ else fi echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:552: checking for Cygwin environment" >&5 +echo "configure:563: checking for Cygwin environment" >&5 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:579: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cygwin=yes else @@ -581,19 +592,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6 CYGWIN= test "$ac_cv_cygwin" = yes && CYGWIN=yes echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:585: checking for mingw32 environment" >&5 +echo "configure:596: checking for mingw32 environment" >&5 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:608: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -658,7 +669,7 @@ else { echo "configure: error: can not r fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:662: checking host system type" >&5 +echo "configure:673: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -679,7 +690,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)- echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:683: checking target system type" >&5 +echo "configure:694: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -697,7 +708,7 @@ target_os=`echo $target | sed 's/^\([^-] echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:701: checking build system type" >&5 +echo "configure:712: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -721,7 +732,7 @@ test "$host_alias" != "$target_alias" && echo $ac_n "checking for strerror in -lcposix""... $ac_c" 1>&6 -echo "configure:725: checking for strerror in -lcposix" >&5 +echo "configure:736: checking for strerror in -lcposix" >&5 ac_lib_var=`echo cposix'_'strerror | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -729,7 +740,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcposix $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:755: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -780,7 +791,7 @@ BFD_VERSION=`sed -n -e 's/^.._INIT_AUTOM # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:784: checking for a BSD compatible install" >&5 +echo "configure:795: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -833,7 +844,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCR test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:837: checking whether build environment is sane" >&5 +echo "configure:848: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile @@ -890,7 +901,7 @@ test "$program_suffix" != NONE && test "$program_transform_name" = "" && program_transform_name="s,x,x," echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:894: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:905: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -936,7 +947,7 @@ EOF missing_dir=`cd $ac_aux_dir && pwd` echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 -echo "configure:940: checking for working aclocal" >&5 +echo "configure:951: checking for working aclocal" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -949,7 +960,7 @@ else fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:953: checking for working autoconf" >&5 +echo "configure:964: checking for working autoconf" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -962,7 +973,7 @@ else fi echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:966: checking for working automake" >&5 +echo "configure:977: checking for working automake" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -975,7 +986,7 @@ else fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:979: checking for working autoheader" >&5 +echo "configure:990: checking for working autoheader" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -988,7 +999,7 @@ else fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:992: checking for working makeinfo" >&5 +echo "configure:1003: checking for working makeinfo" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1011,7 +1022,7 @@ fi # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1015: checking for $ac_word" >&5 +echo "configure:1026: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1043,7 +1054,7 @@ fi # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1047: checking for $ac_word" >&5 +echo "configure:1058: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1075,7 +1086,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1079: checking for $ac_word" >&5 +echo "configure:1090: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1181,7 +1192,7 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1185: checking for $ac_word" >&5 +echo "configure:1196: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1211,7 +1222,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1215: checking for $ac_word" >&5 +echo "configure:1226: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1262,7 +1273,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1266: checking for $ac_word" >&5 +echo "configure:1277: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1294,7 +1305,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1298: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1309: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1305,12 +1316,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 1309 "configure" +#line 1320 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1314: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1325: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1336,12 +1347,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1340: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1351: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1345: checking whether we are using GNU C" >&5 +echo "configure:1356: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1350,7 +1361,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1354: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1365: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -1369,7 +1380,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1373: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1384: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1412,7 +1423,7 @@ ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 -echo "configure:1416: checking for ld used by GCC" >&5 +echo "configure:1427: checking for ld used by GCC" >&5 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw @@ -1442,10 +1453,10 @@ echo "configure:1416: checking for ld us esac elif test "$with_gnu_ld" = yes; then echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 -echo "configure:1446: checking for GNU ld" >&5 +echo "configure:1457: checking for GNU ld" >&5 else echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 -echo "configure:1449: checking for non-GNU ld" >&5 +echo "configure:1460: checking for non-GNU ld" >&5 fi if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1480,7 +1491,7 @@ else fi test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 -echo "configure:1484: checking if the linker ($LD) is GNU ld" >&5 +echo "configure:1495: checking if the linker ($LD) is GNU ld" >&5 if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1497,7 +1508,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6 -echo "configure:1501: checking for $LD option to reload object files" >&5 +echo "configure:1512: checking for $LD option to reload object files" >&5 if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1509,7 +1520,7 @@ reload_flag=$lt_cv_ld_reload_flag test -n "$reload_flag" && reload_flag=" $reload_flag" echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 -echo "configure:1513: checking for BSD-compatible nm" >&5 +echo "configure:1524: checking for BSD-compatible nm" >&5 if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1547,7 +1558,7 @@ NM="$lt_cv_path_NM" echo "$ac_t""$NM" 1>&6 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1551: checking whether ln -s works" >&5 +echo "configure:1562: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1568,7 +1579,7 @@ else fi echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6 -echo "configure:1572: checking how to recognise dependant libraries" >&5 +echo "configure:1583: checking how to recognise dependant libraries" >&5 if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1732,13 +1743,13 @@ file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method echo $ac_n "checking for object suffix""... $ac_c" 1>&6 -echo "configure:1736: checking for object suffix" >&5 +echo "configure:1747: checking for object suffix" >&5 if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else rm -f conftest* echo 'int i = 1;' > conftest.$ac_ext -if { (eval echo configure:1742: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1753: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then for ac_file in conftest.*; do case $ac_file in *.c) ;; @@ -1758,7 +1769,7 @@ ac_objext=$ac_cv_objext echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:1762: checking for executable suffix" >&5 +echo "configure:1773: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1768,10 +1779,10 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:1772: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:1783: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in - *.c | *.o | *.obj) ;; + *.c | *.o | *.obj | *.ilk | *.pdb) ;; *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; esac done @@ -1795,7 +1806,7 @@ case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6 -echo "configure:1799: checking for ${ac_tool_prefix}file" >&5 +echo "configure:1810: checking for ${ac_tool_prefix}file" >&5 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1857,7 +1868,7 @@ fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then echo $ac_n "checking for file""... $ac_c" 1>&6 -echo "configure:1861: checking for file" >&5 +echo "configure:1872: checking for file" >&5 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1928,7 +1939,7 @@ esac # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1932: checking for $ac_word" >&5 +echo "configure:1943: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1960,7 +1971,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1964: checking for $ac_word" >&5 +echo "configure:1975: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1995,7 +2006,7 @@ fi # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1999: checking for $ac_word" >&5 +echo "configure:2010: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2027,7 +2038,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2031: checking for $ac_word" >&5 +echo "configure:2042: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2094,8 +2105,8 @@ test x"$pic_mode" = xno && libtool_flags case $host in *-*-irix6*) # Find out which ABI we are using. - echo '#line 2098 "configure"' > conftest.$ac_ext - if { (eval echo configure:2099: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + echo '#line 2109 "configure"' > conftest.$ac_ext + if { (eval echo configure:2110: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" @@ -2116,7 +2127,7 @@ case $host in SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 -echo "configure:2120: checking whether the C compiler needs -belf" >&5 +echo "configure:2131: checking whether the C compiler needs -belf" >&5 if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2129,14 +2140,14 @@ ac_link='${CC-cc} -o conftest${ac_exeext cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2151: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* lt_cv_cc_needs_belf=yes else @@ -2304,7 +2315,7 @@ if test -z "$target" ; then fi echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:2308: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:2319: checking whether to enable maintainer-specific portions of Makefiles" >&5 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" @@ -2329,7 +2340,7 @@ fi echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:2333: checking for executable suffix" >&5 +echo "configure:2344: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2339,10 +2350,10 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:2343: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:2354: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in - *.c | *.o | *.obj) ;; + *.c | *.o | *.obj | *.ilk | *.pdb) ;; *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; esac done @@ -2365,7 +2376,7 @@ ac_exeext=$EXEEXT # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2369: checking for $ac_word" >&5 +echo "configure:2380: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2395,7 +2406,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2399: checking for $ac_word" >&5 +echo "configure:2410: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2446,7 +2457,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2450: checking for $ac_word" >&5 +echo "configure:2461: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2478,7 +2489,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2482: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:2493: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -2489,12 +2500,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 2493 "configure" +#line 2504 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:2498: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2509: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -2520,12 +2531,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2524: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2535: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:2529: checking whether we are using GNU C" >&5 +echo "configure:2540: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2534,7 +2545,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2538: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2549: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -2553,7 +2564,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:2557: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:2568: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2587,7 +2598,7 @@ fi ALL_LINGUAS= echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:2591: checking how to run the C preprocessor" >&5 +echo "configure:2602: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -2602,13 +2613,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2612: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2623: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2619,13 +2630,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2629: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2640: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2636,13 +2647,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2646: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2657: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2669,7 +2680,7 @@ echo "$ac_t""$CPP" 1>&6 # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2673: checking for $ac_word" >&5 +echo "configure:2684: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2697,12 +2708,12 @@ else fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:2701: checking for ANSI C header files" >&5 +echo "configure:2712: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2710,7 +2721,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2714: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2725: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2727,7 +2738,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -2745,7 +2756,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -2766,7 +2777,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -2777,7 +2788,7 @@ if (XOR (islower (i), ISLOWER (i)) || to exit (0); } EOF -if { (eval echo configure:2781: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2792: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -2801,12 +2812,12 @@ EOF fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:2805: checking for working const" >&5 +echo "configure:2816: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2870: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -2876,21 +2887,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:2880: checking for inline" >&5 +echo "configure:2891: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2905: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -2916,12 +2927,12 @@ EOF esac echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:2920: checking for off_t" >&5 +echo "configure:2931: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -2949,12 +2960,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:2953: checking for size_t" >&5 +echo "configure:2964: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -2984,19 +2995,19 @@ fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:2988: checking for working alloca.h" >&5 +echo "configure:2999: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:3000: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3011: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -3017,12 +3028,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:3021: checking for alloca" >&5 +echo "configure:3032: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3065: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -3082,12 +3093,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:3086: checking whether alloca needs Cray hooks" >&5 +echo "configure:3097: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3116: checking for $ac_func" >&5 +echo "configure:3127: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3167,7 +3178,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:3171: checking stack direction for C alloca" >&5 +echo "configure:3182: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3175,7 +3186,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3209: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -3219,17 +3230,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3223: checking for $ac_hdr" >&5 +echo "configure:3234: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3233: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3244: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3258,12 +3269,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3262: checking for $ac_func" >&5 +echo "configure:3273: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3301: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3311,7 +3322,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:3315: checking for working mmap" >&5 +echo "configure:3326: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3319,7 +3330,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3474: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -3487,17 +3498,17 @@ unistd.h values.h sys/param.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3491: checking for $ac_hdr" >&5 +echo "configure:3502: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3501: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3512: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3527,12 +3538,12 @@ done __argz_count __argz_stringify __argz_next do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3531: checking for $ac_func" >&5 +echo "configure:3542: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3570: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3584,12 +3595,12 @@ done for ac_func in stpcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3588: checking for $ac_func" >&5 +echo "configure:3599: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3627: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3646,19 +3657,19 @@ EOF if test $ac_cv_header_locale_h = yes; then echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:3650: checking for LC_MESSAGES" >&5 +echo "configure:3661: checking for LC_MESSAGES" >&5 if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return LC_MESSAGES ; return 0; } EOF -if { (eval echo configure:3662: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3673: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_val_LC_MESSAGES=yes else @@ -3679,7 +3690,7 @@ EOF fi fi echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 -echo "configure:3683: checking whether NLS is requested" >&5 +echo "configure:3694: checking whether NLS is requested" >&5 # Check whether --enable-nls or --disable-nls was given. if test "${enable_nls+set}" = set; then enableval="$enable_nls" @@ -3699,7 +3710,7 @@ fi EOF echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 -echo "configure:3703: checking whether included gettext is requested" >&5 +echo "configure:3714: checking whether included gettext is requested" >&5 # Check whether --with-included-gettext or --without-included-gettext was given. if test "${with_included_gettext+set}" = set; then withval="$with_included_gettext" @@ -3718,17 +3729,17 @@ fi ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 -echo "configure:3722: checking for libintl.h" >&5 +echo "configure:3733: checking for libintl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3732: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3743: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3745,19 +3756,19 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6 -echo "configure:3749: checking for gettext in libc" >&5 +echo "configure:3760: checking for gettext in libc" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return (int) gettext ("") ; return 0; } EOF -if { (eval echo configure:3761: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3772: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gettext_libc=yes else @@ -3773,7 +3784,7 @@ echo "$ac_t""$gt_cv_func_gettext_libc" 1 if test "$gt_cv_func_gettext_libc" != "yes"; then echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6 -echo "configure:3777: checking for bindtextdomain in -lintl" >&5 +echo "configure:3788: checking for bindtextdomain in -lintl" >&5 ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3781,7 +3792,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3807: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3808,19 +3819,19 @@ fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6 -echo "configure:3812: checking for gettext in libintl" >&5 +echo "configure:3823: checking for gettext in libintl" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3835: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gettext_libintl=yes else @@ -3848,7 +3859,7 @@ EOF # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3852: checking for $ac_word" >&5 +echo "configure:3863: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3882,12 +3893,12 @@ fi for ac_func in dcgettext do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3886: checking for $ac_func" >&5 +echo "configure:3897: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3937,7 +3948,7 @@ done # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3941: checking for $ac_word" >&5 +echo "configure:3952: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3973,7 +3984,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3977: checking for $ac_word" >&5 +echo "configure:3988: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4005,7 +4016,7 @@ else fi cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4028: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* CATOBJEXT=.gmo DATADIRNAME=share @@ -4045,7 +4056,7 @@ fi # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4049: checking for $ac_word" >&5 +echo "configure:4060: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4079,7 +4090,7 @@ fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4083: checking for $ac_word" >&5 +echo "configure:4094: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4115,7 +4126,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4119: checking for $ac_word" >&5 +echo "configure:4130: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4205,7 +4216,7 @@ fi LINGUAS= else echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 -echo "configure:4209: checking for catalogs to be installed" >&5 +echo "configure:4220: checking for catalogs to be installed" >&5 NEW_LINGUAS= for lang in ${LINGUAS=$ALL_LINGUAS}; do case "$ALL_LINGUAS" in @@ -4233,17 +4244,17 @@ echo "configure:4209: checking for catal if test "$CATOBJEXT" = ".cat"; then ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6 -echo "configure:4237: checking for linux/version.h" >&5 +echo "configure:4248: checking for linux/version.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4247: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4258: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4288,7 +4299,7 @@ fi l= - if test -d $srcdir/po; then + if test -f $srcdir/po/POTFILES.in; then test -d po || mkdir po if test "x$srcdir" != "x."; then if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then @@ -4307,6 +4318,44 @@ fi . ${srcdir}/../bfd/configure.host +# Put a plausible default for CC_FOR_BUILD in Makefile. +if test -z "$CC_FOR_BUILD"; then + if test "x$cross_compiling" = "xno"; then + CC_FOR_BUILD='$(CC)' + else + CC_FOR_BUILD=gcc + fi +fi + +# Also set EXEEXT_FOR_BUILD. +if test "x$cross_compiling" = "xno"; then + EXEEXT_FOR_BUILD='$(EXEEXT)' +else + echo $ac_n "checking for build system executable suffix""... $ac_c" 1>&6 +echo "configure:4336: checking for build system executable suffix" >&5 +if eval "test \"`echo '$''{'bfd_cv_build_exeext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + rm -f conftest* + echo 'int main () { return 0; }' > conftest.c + bfd_cv_build_exeext= + ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5 + for file in conftest.*; do + case $file in + *.c | *.o | *.obj | *.ilk | *.pdb) ;; + *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;; + esac + done + rm -f conftest* + test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no +fi + +echo "$ac_t""$bfd_cv_build_exeext" 1>&6 + EXEEXT_FOR_BUILD="" + test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext} +fi + + # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or @@ -4320,7 +4369,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:4324: checking for a BSD compatible install" >&5 +echo "configure:4373: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4377,17 +4426,17 @@ for ac_hdr in string.h strings.h stdlib. do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4381: checking for $ac_hdr" >&5 +echo "configure:4430: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4391: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4440: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4788,6 +4837,8 @@ s%@GT_NO@%$GT_NO%g s%@GT_YES@%$GT_YES%g s%@MKINSTALLDIRS@%$MKINSTALLDIRS%g s%@l@%$l%g +s%@CC_FOR_BUILD@%$CC_FOR_BUILD%g +s%@EXEEXT_FOR_BUILD@%$EXEEXT_FOR_BUILD%g s%@HDEFINES@%$HDEFINES%g s%@CGEN_MAINT_TRUE@%$CGEN_MAINT_TRUE%g s%@CGEN_MAINT_FALSE@%$CGEN_MAINT_FALSE%g diff -uprN binutils-2.11.90.0.31/opcodes/configure.in binutils-2.11.92.0.5/opcodes/configure.in --- binutils-2.11.90.0.31/opcodes/configure.in Fri Aug 10 14:08:01 2001 +++ binutils-2.11.92.0.5/opcodes/configure.in Mon Oct 1 15:25:26 2001 @@ -82,6 +82,8 @@ CY_GNU_GETTEXT . ${srcdir}/../bfd/configure.host +BFD_CC_FOR_BUILD + AC_SUBST(HDEFINES) AC_PROG_INSTALL diff -uprN binutils-2.11.90.0.31/opcodes/cris-dis.c binutils-2.11.92.0.5/opcodes/cris-dis.c --- binutils-2.11.90.0.31/opcodes/cris-dis.c Mon Aug 27 11:44:52 2001 +++ binutils-2.11.92.0.5/opcodes/cris-dis.c Mon Oct 1 15:25:26 2001 @@ -1197,7 +1197,7 @@ print_insn_cris_generic (memaddr, info, bytes; stacked prefixes will not be expanded. */ unsigned char buffer[MAX_BYTES_PER_CRIS_INSN]; unsigned char *bufp; - int status; + int status = 0; bfd_vma addr; /* There will be an "out of range" error after the last instruction. diff -uprN binutils-2.11.90.0.31/opcodes/d10v-dis.c binutils-2.11.92.0.5/opcodes/d10v-dis.c --- binutils-2.11.90.0.31/opcodes/d10v-dis.c Mon Aug 27 11:44:52 2001 +++ binutils-2.11.92.0.5/opcodes/d10v-dis.c Mon Oct 1 15:25:26 2001 @@ -202,7 +202,7 @@ dis_long (insn, memaddr, info) while (op->name) { - if ((op->format & LONG_OPCODE) && ((op->mask & insn) == op->opcode)) + if ((op->format & LONG_OPCODE) && ((op->mask & insn) == (unsigned long) op->opcode)) { match = 1; (*info->fprintf_func) (info->stream, "%s\t", op->name); @@ -253,7 +253,7 @@ dis_2_short (insn, memaddr, info, order) while (op->name) { if ((op->format & SHORT_OPCODE) - && ((op->mask & ins[j]) == op->opcode)) + && ((op->mask & ins[j]) == (unsigned long) op->opcode)) { (*info->fprintf_func) (info->stream, "%s\t", op->name); for (i = 0; op->operands[i]; i++) diff -uprN binutils-2.11.90.0.31/opcodes/fr30-asm.c binutils-2.11.92.0.5/opcodes/fr30-asm.c --- binutils-2.11.90.0.31/opcodes/fr30-asm.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/opcodes/fr30-asm.c Mon Oct 1 15:25:26 2001 @@ -26,23 +26,30 @@ along with this program; if not, write t Keep that in mind. */ #include "sysdep.h" -#include #include #include "ansidecl.h" +#include "safe-ctype.h" #include "bfd.h" #include "symcat.h" #include "fr30-desc.h" #include "fr30-opc.h" #include "opintl.h" #include "xregex.h" +#include "libiberty.h" #undef min #define min(a,b) ((a) < (b) ? (a) : (b)) #undef max #define max(a,b) ((a) > (b) ? (a) : (b)) -static const char * parse_insn_normal - PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *, const char **, CGEN_FIELDS *)); +static const char * parse_insn_normal PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *, const char **, CGEN_FIELDS *)); +static int parse_register_number PARAMS ((const char **)); +static const char * parse_register_list PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *, int, int)); +static const char * parse_low_register_list_ld PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *)); +static const char * parse_hi_register_list_ld PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *)); +static const char * parse_low_register_list_st PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *)); +static const char * parse_hi_register_list_st PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *)); + const char * fr30_cgen_parse_operand PARAMS ((CGEN_CPU_DESC, int, const char **, CGEN_FIELDS *)); /* -- assembler routines inserted here */ @@ -70,9 +77,9 @@ parse_register_number (strp) static const char * parse_register_list (cd, strp, opindex, valuep, high_low, load_store) - CGEN_CPU_DESC cd; + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; const char **strp; - int opindex; + int opindex ATTRIBUTE_UNUSED; unsigned long *valuep; int high_low; /* 0 == high, 1 == low */ int load_store; /* 0 == load, 1 == store */ @@ -168,8 +175,7 @@ parse_hi_register_list_st (cd, strp, opi This function could be moved into `parse_insn_normal', but keeping it separate makes clear the interface between `parse_insn_normal' and each of - the handlers. -*/ + the handlers. */ const char * fr30_cgen_parse_operand (cd, opindex, strp, fields) @@ -344,7 +350,7 @@ char * fr30_cgen_build_insn_regex (insn) CGEN_INSN *insn; { - CGEN_OPCODE *opc = CGEN_INSN_OPCODE (insn); + CGEN_OPCODE *opc = (CGEN_OPCODE *) CGEN_INSN_OPCODE (insn); const char *mnem = CGEN_INSN_MNEMONIC (insn); int mnem_len; char rxbuf[CGEN_MAX_RX_ELEMENTS]; @@ -461,14 +467,14 @@ parse_insn_normal (cd, insn, strp, field GAS's input scrubber will ensure mnemonics are lowercase, but we may not be called from GAS. */ p = CGEN_INSN_MNEMONIC (insn); - while (*p && tolower (*p) == tolower (*str)) + while (*p && TOLOWER (*p) == TOLOWER (*str)) ++p, ++str; if (* p) return _("unrecognized instruction"); #ifndef CGEN_MNEMONIC_OPERANDS - if (* str && !isspace (* str)) + if (* str && !ISSPACE (* str)) return _("unrecognized instruction"); #endif @@ -497,7 +503,7 @@ parse_insn_normal (cd, insn, strp, field first char after the mnemonic part is a space. */ /* FIXME: We also take inappropriate advantage of the fact that GAS's input scrubber will remove extraneous blanks. */ - if (tolower (*str) == tolower (CGEN_SYNTAX_CHAR (* syn))) + if (TOLOWER (*str) == TOLOWER (CGEN_SYNTAX_CHAR (* syn))) { #ifdef CGEN_MNEMONIC_OPERANDS if (CGEN_SYNTAX_CHAR(* syn) == ' ') @@ -544,7 +550,7 @@ parse_insn_normal (cd, insn, strp, field blanks now. IE: We needn't try again with a longer version of the insn and it is assumed that longer versions of insns appear before shorter ones (eg: lsr r2,r3,1 vs lsr r2,r3). */ - while (isspace (* str)) + while (ISSPACE (* str)) ++ str; if (* str != '\0') @@ -593,7 +599,7 @@ fr30_cgen_assemble_insn (cd, str, fields int recognized_mnemonic = 0; /* Skip leading white space. */ - while (isspace (* str)) + while (ISSPACE (* str)) ++ str; /* The instructions are stored in hashed lists. diff -uprN binutils-2.11.90.0.31/opcodes/fr30-desc.c binutils-2.11.92.0.5/opcodes/fr30-desc.c --- binutils-2.11.90.0.31/opcodes/fr30-desc.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/opcodes/fr30-desc.c Mon Oct 1 15:25:26 2001 @@ -23,7 +23,6 @@ with this program; if not, write to the */ #include "sysdep.h" -#include #include #include #include "ansidecl.h" @@ -34,6 +33,14 @@ with this program; if not, write to the #include "opintl.h" #include "libiberty.h" +static void init_tables PARAMS ((void)); +static const CGEN_MACH * lookup_mach_via_bfd_name PARAMS ((const CGEN_MACH *, const char *)); +static void build_hw_table PARAMS ((CGEN_CPU_TABLE *)); +static void build_ifield_table PARAMS ((CGEN_CPU_TABLE *)); +static void build_operand_table PARAMS ((CGEN_CPU_TABLE *)); +static void build_insn_table PARAMS ((CGEN_CPU_TABLE *)); +static void fr30_cgen_rebuild_tables PARAMS ((CGEN_CPU_TABLE *)); + /* Attributes. */ static const CGEN_ATTR_ENTRY bool_attr[] = diff -uprN binutils-2.11.90.0.31/opcodes/fr30-dis.c binutils-2.11.92.0.5/opcodes/fr30-dis.c --- binutils-2.11.90.0.31/opcodes/fr30-dis.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/opcodes/fr30-dis.c Mon Oct 1 15:25:26 2001 @@ -38,19 +38,20 @@ along with this program; if not, write t /* Default text to print if an instruction isn't recognized. */ #define UNKNOWN_INSN_MSG _("*unknown*") -static void print_normal - PARAMS ((CGEN_CPU_DESC, PTR, long, unsigned int, bfd_vma, int)); -static void print_address - PARAMS ((CGEN_CPU_DESC, PTR, bfd_vma, unsigned int, bfd_vma, int)); -static void print_keyword - PARAMS ((CGEN_CPU_DESC, PTR, CGEN_KEYWORD *, long, unsigned int)); -static void print_insn_normal - PARAMS ((CGEN_CPU_DESC, PTR, const CGEN_INSN *, CGEN_FIELDS *, - bfd_vma, int)); -static int print_insn PARAMS ((CGEN_CPU_DESC, bfd_vma, - disassemble_info *, char *, int)); -static int default_print_insn - PARAMS ((CGEN_CPU_DESC, bfd_vma, disassemble_info *)); +static void print_normal PARAMS ((CGEN_CPU_DESC, PTR, long, unsigned, bfd_vma, int)); +static void print_address PARAMS ((CGEN_CPU_DESC, PTR, bfd_vma, unsigned, bfd_vma, int)); +static void print_keyword PARAMS ((CGEN_CPU_DESC, PTR, CGEN_KEYWORD *, long, unsigned)); +static void print_insn_normal PARAMS ((CGEN_CPU_DESC, PTR, const CGEN_INSN *, CGEN_FIELDS *, bfd_vma, int)); +static int print_insn PARAMS ((CGEN_CPU_DESC, bfd_vma, disassemble_info *, char *, int)); +static int default_print_insn PARAMS ((CGEN_CPU_DESC, bfd_vma, disassemble_info *)); +static void print_register_list PARAMS ((PTR, long, long, int)); +static void print_hi_register_list_ld PARAMS ((CGEN_CPU_DESC, PTR, long, unsigned, bfd_vma, int)); +static void print_low_register_list_ld PARAMS ((CGEN_CPU_DESC, PTR, long, unsigned, bfd_vma, int)); +static void print_hi_register_list_st PARAMS ((CGEN_CPU_DESC, PTR, long, unsigned, bfd_vma, int)); +static void print_low_register_list_st PARAMS ((CGEN_CPU_DESC, PTR, long, unsigned, bfd_vma, int)); +static void print_m4 PARAMS ((CGEN_CPU_DESC, PTR, long, unsigned, bfd_vma, int)); + void fr30_cgen_print_operand PARAMS ((CGEN_CPU_DESC, int, PTR, CGEN_FIELDS *, void const *, bfd_vma, int)); +static int read_insn PARAMS ((CGEN_CPU_DESC, bfd_vma, disassemble_info *, char *, int, CGEN_EXTRACT_INFO *, unsigned long *)); /* -- disassembler routines inserted here */ @@ -96,60 +97,60 @@ print_register_list (dis_info, value, of static void print_hi_register_list_ld (cd, dis_info, value, attrs, pc, length) - CGEN_CPU_DESC cd; + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; PTR dis_info; long value; - unsigned int attrs; - bfd_vma pc; - int length; + unsigned int attrs ATTRIBUTE_UNUSED; + bfd_vma pc ATTRIBUTE_UNUSED; + int length ATTRIBUTE_UNUSED; { print_register_list (dis_info, value, 8, 0/*load*/); } static void print_low_register_list_ld (cd, dis_info, value, attrs, pc, length) - CGEN_CPU_DESC cd; + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; PTR dis_info; long value; - unsigned int attrs; - bfd_vma pc; - int length; + unsigned int attrs ATTRIBUTE_UNUSED; + bfd_vma pc ATTRIBUTE_UNUSED; + int length ATTRIBUTE_UNUSED; { print_register_list (dis_info, value, 0, 0/*load*/); } static void print_hi_register_list_st (cd, dis_info, value, attrs, pc, length) - CGEN_CPU_DESC cd; + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; PTR dis_info; long value; - unsigned int attrs; - bfd_vma pc; - int length; + unsigned int attrs ATTRIBUTE_UNUSED; + bfd_vma pc ATTRIBUTE_UNUSED; + int length ATTRIBUTE_UNUSED; { print_register_list (dis_info, value, 8, 1/*store*/); } static void print_low_register_list_st (cd, dis_info, value, attrs, pc, length) - CGEN_CPU_DESC cd; + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; PTR dis_info; long value; - unsigned int attrs; - bfd_vma pc; - int length; + unsigned int attrs ATTRIBUTE_UNUSED; + bfd_vma pc ATTRIBUTE_UNUSED; + int length ATTRIBUTE_UNUSED; { print_register_list (dis_info, value, 0, 1/*store*/); } static void print_m4 (cd, dis_info, value, attrs, pc, length) - CGEN_CPU_DESC cd; + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; PTR dis_info; long value; - unsigned int attrs; - bfd_vma pc; - int length; + unsigned int attrs ATTRIBUTE_UNUSED; + bfd_vma pc ATTRIBUTE_UNUSED; + int length ATTRIBUTE_UNUSED; { disassemble_info *info = (disassemble_info *) dis_info; (*info->fprintf_func) (info->stream, "%ld", value); @@ -178,7 +179,7 @@ fr30_cgen_print_operand (cd, opindex, xi int opindex; PTR xinfo; CGEN_FIELDS *fields; - void const *attrs; + void const *attrs ATTRIBUTE_UNUSED; bfd_vma pc; int length; { @@ -458,7 +459,7 @@ print_insn_normal (cd, dis_info, insn, f Returns 0 if all is well, non-zero otherwise. */ static int read_insn (cd, pc, info, buf, buflen, ex_info, insn_value) - CGEN_CPU_DESC cd; + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; bfd_vma pc; disassemble_info *info; char *buf; @@ -537,7 +538,7 @@ print_insn (cd, pc, info, buf, buflen) /* Base size may exceed this instruction's size. Extract the relevant part from the buffer. */ if ((CGEN_INSN_BITSIZE (insn) / 8) < buflen && - (CGEN_INSN_BITSIZE (insn) / 8) <= sizeof (unsigned long)) + (unsigned) (CGEN_INSN_BITSIZE (insn) / 8) <= sizeof (unsigned long)) insn_value_cropped = bfd_get_bits (buf, CGEN_INSN_BITSIZE (insn), info->endian == BFD_ENDIAN_BIG); else @@ -552,8 +553,8 @@ print_insn (cd, pc, info, buf, buflen) /* Make sure the entire insn is loaded into insn_value, if it can fit. */ - if (CGEN_INSN_BITSIZE (insn) > cd->base_insn_bitsize && - (CGEN_INSN_BITSIZE (insn) / 8) <= sizeof (unsigned long)) + if ((unsigned) CGEN_INSN_BITSIZE (insn) > cd->base_insn_bitsize && + (unsigned) (CGEN_INSN_BITSIZE (insn) / 8) <= sizeof (unsigned long)) { unsigned long full_insn_value; int rc = read_insn (cd, pc, info, buf, diff -uprN binutils-2.11.90.0.31/opcodes/fr30-ibld.c binutils-2.11.92.0.5/opcodes/fr30-ibld.c --- binutils-2.11.90.0.31/opcodes/fr30-ibld.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/opcodes/fr30-ibld.c Mon Oct 1 15:25:26 2001 @@ -25,7 +25,6 @@ along with this program; if not, write t Keep that in mind. */ #include "sysdep.h" -#include #include #include "ansidecl.h" #include "dis-asm.h" @@ -49,7 +48,6 @@ static const char * insert_normal static const char * insert_insn_normal PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *, CGEN_FIELDS *, CGEN_INSN_BYTES_PTR, bfd_vma)); - static int extract_normal PARAMS ((CGEN_CPU_DESC, CGEN_EXTRACT_INFO *, CGEN_INSN_INT, unsigned int, unsigned int, unsigned int, unsigned int, @@ -57,8 +55,30 @@ static int extract_normal static int extract_insn_normal PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *, CGEN_EXTRACT_INFO *, CGEN_INSN_INT, CGEN_FIELDS *, bfd_vma)); +#if CGEN_INT_INSN_P static void put_insn_int_value PARAMS ((CGEN_CPU_DESC, CGEN_INSN_BYTES_PTR, int, int, CGEN_INSN_INT)); +#endif +static CGEN_INLINE int fill_cache + PARAMS ((CGEN_CPU_DESC, CGEN_EXTRACT_INFO *, int, int, bfd_vma)); +static CGEN_INLINE long extract_1 + PARAMS ((CGEN_CPU_DESC, CGEN_EXTRACT_INFO *, int, int, int, unsigned char *, + bfd_vma)); +static CGEN_INLINE void insert_1 + PARAMS ((CGEN_CPU_DESC, unsigned long, int, int, int, unsigned char *)); +const char * fr30_cgen_insert_operand + PARAMS ((CGEN_CPU_DESC, int, CGEN_FIELDS *, CGEN_INSN_BYTES_PTR, bfd_vma)); +int fr30_cgen_extract_operand + PARAMS ((CGEN_CPU_DESC, int, CGEN_EXTRACT_INFO *, CGEN_INSN_INT, CGEN_FIELDS *, + bfd_vma)); +int fr30_cgen_get_int_operand + PARAMS ((CGEN_CPU_DESC, int, const CGEN_FIELDS *)); +bfd_vma fr30_cgen_get_vma_operand + PARAMS ((CGEN_CPU_DESC, int, const CGEN_FIELDS *)); +void fr30_cgen_set_int_operand + PARAMS ((CGEN_CPU_DESC, int, CGEN_FIELDS *, int)); +void fr30_cgen_set_vma_operand + PARAMS ((CGEN_CPU_DESC, int, CGEN_FIELDS *, bfd_vma)); /* Operand insertion. */ @@ -249,7 +269,7 @@ insert_insn_normal (cd, insn, fields, bu #else cgen_put_insn_value (cd, buffer, min (cd->base_insn_bitsize, - CGEN_FIELDS_BITSIZE (fields)), + (unsigned) CGEN_FIELDS_BITSIZE (fields)), value); #endif /* ! CGEN_INT_INSN_P */ @@ -275,6 +295,7 @@ insert_insn_normal (cd, insn, fields, bu return NULL; } +#if CGEN_INT_INSN_P /* Cover function to store an insn value into an integral insn. Must go here because it needs -desc.h for CGEN_INT_INSN_P. */ @@ -298,6 +319,7 @@ put_insn_int_value (cd, buf, length, ins *buf = (*buf & ~(mask << shift)) | ((value & mask) << shift); } } +#endif /* Operand extraction. */ @@ -311,14 +333,14 @@ put_insn_int_value (cd, buf, length, ins static CGEN_INLINE int fill_cache (cd, ex_info, offset, bytes, pc) - CGEN_CPU_DESC cd; + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; CGEN_EXTRACT_INFO *ex_info; int offset, bytes; bfd_vma pc; { /* It's doubtful that the middle part has already been fetched so we don't optimize that case. kiss. */ - int mask; + unsigned int mask; disassemble_info *info = (disassemble_info *) ex_info->dis_info; /* First do a quick check. */ @@ -356,10 +378,10 @@ fill_cache (cd, ex_info, offset, bytes, static CGEN_INLINE long extract_1 (cd, ex_info, start, length, word_length, bufp, pc) CGEN_CPU_DESC cd; - CGEN_EXTRACT_INFO *ex_info; + CGEN_EXTRACT_INFO *ex_info ATTRIBUTE_UNUSED; int start,length,word_length; unsigned char *bufp; - bfd_vma pc; + bfd_vma pc ATTRIBUTE_UNUSED; { unsigned long x; int shift; @@ -943,7 +965,7 @@ cgen_extract_fn * const fr30_cgen_extrac int fr30_cgen_get_int_operand (cd, opindex, fields) - CGEN_CPU_DESC cd; + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; int opindex; const CGEN_FIELDS * fields; { @@ -1072,7 +1094,7 @@ fr30_cgen_get_int_operand (cd, opindex, bfd_vma fr30_cgen_get_vma_operand (cd, opindex, fields) - CGEN_CPU_DESC cd; + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; int opindex; const CGEN_FIELDS * fields; { @@ -1206,7 +1228,7 @@ fr30_cgen_get_vma_operand (cd, opindex, void fr30_cgen_set_int_operand (cd, opindex, fields, value) - CGEN_CPU_DESC cd; + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; int opindex; CGEN_FIELDS * fields; int value; @@ -1328,7 +1350,7 @@ fr30_cgen_set_int_operand (cd, opindex, void fr30_cgen_set_vma_operand (cd, opindex, fields, value) - CGEN_CPU_DESC cd; + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; int opindex; CGEN_FIELDS * fields; bfd_vma value; diff -uprN binutils-2.11.90.0.31/opcodes/fr30-opc.c binutils-2.11.92.0.5/opcodes/fr30-opc.c --- binutils-2.11.90.0.31/opcodes/fr30-opc.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/opcodes/fr30-opc.c Mon Oct 1 15:25:26 2001 @@ -33,10 +33,11 @@ with this program; if not, write to the /* The hash functions are recorded here to help keep assembler code out of the disassembler and vice versa. */ -static int asm_hash_insn_p PARAMS ((const CGEN_INSN *)); -static unsigned int asm_hash_insn PARAMS ((const char *)); -static int dis_hash_insn_p PARAMS ((const CGEN_INSN *)); -static unsigned int dis_hash_insn PARAMS ((const char *, CGEN_INSN_INT)); +static int asm_hash_insn_p PARAMS ((const CGEN_INSN *)); +static unsigned int asm_hash_insn PARAMS ((const char *)); +static int dis_hash_insn_p PARAMS ((const CGEN_INSN *)); +static unsigned int dis_hash_insn PARAMS ((const char *, CGEN_INSN_INT)); +static void set_fields_bitsize PARAMS ((CGEN_FIELDS *, int)); /* Instruction formats. */ @@ -1284,7 +1285,7 @@ static const CGEN_OPCODE fr30_cgen_macro static int asm_hash_insn_p (insn) - const CGEN_INSN *insn; + const CGEN_INSN *insn ATTRIBUTE_UNUSED; { return CGEN_ASM_HASH_P (insn); } @@ -1335,7 +1336,7 @@ asm_hash_insn (mnem) static unsigned int dis_hash_insn (buf, value) const char * buf; - CGEN_INSN_INT value; + CGEN_INSN_INT value ATTRIBUTE_UNUSED; { return CGEN_DIS_HASH (buf, value); } diff -uprN binutils-2.11.90.0.31/opcodes/i370-opc.c binutils-2.11.92.0.5/opcodes/i370-opc.c --- binutils-2.11.90.0.31/opcodes/i370-opc.c Sun Apr 16 10:13:54 2000 +++ binutils-2.11.92.0.5/opcodes/i370-opc.c Mon Oct 1 15:25:26 2001 @@ -1,5 +1,5 @@ /* i370-opc.c -- Instruction 370 (ESA/390) architecture opcode list - Copyright 1994, 1999, 2000 Free Software Foundation, Inc. + Copyright 1994, 1999, 2000, 2001 Free Software Foundation, Inc. PowerPC version written by Ian Lance Taylor, Cygnus Support Rewritten for i370 ESA/390 support by Linas Vepstas 1998, 1999 @@ -199,7 +199,7 @@ const struct i370_operand i370_operands[ #define S_D2_MASK (0xfff) { 12, 0, 0, 0, I370_OPERAND_RELATIVE, "S D2" }, - /* The L length field in an SS form instruction. */ + /* The L length field in an SS form instruction. */ #define SS_L (S_D2 + 1) #define SS_L_MASK (0xffff<<16) { 8, 16, 0, 0, I370_OPERAND_RELATIVE | I370_OPERAND_LENGTH, "SS L" }, @@ -234,7 +234,7 @@ static i370_insn_t insert_ss_b2 (insn, value, errmsg) i370_insn_t insn; long value; - const char **errmsg; + const char **errmsg ATTRIBUTE_UNUSED; { insn.i[1] |= (value & 0xf) << 28; return insn; @@ -244,7 +244,7 @@ static i370_insn_t insert_ss_d2 (insn, value, errmsg) i370_insn_t insn; long value; - const char **errmsg; + const char **errmsg ATTRIBUTE_UNUSED; { insn.i[1] |= (value & 0xfff) << 16; return insn; @@ -254,7 +254,7 @@ static i370_insn_t insert_rxf_r3 (insn, value, errmsg) i370_insn_t insn; long value; - const char **errmsg; + const char **errmsg ATTRIBUTE_UNUSED; { insn.i[1] |= (value & 0xf) << 28; return insn; @@ -263,7 +263,7 @@ insert_rxf_r3 (insn, value, errmsg) static long extract_ss_b2 (insn, invalid) i370_insn_t insn; - int *invalid; + int *invalid ATTRIBUTE_UNUSED; { return (insn.i[1] >>28) & 0xf; } @@ -271,7 +271,7 @@ extract_ss_b2 (insn, invalid) static long extract_ss_d2 (insn, invalid) i370_insn_t insn; - int *invalid; + int *invalid ATTRIBUTE_UNUSED; { return (insn.i[1] >>16) & 0xfff; } @@ -279,7 +279,7 @@ extract_ss_d2 (insn, invalid) static long extract_rxf_r3 (insn, invalid) i370_insn_t insn; - int *invalid; + int *invalid ATTRIBUTE_UNUSED; { return (insn.i[1] >>28) & 0xf; } @@ -341,7 +341,7 @@ extract_rxf_r3 (insn, invalid) #define RRF_MASK RRF (0xffff, 0x0, 0x0, 0x0) -/* An RX form instruction. */ +/* An RX form instruction. */ #define RX(op, r1, x2, b2, d2) \ (XOPS(op) | ((((unsigned short)(r1)) & 0xf) << 20) | \ ((((unsigned short)(x2)) & 0xf) << 16) | \ @@ -350,7 +350,7 @@ extract_rxf_r3 (insn, invalid) #define RX_MASK RX (0xff, 0x0, 0x0, 0x0, 0x0) -/* An RXE form instruction high word. */ +/* An RXE form instruction high word. */ #define RXEH(op, r1, x2, b2, d2) \ (XOPS(op) | ((((unsigned short)(r1)) & 0xf) << 20) | \ ((((unsigned short)(x2)) & 0xf) << 16) | \ @@ -359,13 +359,13 @@ extract_rxf_r3 (insn, invalid) #define RXEH_MASK RXEH (0xff, 0, 0, 0, 0) -/* An RXE form instruction low word. */ +/* An RXE form instruction low word. */ #define RXEL(op) \ ((((unsigned short)(op)) & 0xff) << 16 ) #define RXEL_MASK RXEL (0xff) -/* An RXF form instruction high word. */ +/* An RXF form instruction high word. */ #define RXFH(op, r1, x2, b2, d2) \ (XOPS(op) | ((((unsigned short)(r1)) & 0xf) << 20) | \ ((((unsigned short)(x2)) & 0xf) << 16) | \ @@ -374,14 +374,14 @@ extract_rxf_r3 (insn, invalid) #define RXFH_MASK RXFH (0xff, 0, 0, 0, 0) -/* An RXF form instruction low word. */ +/* An RXF form instruction low word. */ #define RXFL(op, r3) \ (((((unsigned short)(r3)) & 0xf) << 28 ) | \ ((((unsigned short)(op)) & 0xff) << 16 )) #define RXFL_MASK RXFL (0xff, 0) -/* An RS form instruction. */ +/* An RS form instruction. */ #define RS(op, r1, b3, b2, d2) \ (XOPS(op) | ((((unsigned short)(r1)) & 0xf) << 20) | \ ((((unsigned short)(b3)) & 0xf) << 16) | \ @@ -390,7 +390,7 @@ extract_rxf_r3 (insn, invalid) #define RS_MASK RS (0xff, 0x0, 0x0, 0x0, 0x0) -/* An RSI form instruction. */ +/* An RSI form instruction. */ #define RSI(op, r1, r3, i2) \ (XOPS(op) | ((((unsigned short)(r1)) & 0xf) << 20) | \ ((((unsigned short)(r3)) & 0xf) << 16) | \ @@ -398,14 +398,14 @@ extract_rxf_r3 (insn, invalid) #define RSI_MASK RSI (0xff, 0x0, 0x0, 0x0) -/* An RI form instruction. */ +/* An RI form instruction. */ #define RI(op, r1, i2) \ (ROPS(op) | ((((unsigned short)(r1)) & 0xf) << 20) | \ ((((unsigned short)(i2)) & 0xffff))) #define RI_MASK RI (0xfff, 0x0, 0x0) -/* An SI form instruction. */ +/* An SI form instruction. */ #define SI(op, i2, b1, d1) \ (XOPS(op) | ((((unsigned short)(i2)) & 0xff) << 16) | \ ((((unsigned short)(b1)) & 0xf) << 12) | \ @@ -413,32 +413,32 @@ extract_rxf_r3 (insn, invalid) #define SI_MASK SI (0xff, 0x0, 0x0, 0x0) -/* An S form instruction. */ +/* An S form instruction. */ #define S(op, b2, d2) \ (SOPS(op) | ((((unsigned short)(b2)) & 0xf) << 12) | \ ((((unsigned short)(d2)) & 0xfff))) #define S_MASK S (0xffff, 0x0, 0x0) -/* An SS form instruction high word. */ +/* An SS form instruction high word. */ #define SSH(op, l, b1, d1) \ (XOPS(op) | ((((unsigned short)(l)) & 0xff) << 16) | \ ((((unsigned short)(b1)) & 0xf) << 12) | \ ((((unsigned short)(d1)) & 0xfff))) -/* An SS form instruction low word. */ +/* An SS form instruction low word. */ #define SSL(b2, d2) \ ( ((((unsigned short)(b1)) & 0xf) << 28) | \ ((((unsigned short)(d1)) & 0xfff) << 16 )) #define SS_MASK SSH (0xff, 0x0, 0x0, 0x0) -/* An SSE form instruction high word. */ +/* An SSE form instruction high word. */ #define SSEH(op, b1, d1) \ (SOPS(op) | ((((unsigned short)(b1)) & 0xf) << 12) | \ ((((unsigned short)(d1)) & 0xfff))) -/* An SSE form instruction low word. */ +/* An SSE form instruction low word. */ #define SSEL(b2, d2) \ ( ((((unsigned short)(b1)) & 0xf) << 28) | \ ((((unsigned short)(d1)) & 0xfff) << 16 )) @@ -495,414 +495,414 @@ extract_rxf_r3 (insn, invalid) const struct i370_opcode i370_opcodes[] = { /* E form instructions */ -{ "pr", 2, {E(0x0101), 0}, {E_MASK, 0}, IESA, {0} }, +{ "pr", 2, {{E(0x0101), 0}}, {{E_MASK, 0}}, IESA, {0} }, -{ "trap2", 2, {E(0x01FF), 0}, {E_MASK, 0}, ITR, {0} }, -{ "upt", 2, {E(0x0102), 0}, {E_MASK, 0}, IXA, {0} }, +{ "trap2", 2, {{E(0x01FF), 0}}, {{E_MASK, 0}}, ITR, {0} }, +{ "upt", 2, {{E(0x0102), 0}}, {{E_MASK, 0}}, IXA, {0} }, /* RR form instructions */ -{ "ar", 2, {RR(0x1a,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "adr", 2, {RR(0x2a,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "aer", 2, {RR(0x3a,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "alr", 2, {RR(0x1e,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "aur", 2, {RR(0x2e,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "awr", 2, {RR(0x3e,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "axr", 2, {RR(0x36,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "balr", 2, {RR(0x05,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "basr", 2, {RR(0x0d,0,0), 0}, {RR_MASK, 0}, IXA, {RR_R1, RR_R2} }, -{ "bassm", 2, {RR(0x0c,0,0), 0}, {RR_MASK, 0}, IXA, {RR_R1, RR_R2} }, -{ "bsm", 2, {RR(0x0b,0,0), 0}, {RR_MASK, 0}, IXA, {RR_R1, RR_R2} }, -{ "bcr", 2, {RR(0x07,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "bctr", 2, {RR(0x06,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "cdr", 2, {RR(0x29,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "cer", 2, {RR(0x39,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "clr", 2, {RR(0x15,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "clcl", 2, {RR(0x0f,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "cr", 2, {RR(0x19,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "ddr", 2, {RR(0x2d,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "der", 2, {RR(0x3d,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "dr", 2, {RR(0x1d,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "hdr", 2, {RR(0x24,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "her", 2, {RR(0x34,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "lcdr", 2, {RR(0x23,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "lcer", 2, {RR(0x33,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "lcr", 2, {RR(0x13,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "ldr", 2, {RR(0x28,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "ler", 2, {RR(0x38,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "lndr", 2, {RR(0x21,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "lner", 2, {RR(0x31,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "lnr", 2, {RR(0x11,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "lpdr", 2, {RR(0x20,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "lper", 2, {RR(0x30,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "lpr", 2, {RR(0x10,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "lr", 2, {RR(0x18,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "lrdr", 2, {RR(0x25,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "lrer", 2, {RR(0x35,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "ltdr", 2, {RR(0x22,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "lter", 2, {RR(0x32,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "ltr", 2, {RR(0x12,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "mdr", 2, {RR(0x2c,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "mer", 2, {RR(0x3c,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "mr", 2, {RR(0x1c,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "mvcl", 2, {RR(0x0e,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "mxdr", 2, {RR(0x27,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "mxr", 2, {RR(0x26,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "nr", 2, {RR(0x14,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "or", 2, {RR(0x16,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "sdr", 2, {RR(0x2b,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "ser", 2, {RR(0x3b,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "slr", 2, {RR(0x1f,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "spm", 2, {RR(0x04,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1} }, -{ "sr", 2, {RR(0x1b,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "sur", 2, {RR(0x3f,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "swr", 2, {RR(0x2f,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "sxr", 2, {RR(0x37,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, -{ "xr", 2, {RR(0x17,0,0), 0}, {RR_MASK, 0}, I370, {RR_R1, RR_R2} }, +{ "ar", 2, {{RR(0x1a,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "adr", 2, {{RR(0x2a,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "aer", 2, {{RR(0x3a,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "alr", 2, {{RR(0x1e,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "aur", 2, {{RR(0x2e,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "awr", 2, {{RR(0x3e,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "axr", 2, {{RR(0x36,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "balr", 2, {{RR(0x05,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "basr", 2, {{RR(0x0d,0,0), 0}}, {{RR_MASK, 0}}, IXA, {RR_R1, RR_R2} }, +{ "bassm", 2, {{RR(0x0c,0,0), 0}}, {{RR_MASK, 0}}, IXA, {RR_R1, RR_R2} }, +{ "bsm", 2, {{RR(0x0b,0,0), 0}}, {{RR_MASK, 0}}, IXA, {RR_R1, RR_R2} }, +{ "bcr", 2, {{RR(0x07,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "bctr", 2, {{RR(0x06,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "cdr", 2, {{RR(0x29,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "cer", 2, {{RR(0x39,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "clr", 2, {{RR(0x15,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "clcl", 2, {{RR(0x0f,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "cr", 2, {{RR(0x19,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "ddr", 2, {{RR(0x2d,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "der", 2, {{RR(0x3d,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "dr", 2, {{RR(0x1d,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "hdr", 2, {{RR(0x24,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "her", 2, {{RR(0x34,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "lcdr", 2, {{RR(0x23,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "lcer", 2, {{RR(0x33,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "lcr", 2, {{RR(0x13,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "ldr", 2, {{RR(0x28,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "ler", 2, {{RR(0x38,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "lndr", 2, {{RR(0x21,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "lner", 2, {{RR(0x31,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "lnr", 2, {{RR(0x11,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "lpdr", 2, {{RR(0x20,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "lper", 2, {{RR(0x30,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "lpr", 2, {{RR(0x10,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "lr", 2, {{RR(0x18,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "lrdr", 2, {{RR(0x25,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "lrer", 2, {{RR(0x35,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "ltdr", 2, {{RR(0x22,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "lter", 2, {{RR(0x32,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "ltr", 2, {{RR(0x12,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "mdr", 2, {{RR(0x2c,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "mer", 2, {{RR(0x3c,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "mr", 2, {{RR(0x1c,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "mvcl", 2, {{RR(0x0e,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "mxdr", 2, {{RR(0x27,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "mxr", 2, {{RR(0x26,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "nr", 2, {{RR(0x14,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "or", 2, {{RR(0x16,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "sdr", 2, {{RR(0x2b,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "ser", 2, {{RR(0x3b,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "slr", 2, {{RR(0x1f,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "spm", 2, {{RR(0x04,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1} }, +{ "sr", 2, {{RR(0x1b,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "sur", 2, {{RR(0x3f,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "swr", 2, {{RR(0x2f,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "sxr", 2, {{RR(0x37,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, +{ "xr", 2, {{RR(0x17,0,0), 0}}, {{RR_MASK, 0}}, I370, {RR_R1, RR_R2} }, /* unusual RR formats */ -{ "svc", 2, {SVC(0x0a,0), 0}, {SVC_MASK, 0}, I370, {RR_I} }, +{ "svc", 2, {{SVC(0x0a,0), 0}}, {{SVC_MASK, 0}}, I370, {RR_I} }, /* RRE form instructions */ -{ "adbr", 4, {RRE(0xb31a,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "aebr", 4, {RRE(0xb30a,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "axbr", 4, {RRE(0xb34a,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "bakr", 4, {RRE(0xb240,0,0), 0}, {RRE_MASK, 0}, IESA, {RRE_R1, RRE_R2} }, -{ "bsa", 4, {RRE(0xb25a,0,0), 0}, {RRE_MASK, 0}, IBS, {RRE_R1, RRE_R2} }, -{ "bsg", 4, {RRE(0xb258,0,0), 0}, {RRE_MASK, 0}, ISG, {RRE_R1, RRE_R2} }, -{ "cdbr", 4, {RRE(0xb319,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "cdfbr", 4, {RRE(0xb395,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "cdfr", 4, {RRE(0xb3b5,0,0), 0}, {RRE_MASK, 0}, IHX, {RRE_R1, RRE_R2} }, -{ "cebr", 4, {RRE(0xb309,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "cefbr", 4, {RRE(0xb394,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "cefr", 4, {RRE(0xb3b4,0,0), 0}, {RRE_MASK, 0}, IHX, {RRE_R1, RRE_R2} }, -{ "cksm", 4, {RRE(0xb241,0,0), 0}, {RRE_MASK, 0}, ICK, {RRE_R1, RRE_R2} }, -{ "clst", 4, {RRE(0xb25d,0,0), 0}, {RRE_MASK, 0}, ISR, {RRE_R1, RRE_R2} }, -{ "cpya", 4, {RRE(0xb24d,0,0), 0}, {RRE_MASK, 0}, IESA, {RRE_R1, RRE_R2} }, -{ "cuse", 4, {RRE(0xb257,0,0), 0}, {RRE_MASK, 0}, IESA, {RRE_R1, RRE_R2} }, -{ "cxbr", 4, {RRE(0xb349,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "cxfbr", 4, {RRE(0xb396,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "cxfr", 4, {RRE(0xb3b6,0,0), 0}, {RRE_MASK, 0}, IHX, {RRE_R1, RRE_R2} }, -{ "cxr", 4, {RRE(0xb369,0,0), 0}, {RRE_MASK, 0}, IHX, {RRE_R1, RRE_R2} }, -{ "ddbr", 4, {RRE(0xb31d,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "debr", 4, {RRE(0xb30d,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "dxbr", 4, {RRE(0xb34d,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "dxr", 4, {RRE(0xb22d,0,0), 0}, {RRE_MASK, 0}, IXA, {RRE_R1, RRE_R2} }, -{ "ear", 4, {RRE(0xb24f,0,0), 0}, {RRE_MASK, 0}, IESA, {RRE_R1, RRE_R2} }, -{ "efpc", 4, {RRE(0xb38c,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "epar", 4, {RRE(0xb226,0,0), 0}, {RRE_MASK, 0}, IXA, {RRE_R1} }, -{ "ereg", 4, {RRE(0xb249,0,0), 0}, {RRE_MASK, 0}, IESA, {RRE_R1, RRE_R2} }, -{ "esar", 4, {RRE(0xb227,0,0), 0}, {RRE_MASK, 0}, IXA, {RRE_R1} }, -{ "esta", 4, {RRE(0xb24a,0,0), 0}, {RRE_MASK, 0}, IESA, {RRE_R1, RRE_R2} }, -{ "fidr", 4, {RRE(0xb37f,0,0), 0}, {RRE_MASK, 0}, IHX, {RRE_R1, RRE_R2} }, -{ "fier", 4, {RRE(0xb377,0,0), 0}, {RRE_MASK, 0}, IHX, {RRE_R1, RRE_R2} }, -{ "fixr", 4, {RRE(0xb367,0,0), 0}, {RRE_MASK, 0}, IHX, {RRE_R1, RRE_R2} }, -{ "iac", 4, {RRE(0xb224,0,0), 0}, {RRE_MASK, 0}, IXA, {RRE_R1} }, -{ "ipm", 4, {RRE(0xb222,0,0), 0}, {RRE_MASK, 0}, IXA, {RRE_R1} }, -{ "ipte", 4, {RRE(0xb221,0,0), 0}, {RRE_MASK, 0}, IXA, {RRE_R1, RRE_R2} }, -{ "iske", 4, {RRE(0xb229,0,0), 0}, {RRE_MASK, 0}, IXA, {RRE_R1, RRE_R2} }, -{ "ivsk", 4, {RRE(0xb223,0,0), 0}, {RRE_MASK, 0}, IXA, {RRE_R1, RRE_R2} }, -{ "kdbr", 4, {RRE(0xb318,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "kebr", 4, {RRE(0xb308,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "kxbr", 4, {RRE(0xb348,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "lcdbr", 4, {RRE(0xb313,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "lcebr", 4, {RRE(0xb303,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "lcxbr", 4, {RRE(0xb343,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "lcxr", 4, {RRE(0xb363,0,0), 0}, {RRE_MASK, 0}, IHX, {RRE_R1, RRE_R2} }, -{ "lder", 4, {RRE(0xb324,0,0), 0}, {RRE_MASK, 0}, IHX, {RRE_R1, RRE_R2} }, -{ "ldxbr", 4, {RRE(0xb345,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "ledbr", 4, {RRE(0xb344,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "lexbr", 4, {RRE(0xb346,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "lexr", 4, {RRE(0xb366,0,0), 0}, {RRE_MASK, 0}, IHX, {RRE_R1, RRE_R2} }, -{ "lndbr", 4, {RRE(0xb311,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "lnebr", 4, {RRE(0xb301,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "lnxbr", 4, {RRE(0xb341,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "lnxr", 4, {RRE(0xb361,0,0), 0}, {RRE_MASK, 0}, IHX, {RRE_R1, RRE_R2} }, -{ "lpdbr", 4, {RRE(0xb310,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "lpebr", 4, {RRE(0xb300,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "lpxbr", 4, {RRE(0xb340,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "lpxr", 4, {RRE(0xb360,0,0), 0}, {RRE_MASK, 0}, IHX, {RRE_R1, RRE_R2} }, -{ "ltdbr", 4, {RRE(0xb312,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "ltebr", 4, {RRE(0xb302,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "ltxbr", 4, {RRE(0xb342,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "ltxr", 4, {RRE(0xb362,0,0), 0}, {RRE_MASK, 0}, IHX, {RRE_R1, RRE_R2} }, -{ "lura", 4, {RRE(0xb24b,0,0), 0}, {RRE_MASK, 0}, IESA, {RRE_R1, RRE_R2} }, -{ "lxdr", 4, {RRE(0xb325,0,0), 0}, {RRE_MASK, 0}, IHX, {RRE_R1, RRE_R2} }, -{ "lxer", 4, {RRE(0xb326,0,0), 0}, {RRE_MASK, 0}, IHX, {RRE_R1, RRE_R2} }, -{ "lxr", 4, {RRE(0xb365,0,0), 0}, {RRE_MASK, 0}, IFX, {RRE_R1, RRE_R2} }, -{ "lzdr", 4, {RRE(0xb375,0,0), 0}, {RRE_MASK, 0}, IFX, {RRE_R1, RRE_R2} }, -{ "lzer", 4, {RRE(0xb374,0,0), 0}, {RRE_MASK, 0}, IFX, {RRE_R1, RRE_R2} }, -{ "lzxr", 4, {RRE(0xb376,0,0), 0}, {RRE_MASK, 0}, IFX, {RRE_R1, RRE_R2} }, -{ "mdbr", 4, {RRE(0xb31c,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "mdebr", 4, {RRE(0xb30c,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "meebr", 4, {RRE(0xb317,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "meer", 4, {RRE(0xb337,0,0), 0}, {RRE_MASK, 0}, IHX, {RRE_R1, RRE_R2} }, -{ "msr", 4, {RRE(0xb252,0,0), 0}, {RRE_MASK, 0}, IIR, {RRE_R1, RRE_R2} }, -{ "msta", 4, {RRE(0xb247,0,0), 0}, {RRE_MASK, 0}, IESA, {RRE_R1} }, -{ "mvpg", 4, {RRE(0xb254,0,0), 0}, {RRE_MASK, 0}, IESA, {RRE_R1, RRE_R2} }, -{ "mvst", 4, {RRE(0xb255,0,0), 0}, {RRE_MASK, 0}, ISR, {RRE_R1, RRE_R2} }, -{ "mxbr", 4, {RRE(0xb34c,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "mxdbr", 4, {RRE(0xb307,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "palb", 4, {RRE(0xb248,0,0), 0}, {RRE_MASK, 0}, IESA, {0} }, -{ "prbe", 4, {RRE(0xb22a,0,0), 0}, {RRE_MASK, 0}, I370, {RRE_R1, RRE_R2} }, -{ "pt", 4, {RRE(0xb228,0,0), 0}, {RRE_MASK, 0}, IXA, {RRE_R1, RRE_R2} }, -{ "rrbe", 4, {RRE(0xb22a,0,0), 0}, {RRE_MASK, 0}, IXA, {RRE_R1, RRE_R2} }, -{ "sar", 4, {RRE(0xb24e,0,0), 0}, {RRE_MASK, 0}, IESA, {RRE_R1, RRE_R2} }, -{ "sdbr", 4, {RRE(0xb31b,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "sebr", 4, {RRE(0xb30b,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "servc", 4, {RRE(0xb220,0,0), 0}, {RRE_MASK, 0}, IESA, {RRE_R1, RRE_R2} }, -{ "sfpc", 4, {RRE(0xb384,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "sqdbr", 4, {RRE(0xb315,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "sqdr", 4, {RRE(0xb244,0,0), 0}, {RRE_MASK, 0}, IQR, {RRE_R1, RRE_R2} }, -{ "sqebr", 4, {RRE(0xb314,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "sqer", 4, {RRE(0xb245,0,0), 0}, {RRE_MASK, 0}, IQR, {RRE_R1, RRE_R2} }, -{ "sqxbr", 4, {RRE(0xb316,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "sqxr", 4, {RRE(0xb336,0,0), 0}, {RRE_MASK, 0}, IHX, {RRE_R1, RRE_R2} }, -{ "srst", 4, {RRE(0xb25e,0,0), 0}, {RRE_MASK, 0}, ISR, {RRE_R1, RRE_R2} }, -{ "ssar", 4, {RRE(0xb225,0,0), 0}, {RRE_MASK, 0}, IXA, {RRE_R1} }, -{ "sske", 4, {RRE(0xb22b,0,0), 0}, {RRE_MASK, 0}, IXA, {RRE_R1, RRE_R2} }, -{ "stura", 4, {RRE(0xb246,0,0), 0}, {RRE_MASK, 0}, IESA, {RRE_R1, RRE_R2} }, -{ "sxbr", 4, {RRE(0xb34b,0,0), 0}, {RRE_MASK, 0}, IBF, {RRE_R1, RRE_R2} }, -{ "tar", 4, {RRE(0xb24c,0,0), 0}, {RRE_MASK, 0}, IESA, {RRE_R1, RRE_R2} }, -{ "tb", 4, {RRE(0xb22c,0,0), 0}, {RRE_MASK, 0}, IXA, {RRE_R1, RRE_R2} }, -{ "thdr", 4, {RRE(0xb359,0,0), 0}, {RRE_MASK, 0}, IFX, {RRE_R1, RRE_R2} }, -{ "thder", 4, {RRE(0xb359,0,0), 0}, {RRE_MASK, 0}, IFX, {RRE_R1, RRE_R2} }, +{ "adbr", 4, {{RRE(0xb31a,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "aebr", 4, {{RRE(0xb30a,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "axbr", 4, {{RRE(0xb34a,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "bakr", 4, {{RRE(0xb240,0,0), 0}}, {{RRE_MASK, 0}}, IESA, {RRE_R1, RRE_R2} }, +{ "bsa", 4, {{RRE(0xb25a,0,0), 0}}, {{RRE_MASK, 0}}, IBS, {RRE_R1, RRE_R2} }, +{ "bsg", 4, {{RRE(0xb258,0,0), 0}}, {{RRE_MASK, 0}}, ISG, {RRE_R1, RRE_R2} }, +{ "cdbr", 4, {{RRE(0xb319,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "cdfbr", 4, {{RRE(0xb395,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "cdfr", 4, {{RRE(0xb3b5,0,0), 0}}, {{RRE_MASK, 0}}, IHX, {RRE_R1, RRE_R2} }, +{ "cebr", 4, {{RRE(0xb309,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "cefbr", 4, {{RRE(0xb394,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "cefr", 4, {{RRE(0xb3b4,0,0), 0}}, {{RRE_MASK, 0}}, IHX, {RRE_R1, RRE_R2} }, +{ "cksm", 4, {{RRE(0xb241,0,0), 0}}, {{RRE_MASK, 0}}, ICK, {RRE_R1, RRE_R2} }, +{ "clst", 4, {{RRE(0xb25d,0,0), 0}}, {{RRE_MASK, 0}}, ISR, {RRE_R1, RRE_R2} }, +{ "cpya", 4, {{RRE(0xb24d,0,0), 0}}, {{RRE_MASK, 0}}, IESA, {RRE_R1, RRE_R2} }, +{ "cuse", 4, {{RRE(0xb257,0,0), 0}}, {{RRE_MASK, 0}}, IESA, {RRE_R1, RRE_R2} }, +{ "cxbr", 4, {{RRE(0xb349,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "cxfbr", 4, {{RRE(0xb396,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "cxfr", 4, {{RRE(0xb3b6,0,0), 0}}, {{RRE_MASK, 0}}, IHX, {RRE_R1, RRE_R2} }, +{ "cxr", 4, {{RRE(0xb369,0,0), 0}}, {{RRE_MASK, 0}}, IHX, {RRE_R1, RRE_R2} }, +{ "ddbr", 4, {{RRE(0xb31d,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "debr", 4, {{RRE(0xb30d,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "dxbr", 4, {{RRE(0xb34d,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "dxr", 4, {{RRE(0xb22d,0,0), 0}}, {{RRE_MASK, 0}}, IXA, {RRE_R1, RRE_R2} }, +{ "ear", 4, {{RRE(0xb24f,0,0), 0}}, {{RRE_MASK, 0}}, IESA, {RRE_R1, RRE_R2} }, +{ "efpc", 4, {{RRE(0xb38c,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "epar", 4, {{RRE(0xb226,0,0), 0}}, {{RRE_MASK, 0}}, IXA, {RRE_R1} }, +{ "ereg", 4, {{RRE(0xb249,0,0), 0}}, {{RRE_MASK, 0}}, IESA, {RRE_R1, RRE_R2} }, +{ "esar", 4, {{RRE(0xb227,0,0), 0}}, {{RRE_MASK, 0}}, IXA, {RRE_R1} }, +{ "esta", 4, {{RRE(0xb24a,0,0), 0}}, {{RRE_MASK, 0}}, IESA, {RRE_R1, RRE_R2} }, +{ "fidr", 4, {{RRE(0xb37f,0,0), 0}}, {{RRE_MASK, 0}}, IHX, {RRE_R1, RRE_R2} }, +{ "fier", 4, {{RRE(0xb377,0,0), 0}}, {{RRE_MASK, 0}}, IHX, {RRE_R1, RRE_R2} }, +{ "fixr", 4, {{RRE(0xb367,0,0), 0}}, {{RRE_MASK, 0}}, IHX, {RRE_R1, RRE_R2} }, +{ "iac", 4, {{RRE(0xb224,0,0), 0}}, {{RRE_MASK, 0}}, IXA, {RRE_R1} }, +{ "ipm", 4, {{RRE(0xb222,0,0), 0}}, {{RRE_MASK, 0}}, IXA, {RRE_R1} }, +{ "ipte", 4, {{RRE(0xb221,0,0), 0}}, {{RRE_MASK, 0}}, IXA, {RRE_R1, RRE_R2} }, +{ "iske", 4, {{RRE(0xb229,0,0), 0}}, {{RRE_MASK, 0}}, IXA, {RRE_R1, RRE_R2} }, +{ "ivsk", 4, {{RRE(0xb223,0,0), 0}}, {{RRE_MASK, 0}}, IXA, {RRE_R1, RRE_R2} }, +{ "kdbr", 4, {{RRE(0xb318,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "kebr", 4, {{RRE(0xb308,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "kxbr", 4, {{RRE(0xb348,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "lcdbr", 4, {{RRE(0xb313,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "lcebr", 4, {{RRE(0xb303,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "lcxbr", 4, {{RRE(0xb343,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "lcxr", 4, {{RRE(0xb363,0,0), 0}}, {{RRE_MASK, 0}}, IHX, {RRE_R1, RRE_R2} }, +{ "lder", 4, {{RRE(0xb324,0,0), 0}}, {{RRE_MASK, 0}}, IHX, {RRE_R1, RRE_R2} }, +{ "ldxbr", 4, {{RRE(0xb345,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "ledbr", 4, {{RRE(0xb344,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "lexbr", 4, {{RRE(0xb346,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "lexr", 4, {{RRE(0xb366,0,0), 0}}, {{RRE_MASK, 0}}, IHX, {RRE_R1, RRE_R2} }, +{ "lndbr", 4, {{RRE(0xb311,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "lnebr", 4, {{RRE(0xb301,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "lnxbr", 4, {{RRE(0xb341,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "lnxr", 4, {{RRE(0xb361,0,0), 0}}, {{RRE_MASK, 0}}, IHX, {RRE_R1, RRE_R2} }, +{ "lpdbr", 4, {{RRE(0xb310,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "lpebr", 4, {{RRE(0xb300,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "lpxbr", 4, {{RRE(0xb340,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "lpxr", 4, {{RRE(0xb360,0,0), 0}}, {{RRE_MASK, 0}}, IHX, {RRE_R1, RRE_R2} }, +{ "ltdbr", 4, {{RRE(0xb312,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "ltebr", 4, {{RRE(0xb302,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "ltxbr", 4, {{RRE(0xb342,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "ltxr", 4, {{RRE(0xb362,0,0), 0}}, {{RRE_MASK, 0}}, IHX, {RRE_R1, RRE_R2} }, +{ "lura", 4, {{RRE(0xb24b,0,0), 0}}, {{RRE_MASK, 0}}, IESA, {RRE_R1, RRE_R2} }, +{ "lxdr", 4, {{RRE(0xb325,0,0), 0}}, {{RRE_MASK, 0}}, IHX, {RRE_R1, RRE_R2} }, +{ "lxer", 4, {{RRE(0xb326,0,0), 0}}, {{RRE_MASK, 0}}, IHX, {RRE_R1, RRE_R2} }, +{ "lxr", 4, {{RRE(0xb365,0,0), 0}}, {{RRE_MASK, 0}}, IFX, {RRE_R1, RRE_R2} }, +{ "lzdr", 4, {{RRE(0xb375,0,0), 0}}, {{RRE_MASK, 0}}, IFX, {RRE_R1, RRE_R2} }, +{ "lzer", 4, {{RRE(0xb374,0,0), 0}}, {{RRE_MASK, 0}}, IFX, {RRE_R1, RRE_R2} }, +{ "lzxr", 4, {{RRE(0xb376,0,0), 0}}, {{RRE_MASK, 0}}, IFX, {RRE_R1, RRE_R2} }, +{ "mdbr", 4, {{RRE(0xb31c,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "mdebr", 4, {{RRE(0xb30c,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "meebr", 4, {{RRE(0xb317,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "meer", 4, {{RRE(0xb337,0,0), 0}}, {{RRE_MASK, 0}}, IHX, {RRE_R1, RRE_R2} }, +{ "msr", 4, {{RRE(0xb252,0,0), 0}}, {{RRE_MASK, 0}}, IIR, {RRE_R1, RRE_R2} }, +{ "msta", 4, {{RRE(0xb247,0,0), 0}}, {{RRE_MASK, 0}}, IESA, {RRE_R1} }, +{ "mvpg", 4, {{RRE(0xb254,0,0), 0}}, {{RRE_MASK, 0}}, IESA, {RRE_R1, RRE_R2} }, +{ "mvst", 4, {{RRE(0xb255,0,0), 0}}, {{RRE_MASK, 0}}, ISR, {RRE_R1, RRE_R2} }, +{ "mxbr", 4, {{RRE(0xb34c,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "mxdbr", 4, {{RRE(0xb307,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "palb", 4, {{RRE(0xb248,0,0), 0}}, {{RRE_MASK, 0}}, IESA, {0} }, +{ "prbe", 4, {{RRE(0xb22a,0,0), 0}}, {{RRE_MASK, 0}}, I370, {RRE_R1, RRE_R2} }, +{ "pt", 4, {{RRE(0xb228,0,0), 0}}, {{RRE_MASK, 0}}, IXA, {RRE_R1, RRE_R2} }, +{ "rrbe", 4, {{RRE(0xb22a,0,0), 0}}, {{RRE_MASK, 0}}, IXA, {RRE_R1, RRE_R2} }, +{ "sar", 4, {{RRE(0xb24e,0,0), 0}}, {{RRE_MASK, 0}}, IESA, {RRE_R1, RRE_R2} }, +{ "sdbr", 4, {{RRE(0xb31b,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "sebr", 4, {{RRE(0xb30b,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "servc", 4, {{RRE(0xb220,0,0), 0}}, {{RRE_MASK, 0}}, IESA, {RRE_R1, RRE_R2} }, +{ "sfpc", 4, {{RRE(0xb384,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "sqdbr", 4, {{RRE(0xb315,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "sqdr", 4, {{RRE(0xb244,0,0), 0}}, {{RRE_MASK, 0}}, IQR, {RRE_R1, RRE_R2} }, +{ "sqebr", 4, {{RRE(0xb314,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "sqer", 4, {{RRE(0xb245,0,0), 0}}, {{RRE_MASK, 0}}, IQR, {RRE_R1, RRE_R2} }, +{ "sqxbr", 4, {{RRE(0xb316,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "sqxr", 4, {{RRE(0xb336,0,0), 0}}, {{RRE_MASK, 0}}, IHX, {RRE_R1, RRE_R2} }, +{ "srst", 4, {{RRE(0xb25e,0,0), 0}}, {{RRE_MASK, 0}}, ISR, {RRE_R1, RRE_R2} }, +{ "ssar", 4, {{RRE(0xb225,0,0), 0}}, {{RRE_MASK, 0}}, IXA, {RRE_R1} }, +{ "sske", 4, {{RRE(0xb22b,0,0), 0}}, {{RRE_MASK, 0}}, IXA, {RRE_R1, RRE_R2} }, +{ "stura", 4, {{RRE(0xb246,0,0), 0}}, {{RRE_MASK, 0}}, IESA, {RRE_R1, RRE_R2} }, +{ "sxbr", 4, {{RRE(0xb34b,0,0), 0}}, {{RRE_MASK, 0}}, IBF, {RRE_R1, RRE_R2} }, +{ "tar", 4, {{RRE(0xb24c,0,0), 0}}, {{RRE_MASK, 0}}, IESA, {RRE_R1, RRE_R2} }, +{ "tb", 4, {{RRE(0xb22c,0,0), 0}}, {{RRE_MASK, 0}}, IXA, {RRE_R1, RRE_R2} }, +{ "thdr", 4, {{RRE(0xb359,0,0), 0}}, {{RRE_MASK, 0}}, IFX, {RRE_R1, RRE_R2} }, +{ "thder", 4, {{RRE(0xb359,0,0), 0}}, {{RRE_MASK, 0}}, IFX, {RRE_R1, RRE_R2} }, /* RRF form instructions */ -{ "cfdbr", 4, {RRF(0xb399,0,0,0), 0}, {RRF_MASK, 0}, IBF, {RRF_R1, RRF_R3, RRF_R2} }, -{ "cfdr", 4, {RRF(0xb3b9,0,0,0), 0}, {RRF_MASK, 0}, IHX, {RRF_R1, RRF_R3, RRF_R2} }, -{ "cfebr", 4, {RRF(0xb398,0,0,0), 0}, {RRF_MASK, 0}, IBF, {RRF_R1, RRF_R3, RRF_R2} }, -{ "cfer", 4, {RRF(0xb3b8,0,0,0), 0}, {RRF_MASK, 0}, IHX, {RRF_R1, RRF_R3, RRF_R2} }, -{ "cfxbr", 4, {RRF(0xb39a,0,0,0), 0}, {RRF_MASK, 0}, IBF, {RRF_R1, RRF_R3, RRF_R2} }, -{ "cfxr", 4, {RRF(0xb3ba,0,0,0), 0}, {RRF_MASK, 0}, IHX, {RRF_R1, RRF_R3, RRF_R2} }, -{ "didbr", 4, {RRF(0xb35b,0,0,0), 0}, {RRF_MASK, 0}, IBF, {RRF_R1, RRF_R3, RRF_R2} }, -{ "diebr", 4, {RRF(0xb353,0,0,0), 0}, {RRF_MASK, 0}, IBF, {RRF_R1, RRF_R3, RRF_R2} }, -{ "fidbr", 4, {RRF(0xb35f,0,0,0), 0}, {RRF_MASK, 0}, IBF, {RRF_R1, RRF_R3, RRF_R2} }, -{ "fiebr", 4, {RRF(0xb357,0,0,0), 0}, {RRF_MASK, 0}, IBF, {RRF_R1, RRF_R3, RRF_R2} }, -{ "fixbr", 4, {RRF(0xb347,0,0,0), 0}, {RRF_MASK, 0}, IBF, {RRF_R1, RRF_R3, RRF_R2} }, -{ "madbr", 4, {RRF(0xb31e,0,0,0), 0}, {RRF_MASK, 0}, IBF, {RRF_R1, RRF_R3, RRF_R2} }, -{ "maebr", 4, {RRF(0xb30e,0,0,0), 0}, {RRF_MASK, 0}, IBF, {RRF_R1, RRF_R3, RRF_R2} }, -{ "msdbr", 4, {RRF(0xb31f,0,0,0), 0}, {RRF_MASK, 0}, IBF, {RRF_R1, RRF_R3, RRF_R2} }, -{ "msebr", 4, {RRF(0xb30f,0,0,0), 0}, {RRF_MASK, 0}, IBF, {RRF_R1, RRF_R3, RRF_R2} }, -{ "tbdr", 4, {RRF(0xb351,0,0,0), 0}, {RRF_MASK, 0}, IFX, {RRF_R1, RRF_R3, RRF_R2} }, -{ "tbedr", 4, {RRF(0xb350,0,0,0), 0}, {RRF_MASK, 0}, IFX, {RRF_R1, RRF_R3, RRF_R2} }, +{ "cfdbr", 4, {{RRF(0xb399,0,0,0), 0}}, {{RRF_MASK, 0}}, IBF, {RRF_R1, RRF_R3, RRF_R2} }, +{ "cfdr", 4, {{RRF(0xb3b9,0,0,0), 0}}, {{RRF_MASK, 0}}, IHX, {RRF_R1, RRF_R3, RRF_R2} }, +{ "cfebr", 4, {{RRF(0xb398,0,0,0), 0}}, {{RRF_MASK, 0}}, IBF, {RRF_R1, RRF_R3, RRF_R2} }, +{ "cfer", 4, {{RRF(0xb3b8,0,0,0), 0}}, {{RRF_MASK, 0}}, IHX, {RRF_R1, RRF_R3, RRF_R2} }, +{ "cfxbr", 4, {{RRF(0xb39a,0,0,0), 0}}, {{RRF_MASK, 0}}, IBF, {RRF_R1, RRF_R3, RRF_R2} }, +{ "cfxr", 4, {{RRF(0xb3ba,0,0,0), 0}}, {{RRF_MASK, 0}}, IHX, {RRF_R1, RRF_R3, RRF_R2} }, +{ "didbr", 4, {{RRF(0xb35b,0,0,0), 0}}, {{RRF_MASK, 0}}, IBF, {RRF_R1, RRF_R3, RRF_R2} }, +{ "diebr", 4, {{RRF(0xb353,0,0,0), 0}}, {{RRF_MASK, 0}}, IBF, {RRF_R1, RRF_R3, RRF_R2} }, +{ "fidbr", 4, {{RRF(0xb35f,0,0,0), 0}}, {{RRF_MASK, 0}}, IBF, {RRF_R1, RRF_R3, RRF_R2} }, +{ "fiebr", 4, {{RRF(0xb357,0,0,0), 0}}, {{RRF_MASK, 0}}, IBF, {RRF_R1, RRF_R3, RRF_R2} }, +{ "fixbr", 4, {{RRF(0xb347,0,0,0), 0}}, {{RRF_MASK, 0}}, IBF, {RRF_R1, RRF_R3, RRF_R2} }, +{ "madbr", 4, {{RRF(0xb31e,0,0,0), 0}}, {{RRF_MASK, 0}}, IBF, {RRF_R1, RRF_R3, RRF_R2} }, +{ "maebr", 4, {{RRF(0xb30e,0,0,0), 0}}, {{RRF_MASK, 0}}, IBF, {RRF_R1, RRF_R3, RRF_R2} }, +{ "msdbr", 4, {{RRF(0xb31f,0,0,0), 0}}, {{RRF_MASK, 0}}, IBF, {RRF_R1, RRF_R3, RRF_R2} }, +{ "msebr", 4, {{RRF(0xb30f,0,0,0), 0}}, {{RRF_MASK, 0}}, IBF, {RRF_R1, RRF_R3, RRF_R2} }, +{ "tbdr", 4, {{RRF(0xb351,0,0,0), 0}}, {{RRF_MASK, 0}}, IFX, {RRF_R1, RRF_R3, RRF_R2} }, +{ "tbedr", 4, {{RRF(0xb350,0,0,0), 0}}, {{RRF_MASK, 0}}, IFX, {RRF_R1, RRF_R3, RRF_R2} }, /* RX form instructions */ -{ "a", 4, {RX(0x5a,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "ad", 4, {RX(0x6a,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "ae", 4, {RX(0x7a,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "ah", 4, {RX(0x4a,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "al", 4, {RX(0x5e,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "au", 4, {RX(0x7e,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "aw", 4, {RX(0x6e,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "bal", 4, {RX(0x45,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "bas", 4, {RX(0x4d,0,0,0,0), 0}, {RX_MASK, 0}, IXA, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "bc", 4, {RX(0x47,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "bct", 4, {RX(0x46,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "c", 4, {RX(0x59,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "cd", 4, {RX(0x69,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "ce", 4, {RX(0x79,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "ch", 4, {RX(0x49,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "cl", 4, {RX(0x55,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "cvb", 4, {RX(0x4f,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "cvd", 4, {RX(0x4e,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "d", 4, {RX(0x5d,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "dd", 4, {RX(0x6d,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "de", 4, {RX(0x7d,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "ex", 4, {RX(0x44,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "ic", 4, {RX(0x43,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "l", 4, {RX(0x58,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "la", 4, {RX(0x41,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "lae", 4, {RX(0x51,0,0,0,0), 0}, {RX_MASK, 0}, IESA, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "ld", 4, {RX(0x68,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "le", 4, {RX(0x78,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "lh", 4, {RX(0x48,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "lra", 4, {RX(0xb1,0,0,0,0), 0}, {RX_MASK, 0}, IXA, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "m", 4, {RX(0x5c,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "md", 4, {RX(0x6c,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "me", 4, {RX(0x7c,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "mh", 4, {RX(0x4c,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "ms", 4, {RX(0x71,0,0,0,0), 0}, {RX_MASK, 0}, IIR, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "mxd", 4, {RX(0x67,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "n", 4, {RX(0x54,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "o", 4, {RX(0x56,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "s", 4, {RX(0x5b,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "sd", 4, {RX(0x6b,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "se", 4, {RX(0x7b,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "sh", 4, {RX(0x4b,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "sl", 4, {RX(0x5f,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "st", 4, {RX(0x50,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "stc", 4, {RX(0x42,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "std", 4, {RX(0x60,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "ste", 4, {RX(0x70,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "sth", 4, {RX(0x40,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "su", 4, {RX(0x7f,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "sw", 4, {RX(0x6f,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "x", 4, {RX(0x57,0,0,0,0), 0}, {RX_MASK, 0}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "a", 4, {{RX(0x5a,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "ad", 4, {{RX(0x6a,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "ae", 4, {{RX(0x7a,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "ah", 4, {{RX(0x4a,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "al", 4, {{RX(0x5e,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "au", 4, {{RX(0x7e,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "aw", 4, {{RX(0x6e,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "bal", 4, {{RX(0x45,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "bas", 4, {{RX(0x4d,0,0,0,0), 0}}, {{RX_MASK, 0}}, IXA, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "bc", 4, {{RX(0x47,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "bct", 4, {{RX(0x46,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "c", 4, {{RX(0x59,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "cd", 4, {{RX(0x69,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "ce", 4, {{RX(0x79,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "ch", 4, {{RX(0x49,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "cl", 4, {{RX(0x55,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "cvb", 4, {{RX(0x4f,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "cvd", 4, {{RX(0x4e,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "d", 4, {{RX(0x5d,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "dd", 4, {{RX(0x6d,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "de", 4, {{RX(0x7d,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "ex", 4, {{RX(0x44,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "ic", 4, {{RX(0x43,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "l", 4, {{RX(0x58,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "la", 4, {{RX(0x41,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "lae", 4, {{RX(0x51,0,0,0,0), 0}}, {{RX_MASK, 0}}, IESA, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "ld", 4, {{RX(0x68,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "le", 4, {{RX(0x78,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "lh", 4, {{RX(0x48,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "lra", 4, {{RX(0xb1,0,0,0,0), 0}}, {{RX_MASK, 0}}, IXA, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "m", 4, {{RX(0x5c,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "md", 4, {{RX(0x6c,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "me", 4, {{RX(0x7c,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "mh", 4, {{RX(0x4c,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "ms", 4, {{RX(0x71,0,0,0,0), 0}}, {{RX_MASK, 0}}, IIR, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "mxd", 4, {{RX(0x67,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "n", 4, {{RX(0x54,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "o", 4, {{RX(0x56,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "s", 4, {{RX(0x5b,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "sd", 4, {{RX(0x6b,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "se", 4, {{RX(0x7b,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "sh", 4, {{RX(0x4b,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "sl", 4, {{RX(0x5f,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "st", 4, {{RX(0x50,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "stc", 4, {{RX(0x42,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "std", 4, {{RX(0x60,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "ste", 4, {{RX(0x70,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "sth", 4, {{RX(0x40,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "su", 4, {{RX(0x7f,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "sw", 4, {{RX(0x6f,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "x", 4, {{RX(0x57,0,0,0,0), 0}}, {{RX_MASK, 0}}, I370, {RX_R1, RX_D2, RX_X2, RX_B2} }, /* RXE form instructions */ -{ "adb", 6, {RXEH(0xed,0,0,0,0), RXEL(0x1a)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "aeb", 6, {RXEH(0xed,0,0,0,0), RXEL(0x0a)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "cdb", 6, {RXEH(0xed,0,0,0,0), RXEL(0x19)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "ceb", 6, {RXEH(0xed,0,0,0,0), RXEL(0x09)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "ddb", 6, {RXEH(0xed,0,0,0,0), RXEL(0x1d)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "deb", 6, {RXEH(0xed,0,0,0,0), RXEL(0x0d)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "kdb", 6, {RXEH(0xed,0,0,0,0), RXEL(0x18)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "keb", 6, {RXEH(0xed,0,0,0,0), RXEL(0x08)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "lde", 6, {RXEH(0xed,0,0,0,0), RXEL(0x24)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "ldeb", 6, {RXEH(0xed,0,0,0,0), RXEL(0x04)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "lxd", 6, {RXEH(0xed,0,0,0,0), RXEL(0x25)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "lxdb", 6, {RXEH(0xed,0,0,0,0), RXEL(0x05)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "lxe", 6, {RXEH(0xed,0,0,0,0), RXEL(0x26)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "lxeb", 6, {RXEH(0xed,0,0,0,0), RXEL(0x06)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "mdb", 6, {RXEH(0xed,0,0,0,0), RXEL(0x1c)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "mdeb", 6, {RXEH(0xed,0,0,0,0), RXEL(0x0c)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "mee", 6, {RXEH(0xed,0,0,0,0), RXEL(0x37)}, {RXEH_MASK, RXEL_MASK}, IHX, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "meeb", 6, {RXEH(0xed,0,0,0,0), RXEL(0x17)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "mxdb", 6, {RXEH(0xed,0,0,0,0), RXEL(0x07)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "sqd", 6, {RXEH(0xed,0,0,0,0), RXEL(0x35)}, {RXEH_MASK, RXEL_MASK}, IHX, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "sqdb", 6, {RXEH(0xed,0,0,0,0), RXEL(0x15)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "sqe", 6, {RXEH(0xed,0,0,0,0), RXEL(0x34)}, {RXEH_MASK, RXEL_MASK}, IHX, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "sqeb", 6, {RXEH(0xed,0,0,0,0), RXEL(0x14)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "sdb", 6, {RXEH(0xed,0,0,0,0), RXEL(0x1b)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "seb", 6, {RXEH(0xed,0,0,0,0), RXEL(0x0b)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "tcdb", 6, {RXEH(0xed,0,0,0,0), RXEL(0x11)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "tceb", 6, {RXEH(0xed,0,0,0,0), RXEL(0x10)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, -{ "tcxb", 6, {RXEH(0xed,0,0,0,0), RXEL(0x12)}, {RXEH_MASK, RXEL_MASK}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "adb", 6, {{RXEH(0xed,0,0,0,0), RXEL(0x1a)}}, {{RXEH_MASK, RXEL_MASK}}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "aeb", 6, {{RXEH(0xed,0,0,0,0), RXEL(0x0a)}}, {{RXEH_MASK, RXEL_MASK}}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "cdb", 6, {{RXEH(0xed,0,0,0,0), RXEL(0x19)}}, {{RXEH_MASK, RXEL_MASK}}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "ceb", 6, {{RXEH(0xed,0,0,0,0), RXEL(0x09)}}, {{RXEH_MASK, RXEL_MASK}}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "ddb", 6, {{RXEH(0xed,0,0,0,0), RXEL(0x1d)}}, {{RXEH_MASK, RXEL_MASK}}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "deb", 6, {{RXEH(0xed,0,0,0,0), RXEL(0x0d)}}, {{RXEH_MASK, RXEL_MASK}}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "kdb", 6, {{RXEH(0xed,0,0,0,0), RXEL(0x18)}}, {{RXEH_MASK, RXEL_MASK}}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "keb", 6, {{RXEH(0xed,0,0,0,0), RXEL(0x08)}}, {{RXEH_MASK, RXEL_MASK}}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "lde", 6, {{RXEH(0xed,0,0,0,0), RXEL(0x24)}}, {{RXEH_MASK, RXEL_MASK}}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "ldeb", 6, {{RXEH(0xed,0,0,0,0), RXEL(0x04)}}, {{RXEH_MASK, RXEL_MASK}}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "lxd", 6, {{RXEH(0xed,0,0,0,0), RXEL(0x25)}}, {{RXEH_MASK, RXEL_MASK}}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "lxdb", 6, {{RXEH(0xed,0,0,0,0), RXEL(0x05)}}, {{RXEH_MASK, RXEL_MASK}}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "lxe", 6, {{RXEH(0xed,0,0,0,0), RXEL(0x26)}}, {{RXEH_MASK, RXEL_MASK}}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "lxeb", 6, {{RXEH(0xed,0,0,0,0), RXEL(0x06)}}, {{RXEH_MASK, RXEL_MASK}}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "mdb", 6, {{RXEH(0xed,0,0,0,0), RXEL(0x1c)}}, {{RXEH_MASK, RXEL_MASK}}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "mdeb", 6, {{RXEH(0xed,0,0,0,0), RXEL(0x0c)}}, {{RXEH_MASK, RXEL_MASK}}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "mee", 6, {{RXEH(0xed,0,0,0,0), RXEL(0x37)}}, {{RXEH_MASK, RXEL_MASK}}, IHX, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "meeb", 6, {{RXEH(0xed,0,0,0,0), RXEL(0x17)}}, {{RXEH_MASK, RXEL_MASK}}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "mxdb", 6, {{RXEH(0xed,0,0,0,0), RXEL(0x07)}}, {{RXEH_MASK, RXEL_MASK}}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "sqd", 6, {{RXEH(0xed,0,0,0,0), RXEL(0x35)}}, {{RXEH_MASK, RXEL_MASK}}, IHX, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "sqdb", 6, {{RXEH(0xed,0,0,0,0), RXEL(0x15)}}, {{RXEH_MASK, RXEL_MASK}}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "sqe", 6, {{RXEH(0xed,0,0,0,0), RXEL(0x34)}}, {{RXEH_MASK, RXEL_MASK}}, IHX, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "sqeb", 6, {{RXEH(0xed,0,0,0,0), RXEL(0x14)}}, {{RXEH_MASK, RXEL_MASK}}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "sdb", 6, {{RXEH(0xed,0,0,0,0), RXEL(0x1b)}}, {{RXEH_MASK, RXEL_MASK}}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "seb", 6, {{RXEH(0xed,0,0,0,0), RXEL(0x0b)}}, {{RXEH_MASK, RXEL_MASK}}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "tcdb", 6, {{RXEH(0xed,0,0,0,0), RXEL(0x11)}}, {{RXEH_MASK, RXEL_MASK}}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "tceb", 6, {{RXEH(0xed,0,0,0,0), RXEL(0x10)}}, {{RXEH_MASK, RXEL_MASK}}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, +{ "tcxb", 6, {{RXEH(0xed,0,0,0,0), RXEL(0x12)}}, {{RXEH_MASK, RXEL_MASK}}, IBF, {RX_R1, RX_D2, RX_X2, RX_B2} }, /* RXF form instructions */ -{ "madb", 6, {RXFH(0xed,0,0,0,0), RXFL(0x1e,0)}, {RXFH_MASK, RXFL_MASK}, IBF, {RX_R1, RXF_R3, RX_D2, RX_X2, RX_B2} }, -{ "maeb", 6, {RXFH(0xed,0,0,0,0), RXFL(0x0e,0)}, {RXFH_MASK, RXFL_MASK}, IBF, {RX_R1, RXF_R3, RX_D2, RX_X2, RX_B2} }, -{ "msdb", 6, {RXFH(0xed,0,0,0,0), RXFL(0x1f,0)}, {RXFH_MASK, RXFL_MASK}, IBF, {RX_R1, RXF_R3, RX_D2, RX_X2, RX_B2} }, -{ "mseb", 6, {RXFH(0xed,0,0,0,0), RXFL(0x0f,0)}, {RXFH_MASK, RXFL_MASK}, IBF, {RX_R1, RXF_R3, RX_D2, RX_X2, RX_B2} }, +{ "madb", 6, {{RXFH(0xed,0,0,0,0), RXFL(0x1e,0)}}, {{RXFH_MASK, RXFL_MASK}}, IBF, {RX_R1, RXF_R3, RX_D2, RX_X2, RX_B2} }, +{ "maeb", 6, {{RXFH(0xed,0,0,0,0), RXFL(0x0e,0)}}, {{RXFH_MASK, RXFL_MASK}}, IBF, {RX_R1, RXF_R3, RX_D2, RX_X2, RX_B2} }, +{ "msdb", 6, {{RXFH(0xed,0,0,0,0), RXFL(0x1f,0)}}, {{RXFH_MASK, RXFL_MASK}}, IBF, {RX_R1, RXF_R3, RX_D2, RX_X2, RX_B2} }, +{ "mseb", 6, {{RXFH(0xed,0,0,0,0), RXFL(0x0f,0)}}, {{RXFH_MASK, RXFL_MASK}}, IBF, {RX_R1, RXF_R3, RX_D2, RX_X2, RX_B2} }, /* RS form instructions */ -{ "bxh", 4, {RS(0x86,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_R3, RS_D2, RS_B2} }, -{ "bxle", 4, {RS(0x87,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_R3, RS_D2, RS_B2} }, -{ "cds", 4, {RS(0xbb,0,0,0,0), 0}, {RS_MASK, 0}, IXA, {RX_R1, RS_R3, RS_D2, RS_B2} }, -{ "clcle", 4, {RS(0xa9,0,0,0,0), 0}, {RS_MASK, 0}, ICM, {RX_R1, RS_R3, RS_D2, RS_B2} }, -{ "clm", 4, {RS(0xbd,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_R3, RS_D2, RS_B2} }, -{ "cs", 4, {RS(0xba,0,0,0,0), 0}, {RS_MASK, 0}, IXA, {RX_R1, RS_R3, RS_D2, RS_B2} }, -{ "icm", 4, {RS(0xbf,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_R3, RS_D2, RS_B2} }, -{ "lam", 4, {RS(0x9a,0,0,0,0), 0}, {RS_MASK, 0}, IESA, {RX_R1, RS_R3, RS_D2, RS_B2} }, -{ "lctl", 4, {RS(0xb7,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_R3, RS_D2, RS_B2} }, -{ "lm", 4, {RS(0x98,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_R3, RS_D2, RS_B2} }, -{ "mvcle", 4, {RS(0xa8,0,0,0,0), 0}, {RS_MASK, 0}, ICM, {RX_R1, RS_R3, RS_D2, RS_B2} }, -{ "sigp", 4, {RS(0xae,0,0,0,0), 0}, {RS_MASK, 0}, IXA, {RX_R1, RS_R3, RS_D2, RS_B2} }, -{ "stam", 4, {RS(0x9b,0,0,0,0), 0}, {RS_MASK, 0}, IESA, {RX_R1, RS_R3, RS_D2, RS_B2} }, -{ "stcm", 4, {RS(0xbe,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_R3, RS_D2, RS_B2} }, -{ "stctl", 4, {RS(0xb6,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_R3, RS_D2, RS_B2} }, -{ "stm", 4, {RS(0x90,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_R3, RS_D2, RS_B2} }, -{ "trace", 4, {RS(0x99,0,0,0,0), 0}, {RS_MASK, 0}, IXA, {RX_R1, RS_R3, RS_D2, RS_B2} }, +{ "bxh", 4, {{RS(0x86,0,0,0,0), 0}}, {{RS_MASK, 0}}, I370, {RX_R1, RS_R3, RS_D2, RS_B2} }, +{ "bxle", 4, {{RS(0x87,0,0,0,0), 0}}, {{RS_MASK, 0}}, I370, {RX_R1, RS_R3, RS_D2, RS_B2} }, +{ "cds", 4, {{RS(0xbb,0,0,0,0), 0}}, {{RS_MASK, 0}}, IXA, {RX_R1, RS_R3, RS_D2, RS_B2} }, +{ "clcle", 4, {{RS(0xa9,0,0,0,0), 0}}, {{RS_MASK, 0}}, ICM, {RX_R1, RS_R3, RS_D2, RS_B2} }, +{ "clm", 4, {{RS(0xbd,0,0,0,0), 0}}, {{RS_MASK, 0}}, I370, {RX_R1, RS_R3, RS_D2, RS_B2} }, +{ "cs", 4, {{RS(0xba,0,0,0,0), 0}}, {{RS_MASK, 0}}, IXA, {RX_R1, RS_R3, RS_D2, RS_B2} }, +{ "icm", 4, {{RS(0xbf,0,0,0,0), 0}}, {{RS_MASK, 0}}, I370, {RX_R1, RS_R3, RS_D2, RS_B2} }, +{ "lam", 4, {{RS(0x9a,0,0,0,0), 0}}, {{RS_MASK, 0}}, IESA, {RX_R1, RS_R3, RS_D2, RS_B2} }, +{ "lctl", 4, {{RS(0xb7,0,0,0,0), 0}}, {{RS_MASK, 0}}, I370, {RX_R1, RS_R3, RS_D2, RS_B2} }, +{ "lm", 4, {{RS(0x98,0,0,0,0), 0}}, {{RS_MASK, 0}}, I370, {RX_R1, RS_R3, RS_D2, RS_B2} }, +{ "mvcle", 4, {{RS(0xa8,0,0,0,0), 0}}, {{RS_MASK, 0}}, ICM, {RX_R1, RS_R3, RS_D2, RS_B2} }, +{ "sigp", 4, {{RS(0xae,0,0,0,0), 0}}, {{RS_MASK, 0}}, IXA, {RX_R1, RS_R3, RS_D2, RS_B2} }, +{ "stam", 4, {{RS(0x9b,0,0,0,0), 0}}, {{RS_MASK, 0}}, IESA, {RX_R1, RS_R3, RS_D2, RS_B2} }, +{ "stcm", 4, {{RS(0xbe,0,0,0,0), 0}}, {{RS_MASK, 0}}, I370, {RX_R1, RS_R3, RS_D2, RS_B2} }, +{ "stctl", 4, {{RS(0xb6,0,0,0,0), 0}}, {{RS_MASK, 0}}, I370, {RX_R1, RS_R3, RS_D2, RS_B2} }, +{ "stm", 4, {{RS(0x90,0,0,0,0), 0}}, {{RS_MASK, 0}}, I370, {RX_R1, RS_R3, RS_D2, RS_B2} }, +{ "trace", 4, {{RS(0x99,0,0,0,0), 0}}, {{RS_MASK, 0}}, IXA, {RX_R1, RS_R3, RS_D2, RS_B2} }, /* RS form instructions with blank R3 and optional B2 (shift left/right) */ -{ "sla", 4, {RS(0x8b,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_D2, RS_B2_OPT} }, -{ "slda", 4, {RS(0x8f,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_D2, RS_B2_OPT} }, -{ "sldl", 4, {RS(0x8d,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_D2, RS_B2_OPT} }, -{ "sll", 4, {RS(0x89,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_D2, RS_B2_OPT} }, -{ "sra", 4, {RS(0x8a,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_D2, RS_B2_OPT} }, -{ "srda", 4, {RS(0x8e,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_D2, RS_B2_OPT} }, -{ "srdl", 4, {RS(0x8c,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_D2, RS_B2_OPT} }, -{ "srl", 4, {RS(0x88,0,0,0,0), 0}, {RS_MASK, 0}, I370, {RX_R1, RS_D2, RS_B2_OPT} }, +{ "sla", 4, {{RS(0x8b,0,0,0,0), 0}}, {{RS_MASK, 0}}, I370, {RX_R1, RS_D2, RS_B2_OPT} }, +{ "slda", 4, {{RS(0x8f,0,0,0,0), 0}}, {{RS_MASK, 0}}, I370, {RX_R1, RS_D2, RS_B2_OPT} }, +{ "sldl", 4, {{RS(0x8d,0,0,0,0), 0}}, {{RS_MASK, 0}}, I370, {RX_R1, RS_D2, RS_B2_OPT} }, +{ "sll", 4, {{RS(0x89,0,0,0,0), 0}}, {{RS_MASK, 0}}, I370, {RX_R1, RS_D2, RS_B2_OPT} }, +{ "sra", 4, {{RS(0x8a,0,0,0,0), 0}}, {{RS_MASK, 0}}, I370, {RX_R1, RS_D2, RS_B2_OPT} }, +{ "srda", 4, {{RS(0x8e,0,0,0,0), 0}}, {{RS_MASK, 0}}, I370, {RX_R1, RS_D2, RS_B2_OPT} }, +{ "srdl", 4, {{RS(0x8c,0,0,0,0), 0}}, {{RS_MASK, 0}}, I370, {RX_R1, RS_D2, RS_B2_OPT} }, +{ "srl", 4, {{RS(0x88,0,0,0,0), 0}}, {{RS_MASK, 0}}, I370, {RX_R1, RS_D2, RS_B2_OPT} }, /* RSI form instructions */ -{ "brxh", 4, {RSI(0x84,0,0,0), 0}, {RSI_MASK, 0}, IIR, {RSI_R1, RSI_R3, RSI_I2} }, -{ "brxle", 4, {RSI(0x85,0,0,0), 0}, {RSI_MASK, 0}, IIR, {RSI_R1, RSI_R3, RSI_I2} }, +{ "brxh", 4, {{RSI(0x84,0,0,0), 0}}, {{RSI_MASK, 0}}, IIR, {RSI_R1, RSI_R3, RSI_I2} }, +{ "brxle", 4, {{RSI(0x85,0,0,0), 0}}, {{RSI_MASK, 0}}, IIR, {RSI_R1, RSI_R3, RSI_I2} }, /* RI form instructions */ -{ "ahi", 4, {RI(0xa7a,0,0), 0}, {RI_MASK, 0}, IIR, {RI_R1, RI_I2} }, -{ "bras", 4, {RI(0xa75,0,0), 0}, {RI_MASK, 0}, IIR, {RI_R1, RI_I2} }, -{ "brc", 4, {RI(0xa74,0,0), 0}, {RI_MASK, 0}, IIR, {RI_R1, RI_I2} }, -{ "brct", 4, {RI(0xa76,0,0), 0}, {RI_MASK, 0}, IIR, {RI_R1, RI_I2} }, -{ "chi", 4, {RI(0xa7e,0,0), 0}, {RI_MASK, 0}, IIR, {RI_R1, RI_I2} }, -{ "lhi", 4, {RI(0xa78,0,0), 0}, {RI_MASK, 0}, IIR, {RI_R1, RI_I2} }, -{ "mhi", 4, {RI(0xa7c,0,0), 0}, {RI_MASK, 0}, IIR, {RI_R1, RI_I2} }, -{ "tmh", 4, {RI(0xa70,0,0), 0}, {RI_MASK, 0}, IIR, {RI_R1, RI_I2} }, -{ "tml", 4, {RI(0xa71,0,0), 0}, {RI_MASK, 0}, IIR, {RI_R1, RI_I2} }, +{ "ahi", 4, {{RI(0xa7a,0,0), 0}}, {{RI_MASK, 0}}, IIR, {RI_R1, RI_I2} }, +{ "bras", 4, {{RI(0xa75,0,0), 0}}, {{RI_MASK, 0}}, IIR, {RI_R1, RI_I2} }, +{ "brc", 4, {{RI(0xa74,0,0), 0}}, {{RI_MASK, 0}}, IIR, {RI_R1, RI_I2} }, +{ "brct", 4, {{RI(0xa76,0,0), 0}}, {{RI_MASK, 0}}, IIR, {RI_R1, RI_I2} }, +{ "chi", 4, {{RI(0xa7e,0,0), 0}}, {{RI_MASK, 0}}, IIR, {RI_R1, RI_I2} }, +{ "lhi", 4, {{RI(0xa78,0,0), 0}}, {{RI_MASK, 0}}, IIR, {RI_R1, RI_I2} }, +{ "mhi", 4, {{RI(0xa7c,0,0), 0}}, {{RI_MASK, 0}}, IIR, {RI_R1, RI_I2} }, +{ "tmh", 4, {{RI(0xa70,0,0), 0}}, {{RI_MASK, 0}}, IIR, {RI_R1, RI_I2} }, +{ "tml", 4, {{RI(0xa71,0,0), 0}}, {{RI_MASK, 0}}, IIR, {RI_R1, RI_I2} }, /* SI form instructions */ -{ "cli", 4, {SI(0x95,0,0,0), 0}, {SI_MASK, 0}, I370, {SI_D1, SI_B1, SI_I2} }, -{ "mc", 4, {SI(0xaf,0,0,0), 0}, {SI_MASK, 0}, I370, {SI_D1, SI_B1, SI_I2} }, -{ "mvi", 4, {SI(0x92,0,0,0), 0}, {SI_MASK, 0}, I370, {SI_D1, SI_B1, SI_I2} }, -{ "ni", 4, {SI(0x94,0,0,0), 0}, {SI_MASK, 0}, I370, {SI_D1, SI_B1, SI_I2} }, -{ "oi", 4, {SI(0x96,0,0,0), 0}, {SI_MASK, 0}, I370, {SI_D1, SI_B1, SI_I2} }, -{ "stnsm", 4, {SI(0xac,0,0,0), 0}, {SI_MASK, 0}, IXA, {SI_D1, SI_B1, SI_I2} }, -{ "stosm", 4, {SI(0xad,0,0,0), 0}, {SI_MASK, 0}, IXA, {SI_D1, SI_B1, SI_I2} }, -{ "tm", 4, {SI(0x91,0,0,0), 0}, {SI_MASK, 0}, I370, {SI_D1, SI_B1, SI_I2} }, -{ "xi", 4, {SI(0x97,0,0,0), 0}, {SI_MASK, 0}, I370, {SI_D1, SI_B1, SI_I2} }, +{ "cli", 4, {{SI(0x95,0,0,0), 0}}, {{SI_MASK, 0}}, I370, {SI_D1, SI_B1, SI_I2} }, +{ "mc", 4, {{SI(0xaf,0,0,0), 0}}, {{SI_MASK, 0}}, I370, {SI_D1, SI_B1, SI_I2} }, +{ "mvi", 4, {{SI(0x92,0,0,0), 0}}, {{SI_MASK, 0}}, I370, {SI_D1, SI_B1, SI_I2} }, +{ "ni", 4, {{SI(0x94,0,0,0), 0}}, {{SI_MASK, 0}}, I370, {SI_D1, SI_B1, SI_I2} }, +{ "oi", 4, {{SI(0x96,0,0,0), 0}}, {{SI_MASK, 0}}, I370, {SI_D1, SI_B1, SI_I2} }, +{ "stnsm", 4, {{SI(0xac,0,0,0), 0}}, {{SI_MASK, 0}}, IXA, {SI_D1, SI_B1, SI_I2} }, +{ "stosm", 4, {{SI(0xad,0,0,0), 0}}, {{SI_MASK, 0}}, IXA, {SI_D1, SI_B1, SI_I2} }, +{ "tm", 4, {{SI(0x91,0,0,0), 0}}, {{SI_MASK, 0}}, I370, {SI_D1, SI_B1, SI_I2} }, +{ "xi", 4, {{SI(0x97,0,0,0), 0}}, {{SI_MASK, 0}}, I370, {SI_D1, SI_B1, SI_I2} }, /* S form instructions */ -{ "cfc", 4, {S(0xb21a,0,0), 0}, {S_MASK, 0}, IXA, {S_D2, S_B2} }, -{ "csch", 4, {S(0xb230,0,0), 0}, {S_MASK, 0}, IXA, {0} }, -{ "hsch", 4, {S(0xb231,0,0), 0}, {S_MASK, 0}, IXA, {0} }, -{ "ipk", 4, {S(0xb20b,0,0), 0}, {S_MASK, 0}, IXA, {0} }, -{ "lfpc", 4, {S(0xb29d,0,0), 0}, {S_MASK, 0}, IBF, {S_D2, S_B2} }, -{ "lpsw", 4, {S(0x8200,0,0), 0}, {S_MASK, 0}, I370, {S_D2, S_B2} }, -{ "msch", 4, {S(0xb232,0,0), 0}, {S_MASK, 0}, IXA, {S_D2, S_B2} }, -{ "pc", 4, {S(0xb218,0,0), 0}, {S_MASK, 0}, IXA, {S_D2, S_B2} }, -{ "pcf", 4, {S(0xb218,0,0), 0}, {S_MASK, 0}, IPC, {S_D2, S_B2} }, -{ "ptlb", 4, {S(0xb20d,0,0), 0}, {S_MASK, 0}, IXA, {0} }, -{ "rchp", 4, {S(0xb23b,0,0), 0}, {S_MASK, 0}, IXA, {0} }, -{ "rp", 4, {S(0xb277,0,0), 0}, {S_MASK, 0}, IRP, {0} }, -{ "rsch", 4, {S(0xb238,0,0), 0}, {S_MASK, 0}, IXA, {0} }, -{ "sac", 4, {S(0xb219,0,0), 0}, {S_MASK, 0}, IXA, {S_D2, S_B2} }, -{ "sacf", 4, {S(0xb279,0,0), 0}, {S_MASK, 0}, ISA, {S_D2, S_B2} }, -{ "sal", 4, {S(0xb237,0,0), 0}, {S_MASK, 0}, IXA, {0} }, -{ "schm", 4, {S(0xb23c,0,0), 0}, {S_MASK, 0}, IXA, {0} }, -{ "sck", 4, {S(0xb204,0,0), 0}, {S_MASK, 0}, I370, {S_D2, S_B2} }, -{ "sckc", 4, {S(0xb206,0,0), 0}, {S_MASK, 0}, IXA, {S_D2, S_B2} }, -{ "spka", 4, {S(0xb20a,0,0), 0}, {S_MASK, 0}, IXA, {S_D2, S_B2} }, -{ "spt", 4, {S(0xb208,0,0), 0}, {S_MASK, 0}, IXA, {S_D2, S_B2} }, -{ "spx", 4, {S(0xb210,0,0), 0}, {S_MASK, 0}, IXA, {S_D2, S_B2} }, -{ "srnm", 4, {S(0xb299,0,0), 0}, {S_MASK, 0}, IBF, {S_D2, S_B2} }, -{ "ssch", 4, {S(0xb233,0,0), 0}, {S_MASK, 0}, IXA, {S_D2, S_B2} }, -{ "ssm", 4, {S(0x8000,0,0), 0}, {S_MASK, 0}, I370, {S_D2, S_B2} }, -{ "stap", 4, {S(0xb212,0,0), 0}, {S_MASK, 0}, IXA, {S_D2, S_B2} }, -{ "stck", 4, {S(0xb205,0,0), 0}, {S_MASK, 0}, IXA, {S_D2, S_B2} }, -{ "stckc", 4, {S(0xb207,0,0), 0}, {S_MASK, 0}, I370, {S_D2, S_B2} }, -{ "stcps", 4, {S(0xb23a,0,0), 0}, {S_MASK, 0}, IXA, {S_D2, S_B2} }, -{ "stcrw", 4, {S(0xb239,0,0), 0}, {S_MASK, 0}, IXA, {S_D2, S_B2} }, -{ "stfpc", 4, {S(0xb29c,0,0), 0}, {S_MASK, 0}, IBF, {S_D2, S_B2} }, -{ "stidp", 4, {S(0xb202,0,0), 0}, {S_MASK, 0}, I370, {S_D2, S_B2} }, -{ "stpt", 4, {S(0xb209,0,0), 0}, {S_MASK, 0}, IXA, {S_D2, S_B2} }, -{ "stpx", 4, {S(0xb211,0,0), 0}, {S_MASK, 0}, IXA, {S_D2, S_B2} }, -{ "stsch", 4, {S(0xb234,0,0), 0}, {S_MASK, 0}, IXA, {S_D2, S_B2} }, -{ "tpi", 4, {S(0xb236,0,0), 0}, {S_MASK, 0}, IXA, {S_D2, S_B2} }, -{ "trap4", 4, {S(0xb2ff,0,0), 0}, {S_MASK, 0}, ITR, {S_D2, S_B2} }, -{ "ts", 4, {S(0x9300,0,0), 0}, {S_MASK, 0}, I370, {S_D2, S_B2} }, -{ "tsch", 4, {S(0xb235,0,0), 0}, {S_MASK, 0}, IXA, {S_D2, S_B2} }, +{ "cfc", 4, {{S(0xb21a,0,0), 0}}, {{S_MASK, 0}}, IXA, {S_D2, S_B2} }, +{ "csch", 4, {{S(0xb230,0,0), 0}}, {{S_MASK, 0}}, IXA, {0} }, +{ "hsch", 4, {{S(0xb231,0,0), 0}}, {{S_MASK, 0}}, IXA, {0} }, +{ "ipk", 4, {{S(0xb20b,0,0), 0}}, {{S_MASK, 0}}, IXA, {0} }, +{ "lfpc", 4, {{S(0xb29d,0,0), 0}}, {{S_MASK, 0}}, IBF, {S_D2, S_B2} }, +{ "lpsw", 4, {{S(0x8200,0,0), 0}}, {{S_MASK, 0}}, I370, {S_D2, S_B2} }, +{ "msch", 4, {{S(0xb232,0,0), 0}}, {{S_MASK, 0}}, IXA, {S_D2, S_B2} }, +{ "pc", 4, {{S(0xb218,0,0), 0}}, {{S_MASK, 0}}, IXA, {S_D2, S_B2} }, +{ "pcf", 4, {{S(0xb218,0,0), 0}}, {{S_MASK, 0}}, IPC, {S_D2, S_B2} }, +{ "ptlb", 4, {{S(0xb20d,0,0), 0}}, {{S_MASK, 0}}, IXA, {0} }, +{ "rchp", 4, {{S(0xb23b,0,0), 0}}, {{S_MASK, 0}}, IXA, {0} }, +{ "rp", 4, {{S(0xb277,0,0), 0}}, {{S_MASK, 0}}, IRP, {0} }, +{ "rsch", 4, {{S(0xb238,0,0), 0}}, {{S_MASK, 0}}, IXA, {0} }, +{ "sac", 4, {{S(0xb219,0,0), 0}}, {{S_MASK, 0}}, IXA, {S_D2, S_B2} }, +{ "sacf", 4, {{S(0xb279,0,0), 0}}, {{S_MASK, 0}}, ISA, {S_D2, S_B2} }, +{ "sal", 4, {{S(0xb237,0,0), 0}}, {{S_MASK, 0}}, IXA, {0} }, +{ "schm", 4, {{S(0xb23c,0,0), 0}}, {{S_MASK, 0}}, IXA, {0} }, +{ "sck", 4, {{S(0xb204,0,0), 0}}, {{S_MASK, 0}}, I370, {S_D2, S_B2} }, +{ "sckc", 4, {{S(0xb206,0,0), 0}}, {{S_MASK, 0}}, IXA, {S_D2, S_B2} }, +{ "spka", 4, {{S(0xb20a,0,0), 0}}, {{S_MASK, 0}}, IXA, {S_D2, S_B2} }, +{ "spt", 4, {{S(0xb208,0,0), 0}}, {{S_MASK, 0}}, IXA, {S_D2, S_B2} }, +{ "spx", 4, {{S(0xb210,0,0), 0}}, {{S_MASK, 0}}, IXA, {S_D2, S_B2} }, +{ "srnm", 4, {{S(0xb299,0,0), 0}}, {{S_MASK, 0}}, IBF, {S_D2, S_B2} }, +{ "ssch", 4, {{S(0xb233,0,0), 0}}, {{S_MASK, 0}}, IXA, {S_D2, S_B2} }, +{ "ssm", 4, {{S(0x8000,0,0), 0}}, {{S_MASK, 0}}, I370, {S_D2, S_B2} }, +{ "stap", 4, {{S(0xb212,0,0), 0}}, {{S_MASK, 0}}, IXA, {S_D2, S_B2} }, +{ "stck", 4, {{S(0xb205,0,0), 0}}, {{S_MASK, 0}}, IXA, {S_D2, S_B2} }, +{ "stckc", 4, {{S(0xb207,0,0), 0}}, {{S_MASK, 0}}, I370, {S_D2, S_B2} }, +{ "stcps", 4, {{S(0xb23a,0,0), 0}}, {{S_MASK, 0}}, IXA, {S_D2, S_B2} }, +{ "stcrw", 4, {{S(0xb239,0,0), 0}}, {{S_MASK, 0}}, IXA, {S_D2, S_B2} }, +{ "stfpc", 4, {{S(0xb29c,0,0), 0}}, {{S_MASK, 0}}, IBF, {S_D2, S_B2} }, +{ "stidp", 4, {{S(0xb202,0,0), 0}}, {{S_MASK, 0}}, I370, {S_D2, S_B2} }, +{ "stpt", 4, {{S(0xb209,0,0), 0}}, {{S_MASK, 0}}, IXA, {S_D2, S_B2} }, +{ "stpx", 4, {{S(0xb211,0,0), 0}}, {{S_MASK, 0}}, IXA, {S_D2, S_B2} }, +{ "stsch", 4, {{S(0xb234,0,0), 0}}, {{S_MASK, 0}}, IXA, {S_D2, S_B2} }, +{ "tpi", 4, {{S(0xb236,0,0), 0}}, {{S_MASK, 0}}, IXA, {S_D2, S_B2} }, +{ "trap4", 4, {{S(0xb2ff,0,0), 0}}, {{S_MASK, 0}}, ITR, {S_D2, S_B2} }, +{ "ts", 4, {{S(0x9300,0,0), 0}}, {{S_MASK, 0}}, I370, {S_D2, S_B2} }, +{ "tsch", 4, {{S(0xb235,0,0), 0}}, {{S_MASK, 0}}, IXA, {S_D2, S_B2} }, /* SS form instructions */ -{ "ap", 6, {SSH(0xfa,0,0,0), 0}, {SS_MASK, 0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, -{ "clc", 6, {SSH(0xd5,0,0,0), 0}, {SS_MASK, 0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, -{ "cp", 6, {SSH(0xf9,0,0,0), 0}, {SS_MASK, 0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, -{ "dp", 6, {SSH(0xfd,0,0,0), 0}, {SS_MASK, 0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, -{ "ed", 6, {SSH(0xde,0,0,0), 0}, {SS_MASK, 0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, -{ "edmk", 6, {SSH(0xdf,0,0,0), 0}, {SS_MASK, 0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, -{ "mvc", 6, {SSH(0xd2,0,0,0), 0}, {SS_MASK, 0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, -{ "mvcin", 6, {SSH(0xe8,0,0,0), 0}, {SS_MASK, 0}, IMI, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, -{ "mvck", 6, {SSH(0xd9,0,0,0), 0}, {SS_MASK, 0}, IXA, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, -{ "mvcp", 6, {SSH(0xda,0,0,0), 0}, {SS_MASK, 0}, IXA, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, -{ "mvcs", 6, {SSH(0xdb,0,0,0), 0}, {SS_MASK, 0}, IXA, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, -{ "mvn", 6, {SSH(0xd1,0,0,0), 0}, {SS_MASK, 0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, -{ "mvo", 6, {SSH(0xf1,0,0,0), 0}, {SS_MASK, 0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, -{ "mvz", 6, {SSH(0xd3,0,0,0), 0}, {SS_MASK, 0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, -{ "nc", 6, {SSH(0xd4,0,0,0), 0}, {SS_MASK, 0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, -{ "oc", 6, {SSH(0xd6,0,0,0), 0}, {SS_MASK, 0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, -{ "pack", 6, {SSH(0xf2,0,0,0), 0}, {SS_MASK, 0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, -{ "plo", 6, {SSH(0xee,0,0,0), 0}, {SS_MASK, 0}, IPL, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, -{ "sp", 6, {SSH(0xfb,0,0,0), 0}, {SS_MASK, 0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, -{ "srp", 6, {SSH(0xf0,0,0,0), 0}, {SS_MASK, 0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, -{ "tr", 6, {SSH(0xdc,0,0,0), 0}, {SS_MASK, 0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, -{ "trt", 6, {SSH(0xdd,0,0,0), 0}, {SS_MASK, 0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, -{ "unpk", 6, {SSH(0xf3,0,0,0), 0}, {SS_MASK, 0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, -{ "xc", 6, {SSH(0xd7,0,0,0), 0}, {SS_MASK, 0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, -{ "zap", 6, {SSH(0xf8,0,0,0), 0}, {SS_MASK, 0}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, +{ "ap", 6, {{SSH(0xfa,0,0,0), 0}}, {{SS_MASK, 0}}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, +{ "clc", 6, {{SSH(0xd5,0,0,0), 0}}, {{SS_MASK, 0}}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, +{ "cp", 6, {{SSH(0xf9,0,0,0), 0}}, {{SS_MASK, 0}}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, +{ "dp", 6, {{SSH(0xfd,0,0,0), 0}}, {{SS_MASK, 0}}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, +{ "ed", 6, {{SSH(0xde,0,0,0), 0}}, {{SS_MASK, 0}}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, +{ "edmk", 6, {{SSH(0xdf,0,0,0), 0}}, {{SS_MASK, 0}}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, +{ "mvc", 6, {{SSH(0xd2,0,0,0), 0}}, {{SS_MASK, 0}}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, +{ "mvcin", 6, {{SSH(0xe8,0,0,0), 0}}, {{SS_MASK, 0}}, IMI, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, +{ "mvck", 6, {{SSH(0xd9,0,0,0), 0}}, {{SS_MASK, 0}}, IXA, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, +{ "mvcp", 6, {{SSH(0xda,0,0,0), 0}}, {{SS_MASK, 0}}, IXA, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, +{ "mvcs", 6, {{SSH(0xdb,0,0,0), 0}}, {{SS_MASK, 0}}, IXA, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, +{ "mvn", 6, {{SSH(0xd1,0,0,0), 0}}, {{SS_MASK, 0}}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, +{ "mvo", 6, {{SSH(0xf1,0,0,0), 0}}, {{SS_MASK, 0}}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, +{ "mvz", 6, {{SSH(0xd3,0,0,0), 0}}, {{SS_MASK, 0}}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, +{ "nc", 6, {{SSH(0xd4,0,0,0), 0}}, {{SS_MASK, 0}}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, +{ "oc", 6, {{SSH(0xd6,0,0,0), 0}}, {{SS_MASK, 0}}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, +{ "pack", 6, {{SSH(0xf2,0,0,0), 0}}, {{SS_MASK, 0}}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, +{ "plo", 6, {{SSH(0xee,0,0,0), 0}}, {{SS_MASK, 0}}, IPL, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, +{ "sp", 6, {{SSH(0xfb,0,0,0), 0}}, {{SS_MASK, 0}}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, +{ "srp", 6, {{SSH(0xf0,0,0,0), 0}}, {{SS_MASK, 0}}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, +{ "tr", 6, {{SSH(0xdc,0,0,0), 0}}, {{SS_MASK, 0}}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, +{ "trt", 6, {{SSH(0xdd,0,0,0), 0}}, {{SS_MASK, 0}}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, +{ "unpk", 6, {{SSH(0xf3,0,0,0), 0}}, {{SS_MASK, 0}}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, +{ "xc", 6, {{SSH(0xd7,0,0,0), 0}}, {{SS_MASK, 0}}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, +{ "zap", 6, {{SSH(0xf8,0,0,0), 0}}, {{SS_MASK, 0}}, I370, {SS_D1,SS_L,SS_B1,SS_D2,SS_B2} }, /* SSE form instructions */ -{ "lasp", 6, {SSEH(0xe500,0,0), 0}, {SSE_MASK, 0}, IXA, {SS_D1, SS_B1, SS_D2, SS_B2} }, -{ "mvcdk", 6, {SSEH(0xe50f,0,0), 0}, {SSE_MASK, 0}, IESA, {SS_D1, SS_B1, SS_D2, SS_B2} }, -{ "mvcsk", 6, {SSEH(0xe50e,0,0), 0}, {SSE_MASK, 0}, IESA, {SS_D1, SS_B1, SS_D2, SS_B2} }, -{ "tprot", 6, {SSEH(0xe501,0,0), 0}, {SSE_MASK, 0}, IXA, {SS_D1, SS_B1, SS_D2, SS_B2} }, +{ "lasp", 6, {{SSEH(0xe500,0,0), 0}}, {{SSE_MASK, 0}}, IXA, {SS_D1, SS_B1, SS_D2, SS_B2} }, +{ "mvcdk", 6, {{SSEH(0xe50f,0,0), 0}}, {{SSE_MASK, 0}}, IESA, {SS_D1, SS_B1, SS_D2, SS_B2} }, +{ "mvcsk", 6, {{SSEH(0xe50e,0,0), 0}}, {{SSE_MASK, 0}}, IESA, {SS_D1, SS_B1, SS_D2, SS_B2} }, +{ "tprot", 6, {{SSEH(0xe501,0,0), 0}}, {{SSE_MASK, 0}}, IXA, {SS_D1, SS_B1, SS_D2, SS_B2} }, /* */ }; diff -uprN binutils-2.11.90.0.31/opcodes/i386-dis.c binutils-2.11.92.0.5/opcodes/i386-dis.c --- binutils-2.11.90.0.31/opcodes/i386-dis.c Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/opcodes/i386-dis.c Mon Oct 1 15:25:26 2001 @@ -1297,10 +1297,10 @@ static const struct dis386 grps[][8] = { { "(bad)", Eb, XX, XX }, { "notA", Eb, XX, XX }, { "negA", Eb, XX, XX }, - { "mulB", AL, Eb, XX }, - { "imulB", AL, Eb, XX }, - { "divB", AL, Eb, XX }, - { "idivB", AL, Eb, XX } + { "mulA", Eb, XX, XX }, /* Don't print the implicit %al register, */ + { "imulA", Eb, XX, XX }, /* to distinguish these opcodes from other */ + { "divA", Eb, XX, XX }, /* mul/imul opcodes. Do the same for div */ + { "idivA", Eb, XX, XX } /* and idiv for consistency. */ }, /* GRP3S */ { @@ -1308,10 +1308,10 @@ static const struct dis386 grps[][8] = { { "(bad)", XX, XX, XX }, { "notQ", Ev, XX, XX }, { "negQ", Ev, XX, XX }, - { "mulS", eAX, Ev, XX }, - { "imulS", eAX, Ev, XX }, - { "divS", eAX, Ev, XX }, - { "idivS", eAX, Ev, XX }, + { "mulQ", Ev, XX, XX }, /* Don't print the implicit register. */ + { "imulQ", Ev, XX, XX }, + { "divQ", Ev, XX, XX }, + { "idivQ", Ev, XX, XX }, }, /* GRP4 */ { diff -uprN binutils-2.11.90.0.31/opcodes/i960-dis.c binutils-2.11.92.0.5/opcodes/i960-dis.c --- binutils-2.11.90.0.31/opcodes/i960-dis.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/opcodes/i960-dis.c Mon Oct 1 15:25:26 2001 @@ -36,7 +36,7 @@ static void ctrl PARAMS ((bfd_vma, unsig static void cobr PARAMS ((bfd_vma, unsigned long, unsigned long)); static void reg PARAMS ((unsigned long)); static int mem PARAMS ((bfd_vma, unsigned long, unsigned long, int)); -static void ea PARAMS ((bfd_vma, int, char *, char *, int, unsigned int)); +static void ea PARAMS ((bfd_vma, int, const char *, const char *, int, unsigned int)); static void dstop PARAMS ((int, int, int)); static void regop PARAMS ((int, int, int, int)); static void invalid PARAMS ((int)); @@ -118,802 +118,839 @@ struct sparse_tabent { }; static int -pinsn( memaddr, word1, word2 ) - bfd_vma memaddr; - unsigned long word1, word2; +pinsn (memaddr, word1, word2) + bfd_vma memaddr; + unsigned long word1, word2; { - int instr_len; + int instr_len; + + instr_len = 4; + put_abs (word1, word2); + + /* Divide instruction set into classes based on high 4 bits of opcode. */ + switch ((word1 >> 28) & 0xf) + { + case 0x0: + case 0x1: + ctrl (memaddr, word1, word2); + break; + case 0x2: + case 0x3: + cobr (memaddr, word1, word2); + break; + case 0x5: + case 0x6: + case 0x7: + reg (word1); + break; + case 0x8: + case 0x9: + case 0xa: + case 0xb: + case 0xc: + instr_len = mem (memaddr, word1, word2, 0); + break; + default: + /* Invalid instruction, print as data word. */ + invalid (word1); + break; + } + return instr_len; +} - instr_len = 4; - put_abs( word1, word2 ); +/* CTRL format.. */ - /* Divide instruction set into classes based on high 4 bits of opcode*/ - switch ( (word1 >> 28) & 0xf ){ - case 0x0: - case 0x1: - ctrl( memaddr, word1, word2 ); - break; - case 0x2: - case 0x3: - cobr( memaddr, word1, word2 ); - break; - case 0x5: - case 0x6: - case 0x7: - reg( word1 ); - break; - case 0x8: - case 0x9: - case 0xa: - case 0xb: - case 0xc: - instr_len = mem( memaddr, word1, word2, 0 ); - break; - default: - /* invalid instruction, print as data word */ - invalid( word1 ); - break; - } - return instr_len; -} - -/****************************************/ -/* CTRL format */ -/****************************************/ static void -ctrl( memaddr, word1, word2 ) - bfd_vma memaddr; - unsigned long word1; - unsigned long word2 ATTRIBUTE_UNUSED; +ctrl (memaddr, word1, word2) + bfd_vma memaddr; + unsigned long word1; + unsigned long word2 ATTRIBUTE_UNUSED; { - int i; - static const struct tabent ctrl_tab[] = { - { NULL, 0, }, /* 0x00 */ - { NULL, 0, }, /* 0x01 */ - { NULL, 0, }, /* 0x02 */ - { NULL, 0, }, /* 0x03 */ - { NULL, 0, }, /* 0x04 */ - { NULL, 0, }, /* 0x05 */ - { NULL, 0, }, /* 0x06 */ - { NULL, 0, }, /* 0x07 */ - { "b", 1, }, /* 0x08 */ - { "call", 1, }, /* 0x09 */ - { "ret", 0, }, /* 0x0a */ - { "bal", 1, }, /* 0x0b */ - { NULL, 0, }, /* 0x0c */ - { NULL, 0, }, /* 0x0d */ - { NULL, 0, }, /* 0x0e */ - { NULL, 0, }, /* 0x0f */ - { "bno", 1, }, /* 0x10 */ - { "bg", 1, }, /* 0x11 */ - { "be", 1, }, /* 0x12 */ - { "bge", 1, }, /* 0x13 */ - { "bl", 1, }, /* 0x14 */ - { "bne", 1, }, /* 0x15 */ - { "ble", 1, }, /* 0x16 */ - { "bo", 1, }, /* 0x17 */ - { "faultno", 0, }, /* 0x18 */ - { "faultg", 0, }, /* 0x19 */ - { "faulte", 0, }, /* 0x1a */ - { "faultge", 0, }, /* 0x1b */ - { "faultl", 0, }, /* 0x1c */ - { "faultne", 0, }, /* 0x1d */ - { "faultle", 0, }, /* 0x1e */ - { "faulto", 0, }, /* 0x1f */ - }; - - i = (word1 >> 24) & 0xff; - if ( (ctrl_tab[i].name == NULL) || ((word1 & 1) != 0) ){ - invalid( word1 ); - return; - } - - (*info->fprintf_func) ( stream, ctrl_tab[i].name ); - if ( word1 & 2 ){ /* Predicts branch not taken */ - (*info->fprintf_func) ( stream, ".f" ); - } - - if ( ctrl_tab[i].numops == 1 ){ - /* EXTRACT DISPLACEMENT AND CONVERT TO ADDRESS */ - word1 &= 0x00ffffff; - if ( word1 & 0x00800000 ){ /* Sign bit is set */ - word1 |= (-1 & ~0xffffff); /* Sign extend */ - } - (*info->fprintf_func)( stream, "\t" ); - print_addr( word1 + memaddr ); - } -} - -/****************************************/ -/* COBR format */ -/****************************************/ + int i; + static const struct tabent ctrl_tab[] = { + { NULL, 0, }, /* 0x00 */ + { NULL, 0, }, /* 0x01 */ + { NULL, 0, }, /* 0x02 */ + { NULL, 0, }, /* 0x03 */ + { NULL, 0, }, /* 0x04 */ + { NULL, 0, }, /* 0x05 */ + { NULL, 0, }, /* 0x06 */ + { NULL, 0, }, /* 0x07 */ + { "b", 1, }, /* 0x08 */ + { "call", 1, }, /* 0x09 */ + { "ret", 0, }, /* 0x0a */ + { "bal", 1, }, /* 0x0b */ + { NULL, 0, }, /* 0x0c */ + { NULL, 0, }, /* 0x0d */ + { NULL, 0, }, /* 0x0e */ + { NULL, 0, }, /* 0x0f */ + { "bno", 1, }, /* 0x10 */ + { "bg", 1, }, /* 0x11 */ + { "be", 1, }, /* 0x12 */ + { "bge", 1, }, /* 0x13 */ + { "bl", 1, }, /* 0x14 */ + { "bne", 1, }, /* 0x15 */ + { "ble", 1, }, /* 0x16 */ + { "bo", 1, }, /* 0x17 */ + { "faultno", 0, }, /* 0x18 */ + { "faultg", 0, }, /* 0x19 */ + { "faulte", 0, }, /* 0x1a */ + { "faultge", 0, }, /* 0x1b */ + { "faultl", 0, }, /* 0x1c */ + { "faultne", 0, }, /* 0x1d */ + { "faultle", 0, }, /* 0x1e */ + { "faulto", 0, }, /* 0x1f */ + }; + + i = (word1 >> 24) & 0xff; + if ((ctrl_tab[i].name == NULL) || ((word1 & 1) != 0)) + { + invalid (word1); + return; + } + + (*info->fprintf_func) (stream, ctrl_tab[i].name); + if (word1 & 2) + /* Predicts branch not taken. */ + (*info->fprintf_func) (stream, ".f"); + + if (ctrl_tab[i].numops == 1) + { + /* Extract displacement and convert to address. */ + word1 &= 0x00ffffff; + + if (word1 & 0x00800000) + { + /* Sign bit is set. */ + word1 |= (-1 & ~0xffffff); /* Sign extend. */ + } + + (*info->fprintf_func) (stream, "\t"); + print_addr (word1 + memaddr); + } +} + +/* COBR format. */ + static void -cobr( memaddr, word1, word2 ) - bfd_vma memaddr; - unsigned long word1; - unsigned long word2 ATTRIBUTE_UNUSED; +cobr (memaddr, word1, word2) + bfd_vma memaddr; + unsigned long word1; + unsigned long word2 ATTRIBUTE_UNUSED; { - int src1; - int src2; - int i; - - static const struct tabent cobr_tab[] = { - { "testno", 1, }, /* 0x20 */ - { "testg", 1, }, /* 0x21 */ - { "teste", 1, }, /* 0x22 */ - { "testge", 1, }, /* 0x23 */ - { "testl", 1, }, /* 0x24 */ - { "testne", 1, }, /* 0x25 */ - { "testle", 1, }, /* 0x26 */ - { "testo", 1, }, /* 0x27 */ - { NULL, 0, }, /* 0x28 */ - { NULL, 0, }, /* 0x29 */ - { NULL, 0, }, /* 0x2a */ - { NULL, 0, }, /* 0x2b */ - { NULL, 0, }, /* 0x2c */ - { NULL, 0, }, /* 0x2d */ - { NULL, 0, }, /* 0x2e */ - { NULL, 0, }, /* 0x2f */ - { "bbc", 3, }, /* 0x30 */ - { "cmpobg", 3, }, /* 0x31 */ - { "cmpobe", 3, }, /* 0x32 */ - { "cmpobge", 3, }, /* 0x33 */ - { "cmpobl", 3, }, /* 0x34 */ - { "cmpobne", 3, }, /* 0x35 */ - { "cmpoble", 3, }, /* 0x36 */ - { "bbs", 3, }, /* 0x37 */ - { "cmpibno", 3, }, /* 0x38 */ - { "cmpibg", 3, }, /* 0x39 */ - { "cmpibe", 3, }, /* 0x3a */ - { "cmpibge", 3, }, /* 0x3b */ - { "cmpibl", 3, }, /* 0x3c */ - { "cmpibne", 3, }, /* 0x3d */ - { "cmpible", 3, }, /* 0x3e */ - { "cmpibo", 3, }, /* 0x3f */ - }; - - i = ((word1 >> 24) & 0xff) - 0x20; - if ( cobr_tab[i].name == NULL ){ - invalid( word1 ); - return; - } - - (*info->fprintf_func) ( stream, cobr_tab[i].name ); - if ( word1 & 2 ){ /* Predicts branch not taken */ - (*info->fprintf_func) ( stream, ".f" ); - } - (*info->fprintf_func)( stream, "\t" ); - - src1 = (word1 >> 19) & 0x1f; - src2 = (word1 >> 14) & 0x1f; - - if ( word1 & 0x02000 ){ /* M1 is 1 */ - (*info->fprintf_func)( stream, "%d", src1 ); - } else { /* M1 is 0 */ - (*info->fprintf_func)( stream, reg_names[src1] ); - } - - if ( cobr_tab[i].numops > 1 ){ - if ( word1 & 1 ){ /* S2 is 1 */ - (*info->fprintf_func)( stream, ",sf%d,", src2 ); - } else { /* S1 is 0 */ - (*info->fprintf_func)( stream, ",%s,", reg_names[src2] ); - } - - /* Extract displacement and convert to address - */ - word1 &= 0x00001ffc; - if ( word1 & 0x00001000 ){ /* Negative displacement */ - word1 |= (-1 & ~0x1fff); /* Sign extend */ - } - print_addr( memaddr + word1 ); - } -} - -/****************************************/ -/* MEM format */ -/****************************************/ -static int /* returns instruction length: 4 or 8 */ -mem( memaddr, word1, word2, noprint ) - bfd_vma memaddr; - unsigned long word1, word2; - int noprint; /* If TRUE, return instruction length, but - * don't output any text. - */ -{ - int i, j; - int len; - int mode; - int offset; - const char *reg1, *reg2, *reg3; - - /* This lookup table is too sparse to make it worth typing in, but not - so large as to make a sparse array necessary. We create the table - at runtime. */ - - /* - * NOTE: In this table, the meaning of 'numops' is: - * 1: single operand - * 2: 2 operands, load instruction - * -2: 2 operands, store instruction - */ - static struct tabent *mem_tab; -/* Opcodes of 0x8X, 9X, aX, bX, and cX must be in the table. */ + int src1; + int src2; + int i; + + static const struct tabent cobr_tab[] = { + { "testno", 1, }, /* 0x20 */ + { "testg", 1, }, /* 0x21 */ + { "teste", 1, }, /* 0x22 */ + { "testge", 1, }, /* 0x23 */ + { "testl", 1, }, /* 0x24 */ + { "testne", 1, }, /* 0x25 */ + { "testle", 1, }, /* 0x26 */ + { "testo", 1, }, /* 0x27 */ + { NULL, 0, }, /* 0x28 */ + { NULL, 0, }, /* 0x29 */ + { NULL, 0, }, /* 0x2a */ + { NULL, 0, }, /* 0x2b */ + { NULL, 0, }, /* 0x2c */ + { NULL, 0, }, /* 0x2d */ + { NULL, 0, }, /* 0x2e */ + { NULL, 0, }, /* 0x2f */ + { "bbc", 3, }, /* 0x30 */ + { "cmpobg", 3, }, /* 0x31 */ + { "cmpobe", 3, }, /* 0x32 */ + { "cmpobge",3, }, /* 0x33 */ + { "cmpobl", 3, }, /* 0x34 */ + { "cmpobne",3, }, /* 0x35 */ + { "cmpoble",3, }, /* 0x36 */ + { "bbs", 3, }, /* 0x37 */ + { "cmpibno",3, }, /* 0x38 */ + { "cmpibg", 3, }, /* 0x39 */ + { "cmpibe", 3, }, /* 0x3a */ + { "cmpibge",3, }, /* 0x3b */ + { "cmpibl", 3, }, /* 0x3c */ + { "cmpibne",3, }, /* 0x3d */ + { "cmpible",3, }, /* 0x3e */ + { "cmpibo", 3, }, /* 0x3f */ + }; + + i = ((word1 >> 24) & 0xff) - 0x20; + if (cobr_tab[i].name == NULL) + { + invalid (word1); + return; + } + + (*info->fprintf_func) (stream, cobr_tab[i].name); + + /* Predicts branch not taken. */ + if (word1 & 2) + (*info->fprintf_func) (stream, ".f"); + + (*info->fprintf_func) (stream, "\t"); + + src1 = (word1 >> 19) & 0x1f; + src2 = (word1 >> 14) & 0x1f; + + if (word1 & 0x02000) + /* M1 is 1 */ + (*info->fprintf_func) (stream, "%d", src1); + else + (*info->fprintf_func) (stream, reg_names[src1]); + + if (cobr_tab[i].numops > 1) + { + if (word1 & 1) + /* S2 is 1. */ + (*info->fprintf_func) (stream, ",sf%d,", src2); + else + /* S1 is 0. */ + (*info->fprintf_func) (stream, ",%s,", reg_names[src2]); + + /* Extract displacement and convert to address. */ + word1 &= 0x00001ffc; + if (word1 & 0x00001000) + /* Negative displacement. */ + word1 |= (-1 & ~0x1fff); /* Sign extend. */ + + print_addr (memaddr + word1); + } +} + +/* MEM format. */ +/* Returns instruction length: 4 or 8. */ + +static int +mem (memaddr, word1, word2, noprint) + bfd_vma memaddr; + unsigned long word1, word2; + int noprint; /* If TRUE, return instruction length, but + don't output any text. */ +{ + int i, j; + int len; + int mode; + int offset; + const char *reg1, *reg2, *reg3; + + /* This lookup table is too sparse to make it worth typing in, but not + so large as to make a sparse array necessary. We create the table + at runtime. */ + + /* NOTE: In this table, the meaning of 'numops' is: + 1: single operand + 2: 2 operands, load instruction + -2: 2 operands, store instruction. */ + static struct tabent *mem_tab; + /* Opcodes of 0x8X, 9X, aX, bX, and cX must be in the table. */ #define MEM_MIN 0x80 #define MEM_MAX 0xcf #define MEM_SIZ ( * sizeof(struct tabent)) - static const struct sparse_tabent mem_init[] = { - { 0x80, "ldob", 2 }, - { 0x82, "stob", -2 }, - { 0x84, "bx", 1 }, - { 0x85, "balx", 2 }, - { 0x86, "callx", 1 }, - { 0x88, "ldos", 2 }, - { 0x8a, "stos", -2 }, - { 0x8c, "lda", 2 }, - { 0x90, "ld", 2 }, - { 0x92, "st", -2 }, - { 0x98, "ldl", 2 }, - { 0x9a, "stl", -2 }, - { 0xa0, "ldt", 2 }, - { 0xa2, "stt", -2 }, - { 0xac, "dcinva", 1 }, - { 0xb0, "ldq", 2 }, - { 0xb2, "stq", -2 }, - { 0xc0, "ldib", 2 }, - { 0xc2, "stib", -2 }, - { 0xc8, "ldis", 2 }, - { 0xca, "stis", -2 }, - { 0, NULL, 0 } - }; - static struct tabent mem_tab_buf[MEM_MAX - MEM_MIN + 1]; - - if ( mem_tab == NULL ){ - mem_tab = mem_tab_buf; - for ( i = 0; mem_init[i].opcode != 0; i++ ){ - j = mem_init[i].opcode - MEM_MIN; - mem_tab[j].name = mem_init[i].name; - mem_tab[j].numops = mem_init[i].numops; - } - } - - i = ((word1 >> 24) & 0xff) - MEM_MIN; - mode = (word1 >> 10) & 0xf; - - if ( (mem_tab[i].name != NULL) /* Valid instruction */ - && ((mode == 5) || (mode >=12)) ){ /* With 32-bit displacement */ - len = 8; - } else { - len = 4; - } - - if ( noprint ){ - return len; - } - - if ( (mem_tab[i].name == NULL) || (mode == 6) ){ - invalid( word1 ); - return len; - } - - (*info->fprintf_func)( stream, "%s\t", mem_tab[i].name ); - - reg1 = reg_names[ (word1 >> 19) & 0x1f ]; /* MEMB only */ - reg2 = reg_names[ (word1 >> 14) & 0x1f ]; - reg3 = reg_names[ word1 & 0x1f ]; /* MEMB only */ - offset = word1 & 0xfff; /* MEMA only */ - - switch ( mem_tab[i].numops ){ - - case 2: /* LOAD INSTRUCTION */ - if ( mode & 4 ){ /* MEMB FORMAT */ - ea( memaddr, mode, reg2, reg3, word1, word2 ); - (*info->fprintf_func)( stream, ",%s", reg1 ); - } else { /* MEMA FORMAT */ - (*info->fprintf_func)( stream, "0x%x", (unsigned) offset ); - if (mode & 8) { - (*info->fprintf_func)( stream, "(%s)", reg2 ); - } - (*info->fprintf_func)( stream, ",%s", reg1 ); - } - break; - - case -2: /* STORE INSTRUCTION */ - if ( mode & 4 ){ /* MEMB FORMAT */ - (*info->fprintf_func)( stream, "%s,", reg1 ); - ea( memaddr, mode, reg2, reg3, word1, word2 ); - } else { /* MEMA FORMAT */ - (*info->fprintf_func)( stream, "%s,0x%x", reg1, (unsigned) offset ); - if (mode & 8) { - (*info->fprintf_func)( stream, "(%s)", reg2 ); - } - } - break; - - case 1: /* BX/CALLX INSTRUCTION */ - if ( mode & 4 ){ /* MEMB FORMAT */ - ea( memaddr, mode, reg2, reg3, word1, word2 ); - } else { /* MEMA FORMAT */ - (*info->fprintf_func)( stream, "0x%x", (unsigned) offset ); - if (mode & 8) { - (*info->fprintf_func)( stream, "(%s)", reg2 ); - } - } - break; - } - - return len; -} - -/****************************************/ -/* REG format */ -/****************************************/ + static const struct sparse_tabent mem_init[] = { + { 0x80, "ldob", 2 }, + { 0x82, "stob", -2 }, + { 0x84, "bx", 1 }, + { 0x85, "balx", 2 }, + { 0x86, "callx", 1 }, + { 0x88, "ldos", 2 }, + { 0x8a, "stos", -2 }, + { 0x8c, "lda", 2 }, + { 0x90, "ld", 2 }, + { 0x92, "st", -2 }, + { 0x98, "ldl", 2 }, + { 0x9a, "stl", -2 }, + { 0xa0, "ldt", 2 }, + { 0xa2, "stt", -2 }, + { 0xac, "dcinva", 1 }, + { 0xb0, "ldq", 2 }, + { 0xb2, "stq", -2 }, + { 0xc0, "ldib", 2 }, + { 0xc2, "stib", -2 }, + { 0xc8, "ldis", 2 }, + { 0xca, "stis", -2 }, + { 0, NULL, 0 } + }; + static struct tabent mem_tab_buf[MEM_MAX - MEM_MIN + 1]; + + if (mem_tab == NULL) + { + mem_tab = mem_tab_buf; + + for (i = 0; mem_init[i].opcode != 0; i++) + { + j = mem_init[i].opcode - MEM_MIN; + mem_tab[j].name = mem_init[i].name; + mem_tab[j].numops = mem_init[i].numops; + } + } + + i = ((word1 >> 24) & 0xff) - MEM_MIN; + mode = (word1 >> 10) & 0xf; + + if ((mem_tab[i].name != NULL) /* Valid instruction */ + && ((mode == 5) || (mode >= 12))) + /* With 32-bit displacement. */ + len = 8; + else + len = 4; + + if (noprint) + return len; + + if ((mem_tab[i].name == NULL) || (mode == 6)) + { + invalid (word1); + return len; + } + + (*info->fprintf_func) (stream, "%s\t", mem_tab[i].name); + + reg1 = reg_names[ (word1 >> 19) & 0x1f ]; /* MEMB only */ + reg2 = reg_names[ (word1 >> 14) & 0x1f ]; + reg3 = reg_names[ word1 & 0x1f ]; /* MEMB only */ + offset = word1 & 0xfff; /* MEMA only */ + + switch (mem_tab[i].numops) + { + case 2: /* LOAD INSTRUCTION */ + if (mode & 4) + { /* MEMB FORMAT */ + ea (memaddr, mode, reg2, reg3, word1, word2); + (*info->fprintf_func) (stream, ",%s", reg1); + } + else + { /* MEMA FORMAT */ + (*info->fprintf_func) (stream, "0x%x", (unsigned) offset); + + if (mode & 8) + (*info->fprintf_func) (stream, "(%s)", reg2); + + (*info->fprintf_func)(stream, ",%s", reg1); + } + break; + + case -2: /* STORE INSTRUCTION */ + if (mode & 4) + { + /* MEMB FORMAT */ + (*info->fprintf_func) (stream, "%s,", reg1); + ea (memaddr, mode, reg2, reg3, word1, word2); + } + else + { + /* MEMA FORMAT */ + (*info->fprintf_func) (stream, "%s,0x%x", reg1, (unsigned) offset); + + if (mode & 8) + (*info->fprintf_func) (stream, "(%s)", reg2); + } + break; + + case 1: /* BX/CALLX INSTRUCTION */ + if (mode & 4) + { + /* MEMB FORMAT */ + ea (memaddr, mode, reg2, reg3, word1, word2); + } + else + { + /* MEMA FORMAT */ + (*info->fprintf_func) (stream, "0x%x", (unsigned) offset); + if (mode & 8) + (*info->fprintf_func) (stream, "(%s)", reg2); + } + break; + } + + return len; +} + +/* REG format. */ + static void -reg( word1 ) - unsigned long word1; +reg (word1) + unsigned long word1; { - int i, j; - int opcode; - int fp; - int m1, m2, m3; - int s1, s2; - int src, src2, dst; - char *mnemp; - - /* This lookup table is too sparse to make it worth typing in, but not - so large as to make a sparse array necessary. We create the table - at runtime. */ - - /* - * NOTE: In this table, the meaning of 'numops' is: - * 1: single operand, which is NOT a destination. - * -1: single operand, which IS a destination. - * 2: 2 operands, the 2nd of which is NOT a destination. - * -2: 2 operands, the 2nd of which IS a destination. - * 3: 3 operands - * - * If an opcode mnemonic begins with "F", it is a floating-point - * opcode (the "F" is not printed). - */ - - static struct tabent *reg_tab; - static const struct sparse_tabent reg_init[] = { + int i, j; + int opcode; + int fp; + int m1, m2, m3; + int s1, s2; + int src, src2, dst; + char *mnemp; + + /* This lookup table is too sparse to make it worth typing in, but not + so large as to make a sparse array necessary. We create the table + at runtime. */ + + /* NOTE: In this table, the meaning of 'numops' is: + 1: single operand, which is NOT a destination. + -1: single operand, which IS a destination. + 2: 2 operands, the 2nd of which is NOT a destination. + -2: 2 operands, the 2nd of which IS a destination. + 3: 3 operands + + If an opcode mnemonic begins with "F", it is a floating-point + opcode (the "F" is not printed). */ + + static struct tabent *reg_tab; + static const struct sparse_tabent reg_init[] = + { #define REG_MIN 0x580 - { 0x580, "notbit", 3 }, - { 0x581, "and", 3 }, - { 0x582, "andnot", 3 }, - { 0x583, "setbit", 3 }, - { 0x584, "notand", 3 }, - { 0x586, "xor", 3 }, - { 0x587, "or", 3 }, - { 0x588, "nor", 3 }, - { 0x589, "xnor", 3 }, - { 0x58a, "not", -2 }, - { 0x58b, "ornot", 3 }, - { 0x58c, "clrbit", 3 }, - { 0x58d, "notor", 3 }, - { 0x58e, "nand", 3 }, - { 0x58f, "alterbit", 3 }, - { 0x590, "addo", 3 }, - { 0x591, "addi", 3 }, - { 0x592, "subo", 3 }, - { 0x593, "subi", 3 }, - { 0x594, "cmpob", 2 }, - { 0x595, "cmpib", 2 }, - { 0x596, "cmpos", 2 }, - { 0x597, "cmpis", 2 }, - { 0x598, "shro", 3 }, - { 0x59a, "shrdi", 3 }, - { 0x59b, "shri", 3 }, - { 0x59c, "shlo", 3 }, - { 0x59d, "rotate", 3 }, - { 0x59e, "shli", 3 }, - { 0x5a0, "cmpo", 2 }, - { 0x5a1, "cmpi", 2 }, - { 0x5a2, "concmpo", 2 }, - { 0x5a3, "concmpi", 2 }, - { 0x5a4, "cmpinco", 3 }, - { 0x5a5, "cmpinci", 3 }, - { 0x5a6, "cmpdeco", 3 }, - { 0x5a7, "cmpdeci", 3 }, - { 0x5ac, "scanbyte", 2 }, - { 0x5ad, "bswap", -2 }, - { 0x5ae, "chkbit", 2 }, - { 0x5b0, "addc", 3 }, - { 0x5b2, "subc", 3 }, - { 0x5b4, "intdis", 0 }, - { 0x5b5, "inten", 0 }, - { 0x5cc, "mov", -2 }, - { 0x5d8, "eshro", 3 }, - { 0x5dc, "movl", -2 }, - { 0x5ec, "movt", -2 }, - { 0x5fc, "movq", -2 }, - { 0x600, "synmov", 2 }, - { 0x601, "synmovl", 2 }, - { 0x602, "synmovq", 2 }, - { 0x603, "cmpstr", 3 }, - { 0x604, "movqstr", 3 }, - { 0x605, "movstr", 3 }, - { 0x610, "atmod", 3 }, - { 0x612, "atadd", 3 }, - { 0x613, "inspacc", -2 }, - { 0x614, "ldphy", -2 }, - { 0x615, "synld", -2 }, - { 0x617, "fill", 3 }, - { 0x630, "sdma", 3 }, - { 0x631, "udma", 0 }, - { 0x640, "spanbit", -2 }, - { 0x641, "scanbit", -2 }, - { 0x642, "daddc", 3 }, - { 0x643, "dsubc", 3 }, - { 0x644, "dmovt", -2 }, - { 0x645, "modac", 3 }, - { 0x646, "condrec", -2 }, - { 0x650, "modify", 3 }, - { 0x651, "extract", 3 }, - { 0x654, "modtc", 3 }, - { 0x655, "modpc", 3 }, - { 0x656, "receive", -2 }, - { 0x658, "intctl", -2 }, - { 0x659, "sysctl", 3 }, - { 0x65b, "icctl", 3 }, - { 0x65c, "dcctl", 3 }, - { 0x65d, "halt", 0 }, - { 0x660, "calls", 1 }, - { 0x662, "send", 3 }, - { 0x663, "sendserv", 1 }, - { 0x664, "resumprcs", 1 }, - { 0x665, "schedprcs", 1 }, - { 0x666, "saveprcs", 0 }, - { 0x668, "condwait", 1 }, - { 0x669, "wait", 1 }, - { 0x66a, "signal", 1 }, - { 0x66b, "mark", 0 }, - { 0x66c, "fmark", 0 }, - { 0x66d, "flushreg", 0 }, - { 0x66f, "syncf", 0 }, - { 0x670, "emul", 3 }, - { 0x671, "ediv", 3 }, - { 0x673, "ldtime", -1 }, - { 0x674, "Fcvtir", -2 }, - { 0x675, "Fcvtilr", -2 }, - { 0x676, "Fscalerl", 3 }, - { 0x677, "Fscaler", 3 }, - { 0x680, "Fatanr", 3 }, - { 0x681, "Flogepr", 3 }, - { 0x682, "Flogr", 3 }, - { 0x683, "Fremr", 3 }, - { 0x684, "Fcmpor", 2 }, - { 0x685, "Fcmpr", 2 }, - { 0x688, "Fsqrtr", -2 }, - { 0x689, "Fexpr", -2 }, - { 0x68a, "Flogbnr", -2 }, - { 0x68b, "Froundr", -2 }, - { 0x68c, "Fsinr", -2 }, - { 0x68d, "Fcosr", -2 }, - { 0x68e, "Ftanr", -2 }, - { 0x68f, "Fclassr", 1 }, - { 0x690, "Fatanrl", 3 }, - { 0x691, "Flogeprl", 3 }, - { 0x692, "Flogrl", 3 }, - { 0x693, "Fremrl", 3 }, - { 0x694, "Fcmporl", 2 }, - { 0x695, "Fcmprl", 2 }, - { 0x698, "Fsqrtrl", -2 }, - { 0x699, "Fexprl", -2 }, - { 0x69a, "Flogbnrl", -2 }, - { 0x69b, "Froundrl", -2 }, - { 0x69c, "Fsinrl", -2 }, - { 0x69d, "Fcosrl", -2 }, - { 0x69e, "Ftanrl", -2 }, - { 0x69f, "Fclassrl", 1 }, - { 0x6c0, "Fcvtri", -2 }, - { 0x6c1, "Fcvtril", -2 }, - { 0x6c2, "Fcvtzri", -2 }, - { 0x6c3, "Fcvtzril", -2 }, - { 0x6c9, "Fmovr", -2 }, - { 0x6d9, "Fmovrl", -2 }, - { 0x6e1, "Fmovre", -2 }, - { 0x6e2, "Fcpysre", 3 }, - { 0x6e3, "Fcpyrsre", 3 }, - { 0x701, "mulo", 3 }, - { 0x708, "remo", 3 }, - { 0x70b, "divo", 3 }, - { 0x741, "muli", 3 }, - { 0x748, "remi", 3 }, - { 0x749, "modi", 3 }, - { 0x74b, "divi", 3 }, - { 0x780, "addono", 3 }, - { 0x781, "addino", 3 }, - { 0x782, "subono", 3 }, - { 0x783, "subino", 3 }, - { 0x784, "selno", 3 }, - { 0x78b, "Fdivr", 3 }, - { 0x78c, "Fmulr", 3 }, - { 0x78d, "Fsubr", 3 }, - { 0x78f, "Faddr", 3 }, - { 0x790, "addog", 3 }, - { 0x791, "addig", 3 }, - { 0x792, "subog", 3 }, - { 0x793, "subig", 3 }, - { 0x794, "selg", 3 }, - { 0x79b, "Fdivrl", 3 }, - { 0x79c, "Fmulrl", 3 }, - { 0x79d, "Fsubrl", 3 }, - { 0x79f, "Faddrl", 3 }, - { 0x7a0, "addoe", 3 }, - { 0x7a1, "addie", 3 }, - { 0x7a2, "suboe", 3 }, - { 0x7a3, "subie", 3 }, - { 0x7a4, "sele", 3 }, - { 0x7b0, "addoge", 3 }, - { 0x7b1, "addige", 3 }, - { 0x7b2, "suboge", 3 }, - { 0x7b3, "subige", 3 }, - { 0x7b4, "selge", 3 }, - { 0x7c0, "addol", 3 }, - { 0x7c1, "addil", 3 }, - { 0x7c2, "subol", 3 }, - { 0x7c3, "subil", 3 }, - { 0x7c4, "sell", 3 }, - { 0x7d0, "addone", 3 }, - { 0x7d1, "addine", 3 }, - { 0x7d2, "subone", 3 }, - { 0x7d3, "subine", 3 }, - { 0x7d4, "selne", 3 }, - { 0x7e0, "addole", 3 }, - { 0x7e1, "addile", 3 }, - { 0x7e2, "subole", 3 }, - { 0x7e3, "subile", 3 }, - { 0x7e4, "selle", 3 }, - { 0x7f0, "addoo", 3 }, - { 0x7f1, "addio", 3 }, - { 0x7f2, "suboo", 3 }, - { 0x7f3, "subio", 3 }, - { 0x7f4, "selo", 3 }, + { 0x580, "notbit", 3 }, + { 0x581, "and", 3 }, + { 0x582, "andnot", 3 }, + { 0x583, "setbit", 3 }, + { 0x584, "notand", 3 }, + { 0x586, "xor", 3 }, + { 0x587, "or", 3 }, + { 0x588, "nor", 3 }, + { 0x589, "xnor", 3 }, + { 0x58a, "not", -2 }, + { 0x58b, "ornot", 3 }, + { 0x58c, "clrbit", 3 }, + { 0x58d, "notor", 3 }, + { 0x58e, "nand", 3 }, + { 0x58f, "alterbit", 3 }, + { 0x590, "addo", 3 }, + { 0x591, "addi", 3 }, + { 0x592, "subo", 3 }, + { 0x593, "subi", 3 }, + { 0x594, "cmpob", 2 }, + { 0x595, "cmpib", 2 }, + { 0x596, "cmpos", 2 }, + { 0x597, "cmpis", 2 }, + { 0x598, "shro", 3 }, + { 0x59a, "shrdi", 3 }, + { 0x59b, "shri", 3 }, + { 0x59c, "shlo", 3 }, + { 0x59d, "rotate", 3 }, + { 0x59e, "shli", 3 }, + { 0x5a0, "cmpo", 2 }, + { 0x5a1, "cmpi", 2 }, + { 0x5a2, "concmpo", 2 }, + { 0x5a3, "concmpi", 2 }, + { 0x5a4, "cmpinco", 3 }, + { 0x5a5, "cmpinci", 3 }, + { 0x5a6, "cmpdeco", 3 }, + { 0x5a7, "cmpdeci", 3 }, + { 0x5ac, "scanbyte", 2 }, + { 0x5ad, "bswap", -2 }, + { 0x5ae, "chkbit", 2 }, + { 0x5b0, "addc", 3 }, + { 0x5b2, "subc", 3 }, + { 0x5b4, "intdis", 0 }, + { 0x5b5, "inten", 0 }, + { 0x5cc, "mov", -2 }, + { 0x5d8, "eshro", 3 }, + { 0x5dc, "movl", -2 }, + { 0x5ec, "movt", -2 }, + { 0x5fc, "movq", -2 }, + { 0x600, "synmov", 2 }, + { 0x601, "synmovl", 2 }, + { 0x602, "synmovq", 2 }, + { 0x603, "cmpstr", 3 }, + { 0x604, "movqstr", 3 }, + { 0x605, "movstr", 3 }, + { 0x610, "atmod", 3 }, + { 0x612, "atadd", 3 }, + { 0x613, "inspacc", -2 }, + { 0x614, "ldphy", -2 }, + { 0x615, "synld", -2 }, + { 0x617, "fill", 3 }, + { 0x630, "sdma", 3 }, + { 0x631, "udma", 0 }, + { 0x640, "spanbit", -2 }, + { 0x641, "scanbit", -2 }, + { 0x642, "daddc", 3 }, + { 0x643, "dsubc", 3 }, + { 0x644, "dmovt", -2 }, + { 0x645, "modac", 3 }, + { 0x646, "condrec", -2 }, + { 0x650, "modify", 3 }, + { 0x651, "extract", 3 }, + { 0x654, "modtc", 3 }, + { 0x655, "modpc", 3 }, + { 0x656, "receive", -2 }, + { 0x658, "intctl", -2 }, + { 0x659, "sysctl", 3 }, + { 0x65b, "icctl", 3 }, + { 0x65c, "dcctl", 3 }, + { 0x65d, "halt", 0 }, + { 0x660, "calls", 1 }, + { 0x662, "send", 3 }, + { 0x663, "sendserv", 1 }, + { 0x664, "resumprcs", 1 }, + { 0x665, "schedprcs", 1 }, + { 0x666, "saveprcs", 0 }, + { 0x668, "condwait", 1 }, + { 0x669, "wait", 1 }, + { 0x66a, "signal", 1 }, + { 0x66b, "mark", 0 }, + { 0x66c, "fmark", 0 }, + { 0x66d, "flushreg", 0 }, + { 0x66f, "syncf", 0 }, + { 0x670, "emul", 3 }, + { 0x671, "ediv", 3 }, + { 0x673, "ldtime", -1 }, + { 0x674, "Fcvtir", -2 }, + { 0x675, "Fcvtilr", -2 }, + { 0x676, "Fscalerl", 3 }, + { 0x677, "Fscaler", 3 }, + { 0x680, "Fatanr", 3 }, + { 0x681, "Flogepr", 3 }, + { 0x682, "Flogr", 3 }, + { 0x683, "Fremr", 3 }, + { 0x684, "Fcmpor", 2 }, + { 0x685, "Fcmpr", 2 }, + { 0x688, "Fsqrtr", -2 }, + { 0x689, "Fexpr", -2 }, + { 0x68a, "Flogbnr", -2 }, + { 0x68b, "Froundr", -2 }, + { 0x68c, "Fsinr", -2 }, + { 0x68d, "Fcosr", -2 }, + { 0x68e, "Ftanr", -2 }, + { 0x68f, "Fclassr", 1 }, + { 0x690, "Fatanrl", 3 }, + { 0x691, "Flogeprl", 3 }, + { 0x692, "Flogrl", 3 }, + { 0x693, "Fremrl", 3 }, + { 0x694, "Fcmporl", 2 }, + { 0x695, "Fcmprl", 2 }, + { 0x698, "Fsqrtrl", -2 }, + { 0x699, "Fexprl", -2 }, + { 0x69a, "Flogbnrl", -2 }, + { 0x69b, "Froundrl", -2 }, + { 0x69c, "Fsinrl", -2 }, + { 0x69d, "Fcosrl", -2 }, + { 0x69e, "Ftanrl", -2 }, + { 0x69f, "Fclassrl", 1 }, + { 0x6c0, "Fcvtri", -2 }, + { 0x6c1, "Fcvtril", -2 }, + { 0x6c2, "Fcvtzri", -2 }, + { 0x6c3, "Fcvtzril", -2 }, + { 0x6c9, "Fmovr", -2 }, + { 0x6d9, "Fmovrl", -2 }, + { 0x6e1, "Fmovre", -2 }, + { 0x6e2, "Fcpysre", 3 }, + { 0x6e3, "Fcpyrsre", 3 }, + { 0x701, "mulo", 3 }, + { 0x708, "remo", 3 }, + { 0x70b, "divo", 3 }, + { 0x741, "muli", 3 }, + { 0x748, "remi", 3 }, + { 0x749, "modi", 3 }, + { 0x74b, "divi", 3 }, + { 0x780, "addono", 3 }, + { 0x781, "addino", 3 }, + { 0x782, "subono", 3 }, + { 0x783, "subino", 3 }, + { 0x784, "selno", 3 }, + { 0x78b, "Fdivr", 3 }, + { 0x78c, "Fmulr", 3 }, + { 0x78d, "Fsubr", 3 }, + { 0x78f, "Faddr", 3 }, + { 0x790, "addog", 3 }, + { 0x791, "addig", 3 }, + { 0x792, "subog", 3 }, + { 0x793, "subig", 3 }, + { 0x794, "selg", 3 }, + { 0x79b, "Fdivrl", 3 }, + { 0x79c, "Fmulrl", 3 }, + { 0x79d, "Fsubrl", 3 }, + { 0x79f, "Faddrl", 3 }, + { 0x7a0, "addoe", 3 }, + { 0x7a1, "addie", 3 }, + { 0x7a2, "suboe", 3 }, + { 0x7a3, "subie", 3 }, + { 0x7a4, "sele", 3 }, + { 0x7b0, "addoge", 3 }, + { 0x7b1, "addige", 3 }, + { 0x7b2, "suboge", 3 }, + { 0x7b3, "subige", 3 }, + { 0x7b4, "selge", 3 }, + { 0x7c0, "addol", 3 }, + { 0x7c1, "addil", 3 }, + { 0x7c2, "subol", 3 }, + { 0x7c3, "subil", 3 }, + { 0x7c4, "sell", 3 }, + { 0x7d0, "addone", 3 }, + { 0x7d1, "addine", 3 }, + { 0x7d2, "subone", 3 }, + { 0x7d3, "subine", 3 }, + { 0x7d4, "selne", 3 }, + { 0x7e0, "addole", 3 }, + { 0x7e1, "addile", 3 }, + { 0x7e2, "subole", 3 }, + { 0x7e3, "subile", 3 }, + { 0x7e4, "selle", 3 }, + { 0x7f0, "addoo", 3 }, + { 0x7f1, "addio", 3 }, + { 0x7f2, "suboo", 3 }, + { 0x7f3, "subio", 3 }, + { 0x7f4, "selo", 3 }, #define REG_MAX 0x7f4 - { 0, NULL, 0 } - }; - static struct tabent reg_tab_buf[REG_MAX - REG_MIN + 1]; - - if ( reg_tab == NULL ){ - reg_tab = reg_tab_buf; - for ( i = 0; reg_init[i].opcode != 0; i++ ){ - j = reg_init[i].opcode - REG_MIN; - reg_tab[j].name = reg_init[i].name; - reg_tab[j].numops = reg_init[i].numops; - } - } - - opcode = ((word1 >> 20) & 0xff0) | ((word1 >> 7) & 0xf); - i = opcode - REG_MIN; - - if ( (opcodeREG_MAX) || (reg_tab[i].name==NULL) ){ - invalid( word1 ); - return; - } - - mnemp = reg_tab[i].name; - if ( *mnemp == 'F' ){ - fp = 1; - mnemp++; - } else { - fp = 0; - } - - (*info->fprintf_func)( stream, mnemp ); - - s1 = (word1 >> 5) & 1; - s2 = (word1 >> 6) & 1; - m1 = (word1 >> 11) & 1; - m2 = (word1 >> 12) & 1; - m3 = (word1 >> 13) & 1; - src = word1 & 0x1f; - src2 = (word1 >> 14) & 0x1f; - dst = (word1 >> 19) & 0x1f; - - if ( reg_tab[i].numops != 0 ){ - (*info->fprintf_func)( stream, "\t" ); - - switch ( reg_tab[i].numops ){ - case 1: - regop( m1, s1, src, fp ); - break; - case -1: - dstop( m3, dst, fp ); - break; - case 2: - regop( m1, s1, src, fp ); - (*info->fprintf_func)( stream, "," ); - regop( m2, s2, src2, fp ); - break; - case -2: - regop( m1, s1, src, fp ); - (*info->fprintf_func)( stream, "," ); - dstop( m3, dst, fp ); - break; - case 3: - regop( m1, s1, src, fp ); - (*info->fprintf_func)( stream, "," ); - regop( m2, s2, src2, fp ); - (*info->fprintf_func)( stream, "," ); - dstop( m3, dst, fp ); - break; - } - } -} - - -/* - * Print out effective address for memb instructions. - */ + { 0, NULL, 0 } + }; + static struct tabent reg_tab_buf[REG_MAX - REG_MIN + 1]; + + if (reg_tab == NULL) + { + reg_tab = reg_tab_buf; + + for (i = 0; reg_init[i].opcode != 0; i++) + { + j = reg_init[i].opcode - REG_MIN; + reg_tab[j].name = reg_init[i].name; + reg_tab[j].numops = reg_init[i].numops; + } + } + + opcode = ((word1 >> 20) & 0xff0) | ((word1 >> 7) & 0xf); + i = opcode - REG_MIN; + + if ((opcodeREG_MAX) || (reg_tab[i].name==NULL)) + { + invalid (word1); + return; + } + + mnemp = reg_tab[i].name; + if (*mnemp == 'F') + { + fp = 1; + mnemp++; + } + else + { + fp = 0; + } + + (*info->fprintf_func) (stream, mnemp); + + s1 = (word1 >> 5) & 1; + s2 = (word1 >> 6) & 1; + m1 = (word1 >> 11) & 1; + m2 = (word1 >> 12) & 1; + m3 = (word1 >> 13) & 1; + src = word1 & 0x1f; + src2 = (word1 >> 14) & 0x1f; + dst = (word1 >> 19) & 0x1f; + + if (reg_tab[i].numops != 0) + { + (*info->fprintf_func) (stream, "\t"); + + switch (reg_tab[i].numops) + { + case 1: + regop (m1, s1, src, fp); + break; + case -1: + dstop (m3, dst, fp); + break; + case 2: + regop (m1, s1, src, fp); + (*info->fprintf_func) (stream, ","); + regop (m2, s2, src2, fp); + break; + case -2: + regop (m1, s1, src, fp); + (*info->fprintf_func) (stream, ","); + dstop (m3, dst, fp); + break; + case 3: + regop (m1, s1, src, fp); + (*info->fprintf_func) (stream, ","); + regop (m2, s2, src2, fp); + (*info->fprintf_func) (stream, ","); + dstop (m3, dst, fp); + break; + } + } +} + +/* Print out effective address for memb instructions. */ + static void -ea( memaddr, mode, reg2, reg3, word1, word2 ) +ea (memaddr, mode, reg2, reg3, word1, word2) bfd_vma memaddr; int mode; - char *reg2, *reg3; + const char *reg2; + const char *reg3; int word1; unsigned int word2; { - int scale; - static const int scale_tab[] = { 1, 2, 4, 8, 16 }; + int scale; + static const int scale_tab[] = { 1, 2, 4, 8, 16 }; - scale = (word1 >> 7) & 0x07; - if ( (scale > 4) || (((word1 >> 5) & 0x03) != 0) ){ - invalid( word1 ); - return; - } - scale = scale_tab[scale]; - - switch (mode) { - case 4: /* (reg) */ - (*info->fprintf_func)( stream, "(%s)", reg2 ); - break; - case 5: /* displ+8(ip) */ - print_addr( word2+8+memaddr ); - break; - case 7: /* (reg)[index*scale] */ - if (scale == 1) { - (*info->fprintf_func)( stream, "(%s)[%s]", reg2, reg3 ); - } else { - (*info->fprintf_func)( stream, "(%s)[%s*%d]",reg2,reg3,scale); - } - break; - case 12: /* displacement */ - print_addr( (bfd_vma)word2 ); - break; - case 13: /* displ(reg) */ - print_addr( (bfd_vma)word2 ); - (*info->fprintf_func)( stream, "(%s)", reg2 ); - break; - case 14: /* displ[index*scale] */ - print_addr( (bfd_vma)word2 ); - if (scale == 1) { - (*info->fprintf_func)( stream, "[%s]", reg3 ); - } else { - (*info->fprintf_func)( stream, "[%s*%d]", reg3, scale ); - } - break; - case 15: /* displ(reg)[index*scale] */ - print_addr( (bfd_vma)word2 ); - if (scale == 1) { - (*info->fprintf_func)( stream, "(%s)[%s]", reg2, reg3 ); - } else { - (*info->fprintf_func)( stream, "(%s)[%s*%d]",reg2,reg3,scale ); - } - break; - default: - invalid( word1 ); - return; - } + scale = (word1 >> 7) & 0x07; + + if ((scale > 4) || (((word1 >> 5) & 0x03) != 0)) + { + invalid (word1); + return; + } + scale = scale_tab[scale]; + + switch (mode) + { + case 4: /* (reg) */ + (*info->fprintf_func)( stream, "(%s)", reg2 ); + break; + case 5: /* displ+8(ip) */ + print_addr (word2 + 8 + memaddr); + break; + case 7: /* (reg)[index*scale] */ + if (scale == 1) + (*info->fprintf_func) (stream, "(%s)[%s]", reg2, reg3); + else + (*info->fprintf_func) (stream, "(%s)[%s*%d]", reg2, reg3, scale); + break; + case 12: /* displacement */ + print_addr ((bfd_vma) word2); + break; + case 13: /* displ(reg) */ + print_addr ((bfd_vma) word2); + (*info->fprintf_func) (stream, "(%s)", reg2); + break; + case 14: /* displ[index*scale] */ + print_addr ((bfd_vma) word2); + if (scale == 1) + (*info->fprintf_func) (stream, "[%s]", reg3); + else + (*info->fprintf_func) (stream, "[%s*%d]", reg3, scale); + break; + case 15: /* displ(reg)[index*scale] */ + print_addr ((bfd_vma) word2); + if (scale == 1) + (*info->fprintf_func) (stream, "(%s)[%s]", reg2, reg3); + else + (*info->fprintf_func) (stream, "(%s)[%s*%d]", reg2, reg3, scale); + break; + default: + invalid (word1); + return; + } } -/************************************************/ -/* Register Instruction Operand */ -/************************************************/ +/* Register Instruction Operand. */ + static void -regop( mode, spec, reg, fp ) - int mode, spec, reg, fp; +regop (mode, spec, reg, fp) + int mode, spec, reg, fp; { - if ( fp ){ /* FLOATING POINT INSTRUCTION */ - if ( mode == 1 ){ /* FP operand */ - switch ( reg ){ - case 0: (*info->fprintf_func)( stream, "fp0" ); - break; - case 1: (*info->fprintf_func)( stream, "fp1" ); - break; - case 2: (*info->fprintf_func)( stream, "fp2" ); - break; - case 3: (*info->fprintf_func)( stream, "fp3" ); - break; - case 16: (*info->fprintf_func)( stream, "0f0.0" ); - break; - case 22: (*info->fprintf_func)( stream, "0f1.0" ); - break; - default: (*info->fprintf_func)( stream, "?" ); - break; - } - } else { /* Non-FP register */ - (*info->fprintf_func)( stream, reg_names[reg] ); - } - } else { /* NOT FLOATING POINT */ - if ( mode == 1 ){ /* Literal */ - (*info->fprintf_func)( stream, "%d", reg ); - } else { /* Register */ - if ( spec == 0 ){ - (*info->fprintf_func)( stream, reg_names[reg] ); - } else { - (*info->fprintf_func)( stream, "sf%d", reg ); - } - } + if (fp) + { + /* Floating point instruction. */ + if (mode == 1) + { + /* FP operand. */ + switch (reg) + { + case 0: (*info->fprintf_func) (stream, "fp0"); + break; + case 1: (*info->fprintf_func) (stream, "fp1"); + break; + case 2: (*info->fprintf_func) (stream, "fp2"); + break; + case 3: (*info->fprintf_func) (stream, "fp3"); + break; + case 16: (*info->fprintf_func) (stream, "0f0.0"); + break; + case 22: (*info->fprintf_func) (stream, "0f1.0"); + break; + default: (*info->fprintf_func) (stream, "?"); + break; + } + } + else + { + /* Non-FP register. */ + (*info->fprintf_func) (stream, reg_names[reg]); } + } + else + { + /* Not floating point. */ + if (mode == 1) + { + /* Literal. */ + (*info->fprintf_func) (stream, "%d", reg); + } + else + { + /* Register. */ + if (spec == 0) + (*info->fprintf_func) (stream, reg_names[reg]); + else + (*info->fprintf_func) (stream, "sf%d", reg); + } + } } -/************************************************/ -/* Register Instruction Destination Operand */ -/************************************************/ +/* Register Instruction Destination Operand. */ + static void -dstop( mode, reg, fp ) - int mode, reg, fp; +dstop (mode, reg, fp) + int mode, reg, fp; { - /* 'dst' operand can't be a literal. On non-FP instructions, register - * mode is assumed and "m3" acts as if were "s3"; on FP-instructions, - * sf registers are not allowed so m3 acts normally. - */ - if ( fp ){ - regop( mode, 0, reg, fp ); - } else { - regop( 0, mode, reg, fp ); - } + /* 'dst' operand can't be a literal. On non-FP instructions, register + mode is assumed and "m3" acts as if were "s3"; on FP-instructions, + sf registers are not allowed so m3 acts normally. */ + if (fp) + regop (mode, 0, reg, fp); + else + regop (0, mode, reg, fp); } - static void -invalid( word1 ) - int word1; +invalid (word1) + int word1; { - (*info->fprintf_func)( stream, ".word\t0x%08x", (unsigned) word1 ); + (*info->fprintf_func) (stream, ".word\t0x%08x", (unsigned) word1); } static void -print_addr(a) -bfd_vma a; +print_addr (a) + bfd_vma a; { (*info->print_address_func) (a, info); } static void -put_abs( word1, word2 ) - unsigned long word1 ATTRIBUTE_UNUSED; - unsigned long word2 ATTRIBUTE_UNUSED; +put_abs (word1, word2) + unsigned long word1 ATTRIBUTE_UNUSED; + unsigned long word2 ATTRIBUTE_UNUSED; { #ifdef IN_GDB - return; + return; #else - int len; + int len; - switch ( (word1 >> 28) & 0xf ){ - case 0x8: - case 0x9: - case 0xa: - case 0xb: - case 0xc: - /* MEM format instruction */ - len = mem( 0, word1, word2, 1 ); - break; - default: - len = 4; - break; - } - - if ( len == 8 ){ - (*info->fprintf_func)( stream, "%08x %08x\t", word1, word2 ); - } else { - (*info->fprintf_func)( stream, "%08x \t", word1 ); - } -; + switch ((word1 >> 28) & 0xf) + { + case 0x8: + case 0x9: + case 0xa: + case 0xb: + case 0xc: + /* MEM format instruction. */ + len = mem (0, word1, word2, 1); + break; + default: + len = 4; + break; + } + if (len == 8) + (*info->fprintf_func) (stream, "%08x %08x\t", word1, word2); + else + (*info->fprintf_func) (stream, "%08x \t", word1); #endif } diff -uprN binutils-2.11.90.0.31/opcodes/ia64-gen.c binutils-2.11.92.0.5/opcodes/ia64-gen.c --- binutils-2.11.90.0.31/opcodes/ia64-gen.c Fri Mar 23 13:52:28 2001 +++ binutils-2.11.92.0.5/opcodes/ia64-gen.c Mon Oct 1 15:25:26 2001 @@ -1,5 +1,5 @@ /* ia64-gen.c -- Generate a shrunk set of opcode tables - Copyright 1999, 2000 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001 Free Software Foundation, Inc. Written by Bob Manson, Cygnus Solutions, This file is part of GDB, GAS, and the GNU binutils. @@ -35,10 +35,10 @@ */ #include -#include #include "ansidecl.h" #include "libiberty.h" +#include "safe-ctype.h" #include "sysdep.h" #include "ia64-opc.h" #include "ia64-opc-a.c" @@ -543,7 +543,7 @@ load_insn_classes() if (fgets (buf, sizeof(buf), fp) == NULL) break; - while (isspace(buf[strlen(buf)-1])) + while (ISSPACE (buf[strlen(buf)-1])) buf[strlen(buf)-1] = '\0'; name = tmp = buf; @@ -571,7 +571,7 @@ load_insn_classes() char *subname; int sub; - while (*tmp && isspace(*tmp)) + while (*tmp && ISSPACE (*tmp)) { ++tmp; if (tmp == buf + sizeof(buf)) @@ -633,7 +633,7 @@ parse_resource_users(ref, usersp, nusers int create = 0; char *name; - while (isspace(*tmp)) + while (ISSPACE (*tmp)) ++tmp; name = tmp; while (*tmp && *tmp != ',') @@ -754,7 +754,7 @@ load_depfile (const char *filename, enum if (fgets (buf, sizeof(buf), fp) == NULL) break; - while (isspace(buf[strlen(buf)-1])) + while (ISSPACE (buf[strlen(buf)-1])) buf[strlen(buf)-1] = '\0'; name = tmp = buf; @@ -762,21 +762,21 @@ load_depfile (const char *filename, enum ++tmp; *tmp++ = '\0'; - while (isspace (*tmp)) + while (ISSPACE (*tmp)) ++tmp; regp = tmp; tmp = strchr (tmp, ';'); if (!tmp) abort (); *tmp++ = 0; - while (isspace (*tmp)) + while (ISSPACE (*tmp)) ++tmp; chkp = tmp; tmp = strchr (tmp, ';'); if (!tmp) abort (); *tmp++ = 0; - while (isspace (*tmp)) + while (ISSPACE (*tmp)) ++tmp; semantics = parse_semantics (tmp); extra = semantics == IA64_DVS_OTHER ? xstrdup (tmp) : NULL; diff -uprN binutils-2.11.90.0.31/opcodes/m32r-asm.c binutils-2.11.92.0.5/opcodes/m32r-asm.c --- binutils-2.11.90.0.31/opcodes/m32r-asm.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/opcodes/m32r-asm.c Mon Oct 1 15:25:26 2001 @@ -26,23 +26,28 @@ along with this program; if not, write t Keep that in mind. */ #include "sysdep.h" -#include #include #include "ansidecl.h" +#include "safe-ctype.h" #include "bfd.h" #include "symcat.h" #include "m32r-desc.h" #include "m32r-opc.h" #include "opintl.h" #include "xregex.h" +#include "libiberty.h" #undef min #define min(a,b) ((a) < (b) ? (a) : (b)) #undef max #define max(a,b) ((a) > (b) ? (a) : (b)) -static const char * parse_insn_normal - PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *, const char **, CGEN_FIELDS *)); +static const char * parse_insn_normal PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *, const char **, CGEN_FIELDS *)); +static const char * parse_hash PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *)); +static const char * parse_hi16 PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *)); +static const char * parse_slo16 PARAMS ((CGEN_CPU_DESC, const char **, int, long *)); +static const char * parse_ulo16 PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *)); + const char * m32r_cgen_parse_operand PARAMS ((CGEN_CPU_DESC, int, const char **, CGEN_FIELDS *)); /* -- assembler routines inserted here */ @@ -52,10 +57,10 @@ static const char * parse_insn_normal static const char * parse_hash (cd, strp, opindex, valuep) - CGEN_CPU_DESC cd; + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; const char **strp; - int opindex; - unsigned long *valuep; + int opindex ATTRIBUTE_UNUSED; + unsigned long *valuep ATTRIBUTE_UNUSED; { if (**strp == '#') ++*strp; @@ -352,7 +357,7 @@ char * m32r_cgen_build_insn_regex (insn) CGEN_INSN *insn; { - CGEN_OPCODE *opc = CGEN_INSN_OPCODE (insn); + CGEN_OPCODE *opc = (CGEN_OPCODE *) CGEN_INSN_OPCODE (insn); const char *mnem = CGEN_INSN_MNEMONIC (insn); int mnem_len; char rxbuf[CGEN_MAX_RX_ELEMENTS]; @@ -469,14 +474,14 @@ parse_insn_normal (cd, insn, strp, field GAS's input scrubber will ensure mnemonics are lowercase, but we may not be called from GAS. */ p = CGEN_INSN_MNEMONIC (insn); - while (*p && tolower (*p) == tolower (*str)) + while (*p && TOLOWER (*p) == TOLOWER (*str)) ++p, ++str; if (* p) return _("unrecognized instruction"); #ifndef CGEN_MNEMONIC_OPERANDS - if (* str && !isspace (* str)) + if (* str && !ISSPACE (* str)) return _("unrecognized instruction"); #endif @@ -505,7 +510,7 @@ parse_insn_normal (cd, insn, strp, field first char after the mnemonic part is a space. */ /* FIXME: We also take inappropriate advantage of the fact that GAS's input scrubber will remove extraneous blanks. */ - if (tolower (*str) == tolower (CGEN_SYNTAX_CHAR (* syn))) + if (TOLOWER (*str) == TOLOWER (CGEN_SYNTAX_CHAR (* syn))) { #ifdef CGEN_MNEMONIC_OPERANDS if (CGEN_SYNTAX_CHAR(* syn) == ' ') @@ -552,7 +557,7 @@ parse_insn_normal (cd, insn, strp, field blanks now. IE: We needn't try again with a longer version of the insn and it is assumed that longer versions of insns appear before shorter ones (eg: lsr r2,r3,1 vs lsr r2,r3). */ - while (isspace (* str)) + while (ISSPACE (* str)) ++ str; if (* str != '\0') @@ -601,7 +606,7 @@ m32r_cgen_assemble_insn (cd, str, fields int recognized_mnemonic = 0; /* Skip leading white space. */ - while (isspace (* str)) + while (ISSPACE (* str)) ++ str; /* The instructions are stored in hashed lists. diff -uprN binutils-2.11.90.0.31/opcodes/m32r-desc.c binutils-2.11.92.0.5/opcodes/m32r-desc.c --- binutils-2.11.90.0.31/opcodes/m32r-desc.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/opcodes/m32r-desc.c Mon Oct 1 15:25:26 2001 @@ -23,7 +23,6 @@ with this program; if not, write to the */ #include "sysdep.h" -#include #include #include #include "ansidecl.h" @@ -34,6 +33,13 @@ with this program; if not, write to the #include "opintl.h" #include "libiberty.h" +static void init_tables PARAMS ((void)); +static const CGEN_MACH * lookup_mach_via_bfd_name PARAMS ((const CGEN_MACH *, const char *)); +static void build_hw_table PARAMS ((CGEN_CPU_TABLE *)); +static void build_ifield_table PARAMS ((CGEN_CPU_TABLE *)); +static void build_operand_table PARAMS ((CGEN_CPU_TABLE *)); +static void build_insn_table PARAMS ((CGEN_CPU_TABLE *)); +static void m32r_cgen_rebuild_tables PARAMS ((CGEN_CPU_TABLE *)); /* Attributes. */ static const CGEN_ATTR_ENTRY bool_attr[] = diff -uprN binutils-2.11.90.0.31/opcodes/m32r-dis.c binutils-2.11.92.0.5/opcodes/m32r-dis.c --- binutils-2.11.90.0.31/opcodes/m32r-dis.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/opcodes/m32r-dis.c Mon Oct 1 15:25:26 2001 @@ -47,10 +47,17 @@ static void print_keyword static void print_insn_normal PARAMS ((CGEN_CPU_DESC, PTR, const CGEN_INSN *, CGEN_FIELDS *, bfd_vma, int)); -static int print_insn PARAMS ((CGEN_CPU_DESC, bfd_vma, - disassemble_info *, char *, int)); -static int default_print_insn +static int print_insn + PARAMS ((CGEN_CPU_DESC, bfd_vma, disassemble_info *, char *, int)); +static void print_hash + PARAMS ((CGEN_CPU_DESC, PTR, long, unsigned, bfd_vma, int)); +static int my_print_insn PARAMS ((CGEN_CPU_DESC, bfd_vma, disassemble_info *)); +void m32r_cgen_print_operand + PARAMS ((CGEN_CPU_DESC, int, PTR, CGEN_FIELDS *, void const *, bfd_vma, int)); +static int read_insn + PARAMS ((CGEN_CPU_DESC, bfd_vma, disassemble_info *, char *, int, + CGEN_EXTRACT_INFO *, unsigned long *)); /* -- disassembler routines inserted here */ @@ -68,12 +75,12 @@ do { \ static void print_hash (cd, dis_info, value, attrs, pc, length) - CGEN_CPU_DESC cd; + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; PTR dis_info; - long value; - unsigned int attrs; - bfd_vma pc; - int length; + long value ATTRIBUTE_UNUSED; + unsigned int attrs ATTRIBUTE_UNUSED; + bfd_vma pc ATTRIBUTE_UNUSED; + int length ATTRIBUTE_UNUSED; { disassemble_info *info = (disassemble_info *) dis_info; (*info->fprintf_func) (info->stream, "#"); @@ -156,7 +163,7 @@ m32r_cgen_print_operand (cd, opindex, xi int opindex; PTR xinfo; CGEN_FIELDS *fields; - void const *attrs; + void const *attrs ATTRIBUTE_UNUSED; bfd_vma pc; int length; { @@ -264,7 +271,7 @@ m32r_cgen_init_dis (cd) static void print_normal (cd, dis_info, value, attrs, pc, length) #ifdef CGEN_PRINT_NORMAL - CGEN_CPU_DESC cd; + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; #else CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; #endif @@ -272,8 +279,8 @@ print_normal (cd, dis_info, value, attrs long value; unsigned int attrs; #ifdef CGEN_PRINT_NORMAL - bfd_vma pc; - int length; + bfd_vma pc ATTRIBUTE_UNUSED; + int length ATTRIBUTE_UNUSED; #else bfd_vma pc ATTRIBUTE_UNUSED; int length ATTRIBUTE_UNUSED; @@ -299,7 +306,7 @@ print_normal (cd, dis_info, value, attrs static void print_address (cd, dis_info, value, attrs, pc, length) #ifdef CGEN_PRINT_NORMAL - CGEN_CPU_DESC cd; + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; #else CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; #endif @@ -307,8 +314,8 @@ print_address (cd, dis_info, value, attr bfd_vma value; unsigned int attrs; #ifdef CGEN_PRINT_NORMAL - bfd_vma pc; - int length; + bfd_vma pc ATTRIBUTE_UNUSED; + int length ATTRIBUTE_UNUSED; #else bfd_vma pc ATTRIBUTE_UNUSED; int length ATTRIBUTE_UNUSED; @@ -397,7 +404,7 @@ print_insn_normal (cd, dis_info, insn, f Returns 0 if all is well, non-zero otherwise. */ static int read_insn (cd, pc, info, buf, buflen, ex_info, insn_value) - CGEN_CPU_DESC cd; + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; bfd_vma pc; disassemble_info *info; char *buf; @@ -475,8 +482,8 @@ print_insn (cd, pc, info, buf, buflen) /* Base size may exceed this instruction's size. Extract the relevant part from the buffer. */ - if ((CGEN_INSN_BITSIZE (insn) / 8) < buflen && - (CGEN_INSN_BITSIZE (insn) / 8) <= sizeof (unsigned long)) + if ((CGEN_INSN_BITSIZE (insn) / 8) < buflen + && (unsigned) (CGEN_INSN_BITSIZE (insn) / 8) <= sizeof (unsigned long)) insn_value_cropped = bfd_get_bits (buf, CGEN_INSN_BITSIZE (insn), info->endian == BFD_ENDIAN_BIG); else @@ -491,8 +498,8 @@ print_insn (cd, pc, info, buf, buflen) /* Make sure the entire insn is loaded into insn_value, if it can fit. */ - if (CGEN_INSN_BITSIZE (insn) > cd->base_insn_bitsize && - (CGEN_INSN_BITSIZE (insn) / 8) <= sizeof (unsigned long)) + if ((unsigned) CGEN_INSN_BITSIZE (insn) > cd->base_insn_bitsize + && ((unsigned) CGEN_INSN_BITSIZE (insn) / 8) <= sizeof (unsigned long)) { unsigned long full_insn_value; int rc = read_insn (cd, pc, info, buf, @@ -530,7 +537,9 @@ print_insn (cd, pc, info, buf, buflen) #ifndef CGEN_PRINT_INSN #define CGEN_PRINT_INSN default_print_insn -#endif + +static int default_print_insn + PARAMS ((CGEN_CPU_DESC, bfd_vma, disassemble_info *)); static int default_print_insn (cd, pc, info) @@ -561,6 +570,7 @@ default_print_insn (cd, pc, info) return print_insn (cd, pc, info, buf, buflen); } +#endif /* Main entry point. Print one instruction from PC on INFO->STREAM. diff -uprN binutils-2.11.90.0.31/opcodes/m32r-ibld.c binutils-2.11.92.0.5/opcodes/m32r-ibld.c --- binutils-2.11.90.0.31/opcodes/m32r-ibld.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/opcodes/m32r-ibld.c Mon Oct 1 15:25:26 2001 @@ -25,7 +25,6 @@ along with this program; if not, write t Keep that in mind. */ #include "sysdep.h" -#include #include #include "ansidecl.h" #include "dis-asm.h" @@ -59,7 +58,18 @@ static int extract_insn_normal CGEN_INSN_INT, CGEN_FIELDS *, bfd_vma)); static void put_insn_int_value PARAMS ((CGEN_CPU_DESC, CGEN_INSN_BYTES_PTR, int, int, CGEN_INSN_INT)); - +const char * m32r_cgen_insert_operand + PARAMS ((CGEN_CPU_DESC, int, CGEN_FIELDS *, CGEN_INSN_BYTES_PTR, bfd_vma)); +int m32r_cgen_extract_operand + PARAMS ((CGEN_CPU_DESC, int, CGEN_EXTRACT_INFO *, CGEN_INSN_INT, CGEN_FIELDS *, bfd_vma)); +int m32r_cgen_get_int_operand + PARAMS ((CGEN_CPU_DESC, int, const CGEN_FIELDS *)); +bfd_vma m32r_cgen_get_vma_operand + PARAMS ((CGEN_CPU_DESC, int, const CGEN_FIELDS *)); +void m32r_cgen_set_int_operand + PARAMS ((CGEN_CPU_DESC, int, CGEN_FIELDS *, int)); +void m32r_cgen_set_vma_operand + PARAMS ((CGEN_CPU_DESC, int, CGEN_FIELDS *, bfd_vma)); /* Operand insertion. */ @@ -798,7 +808,7 @@ cgen_extract_fn * const m32r_cgen_extrac int m32r_cgen_get_int_operand (cd, opindex, fields) - CGEN_CPU_DESC cd; + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; int opindex; const CGEN_FIELDS * fields; { @@ -888,7 +898,7 @@ m32r_cgen_get_int_operand (cd, opindex, bfd_vma m32r_cgen_get_vma_operand (cd, opindex, fields) - CGEN_CPU_DESC cd; + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; int opindex; const CGEN_FIELDS * fields; { @@ -983,7 +993,7 @@ m32r_cgen_get_vma_operand (cd, opindex, void m32r_cgen_set_int_operand (cd, opindex, fields, value) - CGEN_CPU_DESC cd; + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; int opindex; CGEN_FIELDS * fields; int value; @@ -1069,7 +1079,7 @@ m32r_cgen_set_int_operand (cd, opindex, void m32r_cgen_set_vma_operand (cd, opindex, fields, value) - CGEN_CPU_DESC cd; + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; int opindex; CGEN_FIELDS * fields; bfd_vma value; diff -uprN binutils-2.11.90.0.31/opcodes/m32r-opc.c binutils-2.11.92.0.5/opcodes/m32r-opc.c --- binutils-2.11.90.0.31/opcodes/m32r-opc.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/opcodes/m32r-opc.c Mon Oct 1 15:25:26 2001 @@ -33,10 +33,11 @@ with this program; if not, write to the /* The hash functions are recorded here to help keep assembler code out of the disassembler and vice versa. */ -static int asm_hash_insn_p PARAMS ((const CGEN_INSN *)); -static unsigned int asm_hash_insn PARAMS ((const char *)); -static int dis_hash_insn_p PARAMS ((const CGEN_INSN *)); -static unsigned int dis_hash_insn PARAMS ((const char *, CGEN_INSN_INT)); +static int asm_hash_insn_p PARAMS ((const CGEN_INSN *)); +static unsigned int asm_hash_insn PARAMS ((const char *)); +static int dis_hash_insn_p PARAMS ((const CGEN_INSN *)); +static unsigned int dis_hash_insn PARAMS ((const char *, CGEN_INSN_INT)); +static void set_fields_bitsize PARAMS ((CGEN_FIELDS *, int)); /* Instruction formats. */ @@ -1601,7 +1602,7 @@ static const CGEN_OPCODE m32r_cgen_macro static int asm_hash_insn_p (insn) - const CGEN_INSN *insn; + const CGEN_INSN *insn ATTRIBUTE_UNUSED; { return CGEN_ASM_HASH_P (insn); } @@ -1652,7 +1653,7 @@ asm_hash_insn (mnem) static unsigned int dis_hash_insn (buf, value) const char * buf; - CGEN_INSN_INT value; + CGEN_INSN_INT value ATTRIBUTE_UNUSED; { return CGEN_DIS_HASH (buf, value); } diff -uprN binutils-2.11.90.0.31/opcodes/m32r-opinst.c binutils-2.11.92.0.5/opcodes/m32r-opinst.c --- binutils-2.11.90.0.31/opcodes/m32r-opinst.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/opcodes/m32r-opinst.c Mon Oct 1 15:25:26 2001 @@ -36,9 +36,9 @@ with this program; if not, write to the #else #define OP_ENT(op) M32R_OPERAND_/**/op #endif -#define INPUT CGEN_OPINST_INPUT -#define OUTPUT CGEN_OPINST_OUTPUT -#define END CGEN_OPINST_END +#define INPUT CGEN_OPINST_INPUT +#define OUTPUT CGEN_OPINST_OUTPUT +#define END CGEN_OPINST_END, "", 0, 0, 0, 0, 0 #define COND_REF CGEN_OPINST_COND_REF static const CGEN_OPINST sfmt_empty_ops[] = { diff -uprN binutils-2.11.90.0.31/opcodes/mips-dis.c binutils-2.11.92.0.5/opcodes/mips-dis.c --- binutils-2.11.90.0.31/opcodes/mips-dis.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/opcodes/mips-dis.c Mon Oct 1 15:25:26 2001 @@ -369,26 +369,23 @@ mips_isa_type (mach, isa, cputype) *cputype = CPU_MIPS16; *isa = ISA_MIPS3; break; - case bfd_mach_mips32: - *cputype = CPU_MIPS32; - *isa = ISA_MIPS32; - break; - case bfd_mach_mips32_4k: - *cputype = CPU_MIPS32_4K; - *isa = ISA_MIPS32; - break; case bfd_mach_mips5: *cputype = CPU_MIPS5; *isa = ISA_MIPS5; break; - case bfd_mach_mips64: - *cputype = CPU_MIPS64; - *isa = ISA_MIPS64; - break; case bfd_mach_mips_sb1: *cputype = CPU_SB1; *isa = ISA_MIPS64; break; + case bfd_mach_mipsisa32: + * cputype = CPU_MIPS32; + * isa = ISA_MIPS32; + break; + case bfd_mach_mipsisa64: + * cputype = CPU_MIPS64; + * isa = ISA_MIPS64; + break; + default: *cputype = CPU_R3000; *isa = ISA_MIPS3; diff -uprN binutils-2.11.90.0.31/opcodes/ns32k-dis.c binutils-2.11.92.0.5/opcodes/ns32k-dis.c --- binutils-2.11.90.0.31/opcodes/ns32k-dis.c Mon Aug 27 11:44:52 2001 +++ binutils-2.11.92.0.5/opcodes/ns32k-dis.c Mon Oct 1 15:25:26 2001 @@ -635,20 +635,20 @@ print_insn_arg (d, ioffset, aoffsetp, bu break; case 'W': Ivalue = bit_extract (buffer, *aoffsetp, 16); - flip_bytes (&Ivalue, 2); + flip_bytes ((char *) & Ivalue, 2); *aoffsetp += 16; Ivalue = sign_extend (Ivalue, 16); sprintf (result, "$%d", Ivalue); break; case 'D': Ivalue = bit_extract (buffer, *aoffsetp, 32); - flip_bytes (&Ivalue, 4); + flip_bytes ((char *) & Ivalue, 4); *aoffsetp += 32; sprintf (result, "$%d", Ivalue); break; case 'F': bit_copy (buffer, *aoffsetp, 32, (char *) &Fvalue); - flip_bytes (&Fvalue, 4); + flip_bytes ((char *) & Fvalue, 4); *aoffsetp += 32; if (INVALID_FLOAT (&Fvalue, 4)) sprintf (result, "<>", *(int *) &Fvalue); @@ -657,7 +657,7 @@ print_insn_arg (d, ioffset, aoffsetp, bu break; case 'L': bit_copy (buffer, *aoffsetp, 64, (char *) &Lvalue); - flip_bytes (&Lvalue, 8); + flip_bytes ((char *) & Lvalue, 8); *aoffsetp += 64; if (INVALID_FLOAT (&Lvalue, 8)) sprintf (result, "<>", @@ -840,13 +840,13 @@ get_displacement (buffer, aoffsetp) break; case 0x80: Ivalue2 = bit_extract (buffer, *aoffsetp, 16); - flip_bytes (&Ivalue2, 2); + flip_bytes ((char *) & Ivalue2, 2); Ivalue = sign_extend (Ivalue2, 14); *aoffsetp += 16; break; case 0xc0: Ivalue = bit_extract (buffer, *aoffsetp, 32); - flip_bytes (&Ivalue, 4); + flip_bytes ((char *) & Ivalue, 4); Ivalue = sign_extend (Ivalue, 30); *aoffsetp += 32; break; diff -uprN binutils-2.11.90.0.31/opcodes/openrisc-asm.c binutils-2.11.92.0.5/opcodes/openrisc-asm.c --- binutils-2.11.90.0.31/opcodes/openrisc-asm.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/opcodes/openrisc-asm.c Mon Oct 1 15:25:26 2001 @@ -26,15 +26,16 @@ along with this program; if not, write t Keep that in mind. */ #include "sysdep.h" -#include #include #include "ansidecl.h" +#include "safe-ctype.h" #include "bfd.h" #include "symcat.h" #include "openrisc-desc.h" #include "openrisc-opc.h" #include "opintl.h" #include "xregex.h" +#include "libiberty.h" #undef min #define min(a,b) ((a) < (b) ? (a) : (b)) @@ -43,6 +44,14 @@ along with this program; if not, write t static const char * parse_insn_normal PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *, const char **, CGEN_FIELDS *)); +long openrisc_sign_extend_16bit + PARAMS ((long)); +static const char * parse_hi16 + PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *)); +static const char * parse_lo16 + PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *)); +const char * openrisc_cgen_parse_operand + PARAMS ((CGEN_CPU_DESC, int, const char **, CGEN_FIELDS *)); /* -- assembler routines inserted here */ @@ -101,7 +110,7 @@ parse_hi16 (cd, strp, opindex, valuep) if (**strp == '-') errmsg = cgen_parse_signed_integer (cd, strp, opindex, (long *) &value); else - errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, &value); + errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, (unsigned long *) &value); } *valuep = (long) (short) (value & 0xffff); return errmsg; @@ -151,7 +160,7 @@ parse_lo16 (cd, strp, opindex, valuep) if (**strp == '-') errmsg = cgen_parse_signed_integer (cd, strp, opindex, (long *) &value); else - errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, &value); + errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, (unsigned long *) &value); *valuep = (long) (short) (value & 0xffff); return errmsg; } @@ -181,7 +190,7 @@ openrisc_cgen_parse_operand (cd, opindex { const char * errmsg = NULL; /* Used by scalar operands that still need to be parsed. */ - long junk; + long junk ATTRIBUTE_UNUSED; switch (opindex) { @@ -276,7 +285,7 @@ char * openrisc_cgen_build_insn_regex (insn) CGEN_INSN *insn; { - CGEN_OPCODE *opc = CGEN_INSN_OPCODE (insn); + CGEN_OPCODE *opc = (CGEN_OPCODE *) CGEN_INSN_OPCODE (insn); const char *mnem = CGEN_INSN_MNEMONIC (insn); int mnem_len; char rxbuf[CGEN_MAX_RX_ELEMENTS]; @@ -393,14 +402,14 @@ parse_insn_normal (cd, insn, strp, field GAS's input scrubber will ensure mnemonics are lowercase, but we may not be called from GAS. */ p = CGEN_INSN_MNEMONIC (insn); - while (*p && tolower (*p) == tolower (*str)) + while (*p && TOLOWER (*p) == TOLOWER (*str)) ++p, ++str; if (* p) return _("unrecognized instruction"); #ifndef CGEN_MNEMONIC_OPERANDS - if (* str && !isspace (* str)) + if (* str && !ISSPACE (* str)) return _("unrecognized instruction"); #endif @@ -429,7 +438,7 @@ parse_insn_normal (cd, insn, strp, field first char after the mnemonic part is a space. */ /* FIXME: We also take inappropriate advantage of the fact that GAS's input scrubber will remove extraneous blanks. */ - if (tolower (*str) == tolower (CGEN_SYNTAX_CHAR (* syn))) + if (TOLOWER (*str) == TOLOWER (CGEN_SYNTAX_CHAR (* syn))) { #ifdef CGEN_MNEMONIC_OPERANDS if (CGEN_SYNTAX_CHAR(* syn) == ' ') @@ -476,7 +485,7 @@ parse_insn_normal (cd, insn, strp, field blanks now. IE: We needn't try again with a longer version of the insn and it is assumed that longer versions of insns appear before shorter ones (eg: lsr r2,r3,1 vs lsr r2,r3). */ - while (isspace (* str)) + while (ISSPACE (* str)) ++ str; if (* str != '\0') @@ -525,7 +534,7 @@ openrisc_cgen_assemble_insn (cd, str, fi int recognized_mnemonic = 0; /* Skip leading white space. */ - while (isspace (* str)) + while (ISSPACE (* str)) ++ str; /* The instructions are stored in hashed lists. diff -uprN binutils-2.11.90.0.31/opcodes/openrisc-desc.c binutils-2.11.92.0.5/opcodes/openrisc-desc.c --- binutils-2.11.90.0.31/opcodes/openrisc-desc.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/opcodes/openrisc-desc.c Mon Oct 1 15:25:26 2001 @@ -23,7 +23,6 @@ with this program; if not, write to the */ #include "sysdep.h" -#include #include #include #include "ansidecl.h" @@ -34,6 +33,13 @@ with this program; if not, write to the #include "opintl.h" #include "libiberty.h" +static void init_tables PARAMS ((void)); +static const CGEN_MACH * lookup_mach_via_bfd_name PARAMS ((const CGEN_MACH *, const char *)); +static void build_hw_table PARAMS ((CGEN_CPU_TABLE *)); +static void build_ifield_table PARAMS ((CGEN_CPU_TABLE *)); +static void build_operand_table PARAMS ((CGEN_CPU_TABLE *)); +static void build_insn_table PARAMS ((CGEN_CPU_TABLE *)); +static void openrisc_cgen_rebuild_tables PARAMS ((CGEN_CPU_TABLE *)); /* Attributes. */ static const CGEN_ATTR_ENTRY bool_attr[] = diff -uprN binutils-2.11.90.0.31/opcodes/openrisc-dis.c binutils-2.11.92.0.5/opcodes/openrisc-dis.c --- binutils-2.11.90.0.31/opcodes/openrisc-dis.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/opcodes/openrisc-dis.c Mon Oct 1 15:25:26 2001 @@ -51,6 +51,10 @@ static int print_insn PARAMS ((CGEN_CPU_ disassemble_info *, char *, int)); static int default_print_insn PARAMS ((CGEN_CPU_DESC, bfd_vma, disassemble_info *)); +void openrisc_cgen_print_operand + PARAMS ((CGEN_CPU_DESC, int, PTR, CGEN_FIELDS *, void const *, bfd_vma, int)); +static int read_insn + PARAMS ((CGEN_CPU_DESC, bfd_vma, disassemble_info *, char *, int, CGEN_EXTRACT_INFO *, unsigned long *)); /* -- disassembler routines inserted here */ @@ -77,7 +81,7 @@ openrisc_cgen_print_operand (cd, opindex int opindex; PTR xinfo; CGEN_FIELDS *fields; - void const *attrs; + void const *attrs ATTRIBUTE_UNUSED; bfd_vma pc; int length; { @@ -288,7 +292,7 @@ print_insn_normal (cd, dis_info, insn, f Returns 0 if all is well, non-zero otherwise. */ static int read_insn (cd, pc, info, buf, buflen, ex_info, insn_value) - CGEN_CPU_DESC cd; + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; bfd_vma pc; disassemble_info *info; char *buf; @@ -367,7 +371,7 @@ print_insn (cd, pc, info, buf, buflen) /* Base size may exceed this instruction's size. Extract the relevant part from the buffer. */ if ((CGEN_INSN_BITSIZE (insn) / 8) < buflen && - (CGEN_INSN_BITSIZE (insn) / 8) <= sizeof (unsigned long)) + ((unsigned) CGEN_INSN_BITSIZE (insn) / 8) <= sizeof (unsigned long)) insn_value_cropped = bfd_get_bits (buf, CGEN_INSN_BITSIZE (insn), info->endian == BFD_ENDIAN_BIG); else @@ -382,8 +386,8 @@ print_insn (cd, pc, info, buf, buflen) /* Make sure the entire insn is loaded into insn_value, if it can fit. */ - if (CGEN_INSN_BITSIZE (insn) > cd->base_insn_bitsize && - (CGEN_INSN_BITSIZE (insn) / 8) <= sizeof (unsigned long)) + if ( (unsigned) CGEN_INSN_BITSIZE (insn) > cd->base_insn_bitsize && + ((unsigned) CGEN_INSN_BITSIZE (insn) / 8) <= sizeof (unsigned long)) { unsigned long full_insn_value; int rc = read_insn (cd, pc, info, buf, diff -uprN binutils-2.11.90.0.31/opcodes/openrisc-ibld.c binutils-2.11.92.0.5/opcodes/openrisc-ibld.c --- binutils-2.11.90.0.31/opcodes/openrisc-ibld.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/opcodes/openrisc-ibld.c Mon Oct 1 15:25:26 2001 @@ -25,7 +25,6 @@ along with this program; if not, write t Keep that in mind. */ #include "sysdep.h" -#include #include #include "ansidecl.h" #include "dis-asm.h" @@ -59,7 +58,18 @@ static int extract_insn_normal CGEN_INSN_INT, CGEN_FIELDS *, bfd_vma)); static void put_insn_int_value PARAMS ((CGEN_CPU_DESC, CGEN_INSN_BYTES_PTR, int, int, CGEN_INSN_INT)); - +const char * openrisc_cgen_insert_operand + PARAMS ((CGEN_CPU_DESC, int, CGEN_FIELDS *, CGEN_INSN_BYTES_PTR, bfd_vma)); +int openrisc_cgen_extract_operand + PARAMS ((CGEN_CPU_DESC, int, CGEN_EXTRACT_INFO *, CGEN_INSN_INT, CGEN_FIELDS *, bfd_vma)); +int openrisc_cgen_get_int_operand + PARAMS ((CGEN_CPU_DESC, int, const CGEN_FIELDS *)); +bfd_vma openrisc_cgen_get_vma_operand + PARAMS ((CGEN_CPU_DESC, int, const CGEN_FIELDS *)); +void openrisc_cgen_set_int_operand + PARAMS ((CGEN_CPU_DESC, int, CGEN_FIELDS *, int)); +void openrisc_cgen_set_vma_operand + PARAMS ((CGEN_CPU_DESC, int, CGEN_FIELDS *, bfd_vma)); /* Operand insertion. */ @@ -703,6 +713,8 @@ openrisc_cgen_extract_operand (cd, opind length = extract_normal (cd, ex_info, insn_value, 0, 0, 25, 5, 32, total_length, pc, & fields->f_i16_2); if (length <= 0) break; { + extern long openrisc_sign_extend_16bit PARAMS ((long)); + FLD (f_i16nc) = openrisc_sign_extend_16bit (((((FLD (f_i16_2)) << (11))) | (FLD (f_i16_1)))); } } @@ -741,7 +753,7 @@ cgen_extract_fn * const openrisc_cgen_ex int openrisc_cgen_get_int_operand (cd, opindex, fields) - CGEN_CPU_DESC cd; + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; int opindex; const CGEN_FIELDS * fields; { @@ -801,7 +813,7 @@ openrisc_cgen_get_int_operand (cd, opind bfd_vma openrisc_cgen_get_vma_operand (cd, opindex, fields) - CGEN_CPU_DESC cd; + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; int opindex; const CGEN_FIELDS * fields; { @@ -866,7 +878,7 @@ openrisc_cgen_get_vma_operand (cd, opind void openrisc_cgen_set_int_operand (cd, opindex, fields, value) - CGEN_CPU_DESC cd; + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; int opindex; CGEN_FIELDS * fields; int value; @@ -923,7 +935,7 @@ openrisc_cgen_set_int_operand (cd, opind void openrisc_cgen_set_vma_operand (cd, opindex, fields, value) - CGEN_CPU_DESC cd; + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; int opindex; CGEN_FIELDS * fields; bfd_vma value; diff -uprN binutils-2.11.90.0.31/opcodes/openrisc-opc.c binutils-2.11.92.0.5/opcodes/openrisc-opc.c --- binutils-2.11.90.0.31/opcodes/openrisc-opc.c Wed Aug 22 08:52:10 2001 +++ binutils-2.11.92.0.5/opcodes/openrisc-opc.c Mon Oct 1 15:25:26 2001 @@ -35,10 +35,11 @@ with this program; if not, write to the /* The hash functions are recorded here to help keep assembler code out of the disassembler and vice versa. */ -static int asm_hash_insn_p PARAMS ((const CGEN_INSN *)); -static unsigned int asm_hash_insn PARAMS ((const char *)); -static int dis_hash_insn_p PARAMS ((const CGEN_INSN *)); -static unsigned int dis_hash_insn PARAMS ((const char *, CGEN_INSN_INT)); +static int asm_hash_insn_p PARAMS ((const CGEN_INSN *)); +static unsigned int asm_hash_insn PARAMS ((const char *)); +static int dis_hash_insn_p PARAMS ((const CGEN_INSN *)); +static unsigned int dis_hash_insn PARAMS ((const char *, CGEN_INSN_INT)); +static void set_fields_bitsize PARAMS ((CGEN_FIELDS *, int)); /* Instruction formats. */ @@ -594,7 +595,7 @@ static const CGEN_OPCODE openrisc_cgen_m static int asm_hash_insn_p (insn) - const CGEN_INSN *insn; + const CGEN_INSN *insn ATTRIBUTE_UNUSED; { return CGEN_ASM_HASH_P (insn); } @@ -645,7 +646,7 @@ asm_hash_insn (mnem) static unsigned int dis_hash_insn (buf, value) const char * buf; - CGEN_INSN_INT value; + CGEN_INSN_INT value ATTRIBUTE_UNUSED; { return CGEN_DIS_HASH (buf, value); } diff -uprN binutils-2.11.90.0.31/opcodes/pdp11-dis.c binutils-2.11.92.0.5/opcodes/pdp11-dis.c --- binutils-2.11.90.0.31/opcodes/pdp11-dis.c Mon Feb 19 14:21:52 2001 +++ binutils-2.11.92.0.5/opcodes/pdp11-dis.c Mon Oct 1 15:25:26 2001 @@ -15,6 +15,7 @@ You should have received a copy of the G along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "sysdep.h" #include "dis-asm.h" #include "opcode/pdp11.h" diff -uprN binutils-2.11.90.0.31/opcodes/po/POTFILES.in binutils-2.11.92.0.5/opcodes/po/POTFILES.in --- binutils-2.11.90.0.31/opcodes/po/POTFILES.in Fri Apr 27 13:48:39 2001 +++ binutils-2.11.92.0.5/opcodes/po/POTFILES.in Thu Oct 4 14:35:43 2001 @@ -16,8 +16,8 @@ d10v-dis.c d10v-opc.c d30v-dis.c d30v-opc.c -disassemble.c dis-buf.c +disassemble.c fr30-asm.c fr30-desc.c fr30-desc.h @@ -40,12 +40,12 @@ ia64-dis.c ia64-gen.c ia64-opc-a.c ia64-opc-b.c -ia64-opc.c ia64-opc-d.c ia64-opc-f.c -ia64-opc.h ia64-opc-i.c ia64-opc-m.c +ia64-opc.c +ia64-opc.h m10200-dis.c m10200-opc.c m10300-dis.c @@ -65,9 +65,9 @@ m68k-opc.c m88k-dis.c mcore-dis.c mcore-opc.h -mips16-opc.c mips-dis.c mips-opc.c +mips16-opc.c ns32k-dis.c openrisc-asm.c openrisc-desc.c @@ -83,6 +83,7 @@ pj-opc.c ppc-dis.c ppc-opc.c s390-dis.c +s390-mkopc.c s390-opc.c sh-dis.c sh-opc.h @@ -100,5 +101,5 @@ vax-dis.c w65-dis.c w65-opc.h z8k-dis.c -z8kgen.c z8k-opc.h +z8kgen.c diff -uprN binutils-2.11.90.0.31/opcodes/ppc-opc.c binutils-2.11.92.0.5/opcodes/ppc-opc.c --- binutils-2.11.90.0.31/opcodes/ppc-opc.c Thu Aug 30 09:30:37 2001 +++ binutils-2.11.92.0.5/opcodes/ppc-opc.c Mon Oct 1 15:25:26 2001 @@ -1153,10 +1153,10 @@ extract_tbr (insn, invalid) #define VX_MASK VX(0x3f, 0x7ff) /* An VA form instruction. */ -#define VXA(op, xop) (OP (op) | (((unsigned long)(xop)) & 0x07f)) +#define VXA(op, xop) (OP (op) | (((unsigned long)(xop)) & 0x03f)) /* The mask for an VA form instruction. */ -#define VXA_MASK VXA(0x3f, 0x7f) +#define VXA_MASK VXA(0x3f, 0x3f) /* An VXR form instruction. */ #define VXR(op, xop, rc) (OP (op) | (((rc) & 1) << 10) | (((unsigned long)(xop)) & 0x3ff)) diff -uprN binutils-2.11.90.0.31/opcodes/s390-mkopc.c binutils-2.11.92.0.5/opcodes/s390-mkopc.c --- binutils-2.11.90.0.31/opcodes/s390-mkopc.c Thu Mar 15 14:52:14 2001 +++ binutils-2.11.92.0.5/opcodes/s390-mkopc.c Mon Oct 1 15:25:26 2001 @@ -32,45 +32,48 @@ #define ARCHBITS_ESA 3 #define ARCHBITS_ESAME 2 -struct op_struct { - char opcode[16]; - char mnemonic[16]; - char format[16]; - int archbits; - unsigned long long sort_value; - int no_nibbles; -}; +struct op_struct + { + char opcode[16]; + char mnemonic[16]; + char format[16]; + int archbits; + unsigned long long sort_value; + int no_nibbles; + }; struct op_struct *op_array; int max_ops; int no_ops; static void -createTable(void) +createTable (void) { - max_ops = 256; - op_array = malloc(max_ops*sizeof(struct op_struct)); - no_ops = 0; + max_ops = 256; + op_array = malloc (max_ops * sizeof (struct op_struct)); + no_ops = 0; } -/* - * `insertOpcode': insert an op_struct into sorted opcode array - */ +/* `insertOpcode': insert an op_struct into sorted opcode array. */ + static void -insertOpcode(char *opcode, char *mnemonic, char *format, int archbits) +insertOpcode (char *opcode, char *mnemonic, char *format, int archbits) { - char *str; - unsigned long long sort_value; - int no_nibbles; - int ix, k; - - while (no_ops >= max_ops) { - max_ops = max_ops*2; - op_array = realloc(op_array, max_ops*sizeof(struct op_struct)); + char *str; + unsigned long long sort_value; + int no_nibbles; + int ix, k; + + while (no_ops >= max_ops) + { + max_ops = max_ops * 2; + op_array = realloc (op_array, max_ops * sizeof (struct op_struct)); } - sort_value = 0; - str = opcode; - for (ix = 0; ix < 16; ix++) { + + sort_value = 0; + str = opcode; + for (ix = 0; ix < 16; ix++) + { if (*str >= '0' && *str <= '9') sort_value = (sort_value << 4) + (*str - '0'); else if (*str >= 'a' && *str <= 'f') @@ -81,67 +84,80 @@ insertOpcode(char *opcode, char *mnemoni sort_value <<= 4; else break; - str++; + str ++; } - sort_value <<= 4*(16 - ix); - no_nibbles = ix; - for (ix = 0; ix < no_ops; ix++) - if (sort_value > op_array[ix].sort_value) - break; - for (k = no_ops; k > ix; k--) - op_array[k] = op_array[k-1]; - strcpy(op_array[ix].opcode, opcode); - strcpy(op_array[ix].mnemonic, mnemonic); - strcpy(op_array[ix].format, format); - op_array[ix].sort_value = sort_value; - op_array[ix].no_nibbles = no_nibbles; - op_array[ix].archbits = archbits; - no_ops++; + sort_value <<= 4*(16 - ix); + no_nibbles = ix; + for (ix = 0; ix < no_ops; ix++) + if (sort_value > op_array[ix].sort_value) + break; + for (k = no_ops; k > ix; k--) + op_array[k] = op_array[k-1]; + strcpy(op_array[ix].opcode, opcode); + strcpy(op_array[ix].mnemonic, mnemonic); + strcpy(op_array[ix].format, format); + op_array[ix].sort_value = sort_value; + op_array[ix].no_nibbles = no_nibbles; + op_array[ix].archbits = archbits; + no_ops++; } +static char file_header[] = + "/* The opcode table. This file was generated by s390-mkopc.\n\n" + " The format of the opcode table is:\n\n" + " NAME OPCODE MASK OPERANDS\n\n" + " Name is the name of the instruction.\n" + " OPCODE is the instruction opcode.\n" + " MASK is the opcode mask; this is used to tell the disassembler\n" + " which bits in the actual opcode must match OPCODE.\n" + " OPERANDS is the list of operands.\n\n" + " The disassembler reads the table in order and prints the first\n" + " instruction which matches. */\n\n" + "const struct s390_opcode s390_opcodes[] =\n {\n"; + +/* `dumpTable': write opcode table. */ -/* - * `dumpTable': write opcode table - */ static void -dumpTable(void) +dumpTable (void) { - char *str; - int ix; + char *str; + int ix; + + /* Write hash table entries (slots). */ + printf (file_header); - /* Write hash table entries (slots). */ - printf("const struct s390_opcode s390_opcodes[] = {\n"); - for (ix = 0; ix < no_ops; ix++) { - printf(" { \"%s\", ", op_array[ix].mnemonic); + for (ix = 0; ix < no_ops; ix++) + { + printf (" { \"%s\", ", op_array[ix].mnemonic); for (str = op_array[ix].opcode; *str != 0; str++) if (*str == '?') *str = '0'; - printf("OP%i(0x%sLL), ", - op_array[ix].no_nibbles*4, op_array[ix].opcode); - printf("MASK_%s, INSTR_%s, ", - op_array[ix].format, op_array[ix].format); - printf("%i}", op_array[ix].archbits); + printf ("OP%i(0x%sLL), ", + op_array[ix].no_nibbles*4, op_array[ix].opcode); + printf ("MASK_%s, INSTR_%s, ", + op_array[ix].format, op_array[ix].format); + printf ("%i}", op_array[ix].archbits); if (ix < no_ops-1) - printf(",\n"); + printf (",\n"); else - printf("\n"); + printf ("\n"); } - printf("};\n\n"); - printf("const int s390_num_opcodes =\n"); - printf(" sizeof (s390_opcodes) / sizeof (s390_opcodes[0]);\n\n"); + printf ("};\n\n"); + printf ("const int s390_num_opcodes =\n"); + printf (" sizeof (s390_opcodes) / sizeof (s390_opcodes[0]);\n\n"); } - int -main(void) +main (void) { - char currentLine[256]; - - createTable(); - /* Read opcode descriptions from `stdin'. For each mnemonic, - * make an entry into the opcode table. - */ - while (fgets(currentLine, sizeof(currentLine), stdin) != NULL) { + char currentLine[256]; + + createTable (); + + /* Read opcode descriptions from `stdin'. For each mnemonic, + make an entry into the opcode table. */ + while (fgets (currentLine, sizeof (currentLine), stdin) != NULL) + { char opcode[16]; char mnemonic[16]; char format[16]; @@ -151,22 +167,24 @@ main(void) if (currentLine[0] == '#') continue; - memset(opcode, 0, 8); - if (sscanf(currentLine, "%15s %15s %15s \"%[^\"]\" %15s", - opcode, mnemonic, format, description, archtag) == 5) { - if (strcmp(archtag, "esaonly") == 0) - archbits = ARCHBITS_ESAONLY; - else if (strcmp(archtag, "esa") == 0) - archbits = ARCHBITS_ESA; - else if (strcmp(archtag, "esame") == 0) - archbits = ARCHBITS_ESAME; - else - archbits = 0; - insertOpcode(opcode, mnemonic, format, archbits); - } else - fprintf(stderr, "Couldn't scan line %s\n", currentLine); + memset (opcode, 0, 8); + if (sscanf (currentLine, "%15s %15s %15s \"%[^\"]\" %15s", + opcode, mnemonic, format, description, archtag) == 5) + { + if (strcmp (archtag, "esaonly") == 0) + archbits = ARCHBITS_ESAONLY; + else if (strcmp (archtag, "esa") == 0) + archbits = ARCHBITS_ESA; + else if (strcmp (archtag, "esame") == 0) + archbits = ARCHBITS_ESAME; + else + archbits = 0; + insertOpcode (opcode, mnemonic, format, archbits); + } + else + fprintf (stderr, "Couldn't scan line %s\n", currentLine); } - dumpTable(); - return 0; + dumpTable (); + return 0; } diff -uprN binutils-2.11.90.0.31/opcodes/s390-opc.c binutils-2.11.92.0.5/opcodes/s390-opc.c --- binutils-2.11.90.0.31/opcodes/s390-opc.c Mon Aug 27 11:44:52 2001 +++ binutils-2.11.92.0.5/opcodes/s390-opc.c Mon Oct 1 15:25:26 2001 @@ -131,863 +131,188 @@ const struct s390_operand s390_operands[ /* Macros used to form opcodes. */ -/* 8/16/48 bit opcodes */ +/* 8/16/48 bit opcodes. */ #define OP8(x) { x, 0x00, 0x00, 0x00, 0x00, 0x00 } #define OP16(x) { x >> 8, x & 255, 0x00, 0x00, 0x00, 0x00 } #define OP48(x) { x >> 40, (x >> 32) & 255, (x >> 24) & 255, \ (x >> 16) & 255, (x >> 8) & 255, x & 255} -#define INSTR_E 2, { 0,0,0,0,0,0 } /* e.g. pr */ -#define INSTR_RR 2, { R_8,R_12,0,0,0,0 } /* e.g. lr */ -#define INSTR_RR_M 2, { U4_8,R_12,0,0,0,0 } /* e.g. bcr */ -#define INSTR_RR_B 2, { R_12, 0,0,0,0,0 } /* e.g. br */ -#define INSTR_RR_I 2, { U8_8, 0,0,0,0,0 } /* e.g. svc */ -#define INSTR_RR_R 2, { R_8, 0,0,0,0,0 } /* e.g. spm */ -#define INSTR_RR_E 2, { R_8,R_12,0,0,0,0 } /* e.g. aer */ -#define INSTR_RR_D 2, { F_8,F_12,0,0,0,0 } /* e.g. adr */ -#define INSTR_RR_X 2, { R_8,R_12,0,0,0,0 } /* e.g. mxr */ -#define INSTR_RR_ED 2, { F_8,F_12,0,0,0,0 } /* e.g. mer */ -#define INSTR_RR_DE 2, { F_8,F_12,0,0,0,0 } /* e.g. lrer */ -#define INSTR_RR_DX 2, { F_8,F_12,0,0,0,0 } /* e.g. mxdr */ -#define INSTR_RR_XD 2, { F_8,F_12,0,0,0,0 } /* e.g. lrdr */ -#define INSTR_RRE 4, { R_24,R_28,0,0,0,0 } /* e.g. lura */ -#define INSTR_RRE_A 4, { A_24,A_28,0,0,0,0 } /* e.g. cpya */ -#define INSTR_RRE_F 4, { F_24,F_28,0,0,0,0 } /* e.g. debr */ -#define INSTR_RRE_O 4, { 0,0,0,0,0,0 } /* e.g. palb */ -#define INSTR_RRE_R 4, { R_24,0,0,0,0,0 } /* e.g. ipm */ -#define INSTR_RRE_R2 4, { R_28,0,0,0,0,0 } /* e.g. tb */ -#define INSTR_RRE_E 4, { F_24,0,0,0,0,0 } /* e.g. sqer */ -#define INSTR_RRE_D 4, { F_24,0,0,0,0,0 } /* e.g. sqdr */ -#define INSTR_RRE_X 4, { F_24,0,0,0,0,0 } /* e.g. dxr */ -#define INSTR_RRE_AR 4, { A_24,R_28,0,0,0,0 } /* e.g. sar */ -#define INSTR_RRE_RA 4, { R_24,A_28,0,0,0,0 } /* e.g. ear */ -#define INSTR_RRF_M 4, { R_24,U4_16,R_28,0,0,0 } /* e.g. cfxbr*/ -#define INSTR_RRF_RM 4, { R_24,R_16,R_28,U4_20,0,0 } /* e.g. didbr*/ -#define INSTR_RRF_R 4, { R_16,R_24,R_28,0,0,0 } /* e.g. madbr*/ -#define INSTR_RRF_F 4, { F_16,F_24,F_28,0,0,0 } /* e.g. madbr*/ -#define INSTR_RS 4, { R_8,R_12,D_20,B_16,0,0 } /* e.g. cs */ -#define INSTR_RS_A 4, { A_8,A_12,D_20,B_16,0,0 } /* e.g. lam */ -#define INSTR_RS_C 4, { C_8,C_12,D_20,B_16,0,0 } /* e.g. lctl */ -#define INSTR_RS_M 4, { R_8,U4_12,D_20,B_16,0,0 } /* e.g. icm */ -#define INSTR_RS_S 4, { R_8,D_20,B_16,0,0,0 } /* e.g. sll */ -#define INSTR_RS_D 4, { R_8,D_20,B_16,0,0,0 } /* e.g. sldl */ -#define INSTR_RX 4, { R_8,D_20,X_12,B_16,0,0 } /* e.g. l */ -#define INSTR_RX_M 4, { U4_8,D_20,X_12,B_16,0,0 } /* e.g. bc */ -#define INSTR_RX_B 4, { D_20,X_12,B_16,0,0,0 } /* e.g. b */ -#define INSTR_RX_E 4, { F_8,D_20,X_12,B_16,0,0 } /* e.g. ae */ -#define INSTR_RX_D 4, { F_8,D_20,X_12,B_16,0,0 } /* e.g. ad */ -#define INSTR_RX_ED 4, { F_8,D_20,X_12,B_16,0,0 } /* e.g. me */ -#define INSTR_RX_DX 4, { F_8,D_20,X_12,B_16,0,0 } /* e.g. mxd */ -#define INSTR_RXE 6, { R_8,D_20,X_12,B_16,0,0 } /* e.g. agr */ -#define INSTR_RXE_F 6, { F_8,D_20,X_12,B_16,0,0 } /* e.g. axbr */ -#define INSTR_RXF 6, { F_32,D_20,X_12,B_16,F_8,0 } /* e.g. madb */ -#define INSTR_S 4, { D_20,B_16,0,0,0,0 } /* e.g. lpsw */ -#define INSTR_S_O 4, { 0,0,0,0,0,0 } /* e.g. hsch */ -#define INSTR_SI 4, { D_20,B_16,U8_8,0,0,0 } /* e.g. cli */ -#define INSTR_SS_RR 6, { D_20,R_8,B_16,D_36,B_32,R_12 } /* e.g. mvck */ -#define INSTR_SS_LL 6, { D_20,L4_8,B_16,D_36,L4_12,B_32 } /* e.g. pack */ -#define INSTR_SS_LI 6, { D_20,L4_8,B_16,D_36,B_32,U4_12 } /* e.g. srp */ -#define INSTR_SS_L 6, { D_20,L8_8,B_16,D_36,B_32,0 } /* e.g. mvc */ -#define INSTR_SS_LMD 6, { R_8,R_12,D_20,B_16,D_36,B_32 } /* e.g. lmd */ -#define INSTR_SS_PLO 6, { R_8,D_20,B_16,R_12,D_36,B_32 } /* e.g. plo */ -#define INSTR_SSE 6, { D_20,B_16,D_36,B_32,0,0 } /* e.g. mvsdk */ -#define INSTR_RI 4, { R_8,I16_16,0,0,0,0 } /* e.g. ahi */ -#define INSTR_RI_U 4, { R_8,U16_16,0,0,0,0 } /* e.g. tml */ -#define INSTR_RI_A 4, { R_8,J16_16,0,0,0,0 } /* e.g. brct */ -#define INSTR_RI_MA 4, { U4_8,J16_16,0,0,0 } /* e.g. brc */ -#define INSTR_RI_B 4, { J16_16,0,0,0,0 } /* e.g. j */ -#define INSTR_RSI_A 4, { R_8,R_12,J16_16,0,0,0 } /* e.g. brxh */ -#define INSTR_RSE 6, { R_8,D_20,B_16,R_12,0,0 } /* e.g. lmg */ -#define INSTR_RSE_M 6, { R_8,U4_12,D_20,B_16,0,0 } /* e.g. icmh */ -#define INSTR_RSE_R 6, { R_8,R_12,D_20,B_16,0,0 } /* e.g. lmh */ -#define INSTR_RIE_A 6, { R_8,J16_16,R_12,0,0,0 } /* e.g. brxhg */ -#define INSTR_RIL_A 6, { R_8,J32_16,0,0,0,0 } /* e.g. brasl */ -#define INSTR_RIL_B 6, { J32_16,0,0,0,0,0 } /* e.g. jg */ -#define INSTR_RIL_MA 6, { R_8,J32_16,0,0,0,0 } /* e.g. brcl */ - -#define MASK_E { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RR { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RR_M { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RR_B { 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RR_I { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RR_R { 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RR_E { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RR_D { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RR_X { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RR_ED { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RR_DE { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RR_DX { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RR_XD { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RRE { 0xff, 0xff, 0xff, 0x00, 0x00, 0x00 } -#define MASK_RRE_A { 0xff, 0xff, 0xff, 0x00, 0x00, 0x00 } -#define MASK_RRE_F { 0xff, 0xff, 0xff, 0x00, 0x00, 0x00 } -#define MASK_RRE_O { 0xff, 0xff, 0xff, 0xff, 0x00, 0x00 } -#define MASK_RRE_R { 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00 } -#define MASK_RRE_R2 { 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00 } -#define MASK_RRE_E { 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00 } -#define MASK_RRE_D { 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00 } -#define MASK_RRE_X { 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00 } -#define MASK_RRE_AR { 0xff, 0xff, 0xff, 0x00, 0x00, 0x00 } -#define MASK_RRE_RA { 0xff, 0xff, 0xff, 0x00, 0x00, 0x00 } -#define MASK_RRF_M { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RRF_RM { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RRF_R { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RRF_F { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RS { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RS_A { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RS_C { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RS_M { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RS_S { 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RS_D { 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RX { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RX_M { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RX_B { 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RX_E { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RX_D { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RX_ED { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RX_DX { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RXE { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff } -#define MASK_RXE_F { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff } -#define MASK_RXF { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff } -#define MASK_S { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } -#define MASK_S_O { 0xff, 0xff, 0xff, 0xff, 0x00, 0x00 } -#define MASK_SI { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } -#define MASK_SS_RR { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } -#define MASK_SS_LL { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } -#define MASK_SS_LI { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } -#define MASK_SS_L { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } -#define MASK_SS_LMD { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } -#define MASK_SS_PLO { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } -#define MASK_SSE { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RI { 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RI_U { 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RI_A { 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RI_MA { 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RI_B { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RSI_A { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RSE { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff } -#define MASK_RSE_M { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff } -#define MASK_RSE_R { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff } -#define MASK_RIE_A { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff } -#define MASK_RIL_A { 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RIL_B { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RIL_M { 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00 } -#define MASK_RIL_MA { 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00 } +/* The new format of the INSTR_x_y and MASK_x_y defines is based + on the following rules: + 1) the middle part of the definition (x in INSTR_x_y) is the official + names of the instruction format that you can find in the principals + of operation. + 2) the last part of the definition (y in INSTR_x_y) gives you an idea + which operands the binary represenation of the instruction has. + The meanings of the letters in y are: + a - access register + c - control register + d - displacement, 12 bit + f - floating pointer register + i - signed integer, 4 or 8 bit + l - length, 4 or 8 bit + p - pc relative + r - general purpose register + u - unsigned integer, 4 or 8 bit + 0 - operand skipped. + The order of the letters reflects the layout of the format in + storage and not the order of the paramaters of the instructions. + The use of the letters is not a 100% match with the PoP but it is + quite close. + + For example the instruction "mvo" is defined in the PoP as follows: + + MVO D1(L1,B1),D2(L2,B2) [SS] + + -------------------------------------- + | 'F1' | L1 | L2 | B1 | D1 | B2 | D2 | + -------------------------------------- + 0 8 12 16 20 32 36 + + The instruction format is: INSTR_SS_LLRDRD / MASK_SS_LLRDRD. */ + +#define INSTR_E 2, { 0,0,0,0,0,0 } /* e.g. pr */ +#define INSTR_RIE_RRP 6, { R_8,R_12,J16_16,0,0,0 } /* e.g. brxhg */ +#define INSTR_RIL_0P 6, { J32_16,0,0,0,0 } /* e.g. jg */ +#define INSTR_RIL_RP 6, { R_8,J32_16,0,0,0,0 } /* e.g. brasl */ +#define INSTR_RIL_UP 6, { U4_8,J32_16,0,0,0,0 } /* e.g. brcl */ +#define INSTR_RI_0P 4, { J16_16,0,0,0,0,0 } /* e.g. j */ +#define INSTR_RI_RI 4, { R_8,I16_16,0,0,0,0 } /* e.g. ahi */ +#define INSTR_RI_RP 4, { R_8,J16_16,0,0,0,0 } /* e.g. brct */ +#define INSTR_RI_RU 4, { R_8,U16_16,0,0,0,0 } /* e.g. tml */ +#define INSTR_RI_UP 4, { U4_8,J16_16,0,0,0,0 } /* e.g. brc */ +#define INSTR_RRE_00 4, { 0,0,0,0,0,0 } /* e.g. palb */ +#define INSTR_RRE_0R 4, { R_28,0,0,0,0,0 } /* e.g. tb */ +#define INSTR_RRE_AA 4, { A_24,A_28,0,0,0,0 } /* e.g. cpya */ +#define INSTR_RRE_AR 4, { A_24,R_28,0,0,0,0 } /* e.g. sar */ +#define INSTR_RRE_F0 4, { F_24,0,0,0,0,0 } /* e.g. sqer */ +#define INSTR_RRE_FF 4, { F_24,F_28,0,0,0,0 } /* e.g. debr */ +#define INSTR_RRE_R0 4, { R_24,0,0,0,0,0 } /* e.g. ipm */ +#define INSTR_RRE_RA 4, { R_24,A_28,0,0,0,0 } /* e.g. ear */ +#define INSTR_RRE_RF 4, { R_24,F_28,0,0,0,0 } /* e.g. cefbr */ +#define INSTR_RRE_RR 4, { R_24,R_28,0,0,0,0 } /* e.g. lura */ +#define INSTR_RRF_F0FF 4, { F_16,F_24,F_28,0,0,0 } /* e.g. madbr */ +#define INSTR_RRF_FUFF 4, { F_24,F_16,F_28,U4_20,0,0 } /* e.g. didbr */ +#define INSTR_RRF_RURR 4, { R_24,R_28,R_16,U4_20,0,0 } /* e.g. .insn */ +#define INSTR_RRF_U0FF 4, { F_24,U4_16,F_28,0,0,0 } /* e.g. cfxbr */ +#define INSTR_RRF_U0FR 4, { F_24,U4_16,R_28,0,0,0 } /* e.g. cfebr */ +#define INSTR_RRF_U0FR 4, { F_24,U4_16,R_28,0,0,0 } /* e.g. cfxbr */ +#define INSTR_RR_0R 2, { R_12, 0,0,0,0,0 } /* e.g. br */ +#define INSTR_RR_FF 2, { F_8,F_12,0,0,0,0 } /* e.g. adr */ +#define INSTR_RR_R0 2, { R_8, 0,0,0,0,0 } /* e.g. spm */ +#define INSTR_RR_RR 2, { R_8,R_12,0,0,0,0 } /* e.g. lr */ +#define INSTR_RR_U0 2, { U8_8, 0,0,0,0,0 } /* e.g. svc */ +#define INSTR_RR_UR 2, { U4_8,R_12,0,0,0,0 } /* e.g. bcr */ +#define INSTR_RSE_RRRD 6, { R_8,R_12,D_20,B_16,0,0 } /* e.g. lmh */ +#define INSTR_RSE_RURD 6, { R_8,U4_12,D_20,B_16,0,0 } /* e.g. icmh */ +#define INSTR_RSI_RRP 4, { R_8,R_12,J16_16,0,0,0 } /* e.g. brxh */ +#define INSTR_RS_AARD 4, { A_8,A_12,D_20,B_16,0,0 } /* e.g. lam */ +#define INSTR_RS_CCRD 4, { C_8,C_12,D_20,B_16,0,0 } /* e.g. lctl */ +#define INSTR_RS_R0RD 4, { R_8,D_20,B_16,0,0,0 } /* e.g. sll */ +#define INSTR_RS_RRRD 4, { R_8,R_12,D_20,B_16,0,0 } /* e.g. cs */ +#define INSTR_RS_RURD 4, { R_8,U4_12,D_20,B_16,0,0 } /* e.g. icm */ +#define INSTR_RXE_FRRD 6, { F_8,D_20,X_12,B_16,0,0 } /* e.g. axbr */ +#define INSTR_RXE_RRRD 6, { R_8,D_20,X_12,B_16,0,0 } /* e.g. lg */ +#define INSTR_RXF_FRRDF 6, { F_32,F_8,D_20,X_12,B_16,0 } /* e.g. madb */ +#define INSTR_RXF_RRRDR 6, { R_32,R_8,D_20,X_12,B_16,0 } /* e.g. .insn */ +#define INSTR_RX_0RRD 4, { D_20,X_12,B_16,0,0,0 } /* e.g. be */ +#define INSTR_RX_FRRD 4, { F_8,D_20,X_12,B_16,0,0 } /* e.g. ae */ +#define INSTR_RX_RRRD 4, { R_8,D_20,X_12,B_16,0,0 } /* e.g. l */ +#define INSTR_RX_URRD 4, { U4_8,D_20,X_12,B_16,0,0 } /* e.g. bc */ +#define INSTR_SI_URD 4, { D_20,B_16,U8_8,0,0,0 } /* e.g. cli */ +#define INSTR_SSE_RDRD 6, { D_20,B_16,D_36,B_32,0,0 } /* e.g. mvsdk */ +#define INSTR_SS_L0RDRD 6, { D_20,L8_8,B_16,D_36,B_32,0 } /* e.g. mvc */ +#define INSTR_SS_LIRDRD 6, { D_20,L4_8,B_16,D_36,B_32,U4_12 } /* e.g. srp */ +#define INSTR_SS_LLRDRD 6, { D_20,L4_8,B_16,D_36,L4_12,B_32 } /* e.g. pack */ +#define INSTR_SS_RRRDRD 6, { D_20,R_8,B_16,D_36,B_32,R_12 } /* e.g. mvck */ +#define INSTR_SS_RRRDRD2 6, { R_8,D_20,B_16,R_12,D_36,B_32 } /* e.g. plo */ +#define INSTR_SS_RRRDRD3 6, { R_8,R_12,D_20,B_16,D_36,B_32 } /* e.g. lmd */ +#define INSTR_S_00 4, { 0,0,0,0,0,0 } /* e.g. hsch */ +#define INSTR_S_RD 4, { D_20,B_16,0,0,0,0 } /* e.g. lpsw */ + +#define MASK_E { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } +#define MASK_RIE_RRP { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff } +#define MASK_RIL_0P { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } +#define MASK_RIL_RP { 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00 } +#define MASK_RIL_UP { 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00 } +#define MASK_RI_0P { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } +#define MASK_RI_RI { 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00 } +#define MASK_RI_RP { 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00 } +#define MASK_RI_RU { 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00 } +#define MASK_RI_UP { 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00 } +#define MASK_RRE_00 { 0xff, 0xff, 0xff, 0xff, 0x00, 0x00 } +#define MASK_RRE_0R { 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00 } +#define MASK_RRE_AA { 0xff, 0xff, 0xff, 0x00, 0x00, 0x00 } +#define MASK_RRE_AR { 0xff, 0xff, 0xff, 0x00, 0x00, 0x00 } +#define MASK_RRE_F0 { 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00 } +#define MASK_RRE_FF { 0xff, 0xff, 0xff, 0x00, 0x00, 0x00 } +#define MASK_RRE_R0 { 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00 } +#define MASK_RRE_RA { 0xff, 0xff, 0xff, 0x00, 0x00, 0x00 } +#define MASK_RRE_RF { 0xff, 0xff, 0xff, 0x00, 0x00, 0x00 } +#define MASK_RRE_RR { 0xff, 0xff, 0xff, 0x00, 0x00, 0x00 } +#define MASK_RRF_F0FF { 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00 } +#define MASK_RRF_FUFF { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } +#define MASK_RRF_RURR { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } +#define MASK_RRF_U0FF { 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00 } +#define MASK_RRF_U0FR { 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00 } +#define MASK_RRF_U0FR { 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00 } +#define MASK_RR_0R { 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00 } +#define MASK_RR_FF { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } +#define MASK_RR_R0 { 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00 } +#define MASK_RR_RR { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } +#define MASK_RR_U0 { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } +#define MASK_RR_UR { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } +#define MASK_RSE_RRRD { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff } +#define MASK_RSE_RURD { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff } +#define MASK_RSI_RRP { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } +#define MASK_RS_AARD { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } +#define MASK_RS_CCRD { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } +#define MASK_RS_R0RD { 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00 } +#define MASK_RS_RRRD { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } +#define MASK_RS_RURD { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } +#define MASK_RXE_FRRD { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff } +#define MASK_RXE_RRRD { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff } +#define MASK_RXF_FRRDF { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff } +#define MASK_RXF_RRRDR { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff } +#define MASK_RX_0RRD { 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00 } +#define MASK_RX_FRRD { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } +#define MASK_RX_RRRD { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } +#define MASK_RX_URRD { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } +#define MASK_SI_URD { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } +#define MASK_SSE_RDRD { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } +#define MASK_SS_L0RDRD { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } +#define MASK_SS_LIRDRD { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } +#define MASK_SS_LLRDRD { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } +#define MASK_SS_RRRDRD { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } +#define MASK_SS_RRRDRD2 { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } +#define MASK_SS_RRRDRD3 { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } +#define MASK_S_00 { 0xff, 0xff, 0xff, 0xff, 0x00, 0x00 } +#define MASK_S_RD { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } -/* The opcode formats table (blueprints for .insn pseudo mnemonic). */ +/* The opcode formats table (blueprints for .insn pseudo mnemonic). */ const struct s390_opcode s390_opformats[] = { { "e", OP8(0x00LL), MASK_E, INSTR_E, 3 }, - { "ri", OP8(0x00LL), MASK_RI, INSTR_RI, 3 }, - { "ri_a", OP8(0x00LL), MASK_RI_A, INSTR_RI_A, 3 }, - { "ri_b", OP8(0x00LL), MASK_RI_B, INSTR_RI_B, 3 }, - { "ri_ma", OP8(0x00LL), MASK_RI_MA, INSTR_RI_MA, 3 }, - { "ri_u", OP8(0x00LL), MASK_RI_U, INSTR_RI_U, 3 }, - { "rie_a", OP8(0x00LL), MASK_RIE_A, INSTR_RIE_A, 3 }, - { "ril_a", OP8(0x00LL), MASK_RIL_A, INSTR_RIL_A, 3 }, - { "ril_b", OP8(0x00LL), MASK_RIL_B, INSTR_RIL_B, 3 }, - { "ril_ma", OP8(0x00LL), MASK_RIL_MA, INSTR_RIL_MA, 3 }, - { "rr", OP8(0x00LL), MASK_RR, INSTR_RR, 3 }, - { "rr_b", OP8(0x00LL), MASK_RR_B, INSTR_RR_B, 3 }, - { "rr_d", OP8(0x00LL), MASK_RR_D, INSTR_RR_D, 3 }, - { "rr_de", OP8(0x00LL), MASK_RR_DE, INSTR_RR_DE, 3 }, - { "rr_dx", OP8(0x00LL), MASK_RR_DX, INSTR_RR_DX, 3 }, - { "rr_e", OP8(0x00LL), MASK_RR_E, INSTR_RR_E, 3 }, - { "rr_ed", OP8(0x00LL), MASK_RR_ED, INSTR_RR_ED, 3 }, - { "rr_i", OP8(0x00LL), MASK_RR_I, INSTR_RR_I, 3 }, - { "rr_m", OP8(0x00LL), MASK_RR_M, INSTR_RR_M, 3 }, - { "rr_r", OP8(0x00LL), MASK_RR_R, INSTR_RR_R, 3 }, - { "rr_x", OP8(0x00LL), MASK_RR_X, INSTR_RR_X, 3 }, - { "rr_xd", OP8(0x00LL), MASK_RR_XD, INSTR_RR_XD, 3 }, - { "rre", OP8(0x00LL), MASK_RRE, INSTR_RRE, 3 }, - { "rre_a", OP8(0x00LL), MASK_RRE_A, INSTR_RRE_A, 3 }, - { "rre_ar", OP8(0x00LL), MASK_RRE_AR, INSTR_RRE_AR, 3 }, - { "rre_d", OP8(0x00LL), MASK_RRE_D, INSTR_RRE_D, 3 }, - { "rre_e", OP8(0x00LL), MASK_RRE_E, INSTR_RRE_E, 3 }, - { "rre_f", OP8(0x00LL), MASK_RRE_F, INSTR_RRE_F, 3 }, - { "rre_o", OP8(0x00LL), MASK_RRE_O, INSTR_RRE_O, 3 }, - { "rre_r", OP8(0x00LL), MASK_RRE_R, INSTR_RRE_R, 3 }, - { "rre_r2", OP8(0x00LL), MASK_RRE_R2, INSTR_RRE_R2, 3 }, - { "rre_ra", OP8(0x00LL), MASK_RRE_RA, INSTR_RRE_RA, 3 }, - { "rre_x", OP8(0x00LL), MASK_RRE_X, INSTR_RRE_X, 3 }, - { "rrf_f", OP8(0x00LL), MASK_RRF_F, INSTR_RRF_F, 3 }, - { "rrf_m", OP8(0x00LL), MASK_RRF_M, INSTR_RRF_M, 3 }, - { "rrf_r", OP8(0x00LL), MASK_RRF_R, INSTR_RRF_R, 3 }, - { "rrf_rm", OP8(0x00LL), MASK_RRF_RM, INSTR_RRF_RM, 3 }, - { "rs", OP8(0x00LL), MASK_RS, INSTR_RS, 3 }, - { "rs_a", OP8(0x00LL), MASK_RS_A, INSTR_RS_A, 3 }, - { "rs_c", OP8(0x00LL), MASK_RS_C, INSTR_RS_C, 3 }, - { "rs_d", OP8(0x00LL), MASK_RS_D, INSTR_RS_D, 3 }, - { "rs_m", OP8(0x00LL), MASK_RS_M, INSTR_RS_M, 3 }, - { "rs_s", OP8(0x00LL), MASK_RS_S, INSTR_RS_S, 3 }, - { "rse", OP8(0x00LL), MASK_RSE, INSTR_RSE, 3 }, - { "rse_m", OP8(0x00LL), MASK_RSE_M, INSTR_RSE_M, 3 }, - { "rse_r", OP8(0x00LL), MASK_RSE_R, INSTR_RSE_R, 3 }, - { "rsi_a", OP8(0x00LL), MASK_RSI_A, INSTR_RSI_A, 3 }, - { "rx", OP8(0x00LL), MASK_RX, INSTR_RX, 3 }, - { "rx_b", OP8(0x00LL), MASK_RX_B, INSTR_RX_B, 3 }, - { "rx_d", OP8(0x00LL), MASK_RX_D, INSTR_RX_D, 3 }, - { "rx_dx", OP8(0x00LL), MASK_RX_DX, INSTR_RX_DX, 3 }, - { "rx_e", OP8(0x00LL), MASK_RX_E, INSTR_RX_E, 3 }, - { "rx_ed", OP8(0x00LL), MASK_RX_ED, INSTR_RX_ED, 3 }, - { "rx_m", OP8(0x00LL), MASK_RX_M, INSTR_RX_M, 3 }, - { "rxe", OP8(0x00LL), MASK_RXE, INSTR_RXE, 3 }, - { "rxe_f", OP8(0x00LL), MASK_RXE_F, INSTR_RXE_F, 3 }, - { "rxf", OP8(0x00LL), MASK_RXF, INSTR_RXF, 3 }, - { "s", OP8(0x00LL), MASK_S, INSTR_S, 3 }, - { "si", OP8(0x00LL), MASK_SI, INSTR_SI, 3 }, - { "ss_l", OP8(0x00LL), MASK_SS_L, INSTR_SS_L, 3 }, - { "ss_li", OP8(0x00LL), MASK_SS_LI, INSTR_SS_LI, 3 }, - { "ss_ll", OP8(0x00LL), MASK_SS_LL, INSTR_SS_LL, 3 }, - { "ss_lmd", OP8(0x00LL), MASK_SS_LMD, INSTR_SS_LMD, 3 }, - { "ss_plo", OP8(0x00LL), MASK_SS_PLO, INSTR_SS_PLO, 3 }, - { "ss_rr", OP8(0x00LL), MASK_SS_RR, INSTR_SS_RR, 3 }, - { "sse", OP8(0x00LL), MASK_SSE, INSTR_SSE, 3 }, + { "ri", OP8(0x00LL), MASK_RI_RI, INSTR_RI_RI, 3 }, + { "rie", OP8(0x00LL), MASK_RIE_RRP, INSTR_RIE_RRP, 3 }, + { "ril", OP8(0x00LL), MASK_RIL_RP, INSTR_RIL_RP, 3 }, + { "rr", OP8(0x00LL), MASK_RR_RR, INSTR_RR_RR, 3 }, + { "rre", OP8(0x00LL), MASK_RRE_RR, INSTR_RRE_RR, 3 }, + { "rrf", OP8(0x00LL), MASK_RRF_RURR, INSTR_RRF_RURR, 3 }, + { "rs", OP8(0x00LL), MASK_RS_RRRD, INSTR_RS_RRRD, 3 }, + { "rse", OP8(0x00LL), MASK_RSE_RRRD, INSTR_RSE_RRRD, 3 }, + { "rsi", OP8(0x00LL), MASK_RSI_RRP, INSTR_RSI_RRP, 3 }, + { "rx", OP8(0x00LL), MASK_RX_RRRD, INSTR_RX_RRRD, 3 }, + { "rxe", OP8(0x00LL), MASK_RXE_RRRD, INSTR_RXE_RRRD, 3 }, + { "rxf", OP8(0x00LL), MASK_RXF_RRRDR, INSTR_RXF_RRRDR,3 }, + { "s", OP8(0x00LL), MASK_S_RD, INSTR_S_RD, 3 }, + { "si", OP8(0x00LL), MASK_SI_URD, INSTR_SI_URD, 3 }, + { "ss", OP8(0x00LL), MASK_SS_RRRDRD, INSTR_SS_RRRDRD,3 }, + { "sse", OP8(0x00LL), MASK_SSE_RDRD, INSTR_SSE_RDRD, 3 }, }; const int s390_num_opformats = sizeof (s390_opformats) / sizeof (s390_opformats[0]); -/* The opcode table. - - The format of the opcode table is: - - NAME OPCODE MASK OPERANDS - - NAME is the name of the instruction. - OPCODE is the instruction opcode. - MASK is the opcode mask; this is used to tell the disassembler - which bits in the actual opcode must match OPCODE. - OPERANDS is the list of operands. - - The disassembler reads the table in order and prints the first - instruction which matches. */ - -const struct s390_opcode s390_opcodes[] = - { - { "dp", OP8(0xfdLL), MASK_SS_LL, INSTR_SS_LL, 3}, - { "mp", OP8(0xfcLL), MASK_SS_LL, INSTR_SS_LL, 3}, - { "sp", OP8(0xfbLL), MASK_SS_LL, INSTR_SS_LL, 3}, - { "ap", OP8(0xfaLL), MASK_SS_LL, INSTR_SS_LL, 3}, - { "cp", OP8(0xf9LL), MASK_SS_LL, INSTR_SS_LL, 3}, - { "zap", OP8(0xf8LL), MASK_SS_LL, INSTR_SS_LL, 3}, - { "unpk", OP8(0xf3LL), MASK_SS_LL, INSTR_SS_LL, 3}, - { "pack", OP8(0xf2LL), MASK_SS_LL, INSTR_SS_LL, 3}, - { "mvo", OP8(0xf1LL), MASK_SS_LL, INSTR_SS_LL, 3}, - { "srp", OP8(0xf0LL), MASK_SS_LI, INSTR_SS_LI, 3}, - { "lmd", OP8(0xefLL), MASK_SS_LMD, INSTR_SS_LMD, 2}, - { "plo", OP8(0xeeLL), MASK_SS_PLO, INSTR_SS_PLO, 3}, - { "msdb", OP48(0xed000000001fLL), MASK_RXF, INSTR_RXF, 3}, - { "madb", OP48(0xed000000001eLL), MASK_RXF, INSTR_RXF, 3}, - { "ddb", OP48(0xed000000001dLL), MASK_RXE_F, INSTR_RXE_F, 3}, - { "mdb", OP48(0xed000000001cLL), MASK_RXE_F, INSTR_RXE_F, 3}, - { "sdb", OP48(0xed000000001bLL), MASK_RXE_F, INSTR_RXE_F, 3}, - { "adb", OP48(0xed000000001aLL), MASK_RXE_F, INSTR_RXE_F, 3}, - { "cdb", OP48(0xed0000000019LL), MASK_RXE_F, INSTR_RXE_F, 3}, - { "kdb", OP48(0xed0000000018LL), MASK_RXE_F, INSTR_RXE_F, 3}, - { "meeb", OP48(0xed0000000017LL), MASK_RXE_F, INSTR_RXE_F, 3}, - { "sqdb", OP48(0xed0000000015LL), MASK_RXE_F, INSTR_RXE_F, 3}, - { "sqeb", OP48(0xed0000000014LL), MASK_RXE_F, INSTR_RXE_F, 3}, - { "tcxb", OP48(0xed0000000012LL), MASK_RXE_F, INSTR_RXE_F, 3}, - { "tcdb", OP48(0xed0000000011LL), MASK_RXE_F, INSTR_RXE_F, 3}, - { "tceb", OP48(0xed0000000010LL), MASK_RXE_F, INSTR_RXE_F, 3}, - { "mseb", OP48(0xed000000000fLL), MASK_RXF, INSTR_RXF, 3}, - { "maeb", OP48(0xed000000000eLL), MASK_RXF, INSTR_RXF, 3}, - { "deb", OP48(0xed000000000dLL), MASK_RXE_F, INSTR_RXE_F, 3}, - { "mdeb", OP48(0xed000000000cLL), MASK_RXE_F, INSTR_RXE_F, 3}, - { "seb", OP48(0xed000000000bLL), MASK_RXE_F, INSTR_RXE_F, 3}, - { "aeb", OP48(0xed000000000aLL), MASK_RXE_F, INSTR_RXE_F, 3}, - { "ceb", OP48(0xed0000000009LL), MASK_RXE_F, INSTR_RXE_F, 3}, - { "keb", OP48(0xed0000000008LL), MASK_RXE_F, INSTR_RXE_F, 3}, - { "mxdb", OP48(0xed0000000007LL), MASK_RXE_F, INSTR_RXE_F, 3}, - { "lxeb", OP48(0xed0000000006LL), MASK_RXE_F, INSTR_RXE_F, 3}, - { "lxdb", OP48(0xed0000000005LL), MASK_RXE_F, INSTR_RXE_F, 3}, - { "ldeb", OP48(0xed0000000004LL), MASK_RXE_F, INSTR_RXE_F, 3}, - { "brxlg", OP48(0xec0000000045LL), MASK_RIE_A, INSTR_RIE_A, 2}, - { "brxhg", OP48(0xec0000000044LL), MASK_RIE_A, INSTR_RIE_A, 2}, - { "lmh", OP48(0xeb0000000096LL), MASK_RSE_R, INSTR_RSE_R, 2}, - { "mvclu", OP48(0xeb000000008eLL), MASK_RSE_R, INSTR_RSE_R, 2}, - { "icmh", OP48(0xeb0000000080LL), MASK_RSE_M, INSTR_RSE_M, 2}, - { "bxleg", OP48(0xeb0000000045LL), MASK_RSE_R, INSTR_RSE_R, 2}, - { "bxhg", OP48(0xeb0000000044LL), MASK_RSE_R, INSTR_RSE_R, 2}, - { "cdsg", OP48(0xeb000000003eLL), MASK_RSE_R, INSTR_RSE_R, 2}, - { "csg", OP48(0xeb0000000030LL), MASK_RSE_R, INSTR_RSE_R, 2}, - { "lctlg", OP48(0xeb000000002fLL), MASK_RSE_R, INSTR_RSE_R, 2}, - { "stcmh", OP48(0xeb000000002cLL), MASK_RSE_M, INSTR_RSE_M, 2}, - { "stmh", OP48(0xeb0000000026LL), MASK_RSE_R, INSTR_RSE_R, 2}, - { "stctg", OP48(0xeb0000000025LL), MASK_RSE_R, INSTR_RSE_R, 2}, - { "stmg", OP48(0xeb0000000024LL), MASK_RSE_R, INSTR_RSE_R, 2}, - { "clmh", OP48(0xeb0000000020LL), MASK_RSE_M, INSTR_RSE_M, 2}, - { "rll", OP48(0xeb000000001dLL), MASK_RSE_R, INSTR_RSE_R, 2}, - { "rllg", OP48(0xeb000000001cLL), MASK_RSE_R, INSTR_RSE_R, 2}, - { "tracg", OP48(0xeb000000000fLL), MASK_RSE_R, INSTR_RSE_R, 2}, - { "sllg", OP48(0xeb000000000dLL), MASK_RSE_R, INSTR_RSE_R, 2}, - { "srlg", OP48(0xeb000000000cLL), MASK_RSE_R, INSTR_RSE_R, 2}, - { "slag", OP48(0xeb000000000bLL), MASK_RSE_R, INSTR_RSE_R, 2}, - { "srag", OP48(0xeb000000000aLL), MASK_RSE_R, INSTR_RSE_R, 2}, - { "lmg", OP48(0xeb0000000004LL), MASK_RSE_R, INSTR_RSE_R, 2}, - { "unpka", OP8(0xeaLL), MASK_SS_L, INSTR_SS_L, 2}, - { "pka", OP8(0xe9LL), MASK_SS_L, INSTR_SS_L, 2}, - { "mvcin", OP8(0xe8LL), MASK_SS_L, INSTR_SS_L, 3}, - { "mvcdk", OP16(0xe50fLL), MASK_SSE, INSTR_SSE, 3}, - { "mvcsk", OP16(0xe50eLL), MASK_SSE, INSTR_SSE, 3}, - { "tprot", OP16(0xe501LL), MASK_SSE, INSTR_SSE, 3}, - { "strag", OP48(0xe50000000002LL), MASK_SSE, INSTR_SSE, 2}, - { "lasp", OP16(0xe500LL), MASK_SSE, INSTR_SSE, 3}, - { "slb", OP48(0xe30000000099LL), MASK_RXE, INSTR_RXE, 2}, - { "alc", OP48(0xe30000000098LL), MASK_RXE, INSTR_RXE, 2}, - { "dl", OP48(0xe30000000097LL), MASK_RXE, INSTR_RXE, 2}, - { "ml", OP48(0xe30000000096LL), MASK_RXE, INSTR_RXE, 2}, - { "llgh", OP48(0xe30000000091LL), MASK_RXE, INSTR_RXE, 2}, - { "llgc", OP48(0xe30000000090LL), MASK_RXE, INSTR_RXE, 2}, - { "lpq", OP48(0xe3000000008fLL), MASK_RXE, INSTR_RXE, 2}, - { "stpq", OP48(0xe3000000008eLL), MASK_RXE, INSTR_RXE, 2}, - { "slbg", OP48(0xe30000000089LL), MASK_RXE, INSTR_RXE, 2}, - { "alcg", OP48(0xe30000000088LL), MASK_RXE, INSTR_RXE, 2}, - { "dlg", OP48(0xe30000000087LL), MASK_RXE, INSTR_RXE, 2}, - { "mlg", OP48(0xe30000000086LL), MASK_RXE, INSTR_RXE, 2}, - { "xg", OP48(0xe30000000082LL), MASK_RXE, INSTR_RXE, 2}, - { "og", OP48(0xe30000000081LL), MASK_RXE, INSTR_RXE, 2}, - { "ng", OP48(0xe30000000080LL), MASK_RXE, INSTR_RXE, 2}, - { "bctg", OP48(0xe30000000046LL), MASK_RXE, INSTR_RXE, 2}, - { "strvh", OP48(0xe3000000003fLL), MASK_RXE, INSTR_RXE, 2}, - { "strv", OP48(0xe3000000003eLL), MASK_RXE, INSTR_RXE, 2}, - { "clgf", OP48(0xe30000000031LL), MASK_RXE, INSTR_RXE, 2}, - { "cgf", OP48(0xe30000000030LL), MASK_RXE, INSTR_RXE, 2}, - { "strvg", OP48(0xe3000000002fLL), MASK_RXE, INSTR_RXE, 2}, - { "cvdg", OP48(0xe3000000002eLL), MASK_RXE, INSTR_RXE, 2}, - { "stg", OP48(0xe30000000024LL), MASK_RXE, INSTR_RXE, 2}, - { "clg", OP48(0xe30000000021LL), MASK_RXE, INSTR_RXE, 2}, - { "cg", OP48(0xe30000000020LL), MASK_RXE, INSTR_RXE, 2}, - { "lrvh", OP48(0xe3000000001fLL), MASK_RXE, INSTR_RXE, 2}, - { "lrv", OP48(0xe3000000001eLL), MASK_RXE, INSTR_RXE, 2}, - { "dsgf", OP48(0xe3000000001dLL), MASK_RXE, INSTR_RXE, 2}, - { "msgf", OP48(0xe3000000001cLL), MASK_RXE, INSTR_RXE, 2}, - { "slgf", OP48(0xe3000000001bLL), MASK_RXE, INSTR_RXE, 2}, - { "algf", OP48(0xe3000000001aLL), MASK_RXE, INSTR_RXE, 2}, - { "sgf", OP48(0xe30000000019LL), MASK_RXE, INSTR_RXE, 2}, - { "agf", OP48(0xe30000000018LL), MASK_RXE, INSTR_RXE, 2}, - { "llgt", OP48(0xe30000000017LL), MASK_RXE, INSTR_RXE, 2}, - { "llgf", OP48(0xe30000000016LL), MASK_RXE, INSTR_RXE, 2}, - { "lgh", OP48(0xe30000000015LL), MASK_RXE, INSTR_RXE, 2}, - { "lgf", OP48(0xe30000000014LL), MASK_RXE, INSTR_RXE, 2}, - { "lrvg", OP48(0xe3000000000fLL), MASK_RXE, INSTR_RXE, 2}, - { "cvbg", OP48(0xe3000000000eLL), MASK_RXE, INSTR_RXE, 2}, - { "dsg", OP48(0xe3000000000dLL), MASK_RXE, INSTR_RXE, 2}, - { "msg", OP48(0xe3000000000cLL), MASK_RXE, INSTR_RXE, 2}, - { "slg", OP48(0xe3000000000bLL), MASK_RXE, INSTR_RXE, 2}, - { "alg", OP48(0xe3000000000aLL), MASK_RXE, INSTR_RXE, 2}, - { "sg", OP48(0xe30000000009LL), MASK_RXE, INSTR_RXE, 2}, - { "ag", OP48(0xe30000000008LL), MASK_RXE, INSTR_RXE, 2}, - { "lg", OP48(0xe30000000004LL), MASK_RXE, INSTR_RXE, 2}, - { "lrag", OP48(0xe30000000003LL), MASK_RXE, INSTR_RXE, 2}, - { "unpku", OP8(0xe2LL), MASK_SS_L, INSTR_SS_L, 2}, - { "pku", OP8(0xe1LL), MASK_SS_L, INSTR_SS_L, 2}, - { "edmk", OP8(0xdfLL), MASK_SS_L, INSTR_SS_L, 3}, - { "ed", OP8(0xdeLL), MASK_SS_L, INSTR_SS_L, 3}, - { "trt", OP8(0xddLL), MASK_SS_L, INSTR_SS_L, 3}, - { "tr", OP8(0xdcLL), MASK_SS_L, INSTR_SS_L, 3}, - { "mvcs", OP8(0xdbLL), MASK_SS_RR, INSTR_SS_RR, 3}, - { "mvcp", OP8(0xdaLL), MASK_SS_RR, INSTR_SS_RR, 3}, - { "mvck", OP8(0xd9LL), MASK_SS_RR, INSTR_SS_RR, 3}, - { "xc", OP8(0xd7LL), MASK_SS_L, INSTR_SS_L, 3}, - { "oc", OP8(0xd6LL), MASK_SS_L, INSTR_SS_L, 3}, - { "clc", OP8(0xd5LL), MASK_SS_L, INSTR_SS_L, 3}, - { "nc", OP8(0xd4LL), MASK_SS_L, INSTR_SS_L, 3}, - { "mvz", OP8(0xd3LL), MASK_SS_L, INSTR_SS_L, 3}, - { "mvc", OP8(0xd2LL), MASK_SS_L, INSTR_SS_L, 3}, - { "mvn", OP8(0xd1LL), MASK_SS_L, INSTR_SS_L, 3}, - { "jg", OP16(0xc0f4LL), MASK_RIL_B, INSTR_RIL_B, 2}, - { "jgno", OP16(0xc0e4LL), MASK_RIL_B, INSTR_RIL_B, 2}, - { "jgnh", OP16(0xc0d4LL), MASK_RIL_B, INSTR_RIL_B, 2}, - { "jgnp", OP16(0xc0d4LL), MASK_RIL_B, INSTR_RIL_B, 2}, - { "jgle", OP16(0xc0c4LL), MASK_RIL_B, INSTR_RIL_B, 2}, - { "jgnl", OP16(0xc0b4LL), MASK_RIL_B, INSTR_RIL_B, 2}, - { "jgnm", OP16(0xc0b4LL), MASK_RIL_B, INSTR_RIL_B, 2}, - { "jghe", OP16(0xc0a4LL), MASK_RIL_B, INSTR_RIL_B, 2}, - { "jgnlh", OP16(0xc094LL), MASK_RIL_B, INSTR_RIL_B, 2}, - { "jge", OP16(0xc084LL), MASK_RIL_B, INSTR_RIL_B, 2}, - { "jgz", OP16(0xc084LL), MASK_RIL_B, INSTR_RIL_B, 2}, - { "jgne", OP16(0xc074LL), MASK_RIL_B, INSTR_RIL_B, 2}, - { "jgnz", OP16(0xc074LL), MASK_RIL_B, INSTR_RIL_B, 2}, - { "jglh", OP16(0xc064LL), MASK_RIL_B, INSTR_RIL_B, 2}, - { "jgnhe", OP16(0xc054LL), MASK_RIL_B, INSTR_RIL_B, 2}, - { "jgl", OP16(0xc044LL), MASK_RIL_B, INSTR_RIL_B, 2}, - { "jgm", OP16(0xc044LL), MASK_RIL_B, INSTR_RIL_B, 2}, - { "jgnle", OP16(0xc034LL), MASK_RIL_B, INSTR_RIL_B, 2}, - { "jgh", OP16(0xc024LL), MASK_RIL_B, INSTR_RIL_B, 2}, - { "jgp", OP16(0xc024LL), MASK_RIL_B, INSTR_RIL_B, 2}, - { "jgo", OP16(0xc014LL), MASK_RIL_B, INSTR_RIL_B, 2}, - { "brasl", OP16(0xc005LL), MASK_RIL_A, INSTR_RIL_A, 2}, - { "brcl", OP16(0xc004LL), MASK_RIL_MA, INSTR_RIL_MA, 2}, - { "larl", OP16(0xc000LL), MASK_RIL_A, INSTR_RIL_A, 2}, - { "icm", OP8(0xbfLL), MASK_RS_M, INSTR_RS_M, 3}, - { "stcm", OP8(0xbeLL), MASK_RS_M, INSTR_RS_M, 3}, - { "clm", OP8(0xbdLL), MASK_RS_M, INSTR_RS_M, 3}, - { "cds", OP8(0xbbLL), MASK_RS, INSTR_RS, 3}, - { "cs", OP8(0xbaLL), MASK_RS, INSTR_RS, 3}, - { "esea", OP16(0xb99dLL), MASK_RRE_R, INSTR_RRE_R, 2}, - { "slbr", OP16(0xb999LL), MASK_RRE, INSTR_RRE, 2}, - { "alcr", OP16(0xb998LL), MASK_RRE, INSTR_RRE, 2}, - { "dlr", OP16(0xb997LL), MASK_RRE, INSTR_RRE, 2}, - { "mlr", OP16(0xb996LL), MASK_RRE, INSTR_RRE, 2}, - { "epsw", OP16(0xb98dLL), MASK_RRE, INSTR_RRE, 2}, - { "slbgr", OP16(0xb989LL), MASK_RRE, INSTR_RRE, 2}, - { "alcgr", OP16(0xb988LL), MASK_RRE, INSTR_RRE, 2}, - { "dlgr", OP16(0xb987LL), MASK_RRE, INSTR_RRE, 2}, - { "mlgr", OP16(0xb986LL), MASK_RRE, INSTR_RRE, 2}, - { "troo", OP16(0xb993LL), MASK_RRE, INSTR_RRE, 2}, - { "trot", OP16(0xb992LL), MASK_RRE, INSTR_RRE, 2}, - { "trto", OP16(0xb991LL), MASK_RRE, INSTR_RRE, 2}, - { "trtt", OP16(0xb990LL), MASK_RRE, INSTR_RRE, 2}, - { "xgr", OP16(0xb982LL), MASK_RRE, INSTR_RRE, 2}, - { "ogr", OP16(0xb981LL), MASK_RRE, INSTR_RRE, 2}, - { "ngr", OP16(0xb980LL), MASK_RRE, INSTR_RRE, 2}, - { "bctgr", OP16(0xb946LL), MASK_RRE, INSTR_RRE, 2}, - { "clgfr", OP16(0xb931LL), MASK_RRE, INSTR_RRE, 2}, - { "cgfr", OP16(0xb930LL), MASK_RRE, INSTR_RRE, 2}, - { "sturg", OP16(0xb925LL), MASK_RRE, INSTR_RRE, 2}, - { "clgr", OP16(0xb921LL), MASK_RRE, INSTR_RRE, 2}, - { "cgr", OP16(0xb920LL), MASK_RRE, INSTR_RRE, 2}, - { "lrvr", OP16(0xb91fLL), MASK_RRE, INSTR_RRE, 2}, - { "dsgfr", OP16(0xb91dLL), MASK_RRE, INSTR_RRE, 2}, - { "msgfr", OP16(0xb91cLL), MASK_RRE, INSTR_RRE, 2}, - { "slgfr", OP16(0xb91bLL), MASK_RRE, INSTR_RRE, 2}, - { "algfr", OP16(0xb91aLL), MASK_RRE, INSTR_RRE, 2}, - { "sgfr", OP16(0xb919LL), MASK_RRE, INSTR_RRE, 2}, - { "agfr", OP16(0xb918LL), MASK_RRE, INSTR_RRE, 2}, - { "llgtr", OP16(0xb917LL), MASK_RRE, INSTR_RRE, 2}, - { "llgfr", OP16(0xb916LL), MASK_RRE, INSTR_RRE, 2}, - { "lgfr", OP16(0xb914LL), MASK_RRE, INSTR_RRE, 2}, - { "lcgfr", OP16(0xb913LL), MASK_RRE, INSTR_RRE, 2}, - { "ltgfr", OP16(0xb912LL), MASK_RRE, INSTR_RRE, 2}, - { "lngfr", OP16(0xb911LL), MASK_RRE, INSTR_RRE, 2}, - { "lpgfr", OP16(0xb910LL), MASK_RRE, INSTR_RRE, 2}, - { "lrvgr", OP16(0xb90fLL), MASK_RRE, INSTR_RRE, 2}, - { "eregg", OP16(0xb90eLL), MASK_RRE, INSTR_RRE, 2}, - { "dsgr", OP16(0xb90dLL), MASK_RRE, INSTR_RRE, 2}, - { "msgr", OP16(0xb90cLL), MASK_RRE, INSTR_RRE, 2}, - { "slgr", OP16(0xb90bLL), MASK_RRE, INSTR_RRE, 2}, - { "algr", OP16(0xb90aLL), MASK_RRE, INSTR_RRE, 2}, - { "sgr", OP16(0xb909LL), MASK_RRE, INSTR_RRE, 2}, - { "agr", OP16(0xb908LL), MASK_RRE, INSTR_RRE, 2}, - { "lurag", OP16(0xb905LL), MASK_RRE, INSTR_RRE, 2}, - { "lgr", OP16(0xb904LL), MASK_RRE, INSTR_RRE, 2}, - { "lcgr", OP16(0xb903LL), MASK_RRE, INSTR_RRE, 2}, - { "ltgr", OP16(0xb902LL), MASK_RRE, INSTR_RRE, 2}, - { "lngr", OP16(0xb901LL), MASK_RRE, INSTR_RRE, 2}, - { "lpgr", OP16(0xb900LL), MASK_RRE, INSTR_RRE, 2}, - { "lctl", OP8(0xb7LL), MASK_RS_C, INSTR_RS_C, 3}, - { "stctl", OP8(0xb6LL), MASK_RS_C, INSTR_RS_C, 3}, - { "cgxr", OP16(0xb3caLL), MASK_RRF_F, INSTR_RRF_F, 2}, - { "cgdr", OP16(0xb3c9LL), MASK_RRF_F, INSTR_RRF_F, 2}, - { "cger", OP16(0xb3c8LL), MASK_RRF_F, INSTR_RRF_F, 2}, - { "cxgr", OP16(0xb3c6LL), MASK_RRE, INSTR_RRE, 2}, - { "cdgr", OP16(0xb3c5LL), MASK_RRE, INSTR_RRE, 2}, - { "cegr", OP16(0xb3c4LL), MASK_RRE, INSTR_RRE, 2}, - { "cgxbr", OP16(0xb3aaLL), MASK_RRF_M, INSTR_RRF_M, 2}, - { "cgdbr", OP16(0xb3a9LL), MASK_RRF_M, INSTR_RRF_M, 2}, - { "cgebr", OP16(0xb3a8LL), MASK_RRF_M, INSTR_RRF_M, 2}, - { "cxgbr", OP16(0xb3a6LL), MASK_RRE, INSTR_RRE, 2}, - { "cdgbr", OP16(0xb3a5LL), MASK_RRE, INSTR_RRE, 2}, - { "cegbr", OP16(0xb3a4LL), MASK_RRE, INSTR_RRE, 2}, - { "cfxbr", OP16(0xb39aLL), MASK_RRF_M, INSTR_RRF_M, 3}, - { "cfdbr", OP16(0xb399LL), MASK_RRF_M, INSTR_RRF_M, 3}, - { "cfebr", OP16(0xb398LL), MASK_RRF_M, INSTR_RRF_M, 3}, - { "cxfbr", OP16(0xb396LL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "cdfbr", OP16(0xb395LL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "cefbr", OP16(0xb394LL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "efpc", OP16(0xb38cLL), MASK_RRE, INSTR_RRE, 3}, - { "sfpc", OP16(0xb384LL), MASK_RRE, INSTR_RRE, 3}, - { "lzxr", OP16(0xb376LL), MASK_RRE_R, INSTR_RRE_R, 2}, - { "lzdr", OP16(0xb375LL), MASK_RRE_R, INSTR_RRE_R, 2}, - { "lzer", OP16(0xb374LL), MASK_RRE_R, INSTR_RRE_R, 2}, - { "fidbr", OP16(0xb35fLL), MASK_RRF_M, INSTR_RRF_M, 3}, - { "didbr", OP16(0xb35bLL), MASK_RRF_RM, INSTR_RRF_RM, 3}, - { "thdr", OP16(0xb359LL), MASK_RRE, INSTR_RRE, 2}, - { "thder", OP16(0xb358LL), MASK_RRE, INSTR_RRE, 2}, - { "fiebr", OP16(0xb357LL), MASK_RRF_M, INSTR_RRF_M, 3}, - { "diebr", OP16(0xb353LL), MASK_RRF_RM, INSTR_RRF_RM, 3}, - { "tbdr", OP16(0xb351LL), MASK_RRF_M, INSTR_RRF_M, 2}, - { "tbedr", OP16(0xb350LL), MASK_RRF_M, INSTR_RRF_M, 2}, - { "dxbr", OP16(0xb34dLL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "mxbr", OP16(0xb34cLL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "sxbr", OP16(0xb34bLL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "axbr", OP16(0xb34aLL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "cxbr", OP16(0xb349LL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "kxbr", OP16(0xb348LL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "fixbr", OP16(0xb347LL), MASK_RRF_M, INSTR_RRF_M, 3}, - { "lexbr", OP16(0xb346LL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "ldxbr", OP16(0xb345LL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "ledbr", OP16(0xb344LL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "lcxbr", OP16(0xb343LL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "ltxbr", OP16(0xb342LL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "lnxbr", OP16(0xb341LL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "lpxbr", OP16(0xb340LL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "msdbr", OP16(0xb31fLL), MASK_RRF_R, INSTR_RRF_R, 3}, - { "madbr", OP16(0xb31eLL), MASK_RRF_R, INSTR_RRF_R, 3}, - { "ddbr", OP16(0xb31dLL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "mdbr", OP16(0xb31cLL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "sdbr", OP16(0xb31bLL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "adbr", OP16(0xb31aLL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "cdbr", OP16(0xb319LL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "kdbr", OP16(0xb318LL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "meebr", OP16(0xb317LL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "sqxbr", OP16(0xb316LL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "sqdbr", OP16(0xb315LL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "sqebr", OP16(0xb314LL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "lcdbr", OP16(0xb313LL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "ltdbr", OP16(0xb312LL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "lndbr", OP16(0xb311LL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "lpdbr", OP16(0xb310LL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "msebr", OP16(0xb30fLL), MASK_RRF_R, INSTR_RRF_R, 3}, - { "maebr", OP16(0xb30eLL), MASK_RRF_R, INSTR_RRF_R, 3}, - { "debr", OP16(0xb30dLL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "mdebr", OP16(0xb30cLL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "sebr", OP16(0xb30bLL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "aebr", OP16(0xb30aLL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "cebr", OP16(0xb309LL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "kebr", OP16(0xb308LL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "mxdbr", OP16(0xb307LL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "lxebr", OP16(0xb306LL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "lxdbr", OP16(0xb305LL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "ldebr", OP16(0xb304LL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "lcebr", OP16(0xb303LL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "ltebr", OP16(0xb302LL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "lnebr", OP16(0xb301LL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "lpebr", OP16(0xb300LL), MASK_RRE_F, INSTR_RRE_F, 3}, - { "trap4", OP16(0xb2ffLL), MASK_S, INSTR_S, 3}, - { "lpswe", OP16(0xb2b2LL), MASK_S, INSTR_S, 2}, - { "stfl", OP16(0xb2b1LL), MASK_S, INSTR_S, 2}, - { "cutfu", OP16(0xb2a7LL), MASK_RRE, INSTR_RRE, 3}, - { "cuutf", OP16(0xb2a6LL), MASK_RRE, INSTR_RRE, 3}, - { "tre", OP16(0xb2a5LL), MASK_RRE, INSTR_RRE, 2}, - { "lfpc", OP16(0xb29dLL), MASK_S, INSTR_S, 3}, - { "stfpc", OP16(0xb29cLL), MASK_S, INSTR_S, 3}, - { "srnm", OP16(0xb299LL), MASK_S, INSTR_S, 3}, - { "stsi", OP16(0xb27dLL), MASK_S, INSTR_S, 3}, - { "sacf", OP16(0xb279LL), MASK_S, INSTR_S, 3}, - { "stcke", OP16(0xb278LL), MASK_S, INSTR_S, 2}, - { "rp", OP16(0xb277LL), MASK_S, INSTR_S, 3}, - { "siga", OP16(0xb274LL), MASK_S, INSTR_S, 3}, - { "cmpsc", OP16(0xb263LL), MASK_RRE, INSTR_RRE, 3}, - { "srst", OP16(0xb25eLL), MASK_RRE, INSTR_RRE, 3}, - { "clst", OP16(0xb25dLL), MASK_RRE, INSTR_RRE, 3}, - { "bsa", OP16(0xb25aLL), MASK_RRE, INSTR_RRE, 3}, - { "bsg", OP16(0xb258LL), MASK_RRE, INSTR_RRE, 3}, - { "cuse", OP16(0xb257LL), MASK_RRE, INSTR_RRE, 3}, - { "mvst", OP16(0xb255LL), MASK_RRE, INSTR_RRE, 3}, - { "mvpg", OP16(0xb254LL), MASK_RRE, INSTR_RRE, 3}, - { "msr", OP16(0xb252LL), MASK_RRE, INSTR_RRE, 3}, - { "csp", OP16(0xb250LL), MASK_RRE, INSTR_RRE, 3}, - { "ear", OP16(0xb24fLL), MASK_RRE_RA, INSTR_RRE_RA, 3}, - { "sar", OP16(0xb24eLL), MASK_RRE_AR, INSTR_RRE_AR, 3}, - { "cpya", OP16(0xb24dLL), MASK_RRE_A, INSTR_RRE_A, 3}, - { "tar", OP16(0xb24cLL), MASK_RRE_AR, INSTR_RRE_AR, 3}, - { "lura", OP16(0xb24bLL), MASK_RRE, INSTR_RRE, 3}, - { "esta", OP16(0xb24aLL), MASK_RRE, INSTR_RRE, 3}, - { "ereg", OP16(0xb249LL), MASK_RRE, INSTR_RRE, 3}, - { "palb", OP16(0xb248LL), MASK_RRE_O, INSTR_RRE_O, 3}, - { "msta", OP16(0xb247LL), MASK_RRE_R, INSTR_RRE_R, 3}, - { "stura", OP16(0xb246LL), MASK_RRE, INSTR_RRE, 3}, - { "sqer", OP16(0xb245LL), MASK_RRE_E, INSTR_RRE_E, 3}, - { "sqdr", OP16(0xb244LL), MASK_RRE_D, INSTR_RRE_D, 3}, - { "cksm", OP16(0xb241LL), MASK_RRE, INSTR_RRE, 3}, - { "bakr", OP16(0xb240LL), MASK_RRE, INSTR_RRE, 3}, - { "schm", OP16(0xb23cLL), MASK_S_O, INSTR_S_O, 3}, - { "rchp", OP16(0xb23bLL), MASK_S_O, INSTR_S_O, 3}, - { "stcps", OP16(0xb23aLL), MASK_S, INSTR_S, 3}, - { "stcrw", OP16(0xb239LL), MASK_S, INSTR_S, 3}, - { "rsch", OP16(0xb238LL), MASK_S_O, INSTR_S_O, 3}, - { "sal", OP16(0xb237LL), MASK_S_O, INSTR_S_O, 3}, - { "tpi", OP16(0xb236LL), MASK_S, INSTR_S, 3}, - { "tsch", OP16(0xb235LL), MASK_S, INSTR_S, 3}, - { "stsch", OP16(0xb234LL), MASK_S, INSTR_S, 3}, - { "ssch", OP16(0xb233LL), MASK_S, INSTR_S, 3}, - { "msch", OP16(0xb232LL), MASK_S, INSTR_S, 3}, - { "hsch", OP16(0xb231LL), MASK_S_O, INSTR_S_O, 3}, - { "csch", OP16(0xb230LL), MASK_S_O, INSTR_S_O, 3}, - { "dxr", OP16(0xb22dLL), MASK_RRE_X, INSTR_RRE_X, 3}, - { "tb", OP16(0xb22cLL), MASK_RRE_R2, INSTR_RRE_R2, 3}, - { "sske", OP16(0xb22bLL), MASK_RRE, INSTR_RRE, 3}, - { "rrbe", OP16(0xb22aLL), MASK_RRE, INSTR_RRE, 3}, - { "iske", OP16(0xb229LL), MASK_RRE, INSTR_RRE, 3}, - { "pt", OP16(0xb228LL), MASK_RRE, INSTR_RRE, 3}, - { "esar", OP16(0xb227LL), MASK_RRE_R, INSTR_RRE_R, 3}, - { "epar", OP16(0xb226LL), MASK_RRE_R, INSTR_RRE_R, 3}, - { "ssar", OP16(0xb225LL), MASK_RRE_R, INSTR_RRE_R, 3}, - { "iac", OP16(0xb224LL), MASK_RRE_R, INSTR_RRE_R, 3}, - { "ivsk", OP16(0xb223LL), MASK_RRE, INSTR_RRE, 3}, - { "ipm", OP16(0xb222LL), MASK_RRE_R, INSTR_RRE_R, 3}, - { "ipte", OP16(0xb221LL), MASK_RRE, INSTR_RRE, 3}, - { "cfc", OP16(0xb21aLL), MASK_S, INSTR_S, 3}, - { "sac", OP16(0xb219LL), MASK_S, INSTR_S, 3}, - { "pc", OP16(0xb218LL), MASK_S, INSTR_S, 3}, - { "sie", OP16(0xb214LL), MASK_S, INSTR_S, 3}, - { "stap", OP16(0xb212LL), MASK_S, INSTR_S, 3}, - { "stpx", OP16(0xb211LL), MASK_S, INSTR_S, 3}, - { "spx", OP16(0xb210LL), MASK_S, INSTR_S, 3}, - { "ptlb", OP16(0xb20dLL), MASK_S_O, INSTR_S_O, 3}, - { "ipk", OP16(0xb20bLL), MASK_S_O, INSTR_S_O, 3}, - { "spka", OP16(0xb20aLL), MASK_S, INSTR_S, 3}, - { "stpt", OP16(0xb209LL), MASK_S, INSTR_S, 3}, - { "spt", OP16(0xb208LL), MASK_S, INSTR_S, 3}, - { "stckc", OP16(0xb207LL), MASK_S, INSTR_S, 3}, - { "sckc", OP16(0xb206LL), MASK_S, INSTR_S, 3}, - { "stck", OP16(0xb205LL), MASK_S, INSTR_S, 3}, - { "sck", OP16(0xb204LL), MASK_S, INSTR_S, 3}, - { "stidp", OP16(0xb202LL), MASK_S, INSTR_S, 3}, - { "lra", OP8(0xb1LL), MASK_RX, INSTR_RX, 3}, - { "mc", OP8(0xafLL), MASK_SI, INSTR_SI, 3}, - { "sigp", OP8(0xaeLL), MASK_RS, INSTR_RS, 3}, - { "stosm", OP8(0xadLL), MASK_SI, INSTR_SI, 3}, - { "stnsm", OP8(0xacLL), MASK_SI, INSTR_SI, 3}, - { "clcle", OP8(0xa9LL), MASK_RS, INSTR_RS, 3}, - { "mvcle", OP8(0xa8LL), MASK_RS, INSTR_RS, 3}, - { "j", OP16(0xa7f4LL), MASK_RI_B, INSTR_RI_B, 3}, - { "jno", OP16(0xa7e4LL), MASK_RI_B, INSTR_RI_B, 3}, - { "jnh", OP16(0xa7d4LL), MASK_RI_B, INSTR_RI_B, 3}, - { "jnp", OP16(0xa7d4LL), MASK_RI_B, INSTR_RI_B, 3}, - { "jle", OP16(0xa7c4LL), MASK_RI_B, INSTR_RI_B, 3}, - { "jnl", OP16(0xa7b4LL), MASK_RI_B, INSTR_RI_B, 3}, - { "jnm", OP16(0xa7b4LL), MASK_RI_B, INSTR_RI_B, 3}, - { "jhe", OP16(0xa7a4LL), MASK_RI_B, INSTR_RI_B, 3}, - { "jnlh", OP16(0xa794LL), MASK_RI_B, INSTR_RI_B, 3}, - { "je", OP16(0xa784LL), MASK_RI_B, INSTR_RI_B, 3}, - { "jz", OP16(0xa784LL), MASK_RI_B, INSTR_RI_B, 3}, - { "jne", OP16(0xa774LL), MASK_RI_B, INSTR_RI_B, 3}, - { "jnz", OP16(0xa774LL), MASK_RI_B, INSTR_RI_B, 3}, - { "jlh", OP16(0xa764LL), MASK_RI_B, INSTR_RI_B, 3}, - { "jnhe", OP16(0xa754LL), MASK_RI_B, INSTR_RI_B, 3}, - { "jl", OP16(0xa744LL), MASK_RI_B, INSTR_RI_B, 3}, - { "jm", OP16(0xa744LL), MASK_RI_B, INSTR_RI_B, 3}, - { "jnle", OP16(0xa734LL), MASK_RI_B, INSTR_RI_B, 3}, - { "jh", OP16(0xa724LL), MASK_RI_B, INSTR_RI_B, 3}, - { "jp", OP16(0xa724LL), MASK_RI_B, INSTR_RI_B, 3}, - { "jo", OP16(0xa714LL), MASK_RI_B, INSTR_RI_B, 3}, - { "cghi", OP16(0xa70fLL), MASK_RI, INSTR_RI, 2}, - { "chi", OP16(0xa70eLL), MASK_RI, INSTR_RI, 3}, - { "mghi", OP16(0xa70dLL), MASK_RI, INSTR_RI, 2}, - { "mhi", OP16(0xa70cLL), MASK_RI, INSTR_RI, 3}, - { "aghi", OP16(0xa70bLL), MASK_RI, INSTR_RI, 2}, - { "ahi", OP16(0xa70aLL), MASK_RI, INSTR_RI, 3}, - { "lghi", OP16(0xa709LL), MASK_RI, INSTR_RI, 2}, - { "lhi", OP16(0xa708LL), MASK_RI, INSTR_RI, 3}, - { "brctg", OP16(0xa707LL), MASK_RI_A, INSTR_RI_A, 2}, - { "brct", OP16(0xa706LL), MASK_RI_A, INSTR_RI_A, 3}, - { "bras", OP16(0xa705LL), MASK_RI_A, INSTR_RI_A, 3}, - { "brc", OP16(0xa704LL), MASK_RI_MA, INSTR_RI_MA, 3}, - { "tmhl", OP16(0xa703LL), MASK_RI_U, INSTR_RI_U, 2}, - { "tmhh", OP16(0xa702LL), MASK_RI_U, INSTR_RI_U, 2}, - { "tml", OP16(0xa701LL), MASK_RI_U, INSTR_RI_U, 3}, - { "tmll", OP16(0xa701LL), MASK_RI_U, INSTR_RI_U, 2}, - { "tmh", OP16(0xa700LL), MASK_RI_U, INSTR_RI_U, 3}, - { "tmlh", OP16(0xa700LL), MASK_RI_U, INSTR_RI_U, 2}, - { "llill", OP16(0xa50fLL), MASK_RI_U, INSTR_RI_U, 2}, - { "llilh", OP16(0xa50eLL), MASK_RI_U, INSTR_RI_U, 2}, - { "llihl", OP16(0xa50dLL), MASK_RI_U, INSTR_RI_U, 2}, - { "llihh", OP16(0xa50cLL), MASK_RI_U, INSTR_RI_U, 2}, - { "oill", OP16(0xa50bLL), MASK_RI_U, INSTR_RI_U, 2}, - { "oilh", OP16(0xa50aLL), MASK_RI_U, INSTR_RI_U, 2}, - { "oihl", OP16(0xa509LL), MASK_RI_U, INSTR_RI_U, 2}, - { "oihh", OP16(0xa508LL), MASK_RI_U, INSTR_RI_U, 2}, - { "nill", OP16(0xa507LL), MASK_RI_U, INSTR_RI_U, 2}, - { "nilh", OP16(0xa506LL), MASK_RI_U, INSTR_RI_U, 2}, - { "nihl", OP16(0xa505LL), MASK_RI_U, INSTR_RI_U, 2}, - { "nihh", OP16(0xa504LL), MASK_RI_U, INSTR_RI_U, 2}, - { "iill", OP16(0xa503LL), MASK_RI_U, INSTR_RI_U, 2}, - { "iilh", OP16(0xa502LL), MASK_RI_U, INSTR_RI_U, 2}, - { "iihl", OP16(0xa501LL), MASK_RI_U, INSTR_RI_U, 2}, - { "iihh", OP16(0xa500LL), MASK_RI_U, INSTR_RI_U, 2}, - { "stam", OP8(0x9bLL), MASK_RS_A, INSTR_RS_A, 3}, - { "lam", OP8(0x9aLL), MASK_RS_A, INSTR_RS_A, 3}, - { "trace", OP8(0x99LL), MASK_RS, INSTR_RS, 3}, - { "lm", OP8(0x98LL), MASK_RS, INSTR_RS, 3}, - { "xi", OP8(0x97LL), MASK_SI, INSTR_SI, 3}, - { "oi", OP8(0x96LL), MASK_SI, INSTR_SI, 3}, - { "cli", OP8(0x95LL), MASK_SI, INSTR_SI, 3}, - { "ni", OP8(0x94LL), MASK_SI, INSTR_SI, 3}, - { "ts", OP8(0x93LL), MASK_S, INSTR_S, 3}, - { "mvi", OP8(0x92LL), MASK_SI, INSTR_SI, 3}, - { "tm", OP8(0x91LL), MASK_SI, INSTR_SI, 3}, - { "stm", OP8(0x90LL), MASK_RS, INSTR_RS, 3}, - { "slda", OP8(0x8fLL), MASK_RS_D, INSTR_RS_D, 3}, - { "srda", OP8(0x8eLL), MASK_RS_D, INSTR_RS_D, 3}, - { "sldl", OP8(0x8dLL), MASK_RS_D, INSTR_RS_D, 3}, - { "srdl", OP8(0x8cLL), MASK_RS_D, INSTR_RS_D, 3}, - { "sla", OP8(0x8bLL), MASK_RS_S, INSTR_RS_S, 3}, - { "sra", OP8(0x8aLL), MASK_RS_S, INSTR_RS_S, 3}, - { "sll", OP8(0x89LL), MASK_RS_S, INSTR_RS_S, 3}, - { "srl", OP8(0x88LL), MASK_RS_S, INSTR_RS_S, 3}, - { "bxle", OP8(0x87LL), MASK_RS, INSTR_RS, 3}, - { "bxh", OP8(0x86LL), MASK_RS, INSTR_RS, 3}, - { "brxle", OP8(0x85LL), MASK_RSI_A, INSTR_RSI_A, 3}, - { "brxh", OP8(0x84LL), MASK_RSI_A, INSTR_RSI_A, 3}, - { "diag", OP8(0x83LL), MASK_RS, INSTR_RS, 3}, - { "lpsw", OP8(0x82LL), MASK_S, INSTR_S, 3}, - { "ssm", OP8(0x80LL), MASK_S, INSTR_S, 3}, - { "su", OP8(0x7fLL), MASK_RX_E, INSTR_RX_E, 3}, - { "au", OP8(0x7eLL), MASK_RX_E, INSTR_RX_E, 3}, - { "de", OP8(0x7dLL), MASK_RX_E, INSTR_RX_E, 3}, - { "me", OP8(0x7cLL), MASK_RX_ED, INSTR_RX_ED, 3}, - { "se", OP8(0x7bLL), MASK_RX_E, INSTR_RX_E, 3}, - { "ae", OP8(0x7aLL), MASK_RX_E, INSTR_RX_E, 3}, - { "ce", OP8(0x79LL), MASK_RX_E, INSTR_RX_E, 3}, - { "le", OP8(0x78LL), MASK_RX_E, INSTR_RX_E, 3}, - { "ms", OP8(0x71LL), MASK_RX, INSTR_RX, 3}, - { "ste", OP8(0x70LL), MASK_RX_E, INSTR_RX_E, 3}, - { "sw", OP8(0x6fLL), MASK_RX_D, INSTR_RX_D, 3}, - { "aw", OP8(0x6eLL), MASK_RX_D, INSTR_RX_D, 3}, - { "dd", OP8(0x6dLL), MASK_RX_D, INSTR_RX_D, 3}, - { "md", OP8(0x6cLL), MASK_RX_D, INSTR_RX_D, 3}, - { "sd", OP8(0x6bLL), MASK_RX_D, INSTR_RX_D, 3}, - { "ad", OP8(0x6aLL), MASK_RX_D, INSTR_RX_D, 3}, - { "cd", OP8(0x69LL), MASK_RX_D, INSTR_RX_D, 3}, - { "ld", OP8(0x68LL), MASK_RX_D, INSTR_RX_D, 3}, - { "mxd", OP8(0x67LL), MASK_RX_DX, INSTR_RX_DX, 3}, - { "std", OP8(0x60LL), MASK_RX_D, INSTR_RX_D, 3}, - { "sl", OP8(0x5fLL), MASK_RX, INSTR_RX, 3}, - { "al", OP8(0x5eLL), MASK_RX, INSTR_RX, 3}, - { "d", OP8(0x5dLL), MASK_RX, INSTR_RX, 3}, - { "m", OP8(0x5cLL), MASK_RX, INSTR_RX, 3}, - { "s", OP8(0x5bLL), MASK_RX, INSTR_RX, 3}, - { "a", OP8(0x5aLL), MASK_RX, INSTR_RX, 3}, - { "c", OP8(0x59LL), MASK_RX, INSTR_RX, 3}, - { "l", OP8(0x58LL), MASK_RX, INSTR_RX, 3}, - { "x", OP8(0x57LL), MASK_RX, INSTR_RX, 3}, - { "o", OP8(0x56LL), MASK_RX, INSTR_RX, 3}, - { "cl", OP8(0x55LL), MASK_RX, INSTR_RX, 3}, - { "n", OP8(0x54LL), MASK_RX, INSTR_RX, 3}, - { "lae", OP8(0x51LL), MASK_RX, INSTR_RX, 3}, - { "st", OP8(0x50LL), MASK_RX, INSTR_RX, 3}, - { "cvb", OP8(0x4fLL), MASK_RX, INSTR_RX, 3}, - { "cvd", OP8(0x4eLL), MASK_RX, INSTR_RX, 3}, - { "bas", OP8(0x4dLL), MASK_RX, INSTR_RX, 3}, - { "mh", OP8(0x4cLL), MASK_RX, INSTR_RX, 3}, - { "sh", OP8(0x4bLL), MASK_RX, INSTR_RX, 3}, - { "ah", OP8(0x4aLL), MASK_RX, INSTR_RX, 3}, - { "ch", OP8(0x49LL), MASK_RX, INSTR_RX, 3}, - { "lh", OP8(0x48LL), MASK_RX, INSTR_RX, 3}, - { "b", OP16(0x47f0LL), MASK_RX_B, INSTR_RX_B, 3}, - { "bno", OP16(0x47e0LL), MASK_RX_B, INSTR_RX_B, 3}, - { "bnh", OP16(0x47d0LL), MASK_RX_B, INSTR_RX_B, 3}, - { "bnp", OP16(0x47d0LL), MASK_RX_B, INSTR_RX_B, 3}, - { "ble", OP16(0x47c0LL), MASK_RX_B, INSTR_RX_B, 3}, - { "bnl", OP16(0x47b0LL), MASK_RX_B, INSTR_RX_B, 3}, - { "bnm", OP16(0x47b0LL), MASK_RX_B, INSTR_RX_B, 3}, - { "bhe", OP16(0x47a0LL), MASK_RX_B, INSTR_RX_B, 3}, - { "bnlh", OP16(0x4790LL), MASK_RX_B, INSTR_RX_B, 3}, - { "be", OP16(0x4780LL), MASK_RX_B, INSTR_RX_B, 3}, - { "bz", OP16(0x4780LL), MASK_RX_B, INSTR_RX_B, 3}, - { "bne", OP16(0x4770LL), MASK_RX_B, INSTR_RX_B, 3}, - { "bnz", OP16(0x4770LL), MASK_RX_B, INSTR_RX_B, 3}, - { "blh", OP16(0x4760LL), MASK_RX_B, INSTR_RX_B, 3}, - { "bnhe", OP16(0x4750LL), MASK_RX_B, INSTR_RX_B, 3}, - { "bl", OP16(0x4740LL), MASK_RX_B, INSTR_RX_B, 3}, - { "bm", OP16(0x4740LL), MASK_RX_B, INSTR_RX_B, 3}, - { "bnle", OP16(0x4730LL), MASK_RX_B, INSTR_RX_B, 3}, - { "bh", OP16(0x4720LL), MASK_RX_B, INSTR_RX_B, 3}, - { "bp", OP16(0x4720LL), MASK_RX_B, INSTR_RX_B, 3}, - { "bo", OP16(0x4710LL), MASK_RX_B, INSTR_RX_B, 3}, - { "bc", OP8(0x47LL), MASK_RX_M, INSTR_RX_M, 3}, - { "nop", OP16(0x4700LL), MASK_RX_B, INSTR_RX_B, 3}, - { "bct", OP8(0x46LL), MASK_RX, INSTR_RX, 3}, - { "bal", OP8(0x45LL), MASK_RX, INSTR_RX, 3}, - { "ex", OP8(0x44LL), MASK_RX, INSTR_RX, 3}, - { "ic", OP8(0x43LL), MASK_RX, INSTR_RX, 3}, - { "stc", OP8(0x42LL), MASK_RX, INSTR_RX, 3}, - { "la", OP8(0x41LL), MASK_RX, INSTR_RX, 3}, - { "sth", OP8(0x40LL), MASK_RX, INSTR_RX, 3}, - { "sur", OP8(0x3fLL), MASK_RR_E, INSTR_RR_E, 3}, - { "aur", OP8(0x3eLL), MASK_RR_E, INSTR_RR_E, 3}, - { "der", OP8(0x3dLL), MASK_RR_E, INSTR_RR_E, 3}, - { "mer", OP8(0x3cLL), MASK_RR_ED, INSTR_RR_ED, 3}, - { "ser", OP8(0x3bLL), MASK_RR_E, INSTR_RR_E, 3}, - { "aer", OP8(0x3aLL), MASK_RR_E, INSTR_RR_E, 3}, - { "cer", OP8(0x39LL), MASK_RR_E, INSTR_RR_E, 3}, - { "ler", OP8(0x38LL), MASK_RR_E, INSTR_RR_E, 3}, - { "sxr", OP8(0x37LL), MASK_RR_X, INSTR_RR_X, 3}, - { "axr", OP8(0x36LL), MASK_RR, INSTR_RR, 3}, - { "lrer", OP8(0x35LL), MASK_RR_DE, INSTR_RR_DE, 3}, - { "her", OP8(0x34LL), MASK_RR_E, INSTR_RR_E, 3}, - { "lcer", OP8(0x33LL), MASK_RR_E, INSTR_RR_E, 3}, - { "lter", OP8(0x32LL), MASK_RR_E, INSTR_RR_E, 3}, - { "lner", OP8(0x31LL), MASK_RR_E, INSTR_RR_E, 3}, - { "lper", OP8(0x30LL), MASK_RR_E, INSTR_RR_E, 3}, - { "swr", OP8(0x2fLL), MASK_RR_D, INSTR_RR_D, 3}, - { "awr", OP8(0x2eLL), MASK_RR_D, INSTR_RR_D, 3}, - { "ddr", OP8(0x2dLL), MASK_RR_D, INSTR_RR_D, 3}, - { "mdr", OP8(0x2cLL), MASK_RR_D, INSTR_RR_D, 3}, - { "sdr", OP8(0x2bLL), MASK_RR_D, INSTR_RR_D, 3}, - { "adr", OP8(0x2aLL), MASK_RR_D, INSTR_RR_D, 3}, - { "cdr", OP8(0x29LL), MASK_RR_D, INSTR_RR_D, 3}, - { "ldr", OP8(0x28LL), MASK_RR_D, INSTR_RR_D, 3}, - { "mxdr", OP8(0x27LL), MASK_RR_DX, INSTR_RR_DX, 3}, - { "mxr", OP8(0x26LL), MASK_RR_X, INSTR_RR_X, 3}, - { "lrdr", OP8(0x25LL), MASK_RR_XD, INSTR_RR_XD, 3}, - { "hdr", OP8(0x24LL), MASK_RR_D, INSTR_RR_D, 3}, - { "lcdr", OP8(0x23LL), MASK_RR_D, INSTR_RR_D, 3}, - { "ltdr", OP8(0x22LL), MASK_RR_D, INSTR_RR_D, 3}, - { "lndr", OP8(0x21LL), MASK_RR_D, INSTR_RR_D, 3}, - { "lpdr", OP8(0x20LL), MASK_RR_D, INSTR_RR_D, 3}, - { "slr", OP8(0x1fLL), MASK_RR, INSTR_RR, 3}, - { "alr", OP8(0x1eLL), MASK_RR, INSTR_RR, 3}, - { "dr", OP8(0x1dLL), MASK_RR, INSTR_RR, 3}, - { "mr", OP8(0x1cLL), MASK_RR, INSTR_RR, 3}, - { "sr", OP8(0x1bLL), MASK_RR, INSTR_RR, 3}, - { "ar", OP8(0x1aLL), MASK_RR, INSTR_RR, 3}, - { "cr", OP8(0x19LL), MASK_RR, INSTR_RR, 3}, - { "lr", OP8(0x18LL), MASK_RR, INSTR_RR, 3}, - { "xr", OP8(0x17LL), MASK_RR, INSTR_RR, 3}, - { "or", OP8(0x16LL), MASK_RR, INSTR_RR, 3}, - { "clr", OP8(0x15LL), MASK_RR, INSTR_RR, 3}, - { "nr", OP8(0x14LL), MASK_RR, INSTR_RR, 3}, - { "lcr", OP8(0x13LL), MASK_RR, INSTR_RR, 3}, - { "ltr", OP8(0x12LL), MASK_RR, INSTR_RR, 3}, - { "lnr", OP8(0x11LL), MASK_RR, INSTR_RR, 3}, - { "lpr", OP8(0x10LL), MASK_RR, INSTR_RR, 3}, - { "clcl", OP8(0x0fLL), MASK_RR, INSTR_RR, 3}, - { "mvcl", OP8(0x0eLL), MASK_RR, INSTR_RR, 3}, - { "basr", OP8(0x0dLL), MASK_RR, INSTR_RR, 3}, - { "bassm", OP8(0x0cLL), MASK_RR, INSTR_RR, 3}, - { "bsm", OP8(0x0bLL), MASK_RR, INSTR_RR, 3}, - { "svc", OP8(0x0aLL), MASK_RR_I, INSTR_RR_I, 3}, - { "br", OP16(0x07f0LL), MASK_RR_B, INSTR_RR_B, 3}, - { "bnor", OP16(0x07e0LL), MASK_RR_B, INSTR_RR_B, 3}, - { "bnhr", OP16(0x07d0LL), MASK_RR_B, INSTR_RR_B, 3}, - { "bnpr", OP16(0x07d0LL), MASK_RR_B, INSTR_RR_B, 3}, - { "bler", OP16(0x07c0LL), MASK_RR_B, INSTR_RR_B, 3}, - { "bnlr", OP16(0x07b0LL), MASK_RR_B, INSTR_RR_B, 3}, - { "bnmr", OP16(0x07b0LL), MASK_RR_B, INSTR_RR_B, 3}, - { "bher", OP16(0x07a0LL), MASK_RR_B, INSTR_RR_B, 3}, - { "bnlhr", OP16(0x0790LL), MASK_RR_B, INSTR_RR_B, 3}, - { "ber", OP16(0x0780LL), MASK_RR_B, INSTR_RR_B, 3}, - { "bzr", OP16(0x0780LL), MASK_RR_B, INSTR_RR_B, 3}, - { "bner", OP16(0x0770LL), MASK_RR_B, INSTR_RR_B, 3}, - { "bnzr", OP16(0x0770LL), MASK_RR_B, INSTR_RR_B, 3}, - { "blhr", OP16(0x0760LL), MASK_RR_B, INSTR_RR_B, 3}, - { "bnher", OP16(0x0750LL), MASK_RR_B, INSTR_RR_B, 3}, - { "blr", OP16(0x0740LL), MASK_RR_B, INSTR_RR_B, 3}, - { "bmr", OP16(0x0740LL), MASK_RR_B, INSTR_RR_B, 3}, - { "bnler", OP16(0x0730LL), MASK_RR_B, INSTR_RR_B, 3}, - { "bhr", OP16(0x0720LL), MASK_RR_B, INSTR_RR_B, 3}, - { "bpr", OP16(0x0720LL), MASK_RR_B, INSTR_RR_B, 3}, - { "bor", OP16(0x0710LL), MASK_RR_B, INSTR_RR_B, 3}, - { "bcr", OP8(0x07LL), MASK_RR_M, INSTR_RR_M, 3}, - { "nopr", OP16(0x0700LL), MASK_RR_B, INSTR_RR_B, 3}, - { "bctr", OP8(0x06LL), MASK_RR, INSTR_RR, 3}, - { "balr", OP8(0x05LL), MASK_RR, INSTR_RR, 3}, - { "spm", OP8(0x04LL), MASK_RR_R, INSTR_RR_R, 3}, - { "trap2", OP16(0x01ffLL), MASK_E, INSTR_E, 3}, - { "sam64", OP16(0x010eLL), MASK_E, INSTR_E, 2}, - { "sam31", OP16(0x010dLL), MASK_E, INSTR_E, 2}, - { "sam24", OP16(0x010cLL), MASK_E, INSTR_E, 2}, - { "tam", OP16(0x010bLL), MASK_E, INSTR_E, 2}, - { "sckpf", OP16(0x0107LL), MASK_E, INSTR_E, 3}, - { "upt", OP16(0x0102LL), MASK_E, INSTR_E, 3}, - { "pr", OP16(0x0101LL), MASK_E, INSTR_E, 3} -}; - -const int s390_num_opcodes = - sizeof (s390_opcodes) / sizeof (s390_opcodes[0]); +#include "s390-opc.tab" diff -uprN binutils-2.11.90.0.31/opcodes/s390-opc.txt binutils-2.11.92.0.5/opcodes/s390-opc.txt --- binutils-2.11.90.0.31/opcodes/s390-opc.txt Mon Aug 27 11:44:52 2001 +++ binutils-2.11.92.0.5/opcodes/s390-opc.txt Mon Oct 1 15:25:26 2001 @@ -1,626 +1,626 @@ # S/390 opcodes list. Use s390-mkopc to convert it into the opcode table. # Copyright 2000, 2001 Free Software Foundation, Inc. # Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). -5a a RX "add" esa -6a ad RX_D "add normalized (long)" esa -2a adr RR_D "add normalized (long)" esa -7a ae RX_E "add normalized (short)" esa -3a aer RR_E "add normalized (short)" esa -4a ah RX "add halfword" esa -5e al RX "add logical" esa -1e alr RR "add logical" esa -fa ap SS_LL "add decimal" esa -1a ar RR "add" esa -7e au RX_E "add unnormalized (short)" esa -3e aur RR_E "add unnormalized (short)" esa -6e aw RX_D "add unnormalized (long)" esa -2e awr RR_D "add unnormalized (long)" esa -36 axr RR "add normalized" esa -b240 bakr RRE "branch and stack" esa -45 bal RX "branch and link" esa -05 balr RR "branch and link" esa -4d bas RX "branch and save" esa -0d basr RR "branch and save" esa -0c bassm RR "branch and save and set mode" esa -47 bc RX_M "branch on condition" esa -07 bcr RR_M "branch on condition" esa -46 bct RX "branch on count" esa -06 bctr RR "branch on count" esa -b258 bsg RRE "branch in subspace group" esa -0b bsm RR "branch and set mode" esa -86 bxh RS "branch on index high" esa -87 bxle RS "branch on index low or equal" esa -59 c RX "compare" esa -69 cd RX_D "compare (long)" esa -29 cdr RR_D "compare (long)" esa -bb cds RS "compare double and swap" esa -79 ce RX_E "compare (short)" esa -39 cer RR_E "compare (short)" esa -b21a cfc S "compare and form codeword" esa -49 ch RX "compare halfword" esa -55 cl RX "compare logical" esa -d5 clc SS_L "compare logical" esa -0f clcl RR "compare logical long" esa -95 cli SI "compare logical" esa -bd clm RS_M "compare logical characters under mask" esa -15 clr RR "compare logical" esa -b25d clst RRE "compare logical string" esa -b263 cmpsc RRE "compression call" esa -f9 cp SS_LL "compare decimal" esa -b24d cpya RRE_A "copy access" esa -19 cr RR "compare" esa -ba cs RS "compare and swap" esa -b230 csch S_O "clear subchannel" esa -b257 cuse RRE "compare until substring equal" esa -b250 csp RRE "compare and swap and purge" esa -4f cvb RX "convert to binary" esa -4e cvd RX "convert to decimal" esa -5d d RX "divide" esa -6d dd RX_D "divide (long)" esa -2d ddr RR_D "divide (long)" esa -7d de RX_E "divide (short)" esa -3d der RR_E "divide (short)" esa -83 diag RS "diagnose" esa -fd dp SS_LL "divide decimal" esa -1d dr RR "divide" esa -b22d dxr RRE_X "divide (ext.)" esa +5a a RX_RRRD "add" esa +6a ad RX_FRRD "add normalized (long)" esa +2a adr RR_FF "add normalized (long)" esa +7a ae RX_FRRD "add normalized (short)" esa +3a aer RR_FF "add normalized (short)" esa +4a ah RX_RRRD "add halfword" esa +5e al RX_RRRD "add logical" esa +1e alr RR_RR "add logical" esa +fa ap SS_LLRDRD "add decimal" esa +1a ar RR_RR "add" esa +7e au RX_FRRD "add unnormalized (short)" esa +3e aur RR_FF "add unnormalized (short)" esa +6e aw RX_FRRD "add unnormalized (long)" esa +2e awr RR_FF "add unnormalized (long)" esa +36 axr RR_FF "add normalized" esa +b240 bakr RRE_RR "branch and stack" esa +45 bal RX_RRRD "branch and link" esa +05 balr RR_RR "branch and link" esa +4d bas RX_RRRD "branch and save" esa +0d basr RR_RR "branch and save" esa +0c bassm RR_RR "branch and save and set mode" esa +47 bc RX_URRD "branch on condition" esa +07 bcr RR_UR "branch on condition" esa +46 bct RX_RRRD "branch on count" esa +06 bctr RR_RR "branch on count" esa +b258 bsg RRE_RR "branch in subspace group" esa +0b bsm RR_RR "branch and set mode" esa +86 bxh RS_RRRD "branch on index high" esa +87 bxle RS_RRRD "branch on index low or equal" esa +59 c RX_RRRD "compare" esa +69 cd RX_FRRD "compare (long)" esa +29 cdr RR_FF "compare (long)" esa +bb cds RS_RRRD "compare double and swap" esa +79 ce RX_FRRD "compare (short)" esa +39 cer RR_FF "compare (short)" esa +b21a cfc S_RD "compare and form codeword" esa +49 ch RX_RRRD "compare halfword" esa +55 cl RX_RRRD "compare logical" esa +d5 clc SS_L0RDRD "compare logical" esa +0f clcl RR_RR "compare logical long" esa +95 cli SI_URD "compare logical" esa +bd clm RS_RURD "compare logical characters under mask" esa +15 clr RR_RR "compare logical" esa +b25d clst RRE_RR "compare logical string" esa +b263 cmpsc RRE_RR "compression call" esa +f9 cp SS_LLRDRD "compare decimal" esa +b24d cpya RRE_AA "copy access" esa +19 cr RR_RR "compare" esa +ba cs RS_RRRD "compare and swap" esa +b230 csch S_00 "clear subchannel" esa +b257 cuse RRE_RR "compare until substring equal" esa +b250 csp RRE_RR "compare and swap and purge" esa +4f cvb RX_RRRD "convert to binary" esa +4e cvd RX_RRRD "convert to decimal" esa +5d d RX_RRRD "divide" esa +6d dd RX_FRRD "divide (long)" esa +2d ddr RR_FF "divide (long)" esa +7d de RX_FRRD "divide (short)" esa +3d der RR_FF "divide (short)" esa +83 diag RS_RRRD "diagnose" esa +fd dp SS_LLRDRD "divide decimal" esa +1d dr RR_RR "divide" esa +b22d dxr RRE_F0 "divide (ext.)" esa b24f ear RRE_RA "extract access" esa -de ed SS_L "edit" esa -df edmk SS_L "edit and mark" esa -b226 epar RRE_R "extract primary ASN" esa -b249 ereg RRE "extract stacked registers" esa -b227 esar RRE_R "extract secondary ASN" esa -b24a esta RRE "extract stacked state" esa -44 ex RX "execute" esa -24 hdr RR_D "halve (long)" esa -34 her RR_E "halve (short)" esa -b231 hsch S_O "halt subchannel" esa -b224 iac RRE_R "insert address space control" esa -43 ic RX "insert character" esa -bf icm RS_M "insert characters under mask" esa -b20b ipk S_O "insert PSW key" esa -b222 ipm RRE_R "insert program mask" esa -b221 ipte RRE "invalidate page table entry" esa -b229 iske RRE "insert storage key extended" esa -b223 ivsk RRE "insert virtual storage key" esa -58 l RX "load" esa -41 la RX "load address" esa -51 lae RX "load address extended" esa -9a lam RS_A "load access multiple" esa -e500 lasp SSE "load address space parameters" esa -23 lcdr RR_D "load complement (long)" esa -33 lcer RR_E "load complement (short)" esa -13 lcr RR "load complement" esa -b7 lctl RS_C "load control" esa -68 ld RX_D "load (long)" esa -28 ldr RR_D "load (long)" esa -78 le RX_E "load (short)" esa -38 ler RR_E "load (short)" esa -48 lh RX "load halfword" esa -98 lm RS "load multiple" esa -21 lndr RR_D "load negative (long)" esa -31 lner RR_E "load negative (short)" esa -11 lnr RR "load negative" esa -20 lpdr RR_D "load positive (long)" esa -30 lper RR_E "load positive (short)" esa -10 lpr RR "load positive" esa -82 lpsw S "load PSW" esa -18 lr RR "load" esa -b1 lra RX "load real address" esa -25 lrdr RR_XD "load rounded (ext. to long)" esa -35 lrer RR_DE "load rounded (long to short)" esa -22 ltdr RR_D "load and test (long)" esa -32 lter RR_E "load and test (short)" esa -12 ltr RR "load and test" esa -b24b lura RRE "load using real address" esa -5c m RX "multiply" esa -af mc SI "monitor call" esa -6c md RX_D "multiply (long)" esa -2c mdr RR_D "multiply (long)" esa -7c me RX_ED "multiply (short to long)" esa -3c mer RR_ED "multiply (short to long)" esa -4c mh RX "multiply halfword" esa -fc mp SS_LL "multiply decimal" esa -1c mr RR "multiply" esa -b232 msch S "modify subchannel" esa -b247 msta RRE_R "modify stacked state" esa -d2 mvc SS_L "move" esa -e50f mvcdk SSE "move with destination key" esa -e8 mvcin SS_L "move inverse" esa -d9 mvck SS_RR "move with key" esa -0e mvcl RR "move long" esa -da mvcp SS_RR "move to primary" esa -db mvcs SS_RR "move to secondary" esa -e50e mvcsk SSE "move with source key" esa -92 mvi SI "move" esa -d1 mvn SS_L "move numerics" esa -f1 mvo SS_LL "move with offset" esa -b254 mvpg RRE "move page" esa -b255 mvst RRE "move string" esa -d3 mvz SS_L "move zones" esa -67 mxd RX_DX "multiply (long to ext.)" esa -27 mxdr RR_DX "multiply (long to ext.)" esa -26 mxr RR_X "multiply (ext.)" esa -54 n RX "AND" esa -d4 nc SS_L "AND" esa -94 ni SI "AND" esa -14 nr RR "AND" esa -56 o RX "OR" esa -d6 oc SS_L "OR" esa -96 oi SI "OR" esa -16 or RR "OR" esa -f2 pack SS_LL "pack" esa -b248 palb RRE_O "purge ALB" esa -b218 pc S "program call" esa +de ed SS_L0RDRD "edit" esa +df edmk SS_L0RDRD "edit and mark" esa +b226 epar RRE_R0 "extract primary ASN" esa +b249 ereg RRE_RR "extract stacked registers" esa +b227 esar RRE_R0 "extract secondary ASN" esa +b24a esta RRE_RR "extract stacked state" esa +44 ex RX_RRRD "execute" esa +24 hdr RR_FF "halve (long)" esa +34 her RR_FF "halve (short)" esa +b231 hsch S_00 "halt subchannel" esa +b224 iac RRE_R0 "insert address space control" esa +43 ic RX_RRRD "insert character" esa +bf icm RS_RURD "insert characters under mask" esa +b20b ipk S_00 "insert PSW key" esa +b222 ipm RRE_R0 "insert program mask" esa +b221 ipte RRE_RR "invalidate page table entry" esa +b229 iske RRE_RR "insert storage key extended" esa +b223 ivsk RRE_RR "insert virtual storage key" esa +58 l RX_RRRD "load" esa +41 la RX_RRRD "load address" esa +51 lae RX_RRRD "load address extended" esa +9a lam RS_AARD "load access multiple" esa +e500 lasp SSE_RDRD "load address space parameters" esa +23 lcdr RR_FF "load complement (long)" esa +33 lcer RR_FF "load complement (short)" esa +13 lcr RR_RR "load complement" esa +b7 lctl RS_CCRD "load control" esa +68 ld RX_FRRD "load (long)" esa +28 ldr RR_FF "load (long)" esa +78 le RX_FRRD "load (short)" esa +38 ler RR_FF "load (short)" esa +48 lh RX_RRRD "load halfword" esa +98 lm RS_RRRD "load multiple" esa +21 lndr RR_FF "load negative (long)" esa +31 lner RR_FF "load negative (short)" esa +11 lnr RR_RR "load negative" esa +20 lpdr RR_FF "load positive (long)" esa +30 lper RR_FF "load positive (short)" esa +10 lpr RR_RR "load positive" esa +82 lpsw S_RD "load PSW" esa +18 lr RR_RR "load" esa +b1 lra RX_RRRD "load real address" esa +25 lrdr RR_FF "load rounded (ext. to long)" esa +35 lrer RR_FF "load rounded (long to short)" esa +22 ltdr RR_FF "load and test (long)" esa +32 lter RR_FF "load and test (short)" esa +12 ltr RR_RR "load and test" esa +b24b lura RRE_RR "load using real address" esa +5c m RX_RRRD "multiply" esa +af mc SI_URD "monitor call" esa +6c md RX_FRRD "multiply (long)" esa +2c mdr RR_FF "multiply (long)" esa +7c me RX_FRRD "multiply (short to long)" esa +3c mer RR_FF "multiply (short to long)" esa +4c mh RX_RRRD "multiply halfword" esa +fc mp SS_LLRDRD "multiply decimal" esa +1c mr RR_RR "multiply" esa +b232 msch S_RD "modify subchannel" esa +b247 msta RRE_R0 "modify stacked state" esa +d2 mvc SS_L0RDRD "move" esa +e50f mvcdk SSE_RDRD "move with destination key" esa +e8 mvcin SS_L0RDRD "move inverse" esa +d9 mvck SS_RRRDRD "move with key" esa +0e mvcl RR_RR "move long" esa +da mvcp SS_RRRDRD "move to primary" esa +db mvcs SS_RRRDRD "move to secondary" esa +e50e mvcsk SSE_RDRD "move with source key" esa +92 mvi SI_URD "move" esa +d1 mvn SS_L0RDRD "move numerics" esa +f1 mvo SS_LLRDRD "move with offset" esa +b254 mvpg RRE_RR "move page" esa +b255 mvst RRE_RR "move string" esa +d3 mvz SS_L0RDRD "move zones" esa +67 mxd RX_FRRD "multiply (long to ext.)" esa +27 mxdr RR_FF "multiply (long to ext.)" esa +26 mxr RR_FF "multiply (ext.)" esa +54 n RX_RRRD "AND" esa +d4 nc SS_L0RDRD "AND" esa +94 ni SI_URD "AND" esa +14 nr RR_RR "AND" esa +56 o RX_RRRD "OR" esa +d6 oc SS_L0RDRD "OR" esa +96 oi SI_URD "OR" esa +16 or RR_RR "OR" esa +f2 pack SS_LLRDRD "pack" esa +b248 palb RRE_00 "purge ALB" esa +b218 pc S_RD "program call" esa 0101 pr E "program return" esa -b228 pt RRE "program transfer" esa -b20d ptlb S_O "purge TLB" esa -b23b rchp S_O "reset channel path" esa -b22a rrbe RRE "reset reference bit extended" esa -b238 rsch S_O "resume subchannel" esa -5b s RX "subtract" esa -b219 sac S "set address space control" esa -b279 sacf S "set address space control fast" esa -b237 sal S_O "set address limit" esa +b228 pt RRE_RR "program transfer" esa +b20d ptlb S_00 "purge TLB" esa +b23b rchp S_00 "reset channel path" esa +b22a rrbe RRE_RR "reset reference bit extended" esa +b238 rsch S_00 "resume subchannel" esa +5b s RX_RRRD "subtract" esa +b219 sac S_RD "set address space control" esa +b279 sacf S_RD "set address space control fast" esa +b237 sal S_00 "set address limit" esa b24e sar RRE_AR "set access" esa -b23c schm S_O "set channel monitor" esa -b204 sck S "set clock" esa -b206 sckc S "set clock comparator" esa -6b sd RX_D "subtract normalized (long)" esa -2b sdr RR_D "subtract normalized (long)" esa -7b se RX_E "subtract normalized (short)" esa -3b ser RR_E "subtract normalized (short)" esa -4b sh RX "subtract halfword" esa -b214 sie S "start interpretive execution" esa -ae sigp RS "signal processor" esa -5f sl RX "subtract logical" esa -8b sla RS_S "shift left single" esa -8f slda RS_D "shift left double (long)" esa -8d sldl RS_D "shift left double logical (long)" esa -89 sll RS_S "shift left single logical" esa -1f slr RR "subtract logical" esa -fb sp SS_LL "subtract decimal" esa -b20a spka S "set PSW key from address" esa -04 spm RR_R "set program mask" esa -b208 spt S "set CPU timer" esa -b210 spx S "set prefix" esa -b244 sqdr RRE_D "square root (long)" esa -b245 sqer RRE_E "square root (short)" esa -1b sr RR "subtract" esa -8a sra RS_S "shift right single" esa -8e srda RS_D "shift right double (long)" esa -8c srdl RS_D "shift right double logical (long)" esa -88 srl RS_S "shift right single logical" esa -f0 srp SS_LI "shift and round decimal" esa -b25e srst RRE "search string" esa -b225 ssar RRE_R "set secondary ASN" esa -b233 ssch S "start subchannel" esa -b22b sske RRE "set storage key extended" esa -80 ssm S "set system mask" esa -50 st RX "store" esa -9b stam RS_A "store access multiple" esa -b212 stap S "store CPU address" esa -42 stc RX "store character" esa -b205 stck S "store clock" esa -b207 stckc S "store clock comparator" esa -be stcm RS_M "store characters under mask" esa -b23a stcps S "store channel path status" esa -b239 stcrw S "store channel report word" esa -b6 stctl RS_C "store control" esa -60 std RX_D "store (long)" esa -70 ste RX_E "store (short)" esa -40 sth RX "store halfword" esa -b202 stidp S "store CPU id" esa -90 stm RS "store multiple" esa -ac stnsm SI "store then AND system mask" esa -ad stosm SI "store then OR system mask" esa -b209 stpt S "store CPU timer" esa -b211 stpx S "store prefix" esa -b234 stsch S "store subchannel" esa -b246 stura RRE "store using real address" esa -7f su RX_E "subtract unnormalized (short)" esa -3f sur RR_E "subtract unnormalized (short)" esa -0a svc RR_I "supervisor call" esa -6f sw RX_D "subtract unnormalized (long)" esa -2f swr RR_D "subtract unnormalized (long)" esa -37 sxr RR_X "subtract normalized (ext.)" esa +b23c schm S_00 "set channel monitor" esa +b204 sck S_RD "set clock" esa +b206 sckc S_RD "set clock comparator" esa +6b sd RX_FRRD "subtract normalized (long)" esa +2b sdr RR_FF "subtract normalized (long)" esa +7b se RX_FRRD "subtract normalized (short)" esa +3b ser RR_FF "subtract normalized (short)" esa +4b sh RX_RRRD "subtract halfword" esa +b214 sie S_RD "start interpretive execution" esa +ae sigp RS_RRRD "signal processor" esa +5f sl RX_RRRD "subtract logical" esa +8b sla RS_R0RD "shift left single" esa +8f slda RS_R0RD "shift left double (long)" esa +8d sldl RS_R0RD "shift left double logical (long)" esa +89 sll RS_R0RD "shift left single logical" esa +1f slr RR_RR "subtract logical" esa +fb sp SS_LLRDRD "subtract decimal" esa +b20a spka S_RD "set PSW key from address" esa +04 spm RR_R0 "set program mask" esa +b208 spt S_RD "set CPU timer" esa +b210 spx S_RD "set prefix" esa +b244 sqdr RRE_F0 "square root (long)" esa +b245 sqer RRE_F0 "square root (short)" esa +1b sr RR_RR "subtract" esa +8a sra RS_R0RD "shift right single" esa +8e srda RS_R0RD "shift right double (long)" esa +8c srdl RS_R0RD "shift right double logical (long)" esa +88 srl RS_R0RD "shift right single logical" esa +f0 srp SS_LIRDRD "shift and round decimal" esa +b25e srst RRE_RR "search string" esa +b225 ssar RRE_R0 "set secondary ASN" esa +b233 ssch S_RD "start subchannel" esa +b22b sske RRE_RR "set storage key extended" esa +80 ssm S_RD "set system mask" esa +50 st RX_RRRD "store" esa +9b stam RS_AARD "store access multiple" esa +b212 stap S_RD "store CPU address" esa +42 stc RX_RRRD "store character" esa +b205 stck S_RD "store clock" esa +b207 stckc S_RD "store clock comparator" esa +be stcm RS_RURD "store characters under mask" esa +b23a stcps S_RD "store channel path status" esa +b239 stcrw S_RD "store channel report word" esa +b6 stctl RS_CCRD "store control" esa +60 std RX_FRRD "store (long)" esa +70 ste RX_FRRD "store (short)" esa +40 sth RX_RRRD "store halfword" esa +b202 stidp S_RD "store CPU id" esa +90 stm RS_RRRD "store multiple" esa +ac stnsm SI_URD "store then AND system mask" esa +ad stosm SI_URD "store then OR system mask" esa +b209 stpt S_RD "store CPU timer" esa +b211 stpx S_RD "store prefix" esa +b234 stsch S_RD "store subchannel" esa +b246 stura RRE_RR "store using real address" esa +7f su RX_FRRD "subtract unnormalized (short)" esa +3f sur RR_FF "subtract unnormalized (short)" esa +0a svc RR_U0 "supervisor call" esa +6f sw RX_FRRD "subtract unnormalized (long)" esa +2f swr RR_FF "subtract unnormalized (long)" esa +37 sxr RR_FF "subtract normalized (ext.)" esa b24c tar RRE_AR "test access" esa -b22c tb RRE_R2 "test block" esa -91 tm SI "test under mask" esa -b236 tpi S "test pending interruption" esa -e501 tprot SSE "test protection" esa -dc tr SS_L "translate" esa -99 trace RS "trace" esa -dd trt SS_L "translate and test" esa -93 ts S "test and set" esa -b235 tsch S "test subchannel" esa -f3 unpk SS_LL "unpack" esa +b22c tb RRE_0R "test block" esa +91 tm SI_URD "test under mask" esa +b236 tpi S_RD "test pending interruption" esa +e501 tprot SSE_RDRD "test protection" esa +dc tr SS_L0RDRD "translate" esa +99 trace RS_RRRD "trace" esa +dd trt SS_L0RDRD "translate and test" esa +93 ts S_RD "test and set" esa +b235 tsch S_RD "test subchannel" esa +f3 unpk SS_LLRDRD "unpack" esa 0102 upt E "update tree" esa -57 x RX "exclusive OR" esa -d7 xc SS_L "exclusive OR" esa -97 xi SI "exclusive OR" esa -17 xr RR "exclusive OR" esa -f8 zap SS_LL "zero and add" esa -a70a ahi RI "add halfword immediate" esa -84 brxh RSI_A "branch relative on index high" esa -85 brxle RSI_A "branch relative on index low or equal" esa -a705 bras RI_A "branch relative and save" esa -a704 brc RI_MA "branch relative on condition" esa -a706 brct RI_A "branch relative on count" esa -b241 cksm RRE "checksum" esa -a70e chi RI "compare halfword immediate" esa -a9 clcle RS "compare logical long extended" esa -a708 lhi RI "load halfword immediate" esa -a8 mvcle RS "move long extended" esa -a70c mhi RI "multiply halfword immediate" esa -b252 msr RRE "multiply single" esa -71 ms RX "multiply single" esa -a700 tmh RI_U "test under mask high" esa -a701 tml RI_U "test under mask low" esa -0700 nopr RR_B "no operation" esa -0710 bor RR_B "branch on overflow / if ones" esa -0720 bhr RR_B "branch on high" esa -0720 bpr RR_B "branch on plus" esa -0730 bnler RR_B "branch on not low or equal" esa -0740 blr RR_B "branch on low" esa -0740 bmr RR_B "branch on minus / if mixed" esa -0750 bnher RR_B "branch on not high or equal" esa -0760 blhr RR_B "branch on low or high" esa -0770 bner RR_B "branch on not equal" esa -0770 bnzr RR_B "branch on not zero / if not zeros" esa -0780 ber RR_B "branch on equal" esa -0780 bzr RR_B "branch on zero / if zeros" esa -0790 bnlhr RR_B "branch on not low or high" esa -07a0 bher RR_B "branch on high or equal" esa -07b0 bnlr RR_B "branch on not low" esa -07b0 bnmr RR_B "branch on not minus / if not mixed" esa -07c0 bler RR_B "brach on low or equal" esa -07d0 bnhr RR_B "branch on not high" esa -07d0 bnpr RR_B "branch on not plus" esa -07e0 bnor RR_B "branch on not overflow / if not ones" esa -07f0 br RR_B "unconditional branch" esa -4700 nop RX_B "no operation" esa -4710 bo RX_B "branch on overflow / if ones" esa -4720 bh RX_B "branch on high" esa -4720 bp RX_B "branch on plus" esa -4730 bnle RX_B "branch on not low or equal" esa -4740 bl RX_B "branch on low" esa -4740 bm RX_B "branch on minus / if mixed" esa -4750 bnhe RX_B "branch on not high or equal" esa -4760 blh RX_B "branch on low or high" esa -4770 bne RX_B "branch on not equal" esa -4770 bnz RX_B "branch on not zero / if not zeros" esa -4780 be RX_B "branch on equal" esa -4780 bz RX_B "branch on zero / if zeros" esa -4790 bnlh RX_B "branch on not low or high" esa -47a0 bhe RX_B "branch on high or equal" esa -47b0 bnl RX_B "branch on not low" esa -47b0 bnm RX_B "branch on not minus / if not mixed" esa -47c0 ble RX_B "branch on low or equal" esa -47d0 bnh RX_B "branch on not high" esa -47d0 bnp RX_B "branch on not plus" esa -47e0 bno RX_B "branch on not overflow / if not ones" esa -47f0 b RX_B "unconditional branch" esa -a714 jo RI_B "jump on overflow / if ones" esa -a724 jh RI_B "jump on A high" esa -a724 jp RI_B "jump on plus" esa -a734 jnle RI_B "jump on not low or equal" esa -a744 jl RI_B "jump on A low" esa -a744 jm RI_B "jump on minus / if mixed" esa -a754 jnhe RI_B "jump on not high or equal" esa -a764 jlh RI_B "jump on low or high" esa -a774 jne RI_B "jump on A not equal B" esa -a774 jnz RI_B "jump on not zero / if not zeros" esa -a784 je RI_B "jump on A equal B" esa -a784 jz RI_B "jump on zero / if zeros" esa -a794 jnlh RI_B "jump on not low or high" esa -a7a4 jhe RI_B "jump on high or equal" esa -a7b4 jnl RI_B "jump on A not low" esa -a7b4 jnm RI_B "jump on not minus / if not mixed" esa -a7c4 jle RI_B "jump on low or equal" esa -a7d4 jnh RI_B "jump on A not high" esa -a7d4 jnp RI_B "jump on not plus" esa -a7e4 jno RI_B "jump on not overflow / if not ones" esa -a7f4 j RI_B "jump" esa -b34a axbr RRE_F "add extended bfp" esa -b31a adbr RRE_F "add long bfp" esa -ed000000001a adb RXE_F "add long bfp" esa -b30a aebr RRE_F "add short bfp" esa -ed000000000a aeb RXE_F "add short bfp" esa -b349 cxbr RRE_F "compare extended bfp" esa -b319 cdbr RRE_F "compare long bfp" esa -ed0000000019 cdb RXE_F "compare long bfp" esa -b309 cebr RRE_F "compare short bfp" esa -ed0000000009 ceb RXE_F "compare short bfp" esa -b348 kxbr RRE_F "compare and signal extended bfp" esa -b318 kdbr RRE_F "compare and signal long bfp" esa -ed0000000018 kdb RXE_F "compare and signal long bfp" esa -b308 kebr RRE_F "compare and signal short bfp" esa -ed0000000008 keb RXE_F "compare and signal short bfp" esa -b396 cxfbr RRE_F "convert from fixed 32 to extended bfp" esa -b395 cdfbr RRE_F "convert from fixed 32 to long bfp" esa -b394 cefbr RRE_F "convert from fixed 32 to short bfp" esa -b39a cfxbr RRF_M "convert to fixed extended bfp to 32" esa -b399 cfdbr RRF_M "convert to fixed long bfp to 32" esa -b398 cfebr RRF_M "convert to fixed short bfp to 32" esa -b34d dxbr RRE_F "divide extended bfp" esa -b31d ddbr RRE_F "divide long bfp" esa -ed000000001d ddb RXE_F "divide long bfp" esa -b30d debr RRE_F "divide short bfp" esa -ed000000000d deb RXE_F "divide short bfp" esa -b35b didbr RRF_RM "divide to integer long bfp" esa -b353 diebr RRF_RM "divide to integer short bfp" esa -b38c efpc RRE "extract fpc" esa -b342 ltxbr RRE_F "load and test extended bfp" esa -b312 ltdbr RRE_F "load and test long bfp" esa -b302 ltebr RRE_F "load and test short bfp" esa -b343 lcxbr RRE_F "load complement extended bfp" esa -b313 lcdbr RRE_F "load complement long bfp" esa -b303 lcebr RRE_F "load complement short bfp" esa -b347 fixbr RRF_M "load fp integer extended bfp" esa -b35f fidbr RRF_M "load fp integer long bfp" esa -b357 fiebr RRF_M "load fp integer short bfp" esa -b29d lfpc S "load fpc" esa -b305 lxdbr RRE_F "load lengthened long to extended bfp" esa -ed0000000005 lxdb RXE_F "load lengthened long to extended bfp" esa -b306 lxebr RRE_F "load lengthened short to extended bfp" esa -ed0000000006 lxeb RXE_F "load lengthened short to extended bfp" esa -b304 ldebr RRE_F "load lengthened short to long bfp" esa -ed0000000004 ldeb RXE_F "load lengthened short to long bfp" esa -b341 lnxbr RRE_F "load negative extended bfp" esa -b311 lndbr RRE_F "load negative long bfp" esa -b301 lnebr RRE_F "load negative short bfp" esa -b340 lpxbr RRE_F "load positive extended bfp" esa -b310 lpdbr RRE_F "load positive long bfp" esa -b300 lpebr RRE_F "load positive short bfp" esa -b345 ldxbr RRE_F "load rounded extended to long bfp" esa -b346 lexbr RRE_F "load rounded extended to short bfp" esa -b344 ledbr RRE_F "load rounded long to short bfp" esa -b34c mxbr RRE_F "multiply extended bfp" esa -b31c mdbr RRE_F "multiply long bfp" esa -ed000000001c mdb RXE_F "multiply long bfp" esa -b307 mxdbr RRE_F "multiply long to extended bfp" esa -ed0000000007 mxdb RXE_F "multiply long to extended bfp" esa -b317 meebr RRE_F "multiply short bfp" esa -ed0000000017 meeb RXE_F "multiply short bfp" esa -b30c mdebr RRE_F "multiply short to long bfp" esa -ed000000000c mdeb RXE_F "multiply short to long bfp" esa -b31e madbr RRF_R "multiply and add long bfp" esa -ed000000001e madb RXF "multiply and add long bfp" esa -b30e maebr RRF_R "multiply and add short bfp" esa -ed000000000e maeb RXF "multiply and add short bfp" esa -b31f msdbr RRF_R "multiply and subtract long bfp" esa -ed000000001f msdb RXF "multiply and subtract long bfp" esa -b30f msebr RRF_R "multiply and subtract short bfp" esa -ed000000000f mseb RXF "multiply and subtract short bfp" esa -b384 sfpc RRE "set fpc" esa -b299 srnm S "set rounding mode" esa -b316 sqxbr RRE_F "square root extended bfp" esa -b315 sqdbr RRE_F "square root long bfp" esa -ed0000000015 sqdb RXE_F "square root long bfp" esa -b314 sqebr RRE_F "square root short bfp" esa -ed0000000014 sqeb RXE_F "square root short bfp" esa -b29c stfpc S "store fpc" esa -b34b sxbr RRE_F "subtract extended bfp" esa -b31b sdbr RRE_F "subtract long bfp" esa -ed000000001b sdb RXE_F "subtract long bfp" esa -b30b sebr RRE_F "subtract short bfp" esa -ed000000000b seb RXE_F "subtract short bfp" esa -ed0000000012 tcxb RXE_F "test data class extended bfp" esa -ed0000000011 tcdb RXE_F "test data class long bfp" esa -ed0000000010 tceb RXE_F "test data class short bfp" esa -b274 siga S "signal adapter" esa +57 x RX_RRRD "exclusive OR" esa +d7 xc SS_L0RDRD "exclusive OR" esa +97 xi SI_URD "exclusive OR" esa +17 xr RR_RR "exclusive OR" esa +f8 zap SS_LLRDRD "zero and add" esa +a70a ahi RI_RI "add halfword immediate" esa +84 brxh RSI_RRP "branch relative on index high" esa +85 brxle RSI_RRP "branch relative on index low or equal" esa +a705 bras RI_RP "branch relative and save" esa +a704 brc RI_UP "branch relative on condition" esa +a706 brct RI_RP "branch relative on count" esa +b241 cksm RRE_RR "checksum" esa +a70e chi RI_RI "compare halfword immediate" esa +a9 clcle RS_RRRD "compare logical long extended" esa +a708 lhi RI_RI "load halfword immediate" esa +a8 mvcle RS_RRRD "move long extended" esa +a70c mhi RI_RI "multiply halfword immediate" esa +b252 msr RRE_RR "multiply single" esa +71 ms RX_RRRD "multiply single" esa +a700 tmh RI_RU "test under mask high" esa +a701 tml RI_RU "test under mask low" esa +0700 nopr RR_0R "no operation" esa +0710 bor RR_0R "branch on overflow / if ones" esa +0720 bhr RR_0R "branch on high" esa +0720 bpr RR_0R "branch on plus" esa +0730 bnler RR_0R "branch on not low or equal" esa +0740 blr RR_0R "branch on low" esa +0740 bmr RR_0R "branch on minus / if mixed" esa +0750 bnher RR_0R "branch on not high or equal" esa +0760 blhr RR_0R "branch on low or high" esa +0770 bner RR_0R "branch on not equal" esa +0770 bnzr RR_0R "branch on not zero / if not zeros" esa +0780 ber RR_0R "branch on equal" esa +0780 bzr RR_0R "branch on zero / if zeros" esa +0790 bnlhr RR_0R "branch on not low or high" esa +07a0 bher RR_0R "branch on high or equal" esa +07b0 bnlr RR_0R "branch on not low" esa +07b0 bnmr RR_0R "branch on not minus / if not mixed" esa +07c0 bler RR_0R "brach on low or equal" esa +07d0 bnhr RR_0R "branch on not high" esa +07d0 bnpr RR_0R "branch on not plus" esa +07e0 bnor RR_0R "branch on not overflow / if not ones" esa +07f0 br RR_0R "unconditional branch" esa +4700 nop RX_0RRD "no operation" esa +4710 bo RX_0RRD "branch on overflow / if ones" esa +4720 bh RX_0RRD "branch on high" esa +4720 bp RX_0RRD "branch on plus" esa +4730 bnle RX_0RRD "branch on not low or equal" esa +4740 bl RX_0RRD "branch on low" esa +4740 bm RX_0RRD "branch on minus / if mixed" esa +4750 bnhe RX_0RRD "branch on not high or equal" esa +4760 blh RX_0RRD "branch on low or high" esa +4770 bne RX_0RRD "branch on not equal" esa +4770 bnz RX_0RRD "branch on not zero / if not zeros" esa +4780 be RX_0RRD "branch on equal" esa +4780 bz RX_0RRD "branch on zero / if zeros" esa +4790 bnlh RX_0RRD "branch on not low or high" esa +47a0 bhe RX_0RRD "branch on high or equal" esa +47b0 bnl RX_0RRD "branch on not low" esa +47b0 bnm RX_0RRD "branch on not minus / if not mixed" esa +47c0 ble RX_0RRD "branch on low or equal" esa +47d0 bnh RX_0RRD "branch on not high" esa +47d0 bnp RX_0RRD "branch on not plus" esa +47e0 bno RX_0RRD "branch on not overflow / if not ones" esa +47f0 b RX_0RRD "unconditional branch" esa +a714 jo RI_0P "jump on overflow / if ones" esa +a724 jh RI_0P "jump on A high" esa +a724 jp RI_0P "jump on plus" esa +a734 jnle RI_0P "jump on not low or equal" esa +a744 jl RI_0P "jump on A low" esa +a744 jm RI_0P "jump on minus / if mixed" esa +a754 jnhe RI_0P "jump on not high or equal" esa +a764 jlh RI_0P "jump on low or high" esa +a774 jne RI_0P "jump on A not equal B" esa +a774 jnz RI_0P "jump on not zero / if not zeros" esa +a784 je RI_0P "jump on A equal B" esa +a784 jz RI_0P "jump on zero / if zeros" esa +a794 jnlh RI_0P "jump on not low or high" esa +a7a4 jhe RI_0P "jump on high or equal" esa +a7b4 jnl RI_0P "jump on A not low" esa +a7b4 jnm RI_0P "jump on not minus / if not mixed" esa +a7c4 jle RI_0P "jump on low or equal" esa +a7d4 jnh RI_0P "jump on A not high" esa +a7d4 jnp RI_0P "jump on not plus" esa +a7e4 jno RI_0P "jump on not overflow / if not ones" esa +a7f4 j RI_0P "jump" esa +b34a axbr RRE_FF "add extended bfp" esa +b31a adbr RRE_FF "add long bfp" esa +ed000000001a adb RXE_FRRD "add long bfp" esa +b30a aebr RRE_FF "add short bfp" esa +ed000000000a aeb RXE_FRRD "add short bfp" esa +b349 cxbr RRE_FF "compare extended bfp" esa +b319 cdbr RRE_FF "compare long bfp" esa +ed0000000019 cdb RXE_FRRD "compare long bfp" esa +b309 cebr RRE_FF "compare short bfp" esa +ed0000000009 ceb RXE_FRRD "compare short bfp" esa +b348 kxbr RRE_FF "compare and signal extended bfp" esa +b318 kdbr RRE_FF "compare and signal long bfp" esa +ed0000000018 kdb RXE_FRRD "compare and signal long bfp" esa +b308 kebr RRE_FF "compare and signal short bfp" esa +ed0000000008 keb RXE_FRRD "compare and signal short bfp" esa +b396 cxfbr RRE_RF "convert from fixed 32 to extended bfp" esa +b395 cdfbr RRE_RF "convert from fixed 32 to long bfp" esa +b394 cefbr RRE_RF "convert from fixed 32 to short bfp" esa +b39a cfxbr RRF_U0FR "convert to fixed extended bfp to 32" esa +b399 cfdbr RRF_U0FR "convert to fixed long bfp to 32" esa +b398 cfebr RRF_U0FR "convert to fixed short bfp to 32" esa +b34d dxbr RRE_FF "divide extended bfp" esa +b31d ddbr RRE_FF "divide long bfp" esa +ed000000001d ddb RXE_FRRD "divide long bfp" esa +b30d debr RRE_FF "divide short bfp" esa +ed000000000d deb RXE_FRRD "divide short bfp" esa +b35b didbr RRF_FUFF "divide to integer long bfp" esa +b353 diebr RRF_FUFF "divide to integer short bfp" esa +b38c efpc RRE_RR "extract fpc" esa +b342 ltxbr RRE_FF "load and test extended bfp" esa +b312 ltdbr RRE_FF "load and test long bfp" esa +b302 ltebr RRE_FF "load and test short bfp" esa +b343 lcxbr RRE_FF "load complement extended bfp" esa +b313 lcdbr RRE_FF "load complement long bfp" esa +b303 lcebr RRE_FF "load complement short bfp" esa +b347 fixbr RRF_U0FF "load fp integer extended bfp" esa +b35f fidbr RRF_U0FF "load fp integer long bfp" esa +b357 fiebr RRF_U0FF "load fp integer short bfp" esa +b29d lfpc S_RD "load fpc" esa +b305 lxdbr RRE_FF "load lengthened long to extended bfp" esa +ed0000000005 lxdb RXE_FRRD "load lengthened long to extended bfp" esa +b306 lxebr RRE_FF "load lengthened short to extended bfp" esa +ed0000000006 lxeb RXE_FRRD "load lengthened short to extended bfp" esa +b304 ldebr RRE_FF "load lengthened short to long bfp" esa +ed0000000004 ldeb RXE_FRRD "load lengthened short to long bfp" esa +b341 lnxbr RRE_FF "load negative extended bfp" esa +b311 lndbr RRE_FF "load negative long bfp" esa +b301 lnebr RRE_FF "load negative short bfp" esa +b340 lpxbr RRE_FF "load positive extended bfp" esa +b310 lpdbr RRE_FF "load positive long bfp" esa +b300 lpebr RRE_FF "load positive short bfp" esa +b345 ldxbr RRE_FF "load rounded extended to long bfp" esa +b346 lexbr RRE_FF "load rounded extended to short bfp" esa +b344 ledbr RRE_FF "load rounded long to short bfp" esa +b34c mxbr RRE_FF "multiply extended bfp" esa +b31c mdbr RRE_FF "multiply long bfp" esa +ed000000001c mdb RXE_FRRD "multiply long bfp" esa +b307 mxdbr RRE_FF "multiply long to extended bfp" esa +ed0000000007 mxdb RXE_FRRD "multiply long to extended bfp" esa +b317 meebr RRE_FF "multiply short bfp" esa +ed0000000017 meeb RXE_FRRD "multiply short bfp" esa +b30c mdebr RRE_FF "multiply short to long bfp" esa +ed000000000c mdeb RXE_FRRD "multiply short to long bfp" esa +b31e madbr RRF_F0FF "multiply and add long bfp" esa +ed000000001e madb RXF_FRRDF "multiply and add long bfp" esa +b30e maebr RRF_F0FF "multiply and add short bfp" esa +ed000000000e maeb RXF_FRRDF "multiply and add short bfp" esa +b31f msdbr RRF_F0FF "multiply and subtract long bfp" esa +ed000000001f msdb RXF_FRRDF "multiply and subtract long bfp" esa +b30f msebr RRF_F0FF "multiply and subtract short bfp" esa +ed000000000f mseb RXF_FRRDF "multiply and subtract short bfp" esa +b384 sfpc RRE_RR "set fpc" esa +b299 srnm S_RD "set rounding mode" esa +b316 sqxbr RRE_FF "square root extended bfp" esa +b315 sqdbr RRE_FF "square root long bfp" esa +ed0000000015 sqdb RXE_FRRD "square root long bfp" esa +b314 sqebr RRE_FF "square root short bfp" esa +ed0000000014 sqeb RXE_FRRD "square root short bfp" esa +b29c stfpc S_RD "store fpc" esa +b34b sxbr RRE_FF "subtract extended bfp" esa +b31b sdbr RRE_FF "subtract long bfp" esa +ed000000001b sdb RXE_FRRD "subtract long bfp" esa +b30b sebr RRE_FF "subtract short bfp" esa +ed000000000b seb RXE_FRRD "subtract short bfp" esa +ed0000000012 tcxb RXE_FRRD "test data class extended bfp" esa +ed0000000011 tcdb RXE_FRRD "test data class long bfp" esa +ed0000000010 tceb RXE_FRRD "test data class short bfp" esa +b274 siga S_RD "signal adapter" esa # are the following instructions confidential ?? -b2a6 cuutf RRE "convert unicode to utf-8" esa -b2a7 cutfu RRE "convert utf-8 to unicode" esa -ee plo SS_PLO "perform locked operation" esa -b25a bsa RRE "branch and set authority" esa -b277 rp S "resume program" esa +b2a6 cuutf RRE_RR "convert unicode to utf-8" esa +b2a7 cutfu RRE_RR "convert utf-8 to unicode" esa +ee plo SS_RRRDRD2 "perform locked operation" esa +b25a bsa RRE_RR "branch and set authority" esa +b277 rp S_RD "resume program" esa 0107 sckpf E "set clock programmable field" esa -b27d stsi S "store system information" esa +b27d stsi S_RD "store system information" esa 01ff trap2 E "trap" esa -b2ff trap4 S "trap4" esa +b2ff trap4 S_RD "trap4" esa # Here are the new esame instructions: -b946 bctgr RRE "branch on count 64" esame -b900 lpgr RRE "load positive 64" esame -b910 lpgfr RRE "load positive 64<32" esame -b901 lngr RRE "load negative 64" esame -b911 lngfr RRE "load negative 64<32" esame -b902 ltgr RRE "load and test 64" esame -b912 ltgfr RRE "load and test 64<32" esame -b903 lcgr RRE "load complement 64" esame -b913 lcgfr RRE "load complement 64<32" esame -b980 ngr RRE "and 64" esame -b921 clgr RRE "compare logical 64" esame -b931 clgfr RRE "compare logical 64<32" esame -b981 ogr RRE "or 64" esame -b982 xgr RRE "exclusive or 64" esame -b904 lgr RRE "load 64" esame -b914 lgfr RRE "load 64<32" esame -b920 cgr RRE "compare 64" esame -b930 cgfr RRE "compare 64<32" esame -b908 agr RRE "add 64" esame -b918 agfr RRE "add 64<32" esame -b909 sgr RRE "subtract 64" esame -b919 sgfr RRE "subtract 64<32" esame -b90a algr RRE "add logical 64" esame -b91a algfr RRE "add logical 64<32" esame -b90b slgr RRE "subtract logical 64" esame -b91b slgfr RRE "subtract logical 64<32" esame -e30000000046 bctg RXE "branch on count 64" esame -e3000000002e cvdg RXE "convert to decimal 64" esame -e3000000000e cvbg RXE "convert to binary 64" esame -e30000000024 stg RXE "store 64" esame -e30000000080 ng RXE "and 64" esame -e30000000021 clg RXE "compare logical 64" esame -e30000000031 clgf RXE "comparee logical 64<32" esame -e30000000081 og RXE "or 64" esame -e30000000082 xg RXE "exclusive or 64" esame -e30000000004 lg RXE "load 64" esame -e30000000014 lgf RXE "load 64<32" esame -e30000000015 lgh RXE "load halfword 64" esame -e30000000020 cg RXE "compare 64" esame -e30000000030 cgf RXE "compare 64<32" esame -e30000000008 ag RXE "add 64" esame -e30000000018 agf RXE "add 64<32" esame -e30000000009 sg RXE "subtract 64" esame -e30000000019 sgf RXE "subtract 64<32" esame -e3000000000a alg RXE "add logical 64" esame -e3000000001a algf RXE "add logical 64<32" esame -e3000000000b slg RXE "subtract logical 64" esame -e3000000001b slgf RXE "subtract logical 64<32" esame -e3000000000c msg RXE "multiply single 64" esame -e3000000001c msgf RXE "multiply single 64<32" esame -ec0000000044 brxhg RIE_A "branch relative on index high 64" esame -ec0000000045 brxlg RIE_A "branch relative on index low or equal 64" esame -eb0000000044 bxhg RSE_R "branch on index high 64" esame -eb0000000045 bxleg RSE_R "branch on index low or equal 64" esame -eb000000000c srlg RSE_R "shift right single logical 64" esame -eb000000000d sllg RSE_R "shift left single logical 64" esame -eb000000000a srag RSE_R "shift right single 64" esame -eb000000000b slag RSE_R "shift left single 64" esame -eb0000000024 stmg RSE_R "store multiple 64" esame -eb0000000026 stmh RSE_R "store multiple high" esame -eb0000000004 lmg RSE_R "load multiple 64" esame -eb0000000096 lmh RSE_R "load multiple high" esame -ef lmd SS_LMD "load multiple disjoint" esame -eb000000000f tracg RSE_R "trace 64" esame -e30000000003 lrag RXE "load real address 64" esame -e50000000002 strag SSE "store read address" esame -eb0000000025 stctg RSE_R "store control 64" esame -eb000000002f lctlg RSE_R "load control 64" esame -eb0000000030 csg RSE_R "compare and swap 64" esame -eb000000003e cdsg RSE_R "compare double and swap 64" esame -eb0000000020 clmh RSE_M "compare logical characters under mask high" esame -eb000000002c stcmh RSE_M "store characters under mask high" esame -eb0000000080 icmh RSE_M "insert characters under mask high" esame -a700 tmlh RI_U "test under mask low high" esame -a702 tmhh RI_U "test under mask high high" esame -a701 tmll RI_U "test under mask low low" esame -a703 tmhl RI_U "test under mask high low" esame -c004 brcl RIL_MA "branch relative on condition long" esame -c014 jgo RIL_B "jump long on overflow / if ones" esame -c024 jgh RIL_B "jump long on high" esame -c024 jgp RIL_B "jump long on plus" esame -c034 jgnle RIL_B "jump long on not low or equal" esame -c044 jgl RIL_B "jump long on low" esame -c044 jgm RIL_B "jump long on minus / if mixed" esame -c054 jgnhe RIL_B "jump long on not high or equal" esame -c064 jglh RIL_B "jump long on low or high" esame -c074 jgne RIL_B "jump long on not equal" esame -c074 jgnz RIL_B "jump long on not zero / if not zeros" esame -c084 jge RIL_B "jump long on equal" esame -c084 jgz RIL_B "jump long on zero / if zeros" esame -c094 jgnlh RIL_B "jump long on not low or high" esame -c0a4 jghe RIL_B "jump long on high or equal" esame -c0b4 jgnl RIL_B "jump long on not low" esame -c0b4 jgnm RIL_B "jump long on not minus / if not mixed" esame -c0c4 jgle RIL_B "jump long on low or equal" esame -c0d4 jgnh RIL_B "jump long on not high" esame -c0d4 jgnp RIL_B "jump long on not plus" esame -c0e4 jgno RIL_B "jump long on not overflow / if not ones" esame -c0f4 jg RIL_B "jump long" esame -c005 brasl RIL_A "branch relative and save long" esame -a707 brctg RI_A "branch relative on count 64" esame -a709 lghi RI "load halfword immediate 64" esame -a70b aghi RI "add halfword immediate 64" esame -a70d mghi RI "multiply halfword immediate 64" esame -a70f cghi RI "compare halfword immediate 64" esame -b925 sturg RRE "store using real address 64" esame -b90e eregg RRE "extract stacked registers 64" esame -b905 lurag RRE "load using real address 64" esame -b90c msgr RRE "multiply single 64" esame -b91c msgfr RRE "multiply single 64<32" esame -b3a4 cegbr RRE "convert from fixed 64 to short bfp" esame -b3a5 cdgbr RRE "convert from fixed 64 to long bfp" esame -b3a6 cxgbr RRE "convert from fixed 64 to extended bfp" esame -b3a8 cgebr RRF_M "convert to fixed short bfd to 64" esame -b3a9 cgdbr RRF_M "convert to fixed long bfp to 64" esame -b3aa cgxbr RRF_M "convert to fixed extended bfp to 64" esame -b3c4 cegr RRE "convert from fixed 64 to short hfp" esame -b3c5 cdgr RRE "convert from fixed 64 to long hfp" esame -b3c6 cxgr RRE "convert from fixed 64 to extended hfp" esame -b3c8 cger RRF_F "convert to fixed short hfp to 64" esame -b3c9 cgdr RRF_F "convert to fixed long hfp to 64" esame -b3ca cgxr RRF_F "convert to fixed extended hfp to 64" esame +b946 bctgr RRE_RR "branch on count 64" esame +b900 lpgr RRE_RR "load positive 64" esame +b910 lpgfr RRE_RR "load positive 64<32" esame +b901 lngr RRE_RR "load negative 64" esame +b911 lngfr RRE_RR "load negative 64<32" esame +b902 ltgr RRE_RR "load and test 64" esame +b912 ltgfr RRE_RR "load and test 64<32" esame +b903 lcgr RRE_RR "load complement 64" esame +b913 lcgfr RRE_RR "load complement 64<32" esame +b980 ngr RRE_RR "and 64" esame +b921 clgr RRE_RR "compare logical 64" esame +b931 clgfr RRE_RR "compare logical 64<32" esame +b981 ogr RRE_RR "or 64" esame +b982 xgr RRE_RR "exclusive or 64" esame +b904 lgr RRE_RR "load 64" esame +b914 lgfr RRE_RR "load 64<32" esame +b920 cgr RRE_RR "compare 64" esame +b930 cgfr RRE_RR "compare 64<32" esame +b908 agr RRE_RR "add 64" esame +b918 agfr RRE_RR "add 64<32" esame +b909 sgr RRE_RR "subtract 64" esame +b919 sgfr RRE_RR "subtract 64<32" esame +b90a algr RRE_RR "add logical 64" esame +b91a algfr RRE_RR "add logical 64<32" esame +b90b slgr RRE_RR "subtract logical 64" esame +b91b slgfr RRE_RR "subtract logical 64<32" esame +e30000000046 bctg RXE_RRRD "branch on count 64" esame +e3000000002e cvdg RXE_RRRD "convert to decimal 64" esame +e3000000000e cvbg RXE_RRRD "convert to binary 64" esame +e30000000024 stg RXE_RRRD "store 64" esame +e30000000080 ng RXE_RRRD "and 64" esame +e30000000021 clg RXE_RRRD "compare logical 64" esame +e30000000031 clgf RXE_RRRD "comparee logical 64<32" esame +e30000000081 og RXE_RRRD "or 64" esame +e30000000082 xg RXE_RRRD "exclusive or 64" esame +e30000000004 lg RXE_RRRD "load 64" esame +e30000000014 lgf RXE_RRRD "load 64<32" esame +e30000000015 lgh RXE_RRRD "load halfword 64" esame +e30000000020 cg RXE_RRRD "compare 64" esame +e30000000030 cgf RXE_RRRD "compare 64<32" esame +e30000000008 ag RXE_RRRD "add 64" esame +e30000000018 agf RXE_RRRD "add 64<32" esame +e30000000009 sg RXE_RRRD "subtract 64" esame +e30000000019 sgf RXE_RRRD "subtract 64<32" esame +e3000000000a alg RXE_RRRD "add logical 64" esame +e3000000001a algf RXE_RRRD "add logical 64<32" esame +e3000000000b slg RXE_RRRD "subtract logical 64" esame +e3000000001b slgf RXE_RRRD "subtract logical 64<32" esame +e3000000000c msg RXE_RRRD "multiply single 64" esame +e3000000001c msgf RXE_RRRD "multiply single 64<32" esame +ec0000000044 brxhg RIE_RRP "branch relative on index high 64" esame +ec0000000045 brxlg RIE_RRP "branch relative on index low or equal 64" esame +eb0000000044 bxhg RSE_RRRD "branch on index high 64" esame +eb0000000045 bxleg RSE_RRRD "branch on index low or equal 64" esame +eb000000000c srlg RSE_RRRD "shift right single logical 64" esame +eb000000000d sllg RSE_RRRD "shift left single logical 64" esame +eb000000000a srag RSE_RRRD "shift right single 64" esame +eb000000000b slag RSE_RRRD "shift left single 64" esame +eb0000000024 stmg RSE_RRRD "store multiple 64" esame +eb0000000026 stmh RSE_RRRD "store multiple high" esame +eb0000000004 lmg RSE_RRRD "load multiple 64" esame +eb0000000096 lmh RSE_RRRD "load multiple high" esame +ef lmd SS_RRRDRD3 "load multiple disjoint" esame +eb000000000f tracg RSE_RRRD "trace 64" esame +e30000000003 lrag RXE_RRRD "load real address 64" esame +e50000000002 strag SSE_RDRD "store read address" esame +eb0000000025 stctg RSE_RRRD "store control 64" esame +eb000000002f lctlg RSE_RRRD "load control 64" esame +eb0000000030 csg RSE_RRRD "compare and swap 64" esame +eb000000003e cdsg RSE_RRRD "compare double and swap 64" esame +eb0000000020 clmh RSE_RURD "compare logical characters under mask high" esame +eb000000002c stcmh RSE_RURD "store characters under mask high" esame +eb0000000080 icmh RSE_RURD "insert characters under mask high" esame +a700 tmlh RI_RU "test under mask low high" esame +a702 tmhh RI_RU "test under mask high high" esame +a701 tmll RI_RU "test under mask low low" esame +a703 tmhl RI_RU "test under mask high low" esame +c004 brcl RIL_UP "branch relative on condition long" esame +c014 jgo RIL_0P "jump long on overflow / if ones" esame +c024 jgh RIL_0P "jump long on high" esame +c024 jgp RIL_0P "jump long on plus" esame +c034 jgnle RIL_0P "jump long on not low or equal" esame +c044 jgl RIL_0P "jump long on low" esame +c044 jgm RIL_0P "jump long on minus / if mixed" esame +c054 jgnhe RIL_0P "jump long on not high or equal" esame +c064 jglh RIL_0P "jump long on low or high" esame +c074 jgne RIL_0P "jump long on not equal" esame +c074 jgnz RIL_0P "jump long on not zero / if not zeros" esame +c084 jge RIL_0P "jump long on equal" esame +c084 jgz RIL_0P "jump long on zero / if zeros" esame +c094 jgnlh RIL_0P "jump long on not low or high" esame +c0a4 jghe RIL_0P "jump long on high or equal" esame +c0b4 jgnl RIL_0P "jump long on not low" esame +c0b4 jgnm RIL_0P "jump long on not minus / if not mixed" esame +c0c4 jgle RIL_0P "jump long on low or equal" esame +c0d4 jgnh RIL_0P "jump long on not high" esame +c0d4 jgnp RIL_0P "jump long on not plus" esame +c0e4 jgno RIL_0P "jump long on not overflow / if not ones" esame +c0f4 jg RIL_0P "jump long" esame +c005 brasl RIL_RP "branch relative and save long" esame +a707 brctg RI_RP "branch relative on count 64" esame +a709 lghi RI_RI "load halfword immediate 64" esame +a70b aghi RI_RI "add halfword immediate 64" esame +a70d mghi RI_RI "multiply halfword immediate 64" esame +a70f cghi RI_RI "compare halfword immediate 64" esame +b925 sturg RRE_RR "store using real address 64" esame +b90e eregg RRE_RR "extract stacked registers 64" esame +b905 lurag RRE_RR "load using real address 64" esame +b90c msgr RRE_RR "multiply single 64" esame +b91c msgfr RRE_RR "multiply single 64<32" esame +b3a4 cegbr RRE_RR "convert from fixed 64 to short bfp" esame +b3a5 cdgbr RRE_RR "convert from fixed 64 to long bfp" esame +b3a6 cxgbr RRE_RR "convert from fixed 64 to extended bfp" esame +b3a8 cgebr RRF_U0FR "convert to fixed short bfd to 64" esame +b3a9 cgdbr RRF_U0FR "convert to fixed long bfp to 64" esame +b3aa cgxbr RRF_U0FR "convert to fixed extended bfp to 64" esame +b3c4 cegr RRE_RR "convert from fixed 64 to short hfp" esame +b3c5 cdgr RRE_RR "convert from fixed 64 to long hfp" esame +b3c6 cxgr RRE_RR "convert from fixed 64 to extended hfp" esame +b3c8 cger RRF_U0FR "convert to fixed short hfp to 64" esame +b3c9 cgdr RRF_U0FR "convert to fixed long hfp to 64" esame +b3ca cgxr RRF_U0FR "convert to fixed extended hfp to 64" esame 010b tam E "test addressing mode" esame 010c sam24 E "set addressing mode 24" esame 010d sam31 E "set addressing mode 31" esame 010e sam64 E "set addressing mode 64" esame -a500 iihh RI_U "insert immediate high high" esame -a501 iihl RI_U "insert immediate high low" esame -a502 iilh RI_U "insert immediate low high" esame -a503 iill RI_U "insert immediate low low" esame -a504 nihh RI_U "and immediate high high" esame -a505 nihl RI_U "and immediate high low" esame -a506 nilh RI_U "and immediate low high" esame -a507 nill RI_U "and immediate low low" esame -a508 oihh RI_U "or immediate high high" esame -a509 oihl RI_U "or immediate high low" esame -a50a oilh RI_U "or immediate low high" esame -a50b oill RI_U "or immediate low low" esame -a50c llihh RI_U "load logical immediate high high" esame -a50d llihl RI_U "load logical immediate high low" esame -a50e llilh RI_U "load logical immediate low high" esame -a50f llill RI_U "load logical immediate low low" esame -b2b1 stfl S "store facility list" esame -b2b2 lpswe S "load psw extended" esame -b90d dsgr RRE "divide single 64" esame -b90f lrvgr RRE "load reversed 64" esame -b916 llgfr RRE "load logical 64<32" esame -b917 llgtr RRE "load logical thirty one bits" esame -b91d dsgfr RRE "divide single 64<32" esame -b91f lrvr RRE "load reversed 32" esame -b986 mlgr RRE "multiply logical 64" esame -b987 dlgr RRE "divide logical 64" esame -b988 alcgr RRE "add logical with carry 64" esame -b989 slbgr RRE "subtract logical with borrow 64" esame -b98d epsw RRE "extract psw" esame -b996 mlr RRE "multiply logical 32" esame -b997 dlr RRE "divide logical 32" esame -b998 alcr RRE "add logical with carry 32" esame -b999 slbr RRE "subtract logical with borrow 32" esame -b99d esea RRE_R "extract and set extended authority" esame -c000 larl RIL_A "load address relative long" esame -e3000000000d dsg RXE "divide single 64" esame -e3000000000f lrvg RXE "load reversed 64" esame -e30000000016 llgf RXE "load logical 64<32" esame -e30000000017 llgt RXE "load logical thirty one bits" esame -e3000000001d dsgf RXE "divide single 64<32" esame -e3000000001e lrv RXE "load reversed 32" esame -e3000000001f lrvh RXE "load reversed 16" esame -e3000000002f strvg RXE "store reversed 64" esame -e3000000003e strv RXE "store reversed 32" esame -e3000000003f strvh RXE "store reversed 64" esame -e30000000086 mlg RXE "multiply logical 64" esame -e30000000087 dlg RXE "divide logical 64" esame -e30000000088 alcg RXE "add logical with carry 64" esame -e30000000089 slbg RXE "subtract logical with borrow 64" esame -e3000000008e stpq RXE "store pair to quadword" esame -e3000000008f lpq RXE "load pair from quadword" esame -e30000000096 ml RXE "multiply logical 32" esame -e30000000097 dl RXE "divide logical 32" esame -e30000000098 alc RXE "add logical with carry 32" esame -e30000000099 slb RXE "subtract logical with borrow 32" esame -e30000000090 llgc RXE "load logical character" esame -e30000000091 llgh RXE "load logical halfword" esame -eb000000001c rllg RSE_R "rotate left single logical 64" esame -eb000000001d rll RSE_R "rotate left single logical 32" esame -b278 stcke S "store clock extended" esame -b2a5 tre RRE "translate extended" esame -eb000000008e mvclu RSE_R "move long unicode" esame -e9 pka SS_L "pack ascii" esame -e1 pku SS_L "pack unicode" esame -b993 troo RRE "translate one to one" esame -b992 trot RRE "translate one to two" esame -b991 trto RRE "translate two to one" esame -b990 trtt RRE "translate two to two" esame -ea unpka SS_L "unpack ascii" esame -e2 unpku SS_L "unpack unicode" esame -b358 thder RRE "convert short bfp to long hfp" esame -b359 thdr RRE "convert long bfp to long hfp" esame -b350 tbedr RRF_M "convert long hfp to short bfp" esame -b351 tbdr RRF_M "convert long hfp to long bfp" esame -b374 lzer RRE_R "load short zero" esame -b375 lzdr RRE_R "load long zero" esame -b376 lzxr RRE_R "load extended zero" esame +a500 iihh RI_RU "insert immediate high high" esame +a501 iihl RI_RU "insert immediate high low" esame +a502 iilh RI_RU "insert immediate low high" esame +a503 iill RI_RU "insert immediate low low" esame +a504 nihh RI_RU "and immediate high high" esame +a505 nihl RI_RU "and immediate high low" esame +a506 nilh RI_RU "and immediate low high" esame +a507 nill RI_RU "and immediate low low" esame +a508 oihh RI_RU "or immediate high high" esame +a509 oihl RI_RU "or immediate high low" esame +a50a oilh RI_RU "or immediate low high" esame +a50b oill RI_RU "or immediate low low" esame +a50c llihh RI_RU "load logical immediate high high" esame +a50d llihl RI_RU "load logical immediate high low" esame +a50e llilh RI_RU "load logical immediate low high" esame +a50f llill RI_RU "load logical immediate low low" esame +b2b1 stfl S_RD "store facility list" esame +b2b2 lpswe S_RD "load psw extended" esame +b90d dsgr RRE_RR "divide single 64" esame +b90f lrvgr RRE_RR "load reversed 64" esame +b916 llgfr RRE_RR "load logical 64<32" esame +b917 llgtr RRE_RR "load logical thirty one bits" esame +b91d dsgfr RRE_RR "divide single 64<32" esame +b91f lrvr RRE_RR "load reversed 32" esame +b986 mlgr RRE_RR "multiply logical 64" esame +b987 dlgr RRE_RR "divide logical 64" esame +b988 alcgr RRE_RR "add logical with carry 64" esame +b989 slbgr RRE_RR "subtract logical with borrow 64" esame +b98d epsw RRE_RR "extract psw" esame +b996 mlr RRE_RR "multiply logical 32" esame +b997 dlr RRE_RR "divide logical 32" esame +b998 alcr RRE_RR "add logical with carry 32" esame +b999 slbr RRE_RR "subtract logical with borrow 32" esame +b99d esea RRE_R0 "extract and set extended authority" esame +c000 larl RIL_RP "load address relative long" esame +e3000000000d dsg RXE_RRRD "divide single 64" esame +e3000000000f lrvg RXE_RRRD "load reversed 64" esame +e30000000016 llgf RXE_RRRD "load logical 64<32" esame +e30000000017 llgt RXE_RRRD "load logical thirty one bits" esame +e3000000001d dsgf RXE_RRRD "divide single 64<32" esame +e3000000001e lrv RXE_RRRD "load reversed 32" esame +e3000000001f lrvh RXE_RRRD "load reversed 16" esame +e3000000002f strvg RXE_RRRD "store reversed 64" esame +e3000000003e strv RXE_RRRD "store reversed 32" esame +e3000000003f strvh RXE_RRRD "store reversed 64" esame +e30000000086 mlg RXE_RRRD "multiply logical 64" esame +e30000000087 dlg RXE_RRRD "divide logical 64" esame +e30000000088 alcg RXE_RRRD "add logical with carry 64" esame +e30000000089 slbg RXE_RRRD "subtract logical with borrow 64" esame +e3000000008e stpq RXE_RRRD "store pair to quadword" esame +e3000000008f lpq RXE_RRRD "load pair from quadword" esame +e30000000096 ml RXE_RRRD "multiply logical 32" esame +e30000000097 dl RXE_RRRD "divide logical 32" esame +e30000000098 alc RXE_RRRD "add logical with carry 32" esame +e30000000099 slb RXE_RRRD "subtract logical with borrow 32" esame +e30000000090 llgc RXE_RRRD "load logical character" esame +e30000000091 llgh RXE_RRRD "load logical halfword" esame +eb000000001c rllg RSE_RRRD "rotate left single logical 64" esame +eb000000001d rll RSE_RRRD "rotate left single logical 32" esame +b278 stcke S_RD "store clock extended" esame +b2a5 tre RRE_RR "translate extended" esame +eb000000008e mvclu RSE_RRRD "move long unicode" esame +e9 pka SS_L0RDRD "pack ascii" esame +e1 pku SS_L0RDRD "pack unicode" esame +b993 troo RRE_RR "translate one to one" esame +b992 trot RRE_RR "translate one to two" esame +b991 trto RRE_RR "translate two to one" esame +b990 trtt RRE_RR "translate two to two" esame +ea unpka SS_L0RDRD "unpack ascii" esame +e2 unpku SS_L0RDRD "unpack unicode" esame +b358 thder RRE_RR "convert short bfp to long hfp" esame +b359 thdr RRE_RR "convert long bfp to long hfp" esame +b350 tbedr RRF_U0FF "convert long hfp to short bfp" esame +b351 tbdr RRF_U0FF "convert long hfp to long bfp" esame +b374 lzer RRE_R0 "load short zero" esame +b375 lzdr RRE_R0 "load long zero" esame +b376 lzxr RRE_R0 "load extended zero" esame diff -uprN binutils-2.11.90.0.31/opcodes/tic54x-dis.c binutils-2.11.92.0.5/opcodes/tic54x-dis.c --- binutils-2.11.90.0.31/opcodes/tic54x-dis.c Mon Aug 27 11:44:52 2001 +++ binutils-2.11.92.0.5/opcodes/tic54x-dis.c Mon Oct 1 15:25:26 2001 @@ -197,7 +197,8 @@ print_instruction (info, memaddr, opcode /* string storage for multiple operands */ char operand[4][64] = { {0},{0},{0},{0}, }; bfd_byte buf[2]; - unsigned long opcode2, lkaddr; + unsigned long opcode2 = 0; + unsigned long lkaddr = 0; enum optype src = OP_None; enum optype dst = OP_None; int i, shift; diff -uprN binutils-2.11.90.0.31/opcodes/tic54x-opc.c binutils-2.11.92.0.5/opcodes/tic54x-opc.c --- binutils-2.11.90.0.31/opcodes/tic54x-opc.c Thu Mar 15 14:52:15 2001 +++ binutils-2.11.92.0.5/opcodes/tic54x-opc.c Mon Oct 1 15:25:26 2001 @@ -1,5 +1,5 @@ /* Table of opcodes for the Texas Instruments TMS320C54X - Copyright 1999, 2000 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001 Free Software Foundation, Inc. Contributed by Timothy Wall (twall@cygnus.com) This program is free software; you can redistribute it and/or modify @@ -22,90 +22,90 @@ /* these are the only register names not found in mmregs */ const symbol regs[] = { - { "AR0", 16 }, { "ar0", 16 }, - { "AR1", 17 }, { "ar1", 17 }, - { "AR2", 18 }, { "ar2", 18 }, - { "AR3", 19 }, { "ar3", 19 }, - { "AR4", 20 }, { "ar4", 20 }, - { "AR5", 21 }, { "ar5", 21 }, - { "AR6", 22 }, { "ar6", 22 }, - { "AR7", 23 }, { "ar7", 23 }, - { NULL, } + { "AR0", 16 }, { "ar0", 16 }, + { "AR1", 17 }, { "ar1", 17 }, + { "AR2", 18 }, { "ar2", 18 }, + { "AR3", 19 }, { "ar3", 19 }, + { "AR4", 20 }, { "ar4", 20 }, + { "AR5", 21 }, { "ar5", 21 }, + { "AR6", 22 }, { "ar6", 22 }, + { "AR7", 23 }, { "ar7", 23 }, + { NULL, 0} }; /* status bits, MM registers, condition codes, etc */ /* some symbols are only valid for certain chips... */ const symbol mmregs[] = { - { "IMR", 0 }, { "imr", 0 }, - { "IFR", 1 }, { "ifr", 1 }, - { "ST0", 6 }, { "st0", 6 }, - { "ST1", 7 }, { "st1", 7 }, - { "AL", 8 }, { "al", 8 }, - { "AH", 9 }, { "ah", 9 }, - { "AG", 10 }, { "ag", 10 }, - { "BL", 11 }, { "bl", 11 }, - { "BH", 12 }, { "bh", 12 }, - { "BG", 13 }, { "bg", 13 }, - { "T", 14 }, { "t", 14 }, - { "TRN", 15 }, { "trn", 15 }, - { "AR0", 16 }, { "ar0", 16 }, - { "AR1", 17 }, { "ar1", 17 }, - { "AR2", 18 }, { "ar2", 18 }, - { "AR3", 19 }, { "ar3", 19 }, - { "AR4", 20 }, { "ar4", 20 }, - { "AR5", 21 }, { "ar5", 21 }, - { "AR6", 22 }, { "ar6", 22 }, - { "AR7", 23 }, { "ar7", 23 }, - { "SP", 24 }, { "sp", 24 }, - { "BK", 25 }, { "bk", 25 }, - { "BRC", 26 }, { "brc", 26 }, - { "RSA", 27 }, { "rsa", 27 }, - { "REA", 28 }, { "rea", 28 }, - { "PMST",29 }, { "pmst",29 }, - { "XPC", 30 }, { "xpc", 30 }, /* 'c548 only */ - /* optional peripherals */ /* optional peripherals */ - { "M1F", 31 }, { "m1f", 31 }, - { "DRR0",0x20 }, { "drr0",0x20 }, - { "BDRR0",0x20 }, { "bdrr0",0x20 }, /* 'c543, 545 */ - { "DXR0",0x21 }, { "dxr0",0x21 }, - { "BDXR0",0x21 }, { "bdxr0",0x21 }, /* 'c543, 545 */ - { "SPC0",0x22 }, { "spc0",0x22 }, - { "BSPC0",0x22 }, { "bspc0",0x22 }, /* 'c543, 545 */ - { "SPCE0",0x23 }, { "spce0",0x23 }, - { "BSPCE0",0x23 }, { "bspce0",0x23 }, /* 'c543, 545 */ - { "TIM", 0x24 }, { "tim", 0x24 }, - { "PRD", 0x25 }, { "prd", 0x25 }, - { "TCR", 0x26 }, { "tcr", 0x26 }, - { "SWWSR",0x28 }, { "swwsr",0x28 }, - { "BSCR",0x29 }, { "bscr",0x29 }, - { "HPIC",0x2C }, { "hpic",0x2c }, - /* 'c541, 'c545 */ /* 'c541, 'c545 */ - { "DRR1",0x30 }, { "drr1",0x30 }, - { "DXR1",0x31 }, { "dxr1",0x31 }, - { "SPC1",0x32 }, { "spc1",0x32 }, - /* 'c542, 'c543 */ /* 'c542, 'c543 */ - { "TRCV",0x30 }, { "trcv",0x30 }, - { "TDXR",0x31 }, { "tdxr",0x31 }, - { "TSPC",0x32 }, { "tspc",0x32 }, - { "TCSR",0x33 }, { "tcsr",0x33 }, - { "TRTA",0x34 }, { "trta",0x34 }, - { "TRAD",0x35 }, { "trad",0x35 }, - { "AXR0",0x38 }, { "axr0",0x38 }, - { "BKX0",0x39 }, { "bkx0",0x39 }, - { "ARR0",0x3A }, { "arr0",0x3a }, - { "BKR0",0x3B }, { "bkr0",0x3b }, - /* 'c545, 'c546, 'c548 */ /* 'c545, 'c546, 'c548 */ - { "CLKMD",0x58 }, { "clkmd",0x58 }, - /* 'c548 */ /* 'c548 */ - { "AXR1",0x3C }, { "axr1",0x3c }, - { "BKX1",0x3D }, { "bkx1",0x3d }, - { "ARR1",0x3E }, { "arr1",0x3e }, - { "BKR1",0x3F }, { "bkr1",0x3f }, - { "BDRR1",0x40 }, { "bdrr1",0x40 }, - { "BDXR1",0x41 }, { "bdxr1",0x41 }, - { "BSPC1",0x42 }, { "bspc1",0x42 }, - { "BSPCE1",0x43 }, { "bspce1",0x43 }, - { NULL }, + { "IMR", 0 }, { "imr", 0 }, + { "IFR", 1 }, { "ifr", 1 }, + { "ST0", 6 }, { "st0", 6 }, + { "ST1", 7 }, { "st1", 7 }, + { "AL", 8 }, { "al", 8 }, + { "AH", 9 }, { "ah", 9 }, + { "AG", 10 }, { "ag", 10 }, + { "BL", 11 }, { "bl", 11 }, + { "BH", 12 }, { "bh", 12 }, + { "BG", 13 }, { "bg", 13 }, + { "T", 14 }, { "t", 14 }, + { "TRN", 15 }, { "trn", 15 }, + { "AR0", 16 }, { "ar0", 16 }, + { "AR1", 17 }, { "ar1", 17 }, + { "AR2", 18 }, { "ar2", 18 }, + { "AR3", 19 }, { "ar3", 19 }, + { "AR4", 20 }, { "ar4", 20 }, + { "AR5", 21 }, { "ar5", 21 }, + { "AR6", 22 }, { "ar6", 22 }, + { "AR7", 23 }, { "ar7", 23 }, + { "SP", 24 }, { "sp", 24 }, + { "BK", 25 }, { "bk", 25 }, + { "BRC", 26 }, { "brc", 26 }, + { "RSA", 27 }, { "rsa", 27 }, + { "REA", 28 }, { "rea", 28 }, + { "PMST",29 }, { "pmst",29 }, + { "XPC", 30 }, { "xpc", 30 }, /* 'c548 only */ + /* optional peripherals */ /* optional peripherals */ + { "M1F", 31 }, { "m1f", 31 }, + { "DRR0",0x20 }, { "drr0",0x20 }, + { "BDRR0",0x20 }, { "bdrr0",0x20 }, /* 'c543, 545 */ + { "DXR0",0x21 }, { "dxr0",0x21 }, + { "BDXR0",0x21 }, { "bdxr0",0x21 }, /* 'c543, 545 */ + { "SPC0",0x22 }, { "spc0",0x22 }, + { "BSPC0",0x22 }, { "bspc0",0x22 }, /* 'c543, 545 */ + { "SPCE0",0x23 }, { "spce0",0x23 }, + { "BSPCE0",0x23 }, { "bspce0",0x23 }, /* 'c543, 545 */ + { "TIM", 0x24 }, { "tim", 0x24 }, + { "PRD", 0x25 }, { "prd", 0x25 }, + { "TCR", 0x26 }, { "tcr", 0x26 }, + { "SWWSR",0x28 }, { "swwsr",0x28 }, + { "BSCR",0x29 }, { "bscr",0x29 }, + { "HPIC",0x2C }, { "hpic",0x2c }, + /* 'c541, 'c545 */ /* 'c541, 'c545 */ + { "DRR1",0x30 }, { "drr1",0x30 }, + { "DXR1",0x31 }, { "dxr1",0x31 }, + { "SPC1",0x32 }, { "spc1",0x32 }, + /* 'c542, 'c543 */ /* 'c542, 'c543 */ + { "TRCV",0x30 }, { "trcv",0x30 }, + { "TDXR",0x31 }, { "tdxr",0x31 }, + { "TSPC",0x32 }, { "tspc",0x32 }, + { "TCSR",0x33 }, { "tcsr",0x33 }, + { "TRTA",0x34 }, { "trta",0x34 }, + { "TRAD",0x35 }, { "trad",0x35 }, + { "AXR0",0x38 }, { "axr0",0x38 }, + { "BKX0",0x39 }, { "bkx0",0x39 }, + { "ARR0",0x3A }, { "arr0",0x3a }, + { "BKR0",0x3B }, { "bkr0",0x3b }, + /* 'c545, 'c546, 'c548 */ /* 'c545, 'c546, 'c548 */ + { "CLKMD",0x58 }, { "clkmd",0x58 }, + /* 'c548 */ /* 'c548 */ + { "AXR1",0x3C }, { "axr1",0x3c }, + { "BKX1",0x3D }, { "bkx1",0x3d }, + { "ARR1",0x3E }, { "arr1",0x3e }, + { "BKR1",0x3F }, { "bkr1",0x3f }, + { "BDRR1",0x40 }, { "bdrr1",0x40 }, + { "BDXR1",0x41 }, { "bdxr1",0x41 }, + { "BSPC1",0x42 }, { "bspc1",0x42 }, + { "BSPCE1",0x43 }, { "bspce1",0x43 }, + { NULL, 0}, }; const symbol condition_codes[] = { @@ -131,25 +131,25 @@ const symbol condition_codes[] = { { "aneq", CC1|CCNEQ }, { "ANEQ", CC1|CCNEQ }, { "alt", CC1|CCLT }, { "ALT", CC1|CCLT }, { "aleq", CC1|CCLEQ }, { "ALEQ", CC1|CCLEQ }, - { "agt", CC1|CCGT }, { "AGT", CC1|CCGT }, - { "ageq", CC1|CCGEQ }, { "AGEQ", CC1|CCGEQ }, - { "aov", CC1|CCOV }, { "AOV", CC1|CCOV }, - { "anov", CC1|CCNOV }, { "ANOV", CC1|CCNOV }, - { "beq", CC1|CCB|CCEQ }, { "BEQ", CC1|CCB|CCEQ }, - { "bneq", CC1|CCB|CCNEQ }, { "BNEQ", CC1|CCB|CCNEQ }, - { "blt", CC1|CCB|CCLT }, { "BLT", CC1|CCB|CCLT }, - { "bleq", CC1|CCB|CCLEQ }, { "BLEQ", CC1|CCB|CCLEQ }, - { "bgt", CC1|CCB|CCGT }, { "BGT", CC1|CCB|CCGT }, - { "bgeq", CC1|CCB|CCGEQ }, { "BGEQ", CC1|CCB|CCGEQ }, - { "bov", CC1|CCB|CCOV }, { "BOV", CC1|CCB|CCOV }, - { "bnov", CC1|CCB|CCNOV }, { "BNOV", CC1|CCB|CCNOV }, - { "tc", CCTC }, { "TC", CCTC }, - { "ntc", CCNTC }, { "NTC", CCNTC }, - { "c", CCC }, { "C", CCC }, - { "nc", CCNC }, { "NC", CCNC }, - { "bio", CCBIO }, { "BIO", CCBIO }, - { "nbio", CCNBIO }, { "NBIO", CCNBIO }, - { NULL, } + { "agt", CC1|CCGT }, { "AGT", CC1|CCGT }, + { "ageq", CC1|CCGEQ }, { "AGEQ", CC1|CCGEQ }, + { "aov", CC1|CCOV }, { "AOV", CC1|CCOV }, + { "anov", CC1|CCNOV }, { "ANOV", CC1|CCNOV }, + { "beq", CC1|CCB|CCEQ }, { "BEQ", CC1|CCB|CCEQ }, + { "bneq", CC1|CCB|CCNEQ }, { "BNEQ", CC1|CCB|CCNEQ }, + { "blt", CC1|CCB|CCLT }, { "BLT", CC1|CCB|CCLT }, + { "bleq", CC1|CCB|CCLEQ }, { "BLEQ", CC1|CCB|CCLEQ }, + { "bgt", CC1|CCB|CCGT }, { "BGT", CC1|CCB|CCGT }, + { "bgeq", CC1|CCB|CCGEQ }, { "BGEQ", CC1|CCB|CCGEQ }, + { "bov", CC1|CCB|CCOV }, { "BOV", CC1|CCB|CCOV }, + { "bnov", CC1|CCB|CCNOV }, { "BNOV", CC1|CCB|CCNOV }, + { "tc", CCTC }, { "TC", CCTC }, + { "ntc", CCNTC }, { "NTC", CCNTC }, + { "c", CCC }, { "C", CCC }, + { "nc", CCNC }, { "NC", CCNC }, + { "bio", CCBIO }, { "BIO", CCBIO }, + { "nbio", CCNBIO }, { "NBIO", CCNBIO }, + { NULL, 0 } }; const symbol cc2_codes[] = { @@ -166,7 +166,7 @@ const symbol cc2_codes[] = { { "BLT", 11 }, { "blt", 11 }, { "BLEQ", 15 },{ "bleq", 15 }, { "BGEQ", 10 },{ "bgeq", 10 }, - { NULL }, + { NULL, 0 }, }; const symbol cc3_codes[] = { @@ -174,15 +174,15 @@ const symbol cc3_codes[] = { { "LT", 0x0100 }, { "lt", 0x0100 }, { "GT", 0x0200 }, { "gt", 0x0200 }, { "NEQ", 0x0300 }, { "neq", 0x0300 }, - { "0", 0x0000 }, + { "0", 0x0000 }, { "1", 0x0100 }, { "2", 0x0200 }, { "3", 0x0300 }, - { "00", 0x0000 }, + { "00", 0x0000 }, { "01", 0x0100 }, { "10", 0x0200 }, { "11", 0x0300 }, - { NULL }, + { NULL, 0 }, }; /* FIXME -- also allow decimal digits */ @@ -203,7 +203,7 @@ const symbol status_bits[] = { { "C16", 7 }, { "c16", 7 }, { "FRCT", 6 }, { "frct", 6 }, { "CMPT", 5 }, { "cmpt", 5 }, - { NULL }, + { NULL, 0 }, }; const char *misc_symbols[] = { @@ -216,7 +216,7 @@ const char *misc_symbols[] = { /* Due to the way instructions are hashed and scanned in gas/config/tc-tic54x.c, all identically-named opcodes must be consecutively - placed + placed Items marked with "PREFER" have been moved prior to a more costly instruction with a similar operand format. @@ -225,236 +225,236 @@ const char *misc_symbols[] = { as an argument are arranged so that the more restrictive (predefined symbol) version is checked first (marked "SRC"). */ -const template tic54x_unknown_opcode = - { "???", 1,0,0,0x0000, 0x0000, {0}, }; +const template tic54x_unknown_opcode = + { "???", 1,0,0,0x0000, 0x0000, {0}, 0, 0, 0}; const template tic54x_optab[] = { /* these must precede bc/bcd, cc/ccd to avoid misinterpretation */ - { "fb", 2,1,1,0xF880, 0xFF80, {OP_xpmad}, B_BRANCH|FL_FAR|FL_NR, }, - { "fbd", 2,1,1,0xFA80, 0xFF80, {OP_xpmad}, B_BRANCH|FL_FAR|FL_DELAY|FL_NR, }, - { "fcall", 2,1,1,0xF980, 0xFF80, {OP_xpmad}, B_BRANCH|FL_FAR|FL_NR, }, - { "fcalld",2,1,1,0xFB80, 0xFF80, {OP_xpmad}, B_BRANCH|FL_FAR|FL_DELAY|FL_NR, }, - - { "abdst", 1,2,2,0xE300, 0xFF00, {OP_Xmem,OP_Ymem}, }, - { "abs", 1,1,2,0xF485, 0xFCFF, {OP_SRC,OPT|OP_DST}, }, - { "add", 1,1,3,0xF400, 0xFCE0, {OP_SRC,OPT|OP_SHIFT,OPT|OP_DST}, },/*SRC*/ - { "add", 1,2,3,0xF480, 0xFCFF, {OP_SRC,OP_ASM,OPT|OP_DST}, },/*SRC*/ - { "add", 1,2,2,0x0000, 0xFE00, {OP_Smem,OP_SRC1}, FL_SMR }, - { "add", 1,3,3,0x0400, 0xFE00, {OP_Smem,OP_TS,OP_SRC1}, FL_SMR }, - { "add", 1,3,4,0x3C00, 0xFC00, {OP_Smem,OP_16,OP_SRC,OPT|OP_DST}, FL_SMR}, - { "add", 1,3,3,0x9000, 0xFE00, {OP_Xmem,OP_SHFT,OP_SRC1}, },/*PREFER*/ - { "add", 2,2,4,0x6F00, 0xFF00, {OP_Smem,OPT|OP_SHIFT,OP_SRC,OPT|OP_DST}, + { "fb", 2,1,1,0xF880, 0xFF80, {OP_xpmad}, B_BRANCH|FL_FAR|FL_NR, 0, 0 }, + { "fbd", 2,1,1,0xFA80, 0xFF80, {OP_xpmad}, B_BRANCH|FL_FAR|FL_DELAY|FL_NR, 0, 0 }, + { "fcall", 2,1,1,0xF980, 0xFF80, {OP_xpmad}, B_BRANCH|FL_FAR|FL_NR, 0, 0 }, + { "fcalld",2,1,1,0xFB80, 0xFF80, {OP_xpmad}, B_BRANCH|FL_FAR|FL_DELAY|FL_NR, 0, 0 }, + + { "abdst", 1,2,2,0xE300, 0xFF00, {OP_Xmem,OP_Ymem}, 0, 0, 0 }, + { "abs", 1,1,2,0xF485, 0xFCFF, {OP_SRC,OPT|OP_DST}, 0, 0, 0 }, + { "add", 1,1,3,0xF400, 0xFCE0, {OP_SRC,OPT|OP_SHIFT,OPT|OP_DST}, 0, 0, 0 },/*SRC*/ + { "add", 1,2,3,0xF480, 0xFCFF, {OP_SRC,OP_ASM,OPT|OP_DST}, 0, 0, 0},/*SRC*/ + { "add", 1,2,2,0x0000, 0xFE00, {OP_Smem,OP_SRC1}, FL_SMR, 0, 0 }, + { "add", 1,3,3,0x0400, 0xFE00, {OP_Smem,OP_TS,OP_SRC1}, FL_SMR, 0, 0 }, + { "add", 1,3,4,0x3C00, 0xFC00, {OP_Smem,OP_16,OP_SRC,OPT|OP_DST}, FL_SMR, 0, 0 }, + { "add", 1,3,3,0x9000, 0xFE00, {OP_Xmem,OP_SHFT,OP_SRC1}, 0, 0, 0 },/*PREFER*/ + { "add", 2,2,4,0x6F00, 0xFF00, {OP_Smem,OPT|OP_SHIFT,OP_SRC,OPT|OP_DST}, FL_EXT|FL_SMR, 0x0C00, 0xFCE0}, - { "add", 1,3,3,0xA000, 0xFE00, {OP_Xmem,OP_Ymem,OP_DST}, }, - { "add", 2,2,4,0xF000, 0xFCF0, {OP_lk,OPT|OP_SHIFT,OP_SRC,OPT|OP_DST}, }, - { "add", 2,3,4,0xF060, 0xFCFF, {OP_lk,OP_16,OP_SRC,OPT|OP_DST}, }, - { "addc", 1,2,2,0x0600, 0xFE00, {OP_Smem,OP_SRC1}, FL_SMR }, - { "addm", 2,2,2,0x6B00, 0xFF00, {OP_lk,OP_Smem}, FL_NR|FL_SMR, }, - { "adds", 1,2,2,0x0200, 0xFE00, {OP_Smem,OP_SRC1}, FL_SMR }, - { "and", 1,1,3,0xF080, 0xFCE0, {OP_SRC,OPT|OP_SHIFT,OPT|OP_DST}, }, - { "and", 1,2,2,0x1800, 0xFE00, {OP_Smem,OP_SRC1}, FL_SMR }, - { "and", 2,2,4,0xF030, 0xFCF0, {OP_lk,OPT|OP_SHFT,OP_SRC,OPT|OP_DST}, }, - { "and", 2,3,4,0xF063, 0xFCFF, {OP_lk,OP_16,OP_SRC,OPT|OP_DST}, }, - { "andm", 2,2,2,0x6800, 0xFF00, {OP_lk,OP_Smem}, FL_NR, }, - { "b", 2,1,1,0xF073, 0xFFFF, {OP_pmad}, B_BRANCH|FL_NR, }, - { "bd", 2,1,1,0xF273, 0xFFFF, {OP_pmad}, B_BRANCH|FL_DELAY|FL_NR, }, - { "bacc", 1,1,1,0xF4E2, 0xFEFF, {OP_SRC1}, B_BACC|FL_NR, }, - { "baccd", 1,1,1,0xF6E2, 0xFEFF, {OP_SRC1}, B_BACC|FL_DELAY|FL_NR, }, - { "banz", 2,2,2,0x6C00, 0xFF00, {OP_pmad,OP_Sind}, B_BRANCH|FL_NR, }, - { "banzd", 2,2,2,0x6E00, 0xFF00, {OP_pmad,OP_Sind}, B_BRANCH|FL_DELAY|FL_NR, }, - { "bc", 2,2,4,0xF800, 0xFF00, {OP_pmad,OP_CC,OPT|OP_CC,OPT|OP_CC}, - B_BRANCH|FL_NR, }, + { "add", 1,3,3,0xA000, 0xFE00, {OP_Xmem,OP_Ymem,OP_DST}, 0, 0, 0}, + { "add", 2,2,4,0xF000, 0xFCF0, {OP_lk,OPT|OP_SHIFT,OP_SRC,OPT|OP_DST}, 0, 0, 0 }, + { "add", 2,3,4,0xF060, 0xFCFF, {OP_lk,OP_16,OP_SRC,OPT|OP_DST}, 0, 0, 0 }, + { "addc", 1,2,2,0x0600, 0xFE00, {OP_Smem,OP_SRC1}, FL_SMR, 0, 0 }, + { "addm", 2,2,2,0x6B00, 0xFF00, {OP_lk,OP_Smem}, FL_NR|FL_SMR, 0, 0 }, + { "adds", 1,2,2,0x0200, 0xFE00, {OP_Smem,OP_SRC1}, FL_SMR, 0, 0 }, + { "and", 1,1,3,0xF080, 0xFCE0, {OP_SRC,OPT|OP_SHIFT,OPT|OP_DST}, 0, 0, 0 }, + { "and", 1,2,2,0x1800, 0xFE00, {OP_Smem,OP_SRC1}, FL_SMR, 0, 0 }, + { "and", 2,2,4,0xF030, 0xFCF0, {OP_lk,OPT|OP_SHFT,OP_SRC,OPT|OP_DST}, 0, 0, 0 }, + { "and", 2,3,4,0xF063, 0xFCFF, {OP_lk,OP_16,OP_SRC,OPT|OP_DST}, 0, 0, 0 }, + { "andm", 2,2,2,0x6800, 0xFF00, {OP_lk,OP_Smem}, FL_NR, 0, 0 }, + { "b", 2,1,1,0xF073, 0xFFFF, {OP_pmad}, B_BRANCH|FL_NR, 0, 0 }, + { "bd", 2,1,1,0xF273, 0xFFFF, {OP_pmad}, B_BRANCH|FL_DELAY|FL_NR, 0, 0 }, + { "bacc", 1,1,1,0xF4E2, 0xFEFF, {OP_SRC1}, B_BACC|FL_NR, 0, 0 }, + { "baccd", 1,1,1,0xF6E2, 0xFEFF, {OP_SRC1}, B_BACC|FL_DELAY|FL_NR, 0, 0 }, + { "banz", 2,2,2,0x6C00, 0xFF00, {OP_pmad,OP_Sind}, B_BRANCH|FL_NR, 0, 0 }, + { "banzd", 2,2,2,0x6E00, 0xFF00, {OP_pmad,OP_Sind}, B_BRANCH|FL_DELAY|FL_NR, 0, 0 }, + { "bc", 2,2,4,0xF800, 0xFF00, {OP_pmad,OP_CC,OPT|OP_CC,OPT|OP_CC}, + B_BRANCH|FL_NR, 0, 0 }, { "bcd", 2,2,4,0xFA00, 0xFF00, {OP_pmad,OP_CC,OPT|OP_CC,OPT|OP_CC}, - B_BRANCH|FL_DELAY|FL_NR, }, - { "bit", 1,2,2,0x9600, 0xFF00, {OP_Xmem,OP_BITC}, }, - { "bitf", 2,2,2,0x6100, 0xFF00, {OP_Smem,OP_lk}, FL_SMR }, - { "bitt", 1,1,1,0x3400, 0xFF00, {OP_Smem}, FL_SMR }, - { "cala", 1,1,1,0xF4E3, 0xFEFF, {OP_SRC1}, B_BACC|FL_NR, }, - { "calad", 1,1,1,0xF6E3, 0xFEFF, {OP_SRC1}, B_BACC|FL_DELAY|FL_NR, }, - { "call", 2,1,1,0xF074, 0xFFFF, {OP_pmad}, B_BRANCH|FL_NR, }, - { "calld", 2,1,1,0xF274, 0xFFFF, {OP_pmad}, B_BRANCH|FL_DELAY|FL_NR, }, - { "cc", 2,2,4,0xF900, 0xFF00, {OP_pmad,OP_CC,OPT|OP_CC,OPT|OP_CC}, - B_BRANCH|FL_NR, }, + B_BRANCH|FL_DELAY|FL_NR, 0, 0 }, + { "bit", 1,2,2,0x9600, 0xFF00, {OP_Xmem,OP_BITC}, 0, 0, 0 }, + { "bitf", 2,2,2,0x6100, 0xFF00, {OP_Smem,OP_lk}, FL_SMR, 0, 0 }, + { "bitt", 1,1,1,0x3400, 0xFF00, {OP_Smem}, FL_SMR, 0, 0 }, + { "cala", 1,1,1,0xF4E3, 0xFEFF, {OP_SRC1}, B_BACC|FL_NR, 0, 0 }, + { "calad", 1,1,1,0xF6E3, 0xFEFF, {OP_SRC1}, B_BACC|FL_DELAY|FL_NR, 0, 0 }, + { "call", 2,1,1,0xF074, 0xFFFF, {OP_pmad}, B_BRANCH|FL_NR, 0, 0 }, + { "calld", 2,1,1,0xF274, 0xFFFF, {OP_pmad}, B_BRANCH|FL_DELAY|FL_NR, 0, 0 }, + { "cc", 2,2,4,0xF900, 0xFF00, {OP_pmad,OP_CC,OPT|OP_CC,OPT|OP_CC}, + B_BRANCH|FL_NR, 0, 0 }, { "ccd", 2,2,4,0xFB00, 0xFF00, {OP_pmad,OP_CC,OPT|OP_CC,OPT|OP_CC}, - B_BRANCH|FL_DELAY|FL_NR, }, - { "cmpl", 1,1,2,0xF493, 0xFCFF, {OP_SRC,OPT|OP_DST}, }, - { "cmpm", 2,2,2,0x6000, 0xFF00, {OP_Smem,OP_lk}, FL_SMR }, - { "cmpr", 1,2,2,0xF4A8, 0xFCF8, {OP_CC3,OP_ARX}, FL_NR, }, - { "cmps", 1,2,2,0x8E00, 0xFE00, {OP_SRC1,OP_Smem}, }, - { "dadd", 1,2,3,0x5000, 0xFC00, {OP_Lmem,OP_SRC,OPT|OP_DST}, }, - { "dadst", 1,2,2,0x5A00, 0xFE00, {OP_Lmem,OP_DST}, }, - { "delay", 1,1,1,0x4D00, 0xFF00, {OP_Smem}, FL_SMR }, - { "dld", 1,2,2,0x5600, 0xFE00, {OP_Lmem,OP_DST}, }, - { "drsub", 1,2,2,0x5800, 0xFE00, {OP_Lmem,OP_SRC1}, }, - { "dsadt", 1,2,2,0x5E00, 0xFE00, {OP_Lmem,OP_DST}, }, - { "dst", 1,2,2,0x4E00, 0xFE00, {OP_SRC1,OP_Lmem}, FL_NR, }, - { "dsub", 1,2,2,0x5400, 0xFE00, {OP_Lmem,OP_SRC1}, }, - { "dsubt", 1,2,2,0x5C00, 0xFE00, {OP_Lmem,OP_DST}, }, - { "exp", 1,1,1,0xF48E, 0xFEFF, {OP_SRC1}, }, - { "fbacc", 1,1,1,0xF4E6, 0xFEFF, {OP_SRC1}, B_BACC|FL_FAR|FL_NR, }, - { "fbaccd",1,1,1,0xF6E6, 0xFEFF, {OP_SRC1}, B_BACC|FL_FAR|FL_DELAY|FL_NR, }, - { "fcala", 1,1,1,0xF4E7, 0xFEFF, {OP_SRC1}, B_BACC|FL_FAR|FL_NR, }, - { "fcalad",1,1,1,0xF6E7, 0xFEFF, {OP_SRC1}, B_BACC|FL_FAR|FL_DELAY|FL_NR, }, - { "firs", 2,3,3,0xE000, 0xFF00, {OP_Xmem,OP_Ymem,OP_pmad}, }, - { "frame", 1,1,1,0xEE00, 0xFF00, {OP_k8}, }, - { "fret", 1,0,0,0xF4E4, 0xFFFF, {OP_None}, B_RET|FL_FAR|FL_NR, }, - { "fretd", 1,0,0,0xF6E4, 0xFFFF, {OP_None}, B_RET|FL_FAR|FL_DELAY|FL_NR, }, - { "frete", 1,0,0,0xF4E5, 0xFFFF, {OP_None}, B_RET|FL_FAR|FL_NR, }, - { "freted",1,0,0,0xF6E5, 0xFFFF, {OP_None}, B_RET|FL_FAR|FL_DELAY|FL_NR, }, - { "idle", 1,1,1,0xF4E1, 0xFCFF, {OP_123}, FL_NR, }, - { "intr", 1,1,1,0xF7C0, 0xFFE0, {OP_031}, B_BRANCH|FL_NR, }, - { "ld", 1,2,3,0xF482, 0xFCFF, {OP_SRC,OP_ASM,OPT|OP_DST}, },/*SRC*/ - { "ld", 1,2,3,0xF440, 0xFCE0, {OP_SRC,OPT|OP_SHIFT,OP_DST}, },/*SRC*/ + B_BRANCH|FL_DELAY|FL_NR, 0, 0 }, + { "cmpl", 1,1,2,0xF493, 0xFCFF, {OP_SRC,OPT|OP_DST}, 0, 0, 0 }, + { "cmpm", 2,2,2,0x6000, 0xFF00, {OP_Smem,OP_lk}, FL_SMR, 0, 0 }, + { "cmpr", 1,2,2,0xF4A8, 0xFCF8, {OP_CC3,OP_ARX}, FL_NR, 0, 0 }, + { "cmps", 1,2,2,0x8E00, 0xFE00, {OP_SRC1,OP_Smem}, 0, 0, 0 }, + { "dadd", 1,2,3,0x5000, 0xFC00, {OP_Lmem,OP_SRC,OPT|OP_DST}, 0, 0, 0 }, + { "dadst", 1,2,2,0x5A00, 0xFE00, {OP_Lmem,OP_DST}, 0, 0, 0 }, + { "delay", 1,1,1,0x4D00, 0xFF00, {OP_Smem}, FL_SMR, 0, 0 }, + { "dld", 1,2,2,0x5600, 0xFE00, {OP_Lmem,OP_DST}, 0, 0, 0 }, + { "drsub", 1,2,2,0x5800, 0xFE00, {OP_Lmem,OP_SRC1}, 0, 0, 0 }, + { "dsadt", 1,2,2,0x5E00, 0xFE00, {OP_Lmem,OP_DST}, 0, 0, 0 }, + { "dst", 1,2,2,0x4E00, 0xFE00, {OP_SRC1,OP_Lmem}, FL_NR, 0, 0 }, + { "dsub", 1,2,2,0x5400, 0xFE00, {OP_Lmem,OP_SRC1}, 0, 0, 0 }, + { "dsubt", 1,2,2,0x5C00, 0xFE00, {OP_Lmem,OP_DST}, 0, 0, 0 }, + { "exp", 1,1,1,0xF48E, 0xFEFF, {OP_SRC1}, 0, 0, 0 }, + { "fbacc", 1,1,1,0xF4E6, 0xFEFF, {OP_SRC1}, B_BACC|FL_FAR|FL_NR, 0, 0 }, + { "fbaccd",1,1,1,0xF6E6, 0xFEFF, {OP_SRC1}, B_BACC|FL_FAR|FL_DELAY|FL_NR, 0, 0 }, + { "fcala", 1,1,1,0xF4E7, 0xFEFF, {OP_SRC1}, B_BACC|FL_FAR|FL_NR, 0, 0 }, + { "fcalad",1,1,1,0xF6E7, 0xFEFF, {OP_SRC1}, B_BACC|FL_FAR|FL_DELAY|FL_NR, 0, 0 }, + { "firs", 2,3,3,0xE000, 0xFF00, {OP_Xmem,OP_Ymem,OP_pmad}, 0, 0, 0 }, + { "frame", 1,1,1,0xEE00, 0xFF00, {OP_k8}, 0, 0, 0 }, + { "fret", 1,0,0,0xF4E4, 0xFFFF, {OP_None}, B_RET|FL_FAR|FL_NR, 0, 0 }, + { "fretd", 1,0,0,0xF6E4, 0xFFFF, {OP_None}, B_RET|FL_FAR|FL_DELAY|FL_NR, 0, 0 }, + { "frete", 1,0,0,0xF4E5, 0xFFFF, {OP_None}, B_RET|FL_FAR|FL_NR, 0, 0 }, + { "freted",1,0,0,0xF6E5, 0xFFFF, {OP_None}, B_RET|FL_FAR|FL_DELAY|FL_NR, 0, 0 }, + { "idle", 1,1,1,0xF4E1, 0xFCFF, {OP_123}, FL_NR, 0, 0 }, + { "intr", 1,1,1,0xF7C0, 0xFFE0, {OP_031}, B_BRANCH|FL_NR, 0, 0 }, + { "ld", 1,2,3,0xF482, 0xFCFF, {OP_SRC,OP_ASM,OPT|OP_DST}, 0, 0, 0 },/*SRC*/ + { "ld", 1,2,3,0xF440, 0xFCE0, {OP_SRC,OPT|OP_SHIFT,OP_DST}, 0, 0, 0 },/*SRC*/ /* alternate syntax */ - { "ld", 1,2,3,0xF440, 0xFCE0, {OP_SRC,OP_SHIFT,OPT|OP_DST}, },/*SRC*/ - { "ld", 1,2,2,0xE800, 0xFE00, {OP_k8u,OP_DST}, },/*SRC*/ - { "ld", 1,2,2,0xED00, 0xFFE0, {OP_k5,OP_ASM}, },/*SRC*/ - { "ld", 1,2,2,0xF4A0, 0xFFF8, {OP_k3,OP_ARP}, FL_NR, },/*SRC*/ - { "ld", 1,2,2,0xEA00, 0xFE00, {OP_k9,OP_DP}, FL_NR, },/*PREFER */ - { "ld", 1,2,2,0x3000, 0xFF00, {OP_Smem,OP_T}, FL_SMR },/*SRC*/ - { "ld", 1,2,2,0x4600, 0xFF00, {OP_Smem,OP_DP}, FL_SMR },/*SRC*/ - { "ld", 1,2,2,0x3200, 0xFF00, {OP_Smem,OP_ASM}, FL_SMR },/*SRC*/ - { "ld", 1,2,2,0x1000, 0xFE00, {OP_Smem,OP_DST}, FL_SMR }, - { "ld", 1,3,3,0x1400, 0xFE00, {OP_Smem,OP_TS,OP_DST}, FL_SMR }, - { "ld", 1,3,3,0x4400, 0xFE00, {OP_Smem,OP_16,OP_DST}, FL_SMR }, - { "ld", 1,3,3,0x9400, 0xFE00, {OP_Xmem,OP_SHFT,OP_DST}, },/*PREFER*/ - { "ld", 2,2,3,0x6F00, 0xFF00, {OP_Smem,OPT|OP_SHIFT,OP_DST}, + { "ld", 1,2,3,0xF440, 0xFCE0, {OP_SRC,OP_SHIFT,OPT|OP_DST}, 0, 0, 0 },/*SRC*/ + { "ld", 1,2,2,0xE800, 0xFE00, {OP_k8u,OP_DST}, 0, 0, 0 },/*SRC*/ + { "ld", 1,2,2,0xED00, 0xFFE0, {OP_k5,OP_ASM}, 0, 0, 0 },/*SRC*/ + { "ld", 1,2,2,0xF4A0, 0xFFF8, {OP_k3,OP_ARP}, FL_NR, 0, 0 },/*SRC*/ + { "ld", 1,2,2,0xEA00, 0xFE00, {OP_k9,OP_DP}, FL_NR, 0, 0 },/*PREFER */ + { "ld", 1,2,2,0x3000, 0xFF00, {OP_Smem,OP_T}, FL_SMR, 0, 0 },/*SRC*/ + { "ld", 1,2,2,0x4600, 0xFF00, {OP_Smem,OP_DP}, FL_SMR, 0, 0 },/*SRC*/ + { "ld", 1,2,2,0x3200, 0xFF00, {OP_Smem,OP_ASM}, FL_SMR, 0, 0 },/*SRC*/ + { "ld", 1,2,2,0x1000, 0xFE00, {OP_Smem,OP_DST}, FL_SMR, 0, 0 }, + { "ld", 1,3,3,0x1400, 0xFE00, {OP_Smem,OP_TS,OP_DST}, FL_SMR, 0, 0 }, + { "ld", 1,3,3,0x4400, 0xFE00, {OP_Smem,OP_16,OP_DST}, FL_SMR, 0, 0 }, + { "ld", 1,3,3,0x9400, 0xFE00, {OP_Xmem,OP_SHFT,OP_DST}, 0, 0, 0 },/*PREFER*/ + { "ld", 2,2,3,0x6F00, 0xFF00, {OP_Smem,OPT|OP_SHIFT,OP_DST}, FL_EXT|FL_SMR, 0x0C40, 0xFEE0 }, - { "ld", 2,2,3,0xF020, 0xFEF0, {OP_lk,OPT|OP_SHFT,OP_DST}, }, - { "ld", 2,3,3,0xF062, 0xFEFF, {OP_lk,OP_16,OP_DST}, }, - { "ldm", 1,2,2,0x4800, 0xFE00, {OP_MMR,OP_DST}, }, - { "ldr", 1,2,2,0x1600, 0xFE00, {OP_Smem,OP_DST}, FL_SMR }, - { "ldu", 1,2,2,0x1200, 0xFE00, {OP_Smem,OP_DST}, FL_SMR }, - { "ldx", 2,3,3,0xF062, 0xFEFF, {OP_xpmad_ms7,OP_16,OP_DST}, FL_FAR},/*pseudo-op*/ - { "lms", 1,2,2,0xE100, 0xFF00, {OP_Xmem,OP_Ymem}, }, - { "ltd", 1,1,1,0x4C00, 0xFF00, {OP_Smem}, FL_SMR }, - { "mac", 1,2,2,0x2800, 0xFE00, {OP_Smem,OP_SRC1}, FL_SMR }, - { "mac", 1,3,4,0xB000, 0xFC00, {OP_Xmem,OP_Ymem,OP_SRC,OPT|OP_DST}, }, - { "mac", 2,2,3,0xF067, 0xFCFF, {OP_lk,OP_SRC,OPT|OP_DST}, }, - { "mac", 2,3,4,0x6400, 0xFC00, {OP_Smem,OP_lk,OP_SRC,OPT|OP_DST}, FL_SMR }, - { "macr", 1,2,2,0x2A00, 0xFE00, {OP_Smem,OP_SRC1}, FL_SMR }, - { "macr", 1,3,4,0xB400, 0xFC00, {OP_Xmem,OP_Ymem,OP_SRC,OPT|OP_DST},FL_SMR}, - { "maca", 1,2,3,0xF488, 0xFCFF, {OP_T,OP_SRC,OPT|OP_DST}, FL_SMR },/*SRC*/ - { "maca", 1,1,2,0x3500, 0xFF00, {OP_Smem,OPT|OP_B}, FL_SMR }, - { "macar", 1,2,3,0xF489, 0xFCFF, {OP_T,OP_SRC,OPT|OP_DST}, FL_SMR },/*SRC*/ - { "macar", 1,1,2,0x3700, 0xFF00, {OP_Smem,OPT|OP_B}, FL_SMR }, - { "macd", 2,3,3,0x7A00, 0xFE00, {OP_Smem,OP_pmad,OP_SRC1}, FL_SMR }, - { "macp", 2,3,3,0x7800, 0xFE00, {OP_Smem,OP_pmad,OP_SRC1}, FL_SMR }, - { "macsu", 1,3,3,0xA600, 0xFE00, {OP_Xmem,OP_Ymem,OP_SRC1}, }, - { "mar", 1,1,1,0x6D00, 0xFF00, {OP_Smem}, }, - { "mas", 1,2,2,0x2C00, 0xFE00, {OP_Smem,OP_SRC1}, FL_SMR }, - { "mas", 1,3,4,0xB800, 0xFC00, {OP_Xmem,OP_Ymem,OP_SRC,OPT|OP_DST}, }, - { "masr", 1,2,2,0x2E00, 0xFE00, {OP_Smem,OP_SRC1}, FL_SMR }, - { "masr", 1,3,4,0xBC00, 0xFC00, {OP_Xmem,OP_Ymem,OP_SRC,OPT|OP_DST}, }, - { "masa", 1,2,3,0xF48A, 0xFCFF, {OP_T,OP_SRC,OPT|OP_DST}, },/*SRC*/ - { "masa", 1,1,2,0x3300, 0xFF00, {OP_Smem,OPT|OP_B}, FL_SMR }, - { "masar", 1,2,3,0xF48B, 0xFCFF, {OP_T,OP_SRC,OPT|OP_DST}, }, - { "max", 1,1,1,0xF486, 0xFEFF, {OP_DST}, }, - { "min", 1,1,1,0xF487, 0xFEFF, {OP_DST}, }, - { "mpy", 1,2,2,0x2000, 0xFE00, {OP_Smem,OP_DST}, FL_SMR }, - { "mpy", 1,3,3,0xA400, 0xFE00, {OP_Xmem,OP_Ymem,OP_DST}, }, - { "mpy", 2,3,3,0x6200, 0xFE00, {OP_Smem,OP_lk,OP_DST}, FL_SMR }, - { "mpy", 2,2,2,0xF066, 0xFEFF, {OP_lk,OP_DST}, }, - { "mpyr", 1,2,2,0x2200, 0xFE00, {OP_Smem,OP_DST}, FL_SMR }, - { "mpya", 1,1,1,0xF48C, 0xFEFF, {OP_DST}, }, /*SRC*/ - { "mpya", 1,1,1,0x3100, 0xFF00, {OP_Smem}, FL_SMR }, - { "mpyu", 1,2,2,0x2400, 0xFE00, {OP_Smem,OP_DST}, FL_SMR }, - { "mvdd", 1,2,2,0xE500, 0xFF00, {OP_Xmem,OP_Ymem}, }, - { "mvdk", 2,2,2,0x7100, 0xFF00, {OP_Smem,OP_dmad}, FL_SMR }, - { "mvdm", 2,2,2,0x7200, 0xFF00, {OP_dmad,OP_MMR}, }, - { "mvdp", 2,2,2,0x7D00, 0xFF00, {OP_Smem,OP_pmad}, FL_SMR }, - { "mvkd", 2,2,2,0x7000, 0xFF00, {OP_dmad,OP_Smem}, }, - { "mvmd", 2,2,2,0x7300, 0xFF00, {OP_MMR,OP_dmad}, }, - { "mvmm", 1,2,2,0xE700, 0xFF00, {OP_MMRX,OP_MMRY}, FL_NR, }, - { "mvpd", 2,2,2,0x7C00, 0xFF00, {OP_pmad,OP_Smem}, }, - { "neg", 1,1,2,0xF484, 0xFCFF, {OP_SRC,OPT|OP_DST}, }, - { "nop", 1,0,0,0xF495, 0xFFFF, {OP_None}, }, - { "norm", 1,1,2,0xF48F, 0xFCFF, {OP_SRC,OPT|OP_DST}, }, - { "or", 1,1,3,0xF0A0, 0xFCE0, {OP_SRC,OPT|OP_SHIFT,OPT|OP_DST}, },/*SRC*/ - { "or", 1,2,2,0x1A00, 0xFE00, {OP_Smem,OP_SRC1}, FL_SMR }, - { "or", 2,2,4,0xF040, 0xFCF0, {OP_lk,OPT|OP_SHFT,OP_SRC,OPT|OP_DST}, }, - { "or", 2,3,4,0xF064, 0xFCFF, {OP_lk,OP_16,OP_SRC,OPT|OP_DST}, }, - { "orm", 2,2,2,0x6900, 0xFF00, {OP_lk,OP_Smem}, FL_NR|FL_SMR, }, - { "poly", 1,1,1,0x3600, 0xFF00, {OP_Smem}, FL_SMR }, - { "popd", 1,1,1,0x8B00, 0xFF00, {OP_Smem}, }, - { "popm", 1,1,1,0x8A00, 0xFF00, {OP_MMR}, }, - { "portr", 2,2,2,0x7400, 0xFF00, {OP_PA,OP_Smem}, }, - { "portw", 2,2,2,0x7500, 0xFF00, {OP_Smem,OP_PA}, FL_SMR }, - { "pshd", 1,1,1,0x4B00, 0xFF00, {OP_Smem}, FL_SMR }, - { "pshm", 1,1,1,0x4A00, 0xFF00, {OP_MMR}, }, - { "ret", 1,0,0,0xFC00, 0xFFFF, {OP_None}, B_RET|FL_NR, }, - { "retd", 1,0,0,0xFE00, 0xFFFF, {OP_None}, B_RET|FL_DELAY|FL_NR, }, - { "rc", 1,1,3,0xFC00, 0xFF00, {OP_CC,OPT|OP_CC,OPT|OP_CC}, - B_RET|FL_NR, }, - { "rcd", 1,1,3,0xFE00, 0xFF00, {OP_CC,OPT|OP_CC,OPT|OP_CC}, - B_RET|FL_DELAY|FL_NR, }, - { "reada", 1,1,1,0x7E00, 0xFF00, {OP_Smem}, }, - { "reset", 1,0,0,0xF7E0, 0xFFFF, {OP_None}, FL_NR, }, - { "rete", 1,0,0,0xF4EB, 0xFFFF, {OP_None}, B_RET|FL_NR, }, - { "reted", 1,0,0,0xF6EB, 0xFFFF, {OP_None}, B_RET|FL_DELAY|FL_NR, }, - { "retf", 1,0,0,0xF49B, 0xFFFF, {OP_None}, B_RET|FL_NR, }, - { "retfd", 1,0,0,0xF69B, 0xFFFF, {OP_None}, B_RET|FL_DELAY|FL_NR, }, - { "rnd", 1,1,2,0xF49F, 0xFCFF, {OP_SRC,OPT|OP_DST}, FL_LP|FL_NR }, - { "rol", 1,1,1,0xF491, 0xFEFF, {OP_SRC1}, }, - { "roltc", 1,1,1,0xF492, 0xFEFF, {OP_SRC1}, }, - { "ror", 1,1,1,0xF490, 0xFEFF, {OP_SRC1}, }, - { "rpt", 1,1,1,0x4700, 0xFF00, {OP_Smem}, B_REPEAT|FL_NR|FL_SMR, }, - { "rpt", 1,1,1,0xEC00, 0xFF00, {OP_k8u}, B_REPEAT|FL_NR, }, - { "rpt", 2,1,1,0xF070, 0xFFFF, {OP_lku}, B_REPEAT|FL_NR, }, - { "rptb", 2,1,1,0xF072, 0xFFFF, {OP_pmad}, FL_NR, }, - { "rptbd", 2,1,1,0xF272, 0xFFFF, {OP_pmad}, FL_DELAY|FL_NR, }, - { "rptz", 2,2,2,0xF071, 0xFEFF, {OP_DST,OP_lku}, B_REPEAT|FL_NR, }, - { "rsbx", 1,1,2,0xF4B0, 0xFDF0, {OPT|OP_N,OP_SBIT}, FL_NR, }, - { "saccd", 1,3,3,0x9E00, 0xFE00, {OP_SRC1,OP_Xmem,OP_CC2}, }, - { "sat", 1,1,1,0xF483, 0xFEFF, {OP_SRC1}, }, - { "sfta", 1,2,3,0xF460, 0xFCE0, {OP_SRC,OP_SHIFT,OPT|OP_DST}, }, - { "sftc", 1,1,1,0xF494, 0xFEFF, {OP_SRC1}, }, - { "sftl", 1,2,3,0xF0E0, 0xFCE0, {OP_SRC,OP_SHIFT,OPT|OP_DST}, }, - { "sqdst", 1,2,2,0xE200, 0xFF00, {OP_Xmem,OP_Ymem}, }, - { "squr", 1,2,2,0xF48D, 0xFEFF, {OP_A,OP_DST}, },/*SRC*/ - { "squr", 1,2,2,0x2600, 0xFE00, {OP_Smem,OP_DST}, FL_SMR }, - { "squra", 1,2,2,0x3800, 0xFE00, {OP_Smem,OP_SRC1}, FL_SMR }, - { "squrs", 1,2,2,0x3A00, 0xFE00, {OP_Smem,OP_SRC1}, FL_SMR }, - { "srccd", 1,2,2,0x9D00, 0xFF00, {OP_Xmem,OP_CC2}, }, - { "ssbx", 1,1,2,0xF5B0, 0xFDF0, {OPT|OP_N,OP_SBIT}, FL_NR, }, - { "st", 1,2,2,0x8C00, 0xFF00, {OP_T,OP_Smem}, }, - { "st", 1,2,2,0x8D00, 0xFF00, {OP_TRN,OP_Smem}, }, - { "st", 2,2,2,0x7600, 0xFF00, {OP_lk,OP_Smem}, }, - { "sth", 1,2,2,0x8200, 0xFE00, {OP_SRC1,OP_Smem}, }, - { "sth", 1,3,3,0x8600, 0xFE00, {OP_SRC1,OP_ASM,OP_Smem}, }, - { "sth", 1,3,3,0x9A00, 0xFE00, {OP_SRC1,OP_SHFT,OP_Xmem}, }, - { "sth", 2,2,3,0x6F00, 0xFF00, {OP_SRC1,OPT|OP_SHIFT,OP_Smem}, + { "ld", 2,2,3,0xF020, 0xFEF0, {OP_lk,OPT|OP_SHFT,OP_DST}, 0, 0, 0 }, + { "ld", 2,3,3,0xF062, 0xFEFF, {OP_lk,OP_16,OP_DST}, 0, 0, 0 }, + { "ldm", 1,2,2,0x4800, 0xFE00, {OP_MMR,OP_DST}, 0, 0, 0 }, + { "ldr", 1,2,2,0x1600, 0xFE00, {OP_Smem,OP_DST}, FL_SMR, 0, 0 }, + { "ldu", 1,2,2,0x1200, 0xFE00, {OP_Smem,OP_DST}, FL_SMR, 0, 0 }, + { "ldx", 2,3,3,0xF062, 0xFEFF, {OP_xpmad_ms7,OP_16,OP_DST}, FL_FAR, 0, 0},/*pseudo-op*/ + { "lms", 1,2,2,0xE100, 0xFF00, {OP_Xmem,OP_Ymem}, 0, 0, 0 }, + { "ltd", 1,1,1,0x4C00, 0xFF00, {OP_Smem}, FL_SMR, 0, 0 }, + { "mac", 1,2,2,0x2800, 0xFE00, {OP_Smem,OP_SRC1}, FL_SMR, 0, 0 }, + { "mac", 1,3,4,0xB000, 0xFC00, {OP_Xmem,OP_Ymem,OP_SRC,OPT|OP_DST}, 0, 0, 0 }, + { "mac", 2,2,3,0xF067, 0xFCFF, {OP_lk,OP_SRC,OPT|OP_DST}, 0, 0, 0 }, + { "mac", 2,3,4,0x6400, 0xFC00, {OP_Smem,OP_lk,OP_SRC,OPT|OP_DST}, FL_SMR, 0, 0 }, + { "macr", 1,2,2,0x2A00, 0xFE00, {OP_Smem,OP_SRC1}, FL_SMR, 0, 0 }, + { "macr", 1,3,4,0xB400, 0xFC00, {OP_Xmem,OP_Ymem,OP_SRC,OPT|OP_DST},FL_SMR, 0, 0 }, + { "maca", 1,2,3,0xF488, 0xFCFF, {OP_T,OP_SRC,OPT|OP_DST}, FL_SMR, 0, 0 },/*SRC*/ + { "maca", 1,1,2,0x3500, 0xFF00, {OP_Smem,OPT|OP_B}, FL_SMR, 0, 0 }, + { "macar", 1,2,3,0xF489, 0xFCFF, {OP_T,OP_SRC,OPT|OP_DST}, FL_SMR, 0, 0 },/*SRC*/ + { "macar", 1,1,2,0x3700, 0xFF00, {OP_Smem,OPT|OP_B}, FL_SMR, 0, 0 }, + { "macd", 2,3,3,0x7A00, 0xFE00, {OP_Smem,OP_pmad,OP_SRC1}, FL_SMR, 0, 0 }, + { "macp", 2,3,3,0x7800, 0xFE00, {OP_Smem,OP_pmad,OP_SRC1}, FL_SMR, 0, 0 }, + { "macsu", 1,3,3,0xA600, 0xFE00, {OP_Xmem,OP_Ymem,OP_SRC1}, 0, 0, 0 }, + { "mar", 1,1,1,0x6D00, 0xFF00, {OP_Smem}, 0, 0, 0 }, + { "mas", 1,2,2,0x2C00, 0xFE00, {OP_Smem,OP_SRC1}, FL_SMR, 0, 0 }, + { "mas", 1,3,4,0xB800, 0xFC00, {OP_Xmem,OP_Ymem,OP_SRC,OPT|OP_DST}, 0, 0, 0 }, + { "masr", 1,2,2,0x2E00, 0xFE00, {OP_Smem,OP_SRC1}, FL_SMR, 0, 0 }, + { "masr", 1,3,4,0xBC00, 0xFC00, {OP_Xmem,OP_Ymem,OP_SRC,OPT|OP_DST}, 0, 0, 0 }, + { "masa", 1,2,3,0xF48A, 0xFCFF, {OP_T,OP_SRC,OPT|OP_DST}, 0, 0, 0 },/*SRC*/ + { "masa", 1,1,2,0x3300, 0xFF00, {OP_Smem,OPT|OP_B}, FL_SMR, 0, 0 }, + { "masar", 1,2,3,0xF48B, 0xFCFF, {OP_T,OP_SRC,OPT|OP_DST}, 0, 0, 0 }, + { "max", 1,1,1,0xF486, 0xFEFF, {OP_DST}, 0, 0, 0 }, + { "min", 1,1,1,0xF487, 0xFEFF, {OP_DST}, 0, 0, 0 }, + { "mpy", 1,2,2,0x2000, 0xFE00, {OP_Smem,OP_DST}, FL_SMR, 0, 0 }, + { "mpy", 1,3,3,0xA400, 0xFE00, {OP_Xmem,OP_Ymem,OP_DST}, 0, 0, 0 }, + { "mpy", 2,3,3,0x6200, 0xFE00, {OP_Smem,OP_lk,OP_DST}, FL_SMR, 0, 0 }, + { "mpy", 2,2,2,0xF066, 0xFEFF, {OP_lk,OP_DST}, 0, 0, 0 }, + { "mpyr", 1,2,2,0x2200, 0xFE00, {OP_Smem,OP_DST}, FL_SMR, 0, 0 }, + { "mpya", 1,1,1,0xF48C, 0xFEFF, {OP_DST}, 0, 0, 0 }, /*SRC*/ + { "mpya", 1,1,1,0x3100, 0xFF00, {OP_Smem}, FL_SMR, 0, 0 }, + { "mpyu", 1,2,2,0x2400, 0xFE00, {OP_Smem,OP_DST}, FL_SMR, 0, 0 }, + { "mvdd", 1,2,2,0xE500, 0xFF00, {OP_Xmem,OP_Ymem}, 0, 0, 0 }, + { "mvdk", 2,2,2,0x7100, 0xFF00, {OP_Smem,OP_dmad}, FL_SMR, 0, 0 }, + { "mvdm", 2,2,2,0x7200, 0xFF00, {OP_dmad,OP_MMR}, 0, 0, 0 }, + { "mvdp", 2,2,2,0x7D00, 0xFF00, {OP_Smem,OP_pmad}, FL_SMR, 0, 0 }, + { "mvkd", 2,2,2,0x7000, 0xFF00, {OP_dmad,OP_Smem}, 0, 0, 0 }, + { "mvmd", 2,2,2,0x7300, 0xFF00, {OP_MMR,OP_dmad}, 0, 0, 0 }, + { "mvmm", 1,2,2,0xE700, 0xFF00, {OP_MMRX,OP_MMRY}, FL_NR, 0, 0 }, + { "mvpd", 2,2,2,0x7C00, 0xFF00, {OP_pmad,OP_Smem}, 0, 0, 0 }, + { "neg", 1,1,2,0xF484, 0xFCFF, {OP_SRC,OPT|OP_DST}, 0, 0, 0 }, + { "nop", 1,0,0,0xF495, 0xFFFF, {OP_None}, 0, 0, 0 }, + { "norm", 1,1,2,0xF48F, 0xFCFF, {OP_SRC,OPT|OP_DST}, 0, 0, 0 }, + { "or", 1,1,3,0xF0A0, 0xFCE0, {OP_SRC,OPT|OP_SHIFT,OPT|OP_DST}, 0, 0, 0 },/*SRC*/ + { "or", 1,2,2,0x1A00, 0xFE00, {OP_Smem,OP_SRC1}, FL_SMR, 0, 0 }, + { "or", 2,2,4,0xF040, 0xFCF0, {OP_lk,OPT|OP_SHFT,OP_SRC,OPT|OP_DST}, 0, 0, 0 }, + { "or", 2,3,4,0xF064, 0xFCFF, {OP_lk,OP_16,OP_SRC,OPT|OP_DST}, 0, 0, 0 }, + { "orm", 2,2,2,0x6900, 0xFF00, {OP_lk,OP_Smem}, FL_NR|FL_SMR, 0, 0 }, + { "poly", 1,1,1,0x3600, 0xFF00, {OP_Smem}, FL_SMR, 0, 0 }, + { "popd", 1,1,1,0x8B00, 0xFF00, {OP_Smem}, 0, 0, 0 }, + { "popm", 1,1,1,0x8A00, 0xFF00, {OP_MMR}, 0, 0, 0 }, + { "portr", 2,2,2,0x7400, 0xFF00, {OP_PA,OP_Smem}, 0, 0, 0 }, + { "portw", 2,2,2,0x7500, 0xFF00, {OP_Smem,OP_PA}, FL_SMR, 0, 0 }, + { "pshd", 1,1,1,0x4B00, 0xFF00, {OP_Smem}, FL_SMR, 0, 0 }, + { "pshm", 1,1,1,0x4A00, 0xFF00, {OP_MMR}, 0, 0, 0 }, + { "ret", 1,0,0,0xFC00, 0xFFFF, {OP_None}, B_RET|FL_NR, 0, 0 }, + { "retd", 1,0,0,0xFE00, 0xFFFF, {OP_None}, B_RET|FL_DELAY|FL_NR, 0, 0 }, + { "rc", 1,1,3,0xFC00, 0xFF00, {OP_CC,OPT|OP_CC,OPT|OP_CC}, + B_RET|FL_NR, 0, 0 }, + { "rcd", 1,1,3,0xFE00, 0xFF00, {OP_CC,OPT|OP_CC,OPT|OP_CC}, + B_RET|FL_DELAY|FL_NR, 0, 0 }, + { "reada", 1,1,1,0x7E00, 0xFF00, {OP_Smem}, 0, 0, 0 }, + { "reset", 1,0,0,0xF7E0, 0xFFFF, {OP_None}, FL_NR, 0, 0 }, + { "rete", 1,0,0,0xF4EB, 0xFFFF, {OP_None}, B_RET|FL_NR, 0, 0 }, + { "reted", 1,0,0,0xF6EB, 0xFFFF, {OP_None}, B_RET|FL_DELAY|FL_NR, 0, 0 }, + { "retf", 1,0,0,0xF49B, 0xFFFF, {OP_None}, B_RET|FL_NR, 0, 0 }, + { "retfd", 1,0,0,0xF69B, 0xFFFF, {OP_None}, B_RET|FL_DELAY|FL_NR, 0, 0 }, + { "rnd", 1,1,2,0xF49F, 0xFCFF, {OP_SRC,OPT|OP_DST}, FL_LP|FL_NR, 0, 0 }, + { "rol", 1,1,1,0xF491, 0xFEFF, {OP_SRC1}, 0, 0, 0 }, + { "roltc", 1,1,1,0xF492, 0xFEFF, {OP_SRC1}, 0, 0, 0 }, + { "ror", 1,1,1,0xF490, 0xFEFF, {OP_SRC1}, 0, 0, 0 }, + { "rpt", 1,1,1,0x4700, 0xFF00, {OP_Smem}, B_REPEAT|FL_NR|FL_SMR, 0, 0 }, + { "rpt", 1,1,1,0xEC00, 0xFF00, {OP_k8u}, B_REPEAT|FL_NR, 0, 0 }, + { "rpt", 2,1,1,0xF070, 0xFFFF, {OP_lku}, B_REPEAT|FL_NR, 0, 0 }, + { "rptb", 2,1,1,0xF072, 0xFFFF, {OP_pmad}, FL_NR, 0, 0 }, + { "rptbd", 2,1,1,0xF272, 0xFFFF, {OP_pmad}, FL_DELAY|FL_NR, 0, 0 }, + { "rptz", 2,2,2,0xF071, 0xFEFF, {OP_DST,OP_lku}, B_REPEAT|FL_NR, 0, 0 }, + { "rsbx", 1,1,2,0xF4B0, 0xFDF0, {OPT|OP_N,OP_SBIT}, FL_NR, 0, 0 }, + { "saccd", 1,3,3,0x9E00, 0xFE00, {OP_SRC1,OP_Xmem,OP_CC2}, 0, 0, 0 }, + { "sat", 1,1,1,0xF483, 0xFEFF, {OP_SRC1}, 0, 0, 0 }, + { "sfta", 1,2,3,0xF460, 0xFCE0, {OP_SRC,OP_SHIFT,OPT|OP_DST}, 0, 0, 0 }, + { "sftc", 1,1,1,0xF494, 0xFEFF, {OP_SRC1}, 0, 0, 0 }, + { "sftl", 1,2,3,0xF0E0, 0xFCE0, {OP_SRC,OP_SHIFT,OPT|OP_DST}, 0, 0, 0 }, + { "sqdst", 1,2,2,0xE200, 0xFF00, {OP_Xmem,OP_Ymem}, 0, 0, 0 }, + { "squr", 1,2,2,0xF48D, 0xFEFF, {OP_A,OP_DST}, 0, 0, 0 },/*SRC*/ + { "squr", 1,2,2,0x2600, 0xFE00, {OP_Smem,OP_DST}, FL_SMR, 0, 0 }, + { "squra", 1,2,2,0x3800, 0xFE00, {OP_Smem,OP_SRC1}, FL_SMR, 0, 0 }, + { "squrs", 1,2,2,0x3A00, 0xFE00, {OP_Smem,OP_SRC1}, FL_SMR, 0, 0 }, + { "srccd", 1,2,2,0x9D00, 0xFF00, {OP_Xmem,OP_CC2}, 0, 0, 0 }, + { "ssbx", 1,1,2,0xF5B0, 0xFDF0, {OPT|OP_N,OP_SBIT}, FL_NR, 0, 0 }, + { "st", 1,2,2,0x8C00, 0xFF00, {OP_T,OP_Smem}, 0, 0, 0 }, + { "st", 1,2,2,0x8D00, 0xFF00, {OP_TRN,OP_Smem}, 0, 0, 0 }, + { "st", 2,2,2,0x7600, 0xFF00, {OP_lk,OP_Smem}, 0, 0, 0 }, + { "sth", 1,2,2,0x8200, 0xFE00, {OP_SRC1,OP_Smem}, 0, 0, 0 }, + { "sth", 1,3,3,0x8600, 0xFE00, {OP_SRC1,OP_ASM,OP_Smem}, 0, 0, 0 }, + { "sth", 1,3,3,0x9A00, 0xFE00, {OP_SRC1,OP_SHFT,OP_Xmem}, 0, 0, 0 }, + { "sth", 2,2,3,0x6F00, 0xFF00, {OP_SRC1,OPT|OP_SHIFT,OP_Smem}, FL_EXT, 0x0C60, 0xFEE0 }, - { "stl", 1,2,2,0x8000, 0xFE00, {OP_SRC1,OP_Smem}, }, - { "stl", 1,3,3,0x8400, 0xFE00, {OP_SRC1,OP_ASM,OP_Smem}, }, - { "stl", 1,3,3,0x9800, 0xFE00, {OP_SRC1,OP_SHFT,OP_Xmem}, }, - { "stl", 2,2,3,0x6F00, 0xFF00, {OP_SRC1,OPT|OP_SHIFT,OP_Smem}, + { "stl", 1,2,2,0x8000, 0xFE00, {OP_SRC1,OP_Smem}, 0, 0, 0 }, + { "stl", 1,3,3,0x8400, 0xFE00, {OP_SRC1,OP_ASM,OP_Smem}, 0, 0, 0 }, + { "stl", 1,3,3,0x9800, 0xFE00, {OP_SRC1,OP_SHFT,OP_Xmem}, 0, 0, 0 }, + { "stl", 2,2,3,0x6F00, 0xFF00, {OP_SRC1,OPT|OP_SHIFT,OP_Smem}, FL_EXT, 0x0C80, 0xFEE0 }, - { "stlm", 1,2,2,0x8800, 0xFE00, {OP_SRC1,OP_MMR}, }, - { "stm", 2,2,2,0x7700, 0xFF00, {OP_lk,OP_MMR}, }, - { "strcd", 1,2,2,0x9C00, 0xFF00, {OP_Xmem,OP_CC2}, }, - { "sub", 1,1,3,0xF420, 0xFCE0, {OP_SRC,OPT|OP_SHIFT,OPT|OP_DST}, },/*SRC*/ - { "sub", 1,2,3,0xF481, 0xFCFF, {OP_SRC,OP_ASM,OPT|OP_DST}, },/*SRC*/ - { "sub", 1,2,2,0x0800, 0xFE00, {OP_Smem,OP_SRC1}, FL_SMR }, - { "sub", 1,3,3,0x0C00, 0xFE00, {OP_Smem,OP_TS,OP_SRC1}, FL_SMR }, - { "sub", 1,3,4,0x4000, 0xFC00, {OP_Smem,OP_16,OP_SRC,OPT|OP_DST}, FL_SMR }, - { "sub", 1,3,3,0x9200, 0xFE00, {OP_Xmem,OP_SHFT,OP_SRC1}, }, /*PREFER*/ - { "sub", 2,2,4,0x6F00, 0xFF00, {OP_Smem,OPT|OP_SHIFT,OP_SRC,OPT|OP_DST}, + { "stlm", 1,2,2,0x8800, 0xFE00, {OP_SRC1,OP_MMR}, 0, 0, 0 }, + { "stm", 2,2,2,0x7700, 0xFF00, {OP_lk,OP_MMR}, 0, 0, 0 }, + { "strcd", 1,2,2,0x9C00, 0xFF00, {OP_Xmem,OP_CC2}, 0, 0, 0 }, + { "sub", 1,1,3,0xF420, 0xFCE0, {OP_SRC,OPT|OP_SHIFT,OPT|OP_DST}, 0, 0, 0 },/*SRC*/ + { "sub", 1,2,3,0xF481, 0xFCFF, {OP_SRC,OP_ASM,OPT|OP_DST}, 0, 0, 0 },/*SRC*/ + { "sub", 1,2,2,0x0800, 0xFE00, {OP_Smem,OP_SRC1}, FL_SMR, 0, 0 }, + { "sub", 1,3,3,0x0C00, 0xFE00, {OP_Smem,OP_TS,OP_SRC1}, FL_SMR, 0, 0 }, + { "sub", 1,3,4,0x4000, 0xFC00, {OP_Smem,OP_16,OP_SRC,OPT|OP_DST}, FL_SMR, 0, 0 }, + { "sub", 1,3,3,0x9200, 0xFE00, {OP_Xmem,OP_SHFT,OP_SRC1}, 0, 0, 0 }, /*PREFER*/ + { "sub", 2,2,4,0x6F00, 0xFF00, {OP_Smem,OPT|OP_SHIFT,OP_SRC,OPT|OP_DST}, FL_EXT|FL_SMR, 0x0C20, 0xFCE0 }, - { "sub", 1,3,3,0xA200, 0xFE00, {OP_Xmem,OP_Ymem,OP_DST}, }, - { "sub", 2,2,4,0xF010, 0xFCF0, {OP_lk,OPT|OP_SHFT,OP_SRC,OPT|OP_DST}, }, - { "sub", 2,3,4,0xF061, 0xFCFF, {OP_lk,OP_16,OP_SRC,OPT|OP_DST}, }, - { "subb", 1,2,2,0x0E00, 0xFE00, {OP_Smem,OP_SRC1}, FL_SMR }, - { "subc", 1,2,2,0x1E00, 0xFE00, {OP_Smem,OP_SRC1}, FL_SMR }, - { "subs", 1,2,2,0x0A00, 0xFE00, {OP_Smem,OP_SRC1}, FL_SMR }, - { "trap", 1,1,1,0xF4C0, 0xFFE0, {OP_031}, B_BRANCH|FL_NR, }, - { "writa", 1,1,1,0x7F00, 0xFF00, {OP_Smem}, FL_SMR }, - { "xc", 1,2,4,0xFD00, 0xFD00, {OP_12,OP_CC,OPT|OP_CC,OPT|OP_CC}, FL_NR, }, - { "xor", 1,1,3,0xF0C0, 0xFCE0, {OP_SRC,OPT|OP_SHIFT,OPT|OP_DST}, },/*SRC*/ - { "xor", 1,2,2,0x1C00, 0xFE00, {OP_Smem,OP_SRC1}, FL_SMR }, - { "xor", 2,2,4,0xF050, 0xFCF0, {OP_lku,OPT|OP_SHFT,OP_SRC,OPT|OP_DST}, }, - { "xor", 2,3,4,0xF065, 0xFCFF, {OP_lku,OP_16,OP_SRC,OPT|OP_DST}, }, - { "xorm", 2,2,2,0x6A00, 0xFF00, {OP_lku,OP_Smem}, FL_NR|FL_SMR, }, - { NULL, }, + { "sub", 1,3,3,0xA200, 0xFE00, {OP_Xmem,OP_Ymem,OP_DST}, 0, 0, 0 }, + { "sub", 2,2,4,0xF010, 0xFCF0, {OP_lk,OPT|OP_SHFT,OP_SRC,OPT|OP_DST}, 0, 0, 0 }, + { "sub", 2,3,4,0xF061, 0xFCFF, {OP_lk,OP_16,OP_SRC,OPT|OP_DST}, 0, 0, 0 }, + { "subb", 1,2,2,0x0E00, 0xFE00, {OP_Smem,OP_SRC1}, FL_SMR, 0, 0 }, + { "subc", 1,2,2,0x1E00, 0xFE00, {OP_Smem,OP_SRC1}, FL_SMR, 0, 0 }, + { "subs", 1,2,2,0x0A00, 0xFE00, {OP_Smem,OP_SRC1}, FL_SMR, 0, 0 }, + { "trap", 1,1,1,0xF4C0, 0xFFE0, {OP_031}, B_BRANCH|FL_NR, 0, 0 }, + { "writa", 1,1,1,0x7F00, 0xFF00, {OP_Smem}, FL_SMR, 0, 0 }, + { "xc", 1,2,4,0xFD00, 0xFD00, {OP_12,OP_CC,OPT|OP_CC,OPT|OP_CC}, FL_NR, 0, 0 }, + { "xor", 1,1,3,0xF0C0, 0xFCE0, {OP_SRC,OPT|OP_SHIFT,OPT|OP_DST}, 0, 0, 0 },/*SRC*/ + { "xor", 1,2,2,0x1C00, 0xFE00, {OP_Smem,OP_SRC1}, FL_SMR, 0, 0 }, + { "xor", 2,2,4,0xF050, 0xFCF0, {OP_lku,OPT|OP_SHFT,OP_SRC,OPT|OP_DST}, 0, 0, 0 }, + { "xor", 2,3,4,0xF065, 0xFCFF, {OP_lku,OP_16,OP_SRC,OPT|OP_DST}, 0, 0, 0 }, + { "xorm", 2,2,2,0x6A00, 0xFF00, {OP_lku,OP_Smem}, FL_NR|FL_SMR, 0, 0 }, + { NULL, 0,0,0,0,0, {}, 0, 0, 0 }, }; /* assume all parallel instructions have at least three operands */ @@ -472,5 +472,5 @@ const partemplate tic54x_paroptab[] = { { "st","masr",1,2,2,0xDC00, 0xFC00, {OP_SRC,OP_Ymem},{OP_Xmem,OP_DST}, }, { "st","mpy", 1,2,2,0xCC00, 0xFC00, {OP_SRC,OP_Ymem},{OP_Xmem,OP_DST}, }, { "st","sub", 1,2,2,0xC400, 0xFC00, {OP_SRC,OP_Ymem},{OP_Xmem,OP_DST}, }, - { NULL,NULL }, + { NULL,NULL, 0, 0, 0, 0, 0, {}, {}, }, }; diff -uprN binutils-2.11.90.0.31/opcodes/v850-opc.c binutils-2.11.92.0.5/opcodes/v850-opc.c --- binutils-2.11.90.0.31/opcodes/v850-opc.c Mon Aug 27 11:44:52 2001 +++ binutils-2.11.92.0.5/opcodes/v850-opc.c Mon Oct 1 15:25:26 2001 @@ -34,42 +34,28 @@ Foundation, Inc., 59 Temple Place - Suit /* two-word opcodes */ #define two(x,y) ((unsigned int) (x) | ((unsigned int) (y) << 16)) -static long unsigned int insert_d9 - PARAMS ((long unsigned int, long int, const char **)); -static long unsigned int extract_d9 - PARAMS ((long unsigned int, int *)); -static long unsigned int insert_d22 - PARAMS ((long unsigned int, long int, const char **)); -static long unsigned int extract_d22 - PARAMS ((long unsigned int, int *)); -static long unsigned int insert_d16_15 - PARAMS ((long unsigned int, long int, const char **)); -static long unsigned int extract_d16_15 - PARAMS ((long unsigned int, int *)); -static long unsigned int insert_d8_7 - PARAMS ((long unsigned int, long int, const char **)); -static long unsigned int extract_d8_7 PARAMS ((long unsigned int, int *)); -static long unsigned int insert_d8_6 - PARAMS ((long unsigned int, long int, const char **)); -static long unsigned int extract_d8_6 PARAMS ((long unsigned int, int *)); -static long unsigned int insert_d5_4 - PARAMS ((long unsigned int, long int, const char **)); -static long unsigned int extract_d5_4 PARAMS ((long unsigned int, int *)); -static long unsigned int insert_d16_16 - PARAMS ((long unsigned int, long int, const char **)); -static long unsigned int extract_d16_16 PARAMS ((long unsigned int, int *)); -static long unsigned int insert_i9 - PARAMS ((long unsigned int, long int, const char **)); -static long unsigned int extract_i9 PARAMS ((long unsigned int, int *)); -static long unsigned int insert_u9 - PARAMS ((long unsigned int, long unsigned int, const char **)); -static long unsigned int extract_u9 PARAMS ((long unsigned int, int *)); -static long unsigned int insert_spe - PARAMS ((long unsigned int, long unsigned int, const char **)); -static long unsigned int extract_spe PARAMS ((long unsigned int, int *)); -static long unsigned int insert_i5div - PARAMS ((long unsigned int, long unsigned int, const char **)); -static long unsigned int extract_i5div PARAMS ((long unsigned int, int *)); +static long unsigned insert_d9 PARAMS ((long unsigned, long, const char **)); +static long unsigned extract_d9 PARAMS ((long unsigned, int *)); +static long unsigned insert_d22 PARAMS ((long unsigned, long, const char **)); +static long unsigned extract_d22 PARAMS ((long unsigned, int *)); +static long unsigned insert_d16_15 PARAMS ((long unsigned, long, const char **)); +static long unsigned extract_d16_15 PARAMS ((long unsigned, int *)); +static long unsigned insert_d8_7 PARAMS ((long unsigned, long, const char **)); +static long unsigned extract_d8_7 PARAMS ((long unsigned, int *)); +static long unsigned insert_d8_6 PARAMS ((long unsigned, long, const char **)); +static long unsigned extract_d8_6 PARAMS ((long unsigned, int *)); +static long unsigned insert_d5_4 PARAMS ((long unsigned, long, const char **)); +static long unsigned extract_d5_4 PARAMS ((long unsigned, int *)); +static long unsigned insert_d16_16 PARAMS ((long unsigned, long, const char **)); +static long unsigned extract_d16_16 PARAMS ((long unsigned, int *)); +static long unsigned insert_i9 PARAMS ((long unsigned, long, const char **)); +static long unsigned extract_i9 PARAMS ((long unsigned, int *)); +static long unsigned insert_u9 PARAMS ((long unsigned, long, const char **)); +static long unsigned extract_u9 PARAMS ((long unsigned, int *)); +static long unsigned insert_spe PARAMS ((long unsigned, long, const char **)); +static long unsigned extract_spe PARAMS ((long unsigned, int *)); +static long unsigned insert_i5div PARAMS ((long unsigned, long, const char **)); +static long unsigned extract_i5div PARAMS ((long unsigned, int *)); /* The functions used to insert and extract complicated operands. */ @@ -322,11 +308,12 @@ extract_i9 (insn, invalid) } static unsigned long -insert_u9 (insn, value, errmsg) +insert_u9 (insn, v, errmsg) unsigned long insn; - unsigned long value; + long v; const char ** errmsg; { + unsigned long value = (unsigned long) v; if (value > 0x1ff) * errmsg = _(immediate_out_of_range); @@ -348,11 +335,13 @@ extract_u9 (insn, invalid) } static unsigned long -insert_spe (insn, value, errmsg) +insert_spe (insn, v, errmsg) unsigned long insn; - unsigned long value; + long v; const char ** errmsg; { + unsigned long value = (unsigned long) v; + if (value != 3) * errmsg = _("invalid register for stack adjustment"); @@ -368,11 +357,13 @@ extract_spe (insn, invalid) } static unsigned long -insert_i5div (insn, value, errmsg) +insert_i5div (insn, v, errmsg) unsigned long insn; - unsigned long value; + long v; const char ** errmsg; { + unsigned long value = (unsigned long) v; + if (value > 0x1ff) { if (value & 1) @@ -405,7 +396,7 @@ extract_i5div (insn, invalid) /* Warning: code in gas/config/tc-v850.c examines the contents of this array. If you change any of the values here, be sure to look for side effects in - that code. */ + that code. */ const struct v850_operand v850_operands[] = { #define UNUSED 0 diff -uprN binutils-2.11.90.0.31/opcodes/vax-dis.c binutils-2.11.92.0.5/opcodes/vax-dis.c --- binutils-2.11.90.0.31/opcodes/vax-dis.c Mon Aug 27 11:44:52 2001 +++ binutils-2.11.92.0.5/opcodes/vax-dis.c Mon Oct 1 15:25:26 2001 @@ -112,7 +112,7 @@ print_insn_vax (memaddr, info) disassemble_info *info; { const struct vot *votp; - const char *argp = NULL; + const char *argp; unsigned char *arg; struct private priv; bfd_byte *buffer = priv.the_buffer; @@ -120,12 +120,14 @@ print_insn_vax (memaddr, info) info->private_data = (PTR) &priv; priv.max_fetched = priv.the_buffer; priv.insn_start = memaddr; + if (setjmp (priv.bailout) != 0) { /* Error return. */ return -1; } + argp = NULL; /* Check if the info buffer has more than one byte left since the last opcode might be a single byte with no argument data. */ if (info->buffer_length - (memaddr - info->buffer_vma) > 1) diff -uprN binutils-2.11.90.0.31/opcodes/w65-opc.h binutils-2.11.92.0.5/opcodes/w65-opc.h --- binutils-2.11.90.0.31/opcodes/w65-opc.h Thu Mar 15 14:52:16 2001 +++ binutils-2.11.92.0.5/opcodes/w65-opc.h Mon Oct 1 15:25:26 2001 @@ -402,7 +402,7 @@ struct opinfo optable[257]={ {0x42, O_wdm, "wdm", ADDR_IMPLIED}, {0xEB, O_xba, "xba", ADDR_IMPLIED}, {0xFB, O_xce, "xce", ADDR_IMPLIED}, - { 0 } + { 0, 0, NULL, 0 } }; #endif #define DISASM()\ diff -uprN binutils-2.11.90.0.31/opcodes/z8k-opc.h binutils-2.11.92.0.5/opcodes/z8k-opc.h --- binutils-2.11.90.0.31/opcodes/z8k-opc.h Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/opcodes/z8k-opc.h Mon Oct 1 15:25:26 2001 @@ -248,7 +248,7 @@ int flags; #endif char *name; unsigned char opcode; -void (*func)(); +void (*func) PARAMS ((void)); unsigned int arg_info[4]; unsigned int byte_info[10]; int noperands; diff -uprN binutils-2.11.90.0.31/opcodes/z8kgen.c binutils-2.11.92.0.5/opcodes/z8kgen.c --- binutils-2.11.90.0.31/opcodes/z8kgen.c Sat Aug 4 19:52:15 2001 +++ binutils-2.11.92.0.5/opcodes/z8kgen.c Mon Oct 1 15:25:26 2001 @@ -1227,7 +1227,7 @@ gas () printf ("#endif\n"); printf ("char *name;\n"); printf ("unsigned char opcode;\n"); - printf ("void (*func)();\n"); + printf ("void (*func) PARAMS ((void));\n"); printf ("unsigned int arg_info[4];\n"); printf ("unsigned int byte_info[%d];\n", BYTE_INFO_LEN); printf ("int noperands;\n");