Touches most files in bfd/, so likely will be blamed for everything..

o  bfd_read and bfd_write lose an unnecessary param and become
   bfd_bread and bfd_bwrite.

o  bfd_*alloc now all take a bfd_size_type arg, and will error if
   size_t is too small.  eg. 32 bit host, 64 bit bfd, verrry big files
   or bugs in linker scripts etc.

o  file_ptr becomes a bfd_signed_vma.  Besides matching sizes with
   various other types involved in handling sections, this should make
   it easier for bfd to support a 64 bit off_t on 32 bit hosts that
   provide it.

o  I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
   generally available.  They now cast their args to bfd_vma and
   bfd_byte * as appropriate, which removes a swag of casts from the
   source.

o  Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
   aout-encap.c.

o  Zillions of formatting and -Wconversion fixes.
This commit is contained in:
Alan Modra
2001-09-18 09:57:26 +00:00
parent 417412a27c
commit dc810e3900
183 changed files with 13588 additions and 12305 deletions
+547
View File
@@ -1,3 +1,550 @@
2001-09-18 Alan Modra <amodra@bigpond.net.au>
* 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 <file> for binutils headers.
(encap_object_p): Half baked attempt to fix compile errors in
code dealing with "magic".
* aout-ns32k.c: Include "file", not <file> 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 <nickc@cambridge.redhat.com>
* elflink.h (elf_link_input_bfd): Fix typo in error message.
+26 -36
View File
@@ -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 <TRANLE@INTELLICORP.COM>.
Converted to back end form by Ian Lance Taylor <ian@cygnus.com>.
@@ -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),
+32 -28
View File
@@ -39,16 +39,17 @@ static void aout_adobe_write_section PARAMS ((bfd *abfd, sec_ptr sect));
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, raw_bytes, execp)
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, raw_bytes, execp)
/* 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, execp, 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);
@@ -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);
@@ -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, section, location, offset, count)
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
+40 -25
View File
@@ -25,14 +25,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
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)
#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
@@ -47,15 +47,30 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#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 +154,7 @@ 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;
{
@@ -248,7 +263,7 @@ MY(fix_pcrel_26) (abfd, reloc_entry, symbol, data, input_section,
{
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 +295,10 @@ MY(fix_pcrel_26) (abfd, reloc_entry, symbol, data, input_section,
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 +322,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 +334,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 +360,7 @@ MY_swap_std_reloc_in (abfd, bytes, cache_ptr, symbols, symcount)
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 +554,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,
+3 -3
View File
@@ -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 - Suite 330, Boston, MA 02111-1307, USA. */
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
@@ -158,7 +158,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;
+44 -40
View File
@@ -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 - Suite 330, Boston, MA 02111-1307, USA. */
#endif
#include "bfd.h"
#include <sysdep.h>
#include "sysdep.h"
#include "libbfd.h"
#include <aout/aout64.h>
#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;
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 (N_BADMAG (*((struct internal_exec *) &magic)))
return 0;
}
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.
+11 -10
View File
@@ -59,7 +59,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 +78,16 @@ MY(put_reloc) PARAMS ((bfd *, int, int, long, reloc_howto_type *,
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 +180,15 @@ MY(reloc_howto) (abfd, rel, r_index, r_extern, r_pcrel)
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 +220,7 @@ MY(put_reloc) (abfd, r_extern, r_index, value, howto, reloc)
#define MY_final_link_relocate _bfd_ns32k_final_link_relocate
#define MY_relocate_contents _bfd_ns32k_relocate_contents
#include <aoutx.h>
#include "aoutx.h"
reloc_howto_type *
MY(bfd_reloc_type_lookup) (abfd,code)
@@ -280,7 +281,7 @@ MY_swap_std_reloc_in (abfd, bytes, cache_ptr, symbols, symcount)
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 +350,8 @@ _bfd_ns32k_relocate_contents (howto, input_bfd, relocation, location)
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)
{
+10 -9
View File
@@ -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,
+21 -12
View File
@@ -57,13 +57,18 @@ static const bfd_target *tic30_aout_object_p PARAMS ((bfd *));
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 +112,7 @@ boolean tic30_aout_set_arch_mach PARAMS ((bfd *, enum bfd_architecture, unsigne
#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 +357,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 +501,9 @@ tic30_aout_relocate_contents (howto, input_bfd, relocation, location)
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 +545,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 +557,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 +645,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;
}
+66 -75
View File
@@ -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 */
+128 -131
View File
@@ -367,7 +367,7 @@ NAME(aout,swap_exec_header_in) (abfd, raw_bytes, execp)
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 +402,7 @@ NAME(aout,swap_exec_header_out) (abfd, execp, raw_bytes)
struct external_exec *bytes = (struct external_exec *)raw_bytes;
/* Now fill in fields in the raw data, from the fields in the exec struct. */
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 +455,9 @@ NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p)
{
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;
@@ -674,22 +675,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;
}
@@ -943,7 +943,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);
@@ -1271,7 +1271,7 @@ NAME(aout,set_section_contents) (abfd, section, location, offset, count)
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;
}
@@ -1288,6 +1288,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;
@@ -1302,13 +1303,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;
@@ -1325,11 +1326,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);
@@ -1339,15 +1340,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;
@@ -1478,6 +1478,7 @@ translate_from_native_sym_flags (abfd, cache_ptr)
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
@@ -1494,7 +1495,8 @@ translate_from_native_sym_flags (abfd, cache_ptr)
{
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;
@@ -1504,7 +1506,8 @@ translate_from_native_sym_flags (abfd, cache_ptr)
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;
@@ -1735,8 +1738,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;
@@ -1779,9 +1782,9 @@ NAME(aout,translate_symbol_table) (abfd, in, ext, count, str, strsize, dynamic)
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))
@@ -1804,7 +1807,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)
@@ -1815,13 +1818,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)
@@ -1915,10 +1918,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);
@@ -1941,6 +1945,7 @@ 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)
@@ -1949,22 +1954,22 @@ NAME(aout,write_syms) (abfd)
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
@@ -2112,7 +2117,7 @@ NAME(aout,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;
@@ -2282,7 +2287,7 @@ NAME(aout,swap_std_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount)
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)) {
@@ -2340,13 +2345,14 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols)
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;
@@ -2373,19 +2379,20 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols)
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);
@@ -2395,21 +2402,19 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols)
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);
@@ -2432,13 +2437,13 @@ NAME(aout,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 || 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;
@@ -2461,10 +2466,11 @@ NAME(aout,squirt_out_relocs) (abfd, section)
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;
@@ -2609,7 +2615,7 @@ NAME(aout,print_symbol) (abfd, afile, symbol, how)
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);
@@ -2710,21 +2716,21 @@ 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;
@@ -2873,7 +2879,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
@@ -2886,9 +2892,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;
}
@@ -2998,9 +3004,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,
@@ -3136,7 +3142,7 @@ aout_link_check_ar_symbols (abfd, info, pneeded)
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;
@@ -3300,6 +3306,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);
@@ -3320,10 +3327,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;
@@ -3345,7 +3350,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)
@@ -3635,9 +3640,9 @@ NAME(aout,final_link) (abfd, info, callback)
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;
@@ -3669,7 +3674,7 @@ NAME(aout,final_link) (abfd, info, callback)
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)
{
@@ -3938,14 +3943,12 @@ NAME(aout,final_link) (abfd, info, callback)
&& 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;
}
@@ -4066,9 +4069,9 @@ aout_link_write_symbols (finfo, input_bfd)
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)
@@ -4089,7 +4092,7 @@ aout_link_write_symbols (finfo, input_bfd)
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;
@@ -4112,7 +4115,7 @@ aout_link_write_symbols (finfo, input_bfd)
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;
@@ -4383,7 +4386,7 @@ aout_link_write_symbols (finfo, input_bfd)
{
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)
@@ -4452,7 +4455,7 @@ aout_link_write_symbols (finfo, input_bfd)
{
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)
@@ -4473,11 +4476,9 @@ aout_link_write_symbols (finfo, input_bfd)
/* 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)
{
@@ -4503,17 +4504,16 @@ aout_link_write_symbols (finfo, input_bfd)
/* 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;
@@ -4533,6 +4533,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;
@@ -4609,12 +4610,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 ();
@@ -4622,9 +4623,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 ();
@@ -4668,7 +4669,7 @@ aout_link_input_section (finfo, input_bfd, input_section, reloff_ptr,
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;
}
}
@@ -4693,7 +4694,7 @@ aout_link_input_section (finfo, input_bfd, input_section, reloff_ptr,
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;
@@ -4703,8 +4704,7 @@ aout_link_input_section (finfo, input_bfd, input_section, reloff_ptr,
{
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;
@@ -5362,7 +5362,7 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs,
/* 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);
@@ -5523,6 +5523,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;
@@ -5652,7 +5653,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:
@@ -5675,10 +5676,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;
@@ -5711,17 +5710,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);
+113 -110
View File
@@ -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.
@@ -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, filepos, new_elt)
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)
@@ -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, trailing_slash, tabloc, tablen)
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, filename, member)
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, filename, member)
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, arhdr)
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, arhdr)
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, elength)
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, elength)
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, elength)
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, elength)
}
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_count, stridx)
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_count, stridx)
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_count, stridx)
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 (arch)
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, symbol_count, stridx)
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, symbol_count, stridx)
/* 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, symbol_count, stridx)
/* 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, symbol_count, stridx)
{
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, symbol_count, stridx)
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;
}
+5 -4
View File
@@ -458,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;
@@ -470,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;
@@ -751,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] == ':')
@@ -773,7 +774,7 @@ bfd_default_scan (info, string)
Attempt to match: <arch> <mach>? */
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)
+42 -21
View File
@@ -113,16 +113,6 @@ typedef enum bfd_boolean {false, true} boolean;
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 <sys/types.h>.
For now, try to avoid breaking stuff by not including <sys/types.h> 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 +180,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 <sys/types.h>.
For now, try to avoid breaking stuff by not including <sys/types.h> 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 +301,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 +356,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. */
@@ -482,14 +486,31 @@ extern void bfd_hash_traverse PARAMS ((struct bfd_hash_table *,
/* 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. */
+310 -249
View File
@@ -113,16 +113,6 @@ typedef enum bfd_boolean {false, true} boolean;
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 <sys/types.h>.
For now, try to avoid breaking stuff by not including <sys/types.h> 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 +180,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 <sys/types.h>.
For now, try to avoid breaking stuff by not including <sys/types.h> 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 +301,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 +356,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. */
@@ -482,14 +486,31 @@ extern void bfd_hash_traverse PARAMS ((struct bfd_hash_table *,
/* 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. */
@@ -796,16 +817,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));
@@ -814,7 +835,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));
@@ -830,9 +851,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)))
@@ -879,40 +900,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
@@ -1347,18 +1416,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, \
@@ -1629,31 +1698,31 @@ bfd_arch_mach_octets_per_byte PARAMS ((enum bfd_architecture arch,
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;
@@ -1661,155 +1730,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,
@@ -2034,7 +2104,7 @@ 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
/* 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,
@@ -2183,7 +2253,7 @@ to compensate for the borrow when the low bits are added. */
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,
@@ -2844,7 +2914,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
@@ -3024,7 +3094,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) */
@@ -3062,7 +3132,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. */
@@ -3330,7 +3400,7 @@ bfd_set_archive_head PARAMS ((bfd *output, bfd *new_head));
bfd *
bfd_openr_next_archived_file PARAMS ((bfd *archive, bfd *previous));
CONST char *
const char *
bfd_core_file_failing_command PARAMS ((bfd *abfd));
int
@@ -3396,27 +3466,27 @@ 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)\
@@ -3427,17 +3497,16 @@ CAT(NAME,_get_section_contents),\
CAT(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)\
@@ -3449,23 +3518,23 @@ CAT(NAME,_bfd_set_private_flags),\
CAT(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)\
@@ -3491,15 +3560,12 @@ CAT(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 *));
@@ -3518,37 +3584,34 @@ 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));
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,
@@ -3559,22 +3622,21 @@ CAT(NAME,_minisymbol_to_symbol)
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 **));
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));
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)\
@@ -3587,34 +3649,33 @@ 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 **));
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)\
@@ -3623,14 +3684,14 @@ CAT(NAME,_canonicalize_dynamic_symtab),\
CAT(NAME,_get_dynamic_reloc_upper_bound),\
CAT(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. */
@@ -3643,7 +3704,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));
+6 -6
View File
@@ -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. *}
@@ -1235,14 +1235,14 @@ bfd_record_phdr (abfd, type, flags_valid, flags, at_valid, at,
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;
+7 -6
View File
@@ -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, <ian@cygnus.com>
@@ -111,7 +111,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 +130,7 @@ binary_get_section_contents (abfd, section, location, offset, count)
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 +151,7 @@ mangle_name (abfd, suffix)
bfd *abfd;
char *suffix;
{
int size;
bfd_size_type size;
char *buf;
char *p;
@@ -183,8 +183,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 +226,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
+50 -43
View File
@@ -67,7 +67,7 @@ bout_swap_exec_header_in (abfd, raw_bytes, execp)
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, raw_bytes)
struct external_exec *bytes = (struct external_exec *)raw_bytes;
/* Now fill in fields in the raw data, from the fields in the exec struct. */
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_entry, src, dst, input_section)
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_entry, src, dst, input_section)
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_entry, data, srcidx, dstidx,
- 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, symbols)
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, symbols)
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, symbols)
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, symbols)
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, section, location, offset, count)
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, shrink)
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_info, again)
/* 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_info, again)
{
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_info, again)
link_info);
break;
case ABS32CODE_SHRUNK:
shrink+=4;
shrink += 4;
break;
}
}
@@ -1287,7 +1293,7 @@ b_out_bfd_get_relocated_section_contents (output_bfd, link_info, link_order,
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 (output_bfd, link_info, link_order,
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 (output_bfd, link_info, link_order,
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 (output_bfd, link_info, link_order,
+ 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_bfd, link_info, link_order,
- 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;
}
+3 -1
View File
@@ -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;
}
+22 -17
View File
@@ -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_info_loc)
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_info_loc)
}
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_info_loc)
/* 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_info_loc)
/* 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_info_loc)
/* 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_info_loc)
/* 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;
}
+6 -6
View File
@@ -154,14 +154,14 @@ a29k_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
}
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, data, input_section, output_bfd,
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, data, input_section, output_bfd,
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, info, input_bfd, input_section,
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:
+61 -65
View File
@@ -76,32 +76,32 @@ static bfd *alpha_ecoff_get_elt_at_index PARAMS ((bfd *, symindex));
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, intern)
{
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, dst)
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_contents (abfd, link_info, link_order,
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, info, input_bfd, ext_rel, h)
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, info, input_bfd, ext_rel, h)
}
/* 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, input_bfd, input_section,
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, input_bfd, input_section,
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, input_bfd, input_section,
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, input_bfd, input_section,
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, input_bfd, input_section,
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, input_bfd, input_section,
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, input_bfd, input_section,
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, filepos)
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, filepos)
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, filepos)
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, filepos)
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, filepos)
/* 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;
+127 -92
View File
@@ -36,18 +36,39 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* 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, symbol, data, input_section, output_bfd,
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, symbol, data, input_section, output_bfd,
{
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, symbol, data, input_section, output_bfd,
{
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, symbol, data, input_section,
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_entry, symbol, data, input_section,
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, symbol, data, input_section,
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, symbol, data, input_section,
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, symbol, data, input_section,
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);
@@ -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);
@@ -1211,7 +1240,8 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
&& 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, info, input_bfd, input_section,
{
/* 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;
@@ -1353,10 +1383,10 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
--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, info, input_bfd, input_section,
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, info, input_bfd, input_section,
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, info, input_bfd, input_section,
{
/* 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;
@@ -1452,22 +1482,22 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
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, info, input_bfd, input_section,
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, info, input_bfd, input_section,
+ 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, info, input_bfd, input_section,
- 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, info, input_bfd, input_section,
{
/* 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 */
@@ -1790,10 +1822,10 @@ bfd_arm_allocate_interworking_sections (info)
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 (info)
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);
@@ -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;
+28 -24
View File
@@ -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_info, link_order, reloc, data, src_ptr,
/* 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_info, link_order, reloc, data, src_ptr,
/* 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_info, link_order, reloc, data, src_ptr,
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_info, link_order, reloc, data, src_ptr,
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_info, link_order, reloc, data, src_ptr,
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;
+5 -5
View File
@@ -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_order, reloc, data, src_ptr, dst_ptr)
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_order, reloc, data, src_ptr, dst_ptr)
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_order, reloc, data, src_ptr, dst_ptr)
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;
+2 -2
View File
@@ -157,7 +157,7 @@ coff_i386_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
{
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, symbol, data, input_section, output_bfd,
{
long x = bfd_get_32 (abfd, addr);
DOIT (x);
bfd_put_32 (abfd, x, addr);
bfd_put_32 (abfd, (bfd_vma) x, addr);
}
break;
+2 -2
View File
@@ -114,7 +114,7 @@ coff_i860_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
{
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, symbol, data, input_section, output_bfd,
{
long x = bfd_get_32 (abfd, addr);
DOIT (x);
bfd_put_32 (abfd, x, addr);
bfd_put_32 (abfd, (bfd_vma) x, addr);
}
break;
+10 -11
View File
@@ -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, symbol_in, data,
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, symbol, data, input_section,
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, info, input_bfd, input_section,
+ (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;
+10 -13
View File
@@ -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);
+5 -3
View File
@@ -316,7 +316,7 @@ m68kcoff_common_addend_special_fn (abfd, reloc_entry, symbol, data,
{
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, reloc_entry, symbol, data,
{
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 (abfd, info, datasec, relsec, errmsg)
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 (abfd, info, datasec, relsec, errmsg)
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;
+8 -6
View File
@@ -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, symbol, data,
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)
+1 -1
View File
@@ -228,7 +228,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;
+38 -39
View File
@@ -426,7 +426,7 @@ mips_ecoff_swap_reloc_in (abfd, ext_ptr, intern)
{
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, dst)
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_bfd, input_section, contents, adjust,
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, input_bfd, input_section,
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, input_bfd, input_section,
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, again)
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, again)
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, again)
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, again)
/* 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, input_section, h, location, address)
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 (abfd, info, datasec, relsec, errmsg)
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 (abfd, info, datasec, relsec, errmsg)
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;
+95 -94
View File
@@ -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, sym, toc_kind)
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]);
}
}
@@ -1199,7 +1200,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
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, info, input_bfd, input_section,
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, info, input_bfd, input_section,
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_get_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, info, input_bfd, input_section,
}
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, info, input_bfd, input_section,
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, info, input_bfd, input_section,
}
/* 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)"),
(_("%s: Relocation exceeds allocated TOC (%lx)"),
bfd_get_filename (input_bfd),
toc_section->_raw_size);
(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, info, input_bfd, input_section,
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);
}
}
}
@@ -1432,7 +1428,6 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
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, info, input_bfd, input_section,
{
/* 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, info, input_bfd, input_section,
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;
@@ -2321,11 +2319,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 +2331,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 +2432,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 +2475,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 +2505,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 +2514,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 +2649,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 +2679,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 +2708,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 +2744,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))
+307 -304
View File
File diff suppressed because it is too large Load Diff
+43 -37
View File
@@ -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, data, input_section, output_bfd,
#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, data, input_section, output_bfd,
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;
@@ -784,7 +784,7 @@ sh_relax_section (abfd, sec, link_info, again)
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)
@@ -886,8 +886,8 @@ sh_relax_section (abfd, sec, link_info, again)
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, again)
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, again)
/* 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
@@ -1023,8 +1024,8 @@ sh_relax_section (abfd, sec, link_info, again)
{
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, again)
/* 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, 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));
if (irelalign == NULL)
sec->_cooked_size -= count;
else
@@ -1128,7 +1130,7 @@ sh_relax_delete_bytes (abfd, sec, addr, count)
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, count)
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, count)
}
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:
@@ -1517,7 +1519,7 @@ sh_relax_delete_bytes (abfd, sec, addr, count)
{
/* 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_relocs, contents, pswapped)
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, contents, addr)
/* 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, contents, addr)
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, contents, addr)
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, contents, addr)
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;
@@ -3035,7 +3039,7 @@ sh_coff_get_relocated_section_contents (output_bfd, link_info, link_order,
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 (output_bfd, link_info, link_order,
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 (output_bfd, link_info, link_order,
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;
+5 -5
View File
@@ -37,7 +37,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
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;
+9 -6
View File
@@ -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;
+2 -2
View File
@@ -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';
+2 -2
View File
@@ -423,7 +423,7 @@ tic54x_reloc_processing (relent, reloc, symbols, abfd, section)
}
/* 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 ticoff0_swap_table =
};
/* 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,
+2 -2
View File
@@ -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));
+6 -6
View File
@@ -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, link_order, reloc, data, src_ptr,
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, link_order, reloc, data, src_ptr,
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, link_order, reloc, data, src_ptr,
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, link_order, reloc, data, src_ptr,
{
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;
+3 -3
View File
@@ -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_order, reloc, data, src_ptr, dst_ptr)
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;
+1266 -1211
View File
File diff suppressed because it is too large Load Diff
+318 -379
View File
File diff suppressed because it is too large Load Diff
+100 -92
View File
@@ -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, target_index)
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, target_index)
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, target_index)
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, internal_f, internal_a)
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, internal_f, internal_a)
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, sec, cache, external_relocs,
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, sec, cache, external_relocs,
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, sec, cache, external_relocs,
{
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_undef)
{
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, native, string_size_p,
}
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, native, string_size_p,
*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, native, string_size_p,
|| !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, written, string_size_p,
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, written, string_size_p,
&((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,9 +1636,9 @@ _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
}
@@ -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, sz)
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, psyment)
*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, symbols, offset, filename_ptr,
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, symbols, offset, filename_ptr,
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, symbols, offset, filename_ptr,
/* 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, class)
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;
+119 -117
View File
@@ -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;
@@ -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, info, abfd)
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;
@@ -1586,6 +1589,7 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
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 +1610,8 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
/* 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 +1637,9 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
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 +1648,8 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
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 +1849,18 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
}
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 +2082,8 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
}
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 +2095,11 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
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 +2147,8 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
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 +2164,7 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
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 +2252,14 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
}
}
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 +2280,13 @@ _bfd_coff_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;
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)
@@ -2454,14 +2458,11 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
/* 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 +2495,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 +2604,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 +2675,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 +2745,7 @@ _bfd_coff_reloc_link_order (output_bfd, finfo, output_section, link_order)
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 +2753,8 @@ _bfd_coff_reloc_link_order (output_bfd, finfo, output_section, link_order)
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 +2777,9 @@ _bfd_coff_reloc_link_order (output_bfd, finfo, output_section, link_order)
}
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;
+399 -405
View File
File diff suppressed because it is too large Load Diff
+87 -110
View File
@@ -1127,7 +1127,7 @@ fi
PACKAGE=bfd
VERSION=2.11.90
VERSION=2.11.91
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; }
@@ -5003,7 +5003,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"'
;;
@@ -5141,7 +5141,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
;;
@@ -5896,76 +5896,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_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_bigarc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;;
bfd_elf32_bigarm_oabi_vec) tb="$tb elfarm-oabi.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" ;;
@@ -5980,41 +5959,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" ;;
@@ -6027,83 +6011,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" ;;
@@ -6197,17 +6174,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:6201: checking for $ac_hdr" >&5
echo "configure:6178: 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
#line 6206 "configure"
#line 6183 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:6211: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:6188: \"$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*
@@ -6236,12 +6213,12 @@ done
for ac_func in getpagesize
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:6240: checking for $ac_func" >&5
echo "configure:6217: 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 <<EOF
#line 6245 "configure"
#line 6222 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -6264,7 +6241,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:6268: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:6245: \"$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
@@ -6289,7 +6266,7 @@ fi
done
echo $ac_n "checking for working mmap""... $ac_c" 1>&6
echo "configure:6293: checking for working mmap" >&5
echo "configure:6270: 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
@@ -6297,7 +6274,7 @@ else
ac_cv_func_mmap_fixed_mapped=no
else
cat > conftest.$ac_ext <<EOF
#line 6301 "configure"
#line 6278 "configure"
#include "confdefs.h"
/* Thanks to Mike Haertel and Jim Avera for this test.
@@ -6437,7 +6414,7 @@ main()
}
EOF
if { (eval echo configure:6441: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:6418: \"$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
@@ -6462,12 +6439,12 @@ fi
for ac_func in madvise mprotect
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:6466: checking for $ac_func" >&5
echo "configure:6443: 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 <<EOF
#line 6471 "configure"
#line 6448 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -6490,7 +6467,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:6494: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:6471: \"$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
@@ -6741,7 +6718,7 @@ cat >> $CONFIG_STATUS <<\EOF
# Split the substitutions into bite-sized pieces for seds with
# small command number limits, like on Digital OSF/1 and HP-UX.
ac_max_sed_cmds=60 # Maximum number of lines to put in a sed script.
ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
ac_file=1 # Number of current file.
ac_beg=1 # First line for current file.
ac_end=$ac_max_sed_cmds # Line after last line for current file.
+74 -97
View File
@@ -7,7 +7,7 @@ AC_INIT(libbfd.c)
AC_CANONICAL_SYSTEM
AC_ISC_POSIX
AM_INIT_AUTOMAKE(bfd, 2.11.90)
AM_INIT_AUTOMAKE(bfd, 2.11.91)
dnl These must be called before AM_PROG_LIBTOOL, because it may want
dnl to call AC_CHECK_PROG.
@@ -151,7 +151,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 +315,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 +469,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_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_bigarc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;;
bfd_elf32_bigarm_oabi_vec) tb="$tb elfarm-oabi.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 +532,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 +584,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" ;;
+2 -2
View File
@@ -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
+2
View File
@@ -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;
-2
View File
@@ -23,8 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#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
+3 -4
View File
@@ -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 - Suite 330, Boston, MA 02111-1307, USA. */
#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;
+7 -3
View File
@@ -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 - Suite 330, Boston, MA 02111-1307, USA. */
#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,}
+1 -1
View File
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* 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.
+78 -72
View File
@@ -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_info_struct[] =
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, offset, size)
}
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, buffer, offset, size)
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, size)
}
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, symbol, data, input_section, output_bfd,
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, symbol, data, input_section, output_bfd,
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, input_bfd, relocation, location,
#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, input_bfd, relocation, location,
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, input_bfd, relocation, location,
#ifdef BFD64
case 8:
#endif
put_data(x, location, 0, size);
put_data (x, location, size);
break;
}
+1 -1
View File
@@ -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,
};
+4 -1
View File
@@ -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 - Suite 330, Boston, MA 02111-1307, USA. */
#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;
+5 -1
View File
@@ -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 - Suite 330, Boston, MA 02111-1307, USA. */
#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;
+3 -2
View File
@@ -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 - Suite 330, Boston, MA 02111-1307, USA. */
#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)
+6 -3
View File
@@ -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 - Suite 330, Boston, MA 02111-1307, USA. */
#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;
+19 -17
View File
@@ -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;
@@ -277,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)
@@ -289,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;
@@ -302,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;
@@ -319,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++)
{
@@ -482,10 +483,10 @@ _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
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;
@@ -505,7 +506,8 @@ _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
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;
+59 -50
View File
@@ -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_ptr)
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_ptr)
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_ptr)
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_ptr)
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_ptr)
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, line, column, end_sequence)
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, syms)
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, syms)
free (relocs);
return addend;
}
free (relocs);
return 0;
}
@@ -1353,6 +1360,8 @@ parse_comp_unit (abfd, stash, unit_length, abbrev_length)
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_length, abbrev_length)
.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_length, abbrev_length)
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, section, symbols, offset,
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, section, symbols, offset,
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, section, symbols, offset,
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, section, symbols, offset,
/* 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;
+158 -150
View File
@@ -65,7 +65,7 @@ static boolean ecoff_compute_section_file_positions PARAMS ((bfd *abfd));
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,
@@ -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, ignore, debug)
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, ignore, debug)
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, ignore, debug)
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, asym, ext, weak)
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, asym, ext, weak)
{
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, asym, ext, weak)
}
/* 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, symbols)
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, symbols)
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, symbols)
}
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, section, ignore_symbols, offset,
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, section, ignore_symbols, offset,
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 (abfd)
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, section, location, offset, count)
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, section, location, offset, count)
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) &section, 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, map, orl_count, stridx)
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, map, orl_count, stridx)
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, map, orl_count, stridx)
/* 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, map, orl_count, stridx)
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, map, orl_count, stridx)
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, map, orl_count, stridx)
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, map, orl_count, stridx)
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 (abfd)
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, info)
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, info)
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, info)
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, info)
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, info)
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, info, pneeded)
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, info, pneeded)
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, info)
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, info)
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, external_ext, ssext)
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, external_ext, ssext)
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 (output_bfd, input_bfd, info, handle)
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, info, output_section, link_order)
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, info, output_section, link_order)
/* 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, info, output_section, link_order)
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, info, output_section, link_order)
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, info, output_section, link_order)
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, output_section, link_order)
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, output_section, link_order)
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, output_section, link_order)
}
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, output_section, link_order)
/* 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)
+64 -56
View File
@@ -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, <ian@cygnus.com>.
@@ -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_debug, output_swap, info)
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, output_bfd, output_debug, output_swap,
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, output_bfd, output_debug, output_swap,
}
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, output_bfd, output_debug, output_swap,
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, output_bfd, output_debug, output_swap,
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, output_bfd, output_debug, output_swap,
}
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, output_bfd, output_debug, output_swap,
}
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, output_bfd, output_debug, output_swap,
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;
}
}
@@ -1210,7 +1210,7 @@ bfd_ecoff_debug_accumulate_other (handle, output_bfd, output_debug,
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, output_bfd, output_debug,
}
(*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_bfd, output_debug,
}
(*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, debug, swap, name, esym)
{
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, where)
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, where)
#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, where)
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, space)
{
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, space)
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 (handle, abfd, debug, swap, info, where)
{
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 (handle, abfd, debug, swap, info, where)
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 (handle, abfd, debug, swap, info, where)
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 (handle, abfd, debug, swap, info, where)
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 (handle, abfd, debug, swap, info, where)
/* 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 (handle, abfd, debug, swap, info, where)
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 (handle, abfd, debug, swap, info, where)
|| (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, line_info)
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, line_info)
/* 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, line_info)
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_swap, line_info)
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_swap, line_info)
{
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;
+220 -219
View File
@@ -45,20 +45,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
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, intern)
*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, ext_ptr)
*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, intern)
*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, ext_ptr)
*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, intern)
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, intern)
| ((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, ext_ptr)
*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, ext_ptr)
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, intern)
*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, ext_ptr)
*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, intern)
*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, ext_ptr)
*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, intern)
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, ext_ptr)
}
#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_ptr)
{
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, intern)
_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, ext_ptr)
_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, intern)
*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, ext_ptr)
*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)
+245 -209
View File
@@ -293,15 +293,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
@@ -355,20 +362,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. */
@@ -379,52 +387,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
@@ -578,11 +586,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
@@ -616,8 +626,7 @@ 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. */
@@ -641,18 +650,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 ((int));
/* The swapping table to use when dealing with ECOFF information.
Used for the MIPS ELF .mdebug section. */
@@ -810,7 +824,7 @@ typedef struct elf_linker_section_pointers
{
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;
@@ -1005,41 +1019,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));
#define elf_string_from_elf_strtab(abfd,strindex) \
bfd_elf_string_from_elf_section(abfd,elf_elfheader(abfd)->e_shstrndx,strindex)
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 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 ((int));
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
@@ -1053,7 +1074,8 @@ extern boolean _bfd_elf_link_hash_table_init
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 *));
@@ -1062,135 +1084,133 @@ extern boolean _bfd_elf_copy_private_symbol_data
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 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 int _bfd_elf_symbol_from_bfd_symbol
PARAMS ((bfd *, asymbol **));
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 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_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 *));
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 *));
boolean _bfd_elfcore_make_pseudosection PARAMS ((bfd *, char *, int, int));
char *_bfd_elfcore_strndup PARAMS ((bfd *, char *, int));
extern boolean _bfd_elfcore_make_pseudosection
PARAMS ((bfd *, char *, size_t, ufile_ptr));
extern char *_bfd_elfcore_strndup
PARAMS ((bfd *, char *, size_t));
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));
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 *));
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));
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));
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));
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 *));
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));
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));
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));
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 *));
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));
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));
boolean _bfd_elf_make_linker_section_rela
PARAMS ((bfd *dynobj,
elf_linker_section_t *lsect,
int alignment));
extern boolean _bfd_elf_make_linker_section_rela
PARAMS ((bfd *, elf_linker_section_t *, int));
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 *));
@@ -1219,9 +1239,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
@@ -1233,12 +1254,16 @@ extern boolean bfd_elf32_link_create_dynamic_sections
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
@@ -1266,9 +1291,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
@@ -1285,41 +1311,43 @@ extern Elf_Internal_Rela *_bfd_elf64_link_read_relocs
#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 *));
boolean _bfd_elf32_gc_record_vtinherit
extern boolean _bfd_elf32_gc_common_finalize_got_offsets
PARAMS ((bfd *, struct bfd_link_info *));
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 *));
boolean _bfd_elf64_gc_record_vtinherit
extern boolean _bfd_elf64_gc_common_finalize_got_offsets
PARAMS ((bfd *, struct bfd_link_info *));
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
@@ -1328,10 +1356,12 @@ extern boolean _bfd_mips_elf_section_from_bfd_section
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
@@ -1342,9 +1372,12 @@ extern bfd_reloc_status_type _bfd_mips_elf_got16_reloc
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 *));
@@ -1384,14 +1417,17 @@ extern boolean _bfd_mips_elf_link_output_symbol_hook
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_ */
+27 -27
View File
@@ -92,8 +92,8 @@ static bfd_reloc_status_type elf_hppa_final_link_relocate
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_type, format, field, ignore, sym)
{
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;
@@ -1484,9 +1484,9 @@ elf_hppa_final_link_relocate (rel, input_bfd, output_bfd,
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_bfd, output_bfd,
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_bfd, output_bfd,
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_bfd, output_bfd,
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_bfd, output_bfd,
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_bfd, output_bfd,
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_bfd, output_bfd,
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_bfd, output_bfd,
}
/* 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_bfd, output_bfd,
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, r_type)
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, r_type)
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, r_type)
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, r_type)
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, r_type)
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, r_type)
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;
+20 -20
View File
@@ -605,14 +605,13 @@ mn10200_elf_relax_section (abfd, sec, link_info, again)
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, sec, addr, count)
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_contents (output_bfd, link_info, link_order,
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_contents (output_bfd, link_info, link_order,
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_contents (output_bfd, link_info, link_order,
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;
+61 -53
View File
@@ -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, link_info, again)
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, link_info, again)
{
/* 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, link_info, again)
/* 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, link_info, again)
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, link_info, again)
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, link_info, again)
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, link_info, again)
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, link_info, again)
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, link_info, again)
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, link_info, again)
/* 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, link_info, again)
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, link_info, again)
/* 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, sec, addr, count)
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_contents (output_bfd, link_info, link_order,
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_contents (output_bfd, link_info, link_order,
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_contents (output_bfd, link_info, link_order,
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 (abfd)
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 (abfd)
}
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 (abfd)
return &ret->root.root;
}
static int
static unsigned long
elf_mn10300_mach (flags)
flagword flags;
{
+187 -179
View File
@@ -50,13 +50,13 @@ static boolean assign_file_positions_except_relocs PARAMS ((bfd *));
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, dst)
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, dst)
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, dst)
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)
@@ -374,7 +374,7 @@ _bfd_elf_make_section_from_shdr (abfd, hdr, name)
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, farg)
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, farg)
(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, farg)
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, farg)
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, farg)
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);
@@ -1076,9 +1076,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;
@@ -1167,7 +1167,7 @@ bfd_elf_get_bfd_needed_list (abfd, pneeded)
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 *));
@@ -1194,7 +1194,7 @@ bfd_elf_get_bfd_needed_list (abfd, pneeded)
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;
@@ -1214,13 +1214,15 @@ bfd_elf_get_bfd_needed_list (abfd, pneeded)
{
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;
@@ -1456,8 +1458,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;
@@ -1529,8 +1533,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;
@@ -1580,7 +1585,7 @@ _bfd_elf_make_section_from_phdr (abfd, hdr, index, typename)
&& (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);
@@ -1611,7 +1616,7 @@ _bfd_elf_make_section_from_phdr (abfd, hdr, index, typename)
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);
@@ -1659,7 +1664,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;
@@ -1692,10 +1697,10 @@ _bfd_elf_init_reloc_shdr (abfd, rel_hdr, asect, use_rela_p)
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);
@@ -1879,6 +1884,7 @@ assign_section_numbers (abfd)
asection *sec;
unsigned int section_number;
Elf_Internal_Shdr **i_shdrp;
bfd_size_type amt;
section_number = 1;
@@ -1912,13 +1918,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);
@@ -2000,7 +2006,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);
@@ -2066,19 +2072,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");
@@ -2094,7 +2100,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;
@@ -2102,7 +2109,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)
@@ -2141,6 +2148,8 @@ elf_map_symbols (abfd)
for (asect = abfd->sections; asect; asect = asect->next)
{
asymbol *sym;
if (sect_syms[asect->index] != NULL)
continue;
@@ -2185,16 +2194,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++;
@@ -2209,7 +2218,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))
@@ -2367,11 +2376,11 @@ make_mapping (abfd, sections, from, to, phdr)
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;
@@ -2410,6 +2419,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;
@@ -2419,8 +2429,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;
@@ -2449,8 +2459,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;
@@ -2463,8 +2473,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;
@@ -2611,8 +2621,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;
@@ -2634,8 +2644,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;
@@ -2733,6 +2743,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)
{
@@ -2773,8 +2784,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;
@@ -3102,7 +3113,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;
@@ -3470,10 +3481,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;
}
}
@@ -3779,6 +3790,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;
@@ -3791,10 +3803,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;
@@ -3871,8 +3882,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;
@@ -4064,11 +4075,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;
@@ -4283,6 +4292,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)
@@ -4298,8 +4308,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;
@@ -4673,6 +4683,7 @@ _bfd_elf_slurp_version_tables (abfd)
bfd *abfd;
{
bfd_byte *contents = NULL;
bfd_size_type amt;
if (elf_dynverdef (abfd) != 0)
{
@@ -4690,7 +4701,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
@@ -4709,9 +4720,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;
@@ -4732,10 +4742,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;
@@ -4785,9 +4793,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;
@@ -4797,7 +4805,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;
@@ -4818,10 +4826,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));
@@ -4871,8 +4878,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
@@ -5090,6 +5098,7 @@ _bfd_elf_set_section_contents (abfd, section, location, offset, count)
bfd_size_type count;
{
Elf_Internal_Shdr *hdr;
bfd_signed_vma pos;
if (! abfd->output_has_begun
&& ! _bfd_elf_compute_section_file_positions
@@ -5097,10 +5106,9 @@ _bfd_elf_set_section_contents (abfd, section, location, offset, count)
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;
@@ -5312,8 +5320,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;
@@ -5322,7 +5330,7 @@ _bfd_elfcore_make_pseudosection (abfd, name, size, filepos)
/* 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);
@@ -5352,7 +5360,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))
@@ -5470,25 +5478,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)
@@ -5617,7 +5625,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);
@@ -5646,7 +5654,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);
@@ -5701,7 +5709,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;
@@ -5726,7 +5734,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;
@@ -5814,8 +5822,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;
@@ -5823,14 +5831,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);
@@ -5844,12 +5852,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);
+1 -1
View File
@@ -155,7 +155,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)
{
+92 -78
View File
@@ -35,7 +35,7 @@ static struct bfd_link_hash_table *elf32_arm_link_hash_table_create
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
@@ -117,7 +117,7 @@ static enum elf_reloc_type_class elf32_arm_reloc_type_class
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_plt0_entry [PLT_ENTRY_SIZE / 4] =
/* 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_bfd)
/* 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);
@@ -305,8 +305,8 @@ find_arm_glue (link_info, name, input_bfd)
/* 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);
@@ -383,13 +383,13 @@ bfd_elf32_arm_allocate_interworking_sections (info)
{
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_sections (info)
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;
@@ -424,6 +424,7 @@ record_arm_to_thumb_glue (link_info, h)
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);
@@ -479,6 +480,7 @@ record_thumb_to_arm_glue (link_info, h)
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 (abfd, link_info, no_pipeline_knowledge)
/* 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 (abfd, link_info, no_pipeline_knowledge)
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 (abfd, link_info, no_pipeline_knowledge)
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, input_bfd, output_bfd, input_section,
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;
@@ -889,10 +895,10 @@ elf32_thumb_to_arm_stub (info, name, input_bfd, output_bfd, input_section,
--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, input_bfd, output_bfd, input_section,
+ 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, input_bfd, output_bfd, input_section,
/* 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, input_bfd, output_bfd, input_section,
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;
@@ -992,10 +997,10 @@ elf32_arm_to_thumb_stub (info, name, input_bfd, output_bfd, input_section,
--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, input_bfd, output_bfd, input_section,
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, input_bfd, output_bfd,
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;
@@ -1722,8 +1726,8 @@ arm_add_to_rel (abfd, address, howto, increment)
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, increment)
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, info, input_bfd, input_section,
|| r_type == R_ARM_GNU_VTINHERIT)
continue;
elf32_arm_info_to_howto (input_bfd, & bfd_reloc, (Elf32_Internal_Rel *) rel);
#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,7 +1836,9 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section,
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);
#endif
@@ -2540,10 +2551,11 @@ elf32_arm_check_relocs (abfd, info, sec, relocs)
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;
@@ -2667,8 +2679,7 @@ elf32_arm_check_relocs (abfd, info, sec, relocs)
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;
@@ -3091,37 +3102,40 @@ elf32_arm_size_dynamic_sections (output_bfd, info)
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;
}
@@ -3254,7 +3268,7 @@ elf32_arm_finish_dynamic_symbol (output_bfd, info, h, sym)
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
@@ -3466,14 +3480,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
+3 -3
View File
@@ -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 <denisc@overta.ru>
This file is part of BFD, the Binary File Descriptor library.
@@ -699,7 +699,7 @@ avr_final_link_relocate (howto, input_bfd, input_section,
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,7 +913,7 @@ static boolean
elf32_avr_object_p (abfd)
bfd *abfd;
{
int e_set = bfd_mach_avr2;
unsigned int e_set = bfd_mach_avr2;
if (elf_elfheader (abfd)->e_machine == EM_AVR
|| elf_elfheader (abfd)->e_machine == EM_AVR_OLD)
{
+41 -38
View File
@@ -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, info, input_bfd, input_section,
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, info, input_bfd, input_section,
+ 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, info, input_bfd, input_section,
|| 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)
@@ -881,14 +882,14 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
bfd_get_filename (bfd_my_archive (input_bfd)),
bfd_get_filename (input_bfd),
cris_elf_howto_table[r_type].name,
name,
symname,
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,
symname,
bfd_get_section_name (input_bfd, input_section));
bfd_set_error (bfd_error_bad_value);
return false;
@@ -904,7 +905,7 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
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)))))
@@ -951,7 +952,7 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
(_("%s: No PLT nor GOT for relocation %s against symbol `%s' from %s section"),
bfd_get_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
@@ -1078,7 +1079,7 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
bfd_get_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);
@@ -1095,7 +1096,7 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
(_("%s: relocation %s is not allowed for global symbol: `%s' from %s section"),
bfd_get_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;
@@ -1327,13 +1328,13 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
{
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 +1357,7 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
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 +1506,7 @@ elf_cris_finish_dynamic_symbol (output_bfd, info, h, sym)
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 +1516,25 @@ elf_cris_finish_dynamic_symbol (output_bfd, info, h, sym)
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 +2317,17 @@ cris_elf_check_relocs (abfd, info, sec, relocs)
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_alloc (abfd, amt));
if (local_got_refcounts == NULL)
return false;
memset (local_got_refcounts, -1, size);
memset (local_got_refcounts, -1, (size_t) amt);
local_got_refcounts++;
elf_local_got_refcounts (abfd) = local_got_refcounts;
@@ -2605,7 +2605,7 @@ cris_elf_check_relocs (abfd, info, sec, relocs)
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 +2790,40 @@ elf_cris_size_dynamic_sections (output_bfd, info)
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;
}
+12 -5
View File
@@ -33,13 +33,20 @@ static reloc_howto_type * fr30_reloc_type_lookup
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, symbol, data,
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;
}
+1 -1
View File
@@ -65,7 +65,7 @@ elf_generic_info_to_howto_rel (abfd, bfd_reloc, elf_reloc)
bfd_reloc->howto = &dummy;
}
static boolean
static boolean
elf32_generic_link_add_symbols (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
+42 -26
View File
@@ -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,7 +54,7 @@ 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
static bfd_reloc_status_type special
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
/* This does not include any relocation information, but should be
@@ -420,7 +435,7 @@ elf32_h8_relocate_section (output_bfd, info, input_bfd, input_section,
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;
@@ -503,7 +518,7 @@ elf32_h8_relocate_section (output_bfd, info, input_bfd, input_section,
elf32_h8_info_to_howto (input_bfd, &bfd_reloc, rel);
howto = bfd_reloc.howto;
if (h != NULL)
name = h->root.root.string;
else
@@ -564,7 +579,7 @@ elf32_h8_relocate_section (output_bfd, info, input_bfd, input_section,
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;
{
@@ -586,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;
@@ -616,7 +631,7 @@ elf32_h8_final_write_processing (abfd, linker)
/* 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;
{
@@ -629,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;
@@ -665,7 +680,7 @@ elf32_h8_merge_private_bfd_data (ibfd, obfd)
mov.b:24/32 -> mov.b:8 4 bytes
mov.[bwl]:24/32 -> mov.[bwl]:16 2 bytes
*/
@@ -766,7 +781,7 @@ elf32_h8_relax_section (abfd, sec, link_info, again)
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;
}
@@ -837,7 +852,7 @@ elf32_h8_relax_section (abfd, sec, link_info, again)
/* 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)
if ((int) gap >= -126 && (int) gap <= 130)
{
unsigned char code;
@@ -859,8 +874,8 @@ elf32_h8_relax_section (abfd, sec, link_info, again)
Such sequences are used by the compiler to deal with
long conditional branches. */
if (gap <= 130
&& gap >= -128
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)
@@ -871,7 +886,7 @@ elf32_h8_relax_section (abfd, sec, link_info, again)
/* 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);
@@ -958,7 +973,7 @@ elf32_h8_relax_section (abfd, sec, link_info, again)
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
@@ -1268,7 +1283,8 @@ elf32_h8_relax_delete_bytes (abfd, sec, addr, count)
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. */
@@ -1400,7 +1416,7 @@ elf32_h8_get_relocated_section_contents (output_bfd, link_info, link_order,
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)
@@ -1413,15 +1429,15 @@ elf32_h8_get_relocated_section_contents (output_bfd, link_info, link_order,
external_syms = (Elf32_External_Sym *) symtab_hdr->contents;
else
{
external_syms = ((Elf32_External_Sym *)
bfd_malloc (symtab_hdr->sh_info
* sizeof (Elf32_External_Sym)));
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_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;
}
@@ -1432,12 +1448,12 @@ elf32_h8_get_relocated_section_contents (output_bfd, link_info, link_order,
goto error_return;
internal_syms = ((Elf_Internal_Sym *)
bfd_malloc (symtab_hdr->sh_info
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 (symtab_hdr->sh_info
sections = (asection **) bfd_malloc ((bfd_size_type) symtab_hdr->sh_info
* sizeof (asection *));
if (sections == NULL && symtab_hdr->sh_info > 0)
goto error_return;
+54 -51
View File
@@ -506,8 +506,9 @@ 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;
@@ -551,7 +552,7 @@ hppa_stub_name (input_section, sym_sec, hash, rel)
const Elf_Internal_Rela *rel;
{
char *stub_name;
size_t len;
bfd_size_type len;
if (hash)
{
@@ -659,7 +660,7 @@ hppa_add_stub (stub_name, section, hplink)
stub_sec = hplink->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);
@@ -1452,19 +1453,20 @@ elf32_hppa_check_relocs (abfd, info, sec, relocs)
/* This is a global offset table entry for a local symbol. */
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));
if (local_got_refcounts == NULL)
return false;
elf_local_got_refcounts (abfd) = local_got_refcounts;
memset (local_got_refcounts, -1, size);
memset (local_got_refcounts, -1, (size_t) size);
}
if (local_got_refcounts[r_symndx] == -1)
local_got_refcounts[r_symndx] = 1;
@@ -1507,17 +1509,18 @@ elf32_hppa_check_relocs (abfd, info, sec, relocs)
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));
if (local_got_refcounts == NULL)
return false;
elf_local_got_refcounts (abfd) = local_got_refcounts;
memset (local_got_refcounts, -1, size);
memset (local_got_refcounts, -1, (size_t) size);
}
local_plt_refcounts = (local_got_refcounts
+ symtab_hdr->sh_info);
@@ -1615,7 +1618,7 @@ elf32_hppa_check_relocs (abfd, info, sec, relocs)
if ((need_entry & NEED_STUBREL))
{
size_t len = strlen (name) + sizeof (STUB_SUFFIX);
bfd_size_type len = strlen (name) + sizeof (STUB_SUFFIX);
char *newname = bfd_malloc (len);
if (newname == NULL)
@@ -1687,7 +1690,7 @@ elf32_hppa_check_relocs (abfd, info, sec, relocs)
if (p == NULL)
{
p = ((struct elf32_hppa_dyn_reloc_entry *)
bfd_alloc (dynobj, sizeof *p));
bfd_alloc (dynobj, (bfd_size_type) sizeof *p));
if (p == NULL)
return false;
p->next = h->reloc_entries;
@@ -2432,7 +2435,10 @@ elf32_hppa_size_dynamic_sections (output_bfd, info)
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
@@ -2440,36 +2446,36 @@ elf32_hppa_size_dynamic_sections (output_bfd, info)
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 (! 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))
if (!add_dynamic_entry (DT_TEXTREL, 0))
return false;
info->flags |= DF_TEXTREL;
}
}
#undef add_dynamic_entry
return true;
}
@@ -2504,6 +2510,7 @@ elf32_hppa_size_stubs (output_bfd, stub_bfd, info, multi_subspace, group_size,
boolean stubs_always_before_branch;
boolean stub_changed = 0;
boolean ret = 0;
bfd_size_type amt;
hplink = hppa_link_hash_table (info);
@@ -2542,8 +2549,8 @@ elf32_hppa_size_stubs (output_bfd, stub_bfd, info, multi_subspace, group_size,
}
}
hplink->stub_group
= (struct map_stub *) bfd_zmalloc (sizeof (struct map_stub) * (top_id + 1));
amt = sizeof (struct map_stub) * (top_id + 1);
hplink->stub_group = (struct map_stub *) bfd_zmalloc (amt);
if (hplink->stub_group == NULL)
return false;
@@ -2561,8 +2568,8 @@ elf32_hppa_size_stubs (output_bfd, stub_bfd, info, multi_subspace, group_size,
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;
@@ -2679,9 +2686,8 @@ elf32_hppa_size_stubs (output_bfd, stub_bfd, info, multi_subspace, group_size,
/* 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;
@@ -2695,6 +2701,7 @@ elf32_hppa_size_stubs (output_bfd, stub_bfd, info, multi_subspace, group_size,
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;
@@ -2703,25 +2710,24 @@ elf32_hppa_size_stubs (output_bfd, stub_bfd, info, multi_subspace, group_size,
/* 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;
@@ -2746,7 +2752,7 @@ elf32_hppa_size_stubs (output_bfd, stub_bfd, info, multi_subspace, group_size,
char *name;
asection *reloc_sec;
name = bfd_malloc (strlen (section->name)
name = bfd_malloc ((bfd_size_type) strlen (section->name)
+ sizeof STUB_SUFFIX
+ 5);
if (name == NULL)
@@ -2867,19 +2873,18 @@ elf32_hppa_size_stubs (output_bfd, stub_bfd, info, multi_subspace, group_size,
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);
@@ -2889,7 +2894,7 @@ elf32_hppa_size_stubs (output_bfd, stub_bfd, info, multi_subspace, group_size,
/* 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)
{
@@ -3205,7 +3210,7 @@ elf32_hppa_build_stubs (info)
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;
@@ -3255,7 +3260,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;
@@ -3805,7 +3810,7 @@ elf32_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
{
/* 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
@@ -3957,8 +3962,6 @@ elf32_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
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,
input_section,
+18 -13
View File
@@ -921,37 +921,40 @@ i370_elf_size_dynamic_sections (output_bfd, info)
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
@@ -1174,7 +1177,7 @@ i370_elf_finish_dynamic_sections (output_bfd, info)
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);
@@ -1704,7 +1707,9 @@ i370_elf_post_process_headers (abfd, link_info)
#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;
}
+22 -20
View File
@@ -455,9 +455,9 @@ 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)));
ret = (struct elf_i386_link_hash_table *) bfd_alloc (abfd, amt);
if (ret == (struct elf_i386_link_hash_table *) NULL)
return NULL;
@@ -633,15 +633,16 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
/* 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));
if (local_got_refcounts == NULL)
return false;
elf_local_got_refcounts (abfd) = local_got_refcounts;
memset (local_got_refcounts, -1, size);
memset (local_got_refcounts, -1, (size_t) size);
}
if (local_got_refcounts[r_symndx] == -1)
local_got_refcounts[r_symndx] = 1;
@@ -801,7 +802,7 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
if (p == NULL)
{
p = ((struct elf_i386_dyn_relocs *)
bfd_alloc (dynobj, sizeof *p));
bfd_alloc (dynobj, (bfd_size_type) sizeof *p));
if (p == NULL)
return false;
p->next = eh->dyn_relocs;
@@ -1388,36 +1389,39 @@ elf_i386_size_dynamic_sections (output_bfd, info)
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))
if (!add_dynamic_entry (DT_TEXTREL, 0))
return false;
}
}
#undef add_dynamic_entry
return true;
}
@@ -1764,8 +1768,6 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
outrel.r_offset = rel->r_offset;
else
{
bfd_vma off;
off = (_bfd_stab_section_offset
(output_bfd, htab->root.stab_info, input_section,
&elf_section_data (input_section)->stab_info,
@@ -1983,7 +1985,7 @@ elf_i386_finish_dynamic_symbol (output_bfd, info, h, sym)
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
@@ -2226,7 +2228,7 @@ elf_i386_grok_prstatus (abfd, note)
Elf_Internal_Note *note;
{
int offset;
int raw_size;
size_t raw_size;
switch (note->descsz)
{
+9 -8
View File
@@ -695,7 +695,8 @@ elf32_i860_info_to_howto_rela (abfd, bfd_reloc, elf_reloc)
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, rello, contents, value)
{
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, input_section, rello, contents, value)
{
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, input_section, rello, contents, value)
{
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, info, input_bfd, input_section,
}
/* 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)
{
+24 -25
View File
@@ -369,7 +369,7 @@ m32r_elf_do_10_pcrel_reloc (abfd, howto, input_section, data, offset,
+ 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, input_section, data, offset,
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, symbol, data,
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_entry, symbol, data,
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_entry, symbol, data,
{
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, sym, namep, flagsp, secp, valp)
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, sym, namep, flagsp, secp, valp)
"_SDA_BASE_",
BSF_GLOBAL,
s,
32768,
(bfd_vma) 32768,
(const char *) NULL,
false,
get_elf_backend_data (abfd)->collect,
@@ -1410,15 +1410,14 @@ m32r_elf_relax_section (abfd, sec, link_info, again)
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 +1781,7 @@ m32r_elf_get_relocated_section_contents (output_bfd, link_info, link_order,
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 +1808,13 @@ m32r_elf_get_relocated_section_contents (output_bfd, link_info, link_order,
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 +1824,15 @@ m32r_elf_get_relocated_section_contents (output_bfd, link_info, link_order,
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;
+29 -25
View File
@@ -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;
@@ -558,15 +558,16 @@ elf_m68k_check_relocs (abfd, info, sec, relocs)
/* 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));
if (local_got_refcounts == NULL)
return false;
elf_local_got_refcounts (abfd) = local_got_refcounts;
memset (local_got_refcounts, -1, size);
memset (local_got_refcounts, -1, (size_t) size);
}
if (local_got_refcounts[r_symndx] == -1)
{
@@ -750,7 +751,7 @@ elf_m68k_check_relocs (abfd, info, sec, relocs)
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 +1265,39 @@ elf_m68k_size_dynamic_sections (output_bfd, info)
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;
}
@@ -1961,7 +1965,7 @@ elf_m68k_finish_dynamic_symbol (output_bfd, info, h, sym)
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 +1979,12 @@ elf_m68k_finish_dynamic_symbol (output_bfd, info, h, sym)
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 +2190,7 @@ bfd_m68k_elf32_create_embedded_relocs (abfd, info, datasec, relsec, errmsg)
Elf_Internal_Rela *free_relocs = NULL;
Elf_Internal_Rela *irel, *irelend;
bfd_byte *p;
bfd_size_type amt;
BFD_ASSERT (! info->relocateable);
@@ -2203,17 +2208,15 @@ bfd_m68k_elf32_create_embedded_relocs (abfd, info, datasec, relsec, errmsg)
{
/* 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 +2232,8 @@ bfd_m68k_elf32_create_embedded_relocs (abfd, info, datasec, relsec, errmsg)
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;
+2 -2
View File
@@ -550,7 +550,7 @@ mcore_elf_relocate_section (output_bfd, info, input_bfd, input_section,
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, info, input_bfd, input_section,
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;
}
+187 -191
View File
@@ -132,7 +132,7 @@ 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 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) \
? (abort (), false) \
: bfd_elf32_add_dynamic_entry (info, (bfd_vma) tag, (bfd_vma) val))
#endif
/* The number of local .got entries we reserve. */
@@ -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_entry, input_section, relocateable, data,
|| (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_entry, input_section, relocateable, data,
|| (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, symbol, data, input_section,
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, symbol, data, input_section,
/* 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, symbol, data, input_section,
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;
{
@@ -1964,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 },
@@ -2133,12 +2133,12 @@ bfd_mips_elf32_swap_reginfo_in (abfd, ex, in)
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
@@ -2147,18 +2147,12 @@ bfd_mips_elf32_swap_reginfo_out (abfd, in, ex)
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
@@ -2173,13 +2167,13 @@ bfd_mips_elf64_swap_reginfo_in (abfd, ex, in)
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
@@ -2188,20 +2182,13 @@ bfd_mips_elf64_swap_reginfo_out (abfd, in, ex)
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
@@ -2213,8 +2200,8 @@ bfd_mips_elf32_swap_gptab_in (abfd, ex, in)
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
@@ -2223,10 +2210,8 @@ bfd_mips_elf32_swap_gptab_out (abfd, in, ex)
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
@@ -2235,12 +2220,12 @@ bfd_elf32_swap_compact_rel_out (abfd, in, ex)
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
@@ -2255,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. */
@@ -2268,10 +2253,10 @@ bfd_mips_elf_swap_options_in (abfd, ex, in)
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. */
@@ -2282,10 +2267,10 @@ bfd_mips_elf_swap_options_out (abfd, in, ex)
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. */
@@ -2296,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. */
@@ -2308,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
@@ -2879,7 +2864,8 @@ _bfd_mips_elf_section_from_shdr (abfd, hdr, name)
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;
@@ -3060,11 +3046,11 @@ _bfd_mips_elf_fake_sections (abfd, hdr, sec)
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,
@@ -3118,8 +3104,8 @@ _bfd_mips_elf_set_section_contents (abfd, section, location, offset, count)
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;
}
@@ -3138,7 +3124,7 @@ _bfd_mips_elf_set_section_contents (abfd, section, location, offset, count)
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,
@@ -3165,10 +3151,10 @@ _bfd_mips_elf_section_processing (abfd, hdr)
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;
}
@@ -3204,10 +3190,10 @@ _bfd_mips_elf_section_processing (abfd, hdr)
+ (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)
@@ -3219,10 +3205,10 @@ _bfd_mips_elf_section_processing (abfd, hdr)
+ (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;
@@ -3401,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. */
@@ -3412,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;
@@ -3438,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;
@@ -3458,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;
@@ -3484,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;
@@ -3574,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;
@@ -3632,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
}
@@ -3665,7 +3652,7 @@ _bfd_mips_elf_read_ecoff_info (abfd, section, debug)
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;
@@ -3684,12 +3671,12 @@ _bfd_mips_elf_read_ecoff_info (abfd, section, debug)
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; \
}
@@ -3785,7 +3772,7 @@ _bfd_mips_elf_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
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;
@@ -3811,9 +3798,9 @@ _bfd_mips_elf_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
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;
@@ -3827,10 +3814,8 @@ _bfd_mips_elf_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
}
/* 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;
@@ -4031,9 +4016,9 @@ _bfd_mips_elf_link_hash_table_create (abfd)
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;
@@ -4101,12 +4086,14 @@ _bfd_mips_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
{
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;
@@ -4140,12 +4127,14 @@ _bfd_mips_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
{
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;
@@ -4431,7 +4420,8 @@ mips_elf_create_procedure_table (handle, abfd, info, s, debug)
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;
@@ -4464,7 +4454,8 @@ mips_elf_create_procedure_table (handle, abfd, info, s, debug)
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;
@@ -4485,7 +4476,7 @@ mips_elf_create_procedure_table (handle, abfd, info, s, debug)
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);
@@ -4526,7 +4517,7 @@ mips_elf_create_procedure_table (handle, abfd, info, s, debug)
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;
@@ -4598,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"
@@ -4749,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);
@@ -4782,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
@@ -4830,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;
@@ -4842,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;
}
@@ -4999,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
@@ -5007,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)
@@ -5077,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);
@@ -5122,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;
@@ -5149,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);
@@ -5193,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);
@@ -5236,7 +5228,7 @@ _bfd_mips_elf_final_link (abfd, info)
bfd_mips_elf32_swap_reginfo_out (abfd, &reginfo, &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;
}
@@ -6804,7 +6796,7 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
/* 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. */
@@ -6864,7 +6856,7 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
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
@@ -7234,7 +7226,7 @@ _bfd_mips_elf_create_dynamic_sections (abfd, info)
{
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;
@@ -7397,6 +7389,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))
@@ -7432,8 +7425,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;
@@ -7441,8 +7434,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;
}
@@ -7605,13 +7598,14 @@ _bfd_mips_elf_check_relocs (abfd, info, sec, relocs)
{
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;
@@ -7714,7 +7708,7 @@ _bfd_mips_elf_check_relocs (abfd, info, sec, relocs)
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);
@@ -7849,12 +7843,12 @@ _bfd_mips_elf_check_relocs (abfd, info, sec, relocs)
{
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
@@ -8133,7 +8127,7 @@ _bfd_mips_elf_adjust_dynamic_symbol (info, h)
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,
@@ -8220,7 +8214,8 @@ _bfd_mips_elf_always_size_sections (output_bfd, info)
/* 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)
@@ -8397,7 +8392,8 @@ _bfd_mips_elf_size_dynamic_sections (output_bfd, info)
{
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;
@@ -8697,18 +8693,18 @@ _bfd_mips_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
/* 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);
@@ -8982,7 +8978,7 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info)
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:
@@ -9158,7 +9154,7 @@ _bfd_elf32_mips_grok_prstatus (abfd, note)
Elf_Internal_Note *note;
{
int offset;
int raw_size;
unsigned int raw_size;
switch (note->descsz)
{
@@ -9240,7 +9236,7 @@ elf32_mips_get_relocated_section_contents (abfd, link_info, link_order, data,
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;
@@ -9248,7 +9244,7 @@ elf32_mips_get_relocated_section_contents (abfd, link_info, link_order, data,
if (!bfd_get_section_contents (input_bfd,
input_section,
(PTR) data,
0,
(file_ptr) 0,
input_section->_raw_size))
goto error_return;
+3 -3
View File
@@ -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_section
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 *,
+6 -6
View File
@@ -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_in, data, input_section, output_bfd,
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_in, data, input_section, output_bfd,
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_in, data, input_section, output_bfd,
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:
+39 -30
View File
@@ -1059,6 +1059,7 @@ ppc_elf_relax_section (abfd, isec, link_info, again)
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 +1071,9 @@ ppc_elf_relax_section (abfd, isec, link_info, again)
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 +1202,7 @@ ppc_elf_relax_section (abfd, isec, link_info, again)
#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;
}
}
@@ -2014,37 +2016,40 @@ ppc_elf_size_dynamic_sections (output_bfd, info)
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;
}
@@ -2200,15 +2205,16 @@ ppc_elf_check_relocs (abfd, info, sec, relocs)
/* 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_alloc (abfd, size);
if (local_got_refcounts == NULL)
return false;
elf_local_got_refcounts (abfd) = local_got_refcounts;
memset (local_got_refcounts, -1, size);
memset (local_got_refcounts, -1, (size_t) size);
}
if (local_got_refcounts[r_symndx] == -1)
{
@@ -2579,21 +2585,24 @@ ppc_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
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 +2706,7 @@ ppc_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
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 +2851,7 @@ ppc_elf_finish_dynamic_sections (output_bfd, info)
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);
@@ -3320,7 +3329,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
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 +3340,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
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 */
@@ -3568,7 +3577,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
{ /* 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;
@@ -3731,7 +3740,7 @@ ppc_elf_grok_prstatus (abfd, note)
Elf_Internal_Note *note;
{
int offset;
int raw_size;
unsigned int raw_size;
switch (note->descsz)
{
+86 -81
View File
@@ -104,7 +104,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 +157,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 +184,7 @@ elf_s390_info_to_howto (abfd, cache_ptr, dst)
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 +213,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 +227,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 +241,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 +334,7 @@ RET1: BASR 1,0 # 2 bytes Return from GOT 1st time
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 +456,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 +517,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
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)
@@ -598,15 +598,16 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
/* 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);
if (local_got_refcounts == NULL)
return false;
elf_local_got_refcounts (abfd) = local_got_refcounts;
memset (local_got_refcounts, -1, size);
memset (local_got_refcounts, -1, (size_t) size);
}
if (local_got_refcounts[r_symndx] == -1)
{
@@ -744,7 +745,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
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 +773,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_addend))
return false;
break;
default:
break;
}
@@ -1220,37 +1221,40 @@ elf_s390_size_dynamic_sections (output_bfd, info)
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;
}
@@ -1546,7 +1550,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
break;
case R_390_GOTOFF:
/* Relocation is relative to the start of the global offset
table. */
@@ -1798,7 +1802,7 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
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 +1811,82 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
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 +1937,7 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
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 +2074,31 @@ elf_s390_finish_dynamic_sections (output_bfd, info)
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);
+2 -2
View File
@@ -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)
{
+64 -57
View File
@@ -767,10 +767,10 @@ sh_elf_reloc_loop (r_type, input_bfd, input_section, contents, addr,
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, input_section, contents, addr,
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_in, data, input_section, output_bfd,
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_in, data, input_section, output_bfd,
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;
@@ -1120,7 +1120,7 @@ sh_elf_relax_section (abfd, sec, link_info, again)
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)
@@ -1151,13 +1151,12 @@ sh_elf_relax_section (abfd, sec, link_info, again)
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;
}
@@ -1251,7 +1250,7 @@ sh_elf_relax_section (abfd, sec, link_info, again)
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_info, again)
/* 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
@@ -1460,7 +1459,8 @@ sh_elf_relax_delete_bytes (abfd, sec, addr, 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));
if (irelalign == NULL)
sec->_cooked_size -= count;
else
@@ -1471,7 +1471,7 @@ sh_elf_relax_delete_bytes (abfd, sec, addr, count)
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, addr, count)
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, addr, count)
}
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, addr, count)
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:
@@ -1780,12 +1780,12 @@ sh_elf_relax_delete_bytes (abfd, sec, addr, count)
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, addr, count)
{
/* 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_relocs, contents, pswapped)
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, contents, addr)
/* 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, contents, addr)
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, contents, addr)
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, contents, addr)
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;
@@ -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, info)
|| ((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, info)
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;
}
@@ -3531,7 +3537,7 @@ sh_elf_get_relocated_section_contents (output_bfd, link_info, link_order,
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 +3545,19 @@ sh_elf_get_relocated_section_contents (output_bfd, link_info, link_order,
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 +3567,15 @@ sh_elf_get_relocated_section_contents (output_bfd, link_info, link_order,
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 +3834,11 @@ sh_elf_check_relocs (abfd, info, sec, relocs)
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 +3974,7 @@ sh_elf_check_relocs (abfd, info, sec, relocs)
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;
@@ -4220,7 +4227,7 @@ sh_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
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
+22 -18
View File
@@ -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, sec, relocs)
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 (output_bfd, info)
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;
}
@@ -1670,7 +1674,7 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
|| 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 +1761,7 @@ elf32_sparc_finish_dynamic_symbol (output_bfd, info, h, sym)
(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 +1804,7 @@ elf32_sparc_finish_dynamic_symbol (output_bfd, info, h, sym)
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 +1930,7 @@ elf32_sparc_finish_dynamic_sections (output_bfd, info)
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);
}
+21 -18
View File
@@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#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;
@@ -699,7 +699,8 @@ v850_elf_check_relocs (abfd, info, sec, relocs)
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, address)
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, already_found)
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_type, addend, address)
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_type, addend, address)
{
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_type, addend, address)
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_type, addend, address)
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_type, addend, address)
}
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, data, isection, obfd, err)
.text
.globl _start
nop
_start:
_start:
jr foo
.section ".foo","ax"
@@ -1363,7 +1365,7 @@ v850_elf_final_link_relocate (howto, input_bfd, output_bfd,
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, info, input_bfd, input_section,
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;
}
+77 -71
View File
@@ -163,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;
@@ -321,9 +321,9 @@ elf64_alpha_bfd_link_hash_table_create (abfd)
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;
@@ -375,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;
@@ -387,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;
@@ -803,8 +805,8 @@ elf64_alpha_do_reloc_gpdisp (abfd, gpdisp, p_ldah, p_lda)
| (((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;
}
@@ -1065,7 +1067,8 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend)
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;
}
@@ -1077,7 +1080,7 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend)
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;
@@ -1097,13 +1100,15 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend)
/* 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;
@@ -1136,7 +1141,8 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend)
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
@@ -1172,8 +1178,8 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend)
In that case the insn would use $27 as the base. */
if (ldah == 0x27ba0000 && lda == 0x23bd0000)
{
bfd_put_32 (info->abfd, INSN_UNOP, p_ldah);
bfd_put_32 (info->abfd, INSN_UNOP, p_lda);
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;
@@ -1204,7 +1210,8 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend)
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;
}
}
@@ -1317,7 +1324,7 @@ elf64_alpha_relax_without_lituse (info, symval, irel)
`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_GPREL16);
@@ -1444,13 +1451,12 @@ elf64_alpha_relax_section (abfd, sec, link_info, again)
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;
}
@@ -1586,10 +1592,10 @@ elf64_alpha_relax_section (abfd, sec, link_info, again)
/* 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 */
@@ -1857,7 +1863,7 @@ elf64_alpha_read_ecoff_info (abfd, section, debug)
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;
@@ -1876,12 +1882,12 @@ elf64_alpha_read_ecoff_info (abfd, section, debug)
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; \
}
@@ -1994,9 +2000,9 @@ elf64_alpha_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
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;
@@ -2010,10 +2016,8 @@ elf64_alpha_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
}
/* 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;
@@ -2225,6 +2229,7 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
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;
@@ -2278,9 +2283,9 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
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;
@@ -2303,16 +2308,16 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
/* 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;
}
@@ -2323,9 +2328,9 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
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;
@@ -2433,17 +2438,15 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
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;
}
@@ -2465,9 +2468,8 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
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;
@@ -3162,7 +3164,7 @@ elf64_alpha_size_dynamic_sections (output_bfd, info)
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;
}
@@ -3175,35 +3177,38 @@ elf64_alpha_size_dynamic_sections (output_bfd, info)
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;
}
@@ -3265,7 +3270,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
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);
@@ -3408,7 +3413,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
/* 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
@@ -3424,7 +3429,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
+ sgot->output_offset
+ gotent->got_offset);
outrel.r_info = ELF64_R_INFO(0, R_ALPHA_RELATIVE);
outrel.r_addend = relocation+addend;
outrel.r_addend = relocation + addend;
bfd_elf64_swap_reloca_out (output_bfd, &outrel,
((Elf64_External_Rela *)
@@ -3654,7 +3659,7 @@ elf64_alpha_finish_dynamic_symbol (output_bfd, info, h, sym)
/* 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;
@@ -3840,8 +3845,8 @@ elf64_alpha_finish_dynamic_sections (output_bfd, info)
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;
@@ -4103,7 +4108,8 @@ 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;
}
+40 -37
View File
@@ -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, sec_symndx, offset, addend)
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, relocs)
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, relocs)
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, relocs)
/* 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, relocs)
/* 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. */
@@ -1047,8 +1046,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 +1800,11 @@ elf64_hppa_size_dynamic_sections (output_bfd, info)
/* 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 +1814,36 @@ elf64_hppa_size_dynamic_sections (output_bfd, info)
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 +2028,13 @@ elf64_hppa_finish_dynamic_symbol (output_bfd, info, h, sym)
/* 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 +2045,7 @@ elf64_hppa_finish_dynamic_symbol (output_bfd, info, h, sym)
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 +2054,14 @@ elf64_hppa_finish_dynamic_symbol (output_bfd, info, h, sym)
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 +2573,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;
+49 -46
View File
@@ -1154,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. */
@@ -1170,13 +1170,13 @@ mips_elf64_swap_reloca_in (abfd, src, dst)
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. */
@@ -1187,12 +1187,12 @@ mips_elf64_swap_reloc_out (abfd, src, dst)
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. */
@@ -1203,13 +1203,13 @@ mips_elf64_swap_reloca_out (abfd, src, dst)
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. */
@@ -1310,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 },
@@ -1391,10 +1391,10 @@ mips_elf64_slurp_one_reloc_table (abfd, asect, symbols, rel_hdr)
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;
@@ -1583,6 +1583,7 @@ mips_elf64_slurp_reloc_table (abfd, asect, symbols, dynamic)
asymbol **symbols;
boolean dynamic;
{
bfd_size_type amt;
struct bfd_elf_section_data * const d = elf_section_data (asect);
if (dynamic)
@@ -1597,9 +1598,9 @@ mips_elf64_slurp_reloc_table (abfd, asect, symbols, dynamic)
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;
@@ -1785,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. */
@@ -1815,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);
@@ -1828,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;
@@ -1838,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);
@@ -1919,12 +1922,12 @@ mips_elf64_write_armap (arch, elength, map, symbol_count, stridx)
/* 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 -
@@ -1940,10 +1943,10 @@ mips_elf64_write_armap (arch, elength, map, symbol_count, stridx)
/* 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++;
}
@@ -1960,7 +1963,7 @@ mips_elf64_write_armap (arch, elength, map, symbol_count, stridx)
{
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;
}
@@ -1968,7 +1971,7 @@ mips_elf64_write_armap (arch, elength, map, symbol_count, stridx)
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;
}
+29 -24
View File
@@ -1724,15 +1724,16 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs)
/* 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_alloc (abfd, size));
if (local_got_refcounts == NULL)
return false;
elf_local_got_refcounts (abfd) = local_got_refcounts;
memset (local_got_refcounts, -1, size);
memset (local_got_refcounts, -1, (size_t) size);
}
if (local_got_refcounts[r_symndx] == -1)
{
@@ -2455,36 +2456,39 @@ ppc64_elf_size_dynamic_sections (output_bfd, info)
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_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 (reltext)
{
if (! bfd_elf64_add_dynamic_entry (info, DT_TEXTREL, 0))
if (!add_dynamic_entry (DT_TEXTREL, 0))
return false;
}
}
#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
@@ -2663,7 +2667,6 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
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",
@@ -2707,6 +2710,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
reloc_howto_type *howto;
unsigned long r_symndx;
bfd_vma relocation;
long insn;
r_type = (enum elf_ppc_reloc_type) ELF64_R_TYPE (rel->r_info);
offset = rel->r_offset;
@@ -2910,16 +2914,17 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
<= input_section->_cooked_size))
{
bfd_byte *pnext;
unsigned long insn;
pnext = contents + (rel->r_offset - input_section->vma) + 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) */
bfd_put_32 (input_bfd,
(bfd_vma) 0xe8410028, /* ld r2,40(r1) */
pnext);
#ifdef DEBUG
fprintf (stderr, "ppc64_elf_relocate_section: " \
"patched nop after call to %s\n", sym_name);
@@ -3118,7 +3123,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
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. */
@@ -3129,7 +3134,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
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;
@@ -3461,7 +3466,7 @@ ppc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
+ (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");
@@ -3535,7 +3540,7 @@ ppc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
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
+37 -34
View File
@@ -289,14 +289,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 +313,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 +415,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;
@@ -562,15 +562,15 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
/* 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_alloc (abfd, size));
if (local_got_refcounts == NULL)
return false;
elf_local_got_refcounts (abfd) = local_got_refcounts;
memset (local_got_refcounts, -1, size);
memset (local_got_refcounts, -1, (size_t) size);
}
if (local_got_refcounts[r_symndx] == -1)
{
@@ -718,7 +718,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
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 +1200,40 @@ elf_s390_size_dynamic_sections (output_bfd, info)
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;
}
@@ -1886,7 +1889,7 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
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

Some files were not shown because too many files have changed in this diff Show More